Examples of ExecutionService


Examples of com.hazelcast.spi.ExecutionService

    private void handleRetryResponse() {
        if (invocationFuture.interrupted) {
            invocationFuture.set(INTERRUPTED_RESPONSE);
        } else {
            invocationFuture.set(WAIT_RESPONSE);
            final ExecutionService ex = nodeEngine.getExecutionService();
            // fast retry for the first few invocations
            if (invokeCount < MAX_FAST_INVOCATION_COUNT) {
                getAsyncExecutor().execute(this);
            } else {
                ex.schedule(ExecutionService.ASYNC_EXECUTOR, this, tryPauseMillis, TimeUnit.MILLISECONDS);
            }
        }
    }
View Full Code Here

Examples of com.hazelcast.spi.ExecutionService

        int partitionTableSendInterval = node.groupProperties.PARTITION_TABLE_SEND_INTERVAL.getInteger();
        if (partitionTableSendInterval <= 0) {
            partitionTableSendInterval = 1;
        }
        ExecutionService executionService = nodeEngine.getExecutionService();
        executionService.scheduleAtFixedRate(new SendClusterStateTask(),
                partitionTableSendInterval, partitionTableSendInterval, TimeUnit.SECONDS);


        int backupSyncCheckInterval = node.groupProperties.PARTITION_BACKUP_SYNC_INTERVAL.getInteger();
        if (backupSyncCheckInterval <= 0) {
            backupSyncCheckInterval = 1;
        }
        executionService.scheduleWithFixedDelay(new SyncReplicaVersionTask(),
                backupSyncCheckInterval, backupSyncCheckInterval, TimeUnit.SECONDS);
    }
View Full Code Here

Examples of com.hazelcast.spi.ExecutionService

    @Override
    public void loadKeys(List<Data> keys, boolean replaceExistingValues) {
        setLoaded(false);
        final NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
        ExecutionService executionService = nodeEngine.getExecutionService();
        executionService.submit("hz:map-loadAllKeys", new LoadAllKeysTask(keys, replaceExistingValues));
    }
View Full Code Here

Examples of com.hazelcast.spi.ExecutionService

            return;
        }
        try {
            this.throwable = null;
            final AtomicInteger checkIfMapLoaded = new AtomicInteger(chunks.size());
            ExecutionService executionService = nodeEngine.getExecutionService();
            Map<Data, Object> chunkedKeys;
            while ((chunkedKeys = chunks.poll()) != null) {
                final Callback<Throwable> callback = createCallbackForThrowable();
                executionService.submit("hz:map-load", new MapLoadAllTask(chunkedKeys, checkIfMapLoaded, callback));
            }
        } catch (Throwable t) {
            throw ExceptionUtil.rethrow(t);
        }
    }
View Full Code Here

Examples of com.hazelcast.spi.ExecutionService

    }


    private ScheduledExecutorService getScheduledExecutorService(MapServiceContext mapServiceContext) {
        final NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
        final ExecutionService executionService = nodeEngine.getExecutionService();
        executionService.register(executorName, 1, EXECUTOR_DEFAULT_QUEUE_CAPACITY, ExecutorType.CACHED);
        return executionService.getScheduledExecutor(executorName);
    }
View Full Code Here

Examples of com.hazelcast.spi.ExecutionService

        HazelcastInstanceProxy proxy = (HazelcastInstanceProxy) createHazelcastInstance();
        Field originalField = HazelcastInstanceProxy.class.getDeclaredField("original");
        originalField.setAccessible(true);
        HazelcastInstanceImpl hz = (HazelcastInstanceImpl) originalField.get(proxy);
        NodeEngine nodeEngine = hz.node.nodeEngine;
        ExecutionService es = nodeEngine.getExecutionService();

        final CountDownLatch latch1 = new CountDownLatch(1);
        final CountDownLatch latch2 = new CountDownLatch(1);
        final ExecutorService executorService = Executors.newSingleThreadExecutor();
        try {
            Future future = executorService.submit(new Callable<String>() {
                @Override
                public String call() {
                    try {
                        latch1.await(30, TimeUnit.SECONDS);
                        return "success";
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                }
            });

            final AtomicReference reference = new AtomicReference();
            final ICompletableFuture completableFuture = es.asCompletableFuture(future);
            completableFuture.andThen(new ExecutionCallback() {
                @Override
                public void onResponse(Object response) {
                    reference.set(response);
                    latch2.countDown();
View Full Code Here

Examples of com.hazelcast.spi.ExecutionService

        HazelcastInstanceProxy proxy = (HazelcastInstanceProxy) createHazelcastInstance();
        Field originalField = HazelcastInstanceProxy.class.getDeclaredField("original");
        originalField.setAccessible(true);
        HazelcastInstanceImpl hz = (HazelcastInstanceImpl) originalField.get(proxy);
        NodeEngine nodeEngine = hz.node.nodeEngine;
        ExecutionService es = nodeEngine.getExecutionService();

        final CountDownLatch latch1 = new CountDownLatch(1);
        final CountDownLatch latch2 = new CountDownLatch(2);
        final ExecutorService executorService = Executors.newSingleThreadExecutor();
        try {
            Future future = executorService.submit(new Callable<String>() {
                @Override
                public String call() {
                    try {
                        latch1.await(30, TimeUnit.SECONDS);
                        return "success";
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                }
            });

            final AtomicReference reference1 = new AtomicReference();
            final AtomicReference reference2 = new AtomicReference();
            final ICompletableFuture completableFuture = es.asCompletableFuture(future);
            completableFuture.andThen(new ExecutionCallback() {
                @Override
                public void onResponse(Object response) {
                    reference1.set(response);
                    latch2.countDown();
View Full Code Here

Examples of com.hazelcast.spi.ExecutionService

        HazelcastInstanceProxy proxy = (HazelcastInstanceProxy) createHazelcastInstance();
        Field originalField = HazelcastInstanceProxy.class.getDeclaredField("original");
        originalField.setAccessible(true);
        HazelcastInstanceImpl hz = (HazelcastInstanceImpl) originalField.get(proxy);
        NodeEngine nodeEngine = hz.node.nodeEngine;
        ExecutionService es = nodeEngine.getExecutionService();

        final CountDownLatch latch1 = new CountDownLatch(1);
        final CountDownLatch latch2 = new CountDownLatch(1);
        final ExecutorService executorService = Executors.newSingleThreadExecutor();
        try {
            Future future = executorService.submit(new Callable<String>() {
                @Override
                public String call() {
                    try {
                        return "success";
                    } finally {
                        latch1.countDown();
                    }
                }
            });

            final ICompletableFuture completableFuture = es.asCompletableFuture(future);
            latch1.await(30, TimeUnit.SECONDS);

            final AtomicReference reference = new AtomicReference();
            completableFuture.andThen(new ExecutionCallback() {
                @Override
View Full Code Here

Examples of com.hazelcast.spi.ExecutionService

        HazelcastInstanceProxy proxy = (HazelcastInstanceProxy) createHazelcastInstance();
        Field originalField = HazelcastInstanceProxy.class.getDeclaredField("original");
        originalField.setAccessible(true);
        HazelcastInstanceImpl hz = (HazelcastInstanceImpl) originalField.get(proxy);
        NodeEngine nodeEngine = hz.node.nodeEngine;
        ExecutionService es = nodeEngine.getExecutionService();

        final CountDownLatch latch1 = new CountDownLatch(1);
        final CountDownLatch latch2 = new CountDownLatch(2);
        final ExecutorService executorService = Executors.newSingleThreadExecutor();
        try {
            Future future = executorService.submit(new Callable<String>() {
                @Override
                public String call() {
                    try {
                        return "success";
                    } finally {
                        latch1.countDown();
                    }
                }
            });

            latch1.await(30, TimeUnit.SECONDS);

            final AtomicReference reference1 = new AtomicReference();
            final AtomicReference reference2 = new AtomicReference();
            final ICompletableFuture completableFuture = es.asCompletableFuture(future);
            completableFuture.andThen(new ExecutionCallback() {
                @Override
                public void onResponse(Object response) {
                    reference1.set(response);
                    latch2.countDown();
View Full Code Here

Examples of com.hazelcast.spi.ExecutionService

        HazelcastInstanceProxy proxy = (HazelcastInstanceProxy) createHazelcastInstance();
        Field originalField = HazelcastInstanceProxy.class.getDeclaredField("original");
        originalField.setAccessible(true);
        HazelcastInstanceImpl hz = (HazelcastInstanceImpl) originalField.get(proxy);
        NodeEngine nodeEngine = hz.node.nodeEngine;
        ExecutionService es = nodeEngine.getExecutionService();

        final CountDownLatch latch1 = new CountDownLatch(1);
        final CountDownLatch latch2 = new CountDownLatch(1);
        Future future = es.submit("default", new Callable<String>() {
            @Override
            public String call() {
                try {
                    latch1.await(30, TimeUnit.SECONDS);
                    return "success";
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        });

        final AtomicReference reference = new AtomicReference();
        final ICompletableFuture completableFuture = es.asCompletableFuture(future);
        completableFuture.andThen(new ExecutionCallback() {
            @Override
            public void onResponse(Object response) {
                reference.set(response);
                latch2.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.