[Swift-commit] cog r3787
swift at ci.uchicago.edu
swift at ci.uchicago.edu
Mon Sep 16 02:00:04 CDT 2013
------------------------------------------------------------------------
r3787 | hategan | 2013-09-16 01:56:57 -0500 (Mon, 16 Sep 2013) | 1 line
merged r3786 from trunk
------------------------------------------------------------------------
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 3786)
+++ 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();
@@ -180,13 +184,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 {
@@ -198,7 +205,8 @@
return fl;
}
else {
- return null;
+ jvmLock.lock();
+ return jvmLock;
}
}
More information about the Swift-commit
mailing list