Package com.hazelcast.core

Examples of com.hazelcast.core.IExecutorService.submit()



    @Test(expected = IllegalStateException.class)
    public void testSubmitFailingCallableReasonExceptionCause() throws Throwable {
        IExecutorService service = client.getExecutorService(randomString());
        Future<String> failingFuture = service.submit(new FailingCallable());

        try {
            failingFuture.get();
        } catch (ExecutionException e) {
            throw e.getCause();
View Full Code Here


    @Test(expected = NullPointerException.class)
    public void testSubmitCallableNullTask() throws Exception {
        IExecutorService service = client.getExecutorService(randomString());
        Callable<String> callable = null;

        service.submit(callable);
    }

    @Test
    public void testSubmitCallableToMember() throws Exception {
        IExecutorService service = client.getExecutorService(randomString());
View Full Code Here

        String msg = randomString();
        Callable<String> callable = new AppendCallable(msg);
        MemberSelector selectAll = new SelectAllMembers();

        Future<String> f = service.submit(callable, selectAll);

        assertEquals(msg + AppendCallable.APPENDAGE, f.get());
    }

    @Test
View Full Code Here

        final CountDownLatch responseLatch = new CountDownLatch(1);
        String mapName = randomString();
        Runnable runnable = new MapPutRunnable(mapName);
        MemberSelector selector = new SelectAllMembers();

        service.submit(runnable, selector, new ExecutionCallback() {
            public void onResponse(Object response) {
                responseLatch.countDown();
            }

            public void onFailure(Throwable t) {
View Full Code Here

        String msg = randomString();
        Callable runnable = new AppendCallable(msg);
        MemberSelector selector = new SelectAllMembers();
        final AtomicReference<Object> result = new AtomicReference<Object>();

        service.submit(runnable, selector, new ExecutionCallback() {
            public void onResponse(Object response) {
                result.set(response);
                responseLatch.countDown();
            }
View Full Code Here

        IExecutorService service = client.getExecutorService(randomString());

        String mapName = randomString();
        Runnable runnable = new MapPutRunnable(mapName);

        service.submit(runnable);

        IMap map = client.getMap(mapName);

        assertSizeEventually(1, map);
    }
View Full Code Here

    public void testSubmitRunnable_WithResult() throws ExecutionException, InterruptedException {
        IExecutorService service = client.getExecutorService(randomString());

        String mapName = randomString();
        Object givenResult = "givenResult";
        Future future = service.submit(new MapPutRunnable(mapName), givenResult);
        Object result = future.get();

        IMap map = client.getMap(mapName);

        assertEquals(givenResult, result);
View Full Code Here

    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());
    }

    @Test
View Full Code Here

        String mapName = randomString();
        Runnable runnable = new MapPutRunnable(mapName);
        final CountDownLatch responseLatch = new CountDownLatch(1);

        service.submit(runnable, new ExecutionCallback() {
            public void onResponse(Object response) {
                responseLatch.countDown();
            }

            public void onFailure(Throwable t) {
View Full Code Here

        String msg = randomString();
        Callable<String> callable = new AppendCallable(msg);
        final AtomicReference<String> result = new AtomicReference<String>();
        final CountDownLatch responseLatch = new CountDownLatch(1);

        service.submit(callable, new ExecutionCallback<String>() {
            public void onResponse(String response) {
                result.set(response);
                responseLatch.countDown();
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.