Examples of compareAndSet()


Examples of com.hazelcast.concurrent.atomiclong.LongWrapper.compareAndSet()

    }

    @Override
    public void run() throws Exception {
        LongWrapper number = getNumber();
        returnValue = number.compareAndSet(expect, update);
        shouldBackup = !returnValue;
    }

    @Override
    public Object getResponse() {
View Full Code Here

Examples of com.hazelcast.concurrent.atomicreference.ReferenceWrapper.compareAndSet()

    }

    @Override
    public void run() throws Exception {
        ReferenceWrapper reference = getReference();
        returnValue = reference.compareAndSet(expect, update);
        shouldBackup = !returnValue;
    }

    @Override
    public Object getResponse() {
View Full Code Here

Examples of com.hazelcast.core.IAtomicLong.compareAndSet()

    public static IAtomicLong mockIAtomicLong() {
        final AtomicLong atomicLong = new AtomicLong(); // keeps actual value
        IAtomicLong iAtomicLong = mock(IAtomicLong.class);

        when( iAtomicLong.getAndIncrement() ).then( delegateTo(atomicLong) );
        when( iAtomicLong.compareAndSet(anyLong(), anyLong()) ).then( delegateTo(atomicLong) );

        return iAtomicLong;
    }
}
View Full Code Here

Examples of io.vertx.core.shareddata.Counter.compareAndSet()

      assertNullPointerException(() -> counter.incrementAndGet(null));
      assertNullPointerException(() -> counter.getAndIncrement(null));
      assertNullPointerException(() -> counter.decrementAndGet(null));
      assertNullPointerException(() -> counter.addAndGet(1, null));
      assertNullPointerException(() -> counter.getAndAdd(1, null));
      assertNullPointerException(() -> counter.compareAndSet(1, 1, null));
      testComplete();
    });
    await();
  }
View Full Code Here

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

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 as pass them up
View Full Code Here

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

        // 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

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

                                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

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

                                        }

                                        @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

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

        }
        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
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.