mirror of https://github.com/apache/jclouds.git
JCLOUDS-153 Remove deprecated ExecutorService and HttpAsyncClient accessors.
This commit is contained in:
parent
ce76144e3b
commit
1a54f0fb09
|
@ -18,10 +18,8 @@ package org.jclouds.compute.internal;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.compute.Utils;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.crypto.Crypto;
|
||||
|
@ -36,7 +34,6 @@ import org.jclouds.xml.XMLParser;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
@ -46,15 +43,10 @@ public class UtilsImpl extends org.jclouds.rest.internal.UtilsImpl implements Ut
|
|||
private Factory sshFactory;
|
||||
private final Function<NodeMetadata, SshClient> sshForNode;
|
||||
|
||||
@Inject
|
||||
UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient,
|
||||
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,
|
||||
@Inject UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient, Crypto encryption,
|
||||
DateService date, EventBus eventBus, Map<String, Credentials> credentialStore, LoggerFactory loggerFactory,
|
||||
Function<NodeMetadata, SshClient> sshForNode) {
|
||||
super(injector, json, xml, simpleClient, simpleAsyncClient, encryption, date, userExecutor, ioExecutor, eventBus,
|
||||
credentialStore, loggerFactory);
|
||||
super(injector, json, xml, simpleClient, encryption, date, eventBus, credentialStore, loggerFactory);
|
||||
this.sshForNode = sshForNode;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import static java.lang.String.format;
|
|||
import static java.lang.System.currentTimeMillis;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
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.wrapInInitScript;
|
||||
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.TimeoutException;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
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.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.google.inject.Key;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.name.Names;
|
||||
|
||||
@Test(groups = { "integration", "live" }, singleThreaded = true)
|
||||
public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceContextLiveTest {
|
||||
|
@ -448,7 +453,8 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
|||
final long timeoutMs = 20 * 60 * 1000;
|
||||
List<String> groups = 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 {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.jclouds.xml.XMLParser;
|
|||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.inject.ImplementedBy;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
@ -56,34 +55,12 @@ public interface Utils {
|
|||
|
||||
Json json();
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated will be removed in jclouds 1.7, as async interfaces are no
|
||||
* longer supported.
|
||||
*/
|
||||
@Deprecated
|
||||
HttpAsyncClient asyncHttp();
|
||||
|
||||
HttpClient http();
|
||||
|
||||
Crypto crypto();
|
||||
|
||||
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();
|
||||
|
||||
LoggerFactory loggerFactory();
|
||||
|
@ -92,5 +69,4 @@ public interface Utils {
|
|||
Injector injector();
|
||||
|
||||
XMLParser xml();
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
|||
|
||||
import org.jclouds.reflect.Invocation;
|
||||
import org.jclouds.rest.ConfiguresHttpApi;
|
||||
import org.jclouds.rest.HttpAsyncClient;
|
||||
import org.jclouds.rest.HttpClient;
|
||||
import org.jclouds.rest.internal.InvokeHttpMethod;
|
||||
|
||||
|
@ -56,8 +55,6 @@ public class HttpApiModule<A> extends RestModule {
|
|||
}).to(InvokeHttpMethod.class);
|
||||
bindHttpApi(binder(), api);
|
||||
bindHttpApi(binder(), HttpClient.class);
|
||||
// TODO: remove when references are gone
|
||||
bindHttpApi(binder(), HttpAsyncClient.class);
|
||||
bindErrorHandlers();
|
||||
bindRetryHandlers();
|
||||
}
|
||||
|
|
|
@ -19,9 +19,7 @@ package org.jclouds.rest.internal;
|
|||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.crypto.Crypto;
|
||||
import org.jclouds.date.DateService;
|
||||
import org.jclouds.domain.Credentials;
|
||||
|
@ -33,7 +31,6 @@ import org.jclouds.xml.XMLParser;
|
|||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
|
@ -42,11 +39,8 @@ public class UtilsImpl implements Utils {
|
|||
|
||||
private final Json json;
|
||||
private final HttpClient simpleClient;
|
||||
private final org.jclouds.rest.HttpAsyncClient simpleAsyncClient;
|
||||
private final Crypto encryption;
|
||||
private final DateService date;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final ListeningExecutorService ioExecutor;
|
||||
private final EventBus eventBus;
|
||||
private final Map<String, Credentials> credentialStore;
|
||||
private final LoggerFactory loggerFactory;
|
||||
|
@ -54,30 +48,19 @@ public class UtilsImpl implements Utils {
|
|||
private XMLParser xml;
|
||||
|
||||
@Inject
|
||||
protected UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient, 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) {
|
||||
protected UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient, Crypto encryption,
|
||||
DateService date, EventBus eventBus, Map<String, Credentials> credentialStore, LoggerFactory loggerFactory) {
|
||||
this.injector = injector;
|
||||
this.json = json;
|
||||
this.simpleClient = simpleClient;
|
||||
this.simpleAsyncClient = simpleAsyncClient;
|
||||
this.encryption = encryption;
|
||||
this.date = date;
|
||||
this.userExecutor = userExecutor;
|
||||
this.ioExecutor = ioExecutor;
|
||||
this.eventBus = eventBus;
|
||||
this.credentialStore = credentialStore;
|
||||
this.loggerFactory = loggerFactory;
|
||||
this.xml = xml;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public org.jclouds.rest.HttpAsyncClient asyncHttp() {
|
||||
return simpleAsyncClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DateService date() {
|
||||
return date;
|
||||
|
@ -93,16 +76,6 @@ public class UtilsImpl implements Utils {
|
|||
return simpleClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListeningExecutorService ioExecutor() {
|
||||
return ioExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListeningExecutorService userExecutor() {
|
||||
return userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventBus eventBus() {
|
||||
return eventBus;
|
||||
|
|
Loading…
Reference in New Issue