[Swift-commit] cog r3786

swift at ci.uchicago.edu swift at ci.uchicago.edu
Mon Sep 16 01:55:03 CDT 2013


------------------------------------------------------------------------
r3786 | hategan | 2013-09-16 01:54:41 -0500 (Mon, 16 Sep 2013) | 1 line

also do a local lock when shared proxies are disabled to avoid problems when using multiple services
------------------------------------------------------------------------
Index: modules/provider-coaster/src/org/globus/cog/abstraction/impl/execution/coaster/AutoCA.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/impl/execution/coaster/AutoCA.java	(revision 3785)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/impl/execution/coaster/AutoCA.java	(working copy)
@@ -27,6 +27,8 @@
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 
 import org.apache.log4j.Logger;
 import org.bouncycastle.asn1.ASN1InputStream;
@@ -94,6 +96,7 @@
     private Info info;
     private X509Certificate cert;
     private X509V3CertificateGenerator gen;
+    private Lock jvmLock;
 
     public synchronized static AutoCA getInstance() {
         if (instance == null) {
@@ -104,6 +107,7 @@
     
     public AutoCA() {
          gen = new X509V3CertificateGenerator();
+         jvmLock = new ReentrantLock();
     }
     
     public static class Info {
@@ -127,7 +131,7 @@
     private void ensureCACertsExist() throws IOException, GeneralSecurityException {
         // delete expired CAs, make a new one if the existing ones don't have
         // at least MIN_CA_LIFETIME_LEFT
-        FileLock fl = lockDir(CA_DIR);
+        Object fl = lockDir(CA_DIR);
         
         try {
             File[] certs = discoverProxies();
@@ -184,13 +188,16 @@
         }
     }
     
-    private void unlock(FileLock fl) throws IOException {
-        if (fl != null) {
-            fl.unlock();
+    private void unlock(Object fl) throws IOException {
+        if (SHARED_PROXIES) {
+            ((FileLock) fl).unlock();
         }
+        else {
+            ((Lock) fl).unlock();
+        }
     }
 
-    private FileLock lockDir(String caDir) {
+    private Object lockDir(String caDir) {
         if (SHARED_PROXIES) {
             FileLock fl = new FileLock(CA_DIR);
             try {
@@ -202,7 +209,8 @@
             return fl;
         }
         else {
-            return null;
+            jvmLock.lock();
+            return jvmLock;
         }
     }
 



More information about the Swift-commit mailing list