Examples of compareAndSet()


Examples of java.util.concurrent.atomic.AtomicBoolean.compareAndSet()

                                cb.operationFinished(ctx, topicSubs);
                            }
                        }

                        private void reportFailure(PubSubException e) {
                            if (failed.compareAndSet(false, true))
                                cb.operationFailed(ctx, e);
                        }
                    }, ctx);
                }
            }
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicBoolean.compareAndSet()

                completion.submit(new Callable<Exchange>() {
                    public Exchange call() throws Exception {
                        // only start the aggregation task when the task is being executed to avoid staring
                        // the aggregation task to early and pile up too many threads
                        if (aggregationTaskSubmitted.compareAndSet(false, true)) {
                            // but only submit the task once
                            aggregateExecutorService.submit(aggregateOnTheFlyTask);
                        }

                        if (!running.get()) {
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicBoolean.compareAndSet()

                        {
                            InterProcessLock lock = makeLock(client);
                            lock.acquire();
                            try
                            {
                                if ( isFirst.compareAndSet(true, false) )
                                {
                                    timing.sleepABit();

                                    server.stop();
                                    Assert.assertTrue(timing.awaitLatch(latch));
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicBoolean.compareAndSet()

                                semaphore.acquire();
                                mutex.acquire();
                                Assert.assertTrue(hasLock.compareAndSet(false, true));
                                try
                                {
                                    if ( isFirst.compareAndSet(true, false) )
                                    {
                                        semaphore.release(THREAD_QTY - 1);
                                        while ( semaphore.availablePermits() > 0 )
                                        {
                                            Thread.sleep(100);
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicBoolean.compareAndSet()

            queue = new DistributedQueue<TestQueueItem>(client, null, serializer, "/test", new ThreadFactoryBuilder().build(), MoreExecutors.sameThreadExecutor(), 10, true, null, QueueBuilder.NOT_SET, true, 0)
            {
                @Override
                void internalCreateNode(final String path, final byte[] bytes, final BackgroundCallback callback) throws Exception
                {
                    if ( firstTime.compareAndSet(true, false) )
                    {
                        Executors.newSingleThreadExecutor().submit
                        (
                            new Callable<Object>()
                            {
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicBoolean.compareAndSet()

                completion.submit(new Callable<Exchange>() {
                    public Exchange call() throws Exception {
                        // only start the aggregation task when the task is being executed to avoid staring
                        // the aggregation task to early and pile up too many threads
                        if (aggregationTaskSubmitted.compareAndSet(false, true)) {
                            // but only submit the task once
                            aggregateExecutorService.submit(aggregateOnTheFlyTask);
                        }

                        if (!running.get()) {
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicBoolean.compareAndSet()

                public void run() {
                    long startNs = System.nanoTime();
                    try {
                        boolean deleted = innerStores.get(node.getId()).delete(key, version);
                        successes.incrementAndGet();
                        deletedSomething.compareAndSet(false, deleted);
                        recordSuccess(node, startNs);
                    } catch(UnreachableStoreException e) {
                        failures.add(e);
                        recordException(node, startNs, e);
                    } catch(VoldemortApplicationException e) {
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicInteger.compareAndSet()

                    }
                }
                @Override
                public void handleResultComplete() {
                    synchronized(failureResult) {
                        status.compareAndSet(0, 1);
                        failureResult.notify();
                    }
                }
                @Override
                public void handleFailed(ModelNode failureDescription) {
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicInteger.compareAndSet()

                }
                @Override
                public void handleFailed(ModelNode failureDescription) {
                    synchronized(failureResult) {
                        failureResult.set(failureDescription);
                        status.compareAndSet(0, 2);
                        failureResult.notify();
                    }
                }
                @Override
                public void handleCancellation() {
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicInteger.compareAndSet()

                    }
                }
                @Override
                public void handleCancellation() {
                    synchronized(failureResult) {
                        status.compareAndSet(0, 3);
                        failureResult.notify();
                    }
                }
            };
            final OperationResult result = BasicModelController.this.execute(resolveContext, resolveHandler, operationExecutionContext, false);
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.