public void testDistributedExecutorWithPassedThreadExecutorOwnership() throws ExecutionException, InterruptedException { ExecutorService service = new WithinThreadExecutor(); customExecutorServiceDistributedExecutorTest(service, true); }
public void testBasicTargetRemoteDistributedCallableWithoutAnyTimeout() throws Exception { ConfigurationBuilder confBuilder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false); confBuilder.clustering().remoteTimeout(0L); EmbeddedCacheManager cacheManager = TestCacheManagerFactory.createClusteredCacheManager(confBuilder); EmbeddedCacheManager cacheManager1 = TestCacheManagerFactory.createClusteredCacheManager(confBuilder); Cache<Object, Object> cache1 = cacheManager.getCache(); Cache<Object, Object> cache2 = cacheManager1.getCache(); DistributedExecutorService des = null; try { // initiate task from cache1 and execute on same node des = new DefaultExecutorService(cache1); Address target = cache2.getAdvancedCache().getRpcManager().getAddress(); DistributedTaskBuilder<Integer> builder = des .createDistributedTaskBuilder(new DistributedExecutorTest.SleepingSimpleCallable(latchHolder)); Future<Integer> future = des.submit(target, builder.build()); Thread.sleep(100); latchHolder.get().open(); AssertJUnit.assertEquals((Integer) 1, future.get()); } finally { if (des != null) des.shutdown(); TestingUtil.killCacheManagers(cacheManager, cacheManager1); } }
public void testDistributedExecutorWithPassedThreadExecutor() throws ExecutionException, InterruptedException { ExecutorService service = new WithinThreadExecutor(); customExecutorServiceDistributedExecutorTest(service, false); }
public void testDistributedExecutorWithManagedExecutorService() throws ExecutionException, InterruptedException { ExecutorService service = new ManagedExecutorServicesEmulator(); customExecutorServiceDistributedExecutorTest(service, false); }
public void testStoppedLocalExecutorServiceForDistributedExecutor() throws ExecutionException, InterruptedException { ExecutorService service = new WithinThreadExecutor(); service.shutdown(); expectException(IllegalArgumentException.class, () -> customExecutorServiceDistributedExecutorTest(service, false)); }
public void testDistributedExecutorWithManagedExecutorServiceOwnership() throws ExecutionException, InterruptedException { ExecutorService service = new ManagedExecutorServicesEmulator(); expectException(IllegalArgumentException.class, () -> customExecutorServiceDistributedExecutorTest(service, true)); }