Issue 327: fixed caching bug

This commit is contained in:
Adrian Cole 2010-08-15 11:53:27 -07:00
parent 09e155bf0d
commit 3363f62b83
2 changed files with 28 additions and 8 deletions

View File

@ -86,7 +86,6 @@ import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
/**
* Configures the VCloud authentication service connection, including logging
@ -106,12 +105,6 @@ public abstract class BaseVCloudRestClientModule<S extends VCloudClient, A exten
@Override
protected void configure() {
requestInjection(this);
bind(new TypeLiteral<Supplier<Map<String, NamedResource>>>() {
}).annotatedWith(Org.class).to(new TypeLiteral<OrgNameToOrgSupplier>() {
});
bind(new TypeLiteral<Supplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>>>() {
}).to(new TypeLiteral<URItoVDC>() {
});
super.configure();
}
@ -145,6 +138,33 @@ public abstract class BaseVCloudRestClientModule<S extends VCloudClient, A exten
return getLast(orgs).getName();
}
@Provides
@Org
@Singleton
protected Supplier<Map<String, NamedResource>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
final OrgNameToOrgSupplier supplier) {
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, NamedResource>>(authException,
seconds, new Supplier<Map<String, NamedResource>>() {
@Override
public Map<String, NamedResource> get() {
return supplier.get();
}
});
}
@Provides
@Singleton
protected Supplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>> provideVDCtoORG(
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final URItoVDC supplier) {
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>>(
authException, seconds, new Supplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>>() {
@Override
public Map<URI, ? extends org.jclouds.vcloud.domain.VDC> get() {
return supplier.get();
}
});
}
@Provides
@Singleton
@VDC

View File

@ -238,7 +238,7 @@ public class TerremarkVCloudComputeClient extends BaseVCloudComputeClient {
}
void blockOnLastTask(VApp vApp) {
TasksList list = client.getTasksList(vApp.getVDC());
TasksList list = client.findTasksListInOrgNamed(null, null);
try {
Task lastTask = getLast(filter(list.getTasks(), new Predicate<Task>() {