|
|
@@ -50,6 +50,8 @@ public class AmazonEC2Driver extends ComputeServiceDriverBase { |
|
|
|
@Getter(lazy=true) private final AWSCredentialsProvider ec2credentials = new BubbleAwsCredentialsProvider(cloud, getCredentials()); |
|
|
|
@Getter(lazy=true) private final Map<String, AmazonEC2> ec2ClientMap = new HashMap<>(); |
|
|
|
|
|
|
|
private static final ExecutorService perRegionExecutor = fixedPool(8); |
|
|
|
|
|
|
|
private AmazonEC2 getEC2Client(final String regionName) { |
|
|
|
Map<String, AmazonEC2> ec2ClientMap = getEc2ClientMap(); |
|
|
|
AmazonEC2 ec2client; |
|
|
@@ -79,12 +81,10 @@ public class AmazonEC2Driver extends ComputeServiceDriverBase { |
|
|
|
throw new UnsupportedOperationException(); |
|
|
|
} |
|
|
|
|
|
|
|
private static final ExecutorService perRegionExecutor = fixedPool(8); |
|
|
|
|
|
|
|
@Override public List<BubbleNode> listNodes() throws IOException { |
|
|
|
List<Future<?>> listNodeJobs = new ArrayList<>(); |
|
|
|
for (final String regionName : getEc2ClientMap().keySet()) { |
|
|
|
listNodeJobs.add(perRegionExecutor.submit(new listNodesForRegion(regionName))); |
|
|
|
listNodeJobs.add(perRegionExecutor.submit(new listNodesHelper(regionName))); |
|
|
|
} |
|
|
|
AwaitResult awaitResult = awaitAll(listNodeJobs, TIMEOUT); |
|
|
|
if (!awaitResult.allSucceeded()) { |
|
|
@@ -97,10 +97,10 @@ public class AmazonEC2Driver extends ComputeServiceDriverBase { |
|
|
|
return nodes; |
|
|
|
} |
|
|
|
|
|
|
|
private class listNodesForRegion implements Callable<List<BubbleNode>> { |
|
|
|
private class listNodesHelper implements Callable<List<BubbleNode>> { |
|
|
|
private String regionName; |
|
|
|
|
|
|
|
public listNodesForRegion(String regionName) { |
|
|
|
public listNodesHelper(String regionName) { |
|
|
|
this.regionName = regionName; |
|
|
|
} |
|
|
|
|
|
|
@@ -133,7 +133,12 @@ public class AmazonEC2Driver extends ComputeServiceDriverBase { |
|
|
|
} |
|
|
|
|
|
|
|
@Override public List<BubbleNode> call() throws Exception { |
|
|
|
return listNodesForSingleRegion(this.regionName); |
|
|
|
try { |
|
|
|
return listNodesForSingleRegion(this.regionName); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("listNodesHelper.call: " + e, e); |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|