Package java.util.concurrent.atomic

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


                log.error("couldn't deliver OOB message " + msg, t);
            }
        }

        final AtomicBoolean processing=win.getProcessing();
        if(!processing.compareAndSet(false, true)) {
            return;
        }

        // try to remove (from the AckReceiverWindow) as many messages as possible and pass them up
View Full Code Here


                log.error("couldn't deliver OOB message " + msg, t);
            }
        }

        final AtomicBoolean processing=win.getProcessing();
        if(!processing.compareAndSet(false, true)) {
            return;
        }

        // try to remove (from the AckReceiverWindow) as many messages as possible as pass them up
View Full Code Here

        // Efficient way of checking whether another thread is already processing messages from 'sender'.
        // If that's the case, we return immediately and let the existing thread process our message
        // (https://jira.jboss.org/jira/browse/JGRP-829). Benefit: fewer threads blocked on the same lock, these threads
        // can be returned to the thread pool
        final AtomicBoolean processing=win.getProcessing();
        if(!processing.compareAndSet(false, true)) {
            return;
        }

        boolean remove_msgs=discard_delivered_msgs && !loopback;
        boolean released_processing=false;
View Full Code Here

                                IResource resource = delta.getResource();
                                if (resource.getType() == IResource.FILE) {
                                    IPath location = resource.getLocation();
                                    boolean isRunBundle = location != null ? runBundleSet.contains(location.toPortableString()) : false;
                                    update.compareAndSet(false, isRunBundle);
                                    return false;
                                }

                                // Recurse into containers
                                return true;
View Full Code Here

                                        }

                                        @Override
                                        public void asyncProcessingFinished(final JobExecutionResult result) {
                                            synchronized ( lock ) {
                                                if ( isAsync.compareAndSet(true, false) ) {
                                                    services.jobConsumerManager.unregisterListener(job.getId());
                                                    Job.JobState state = null;
                                                    if ( result.succeeded() ) {
                                                        state = Job.JobState.SUCCEEDED;
                                                    } else if ( result.failed() ) {
View Full Code Here

        }
        return new MultipleModelInput<T>(sources) {
            final AtomicBoolean closed = new AtomicBoolean();
            @Override
            public void close() throws IOException {
                if (closed.compareAndSet(false, true) == false) {
                    return;
                }
                super.close();
                onInputCompleted(temp, location);
            }
View Full Code Here

                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

                public boolean isClosing() {
                    return closing.get();
                }
                public CloseFuture close(boolean immediately) {
                    final AtomicInteger count = new AtomicInteger(closeables.length);
                    if (closing.compareAndSet(false, true)) {
                        SshFutureListener<CloseFuture> listener = new SshFutureListener<CloseFuture>() {
                            public void operationComplete(CloseFuture f) {
                                if (count.decrementAndGet() == 0) {
                                    future.setClosed();
                                }
View Full Code Here

                }
                public boolean isClosing() {
                    return closing.get();
                }
                public CloseFuture close(final boolean immediately) {
                    if (closing.compareAndSet(false, true)) {
                        final Iterator<Closeable> iterator = Arrays.asList(closeables).iterator();
                        SshFutureListener<CloseFuture> listener = new SshFutureListener<CloseFuture>() {
                            public void operationComplete(CloseFuture previousFuture) {
                                while (iterator.hasNext()) {
                                    Closeable c = iterator.next();
View Full Code Here

  boolean wasClosedHandlerCalled(HRegionInfo hri) {
    AtomicBoolean b = closedRegionHandlerCalled.get(hri);
    //compareAndSet to be sure that unit tests don't see stale values. Means,
    //we will return true exactly once unless the handler code resets to true
    //this value.
    return b == null ? false : b.compareAndSet(true, false);
  }

  //For unit tests only
  boolean wasOpenedHandlerCalled(HRegionInfo hri) {
    AtomicBoolean b = openedRegionHandlerCalled.get(hri);
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.