diff --git a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java index 6371311e..c74220aa 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java +++ b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java @@ -1924,7 +1924,7 @@ public Cffu copy() { * * @return the default executor * @see CffuFactory#defaultExecutor() - * @see CffuFactoryBuilder#newCffuFactoryBuilder(Executor) + * @see CffuFactory#builder(Executor) * @see #cffuFactory() */ @Contract(pure = true) diff --git a/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java b/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java index 72ace5f5..a115694a 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java +++ b/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java @@ -28,7 +28,7 @@ *

* The methods that equivalent to the instance methods of {@link CompletableFuture} is in {@link Cffu} class. *

- * Use {@link CffuFactoryBuilder} to config and build {@link CffuFactory}. + * Use {@link #builder(Executor)} to config and build {@link CffuFactory}. *

* About factory methods conventions of {@link CffuFactory}: *

* * @author Jerry Lee (oldratlee at gmail dot com) - * @see CffuFactoryBuilder * @see Cffu * @see CompletableFuture */ @@ -67,6 +66,18 @@ private Cffu newMin(CompletableFuture cf) { return new Cffu<>(this, true, cf); } + /** + * Returns a {@link CffuFactoryBuilder} with {@code defaultExecutor} setting. + * + * @see Cffu#defaultExecutor() + * @see CffuFactory#defaultExecutor() + */ + @Contract(pure = true) + public static CffuFactoryBuilder builder(Executor defaultExecutor) { + Executor executor = CffuFactoryBuilder.wrapExecutor(requireNonNull(defaultExecutor, "defaultExecutor is null")); + return new CffuFactoryBuilder(executor); + } + //////////////////////////////////////////////////////////////////////////////// //# Factory Methods, equivalent to same name static methods of CompletableFuture // @@ -250,7 +261,7 @@ public Cffu newIncompleteCffu() { * NOTE, keep input stage unchanged if possible when wrap:
*
    *
  1. if input stage is a {@link Cffu}, re-wrapped with the config of - * this {@link CffuFactory} from {@link CffuFactoryBuilder} by {@link Cffu#resetCffuFactory(CffuFactory)}. + * this {@link CffuFactory} by {@link Cffu#resetCffuFactory(CffuFactory)}. *
  2. if input stage is a CompletableFuture, wrap it by setting it as the underlying cf of returned cffu. *
  3. otherwise use input {@code stage.toCompletableFuture} as the underlying cf of returned cffu. *
@@ -659,11 +670,11 @@ public static Cffu[] cffuListToArray(List> cffuList) { /** * Returns the default Executor used for async methods that do not specify an Executor. - * Configured by {@link CffuFactoryBuilder#newCffuFactoryBuilder(Executor)}. + * Configured by {@link CffuFactory#builder(Executor)}. * * @return the default executor * @see Cffu#defaultExecutor() - * @see CffuFactoryBuilder#newCffuFactoryBuilder(Executor) + * @see CffuFactory#builder(Executor) */ @Contract(pure = true) public Executor defaultExecutor() { diff --git a/cffu-core/src/main/java/io/foldright/cffu/CffuFactoryBuilder.java b/cffu-core/src/main/java/io/foldright/cffu/CffuFactoryBuilder.java index f9216325..bef92e14 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/CffuFactoryBuilder.java +++ b/cffu-core/src/main/java/io/foldright/cffu/CffuFactoryBuilder.java @@ -18,7 +18,7 @@ /** - * {@link CffuFactoryBuilder} is the builder of {@link CffuFactory}. + * {@link CffuFactoryBuilder} is the builder of {@link CffuFactory}, creates by {@link CffuFactory#builder(Executor)}. * * @author Jerry Lee (oldratlee at gmail dot com) * @see CffuFactory @@ -33,7 +33,7 @@ public final class CffuFactoryBuilder { private volatile boolean forbidObtrudeMethods = false; - private CffuFactoryBuilder(Executor defaultExecutor) { + CffuFactoryBuilder(Executor defaultExecutor) { this.defaultExecutor = defaultExecutor; } @@ -41,18 +41,6 @@ private CffuFactoryBuilder(Executor defaultExecutor) { // Builder Methods //////////////////////////////////////////////////////////////////////////////// - /** - * Returns a {@link CffuFactoryBuilder} with {@code defaultExecutor} setting. - * - * @see CffuFactory#defaultExecutor() - * @see Cffu#defaultExecutor() - */ - @Contract(pure = true) - public static CffuFactoryBuilder newCffuFactoryBuilder(Executor defaultExecutor) { - Executor executor = wrapExecutor(requireNonNull(defaultExecutor, "defaultExecutor is null")); - return new CffuFactoryBuilder(executor); - } - /** * Sets {@code forbidObtrudeMethods} or not. * @@ -75,7 +63,7 @@ public CffuFactory build() { return new CffuFactory(defaultExecutor, forbidObtrudeMethods); } - private static Executor wrapExecutor(Executor executor) { + static Executor wrapExecutor(Executor executor) { for (ExecutorWrapperProvider provider : EXECUTOR_WRAPPER_PROVIDERS) { Supplier msg = () -> provider + "(class: " + provider.getClass().getName() + ") return null"; executor = requireNonNull(provider.wrap(executor), msg); diff --git a/cffu-core/src/main/java/io/foldright/cffu/spi/ExecutorWrapperProvider.java b/cffu-core/src/main/java/io/foldright/cffu/spi/ExecutorWrapperProvider.java index 17675855..67d9e95d 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/spi/ExecutorWrapperProvider.java +++ b/cffu-core/src/main/java/io/foldright/cffu/spi/ExecutorWrapperProvider.java @@ -11,7 +11,7 @@ * An SPI for wrapping the executor when {@link CffuFactoryBuilder} * {@link CffuFactoryBuilder#build() build} {@link CffuFactory}. * - * @see CffuFactoryBuilder#newCffuFactoryBuilder(Executor) + * @see CffuFactory#builder(Executor) * @see CffuFactoryBuilder#build() */ @FunctionalInterface diff --git a/cffu-core/src/test/java/io/foldright/cffu/CffuFactoryTest.java b/cffu-core/src/test/java/io/foldright/cffu/CffuFactoryTest.java index 5e765860..6c1bfd65 100644 --- a/cffu-core/src/test/java/io/foldright/cffu/CffuFactoryTest.java +++ b/cffu-core/src/test/java/io/foldright/cffu/CffuFactoryTest.java @@ -15,7 +15,7 @@ import java.util.Collections; import java.util.concurrent.*; -import static io.foldright.cffu.CffuFactoryBuilder.newCffuFactoryBuilder; +import static io.foldright.cffu.CffuFactory.builder; import static io.foldright.cffu.CompletableFutureUtils.failedFuture; import static io.foldright.cffu.CompletableFutureUtils.toCompletableFutureArray; import static io.foldright.test_utils.TestUtils.*; @@ -123,7 +123,7 @@ void test_toCffu() throws Exception { assertEquals(n, cf.get()); shouldNotBeMinimalStage(cf); - CffuFactory fac = newCffuFactoryBuilder(anotherExecutorService).forbidObtrudeMethods(true).build(); + CffuFactory fac = builder(anotherExecutorService).forbidObtrudeMethods(true).build(); Cffu cffu = fac.toCffu(cffuFactory.completedFuture(42)); assertSame(anotherExecutorService, cffu.defaultExecutor()); assertSame(fac, cffu.cffuFactory()); @@ -787,14 +787,14 @@ void test_getter() { assertSame(executorService, cffuFactory.defaultExecutor()); assertFalse(cffuFactory.forbidObtrudeMethods()); - CffuFactory fac = newCffuFactoryBuilder(anotherExecutorService).forbidObtrudeMethods(true).build(); + CffuFactory fac = builder(anotherExecutorService).forbidObtrudeMethods(true).build(); assertSame(anotherExecutorService, fac.defaultExecutor()); assertTrue(fac.forbidObtrudeMethods()); } @Test void test_forbidObtrudeMethods_property() { - CffuFactory fac2 = newCffuFactoryBuilder(executorService).forbidObtrudeMethods(true).build(); + CffuFactory fac2 = builder(executorService).forbidObtrudeMethods(true).build(); Cffu cf = fac2.newIncompleteCffu(); try { @@ -815,7 +815,7 @@ void test_forbidObtrudeMethods_property() { void test_executorSetting_MayBe_ThreadPerTaskExecutor() throws Exception { final boolean USE_COMMON_POOL = (ForkJoinPool.getCommonPoolParallelism() > 1); - CffuFactory fac = newCffuFactoryBuilder(commonPool()).build(); + CffuFactory fac = builder(commonPool()).build(); if (USE_COMMON_POOL) { assertSame(commonPool(), fac.defaultExecutor()); } else { @@ -841,7 +841,7 @@ static void beforeAll() { executorService = TestThreadPoolManager.createThreadPool("CffuFactoryTest"); anotherExecutorService = TestThreadPoolManager.createThreadPool("CffuFactoryTest-Another", true); - cffuFactory = newCffuFactoryBuilder(executorService).build(); + cffuFactory = builder(executorService).build(); } @AfterAll diff --git a/cffu-core/src/test/java/io/foldright/cffu/CffuTest.java b/cffu-core/src/test/java/io/foldright/cffu/CffuTest.java index 9caeb511..0bba84e2 100644 --- a/cffu-core/src/test/java/io/foldright/cffu/CffuTest.java +++ b/cffu-core/src/test/java/io/foldright/cffu/CffuTest.java @@ -11,7 +11,7 @@ import java.util.function.BiConsumer; import java.util.function.Consumer; -import static io.foldright.cffu.CffuFactoryBuilder.newCffuFactoryBuilder; +import static io.foldright.cffu.CffuFactory.builder; import static io.foldright.test_utils.TestUtils.*; import static java.util.function.Function.identity; import static org.junit.jupiter.api.Assertions.*; @@ -310,8 +310,8 @@ void test_toString() { static void beforeAll() { executorService = TestThreadPoolManager.createThreadPool("CffuTest"); - cffuFactory = newCffuFactoryBuilder(executorService).build(); - forbidObtrudeMethodsCffuFactory = newCffuFactoryBuilder(executorService) + cffuFactory = builder(executorService).build(); + forbidObtrudeMethodsCffuFactory = builder(executorService) .forbidObtrudeMethods(true).build(); } diff --git a/cffu-core/src/test/java/io/foldright/cffu/spi/ExecutorWrapperProviderTest.kt b/cffu-core/src/test/java/io/foldright/cffu/spi/ExecutorWrapperProviderTest.kt index 599982c5..92ca5379 100644 --- a/cffu-core/src/test/java/io/foldright/cffu/spi/ExecutorWrapperProviderTest.kt +++ b/cffu-core/src/test/java/io/foldright/cffu/spi/ExecutorWrapperProviderTest.kt @@ -1,6 +1,6 @@ package io.foldright.cffu.spi -import io.foldright.cffu.CffuFactoryBuilder +import io.foldright.cffu.CffuFactory import io.foldright.test_utils.testThreadPoolExecutor import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.types.shouldBeSameInstanceAs @@ -8,7 +8,7 @@ import io.kotest.matchers.types.shouldNotBeSameInstanceAs class ExecutorWrapperProviderTest : FunSpec({ test("disable TestExecutorWrapper") { - val factory = CffuFactoryBuilder.newCffuFactoryBuilder(testThreadPoolExecutor).build() + val factory = CffuFactory.builder(testThreadPoolExecutor).build() val cffu = factory.runAsync {} cffu.defaultExecutor().shouldBeSameInstanceAs(testThreadPoolExecutor) } @@ -16,7 +16,7 @@ class ExecutorWrapperProviderTest : FunSpec({ test("enable TestExecutorWrapper") { enableTestExecutorWrapper() - val factory = CffuFactoryBuilder.newCffuFactoryBuilder(testThreadPoolExecutor).build() + val factory = CffuFactory.builder(testThreadPoolExecutor).build() val cffu = factory.runAsync {} cffu.defaultExecutor().shouldNotBeSameInstanceAs(testThreadPoolExecutor) } diff --git a/cffu-core/src/test/java/io/foldright/compatibility_test/CffuApiCompatibilityTest.java b/cffu-core/src/test/java/io/foldright/compatibility_test/CffuApiCompatibilityTest.java index 2b7802aa..ce59fa23 100644 --- a/cffu-core/src/test/java/io/foldright/compatibility_test/CffuApiCompatibilityTest.java +++ b/cffu-core/src/test/java/io/foldright/compatibility_test/CffuApiCompatibilityTest.java @@ -11,7 +11,6 @@ import io.foldright.cffu.Cffu; import io.foldright.cffu.CffuFactory; -import io.foldright.cffu.CffuFactoryBuilder; import io.foldright.test_utils.TestThreadPoolManager; import io.foldright.test_utils.TestUtils; import org.junit.jupiter.api.AfterAll; @@ -881,7 +880,7 @@ private void check1MoreLevelForExecutionException(Cffu cf) throws Excepti @BeforeAll static void beforeAll() { executorService = TestThreadPoolManager.createThreadPool(hello); - cffuFactory = CffuFactoryBuilder.newCffuFactoryBuilder(executorService).build(); + cffuFactory = CffuFactory.builder(executorService).build(); anotherExecutorService = TestThreadPoolManager.createThreadPool(hello, true); } diff --git a/cffu-core/src/test/java/io/foldright/demo/AllResultsOfDemo.java b/cffu-core/src/test/java/io/foldright/demo/AllResultsOfDemo.java index 98cbd781..6beb08a5 100644 --- a/cffu-core/src/test/java/io/foldright/demo/AllResultsOfDemo.java +++ b/cffu-core/src/test/java/io/foldright/demo/AllResultsOfDemo.java @@ -9,12 +9,12 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import static io.foldright.cffu.CffuFactoryBuilder.newCffuFactoryBuilder; +import static io.foldright.cffu.CffuFactory.builder; public class AllResultsOfDemo { public static final ExecutorService myBizExecutor = Executors.newCachedThreadPool(); - public static final CffuFactory cffuFactory = newCffuFactoryBuilder(myBizExecutor).build(); + public static final CffuFactory cffuFactory = builder(myBizExecutor).build(); public static void main(String[] args) throws Exception { ////////////////////////////////////////////////// diff --git a/cffu-core/src/test/java/io/foldright/demo/AllTupleOfDemo.java b/cffu-core/src/test/java/io/foldright/demo/AllTupleOfDemo.java index 852b7657..ad885f4e 100644 --- a/cffu-core/src/test/java/io/foldright/demo/AllTupleOfDemo.java +++ b/cffu-core/src/test/java/io/foldright/demo/AllTupleOfDemo.java @@ -9,12 +9,12 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import static io.foldright.cffu.CffuFactoryBuilder.newCffuFactoryBuilder; +import static io.foldright.cffu.CffuFactory.builder; public class AllTupleOfDemo { public static final ExecutorService myBizExecutor = Executors.newCachedThreadPool(); - public static final CffuFactory cffuFactory = newCffuFactoryBuilder(myBizExecutor).build(); + public static final CffuFactory cffuFactory = builder(myBizExecutor).build(); public static void main(String[] args) throws Exception { ////////////////////////////////////////////////// diff --git a/cffu-core/src/test/java/io/foldright/demo/ConcurrencyStrategyDemo.java b/cffu-core/src/test/java/io/foldright/demo/ConcurrencyStrategyDemo.java index 604f87a5..82901bae 100644 --- a/cffu-core/src/test/java/io/foldright/demo/ConcurrencyStrategyDemo.java +++ b/cffu-core/src/test/java/io/foldright/demo/ConcurrencyStrategyDemo.java @@ -9,12 +9,12 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import static io.foldright.cffu.CffuFactoryBuilder.newCffuFactoryBuilder; +import static io.foldright.cffu.CffuFactory.builder; public class ConcurrencyStrategyDemo { public static final ExecutorService myBizExecutor = Executors.newCachedThreadPool(); - public static final CffuFactory cffuFactory = newCffuFactoryBuilder(myBizExecutor).build(); + public static final CffuFactory cffuFactory = builder(myBizExecutor).build(); public static void main(String[] args) throws Exception { //////////////////////////////////////////////////////////////////////// diff --git a/cffu-core/src/test/java/io/foldright/demo/DefaultExecutorSettingForCffu.java b/cffu-core/src/test/java/io/foldright/demo/DefaultExecutorSettingForCffu.java index b7f652ae..c420a10c 100644 --- a/cffu-core/src/test/java/io/foldright/demo/DefaultExecutorSettingForCffu.java +++ b/cffu-core/src/test/java/io/foldright/demo/DefaultExecutorSettingForCffu.java @@ -6,12 +6,12 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import static io.foldright.cffu.CffuFactoryBuilder.newCffuFactoryBuilder; +import static io.foldright.cffu.CffuFactory.builder; public class DefaultExecutorSettingForCffu { public static final ExecutorService myBizExecutor = Executors.newCachedThreadPool(); - public static final CffuFactory cffuFactory = newCffuFactoryBuilder(myBizExecutor).build(); + public static final CffuFactory cffuFactory = builder(myBizExecutor).build(); public static void main(String[] args) { Cffu cf1 = cffuFactory.runAsync(() -> System.out.println("doing a long time work!")); diff --git a/cffu-core/src/test/java/io/foldright/test_utils/TestThreadPoolManager.kt b/cffu-core/src/test/java/io/foldright/test_utils/TestThreadPoolManager.kt index 4b2383ad..a929d77f 100644 --- a/cffu-core/src/test/java/io/foldright/test_utils/TestThreadPoolManager.kt +++ b/cffu-core/src/test/java/io/foldright/test_utils/TestThreadPoolManager.kt @@ -3,7 +3,7 @@ package io.foldright.test_utils import io.foldright.cffu.CffuFactory -import io.foldright.cffu.CffuFactoryBuilder.newCffuFactoryBuilder +import io.foldright.cffu.CffuFactory.builder import io.kotest.core.annotation.AutoScan import io.kotest.core.listeners.AfterProjectListener import io.kotest.core.listeners.BeforeProjectListener @@ -93,7 +93,9 @@ fun shutdownExecutorService(vararg executors: ExecutorService) { val testThreadPoolExecutor: ExecutorService = createThreadPool("CompletableFutureUseTest_ThreadPool") -val testCffuFactory: CffuFactory = newCffuFactoryBuilder(testThreadPoolExecutor).build() +val testCffuFactory: CffuFactory = builder( + testThreadPoolExecutor +).build() val testForkJoinPoolExecutor: ExecutorService = createThreadPool("CompletableFutureUseTest_ForkJoinPool", true) diff --git a/cffu-core/src/test/java/io/foldright/test_utils/TestUtils.kt b/cffu-core/src/test/java/io/foldright/test_utils/TestUtils.kt index 181b2e93..7f603ea6 100644 --- a/cffu-core/src/test/java/io/foldright/test_utils/TestUtils.kt +++ b/cffu-core/src/test/java/io/foldright/test_utils/TestUtils.kt @@ -3,7 +3,7 @@ package io.foldright.test_utils import io.foldright.cffu.Cffu -import io.foldright.cffu.CffuFactoryBuilder.newCffuFactoryBuilder +import io.foldright.cffu.CffuFactory.builder import io.kotest.assertions.throwables.shouldNotThrow import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.test.TestCase @@ -75,7 +75,7 @@ fun safeNewFailedCompletableFuture(executorService: ExecutorService, t: Thro * safe means works under java 8 */ fun safeNewFailedCffu(executorService: ExecutorService, t: Throwable): Cffu { - return newCffuFactoryBuilder(executorService).build().failedFuture(t) + return builder(executorService).build().failedFuture(t) } @Suppress("UNUSED_PARAMETER") @@ -413,7 +413,7 @@ private fun Cffu.shouldMinCffu(recursive: Boolean = false) { //# Cffu Re-Config methods if (recursive) - resetCffuFactory(newCffuFactoryBuilder(blackHoleExecutor).build()).shouldMinCffu() + resetCffuFactory(builder(blackHoleExecutor).build()).shouldMinCffu() //# Getter methods of properties cffuFactory() @@ -508,7 +508,7 @@ private fun Cffu.shouldNotMinCffu(recursive: Boolean = false) { //# Cffu Re-Config methods if (recursive) - resetCffuFactory(newCffuFactoryBuilder(blackHoleExecutor).build()).shouldNotMinCffu() + resetCffuFactory(builder(blackHoleExecutor).build()).shouldNotMinCffu() //# Getter methods of properties cffuFactory() diff --git a/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt b/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt index acc41499..124ca944 100644 --- a/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt +++ b/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt @@ -2,7 +2,7 @@ package io.foldright.cffu.kotlin import io.foldright.cffu.Cffu import io.foldright.cffu.CffuFactory -import io.foldright.cffu.CffuFactoryBuilder.newCffuFactoryBuilder +import io.foldright.cffu.CffuFactory.builder import io.foldright.cffu.CompletableFutureUtils import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletionStage @@ -62,7 +62,7 @@ fun Array>.toCffu(cffuFactory: CffuFactory): Array) { cffu.cffuFactory() shouldBeSameInstanceAs cffuFactoryForOptional } diff --git a/cffu-ttl-executor-wrapper/src/test/java/io/foldright/cffu/ttl/CffuTtlExecutorWrapperTest.kt b/cffu-ttl-executor-wrapper/src/test/java/io/foldright/cffu/ttl/CffuTtlExecutorWrapperTest.kt index 6fa3f217..1e261bed 100644 --- a/cffu-ttl-executor-wrapper/src/test/java/io/foldright/cffu/ttl/CffuTtlExecutorWrapperTest.kt +++ b/cffu-ttl-executor-wrapper/src/test/java/io/foldright/cffu/ttl/CffuTtlExecutorWrapperTest.kt @@ -1,7 +1,7 @@ package io.foldright.cffu.ttl import com.alibaba.ttl.TransmittableThreadLocal -import io.foldright.cffu.CffuFactoryBuilder +import io.foldright.cffu.CffuFactory import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.booleans.shouldBeTrue import io.kotest.matchers.shouldBe @@ -19,7 +19,7 @@ class CffuTtlExecutorWrapperTest : FunSpec({ val ttl = TransmittableThreadLocal() test("CffuTtlExecutorWrapper") { - val factory = CffuFactoryBuilder.newCffuFactoryBuilder(executorService).build() + val factory = CffuFactory.builder(executorService).build() val v1 = "v1: ${Random.nextULong()}" ttl.set(v1) diff --git a/demos/cffu-demo/src/main/java/io/foldright/demo/cffu/CffuDemo.java b/demos/cffu-demo/src/main/java/io/foldright/demo/cffu/CffuDemo.java index 98330985..aac80890 100644 --- a/demos/cffu-demo/src/main/java/io/foldright/demo/cffu/CffuDemo.java +++ b/demos/cffu-demo/src/main/java/io/foldright/demo/cffu/CffuDemo.java @@ -7,13 +7,13 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import static io.foldright.cffu.CffuFactoryBuilder.newCffuFactoryBuilder; +import static io.foldright.cffu.CffuFactory.builder; public class CffuDemo { private static final ExecutorService myBizThreadPool = Executors.newCachedThreadPool(); // Create a CffuFactory with configuration of the customized thread pool - private static final CffuFactory cffuFactory = newCffuFactoryBuilder(myBizThreadPool).build(); + private static final CffuFactory cffuFactory = builder(myBizThreadPool).build(); public static void main(String[] args) throws Exception { final Cffu cf42 = cffuFactory diff --git a/demos/cffu-kotlin-demo/src/main/java/io/foldright/demo/cffu/kotlin/CffuDemo.kt b/demos/cffu-kotlin-demo/src/main/java/io/foldright/demo/cffu/kotlin/CffuDemo.kt index 863f9bf3..c18bff44 100644 --- a/demos/cffu-kotlin-demo/src/main/java/io/foldright/demo/cffu/kotlin/CffuDemo.kt +++ b/demos/cffu-kotlin-demo/src/main/java/io/foldright/demo/cffu/kotlin/CffuDemo.kt @@ -2,7 +2,7 @@ package io.foldright.demo.cffu.kotlin import io.foldright.cffu.Cffu import io.foldright.cffu.CffuFactory -import io.foldright.cffu.CffuFactoryBuilder.newCffuFactoryBuilder +import io.foldright.cffu.CffuFactory.builder import io.foldright.cffu.kotlin.anyOfSuccessCffu import java.lang.Thread.sleep import java.util.concurrent.ExecutorService @@ -13,7 +13,9 @@ import java.util.concurrent.TimeUnit private val myBizThreadPool: ExecutorService = Executors.newCachedThreadPool() // Create a CffuFactory with configuration of the customized thread pool -private val cffuFactory: CffuFactory = newCffuFactoryBuilder(myBizThreadPool).build() +private val cffuFactory: CffuFactory = builder( + myBizThreadPool +).build() fun main() { val cf42 = cffuFactory