From 8c63ccd819c5d14538e76f1c0f046c95365aa411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Javier=20Casta=C3=B1o=20G=C3=B3mez?= Date: Tue, 7 May 2024 13:38:46 +0200 Subject: [PATCH 1/3] SERVER-7194 Virtual threads support --- .../hystrix/HystrixThreadPoolProperties.java | 32 ++++++++--- .../HystrixConcurrencyStrategy.java | 53 ++++++++++--------- 2 files changed, 54 insertions(+), 31 deletions(-) diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolProperties.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolProperties.java index 56f4e6307..7952e0d0c 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolProperties.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolProperties.java @@ -46,11 +46,12 @@ public abstract class HystrixThreadPoolProperties { /* defaults */ - static int default_coreSize = 10; // core size of thread pool - static int default_maximumSize = 10; // maximum size of thread pool - static int default_keepAliveTimeMinutes = 1; // minutes to keep a thread alive - static int default_maxQueueSize = -1; // size of queue (this can't be dynamically changed so we use 'queueSizeRejectionThreshold' to artificially limit and reject) - // -1 turns it off and makes us use SynchronousQueue + static boolean default_useVirtualThreads = true; // virtual threads for thread pool + static int default_coreSize = 10; // core size of thread pool + static int default_maximumSize = 10; // maximum size of thread pool + static int default_keepAliveTimeMinutes = 1; // minutes to keep a thread alive + static int default_maxQueueSize = -1; // size of queue (this can't be dynamically changed so we use 'queueSizeRejectionThreshold' to artificially limit and reject) + // -1 turns it off and makes us use SynchronousQueue static boolean default_allow_maximum_size_to_diverge_from_core_size = false; //should the maximumSize config value get read and used in configuring the threadPool //turning this on should be a conscious decision by the user, so we default it to false @@ -67,6 +68,7 @@ public abstract class HystrixThreadPoolProperties { private final HystrixProperty threadPoolRollingNumberStatisticalWindowInMilliseconds; private final HystrixProperty threadPoolRollingNumberStatisticalWindowBuckets; + private final HystrixProperty useVirtualThreads; protected HystrixThreadPoolProperties(HystrixThreadPoolKey key) { this(key, new Setter(), "hystrix"); @@ -81,6 +83,7 @@ protected HystrixThreadPoolProperties(HystrixThreadPoolKey key, Setter builder, builder.getAllowMaximumSizeToDivergeFromCoreSize(), default_allow_maximum_size_to_diverge_from_core_size); this.corePoolSize = getProperty(propertyPrefix, key, "coreSize", builder.getCoreSize(), default_coreSize); + this.useVirtualThreads = getProperty(propertyPrefix, key, "useVirtualThreads", builder.getUseVirtualThreads(), default_useVirtualThreads); //this object always contains a reference to the configuration value for the maximumSize of the threadpool //it only gets applied if allowMaximumSizeToDivergeFromCoreSize is true this.maximumPoolSize = getProperty(propertyPrefix, key, "maximumSize", builder.getMaximumSize(), default_maximumSize); @@ -186,6 +189,10 @@ public HystrixProperty getAllowMaximumSizeToDivergeFromCoreSize() { return allowMaximumSizeToDivergeFromCoreSize; } + public HystrixProperty getUseVirtualThreads() { + return useVirtualThreads; + } + /** * Duration of statistical rolling window in milliseconds. This is passed into {@link HystrixRollingNumber} inside each {@link HystrixThreadPoolMetrics} instance. * @@ -220,6 +227,10 @@ public static Setter defaultSetter() { return Setter(); } + public Boolean useVirtualThreads() { + return true; + } + /** * Fluent interface that allows chained setting of properties that can be passed into a {@link HystrixThreadPool} via a {@link HystrixCommand} constructor to inject instance specific property * overrides. @@ -245,6 +256,7 @@ public static class Setter { private Boolean allowMaximumSizeToDivergeFromCoreSize = null; private Integer rollingStatisticalWindowInMilliseconds = null; private Integer rollingStatisticalWindowBuckets = null; + private Boolean useVirtualThreads = null; private Setter() { } @@ -281,6 +293,10 @@ public Integer getMetricsRollingStatisticalWindowBuckets() { return rollingStatisticalWindowBuckets; } + public Boolean getUseVirtualThreads() { + return this.useVirtualThreads; + } + public Setter withCoreSize(int value) { this.coreSize = value; return this; @@ -310,6 +326,10 @@ public Setter withAllowMaximumSizeToDivergeFromCoreSize(boolean value) { this.allowMaximumSizeToDivergeFromCoreSize = value; return this; } + public Setter withUseVirtualThreads(boolean value) { + this.useVirtualThreads = value; + return this; + } public Setter withMetricsRollingStatisticalWindowInMilliseconds(int value) { this.rollingStatisticalWindowInMilliseconds = value; @@ -322,7 +342,5 @@ public Setter withMetricsRollingStatisticalWindowBuckets(int value) { } - - } } 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 d5ce887db..178c74604 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 @@ -1,12 +1,12 @@ /** * Copyright 2013 Netflix, Inc. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,6 +27,7 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; +import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadFactory; @@ -60,7 +61,7 @@ public abstract class HystrixConcurrencyStrategy { * Default Implementation *

* Implementation using standard java.util.concurrent.ThreadPoolExecutor - * + * * @param threadPoolKey * {@link HystrixThreadPoolKey} representing the {@link HystrixThreadPool} that this {@link ThreadPoolExecutor} will be used for. * @param corePoolSize @@ -75,8 +76,8 @@ public abstract class HystrixConcurrencyStrategy { * {@code BlockingQueue} as provided by {@link #getBlockingQueue(int)} * @return instance of {@link ThreadPoolExecutor} */ - public ThreadPoolExecutor getThreadPool(final HystrixThreadPoolKey threadPoolKey, HystrixProperty corePoolSize, HystrixProperty maximumPoolSize, HystrixProperty keepAliveTime, TimeUnit unit, BlockingQueue workQueue) { - final ThreadFactory threadFactory = getThreadFactory(threadPoolKey); + public ThreadPoolExecutor getThreadPool(final HystrixThreadPoolKey threadPoolKey, HystrixProperty corePoolSize, HystrixProperty maximumPoolSize, HystrixProperty keepAliveTime, TimeUnit unit, BlockingQueue workQueue, HystrixProperty useVirtualThreads) { + final ThreadFactory threadFactory = getThreadFactory(threadPoolKey, useVirtualThreads.get()); final int dynamicCoreSize = corePoolSize.get(); final int dynamicMaximumSize = maximumPoolSize.get(); @@ -92,7 +93,7 @@ public ThreadPoolExecutor getThreadPool(final HystrixThreadPoolKey threadPoolKey } public ThreadPoolExecutor getThreadPool(final HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties threadPoolProperties) { - final ThreadFactory threadFactory = getThreadFactory(threadPoolKey); + final ThreadFactory threadFactory = getThreadFactory(threadPoolKey, threadPoolProperties.useVirtualThreads()); final boolean allowMaximumSizeToDivergeFromCoreSize = threadPoolProperties.getAllowMaximumSizeToDivergeFromCoreSize().get(); final int dynamicCoreSize = threadPoolProperties.coreSize().get(); @@ -115,19 +116,23 @@ public ThreadPoolExecutor getThreadPool(final HystrixThreadPoolKey threadPoolKey } } - private static ThreadFactory getThreadFactory(final HystrixThreadPoolKey threadPoolKey) { - if (!PlatformSpecific.isAppEngineStandardEnvironment()) { - return new ThreadFactory() { - private final AtomicInteger threadNumber = new AtomicInteger(0); - - @Override - public Thread newThread(Runnable r) { - Thread thread = new Thread(r, "hystrix-" + threadPoolKey.name() + "-" + threadNumber.incrementAndGet()); - thread.setDaemon(true); - return thread; - } - - }; + private static ThreadFactory getThreadFactory(final HystrixThreadPoolKey threadPoolKey, final Boolean virtual) { + if (!PlatformSpecific.isAppEngineStandardEnvironment()) { + if (virtual) { + return Thread.ofVirtual().name("hystrix-" + threadPoolKey + "-", 0).factory(); + } else { + return new ThreadFactory() { + private final AtomicInteger threadNumber = new AtomicInteger(0); + + @Override + public Thread newThread(Runnable r) { + Thread thread = new Thread(r, "hystrix-" + threadPoolKey.name() + "-" + threadNumber.incrementAndGet()); + thread.setDaemon(true); + return thread; + } + + }; + } } else { return PlatformSpecific.getAppEngineThreadFactory(); } @@ -142,7 +147,7 @@ public Thread newThread(Runnable r) { * Default Implementation *

* Implementation returns {@link SynchronousQueue} when maxQueueSize <= 0 or {@link LinkedBlockingQueue} when maxQueueSize > 0. - * + * * @param maxQueueSize * The max size of the queue requested via properties (or system default if no properties set). * @return instance of {@code BlockingQueue} @@ -171,7 +176,7 @@ public BlockingQueue getBlockingQueue(int maxQueueSize) { * Default Implementation *

* Pass-thru that does no wrapping. - * + * * @param callable * {@code Callable} to be executed via a {@link ThreadPoolExecutor} * @return {@code Callable} either as a pass-thru or wrapping the one given @@ -189,7 +194,7 @@ public Callable wrapCallable(Callable callable) { *

* If this method is implemented it is generally necessary to also implemented {@link #wrapCallable(Callable)} in order to copy state * from parent to child thread. - * + * * @param rv * {@link HystrixRequestVariableLifecycle} with lifecycle implementations from Hystrix * @return {@code HystrixRequestVariable} @@ -197,5 +202,5 @@ public Callable wrapCallable(Callable callable) { public HystrixRequestVariable getRequestVariable(final HystrixRequestVariableLifecycle rv) { return new HystrixLifecycleForwardingRequestVariable(rv); } - + } From 833ab7ceed652ac65e9dbc12fb47c5ebf1609daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Javier=20Casta=C3=B1o=20G=C3=B3mez?= Date: Tue, 7 May 2024 13:45:23 +0200 Subject: [PATCH 2/3] SERVER-7194 Build against Java 21 --- .github/workflows/nebula-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nebula-ci.yml b/.github/workflows/nebula-ci.yml index 9150ee402..2d8404850 100644 --- a/.github/workflows/nebula-ci.yml +++ b/.github/workflows/nebula-ci.yml @@ -12,8 +12,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - # test against JDK 8 - java: [ 8 ] + # test against JDK 21 + java: [ 21 ] name: CI with Java ${{ matrix.java }} steps: - uses: actions/checkout@v1 From d8837a4a4afd6c1bf1e893952b22921f40d7d54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Javier=20Casta=C3=B1o=20G=C3=B3mez?= Date: Fri, 10 May 2024 12:49:25 +0200 Subject: [PATCH 3/3] SERVER-7194 Java 21 and virtual threads --- .github/workflows/nebula-ci.yml | 45 ---------------- .github/workflows/nebula-publish.yml | 51 ------------------- .github/workflows/nebula-snapshot.yml | 37 -------------- build.gradle | 22 +++++++- gradle/wrapper/gradle-wrapper.properties | 6 ++- hystrix-contrib/hystrix-javanica/build.gradle | 1 + .../aop/aspectj/HystrixCommandAspect.java | 22 ++++---- .../javanica/collapser/CommandCollapser.java | 6 ++- .../command/AbstractHystrixCommand.java | 8 +-- .../command/CommandExecutionAction.java | 3 +- .../javanica/command/CommandExecutor.java | 8 +-- .../command/GenericObservableCommand.java | 12 ++--- .../javanica/utils/FallbackMethod.java | 11 ++-- .../javanica/utils/FutureDecorator.java | 8 +-- .../contrib/javanica/utils/TypeHelper.java | 6 +-- .../CacheInvocationContextFactoryTest.java | 10 ++-- .../BasicObservableErrorPropagationTest.java | 2 +- .../fallback/BasicGenericFallbackTest.java | 4 +- .../HystricsMetricsControllerTest.java | 4 +- .../com/netflix/hystrix/AbstractCommand.java | 20 ++++---- .../com/netflix/hystrix/HystrixCollapser.java | 4 +- .../com/netflix/hystrix/HystrixCommand.java | 3 +- .../hystrix/HystrixObservableCollapser.java | 4 +- .../netflix/hystrix/HystrixRequestLog.java | 4 +- .../hystrix/collapser/RequestBatch.java | 4 +- .../strategy/HystrixArchaiusHelper.java | 5 +- .../hystrix/strategy/HystrixPlugins.java | 6 ++- .../HystrixPropertiesChainedProperty.java | 2 +- .../netflix/hystrix/HystrixCommandTest.java | 25 ++++----- .../HystrixObservableCollapserTest.java | 2 +- .../hystrix/HystrixObservableCommandTest.java | 50 +++++++++--------- .../hystrix/HystrixSubclassCommandTest.java | 4 +- .../hystrix/strategy/HystrixPluginsTest.java | 14 ++--- .../basic/CommandThatFailsSilently.java | 2 +- .../ObservableCollapserGetWordForNumber.java | 6 +-- settings.gradle | 16 ------ 36 files changed, 151 insertions(+), 286 deletions(-) delete mode 100644 .github/workflows/nebula-ci.yml delete mode 100644 .github/workflows/nebula-publish.yml delete mode 100644 .github/workflows/nebula-snapshot.yml diff --git a/.github/workflows/nebula-ci.yml b/.github/workflows/nebula-ci.yml deleted file mode 100644 index 2d8404850..000000000 --- a/.github/workflows/nebula-ci.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: "CI" -on: - push: - branches: - - '*' - tags-ignore: - - '*' - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - # test against JDK 21 - java: [ 21 ] - name: CI with Java ${{ matrix.java }} - steps: - - uses: actions/checkout@v1 - - name: Setup jdk - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.java }} - - uses: actions/cache@v1 - id: gradle-cache - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }} - restore-keys: | - - ${{ runner.os }}-gradle- - - uses: actions/cache@v1 - id: gradle-wrapper-cache - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradlewrapper-${{ hashFiles('gradle/wrapper/*') }} - restore-keys: | - - ${{ runner.os }}-gradlewrapper- - - name: Build with Gradle - run: ./gradlew --info --stacktrace build - env: - CI_NAME: github_actions - CI_BUILD_NUMBER: ${{ github.sha }} - CI_BUILD_URL: 'https://github.com/${{ github.repository }}' - CI_BRANCH: ${{ github.ref }} - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/nebula-publish.yml b/.github/workflows/nebula-publish.yml deleted file mode 100644 index 5e20218a1..000000000 --- a/.github/workflows/nebula-publish.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: "Publish candidate/release to NetflixOSS and Maven Central" -on: - push: - tags: - - v*.*.* - - v*.*.*-rc.* - release: - types: - - published - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Setup jdk 8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - uses: actions/cache@v1 - id: gradle-cache - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }} - restore-keys: | - - ${{ runner.os }}-gradle- - - uses: actions/cache@v1 - id: gradle-wrapper-cache - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradlewrapper-${{ hashFiles('gradle/wrapper/*') }} - restore-keys: | - - ${{ runner.os }}-gradlewrapper- - - name: Publish candidate - if: contains(github.ref, '-rc.') - run: ./gradlew --info --stacktrace -Prelease.useLastTag=true candidate - env: - NETFLIX_OSS_SIGNING_KEY: ${{ secrets.ORG_SIGNING_KEY }} - NETFLIX_OSS_SIGNING_PASSWORD: ${{ secrets.ORG_SIGNING_PASSWORD }} - NETFLIX_OSS_REPO_USERNAME: ${{ secrets.ORG_NETFLIXOSS_USERNAME }} - NETFLIX_OSS_REPO_PASSWORD: ${{ secrets.ORG_NETFLIXOSS_PASSWORD }} - - name: Publish release - if: (!contains(github.ref, '-rc.')) - run: ./gradlew --info -Prelease.useLastTag=true final - env: - NETFLIX_OSS_SONATYPE_USERNAME: ${{ secrets.ORG_SONATYPE_USERNAME }} - NETFLIX_OSS_SONATYPE_PASSWORD: ${{ secrets.ORG_SONATYPE_PASSWORD }} - NETFLIX_OSS_SIGNING_KEY: ${{ secrets.ORG_SIGNING_KEY }} - NETFLIX_OSS_SIGNING_PASSWORD: ${{ secrets.ORG_SIGNING_PASSWORD }} - NETFLIX_OSS_REPO_USERNAME: ${{ secrets.ORG_NETFLIXOSS_USERNAME }} - NETFLIX_OSS_REPO_PASSWORD: ${{ secrets.ORG_NETFLIXOSS_PASSWORD }} diff --git a/.github/workflows/nebula-snapshot.yml b/.github/workflows/nebula-snapshot.yml deleted file mode 100644 index b4ee74093..000000000 --- a/.github/workflows/nebula-snapshot.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: "Publish snapshot to NetflixOSS and Maven Central" - -on: - push: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set up JDK - uses: actions/setup-java@v1 - with: - java-version: 8 - - uses: actions/cache@v2 - id: gradle-cache - with: - path: | - ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - - uses: actions/cache@v2 - id: gradle-wrapper-cache - with: - path: | - ~/.gradle/wrapper - key: ${{ runner.os }}-gradlewrapper-${{ hashFiles('gradle/wrapper/*') }} - - name: Build - run: ./gradlew build snapshot - env: - NETFLIX_OSS_SIGNING_KEY: ${{ secrets.ORG_SIGNING_KEY }} - NETFLIX_OSS_SIGNING_PASSWORD: ${{ secrets.ORG_SIGNING_PASSWORD }} - NETFLIX_OSS_REPO_USERNAME: ${{ secrets.ORG_NETFLIXOSS_USERNAME }} - NETFLIX_OSS_REPO_PASSWORD: ${{ secrets.ORG_NETFLIXOSS_PASSWORD }} diff --git a/build.gradle b/build.gradle index bb71914a7..8f31de83b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,38 @@ plugins { - + id "java" id "com.netflix.nebula.netflixoss" version "11.3.1" id "me.champeau.jmh" version "0.7.1" + id("org.openrewrite.rewrite") version("6.12.0") } group = "com.netflix" +version = '1.5.19-SNAPSHOT' allprojects { repositories { mavenCentral() } } - +dependencies { + rewrite("org.openrewrite.recipe:rewrite-migrate-java:2.12.0") +} +rewrite { + activeRecipe("org.openrewrite.java.migrate.UpgradeToJava21") +} subprojects { + apply plugin: 'nebula.netflixoss' apply plugin: 'java-library' + apply plugin: 'java' + + test { + jvmArgs '--add-opens', 'java.base/java.lang=ALL-UNNAMED' + } + java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } + } group = "com.netflix.hystrix" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 298061e64..db8c3baaf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,8 @@ -#Mon Jun 19 21:27:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip diff --git a/hystrix-contrib/hystrix-javanica/build.gradle b/hystrix-contrib/hystrix-javanica/build.gradle index 2e1a0d3e7..503e4bc04 100644 --- a/hystrix-contrib/hystrix-javanica/build.gradle +++ b/hystrix-contrib/hystrix-javanica/build.gradle @@ -109,4 +109,5 @@ dependencies { testImplementation 'log4j:log4j:1.2.17' testImplementation 'org.slf4j:slf4j-log4j12:1.7.7' testImplementation 'com.tngtech.java:junit-dataprovider:1.10.2' + testImplementation 'javax.annotation:javax.annotation-api:1.2' } diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect.java index 47cf74c8b..686434238 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect.java @@ -88,8 +88,10 @@ public Object methodsAnnotatedWithHystrixCommand(final ProceedingJoinPoint joinP Method method = getMethodFromTarget(joinPoint); Validate.notNull(method, "failed to get method from joinPoint: %s", joinPoint); if (method.isAnnotationPresent(HystrixCommand.class) && method.isAnnotationPresent(HystrixCollapser.class)) { - throw new IllegalStateException("method cannot be annotated with HystrixCommand and HystrixCollapser " + - "annotations at the same time"); + throw new IllegalStateException(""" + method cannot be annotated with HystrixCommand and HystrixCollapser \ + annotations at the same time\ + """); } MetaHolderFactory metaHolderFactory = META_HOLDER_FACTORY_MAP.get(HystrixPointcutType.of(method)); MetaHolder metaHolder = metaHolderFactory.create(joinPoint); @@ -119,8 +121,7 @@ private Object executeObservable(HystrixInvokable invokable, ExecutionType execu public Observable call(Throwable throwable) { if (throwable instanceof HystrixBadRequestException) { return Observable.error(throwable.getCause()); - } else if (throwable instanceof HystrixRuntimeException) { - HystrixRuntimeException hystrixRuntimeException = (HystrixRuntimeException) throwable; + } else if (throwable instanceof HystrixRuntimeException hystrixRuntimeException) { return Observable.error(hystrixRuntimeExceptionToThrowable(metaHolder, hystrixRuntimeException)); } return Observable.error(throwable); @@ -154,11 +155,10 @@ private Throwable getCause(HystrixRuntimeException e) { // latest exception in flow should be propagated to end user if (e.getFallbackException() instanceof FallbackInvocationException) { cause = e.getFallbackException().getCause(); - if (cause instanceof HystrixRuntimeException) { - cause = getCause((HystrixRuntimeException) cause); + if (cause instanceof HystrixRuntimeException exception) { + cause = getCause(exception); } - } else if (cause instanceof CommandActionExecutionException) { // this situation is possible only if a callee throws an exception which type extends Throwable directly - CommandActionExecutionException commandActionExecutionException = (CommandActionExecutionException) cause; + } else if (cause instanceof CommandActionExecutionException commandActionExecutionException) { cause = commandActionExecutionException.getCause(); } @@ -310,12 +310,12 @@ private static Class getFirstGenericParameter(final Type type, final int nest for (int cDept = 0; cDept < nestedDepth; cDept++) { if (!(tType instanceof ParameterizedType)) - throw new IllegalStateException(String.format("Sub type at nesting level %d of %s is expected to be generic", cDepth, type)); + throw new IllegalStateException("Sub type at nesting level %d of %s is expected to be generic".formatted(cDepth, type)); tType = ((ParameterizedType) tType).getActualTypeArguments()[cDept]; } - if (tType instanceof ParameterizedType) - return (Class) ((ParameterizedType) tType).getRawType(); + if (tType instanceof ParameterizedType parameterizedType) + return (Class) parameterizedType.getRawType(); else if (tType instanceof Class) return (Class) tType; diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/collapser/CommandCollapser.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/collapser/CommandCollapser.java index 4e3ab1a46..5a9e791b6 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/collapser/CommandCollapser.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/collapser/CommandCollapser.java @@ -34,8 +34,10 @@ public class CommandCollapser extends HystrixCollapser, Object, Obj private MetaHolder metaHolder; - private static final String ERROR_MSG = "Failed to map all collapsed requests to response. " + - "The expected contract has not been respected. "; + private static final String ERROR_MSG = """ + Failed to map all collapsed requests to response. \ + The expected contract has not been respected. \ + """; private static final String ERROR_MSF_TEMPLATE = "Collapser key: '{}', requests size: '{}', response size: '{}'"; diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/AbstractHystrixCommand.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/AbstractHystrixCommand.java index 661963534..723c2b3e8 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/AbstractHystrixCommand.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/AbstractHystrixCommand.java @@ -149,10 +149,10 @@ Object process(Action action) throws Exception { if (isIgnorable(cause)) { throw new HystrixBadRequestException(cause.getMessage(), cause); } - if (cause instanceof RuntimeException) { - throw (RuntimeException) cause; - } else if (cause instanceof Exception) { - throw (Exception) cause; + if (cause instanceof RuntimeException exception) { + throw exception; + } else if (cause instanceof Exception exception) { + throw exception; } else { // instance of Throwable throw new CommandActionExecutionException(cause); diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/CommandExecutionAction.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/CommandExecutionAction.java index 0cc55c8c7..5942225bc 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/CommandExecutionAction.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/CommandExecutionAction.java @@ -57,8 +57,7 @@ public Object executeWithArgs(ExecutionType executionType, Object[] args) throws */ @Override public String getActionName() { - if (hystrixCommand != null && hystrixCommand instanceof HystrixInvokableInfo) { - HystrixInvokableInfo info = (HystrixInvokableInfo) hystrixCommand; + if (hystrixCommand != null && hystrixCommand instanceof HystrixInvokableInfo info) { return info.getCommandKey().name(); } return ""; diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/CommandExecutor.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/CommandExecutor.java index 9c8bc8a59..bff162a4c 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/CommandExecutor.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/CommandExecutor.java @@ -69,15 +69,15 @@ public static Object execute(HystrixInvokable invokable, ExecutionType execution } private static HystrixExecutable castToExecutable(HystrixInvokable invokable, ExecutionType executionType) { - if (invokable instanceof HystrixExecutable) { - return (HystrixExecutable) invokable; + if (invokable instanceof HystrixExecutable executable) { + return executable; } throw new RuntimeException("Command should implement " + HystrixExecutable.class.getCanonicalName() + " interface to execute in: " + executionType + " mode"); } private static HystrixObservable castToObservable(HystrixInvokable invokable) { - if (invokable instanceof HystrixObservable) { - return (HystrixObservable) invokable; + if (invokable instanceof HystrixObservable observable) { + return observable; } throw new RuntimeException("Command should implement " + HystrixObservable.class.getCanonicalName() + " interface to execute in observable mode"); } diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/GenericObservableCommand.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/GenericObservableCommand.java index 75f56a5fa..3d79fb5f6 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/GenericObservableCommand.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/GenericObservableCommand.java @@ -106,12 +106,12 @@ protected Observable resumeWithFallback() { Object[] args = createArgsForFallback(metaHolder, cause); try { Object res = commandActions.getFallbackAction().executeWithArgs(executionType, args); - if (res instanceof Observable) { - return (Observable) res; - } else if (res instanceof Single) { - return ((Single) res).toObservable(); - } else if (res instanceof Completable) { - return ((Completable) res).toObservable(); + if (res instanceof Observable observable) { + return observable; + } else if (res instanceof Single single) { + return single.toObservable(); + } else if (res instanceof Completable completable) { + return completable.toObservable(); } else { return Observable.just(res); } diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/FallbackMethod.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/FallbackMethod.java index ebfce242a..acca4fde2 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/FallbackMethod.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/FallbackMethod.java @@ -143,8 +143,7 @@ public void validateReturnType(Method commandMethod) throws FallbackDefinitionEx private Type getFirstParametrizedType(Method m) { Type gtype = m.getGenericReturnType(); - if (gtype instanceof ParameterizedType) { - ParameterizedType pType = (ParameterizedType) gtype; + if (gtype instanceof ParameterizedType pType) { return pType.getActualTypeArguments()[0]; } return null; @@ -173,7 +172,7 @@ private void validateReturnType(Method commandMethod, Method fallbackMethod) { extraHint = "--> " + ((ParameterizedType) parentKind).getRawType().toString() + "\n"; } } - msg.add(String.format(error.reason + "\n" + extraHint + "Command type literal pos: %s; Fallback type literal pos: %s", + msg.add((error.reason + "\n" + extraHint + "Command type literal pos: %s; Fallback type literal pos: %s").formatted( positionAsString(error.commandType, commandParametrizedTypes), positionAsString(error.fallbackType, fallbackParametrizedTypes))); } @@ -286,7 +285,7 @@ private static Result regularEquals(final Type commandType, final Type fallbackT public List get() { return Collections.singletonList(new Error( commandType, - String.format("Different types. Command type: '%s'; fallback type: '%s'", commandType, fallbackType), + "Different types. Command type: '%s'; fallback type: '%s'".formatted(commandType, fallbackType), fallbackType)); } }); @@ -314,7 +313,7 @@ private static int position(Type type, List types) { private static Error boundsError(Type t1, Type[] b1, String boundType, Type t2, Type[] b2) { return new Error(t1, - String.format("Different %s bounds. Command bounds: '%s'; Fallback bounds: '%s'", + "Different %s bounds. Command bounds: '%s'; Fallback bounds: '%s'".formatted( boundType, StringUtils.join(b1, ", "), StringUtils.join(b2, ", ")), @@ -326,7 +325,7 @@ private static Result equals(Type[] t1, Type[] t2) { if (t1 == null) return Result.failure(); if (t2 == null) return Result.failure(); if (t1.length != t2.length) - return Result.failure(new Error(String.format("Different size of type literals. Command size = %d, fallback size = %d", + return Result.failure(new Error("Different size of type literals. Command size = %d, fallback size = %d".formatted( t1.length, t2.length))); Result result = SUCCESS; for (int i = 0; i < t1.length; i++) { diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/FutureDecorator.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/FutureDecorator.java index 15449457c..349256fa8 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/FutureDecorator.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/FutureDecorator.java @@ -47,8 +47,8 @@ public boolean isDone() { @Override public Object get() throws InterruptedException, ExecutionException { Object result = origin.get(); - if (result instanceof Future) { - return ((Future) result).get(); + if (result instanceof Future future) { + return future.get(); } return result; } @@ -56,8 +56,8 @@ public Object get() throws InterruptedException, ExecutionException { @Override public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { Object result = origin.get(timeout, unit); - if (result instanceof Future) { - return ((Future) result).get(); + if (result instanceof Future future) { + return future.get(); } return result; } diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/TypeHelper.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/TypeHelper.java index 006591a30..5640f8a78 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/TypeHelper.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/TypeHelper.java @@ -87,11 +87,9 @@ public static List flattenTypeVariables(Type type) { TreeTraverser typeTraverser = new TreeTraverser() { @Override public Iterable children(Type root) { - if (root instanceof ParameterizedType) { - ParameterizedType pType = (ParameterizedType) root; + if (root instanceof ParameterizedType pType) { return Arrays.asList(pType.getActualTypeArguments()); - } else if (root instanceof TypeVariable) { - TypeVariable pType = (TypeVariable) root; + } else if (root instanceof TypeVariable pType) { return Arrays.asList(pType.getBounds()); } return Collections.emptyList(); diff --git a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/cache/CacheInvocationContextFactoryTest.java b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/cache/CacheInvocationContextFactoryTest.java index f9026250f..a512a5d82 100644 --- a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/cache/CacheInvocationContextFactoryTest.java +++ b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/cache/CacheInvocationContextFactoryTest.java @@ -56,10 +56,10 @@ public void testCreateCacheResultInvocationContext_givenMethodAnnotatedWithCache // then assertNotNull(context.getKeyParameters()); assertEquals(2, context.getKeyParameters().size()); - assertEquals(String.class, context.getKeyParameters().get(0).getRawType()); - assertEquals(0, context.getKeyParameters().get(0).getPosition()); - assertEquals(param1, context.getKeyParameters().get(0).getValue()); - assertTrue(isAnnotationPresent(context.getKeyParameters().get(0), CacheKey.class)); + assertEquals(String.class, context.getKeyParameters().getFirst().getRawType()); + assertEquals(0, context.getKeyParameters().getFirst().getPosition()); + assertEquals(param1, context.getKeyParameters().getFirst().getValue()); + assertTrue(isAnnotationPresent(context.getKeyParameters().getFirst(), CacheKey.class)); assertEquals(Integer.class, context.getKeyParameters().get(1).getRawType()); assertEquals(2, context.getKeyParameters().get(1).getPosition()); @@ -83,7 +83,7 @@ public void testCreateCacheRemoveInvocationContext_givenMethodAnnotatedWithCache // then assertNotNull(context.getKeyParameters()); assertEquals(1, context.getKeyParameters().size()); - CacheInvocationParameter actual = context.getKeyParameters().get(0); + CacheInvocationParameter actual = context.getKeyParameters().getFirst(); assertEquals(String.class, actual.getRawType()); assertEquals(param1, actual.getValue()); assertEquals(0, actual.getPosition()); diff --git a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/error/BasicObservableErrorPropagationTest.java b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/error/BasicObservableErrorPropagationTest.java index cf6eff1fb..dabede7c4 100644 --- a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/error/BasicObservableErrorPropagationTest.java +++ b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/error/BasicObservableErrorPropagationTest.java @@ -124,7 +124,7 @@ public void testBlockUser() throws NotFoundException, ActivationException, Opera testSubscriber.assertError(Throwable.class); assertTrue(testSubscriber.getOnErrorEvents().size() == 1); - assertTrue(testSubscriber.getOnErrorEvents().get(0).getCause() instanceof OperationException); + assertTrue(testSubscriber.getOnErrorEvents().getFirst().getCause() instanceof OperationException); } finally { assertEquals(2, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size()); com.netflix.hystrix.HystrixInvokableInfo activateUserCommand = getHystrixCommandByKey("blockUser"); diff --git a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/fallback/BasicGenericFallbackTest.java b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/fallback/BasicGenericFallbackTest.java index f6f6d1bde..79b046098 100644 --- a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/fallback/BasicGenericFallbackTest.java +++ b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/fallback/BasicGenericFallbackTest.java @@ -296,8 +296,8 @@ private static Object executeCommand(Object proxy) { return method.invoke(proxy); } catch (InvocationTargetException e) { Throwable t = e.getCause(); - if (t instanceof FallbackDefinitionException) { - throw (FallbackDefinitionException) t; + if (t instanceof FallbackDefinitionException exception) { + throw exception; } else throw new RuntimeException(e); } catch (Exception e) { throw new RuntimeException(e); diff --git a/hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/test/java/com/netflix/hystrix/contrib/metrics/controller/HystricsMetricsControllerTest.java b/hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/test/java/com/netflix/hystrix/contrib/metrics/controller/HystricsMetricsControllerTest.java index 8baf3272d..2ec824c17 100644 --- a/hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/test/java/com/netflix/hystrix/contrib/metrics/controller/HystricsMetricsControllerTest.java +++ b/hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/test/java/com/netflix/hystrix/contrib/metrics/controller/HystricsMetricsControllerTest.java @@ -128,8 +128,8 @@ public void testConcurrency() throws Exception { } // Close one of the connections - streamList.get(0).close(); - streamList.remove(0); + streamList.getFirst().close(); + streamList.removeFirst(); // Try again after closing one of the connections. This request should go through. EventInput eventInput = getStream(); 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 ad1f6544f..9b4e17ae0 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java @@ -1559,14 +1559,14 @@ private R wrapWithOnEmitHook(R r) { * @return HystrixRuntimeException, HystrixBadRequestException or IllegalStateException */ protected Throwable decomposeException(Exception e) { - if (e instanceof IllegalStateException) { - return (IllegalStateException) e; + if (e instanceof IllegalStateException exception) { + return exception; } - if (e instanceof HystrixBadRequestException) { + if (e instanceof HystrixBadRequestException exception) { if (shouldNotBeWrapped(e.getCause())) { return e.getCause(); } - return (HystrixBadRequestException) e; + return exception; } if (e.getCause() instanceof HystrixBadRequestException) { if(shouldNotBeWrapped(e.getCause().getCause())) { @@ -1574,8 +1574,8 @@ protected Throwable decomposeException(Exception e) { } return (HystrixBadRequestException) e.getCause(); } - if (e instanceof HystrixRuntimeException) { - return (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException exception) { + return exception; } // if we have an exception we know about we'll throw it directly without the wrapper exception if (e.getCause() instanceof HystrixRuntimeException) { @@ -1971,8 +1971,8 @@ public ExecutionResult.EventCounts getEventCounts() { protected Exception getExceptionFromThrowable(Throwable t) { Exception e; - if (t instanceof Exception) { - e = (Exception) t; + if (t instanceof Exception exception) { + e = exception; } else { // Hystrix 1.x uses Exception, not Throwable so to prevent a breaking change Throwable will be wrapped in Exception e = new Exception("Throwable caught while executing.", t); @@ -2209,8 +2209,8 @@ public void onUnsubscribe(HystrixInvokable commandInstance) { @SuppressWarnings({ "unchecked", "rawtypes" }) private HystrixCommand getHystrixCommandFromAbstractIfApplicable(HystrixInvokable commandInstance) { - if (commandInstance instanceof HystrixCommand) { - return (HystrixCommand) commandInstance; + if (commandInstance instanceof HystrixCommand command) { + return command; } else { return null; } 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 c32063fe4..252dcf8c1 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapser.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCollapser.java @@ -427,8 +427,8 @@ public ResponseType execute() { try { return queue().get(); } catch (Throwable e) { - if (e instanceof HystrixRuntimeException) { - throw (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException exception) { + throw exception; } // if we have an exception we know about we'll throw it directly without the threading wrapper exception if (e.getCause() instanceof HystrixRuntimeException) { diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommand.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommand.java index dba1e3356..eee88971a 100755 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommand.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommand.java @@ -439,8 +439,7 @@ public R get(long timeout, TimeUnit unit) throws InterruptedException, Execution Throwable t = decomposeException(e); if (t instanceof HystrixBadRequestException) { return f; - } else if (t instanceof HystrixRuntimeException) { - HystrixRuntimeException hre = (HystrixRuntimeException) t; + } else if (t instanceof HystrixRuntimeException hre) { switch (hre.getFailureType()) { case COMMAND_EXCEPTION: case TIMEOUT: 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 a50e7cca7..120021869 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixObservableCollapser.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixObservableCollapser.java @@ -239,8 +239,8 @@ public HystrixCollapserKey getCollapserKey() { protected Exception getExceptionFromThrowable(Throwable t) { Exception e; - if (t instanceof Exception) { - e = (Exception) t; + if (t instanceof Exception exception) { + e = exception; } else { // Hystrix 1.x uses Exception, not Throwable so to prevent a breaking change Throwable will be wrapped in Exception e = new Exception("Throwable caught while executing.", t); 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 e9131df78..55ac51b37 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestLog.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestLog.java @@ -129,9 +129,7 @@ public Collection> getAllExecutedCommands() { } // TODO remove this when deprecation completed - if (command instanceof HystrixCommand) { - @SuppressWarnings("rawtypes") - HystrixCommand _c = (HystrixCommand) command; + if (command instanceof @SuppressWarnings("rawtypes") HystrixCommand _c) { if (!executedCommands.offer(_c)) { // see RequestLog: Reduce Chance of Memory Leak https://github.com/Netflix/Hystrix/issues/53 logger.warn("RequestLog ignoring command after reaching limit of " + MAX_STORAGE + ". See https://github.com/Netflix/Hystrix/issues/53 for more information."); 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 98582922a..8429538eb 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 @@ -180,8 +180,8 @@ public void executeBatchIfNotAlreadyStarted() { public void call(Throwable e) { // handle Throwable in case anything is thrown so we don't block Observers waiting for onError/onCompleted Exception ee; - if (e instanceof Exception) { - ee = (Exception) e; + if (e instanceof Exception exception) { + ee = exception; } else { ee = new RuntimeException("Throwable caught while executing batch and mapping responses.", e); } diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixArchaiusHelper.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixArchaiusHelper.java index f4914df47..5b2c73480 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixArchaiusHelper.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixArchaiusHelper.java @@ -73,7 +73,10 @@ static HystrixDynamicProperties createArchaiusDynamicProperties() { loadCascadedPropertiesFromResources("hystrix-plugins"); try { Class defaultProperties = Class.forName( - "com.netflix.hystrix.strategy.properties.archaius" + ".HystrixDynamicPropertiesArchaius"); + """ + com.netflix.hystrix.strategy.properties.archaius\ + .HystrixDynamicPropertiesArchaius\ + """); return (HystrixDynamicProperties) defaultProperties.newInstance(); } catch (ClassNotFoundException e) { throw new RuntimeException(e); 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 3aa083989..12cbdcc70 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 @@ -369,8 +369,10 @@ private static HystrixDynamicProperties resolveDynamicProperties(ClassLoader cla HystrixDynamicPropertiesSystemProperties.getInstance()); if (hp != null) { logSupplier.getLogger().debug( - "Created HystrixDynamicProperties instance from System property named " - + "\"hystrix.plugin.HystrixDynamicProperties.implementation\". Using class: {}", + """ + Created HystrixDynamicProperties instance from System property named \ + "hystrix.plugin.HystrixDynamicProperties.implementation". Using class: {}\ + """, hp.getClass().getCanonicalName()); return hp; } diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesChainedProperty.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesChainedProperty.java index ea56d1e73..dcae32061 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesChainedProperty.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesChainedProperty.java @@ -147,7 +147,7 @@ public ChainBuilder add(String name, T defaultValue) { public HystrixDynamicProperty build() { if (properties.size() < 1) throw new IllegalArgumentException(); - if (properties.size() == 1) return properties.get(0); + if (properties.size() == 1) return properties.getFirst(); List> reversed = new ArrayList>(properties); Collections.reverse(reversed); 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 c82990ab4..48f8f13cd 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandTest.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandTest.java @@ -682,8 +682,7 @@ public void testExecutionTimeoutWithNoFallback() { fail("we shouldn't get here"); } catch (Exception e) { // e.printStackTrace(); - if (e instanceof HystrixRuntimeException) { - HystrixRuntimeException de = (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException de) { assertNotNull(de.getFallbackException()); assertTrue(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); @@ -734,8 +733,7 @@ public void testExecutionTimeoutFallbackFailure() { command.execute(); fail("we shouldn't get here"); } catch (Exception e) { - if (e instanceof HystrixRuntimeException) { - HystrixRuntimeException de = (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException de) { assertNotNull(de.getFallbackException()); assertFalse(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); @@ -876,8 +874,7 @@ public void testObservedExecutionTimeoutWithNoFallback() { fail("we shouldn't get here"); } catch (Exception e) { e.printStackTrace(); - if (e instanceof HystrixRuntimeException) { - HystrixRuntimeException de = (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException de) { assertNotNull(de.getFallbackException()); assertTrue(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); @@ -926,8 +923,7 @@ public void testObservedExecutionTimeoutFallbackFailure() { command.observe().toBlocking().single(); fail("we shouldn't get here"); } catch (Exception e) { - if (e instanceof HystrixRuntimeException) { - HystrixRuntimeException de = (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException de) { assertNotNull(de.getFallbackException()); assertFalse(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); @@ -1009,8 +1005,7 @@ public void run() { assertFalse(command2.isResponseTimedOut()); assertNotNull(command2.getExecutionException()); - if (e instanceof HystrixRuntimeException && e.getCause() instanceof RejectedExecutionException) { - HystrixRuntimeException de = (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException de && e.getCause() instanceof RejectedExecutionException) { assertNotNull(de.getFallbackException()); assertTrue(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); @@ -1090,8 +1085,7 @@ public void testRejectedThreadWithFallbackFailure() throws ExecutionException, I fail("we shouldn't get here"); } catch (Exception e) { e.printStackTrace(); - if (e instanceof HystrixRuntimeException && e.getCause() instanceof RejectedExecutionException) { - HystrixRuntimeException de = (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException de && e.getCause() instanceof RejectedExecutionException) { assertNotNull(de.getFallbackException()); assertFalse(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); @@ -1163,8 +1157,7 @@ public void run() { assertFalse(command.isResponseTimedOut()); assertNotNull(command.getExecutionException()); - if (e instanceof HystrixRuntimeException && e.getCause() instanceof RejectedExecutionException) { - HystrixRuntimeException de = (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException de && e.getCause() instanceof RejectedExecutionException) { assertNotNull(de.getFallbackException()); assertTrue(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); @@ -2783,8 +2776,8 @@ public void call(Throwable t1) { List errors = ts.getOnErrorEvents(); assertEquals(1, errors.size()); - Throwable e = errors.get(0); - if (errors.get(0) instanceof HystrixRuntimeException) { + Throwable e = errors.getFirst(); + if (errors.getFirst() instanceof HystrixRuntimeException) { HystrixRuntimeException de = (HystrixRuntimeException) e; assertNotNull(de.getFallbackException()); assertTrue(de.getFallbackException() instanceof UnsupportedOperationException); diff --git a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCollapserTest.java b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCollapserTest.java index 083950359..b5adaaf48 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCollapserTest.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCollapserTest.java @@ -580,7 +580,7 @@ public void testTwoRequestsWhenBatchCommandFails() { testSubscriber2.awaitTerminalEvent(); testSubscriber1.assertError(RuntimeException.class); - testSubscriber1.getOnErrorEvents().get(0).printStackTrace(); + testSubscriber1.getOnErrorEvents().getFirst().printStackTrace(); testSubscriber1.assertNoValues(); testSubscriber2.assertError(RuntimeException.class); testSubscriber2.assertNoValues(); 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 f455f6bad..48152ec04 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java @@ -702,8 +702,7 @@ public void testExecutionTimeoutWithNoFallbackUsingSemaphoreIsolation() { fail("we shouldn't get here"); } catch (Exception e) { e.printStackTrace(); - if (e instanceof HystrixRuntimeException) { - HystrixRuntimeException de = (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException de) { assertNotNull(de.getFallbackException()); assertTrue(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); @@ -765,9 +764,8 @@ public void testExecutionTimeoutFallbackFailureUsingSemaphoreIsolation() { command.observe().toBlocking().single(); fail("we shouldn't get here"); } catch (Exception e) { - if (e instanceof HystrixRuntimeException) { + if (e instanceof HystrixRuntimeException de) { e.printStackTrace(); - HystrixRuntimeException de = (HystrixRuntimeException) e; assertNotNull(de.getFallbackException()); assertFalse(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); @@ -811,8 +809,7 @@ private void testExecutionTimeoutWithNoFallback(ExecutionIsolationStrategy isola fail("we shouldn't get here"); } catch (Exception e) { e.printStackTrace(); - if (e instanceof HystrixRuntimeException) { - HystrixRuntimeException de = (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException de) { assertNotNull(de.getFallbackException()); assertTrue(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); @@ -909,8 +906,7 @@ private void testExecutionTimeoutFallbackFailure(ExecutionIsolationStrategy isol command.observe().toBlocking().single(); fail("we shouldn't get here"); } catch (Exception e) { - if (e instanceof HystrixRuntimeException) { - HystrixRuntimeException de = (HystrixRuntimeException) e; + if (e instanceof HystrixRuntimeException de) { assertNotNull(de.getFallbackException()); assertFalse(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); @@ -2115,17 +2111,19 @@ public void call(TestHystrixObservableCommand command) { assertTrue(hook.executionEventsMatch(4, 1, 0)); assertTrue(hook.fallbackEventsMatch(4, 0, 1)); assertEquals(RuntimeException.class, hook.getExecutionException().getClass()); - assertEquals("onStart - onThreadStart - !onRunStart - onExecutionStart - " + - "onExecutionEmit - !onRunSuccess - !onComplete - onEmit - " + - "onExecutionEmit - !onRunSuccess - !onComplete - onEmit - " + - "onExecutionEmit - !onRunSuccess - !onComplete - onEmit - " + - "onExecutionEmit - !onRunSuccess - !onComplete - onEmit - " + - "onExecutionError - !onRunError - onThreadComplete - onFallbackStart - " + - "onFallbackEmit - !onFallbackSuccess - !onComplete - onEmit - " + - "onFallbackEmit - !onFallbackSuccess - !onComplete - onEmit - " + - "onFallbackEmit - !onFallbackSuccess - !onComplete - onEmit - " + - "onFallbackEmit - !onFallbackSuccess - !onComplete - onEmit - " + - "onFallbackSuccess - onSuccess - ", command.getBuilder().executionHook.executionSequence.toString()); + assertEquals(""" + onStart - onThreadStart - !onRunStart - onExecutionStart - \ + onExecutionEmit - !onRunSuccess - !onComplete - onEmit - \ + onExecutionEmit - !onRunSuccess - !onComplete - onEmit - \ + onExecutionEmit - !onRunSuccess - !onComplete - onEmit - \ + onExecutionEmit - !onRunSuccess - !onComplete - onEmit - \ + onExecutionError - !onRunError - onThreadComplete - onFallbackStart - \ + onFallbackEmit - !onFallbackSuccess - !onComplete - onEmit - \ + onFallbackEmit - !onFallbackSuccess - !onComplete - onEmit - \ + onFallbackEmit - !onFallbackSuccess - !onComplete - onEmit - \ + onFallbackEmit - !onFallbackSuccess - !onComplete - onEmit - \ + onFallbackSuccess - onSuccess - \ + """, command.getBuilder().executionHook.executionSequence.toString()); } }); } @@ -2620,8 +2618,8 @@ public void call(Throwable t1) { List errors = ts.getOnErrorEvents(); assertEquals(1, errors.size()); - Throwable e = errors.get(0); - if (errors.get(0) instanceof HystrixRuntimeException) { + Throwable e = errors.getFirst(); + if (errors.getFirst() instanceof HystrixRuntimeException) { HystrixRuntimeException de = (HystrixRuntimeException) e; assertNotNull(de.getFallbackException()); assertTrue(de.getFallbackException() instanceof UnsupportedOperationException); @@ -2990,7 +2988,7 @@ public void call(Notification n) { System.out.println("Observed => Initialized: " + results.isContextInitializedObserveOn.get() + " Thread: " + results.observeOnThread.get()); assertEquals(1, results.ts.getOnNextEvents().size()); - assertTrue(results.ts.getOnNextEvents().get(0)); + assertTrue(results.ts.getOnNextEvents().getFirst()); assertTrue(command.getExecutionTimeInMilliseconds() > -1); assertTrue(command.isSuccessfulExecution()); @@ -3152,7 +3150,7 @@ public void call(Notification n) { assertEquals(0, results.ts.getOnErrorEvents().size()); assertEquals(1, results.ts.getOnNextEvents().size()); - assertEquals(false, results.ts.getOnNextEvents().get(0)); + assertEquals(false, results.ts.getOnNextEvents().getFirst()); assertTrue(command.getExecutionTimeInMilliseconds() > -1); assertFalse(command.isSuccessfulExecution()); @@ -3257,7 +3255,7 @@ public void call(Notification n) { assertEquals(0, results.ts.getOnErrorEvents().size()); assertEquals(1, results.ts.getOnNextEvents().size()); - assertEquals(false, results.ts.getOnNextEvents().get(0)); + assertEquals(false, results.ts.getOnNextEvents().getFirst()); assertFalse(command.isSuccessfulExecution()); assertTrue(command.isResponseRejected()); @@ -3326,7 +3324,7 @@ public void call(Notification n) { assertEquals(0, results.ts.getOnErrorEvents().size()); assertEquals(1, results.ts.getOnNextEvents().size()); - assertEquals(false, results.ts.getOnNextEvents().get(0)); + assertEquals(false, results.ts.getOnNextEvents().getFirst()); assertTrue(command.getExecutionTimeInMilliseconds() == -1); assertFalse(command.isSuccessfulExecution()); @@ -3446,7 +3444,7 @@ public void call(Notification n) { System.out.println("Observed => Initialized: " + results.isContextInitializedObserveOn.get() + " Thread: " + results.observeOnThread.get()); assertEquals(1, results.ts.getOnNextEvents().size()); - assertEquals(false, results.ts.getOnNextEvents().get(0)); + assertEquals(false, results.ts.getOnNextEvents().getFirst()); assertTrue(command.getExecutionTimeInMilliseconds() > -1); assertFalse(command.isSuccessfulExecution()); diff --git a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixSubclassCommandTest.java b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixSubclassCommandTest.java index d0ab97eb1..8512666b1 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixSubclassCommandTest.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixSubclassCommandTest.java @@ -55,7 +55,7 @@ public void testRequestCacheSuperClass() { HystrixRequestLog reqLog = HystrixRequestLog.getCurrentRequest(); assertEquals(3, reqLog.getAllExecutedCommands().size()); List> infos = new ArrayList>(reqLog.getAllExecutedCommands()); - HystrixInvokableInfo info1 = infos.get(0); + HystrixInvokableInfo info1 = infos.getFirst(); assertEquals("SuperCommand", info1.getCommandKey().name()); assertEquals(1, info1.getExecutionEvents().size()); HystrixInvokableInfo info2 = infos.get(1); @@ -79,7 +79,7 @@ public void testRequestCacheSubclassNoOverrides() { HystrixRequestLog reqLog = HystrixRequestLog.getCurrentRequest(); assertEquals(3, reqLog.getAllExecutedCommands().size()); List> infos = new ArrayList>(reqLog.getAllExecutedCommands()); - HystrixInvokableInfo info1 = infos.get(0); + HystrixInvokableInfo info1 = infos.getFirst(); assertEquals("SubCommandNoOverride", info1.getCommandKey().name()); assertEquals(1, info1.getExecutionEvents().size()); HystrixInvokableInfo info2 = infos.get(1); 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 5e2774c72..3d9a55740 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 @@ -72,12 +72,14 @@ public void testDynamicProperties() throws Exception { assertTrue(properties instanceof MockHystrixDynamicPropertiesTest); assertEvents( - "[serviceloader: META-INF/services/com.netflix.hystrix.strategy.properties.HystrixDynamicProperties" - + ", debug: [Created HystrixDynamicProperties instance by loading from ServiceLoader. Using class: {}, com.netflix.hystrix.strategy.HystrixPluginsTest.MockHystrixDynamicPropertiesTest]" - + ", property: hystrix.plugin.HystrixCommandExecutionHook.implementation" - + ", serviceloader: META-INF/services/com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHook" - + ", property: hystrix.plugin.HystrixPropertiesStrategy.implementation" - + ", serviceloader: META-INF/services/com.netflix.hystrix.strategy.properties.HystrixPropertiesStrategy]"); + """ + [serviceloader: META-INF/services/com.netflix.hystrix.strategy.properties.HystrixDynamicProperties\ + , debug: [Created HystrixDynamicProperties instance by loading from ServiceLoader. Using class: {}, com.netflix.hystrix.strategy.HystrixPluginsTest.MockHystrixDynamicPropertiesTest]\ + , property: hystrix.plugin.HystrixCommandExecutionHook.implementation\ + , serviceloader: META-INF/services/com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHook\ + , property: hystrix.plugin.HystrixPropertiesStrategy.implementation\ + , serviceloader: META-INF/services/com.netflix.hystrix.strategy.properties.HystrixPropertiesStrategy]\ + """); } void assertEvents(String expect) throws Exception { 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 37ed285d1..3b72ce0c0 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 @@ -61,7 +61,7 @@ public static class UnitTest { @Test public void testSuccess() { - assertEquals("success", new CommandThatFailsSilently(false).execute().get(0)); + assertEquals("success", new CommandThatFailsSilently(false).execute().getFirst()); } @Test diff --git a/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/ObservableCollapserGetWordForNumber.java b/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/ObservableCollapserGetWordForNumber.java index d03178732..29bccf9ec 100644 --- a/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/ObservableCollapserGetWordForNumber.java +++ b/hystrix-examples/src/main/java/com/netflix/hystrix/examples/basic/ObservableCollapserGetWordForNumber.java @@ -198,7 +198,7 @@ public void shouldCollapseRequestsSync() assertThat(subscriber.getOnErrorEvents().toString(), subscriber.getOnErrorEvents().size(), is(0)); assertThat(subscriber.getOnNextEvents().size(), is(1)); - final String word = subscriber.getOnNextEvents().get(0); + final String word = subscriber.getOnNextEvents().getFirst(); System.out.println("Translated " + subscriberByNumber.getKey() + " to " + word); assertThat(word, equalTo(numberToWord(subscriberByNumber.getKey()))); } @@ -253,7 +253,7 @@ public Observable call() assertThat(subscriber.getOnErrorEvents().toString(), subscriber.getOnErrorEvents().size(), is(0)); assertThat(subscriber.getOnNextEvents().size(), is(1)); - final String word = subscriber.getOnNextEvents().get(0); + final String word = subscriber.getOnNextEvents().getFirst(); System.out.println("Translated " + subscriberByNumber.getKey() + " to " + word); assertThat(word, equalTo(numberToWord(subscriberByNumber.getKey()))); } @@ -294,7 +294,7 @@ private void subscriberReceived(TestSubscriber subscriber, int number) { subscriber.awaitTerminalEvent(10, TimeUnit.SECONDS); assertThat(subscriber.getOnErrorEvents().toString(), subscriber.getOnErrorEvents().size(), is(0)); assertThat(subscriber.getOnNextEvents().size(), is(1)); - assertThat(subscriber.getOnNextEvents().get(0), equalTo(numberToWord(number))); + assertThat(subscriber.getOnNextEvents().getFirst(), equalTo(numberToWord(number))); } private String numberToWord(final int number) diff --git a/settings.gradle b/settings.gradle index 38c4b1ae3..6823e48cd 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,28 +1,12 @@ rootProject.name='hystrix' include 'hystrix-core', \ -'hystrix-examples', \ -'hystrix-examples-webapp', \ 'hystrix-contrib/hystrix-clj', \ 'hystrix-contrib/hystrix-request-servlet', \ -'hystrix-contrib/hystrix-servo-metrics-publisher', \ -'hystrix-contrib/hystrix-metrics-event-stream', \ -'hystrix-contrib/hystrix-metrics-event-stream-jaxrs', \ -'hystrix-contrib/hystrix-rx-netty-metrics-stream', \ -'hystrix-contrib/hystrix-codahale-metrics-publisher', \ -'hystrix-contrib/hystrix-yammer-metrics-publisher', \ 'hystrix-contrib/hystrix-network-auditor-agent', \ -'hystrix-contrib/hystrix-javanica', \ 'hystrix-contrib/hystrix-junit', \ 'hystrix-serialization' project(':hystrix-contrib/hystrix-clj').name = 'hystrix-clj' project(':hystrix-contrib/hystrix-request-servlet').name = 'hystrix-request-servlet' -project(':hystrix-contrib/hystrix-servo-metrics-publisher').name = 'hystrix-servo-metrics-publisher' -project(':hystrix-contrib/hystrix-metrics-event-stream').name = 'hystrix-metrics-event-stream' -project(':hystrix-contrib/hystrix-metrics-event-stream-jaxrs').name = 'hystrix-metrics-event-stream-jaxrs' -project(':hystrix-contrib/hystrix-rx-netty-metrics-stream').name = 'hystrix-rx-netty-metrics-stream' -project(':hystrix-contrib/hystrix-codahale-metrics-publisher').name = 'hystrix-codahale-metrics-publisher' -project(':hystrix-contrib/hystrix-yammer-metrics-publisher').name = 'hystrix-yammer-metrics-publisher' project(':hystrix-contrib/hystrix-network-auditor-agent').name = 'hystrix-network-auditor-agent' -project(':hystrix-contrib/hystrix-javanica').name = 'hystrix-javanica' project(':hystrix-contrib/hystrix-junit').name = 'hystrix-junit'