Search in sources :

Example 11 with AppendCallable

use of com.hazelcast.client.executor.tasks.AppendCallable in project hazelcast by hazelcast.

the class ClientDurableExecutorServiceSubmitTest method testSubmitCallable.

@Test
public void testSubmitCallable() throws Exception {
    DurableExecutorService service = client.getDurableExecutorService(randomString());
    String msg = randomString();
    Callable callable = new AppendCallable(msg);
    Future result = service.submit(callable);
    assertEquals(msg + AppendCallable.APPENDAGE, result.get());
}
Also used : DurableExecutorService(com.hazelcast.durableexecutor.DurableExecutorService) AppendCallable(com.hazelcast.client.executor.tasks.AppendCallable) Future(java.util.concurrent.Future) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) Callable(java.util.concurrent.Callable) MapPutPartitionAwareCallable(com.hazelcast.client.executor.tasks.MapPutPartitionAwareCallable) AppendCallable(com.hazelcast.client.executor.tasks.AppendCallable) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 12 with AppendCallable

use of com.hazelcast.client.executor.tasks.AppendCallable in project hazelcast by hazelcast.

the class ClientExecutorServiceInvokeTest method testInvokeAny.

@Test(expected = UnsupportedOperationException.class)
public void testInvokeAny() throws Throwable {
    IExecutorService service = client.getExecutorService(randomString());
    Collection<Callable<String>> collection = new ArrayList<Callable<String>>();
    collection.add(new AppendCallable());
    collection.add(new AppendCallable());
    service.invokeAny(collection);
}
Also used : AppendCallable(com.hazelcast.client.executor.tasks.AppendCallable) ArrayList(java.util.ArrayList) IExecutorService(com.hazelcast.core.IExecutorService) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) Callable(java.util.concurrent.Callable) AppendCallable(com.hazelcast.client.executor.tasks.AppendCallable) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 13 with AppendCallable

use of com.hazelcast.client.executor.tasks.AppendCallable in project hazelcast by hazelcast.

the class ClientExecutorServiceInvokeTest method testInvokeAll.

@Test
public void testInvokeAll() throws Throwable {
    IExecutorService service = client.getExecutorService(randomString());
    String msg = randomString();
    Collection<Callable<String>> collection = new ArrayList<Callable<String>>();
    collection.add(new AppendCallable(msg));
    collection.add(new AppendCallable(msg));
    List<Future<String>> results = service.invokeAll(collection);
    for (Future<String> result : results) {
        assertEquals(msg + AppendCallable.APPENDAGE, result.get());
    }
}
Also used : AppendCallable(com.hazelcast.client.executor.tasks.AppendCallable) ArrayList(java.util.ArrayList) Future(java.util.concurrent.Future) IExecutorService(com.hazelcast.core.IExecutorService) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) Callable(java.util.concurrent.Callable) AppendCallable(com.hazelcast.client.executor.tasks.AppendCallable) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 14 with AppendCallable

use of com.hazelcast.client.executor.tasks.AppendCallable in project hazelcast by hazelcast.

the class ClientExecutorServiceInvokeTest method testInvokeAnyTimeOut.

@Test(expected = UnsupportedOperationException.class)
public void testInvokeAnyTimeOut() throws Throwable {
    IExecutorService service = client.getExecutorService(randomString());
    Collection<Callable<String>> collection = new ArrayList<Callable<String>>();
    collection.add(new AppendCallable());
    collection.add(new AppendCallable());
    service.invokeAny(collection, 1, TimeUnit.MINUTES);
}
Also used : AppendCallable(com.hazelcast.client.executor.tasks.AppendCallable) ArrayList(java.util.ArrayList) IExecutorService(com.hazelcast.core.IExecutorService) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) Callable(java.util.concurrent.Callable) AppendCallable(com.hazelcast.client.executor.tasks.AppendCallable) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 15 with AppendCallable

use of com.hazelcast.client.executor.tasks.AppendCallable in project hazelcast by hazelcast.

the class ClientExecutorServiceSubmitTest method testSubmitCallable.

@Test
public void testSubmitCallable() throws Exception {
    IExecutorService service = client.getExecutorService(randomString());
    String msg = randomString();
    Callable callable = new AppendCallable(msg);
    Future result = service.submit(callable);
    assertEquals(msg + AppendCallable.APPENDAGE, result.get());
}
Also used : AppendCallable(com.hazelcast.client.executor.tasks.AppendCallable) Future(java.util.concurrent.Future) IExecutorService(com.hazelcast.core.IExecutorService) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) NullCallable(com.hazelcast.client.executor.tasks.NullCallable) Callable(java.util.concurrent.Callable) MapPutPartitionAwareCallable(com.hazelcast.client.executor.tasks.MapPutPartitionAwareCallable) AppendCallable(com.hazelcast.client.executor.tasks.AppendCallable) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

AppendCallable (com.hazelcast.client.executor.tasks.AppendCallable)18 HazelcastTestSupport.randomString (com.hazelcast.test.HazelcastTestSupport.randomString)18 ParallelTest (com.hazelcast.test.annotation.ParallelTest)18 QuickTest (com.hazelcast.test.annotation.QuickTest)18 Test (org.junit.Test)18 IExecutorService (com.hazelcast.core.IExecutorService)14 Callable (java.util.concurrent.Callable)9 CountDownLatch (java.util.concurrent.CountDownLatch)8 MapPutPartitionAwareCallable (com.hazelcast.client.executor.tasks.MapPutPartitionAwareCallable)5 AtomicReference (java.util.concurrent.atomic.AtomicReference)5 NullCallable (com.hazelcast.client.executor.tasks.NullCallable)4 Member (com.hazelcast.core.Member)4 MultiExecutionCallback (com.hazelcast.core.MultiExecutionCallback)4 DurableExecutorService (com.hazelcast.durableexecutor.DurableExecutorService)4 ArrayList (java.util.ArrayList)4 Future (java.util.concurrent.Future)4 SelectAllMembers (com.hazelcast.client.executor.tasks.SelectAllMembers)3 MemberSelector (com.hazelcast.core.MemberSelector)3 ExecutionCallback (com.hazelcast.core.ExecutionCallback)1