JCLOUDS-153 Remove deprecated ExecutorService and HttpAsyncClient accessors.

This commit is contained in:
Adrian Cole 2014-10-05 13:57:10 -07:00
parent ce76144e3b
commit 1a54f0fb09
5 changed files with 12 additions and 68 deletions

View File

@ -18,10 +18,8 @@ package org.jclouds.compute.internal;
import java.util.Map; import java.util.Map;
import javax.inject.Named;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.Constants;
import org.jclouds.compute.Utils; import org.jclouds.compute.Utils;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.crypto.Crypto; import org.jclouds.crypto.Crypto;
@ -36,7 +34,6 @@ import org.jclouds.xml.XMLParser;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.google.inject.Injector; import com.google.inject.Injector;
@ -46,15 +43,10 @@ public class UtilsImpl extends org.jclouds.rest.internal.UtilsImpl implements Ut
private Factory sshFactory; private Factory sshFactory;
private final Function<NodeMetadata, SshClient> sshForNode; private final Function<NodeMetadata, SshClient> sshForNode;
@Inject @Inject UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient, Crypto encryption,
UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient, DateService date, EventBus eventBus, Map<String, Credentials> credentialStore, LoggerFactory loggerFactory,
org.jclouds.rest.HttpAsyncClient simpleAsyncClient, Crypto encryption, DateService date,
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor, EventBus eventBus,
Map<String, Credentials> credentialStore, LoggerFactory loggerFactory,
Function<NodeMetadata, SshClient> sshForNode) { Function<NodeMetadata, SshClient> sshForNode) {
super(injector, json, xml, simpleClient, simpleAsyncClient, encryption, date, userExecutor, ioExecutor, eventBus, super(injector, json, xml, simpleClient, encryption, date, eventBus, credentialStore, loggerFactory);
credentialStore, loggerFactory);
this.sshForNode = sshForNode; this.sshForNode = sshForNode;
} }

View File

@ -33,6 +33,7 @@ import static java.lang.String.format;
import static java.lang.System.currentTimeMillis; import static java.lang.System.currentTimeMillis;
import static java.util.concurrent.TimeUnit.SECONDS; import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.logging.Logger.getAnonymousLogger; import static java.util.logging.Logger.getAnonymousLogger;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import static org.jclouds.compute.options.RunScriptOptions.Builder.nameTask; import static org.jclouds.compute.options.RunScriptOptions.Builder.nameTask;
import static org.jclouds.compute.options.RunScriptOptions.Builder.wrapInInitScript; import static org.jclouds.compute.options.RunScriptOptions.Builder.wrapInInitScript;
import static org.jclouds.compute.options.TemplateOptions.Builder.overrideLoginCredentials; import static org.jclouds.compute.options.TemplateOptions.Builder.overrideLoginCredentials;
@ -63,6 +64,8 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import javax.inject.Named;
import org.jclouds.compute.ComputeService; import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeTestUtils; import org.jclouds.compute.ComputeTestUtils;
@ -111,7 +114,9 @@ import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.MoreExecutors;
import com.google.inject.Key;
import com.google.inject.Module; import com.google.inject.Module;
import com.google.inject.name.Names;
@Test(groups = { "integration", "live" }, singleThreaded = true) @Test(groups = { "integration", "live" }, singleThreaded = true)
public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceContextLiveTest { public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceContextLiveTest {
@ -448,7 +453,8 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
final long timeoutMs = 20 * 60 * 1000; final long timeoutMs = 20 * 60 * 1000;
List<String> groups = Lists.newArrayList(); List<String> groups = Lists.newArrayList();
List<ListenableFuture<NodeMetadata>> futures = Lists.newArrayList(); List<ListenableFuture<NodeMetadata>> futures = Lists.newArrayList();
ListeningExecutorService userExecutor = MoreExecutors.listeningDecorator(context.utils().userExecutor()); ListeningExecutorService userExecutor = context.utils().injector()
.getInstance(Key.get(ListeningExecutorService.class, Names.named(PROPERTY_USER_THREADS)));
try { try {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {

View File

@ -28,7 +28,6 @@ import org.jclouds.xml.XMLParser;
import com.google.common.annotations.Beta; import com.google.common.annotations.Beta;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.ImplementedBy; import com.google.inject.ImplementedBy;
import com.google.inject.Injector; import com.google.inject.Injector;
@ -56,34 +55,12 @@ public interface Utils {
Json json(); Json json();
/**
*
* @deprecated will be removed in jclouds 1.7, as async interfaces are no
* longer supported.
*/
@Deprecated
HttpAsyncClient asyncHttp();
HttpClient http(); HttpClient http();
Crypto crypto(); Crypto crypto();
DateService date(); DateService date();
/**
* @deprecated will be removed in jclouds 1.7, as async interfaces are no
* longer supported.
*/
@Deprecated
ListeningExecutorService userExecutor();
/**
* @deprecated will be removed in jclouds 1.7, as async interfaces are no
* longer supported.
*/
@Deprecated
ListeningExecutorService ioExecutor();
EventBus eventBus(); EventBus eventBus();
LoggerFactory loggerFactory(); LoggerFactory loggerFactory();
@ -92,5 +69,4 @@ public interface Utils {
Injector injector(); Injector injector();
XMLParser xml(); XMLParser xml();
} }

View File

@ -21,7 +21,6 @@ import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
import org.jclouds.reflect.Invocation; import org.jclouds.reflect.Invocation;
import org.jclouds.rest.ConfiguresHttpApi; import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.HttpAsyncClient;
import org.jclouds.rest.HttpClient; import org.jclouds.rest.HttpClient;
import org.jclouds.rest.internal.InvokeHttpMethod; import org.jclouds.rest.internal.InvokeHttpMethod;
@ -56,8 +55,6 @@ public class HttpApiModule<A> extends RestModule {
}).to(InvokeHttpMethod.class); }).to(InvokeHttpMethod.class);
bindHttpApi(binder(), api); bindHttpApi(binder(), api);
bindHttpApi(binder(), HttpClient.class); bindHttpApi(binder(), HttpClient.class);
// TODO: remove when references are gone
bindHttpApi(binder(), HttpAsyncClient.class);
bindErrorHandlers(); bindErrorHandlers();
bindRetryHandlers(); bindRetryHandlers();
} }

View File

@ -19,9 +19,7 @@ package org.jclouds.rest.internal;
import java.util.Map; import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named;
import org.jclouds.Constants;
import org.jclouds.crypto.Crypto; import org.jclouds.crypto.Crypto;
import org.jclouds.date.DateService; import org.jclouds.date.DateService;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
@ -33,7 +31,6 @@ import org.jclouds.xml.XMLParser;
import com.google.common.annotations.Beta; import com.google.common.annotations.Beta;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Singleton; import com.google.inject.Singleton;
@ -42,11 +39,8 @@ public class UtilsImpl implements Utils {
private final Json json; private final Json json;
private final HttpClient simpleClient; private final HttpClient simpleClient;
private final org.jclouds.rest.HttpAsyncClient simpleAsyncClient;
private final Crypto encryption; private final Crypto encryption;
private final DateService date; private final DateService date;
private final ListeningExecutorService userExecutor;
private final ListeningExecutorService ioExecutor;
private final EventBus eventBus; private final EventBus eventBus;
private final Map<String, Credentials> credentialStore; private final Map<String, Credentials> credentialStore;
private final LoggerFactory loggerFactory; private final LoggerFactory loggerFactory;
@ -54,30 +48,19 @@ public class UtilsImpl implements Utils {
private XMLParser xml; private XMLParser xml;
@Inject @Inject
protected UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient, org.jclouds.rest.HttpAsyncClient simpleAsyncClient, protected UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient, Crypto encryption,
Crypto encryption, DateService date, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, DateService date, EventBus eventBus, Map<String, Credentials> credentialStore, LoggerFactory loggerFactory) {
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor, EventBus eventBus,
Map<String, Credentials> credentialStore, LoggerFactory loggerFactory) {
this.injector = injector; this.injector = injector;
this.json = json; this.json = json;
this.simpleClient = simpleClient; this.simpleClient = simpleClient;
this.simpleAsyncClient = simpleAsyncClient;
this.encryption = encryption; this.encryption = encryption;
this.date = date; this.date = date;
this.userExecutor = userExecutor;
this.ioExecutor = ioExecutor;
this.eventBus = eventBus; this.eventBus = eventBus;
this.credentialStore = credentialStore; this.credentialStore = credentialStore;
this.loggerFactory = loggerFactory; this.loggerFactory = loggerFactory;
this.xml = xml; this.xml = xml;
} }
@Override
@Deprecated
public org.jclouds.rest.HttpAsyncClient asyncHttp() {
return simpleAsyncClient;
}
@Override @Override
public DateService date() { public DateService date() {
return date; return date;
@ -93,16 +76,6 @@ public class UtilsImpl implements Utils {
return simpleClient; return simpleClient;
} }
@Override
public ListeningExecutorService ioExecutor() {
return ioExecutor;
}
@Override
public ListeningExecutorService userExecutor() {
return userExecutor;
}
@Override @Override
public EventBus eventBus() { public EventBus eventBus() {
return eventBus; return eventBus;