mirror of https://github.com/apache/jclouds.git
Issue 519:update to guava r09
This commit is contained in:
parent
5f43dbb6fa
commit
c9a4534849
|
@ -110,7 +110,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>r08</version>
|
<version>r09</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.findbugs</groupId>
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
|
|
@ -264,11 +264,11 @@ public class Futures {
|
||||||
return Futures.LazyListenableFutureFunctionAdapter.create(
|
return Futures.LazyListenableFutureFunctionAdapter.create(
|
||||||
((org.jclouds.concurrent.Futures.ListenableFutureAdapter<I>) future).futureListener, function);
|
((org.jclouds.concurrent.Futures.ListenableFutureAdapter<I>) future).futureListener, function);
|
||||||
else
|
else
|
||||||
return com.google.common.util.concurrent.Futures.compose(lf, function, executorService);
|
return com.google.common.util.concurrent.Futures.transform(lf, function, executorService);
|
||||||
} else if (executorService.getClass().isAnnotationPresent(SingleThreaded.class)) {
|
} else if (executorService.getClass().isAnnotationPresent(SingleThreaded.class)) {
|
||||||
return Futures.LazyListenableFutureFunctionAdapter.create(future, function, executorService);
|
return Futures.LazyListenableFutureFunctionAdapter.create(future, function, executorService);
|
||||||
} else {
|
} else {
|
||||||
return com.google.common.util.concurrent.Futures.compose(Futures.makeListenable(future, executorService),
|
return com.google.common.util.concurrent.Futures.transform(Futures.makeListenable(future, executorService),
|
||||||
function, executorService);
|
function, executorService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class ExecutorServiceModule extends AbstractModule {
|
||||||
return new AddToStringFuture<T>(delegate.submit(task), task.toString());
|
return new AddToStringFuture<T>(delegate.submit(task), task.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
public Future<?> submit(Runnable task) {
|
public Future<?> submit(Runnable task) {
|
||||||
return new AddToStringFuture(delegate.submit(task), task.toString());
|
return new AddToStringFuture(delegate.submit(task), task.toString());
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class Utils {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static Iterable<String> getSupportedProvidersOfTypeInProperties(
|
public static Iterable<String> getSupportedProvidersOfTypeInProperties(
|
||||||
final Class<? extends RestContextBuilder> type, final Properties properties) {
|
final Class<? extends RestContextBuilder<?,?>> type, final Properties properties) {
|
||||||
return Providers.getSupportedProvidersOfTypeInProperties(type, properties);
|
return Providers.getSupportedProvidersOfTypeInProperties(type, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,23 +53,23 @@ import com.google.common.collect.Sets;
|
||||||
* <li>{@code LISTENER_DURATION} is the time that the attached listener or function</li>
|
* <li>{@code LISTENER_DURATION} is the time that the attached listener or function</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
* The execution time of a composed task within a composite should not be more than {@code
|
* The execution time of a transformd task within a composite should not be more than {@code
|
||||||
* IO_DURATION} + {@code LISTENER_DURATION} + overhead when a threadpool is used. This is because
|
* IO_DURATION} + {@code LISTENER_DURATION} + overhead when a threadpool is used. This is because
|
||||||
* the listener should be invoked as soon as the result is available.
|
* the listener should be invoked as soon as the result is available.
|
||||||
* <p/>
|
* <p/>
|
||||||
* The execution time of a composed task within a composite should not be more than {@code
|
* The execution time of a transformd task within a composite should not be more than {@code
|
||||||
* IO_DURATION} + {@code LISTENER_DURATION} * {@code COUNT} + overhead when caller thread is used
|
* IO_DURATION} + {@code LISTENER_DURATION} * {@code COUNT} + overhead when caller thread is used
|
||||||
* for handling the listeners.
|
* for handling the listeners.
|
||||||
* <p/>
|
* <p/>
|
||||||
* This test shows that Futures.compose eagerly issues a get() on the source future. code iterating
|
* This test shows that Futures.transform eagerly issues a get() on the source future. code iterating
|
||||||
* over futures and assigning listeners will take the same amount of time as calling get() on each
|
* over futures and assigning listeners will take the same amount of time as calling get() on each
|
||||||
* one, if using a within thread executor. This exposes an inefficiency which can make some use
|
* one, if using a within thread executor. This exposes an inefficiency which can make some use
|
||||||
* cases in google appengine impossible to achieve within the cutoff limits.
|
* cases in google appengine impossible to achieve within the cutoff limits.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "performance", enabled = false, sequential = true, testName = "FuturesComposePerformanceTest")
|
@Test(groups = "performance", enabled = false, sequential = true, testName = "FuturesTransformPerformanceTest")
|
||||||
public class FuturesComposePerformanceTest {
|
public class FuturesTransformPerformanceTest {
|
||||||
private static final int FUDGE = 5;
|
private static final int FUDGE = 5;
|
||||||
private static final int COUNT = 100;
|
private static final int COUNT = 100;
|
||||||
private static final int IO_DURATION = 50;
|
private static final int IO_DURATION = 50;
|
||||||
|
@ -93,7 +93,7 @@ public class FuturesComposePerformanceTest {
|
||||||
ExecutorService chainExecutor = userthreads;
|
ExecutorService chainExecutor = userthreads;
|
||||||
ExecutorService listenerExecutor = userthreads;
|
ExecutorService listenerExecutor = userthreads;
|
||||||
|
|
||||||
checkThresholdsUsingFuturesCompose(expectedMin, expectedMax, expectedOverhead, chainExecutor, listenerExecutor);
|
checkThresholdsUsingFuturesTransform(expectedMin, expectedMax, expectedOverhead, chainExecutor, listenerExecutor);
|
||||||
} finally {
|
} finally {
|
||||||
userthreads.shutdownNow();
|
userthreads.shutdownNow();
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ public class FuturesComposePerformanceTest {
|
||||||
ExecutorService chainExecutor = userthreads;
|
ExecutorService chainExecutor = userthreads;
|
||||||
ExecutorService listenerExecutor = MoreExecutors.sameThreadExecutor();
|
ExecutorService listenerExecutor = MoreExecutors.sameThreadExecutor();
|
||||||
|
|
||||||
checkThresholdsUsingFuturesCompose(expectedMin, expectedMax, expectedOverhead, chainExecutor, listenerExecutor);
|
checkThresholdsUsingFuturesTransform(expectedMin, expectedMax, expectedOverhead, chainExecutor, listenerExecutor);
|
||||||
} finally {
|
} finally {
|
||||||
userthreads.shutdownNow();
|
userthreads.shutdownNow();
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public class FuturesComposePerformanceTest {
|
||||||
ExecutorService chainExecutor = MoreExecutors.sameThreadExecutor();
|
ExecutorService chainExecutor = MoreExecutors.sameThreadExecutor();
|
||||||
ExecutorService listenerExecutor = userthreads;
|
ExecutorService listenerExecutor = userthreads;
|
||||||
|
|
||||||
checkThresholdsUsingFuturesCompose(expectedMin, expectedMax, expectedOverhead, chainExecutor, listenerExecutor);
|
checkThresholdsUsingFuturesTransform(expectedMin, expectedMax, expectedOverhead, chainExecutor, listenerExecutor);
|
||||||
} finally {
|
} finally {
|
||||||
userthreads.shutdownNow();
|
userthreads.shutdownNow();
|
||||||
}
|
}
|
||||||
|
@ -165,18 +165,18 @@ public class FuturesComposePerformanceTest {
|
||||||
ExecutorService chainExecutor = MoreExecutors.sameThreadExecutor();
|
ExecutorService chainExecutor = MoreExecutors.sameThreadExecutor();
|
||||||
ExecutorService listenerExecutor = MoreExecutors.sameThreadExecutor();
|
ExecutorService listenerExecutor = MoreExecutors.sameThreadExecutor();
|
||||||
|
|
||||||
checkThresholdsUsingFuturesCompose(expectedMin, expectedMax, expectedOverhead, chainExecutor, listenerExecutor);
|
checkThresholdsUsingFuturesTransform(expectedMin, expectedMax, expectedOverhead, chainExecutor, listenerExecutor);
|
||||||
} finally {
|
} finally {
|
||||||
userthreads.shutdownNow();
|
userthreads.shutdownNow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkThresholdsUsingFuturesCompose(long expectedMin, long expectedMax, long expectedOverhead,
|
private void checkThresholdsUsingFuturesTransform(long expectedMin, long expectedMax, long expectedOverhead,
|
||||||
ExecutorService chainExecutor, final ExecutorService listenerExecutor) {
|
ExecutorService chainExecutor, final ExecutorService listenerExecutor) {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
Map<String, Future<Long>> responses = newHashMap();
|
Map<String, Future<Long>> responses = newHashMap();
|
||||||
for (int i = 0; i < COUNT; i++)
|
for (int i = 0; i < COUNT; i++)
|
||||||
responses.put(i + "", Futures.compose(Futures.makeListenable(simultateIO(), chainExecutor),
|
responses.put(i + "", Futures.transform(Futures.makeListenable(simultateIO(), chainExecutor),
|
||||||
new Function<Long, Long>() {
|
new Function<Long, Long>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -39,7 +39,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>r08</version>
|
<version>r09</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.findbugs</groupId>
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
|
Loading…
Reference in New Issue