From 31e92dcba4bd93fc4fa4892509170583028bb206 Mon Sep 17 00:00:00 2001 From: Matt Jacobs Date: Thu, 26 Mar 2015 22:20:45 -0700 Subject: [PATCH] Revert back to JDK6 --- build.gradle | 4 +- .../cache/CacheInvocationContextFactory.java | 4 +- .../cache/HystrixCacheKeyGenerator.java | 6 +- .../command/MethodExecutionAction.java | 4 +- .../javanica/test/spring/cache/CacheTest.java | 2 +- .../spring/error/ErrorPropagationTest.java | 2 +- .../HystrixMetricsStreamServlet.java | 4 +- .../HystrixMetricsStreamHandlerTest.java | 2 +- ...HystrixServoMetricsPublisherCollapser.java | 2 +- .../HystrixServoMetricsPublisherCommand.java | 2 +- ...ystrixServoMetricsPublisherThreadPool.java | 2 +- .../com/netflix/hystrix/AbstractCommand.java | 24 +++---- .../java/com/netflix/hystrix/Hystrix.java | 2 +- .../hystrix/HystrixCircuitBreaker.java | 2 +- .../com/netflix/hystrix/HystrixCollapser.java | 4 +- .../netflix/hystrix/HystrixCollapserKey.java | 2 +- .../hystrix/HystrixCollapserMetrics.java | 2 +- .../hystrix/HystrixCommandGroupKey.java | 2 +- .../netflix/hystrix/HystrixCommandKey.java | 2 +- .../hystrix/HystrixCommandMetrics.java | 2 +- .../hystrix/HystrixObservableCollapser.java | 6 +- .../netflix/hystrix/HystrixRequestCache.java | 6 +- .../netflix/hystrix/HystrixRequestLog.java | 12 ++-- .../netflix/hystrix/HystrixThreadPool.java | 2 +- .../netflix/hystrix/HystrixThreadPoolKey.java | 2 +- .../hystrix/HystrixThreadPoolMetrics.java | 2 +- .../CollapsedRequestObservableFunction.java | 8 +-- .../hystrix/collapser/RequestBatch.java | 4 +- .../hystrix/collapser/RequestCollapser.java | 10 +-- .../collapser/RequestCollapserFactory.java | 10 +-- .../hystrix/strategy/HystrixPlugins.java | 10 +-- .../HystrixConcurrencyStrategy.java | 4 +- .../concurrency/HystrixRequestContext.java | 4 +- .../HystrixRequestVariableDefault.java | 4 +- .../HystrixRequestVariableHolder.java | 2 +- .../HystrixMetricsPublisherFactory.java | 6 +- ...trixPropertiesChainedArchaiusProperty.java | 8 +-- .../properties/HystrixPropertiesFactory.java | 6 +- .../strategy/properties/HystrixProperty.java | 1 - .../hystrix/util/HystrixRollingNumber.java | 6 +- .../util/HystrixRollingPercentile.java | 6 +- .../netflix/hystrix/util/HystrixTimer.java | 2 +- .../hystrix/CommonHystrixCommandTests.java | 4 +- .../netflix/hystrix/HystrixCollapserTest.java | 24 +++---- .../netflix/hystrix/HystrixCommandTest.java | 50 +++++++------- .../hystrix/HystrixObservableCommandTest.java | 66 ++++++++++--------- .../hystrix/TestableExecutionHook.java | 6 +- ...ollapsedRequestObservableFunctionTest.java | 18 ++--- .../hystrix/strategy/HystrixPluginsTest.java | 2 +- .../HystrixMetricsPublisherFactoryTest.java | 2 +- .../dashboard/stream/MockStreamServlet.java | 7 +- .../basic/CommandCollapserGetValueForKey.java | 2 +- .../basic/CommandThatFailsSilently.java | 2 +- .../examples/demo/CreditCardCommand.java | 4 +- 54 files changed, 197 insertions(+), 187 deletions(-) diff --git a/build.gradle b/build.gradle index c4595f4d5..6de6e551e 100644 --- a/build.gradle +++ b/build.gradle @@ -20,8 +20,8 @@ subprojects { apply plugin: 'java' apply plugin: 'nebula.provided-base' - sourceCompatibility = 1.7 - targetCompatibility = 1.7 + sourceCompatibility = 1.6 + targetCompatibility = 1.6 repositories { jcenter() diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/CacheInvocationContextFactory.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/CacheInvocationContextFactory.java index 1c6e152eb..e0c6c4737 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/CacheInvocationContextFactory.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/CacheInvocationContextFactory.java @@ -44,7 +44,7 @@ public static CacheInvocationContext createCacheResultInvocationCon Method method = metaHolder.getMethod(); CacheResult cacheResult = method.getAnnotation(CacheResult.class); MethodExecutionAction cacheKeyMethod = createCacheKeyAction(cacheResult.cacheKeyMethod(), metaHolder); - return new CacheInvocationContext<>(cacheResult, cacheKeyMethod, metaHolder.getObj(), method, metaHolder.getArgs()); + return new CacheInvocationContext(cacheResult, cacheKeyMethod, metaHolder.getObj(), method, metaHolder.getArgs()); } return null; } @@ -60,7 +60,7 @@ public static CacheInvocationContext createCacheRemoveInvocationCon Method method = metaHolder.getMethod(); CacheRemove cacheRemove = method.getAnnotation(CacheRemove.class); MethodExecutionAction cacheKeyMethod = createCacheKeyAction(cacheRemove.cacheKeyMethod(), metaHolder); - return new CacheInvocationContext<>(cacheRemove, cacheKeyMethod, metaHolder.getObj(), method, metaHolder.getArgs()); + return new CacheInvocationContext(cacheRemove, cacheKeyMethod, metaHolder.getObj(), method, metaHolder.getArgs()); } return null; } diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/HystrixCacheKeyGenerator.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/HystrixCacheKeyGenerator.java index 1fce06678..7f10adcaa 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/HystrixCacheKeyGenerator.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/HystrixCacheKeyGenerator.java @@ -87,7 +87,11 @@ private Object getPropertyValue(String name, Object obj) throws HystrixCacheKeyG try { return new PropertyDescriptor(name, obj.getClass()) .getReadMethod().invoke(obj); - } catch (IllegalAccessException | IntrospectionException | InvocationTargetException e) { + } catch (IllegalAccessException e) { + throw new HystrixCacheKeyGenerationException(e); + } catch (IntrospectionException e) { + throw new HystrixCacheKeyGenerationException(e); + } catch (InvocationTargetException e) { throw new HystrixCacheKeyGenerationException(e); } } diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/MethodExecutionAction.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/MethodExecutionAction.java index 7fb707bb4..448c9c406 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/MethodExecutionAction.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/MethodExecutionAction.java @@ -99,7 +99,9 @@ private Object execute(Object o, Method m, Object... args) throws CommandActionE try { m.setAccessible(true); // suppress Java language access result = m.invoke(o, args); - } catch (IllegalAccessException | InvocationTargetException e) { + } catch (IllegalAccessException e) { + propagateCause(e); + } catch (InvocationTargetException e) { propagateCause(e); } return result; diff --git a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/cache/CacheTest.java b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/cache/CacheTest.java index f212b3616..0afb107cf 100644 --- a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/cache/CacheTest.java +++ b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/cache/CacheTest.java @@ -272,7 +272,7 @@ public void testGetUserByName_givenNonexistentCacheKeyMethod_shouldThrowExceptio } public static class UserService { - private Map storage = new ConcurrentHashMap<>(); + private Map storage = new ConcurrentHashMap(); @PostConstruct private void init() { diff --git a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/error/ErrorPropagationTest.java b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/error/ErrorPropagationTest.java index 12e0d2686..7700ea36b 100644 --- a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/error/ErrorPropagationTest.java +++ b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/error/ErrorPropagationTest.java @@ -53,7 +53,7 @@ public class ErrorPropagationTest { private static final Map USERS; static { - USERS = new HashMap<>(); + USERS = new HashMap(); USERS.put("1", new User("1", "user_1")); USERS.put("2", new User("2", "user_2")); USERS.put("3", new User("3", "user_3")); diff --git a/hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/metrics/eventstream/HystrixMetricsStreamServlet.java b/hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/metrics/eventstream/HystrixMetricsStreamServlet.java index 463a9d436..267659256 100644 --- a/hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/metrics/eventstream/HystrixMetricsStreamServlet.java +++ b/hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/metrics/eventstream/HystrixMetricsStreamServlet.java @@ -203,7 +203,7 @@ private static class MetricJsonListener implements HystrixMetricsPoller.MetricsA *

* This is a safety check against a runaway poller causing memory leaks. */ - private final LinkedBlockingQueue jsonMetrics = new LinkedBlockingQueue<>(1000); + private final LinkedBlockingQueue jsonMetrics = new LinkedBlockingQueue(1000); /** * Store JSON messages in a queue. @@ -219,7 +219,7 @@ public void handleJsonMetric(String json) { * @return */ public List getJsonMetrics() { - ArrayList metrics = new ArrayList<>(); + ArrayList metrics = new ArrayList(); jsonMetrics.drainTo(metrics); return metrics; } diff --git a/hystrix-contrib/hystrix-rx-netty-metrics-stream/src/test/java/com/netflix/hystrix/contrib/rxnetty/metricsstream/HystrixMetricsStreamHandlerTest.java b/hystrix-contrib/hystrix-rx-netty-metrics-stream/src/test/java/com/netflix/hystrix/contrib/rxnetty/metricsstream/HystrixMetricsStreamHandlerTest.java index 4af342495..608d37a26 100644 --- a/hystrix-contrib/hystrix-rx-netty-metrics-stream/src/test/java/com/netflix/hystrix/contrib/rxnetty/metricsstream/HystrixMetricsStreamHandlerTest.java +++ b/hystrix-contrib/hystrix-rx-netty-metrics-stream/src/test/java/com/netflix/hystrix/contrib/rxnetty/metricsstream/HystrixMetricsStreamHandlerTest.java @@ -115,7 +115,7 @@ private HttpServer createServer() { for (int i = 0; i < 3 && server == null; i++) { port = 10000 + random.nextInt(50000); try { - return RxNetty.newHttpServerBuilder(port, new HystrixMetricsStreamHandler<>( + return RxNetty.newHttpServerBuilder(port, new HystrixMetricsStreamHandler( DEFAULT_HYSTRIX_PREFIX, DEFAULT_INTERVAL, new RequestHandler() { // Application handler diff --git a/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherCollapser.java b/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherCollapser.java index f3e043695..72428c448 100644 --- a/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherCollapser.java +++ b/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherCollapser.java @@ -111,7 +111,7 @@ protected Tag getServoInstanceTag() { */ private List> getServoMonitors() { - List> monitors = new ArrayList<>(); + List> monitors = new ArrayList>(); monitors.add(new InformationalMetric(MonitorConfig.builder("name").build()) { @Override diff --git a/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherCommand.java b/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherCommand.java index c4209976d..deff70860 100644 --- a/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherCommand.java +++ b/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherCommand.java @@ -116,7 +116,7 @@ protected Tag getServoInstanceTag() { */ private List> getServoMonitors() { - List> monitors = new ArrayList<>(); + List> monitors = new ArrayList>(); monitors.add(new InformationalMetric(MonitorConfig.builder("isCircuitBreakerOpen").build()) { @Override diff --git a/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherThreadPool.java b/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherThreadPool.java index de542e9a9..006f39f35 100644 --- a/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherThreadPool.java +++ b/hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherThreadPool.java @@ -111,7 +111,7 @@ protected Tag getServoInstanceTag() { */ private List> getServoMonitors() { - List> monitors = new ArrayList<>(); + List> monitors = new ArrayList>(); monitors.add(new InformationalMetric(MonitorConfig.builder("name").build()) { @Override diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java b/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java index d023e43eb..38f36bf57 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java @@ -87,16 +87,16 @@ protected static enum TimedOutStatus { /* FALLBACK Semaphore */ protected final TryableSemaphore fallbackSemaphoreOverride; /* each circuit has a semaphore to restrict concurrent fallback execution */ - protected static final ConcurrentHashMap fallbackSemaphorePerCircuit = new ConcurrentHashMap<>(); + protected static final ConcurrentHashMap fallbackSemaphorePerCircuit = new ConcurrentHashMap(); /* END FALLBACK Semaphore */ /* EXECUTION Semaphore */ protected final TryableSemaphore executionSemaphoreOverride; /* each circuit has a semaphore to restrict concurrent fallback execution */ - protected static final ConcurrentHashMap executionSemaphorePerCircuit = new ConcurrentHashMap<>(); + protected static final ConcurrentHashMap executionSemaphorePerCircuit = new ConcurrentHashMap(); /* END EXECUTION Semaphore */ - protected final AtomicReference> timeoutTimer = new AtomicReference<>(); + protected final AtomicReference> timeoutTimer = new AtomicReference>(); protected AtomicBoolean started = new AtomicBoolean(); protected volatile long invocationStartTime = -1; @@ -105,10 +105,10 @@ protected static enum TimedOutStatus { protected volatile ExecutionResult executionResult = ExecutionResult.EMPTY; /* If this command executed and timed-out */ - protected final AtomicReference isCommandTimedOut = new AtomicReference<>(TimedOutStatus.NOT_EXECUTED); + protected final AtomicReference isCommandTimedOut = new AtomicReference(TimedOutStatus.NOT_EXECUTED); protected final AtomicBoolean isExecutionComplete = new AtomicBoolean(false); protected final AtomicBoolean isExecutedInThread = new AtomicBoolean(false); - protected final AtomicReference endCurrentThreadExecutingCommand = new AtomicReference<>(); // don't like how this is being done + protected final AtomicReference endCurrentThreadExecutingCommand = new AtomicReference(); // don't like how this is being done /** @@ -119,7 +119,7 @@ protected static enum TimedOutStatus { // this is a micro-optimization but saves about 1-2microseconds (on 2011 MacBook Pro) // on the repetitive string processing that will occur on the same classes over and over again - private static ConcurrentHashMap, String> defaultNameCache = new ConcurrentHashMap<>(); + private static ConcurrentHashMap, String> defaultNameCache = new ConcurrentHashMap, String>(); /* package */static String getDefaultNameFromClass(Class cls) { String fromCache = defaultNameCache.get(cls); @@ -360,7 +360,7 @@ public Observable toObservable() { metrics.markResponseFromCache(); isExecutionComplete.set(true); executionHook.onCacheHit(this); - return new CachedObservableResponse<>((CachedObservableOriginal) fromCache, this); + return new CachedObservableResponse((CachedObservableOriginal) fromCache, this); } } @@ -470,17 +470,17 @@ public void call() { // put in cache if (isRequestCachingEnabled()) { // wrap it for caching - o = new CachedObservableOriginal<>(o.cache(), this); + o = new CachedObservableOriginal(o.cache(), this); Observable fromCache = requestCache.putIfAbsent(getCacheKey(), o); if (fromCache != null) { // another thread beat us so we'll use the cached value instead - o = new CachedObservableResponse<>((CachedObservableOriginal) fromCache, this); + o = new CachedObservableResponse((CachedObservableOriginal) fromCache, this); } // we just created an ObservableCommand so we cast and return it return o; } else { // no request caching so a simple wrapper just to pass 'this' along with the Observable - return new ObservableCommand<>(o, this); + return new ObservableCommand(o, this); } } @@ -542,7 +542,7 @@ public void call(Notification n) { } - }).lift(new HystrixObservableTimeoutOperator<>(_self)).doOnNext(new Action1() { + }).lift(new HystrixObservableTimeoutOperator(_self)).doOnNext(new Action1() { @Override public void call(R r) { if (shouldOutputOnNextEvents()) { @@ -1669,7 +1669,7 @@ public ExecutionResult addEvents(HystrixEventType... events) { } private static List getUpdatedList(List currentList, HystrixEventType... newEvents) { - ArrayList updatedEvents = new ArrayList<>(); + ArrayList updatedEvents = new ArrayList(); updatedEvents.addAll(currentList); Collections.addAll(updatedEvents, newEvents); return Collections.unmodifiableList(updatedEvents); diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/Hystrix.java b/hystrix-core/src/main/java/com/netflix/hystrix/Hystrix.java index 39810ff7c..8483d20f1 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/Hystrix.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/Hystrix.java @@ -82,7 +82,7 @@ private static void _reset() { private static ThreadLocal> currentCommand = new ThreadLocal>() { @Override protected LinkedList initialValue() { - return new LinkedList<>(); + return new LinkedList(); } }; diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCircuitBreaker.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCircuitBreaker.java index 6aaa2e794..f31e8fe4a 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCircuitBreaker.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCircuitBreaker.java @@ -55,7 +55,7 @@ public interface HystrixCircuitBreaker { */ public static class Factory { // String is HystrixCommandKey.name() (we can't use HystrixCommandKey directly as we can't guarantee it implements hashcode/equals correctly) - private static ConcurrentHashMap circuitBreakersByCommand = new ConcurrentHashMap<>(); + private static ConcurrentHashMap circuitBreakersByCommand = new ConcurrentHashMap(); /** * Get the {@link HystrixCircuitBreaker} instance for a given {@link HystrixCommandKey}. diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapser.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapser.java index 8aa8d17ec..db5799beb 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapser.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapser.java @@ -125,7 +125,7 @@ protected HystrixCollapser(Setter setter) { } HystrixCollapserProperties properties = HystrixPropertiesFactory.getCollapserProperties(collapserKey, propertiesBuilder); - this.collapserFactory = new RequestCollapserFactory<>(collapserKey, scope, timer, properties); + this.collapserFactory = new RequestCollapserFactory(collapserKey, scope, timer, properties); this.requestCache = HystrixRequestCache.getInstance(collapserKey, HystrixPlugins.getInstance().getConcurrencyStrategy()); if (metrics == null) { @@ -592,6 +592,6 @@ public Setter andCollapserPropertiesDefaults(HystrixCollapserProperties.Setter p // this is a micro-optimization but saves about 1-2microseconds (on 2011 MacBook Pro) // on the repetitive string processing that will occur on the same classes over and over again @SuppressWarnings("rawtypes") - private static ConcurrentHashMap, String> defaultNameCache = new ConcurrentHashMap<>(); + private static ConcurrentHashMap, String> defaultNameCache = new ConcurrentHashMap, String>(); } diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapserKey.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapserKey.java index bdac217b2..449dd0422 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapserKey.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapserKey.java @@ -37,7 +37,7 @@ private Factory() { } // used to intern instances so we don't keep re-creating them millions of times for the same key - private static ConcurrentHashMap intern = new ConcurrentHashMap<>(); + private static ConcurrentHashMap intern = new ConcurrentHashMap(); /** * Retrieve (or create) an interned HystrixCollapserKey instance for a given name. diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapserMetrics.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapserMetrics.java index 4d3721d21..3ded36764 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapserMetrics.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapserMetrics.java @@ -36,7 +36,7 @@ public class HystrixCollapserMetrics extends HystrixMetrics { private static final Logger logger = LoggerFactory.getLogger(HystrixCollapserMetrics.class); // String is HystrixCollapserKey.name() (we can't use HystrixCollapserKey directly as we can't guarantee it implements hashcode/equals correctly) - private static final ConcurrentHashMap metrics = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap metrics = new ConcurrentHashMap(); /** * Get or create the {@link HystrixCollapserMetrics} instance for a given {@link HystrixCollapserKey}. diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandGroupKey.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandGroupKey.java index bb3533871..0fef7e561 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandGroupKey.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandGroupKey.java @@ -39,7 +39,7 @@ private Factory() { } // used to intern instances so we don't keep re-creating them millions of times for the same key - private static ConcurrentHashMap intern = new ConcurrentHashMap<>(); + private static ConcurrentHashMap intern = new ConcurrentHashMap(); /** * Retrieve (or create) an interned HystrixCommandGroup instance for a given name. diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandKey.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandKey.java index c89461d7c..fb6152ffd 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandKey.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandKey.java @@ -37,7 +37,7 @@ private Factory() { } // used to intern instances so we don't keep re-creating them millions of times for the same key - private static ConcurrentHashMap intern = new ConcurrentHashMap<>(); + private static ConcurrentHashMap intern = new ConcurrentHashMap(); /** * Retrieve (or create) an interned HystrixCommandKey instance for a given name. diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandMetrics.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandMetrics.java index c630d20f8..d0054df8b 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandMetrics.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandMetrics.java @@ -41,7 +41,7 @@ public class HystrixCommandMetrics extends HystrixMetrics { private static final Logger logger = LoggerFactory.getLogger(HystrixCommandMetrics.class); // String is HystrixCommandKey.name() (we can't use HystrixCommandKey directly as we can't guarantee it implements hashcode/equals correctly) - private static final ConcurrentHashMap metrics = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap metrics = new ConcurrentHashMap(); /** * Get or create the {@link HystrixCommandMetrics} instance for a given {@link HystrixCommandKey}. diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixObservableCollapser.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixObservableCollapser.java index a88b35e07..26664e7df 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixObservableCollapser.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixObservableCollapser.java @@ -125,7 +125,7 @@ protected HystrixObservableCollapser(Setter setter) { } HystrixCollapserProperties properties = HystrixPropertiesFactory.getCollapserProperties(collapserKey, propertiesBuilder); - this.collapserFactory = new RequestCollapserFactory<>(collapserKey, scope, timer, properties); + this.collapserFactory = new RequestCollapserFactory(collapserKey, scope, timer, properties); this.requestCache = HystrixRequestCache.getInstance(collapserKey, HystrixPlugins.getInstance().getConcurrencyStrategy()); if (metrics == null) { @@ -169,7 +169,7 @@ public Observable mapResponseToRequests(Observable batchR final Func1 mapBatchTypeToResponseType = self.getBatchReturnTypeToResponseTypeMapper(); // index the requests by key - final Map> requestsByKey = new HashMap<>(requests.size()); + final Map> requestsByKey = new HashMap>(requests.size()); for (CollapsedRequest cr : requests) { requestsByKey.put(requestKeySelector.call(cr.getArgument()), cr); } @@ -531,6 +531,6 @@ public Setter andCollapserPropertiesDefaults(HystrixCollapserProperties.Setter p // this is a micro-optimization but saves about 1-2microseconds (on 2011 MacBook Pro) // on the repetitive string processing that will occur on the same classes over and over again @SuppressWarnings("rawtypes") - private static ConcurrentHashMap, String> defaultNameCache = new ConcurrentHashMap<>(); + private static ConcurrentHashMap, String> defaultNameCache = new ConcurrentHashMap, String>(); } \ No newline at end of file diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestCache.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestCache.java index 2ba961b9f..77815c148 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestCache.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestCache.java @@ -37,7 +37,7 @@ public class HystrixRequestCache { private static final Logger logger = LoggerFactory.getLogger(HystrixRequestCache.class); // the String key must be: HystrixRequestCache.prefix + concurrencyStrategy + cacheKey - private final static ConcurrentHashMap caches = new ConcurrentHashMap<>(); + private final static ConcurrentHashMap caches = new ConcurrentHashMap(); private final RequestCacheKey rcKey; private final HystrixConcurrencyStrategy concurrencyStrategy; @@ -47,11 +47,11 @@ public class HystrixRequestCache { *

* Key => CommandPrefix + CacheKey : Future from queue() */ - private static final HystrixRequestVariableHolder>> requestVariableForCache = new HystrixRequestVariableHolder<>(new HystrixRequestVariableLifecycle>>() { + private static final HystrixRequestVariableHolder>> requestVariableForCache = new HystrixRequestVariableHolder>>(new HystrixRequestVariableLifecycle>>() { @Override public ConcurrentHashMap> initialValue() { - return new ConcurrentHashMap<>(); + return new ConcurrentHashMap>(); } @Override diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestLog.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestLog.java index 6fc547130..1779b7e1b 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestLog.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestLog.java @@ -50,7 +50,7 @@ public class HystrixRequestLog { */ /* package */static final int MAX_STORAGE = 1000; - private static final HystrixRequestVariableHolder currentRequestLog = new HystrixRequestVariableHolder<>(new HystrixRequestVariableLifecycle() { + private static final HystrixRequestVariableHolder currentRequestLog = new HystrixRequestVariableHolder(new HystrixRequestVariableLifecycle() { @Override public HystrixRequestLog initialValue() { return new HystrixRequestLog(); @@ -65,12 +65,12 @@ public void shutdown(HystrixRequestLog value) { /** * History of {@link HystrixCommand} executed in this request. */ - private LinkedBlockingQueue> executedCommands = new LinkedBlockingQueue<>(MAX_STORAGE); + private LinkedBlockingQueue> executedCommands = new LinkedBlockingQueue>(MAX_STORAGE); /** * History of {@link HystrixInvokableInfo} executed in this request. */ - private LinkedBlockingQueue> allExecutedCommands = new LinkedBlockingQueue<>(MAX_STORAGE); + private LinkedBlockingQueue> allExecutedCommands = new LinkedBlockingQueue>(MAX_STORAGE); // prevent public instantiation private HystrixRequestLog() { @@ -172,8 +172,8 @@ public Collection> getAllExecutedCommands() { */ public String getExecutedCommandsAsString() { try { - LinkedHashMap aggregatedCommandsExecuted = new LinkedHashMap<>(); - Map aggregatedCommandExecutionTime = new HashMap<>(); + LinkedHashMap aggregatedCommandsExecuted = new LinkedHashMap(); + Map aggregatedCommandExecutionTime = new HashMap(); StringBuilder builder = new StringBuilder(); int estimatedLength = 0; @@ -181,7 +181,7 @@ public String getExecutedCommandsAsString() { builder.setLength(0); builder.append(command.getCommandKey().name()); - List events = new ArrayList<>(command.getExecutionEvents()); + List events = new ArrayList(command.getExecutionEvents()); if (events.size() > 0) { Collections.sort(events); //replicate functionality of Arrays.toString(events.toArray()) to append directly to existing StringBuilder diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPool.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPool.java index 5fe38075d..ae358e2b3 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPool.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPool.java @@ -88,7 +88,7 @@ public interface HystrixThreadPool { * Use the String from HystrixThreadPoolKey.name() instead of the HystrixThreadPoolKey instance as it's just an interface and we can't ensure the object * we receive implements hashcode/equals correctly and do not want the default hashcode/equals which would create a new threadpool for every object we get even if the name is the same */ - /* package */final static ConcurrentHashMap threadPools = new ConcurrentHashMap<>(); + /* package */final static ConcurrentHashMap threadPools = new ConcurrentHashMap(); /** * Get the {@link HystrixThreadPool} instance for a given {@link HystrixThreadPoolKey}. diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolKey.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolKey.java index 15e5cd6c0..7c65a4756 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolKey.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolKey.java @@ -39,7 +39,7 @@ private Factory() { } // used to intern instances so we don't keep re-creating them millions of times for the same key - private static ConcurrentHashMap intern = new ConcurrentHashMap<>(); + private static ConcurrentHashMap intern = new ConcurrentHashMap(); /** * Retrieve (or create) an interned HystrixThreadPoolKey instance for a given name. diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolMetrics.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolMetrics.java index 04294e4f3..d4798700b 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolMetrics.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolMetrics.java @@ -36,7 +36,7 @@ public class HystrixThreadPoolMetrics extends HystrixMetrics { private static final Logger logger = LoggerFactory.getLogger(HystrixThreadPoolMetrics.class); // String is HystrixThreadPoolKey.name() (we can't use HystrixThreadPoolKey directly as we can't guarantee it implements hashcode/equals correctly) - private static final ConcurrentHashMap metrics = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap metrics = new ConcurrentHashMap(); /** * Get or create the {@link HystrixThreadPoolMetrics} instance for a given {@link HystrixThreadPoolKey}. diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/collapser/CollapsedRequestObservableFunction.java b/hystrix-core/src/main/java/com/netflix/hystrix/collapser/CollapsedRequestObservableFunction.java index bc7c6ebe6..54f2bf8d7 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/collapser/CollapsedRequestObservableFunction.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/collapser/CollapsedRequestObservableFunction.java @@ -37,7 +37,7 @@ */ /* package */class CollapsedRequestObservableFunction implements CollapsedRequest, OnSubscribe { private final R argument; - private final AtomicReference> rh = new AtomicReference<>(new CollapsedRequestObservableFunction.ResponseHolder()); + private final AtomicReference> rh = new AtomicReference>(new CollapsedRequestObservableFunction.ResponseHolder()); private final BooleanSubscription subscription = new BooleanSubscription(); public CollapsedRequestObservableFunction(R arg) { @@ -224,15 +224,15 @@ private ResponseHolder(AtomicReference response, Exception exception, Observe } public ResponseHolder setResponse(T response) { - return new ResponseHolder<>(new AtomicReference<>(response), e, o); + return new ResponseHolder(new AtomicReference(response), e, o); } public ResponseHolder setObserver(Observer observer) { - return new ResponseHolder<>(r, e, observer); + return new ResponseHolder(r, e, observer); } public ResponseHolder setException(Exception exception) { - return new ResponseHolder<>(r, exception, o); + return new ResponseHolder(r, exception, o); } public Observer getObserver() { diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestBatch.java b/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestBatch.java index a98f8380d..622049e80 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestBatch.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestBatch.java @@ -44,7 +44,7 @@ public class RequestBatch { private static final Logger logger = LoggerFactory.getLogger(HystrixCollapser.class); private final HystrixCollapserBridge commandCollapser; - final ConcurrentLinkedQueue> requests = new ConcurrentLinkedQueue<>(); + final ConcurrentLinkedQueue> requests = new ConcurrentLinkedQueue>(); // use AtomicInteger to count so we can use ConcurrentLinkedQueue instead of LinkedBlockingQueue private final AtomicInteger count = new AtomicInteger(0); private final int maxBatchSize; @@ -80,7 +80,7 @@ public Observable offer(RequestArgumentType arg) { if (s > maxBatchSize) { return null; } else { - CollapsedRequestObservableFunction f = new CollapsedRequestObservableFunction<>(arg); + CollapsedRequestObservableFunction f = new CollapsedRequestObservableFunction(arg); requests.add(f); return Observable.create(f); } diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestCollapser.java b/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestCollapser.java index 7d5c3ba3d..3f611149d 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestCollapser.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestCollapser.java @@ -45,8 +45,8 @@ public class RequestCollapser commandCollapser; // batch can be null once shutdown - private final AtomicReference> batch = new AtomicReference<>(); - private final AtomicReference> timerListenerReference = new AtomicReference<>(); + private final AtomicReference> batch = new AtomicReference>(); + private final AtomicReference> timerListenerReference = new AtomicReference>(); private final AtomicBoolean timerListenerRegistered = new AtomicBoolean(); private final CollapserTimer timer; private final HystrixCollapserProperties properties; @@ -63,7 +63,7 @@ public class RequestCollapser(properties, commandCollapser, properties.maxRequestsInBatch().get())); + batch.set(new RequestBatch(properties, commandCollapser, properties.maxRequestsInBatch().get())); } /** @@ -104,7 +104,7 @@ private void createNewBatchAndExecutePreviousIfNeeded(RequestBatch(properties, commandCollapser, properties.maxRequestsInBatch().get()))) { + if (batch.compareAndSet(previousBatch, new RequestBatch(properties, commandCollapser, properties.maxRequestsInBatch().get()))) { // this thread won so trigger the previous batch previousBatch.executeBatchIfNotAlreadyStarted(); } @@ -134,7 +134,7 @@ private class CollapsedTask implements TimerListener { CollapsedTask() { // this gets executed from the context of a HystrixCommand parent thread (such as a Tomcat thread) // so we create the callable now where we can capture the thread context - callableWithContextOfParent = new HystrixContextCallable<>(concurrencyStrategy, new Callable() { + callableWithContextOfParent = new HystrixContextCallable(concurrencyStrategy, new Callable() { // the wrapCallable call allows a strategy to capture thread-context if desired @Override diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestCollapserFactory.java b/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestCollapserFactory.java index c1f610d90..fe5c56cf2 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestCollapserFactory.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestCollapserFactory.java @@ -98,7 +98,7 @@ public RequestCollapser getR * Static global cache of RequestCollapsers for Scope.GLOBAL */ // String is CollapserKey.name() (we can't use CollapserKey directly as we can't guarantee it implements hashcode/equals correctly) - private static ConcurrentHashMap> globalScopedCollapsers = new ConcurrentHashMap<>(); + private static ConcurrentHashMap> globalScopedCollapsers = new ConcurrentHashMap>(); @SuppressWarnings("unchecked") private RequestCollapser getCollapserForGlobalScope(HystrixCollapserBridge commandCollapser) { @@ -107,7 +107,7 @@ private RequestCollapser get return (RequestCollapser) collapser; } // create new collapser using 'this' first instance as the one that will get cached for future executions ('this' is stateless so we can do that) - RequestCollapser newCollapser = new RequestCollapser<>(commandCollapser, properties, timer, concurrencyStrategy); + RequestCollapser newCollapser = new RequestCollapser(commandCollapser, properties, timer, concurrencyStrategy); RequestCollapser existing = globalScopedCollapsers.putIfAbsent(collapserKey.name(), newCollapser); if (existing == null) { // we won @@ -125,7 +125,7 @@ private RequestCollapser get * Static global cache of RequestVariables with RequestCollapsers for Scope.REQUEST */ // String is HystrixCollapserKey.name() (we can't use HystrixCollapserKey directly as we can't guarantee it implements hashcode/equals correctly) - private static ConcurrentHashMap>> requestScopedCollapsers = new ConcurrentHashMap<>(); + private static ConcurrentHashMap>> requestScopedCollapsers = new ConcurrentHashMap>>(); /* we are casting because the Map needs to be but we know it is for this thread */ @SuppressWarnings("unchecked") @@ -206,7 +206,7 @@ private RequestCollapserRequestVariable(final HystrixCollapserBridge initialValue() { // this gets calls once per request per HystrixCollapser instance - return new RequestCollapser<>(commandCollapser, properties, timer, concurrencyStrategy); + return new RequestCollapser(commandCollapser, properties, timer, concurrencyStrategy); } @Override @@ -287,6 +287,6 @@ public Setter andCollapserPropertiesDefaults(HystrixCollapserProperties.Setter p // this is a micro-optimization but saves about 1-2microseconds (on 2011 MacBook Pro) // on the repetitive string processing that will occur on the same classes over and over again @SuppressWarnings("rawtypes") - private static ConcurrentHashMap, String> defaultNameCache = new ConcurrentHashMap<>(); + private static ConcurrentHashMap, String> defaultNameCache = new ConcurrentHashMap, String>(); } diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixPlugins.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixPlugins.java index 812406642..cf3edce8f 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixPlugins.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixPlugins.java @@ -45,11 +45,11 @@ public class HystrixPlugins { private final static HystrixPlugins INSTANCE = new HystrixPlugins(); - /* package */ final AtomicReference notifier = new AtomicReference<>(); - /* package */ final AtomicReference concurrencyStrategy = new AtomicReference<>(); - /* package */ final AtomicReference metricsPublisher = new AtomicReference<>(); - /* package */ final AtomicReference propertiesFactory = new AtomicReference<>(); - /* package */ final AtomicReference commandExecutionHook = new AtomicReference<>(); + /* package */ final AtomicReference notifier = new AtomicReference(); + /* package */ final AtomicReference concurrencyStrategy = new AtomicReference(); + /* package */ final AtomicReference metricsPublisher = new AtomicReference(); + /* package */ final AtomicReference propertiesFactory = new AtomicReference(); + /* package */ final AtomicReference commandExecutionHook = new AtomicReference(); private HystrixPlugins() { try { diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixConcurrencyStrategy.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixConcurrencyStrategy.java index e4e6039ac..2deef03d7 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixConcurrencyStrategy.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixConcurrencyStrategy.java @@ -105,9 +105,9 @@ public BlockingQueue getBlockingQueue(int maxQueueSize) { * and rejecting is the preferred solution. */ if (maxQueueSize <= 0) { - return new SynchronousQueue<>(); + return new SynchronousQueue(); } else { - return new LinkedBlockingQueue<>(maxQueueSize); + return new LinkedBlockingQueue(maxQueueSize); } } diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestContext.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestContext.java index 10f4a4477..ea4d173cb 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestContext.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestContext.java @@ -72,7 +72,7 @@ public class HystrixRequestContext { * HystrixRequestContext object with the ConcurrentHashMap within it nulled out since once it is nullified * from the parent thread it is shared across all child threads. */ - private static ThreadLocal requestVariables = new ThreadLocal<>(); + private static ThreadLocal requestVariables = new ThreadLocal(); public static boolean isCurrentThreadInitialized() { HystrixRequestContext context = requestVariables.get(); @@ -115,7 +115,7 @@ public static HystrixRequestContext initializeContext() { * * Only HystrixRequestVariable has a reason to be accessing this field. */ - /* package */ConcurrentHashMap, HystrixRequestVariableDefault.LazyInitializer> state = new ConcurrentHashMap<>(); + /* package */ConcurrentHashMap, HystrixRequestVariableDefault.LazyInitializer> state = new ConcurrentHashMap, HystrixRequestVariableDefault.LazyInitializer>(); // instantiation should occur via static factory methods. private HystrixRequestContext() { diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariableDefault.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariableDefault.java index 5d9417b2f..72f92b1d7 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariableDefault.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariableDefault.java @@ -93,7 +93,7 @@ public T get() { * Whichever instance of LazyInitializer succeeds will then have get() invoked which will call * the initialValue() method once-and-only-once. */ - LazyInitializer l = new LazyInitializer<>(this); + LazyInitializer l = new LazyInitializer(this); LazyInitializer existing = variableMap.putIfAbsent(this, l); if (existing == null) { /* @@ -132,7 +132,7 @@ public T initialValue() { * the value to set */ public void set(T value) { - HystrixRequestContext.getContextForCurrentThread().state.put(this, new LazyInitializer<>(this, value)); + HystrixRequestContext.getContextForCurrentThread().state.put(this, new LazyInitializer(this, value)); } /** diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariableHolder.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariableHolder.java index 3d7baeabd..95387ef44 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariableHolder.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariableHolder.java @@ -36,7 +36,7 @@ public class HystrixRequestVariableHolder { static final Logger logger = LoggerFactory.getLogger(HystrixRequestVariableHolder.class); - private static ConcurrentHashMap> requestVariableInstance = new ConcurrentHashMap<>(); + private static ConcurrentHashMap> requestVariableInstance = new ConcurrentHashMap>(); private final HystrixRequestVariableLifecycle lifeCycleMethods; diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java index c332f6976..e46c26926 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java @@ -98,7 +98,7 @@ public static void reset() { /* package */ HystrixMetricsPublisherFactory() {} // String is CommandKey.name() (we can't use CommandKey directly as we can't guarantee it implements hashcode/equals correctly) - private final ConcurrentHashMap commandPublishers = new ConcurrentHashMap<>(); + private final ConcurrentHashMap commandPublishers = new ConcurrentHashMap(); /* package */ HystrixMetricsPublisherCommand getPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) { // attempt to retrieve from cache first @@ -123,7 +123,7 @@ public static void reset() { } // String is ThreadPoolKey.name() (we can't use ThreadPoolKey directly as we can't guarantee it implements hashcode/equals correctly) - private final ConcurrentHashMap threadPoolPublishers = new ConcurrentHashMap<>(); + private final ConcurrentHashMap threadPoolPublishers = new ConcurrentHashMap(); /* package */ HystrixMetricsPublisherThreadPool getPublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) { // attempt to retrieve from cache first @@ -163,7 +163,7 @@ public static HystrixMetricsPublisherCollapser createOrRetrievePublisherForColla } // String is CollapserKey.name() (we can't use CollapserKey directly as we can't guarantee it implements hashcode/equals correctly) - private final ConcurrentHashMap collapserPublishers = new ConcurrentHashMap<>(); + private final ConcurrentHashMap collapserPublishers = new ConcurrentHashMap(); /* package */ HystrixMetricsPublisherCollapser getPublisherForCollapser(HystrixCollapserKey collapserKey, HystrixCollapserMetrics metrics, HystrixCollapserProperties properties) { // attempt to retrieve from cache first diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesChainedArchaiusProperty.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesChainedArchaiusProperty.java index 88bfa8421..7db24b566 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesChainedArchaiusProperty.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesChainedArchaiusProperty.java @@ -65,8 +65,8 @@ public static abstract class ChainLink { */ public ChainLink() { next = null; - pReference = new AtomicReference<>(this); - callbacks = new ArrayList<>(); + pReference = new AtomicReference>(this); + callbacks = new ArrayList(); } /** @@ -74,8 +74,8 @@ public ChainLink() { */ public ChainLink(ChainLink nextProperty) { next = nextProperty; - pReference = new AtomicReference<>(next); - callbacks = new ArrayList<>(); + pReference = new AtomicReference>(next); + callbacks = new ArrayList(); } protected void checkAndFlip() { diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java index 31d4c6b89..94edfec75 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java @@ -46,7 +46,7 @@ public static void reset() { } // String is CommandKey.name() (we can't use CommandKey directly as we can't guarantee it implements hashcode/equals correctly) - private static final ConcurrentHashMap commandProperties = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap commandProperties = new ConcurrentHashMap(); /** * Get an instance of {@link HystrixCommandProperties} with the given factory {@link HystrixPropertiesStrategy} implementation for each {@link HystrixCommand} instance. @@ -85,7 +85,7 @@ public static HystrixCommandProperties getCommandProperties(HystrixCommandKey ke } // String is ThreadPoolKey.name() (we can't use ThreadPoolKey directly as we can't guarantee it implements hashcode/equals correctly) - private static final ConcurrentHashMap threadPoolProperties = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap threadPoolProperties = new ConcurrentHashMap(); /** * Get an instance of {@link HystrixThreadPoolProperties} with the given factory {@link HystrixPropertiesStrategy} implementation for each {@link HystrixThreadPool} instance. @@ -124,7 +124,7 @@ public static HystrixThreadPoolProperties getThreadPoolProperties(HystrixThreadP } // String is CollapserKey.name() (we can't use CollapserKey directly as we can't guarantee it implements hashcode/equals correctly) - private static final ConcurrentHashMap collapserProperties = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap collapserProperties = new ConcurrentHashMap(); /** * Get an instance of {@link HystrixCollapserProperties} with the given factory {@link HystrixPropertiesStrategy} implementation for each {@link HystrixCollapserKey} instance. diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixProperty.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixProperty.java index 73804b18d..1c02d436d 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixProperty.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixProperty.java @@ -133,7 +133,6 @@ public T get() { * @param values properties to iterate over * @return first non-null value or null if none found */ - @SafeVarargs public static HystrixProperty asProperty(final HystrixProperty... values) { return new HystrixProperty() { diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixRollingNumber.java b/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixRollingNumber.java index 305ffa7b6..c9bb58d76 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixRollingNumber.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixRollingNumber.java @@ -547,7 +547,7 @@ private Bucket[] getArray() { * but since we never clear the data directly, only increment/decrement head/tail we would never get a NULL * just potentially return stale data which we are okay with doing */ - ArrayList array = new ArrayList<>(); + ArrayList array = new ArrayList(); for (int i = 0; i < size; i++) { array.add(data.get(convert(i))); } @@ -593,8 +593,8 @@ private int convert(int index) { } BucketCircularArray(int size) { - AtomicReferenceArray _buckets = new AtomicReferenceArray<>(size + 1); // + 1 as extra room for the add/remove; - state = new AtomicReference<>(new ListState(_buckets, 0, 0)); + AtomicReferenceArray _buckets = new AtomicReferenceArray(size + 1); // + 1 as extra room for the add/remove; + state = new AtomicReference(new ListState(_buckets, 0, 0)); dataLength = _buckets.length(); numBuckets = size; } diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixRollingPercentile.java b/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixRollingPercentile.java index eb744c7fa..bf038b184 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixRollingPercentile.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixRollingPercentile.java @@ -471,7 +471,7 @@ private Bucket[] getArray() { * but since we never clear the data directly, only increment/decrement head/tail we would never get a NULL * just potentially return stale data which we are okay with doing */ - ArrayList array = new ArrayList<>(); + ArrayList array = new ArrayList(); for (int i = 0; i < size; i++) { array.add(data.get(convert(i))); } @@ -517,8 +517,8 @@ private int convert(int index) { } BucketCircularArray(int size) { - AtomicReferenceArray _buckets = new AtomicReferenceArray<>(size + 1); // + 1 as extra room for the add/remove; - state = new AtomicReference<>(new ListState(_buckets, 0, 0)); + AtomicReferenceArray _buckets = new AtomicReferenceArray(size + 1); // + 1 as extra room for the add/remove; + state = new AtomicReference(new ListState(_buckets, 0, 0)); dataLength = _buckets.length(); numBuckets = size; } diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixTimer.java b/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixTimer.java index 551729f26..235be1c74 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixTimer.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixTimer.java @@ -63,7 +63,7 @@ public static void reset() { } } - /* package */ AtomicReference executor = new AtomicReference<>(); + /* package */ AtomicReference executor = new AtomicReference(); /** * Add a {@link TimerListener} that will be executed until it is garbage collected or removed by clearing the returned {@link Reference}. diff --git a/hystrix-core/src/test/java/com/netflix/hystrix/CommonHystrixCommandTests.java b/hystrix-core/src/test/java/com/netflix/hystrix/CommonHystrixCommandTests.java index 5babf1691..ee97349ed 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/CommonHystrixCommandTests.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/CommonHystrixCommandTests.java @@ -171,7 +171,7 @@ public SingleThreadedPoolWithQueue(int queueSize) { } public SingleThreadedPoolWithQueue(int queueSize, int rejectionQueueSizeThreshold) { - queue = new LinkedBlockingQueue<>(queueSize); + queue = new LinkedBlockingQueue(queueSize); pool = new ThreadPoolExecutor(1, 1, 1, TimeUnit.MINUTES, queue); this.rejectionQueueSizeThreshold = rejectionQueueSizeThreshold; } @@ -222,7 +222,7 @@ protected static class SingleThreadedPoolWithNoQueue implements HystrixThreadPoo final ThreadPoolExecutor pool; public SingleThreadedPoolWithNoQueue() { - queue = new SynchronousQueue<>(); + queue = new SynchronousQueue(); pool = new ThreadPoolExecutor(1, 1, 1, TimeUnit.MINUTES, queue); } diff --git a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixCollapserTest.java b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixCollapserTest.java index 994d9f3eb..913ea11f9 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixCollapserTest.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixCollapserTest.java @@ -392,8 +392,8 @@ public void testRequestVariableLifecycle2() throws Exception { HystrixRequestContext requestContext = HystrixRequestContext.initializeContext(); final TestCollapserTimer timer = new TestCollapserTimer(); - final ConcurrentLinkedQueue> responses = new ConcurrentLinkedQueue<>(); - ConcurrentLinkedQueue threads = new ConcurrentLinkedQueue<>(); + final ConcurrentLinkedQueue> responses = new ConcurrentLinkedQueue>(); + ConcurrentLinkedQueue threads = new ConcurrentLinkedQueue(); // kick off work (simulating a single request with multiple threads) for (int t = 0; t < 5; t++) { @@ -699,7 +699,7 @@ public void testRequestCacheWithException() { // simulate request lifecycle HystrixRequestContext.initializeContext(); - ConcurrentLinkedQueue>> commands = new ConcurrentLinkedQueue<>(); + ConcurrentLinkedQueue>> commands = new ConcurrentLinkedQueue>>(); final TestCollapserTimer timer = new TestCollapserTimer(); // pass in 'null' which will cause an NPE to be thrown @@ -761,7 +761,7 @@ public void testRequestCacheWithTimeout() { // simulate request lifecycle HystrixRequestContext.initializeContext(); - ConcurrentLinkedQueue>> commands = new ConcurrentLinkedQueue<>(); + ConcurrentLinkedQueue>> commands = new ConcurrentLinkedQueue>>(); final TestCollapserTimer timer = new TestCollapserTimer(); // pass in 'null' which will cause an NPE to be thrown @@ -1011,8 +1011,8 @@ public TestShardedRequestCollapser(TestCollapserTimer timer, String value) { @Override protected Collection>> shardRequests(Collection> requests) { - Collection> typeA = new ArrayList<>(); - Collection> typeB = new ArrayList<>(); + Collection> typeA = new ArrayList>(); + Collection> typeB = new ArrayList>(); for (CollapsedRequest request : requests) { if (request.getArgument().endsWith("a")) { @@ -1022,7 +1022,7 @@ protected Collection>> shardRequests } } - ArrayList>> shards = new ArrayList<>(); + ArrayList>> shards = new ArrayList>>(); shards.add(typeA); shards.add(typeB); return shards; @@ -1104,7 +1104,7 @@ private static class TestCollapserCommand extends TestHystrixCommand run() { System.out.println(">>> TestCollapserCommand run() ... batch size: " + requests.size()); // simulate a batch request - ArrayList response = new ArrayList<>(); + ArrayList response = new ArrayList(); for (CollapsedRequest request : requests) { if (request.getArgument() == null) { throw new NullPointerException("Simulated Error"); @@ -1163,7 +1163,7 @@ protected ShortCircuitedCommand() { protected List run() throws Exception { System.out.println("*** execution (this shouldn't happen)"); // this won't ever get called as we're forcing short-circuiting - ArrayList values = new ArrayList<>(); + ArrayList values = new ArrayList(); values.add("hello"); return values; } @@ -1188,7 +1188,7 @@ protected Void run() throws Exception { /* package */ static class TestCollapserTimer implements CollapserTimer { - private final ConcurrentLinkedQueue tasks = new ConcurrentLinkedQueue<>(); + private final ConcurrentLinkedQueue tasks = new ConcurrentLinkedQueue(); @Override public Reference addListener(final TimerListener collapseTask) { @@ -1324,7 +1324,7 @@ public Integer getRequestArgument() { @Override protected HystrixCommand createCommand(Collection> requests) { - ArrayList args = new ArrayList<>(); + ArrayList args = new ArrayList(); for (CollapsedRequest request : requests) { args.add(request.getArgument()); } @@ -1357,7 +1357,7 @@ public Integer getRequestArgument() { @Override protected HystrixCommand createCommand(Collection> requests) { - ArrayList args = new ArrayList<>(); + ArrayList args = new ArrayList(); for (CollapsedRequest request : requests) { args.add(request.getArgument()); } diff --git a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandTest.java b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandTest.java index fc2d34d9f..2de7915a8 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandTest.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandTest.java @@ -575,8 +575,8 @@ public void testObserveSuccess() { @Test public void testCallbackThreadForThreadIsolation() throws Exception { - final AtomicReference commandThread = new AtomicReference<>(); - final AtomicReference subscribeThread = new AtomicReference<>(); + final AtomicReference commandThread = new AtomicReference(); + final AtomicReference subscribeThread = new AtomicReference(); TestHystrixCommand command = new TestHystrixCommand(TestHystrixCommand.testPropsBuilder()) { @@ -628,8 +628,8 @@ public void onNext(Boolean args) { @Test public void testCallbackThreadForSemaphoreIsolation() throws Exception { - final AtomicReference commandThread = new AtomicReference<>(); - final AtomicReference subscribeThread = new AtomicReference<>(); + final AtomicReference commandThread = new AtomicReference(); + final AtomicReference subscribeThread = new AtomicReference(); TestHystrixCommand command = new TestHystrixCommand(TestHystrixCommand.testPropsBuilder() .setCommandPropertiesDefaults(HystrixCommandPropertiesTest.getUnitTestPropertiesSetter().withExecutionIsolationStrategy(ExecutionIsolationStrategy.SEMAPHORE))) { @@ -1993,7 +1993,7 @@ public void testExecutionSemaphoreWithExecution() { throw new RuntimeException(e); } - final ArrayBlockingQueue results = new ArrayBlockingQueue<>(2); + final ArrayBlockingQueue results = new ArrayBlockingQueue(2); final AtomicBoolean exceptionReceived = new AtomicBoolean(); @@ -2062,7 +2062,7 @@ public void run() { @Test public void testRejectedExecutionSemaphoreWithFallbackViaExecute() { final TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - final ArrayBlockingQueue results = new ArrayBlockingQueue<>(2); + final ArrayBlockingQueue results = new ArrayBlockingQueue(2); final AtomicBoolean exceptionReceived = new AtomicBoolean(); @@ -2128,7 +2128,7 @@ public void run() { @Test public void testRejectedExecutionSemaphoreWithFallbackViaObserve() { final TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - final ArrayBlockingQueue> results = new ArrayBlockingQueue<>(2); + final ArrayBlockingQueue> results = new ArrayBlockingQueue>(2); final AtomicBoolean exceptionReceived = new AtomicBoolean(); @@ -2358,8 +2358,8 @@ public void testDynamicKey() { @Test public void testRequestCache1() { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "A"); - SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "A"); + SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand(circuitBreaker, true, "A"); + SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand(circuitBreaker, true, "A"); assertTrue(command1.isCommandRunningInThread()); @@ -2415,8 +2415,8 @@ public void testRequestCache1() { @Test public void testRequestCache2() { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "A"); - SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "B"); + SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand(circuitBreaker, true, "A"); + SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand(circuitBreaker, true, "B"); assertTrue(command1.isCommandRunningInThread()); @@ -2469,9 +2469,9 @@ public void testRequestCache2() { @Test public void testRequestCache3() { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "A"); - SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "B"); - SuccessfulCacheableCommand command3 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "A"); + SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand(circuitBreaker, true, "A"); + SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand(circuitBreaker, true, "B"); + SuccessfulCacheableCommand command3 = new SuccessfulCacheableCommand(circuitBreaker, true, "A"); assertTrue(command1.isCommandRunningInThread()); @@ -2603,9 +2603,9 @@ public void testRequestCacheWithSlowExecution() { @Test public void testNoRequestCache3() { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand<>(circuitBreaker, false, "A"); - SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand<>(circuitBreaker, false, "B"); - SuccessfulCacheableCommand command3 = new SuccessfulCacheableCommand<>(circuitBreaker, false, "A"); + SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand(circuitBreaker, false, "A"); + SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand(circuitBreaker, false, "B"); + SuccessfulCacheableCommand command3 = new SuccessfulCacheableCommand(circuitBreaker, false, "A"); assertTrue(command1.isCommandRunningInThread()); @@ -3198,10 +3198,10 @@ public void testCacheKeyExecutionRequiresRequestVariable() { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - SuccessfulCacheableCommand command = new SuccessfulCacheableCommand<>(circuitBreaker, true, "one"); + SuccessfulCacheableCommand command = new SuccessfulCacheableCommand(circuitBreaker, true, "one"); assertEquals("one", command.execute()); - SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "two"); + SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand(circuitBreaker, true, "two"); assertEquals("two", command2.queue().get()); fail("We expect an exception because cacheKey requires RequestVariable."); @@ -3392,7 +3392,7 @@ public void testCheckedExceptionViaExecute() { public void testCheckedExceptionViaObserve() throws InterruptedException { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); CommandWithCheckedException command = new CommandWithCheckedException(circuitBreaker); - final AtomicReference t = new AtomicReference<>(); + final AtomicReference t = new AtomicReference(); final CountDownLatch latch = new CountDownLatch(1); try { command.observe().subscribe(new Observer() { @@ -3541,7 +3541,7 @@ public void testErrorThrownViaQueue() { public void testErrorThrownViaObserve() throws InterruptedException { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); CommandWithErrorThrown command = new CommandWithErrorThrown(circuitBreaker); - final AtomicReference t = new AtomicReference<>(); + final AtomicReference t = new AtomicReference(); final CountDownLatch latch = new CountDownLatch(1); try { command.observe().subscribe(new Observer() { @@ -3593,10 +3593,10 @@ public void onNext(Boolean args) { public void testFallbackRejectionOccursWithLatentFallback() { int numCommands = 1000; int semaphoreSize = 600; - List> cmds = new ArrayList<>(); + List> cmds = new ArrayList>(); final AtomicInteger exceptionsSeen = new AtomicInteger(0); final AtomicInteger fallbacksSeen = new AtomicInteger(0); - final ConcurrentMap exceptionTypes = new ConcurrentHashMap<>(); + final ConcurrentMap exceptionTypes = new ConcurrentHashMap(); final CountDownLatch latch = new CountDownLatch(numCommands); TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); @@ -3960,9 +3960,9 @@ protected String getFallback() { */ @Test public void testObservableTimeoutNoFallbackThreadContext() { - TestSubscriber ts = new TestSubscriber<>(); + TestSubscriber ts = new TestSubscriber(); - final AtomicReference onErrorThread = new AtomicReference<>(); + final AtomicReference onErrorThread = new AtomicReference(); final AtomicBoolean isRequestContextInitialized = new AtomicBoolean(); TestHystrixCommand command = getCommand(ExecutionIsolationStrategy.THREAD, AbstractTestHystrixCommand.ExecutionResult.SUCCESS, 200, AbstractTestHystrixCommand.FallbackResult.UNIMPLEMENTED, 50); diff --git a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java index b818cade2..dc1d4ec8d 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java @@ -101,7 +101,7 @@ public void cleanup() { */ int count = Runtime.getRuntime().availableProcessors(); final CountDownLatch latch = new CountDownLatch(count); - ArrayList> futures = new ArrayList<>(); + ArrayList> futures = new ArrayList>(); for (int i = 0; i < count; ++i) { futures.add(Observable.create(new OnSubscribe() { @Override @@ -120,7 +120,9 @@ public void call(Subscriber sub) { for (Future future : futures) { try { future.get(); - } catch (InterruptedException | ExecutionException e) { + } catch (InterruptedException e) { + throw new RuntimeException(e); + } catch (ExecutionException e) { throw new RuntimeException(e); } } @@ -651,8 +653,8 @@ private void testObserveFailureWithTimeoutAndFallback(ExecutionIsolationStrategy @Test public void testObserveOnImmediateSchedulerByDefaultForSemaphoreIsolation() throws Exception { - final AtomicReference commandThread = new AtomicReference<>(); - final AtomicReference subscribeThread = new AtomicReference<>(); + final AtomicReference commandThread = new AtomicReference(); + final AtomicReference subscribeThread = new AtomicReference(); TestHystrixObservableCommand command = new TestHystrixObservableCommand(TestHystrixObservableCommand.testPropsBuilder() .setCommandPropertiesDefaults(HystrixCommandPropertiesTest.getUnitTestPropertiesSetter().withExecutionIsolationStrategy(ExecutionIsolationStrategy.SEMAPHORE))) { @@ -1497,7 +1499,7 @@ public void testExecutionSemaphoreWithExecution() { throw new RuntimeException(e); } - final ArrayBlockingQueue results = new ArrayBlockingQueue<>(2); + final ArrayBlockingQueue results = new ArrayBlockingQueue(2); final AtomicBoolean exceptionReceived = new AtomicBoolean(); @@ -1564,7 +1566,7 @@ public void run() { @Test public void testRejectedExecutionSemaphoreWithFallback() { final TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - final ArrayBlockingQueue results = new ArrayBlockingQueue<>(2); + final ArrayBlockingQueue results = new ArrayBlockingQueue(2); final AtomicBoolean exceptionReceived = new AtomicBoolean(); @@ -1804,8 +1806,8 @@ public void testDynamicKey() { @Test public void testRequestCache1UsingThreadIsolation() { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "A"); - SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "A"); + SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand(circuitBreaker, true, "A"); + SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand(circuitBreaker, true, "A"); assertTrue(command1.isCommandRunningInThread()); @@ -1862,8 +1864,8 @@ public void testRequestCache1UsingThreadIsolation() { @Test public void testRequestCache2UsingThreadIsolation() { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "A"); - SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "B"); + SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand(circuitBreaker, true, "A"); + SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand(circuitBreaker, true, "B"); assertTrue(command1.isCommandRunningInThread()); @@ -1917,9 +1919,9 @@ public void testRequestCache2UsingThreadIsolation() { @Test public void testRequestCache3UsingThreadIsolation() { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "A"); - SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "B"); - SuccessfulCacheableCommand command3 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "A"); + SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand(circuitBreaker, true, "A"); + SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand(circuitBreaker, true, "B"); + SuccessfulCacheableCommand command3 = new SuccessfulCacheableCommand(circuitBreaker, true, "A"); assertTrue(command1.isCommandRunningInThread()); @@ -2060,9 +2062,9 @@ public void testRequestCacheWithSlowExecution() { @Test public void testNoRequestCache3UsingThreadIsolation() { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand<>(circuitBreaker, false, "A"); - SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand<>(circuitBreaker, false, "B"); - SuccessfulCacheableCommand command3 = new SuccessfulCacheableCommand<>(circuitBreaker, false, "A"); + SuccessfulCacheableCommand command1 = new SuccessfulCacheableCommand(circuitBreaker, false, "A"); + SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand(circuitBreaker, false, "B"); + SuccessfulCacheableCommand command3 = new SuccessfulCacheableCommand(circuitBreaker, false, "A"); assertTrue(command1.isCommandRunningInThread()); @@ -2695,10 +2697,10 @@ public void testCacheKeyExecutionRequiresRequestVariable() { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - SuccessfulCacheableCommand command = new SuccessfulCacheableCommand<>(circuitBreaker, true, "one"); + SuccessfulCacheableCommand command = new SuccessfulCacheableCommand(circuitBreaker, true, "one"); assertEquals("one", command.observe().toBlocking().single()); - SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand<>(circuitBreaker, true, "two"); + SuccessfulCacheableCommand command2 = new SuccessfulCacheableCommand(circuitBreaker, true, "two"); assertEquals("two", command2.observe().toBlocking().toFuture().get()); fail("We expect an exception because cacheKey requires RequestVariable."); @@ -2872,7 +2874,7 @@ public void testCheckedExceptionViaExecute() { public void testCheckedExceptionViaObserve() throws InterruptedException { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); CommandWithCheckedException command = new CommandWithCheckedException(circuitBreaker); - final AtomicReference t = new AtomicReference<>(); + final AtomicReference t = new AtomicReference(); final CountDownLatch latch = new CountDownLatch(1); try { command.observe().subscribe(new Observer() { @@ -2930,7 +2932,7 @@ public void onNext(Boolean args) { public void testErrorThrownViaObserve() throws InterruptedException { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); CommandWithErrorThrown command = new CommandWithErrorThrown(circuitBreaker, true); - final AtomicReference t = new AtomicReference<>(); + final AtomicReference t = new AtomicReference(); final CountDownLatch latch = new CountDownLatch(1); try { command.observe().subscribe(new Observer() { @@ -3584,9 +3586,9 @@ protected Observable resumeWithFallback() { */ @Test public void testObservableTimeoutNoFallbackThreadContext() { - TestSubscriber ts = new TestSubscriber<>(); + TestSubscriber ts = new TestSubscriber(); - final AtomicReference onErrorThread = new AtomicReference<>(); + final AtomicReference onErrorThread = new AtomicReference(); final AtomicBoolean isRequestContextInitialized = new AtomicBoolean(); TestHystrixObservableCommand command = new TestCommandWithTimeout(50, TestCommandWithTimeout.FALLBACK_NOT_IMPLEMENTED); @@ -3650,9 +3652,9 @@ public void call(Throwable t1) { */ @Test public void testObservableTimeoutFallbackThreadContext() { - TestSubscriber ts = new TestSubscriber<>(); + TestSubscriber ts = new TestSubscriber(); - final AtomicReference onErrorThread = new AtomicReference<>(); + final AtomicReference onErrorThread = new AtomicReference(); final AtomicBoolean isRequestContextInitialized = new AtomicBoolean(); TestHystrixObservableCommand command = new TestCommandWithTimeout(50, TestCommandWithTimeout.FALLBACK_SUCCESS); @@ -3706,7 +3708,7 @@ public void call(Boolean t1) { @Test public void testRejectedViaSemaphoreIsolation() { final TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - final ArrayBlockingQueue results = new ArrayBlockingQueue<>(2); + final ArrayBlockingQueue results = new ArrayBlockingQueue(2); final List executionThreads = Collections.synchronizedList(new ArrayList(2)); final List responseThreads = Collections.synchronizedList(new ArrayList(2)); @@ -3792,7 +3794,7 @@ public Boolean call(Boolean b) { @Test public void testRejectedViaThreadIsolation() throws InterruptedException { final TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); - final ArrayBlockingQueue results = new ArrayBlockingQueue<>(10); + final ArrayBlockingQueue results = new ArrayBlockingQueue(10); final List executionThreads = Collections.synchronizedList(new ArrayList(20)); final List responseThreads = Collections.synchronizedList(new ArrayList(10)); @@ -4511,11 +4513,11 @@ public void call(Notification n) { private final class RequestContextTestResults { volatile TestHystrixObservableCommand command; - final AtomicReference originThread = new AtomicReference<>(); + final AtomicReference originThread = new AtomicReference(); final AtomicBoolean isContextInitialized = new AtomicBoolean(); - TestSubscriber ts = new TestSubscriber<>(); + TestSubscriber ts = new TestSubscriber(); final AtomicBoolean isContextInitializedObserveOn = new AtomicBoolean(); - final AtomicReference observeOnThread = new AtomicReference<>(); + final AtomicReference observeOnThread = new AtomicReference(); } /* *************************************** testSuccessfuleRequestContext *********************************** */ @@ -5505,7 +5507,7 @@ public void testExecutionPartialSuccess() { assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS)); - TestSubscriber ts = new TestSubscriber<>(); + TestSubscriber ts = new TestSubscriber(); command.toObservable().subscribe(ts); ts.awaitTerminalEvent(); ts.assertReceivedOnNext(Arrays.asList(1, 2, 3)); @@ -5561,7 +5563,7 @@ public void testExecutionPartialSuccessWithFallback() { assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS)); - TestSubscriber ts = new TestSubscriber<>(); + TestSubscriber ts = new TestSubscriber(); command.toObservable().subscribe(ts); ts.awaitTerminalEvent(); ts.assertReceivedOnNext(Arrays.asList(false, true, false, true, false, true, false)); @@ -5617,7 +5619,7 @@ public void testExecutionPartialSuccessWithMoreIntelligentFallback() { assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS)); - TestSubscriber ts = new TestSubscriber<>(); + TestSubscriber ts = new TestSubscriber(); command.toObservable().subscribe(ts); ts.awaitTerminalEvent(); ts.assertReceivedOnNext(Arrays.asList(1, 2, 3, 4)); diff --git a/hystrix-core/src/test/java/com/netflix/hystrix/TestableExecutionHook.java b/hystrix-core/src/test/java/com/netflix/hystrix/TestableExecutionHook.java index 4c9d035c6..f088e5ec3 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/TestableExecutionHook.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/TestableExecutionHook.java @@ -31,9 +31,9 @@ private static void recordHookCall(StringBuilder sequenceRecorder, String method } StringBuilder executionSequence = new StringBuilder(); - List> commandEmissions = new ArrayList<>(); - List> executionEmissions = new ArrayList<>(); - List> fallbackEmissions = new ArrayList<>(); + List> commandEmissions = new ArrayList>(); + List> executionEmissions = new ArrayList>(); + List> fallbackEmissions = new ArrayList>(); public boolean commandEmissionsMatch(int numOnNext, int numOnError, int numOnCompleted) { return eventsMatch(commandEmissions, numOnNext, numOnError, numOnCompleted); diff --git a/hystrix-core/src/test/java/com/netflix/hystrix/collapser/CollapsedRequestObservableFunctionTest.java b/hystrix-core/src/test/java/com/netflix/hystrix/collapser/CollapsedRequestObservableFunctionTest.java index 5645dd3ab..252b7bc38 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/collapser/CollapsedRequestObservableFunctionTest.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/collapser/CollapsedRequestObservableFunctionTest.java @@ -29,7 +29,7 @@ public class CollapsedRequestObservableFunctionTest { @Test public void testSetResponseSuccess() throws InterruptedException, ExecutionException { - CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction<>("hello"); + CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction("hello"); Observable o = Observable.create(cr); Future v = o.toBlocking().toFuture(); @@ -41,7 +41,7 @@ public void testSetResponseSuccess() throws InterruptedException, ExecutionExcep @Test public void testSetNullResponseSuccess() throws InterruptedException, ExecutionException { - CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction<>("hello"); + CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction("hello"); Observable o = Observable.create(cr); Future v = o.toBlocking().toFuture(); @@ -53,7 +53,7 @@ public void testSetNullResponseSuccess() throws InterruptedException, ExecutionE @Test public void testSetException() throws InterruptedException, ExecutionException { - CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction<>("hello"); + CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction("hello"); Observable o = Observable.create(cr); Future v = o.toBlocking().toFuture(); @@ -70,7 +70,7 @@ public void testSetException() throws InterruptedException, ExecutionException { @Test public void testSetExceptionAfterResponse() throws InterruptedException, ExecutionException { - CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction<>("hello"); + CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction("hello"); Observable o = Observable.create(cr); Future v = o.toBlocking().toFuture(); @@ -88,7 +88,7 @@ public void testSetExceptionAfterResponse() throws InterruptedException, Executi @Test public void testSetResponseAfterException() throws InterruptedException, ExecutionException { - CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction<>("hello"); + CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction("hello"); Observable o = Observable.create(cr); Future v = o.toBlocking().toFuture(); @@ -111,7 +111,7 @@ public void testSetResponseAfterException() throws InterruptedException, Executi @Test public void testSetResponseDuplicate() throws InterruptedException, ExecutionException { - CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction<>("hello"); + CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction("hello"); Observable o = Observable.create(cr); Future v = o.toBlocking().toFuture(); @@ -129,7 +129,7 @@ public void testSetResponseDuplicate() throws InterruptedException, ExecutionExc @Test(expected = CancellationException.class) public void testSetResponseAfterUnsubscribe() throws InterruptedException, ExecutionException { - CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction<>("hello"); + CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction("hello"); Observable o = Observable.create(cr); Future f = o.toBlocking().toFuture(); @@ -148,7 +148,7 @@ public void testSetResponseAfterUnsubscribe() throws InterruptedException, Execu @Test(expected = CancellationException.class) public void testSetExceptionAfterUnsubscribe() throws InterruptedException, ExecutionException { - CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction<>("hello"); + CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction("hello"); Observable o = Observable.create(cr); Future f = o.toBlocking().toFuture(); @@ -167,7 +167,7 @@ public void testSetExceptionAfterUnsubscribe() throws InterruptedException, Exec @Test public void testUnsubscribeAfterSetResponse() throws InterruptedException, ExecutionException { - CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction<>("hello"); + CollapsedRequestObservableFunction cr = new CollapsedRequestObservableFunction("hello"); Observable o = Observable.create(cr); Future v = o.toBlocking().toFuture(); diff --git a/hystrix-core/src/test/java/com/netflix/hystrix/strategy/HystrixPluginsTest.java b/hystrix-core/src/test/java/com/netflix/hystrix/strategy/HystrixPluginsTest.java index 47a02cdc7..bcfb830f9 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/strategy/HystrixPluginsTest.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/strategy/HystrixPluginsTest.java @@ -222,7 +222,7 @@ public T call() throws Exception { } } - private static final ThreadLocal testRequestIdThreadLocal = new ThreadLocal<>(); + private static final ThreadLocal testRequestIdThreadLocal = new ThreadLocal(); public static class DummyCommand extends HystrixCommand { diff --git a/hystrix-core/src/test/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactoryTest.java b/hystrix-core/src/test/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactoryTest.java index 4884cfe78..b1a7dde98 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactoryTest.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactoryTest.java @@ -49,7 +49,7 @@ public void testSingleInitializePerKey() { final TestHystrixMetricsPublisher publisher = new TestHystrixMetricsPublisher(); HystrixPlugins.getInstance().registerMetricsPublisher(publisher); final HystrixMetricsPublisherFactory factory = new HystrixMetricsPublisherFactory(); - ArrayList threads = new ArrayList<>(); + ArrayList threads = new ArrayList(); for (int i = 0; i < 20; i++) { threads.add(new Thread(new Runnable() { diff --git a/hystrix-dashboard/src/main/java/com/netflix/hystrix/dashboard/stream/MockStreamServlet.java b/hystrix-dashboard/src/main/java/com/netflix/hystrix/dashboard/stream/MockStreamServlet.java index db3442595..bb619e0b1 100644 --- a/hystrix-dashboard/src/main/java/com/netflix/hystrix/dashboard/stream/MockStreamServlet.java +++ b/hystrix-dashboard/src/main/java/com/netflix/hystrix/dashboard/stream/MockStreamServlet.java @@ -107,8 +107,9 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t private String getFileFromPackage(String filename) { try { String file = "/" + this.getClass().getPackage().getName().replace('.', '/') + "/" + filename; - try (InputStream is = this.getClass().getResourceAsStream(file)) { - /* this is FAR too much work just to get a string from a file */ + InputStream is = this.getClass().getResourceAsStream(file); + try { + /* this is FAR too much work just to get a string from a file */ BufferedReader in = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); StringWriter s = new StringWriter(); int c = -1; @@ -116,6 +117,8 @@ private String getFileFromPackage(String filename) { s.write(c); } return s.toString(); + } finally { + is.close(); } } catch (Exception e) { throw new RuntimeException("Could not find file: " + filename, e); diff --git a/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/CommandCollapserGetValueForKey.java b/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/CommandCollapserGetValueForKey.java index b420bcc9e..778c4acff 100644 --- a/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/CommandCollapserGetValueForKey.java +++ b/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/CommandCollapserGetValueForKey.java @@ -74,7 +74,7 @@ private BatchCommand(Collection> requests) { @Override protected List run() { - ArrayList response = new ArrayList<>(); + ArrayList response = new ArrayList(); for (CollapsedRequest request : requests) { // artificial response for each argument received in the batch response.add("ValueForKey: " + request.getArgument()); diff --git a/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/CommandThatFailsSilently.java b/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/CommandThatFailsSilently.java index 35c35c145..37ed285d1 100644 --- a/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/CommandThatFailsSilently.java +++ b/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/CommandThatFailsSilently.java @@ -46,7 +46,7 @@ protected List run() { if (throwException) { throw new RuntimeException("failure from CommandThatFailsFast"); } else { - ArrayList values = new ArrayList<>(); + ArrayList values = new ArrayList(); values.add("success"); return values; } diff --git a/hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/CreditCardCommand.java b/hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/CreditCardCommand.java index f294a4ee1..45ef4838d 100644 --- a/hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/CreditCardCommand.java +++ b/hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/CreditCardCommand.java @@ -168,9 +168,9 @@ public Result submit(String creditCardNumber, String expirationMont } if (Math.random() < 0.8) { - return new Result<>(true); + return new Result(true); } else { - return new Result<>(false); + return new Result(false); } }