Permalink
Browse files

Added option to disable affinity cache

  • Loading branch information...
1 parent d374f0c commit c204a9204748e087ef9baf160a307a0358fd8a6d @timf committed Mar 8, 2013
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/main/java/org/dasein/cloud/aws/storage/S3.java
@@ -73,6 +73,11 @@
static public final Storage<org.dasein.util.uom.storage.Byte> MAX_OBJECT_SIZE = new Storage<org.dasein.util.uom.storage.Byte>(5000000000L, Storage.BYTE);
static private final Random random = new Random();
+ static private final boolean disableAffinityCache;
+ static {
+ String disableStr = System.getProperty("disable.dasein.cloud.affinity.cache");
+ disableAffinityCache = "true".equals(disableStr);
+ }
static private class Constraint {
public String regionId;
@@ -254,12 +259,11 @@ private String getRegion(@Nonnull String bucket, boolean reload) throws CloudExc
}
Constraint c = affinity.constraints.get(bucket);
- if( reload || c == null || c.timeout <= System.currentTimeMillis() ) {
- S3Method method = new S3Method(provider, S3Action.LOCATE_BUCKET);
+ if( disableAffinityCache || reload || c == null || c.timeout <= System.currentTimeMillis() ) {
String location = null;
S3Response response;
- method = new S3Method(provider, S3Action.LOCATE_BUCKET);
+ S3Method method = new S3Method(provider, S3Action.LOCATE_BUCKET);
try {
response = method.invoke(bucket, "?location");
}

0 comments on commit c204a92

Please sign in to comment.