Package java.util.concurrent.atomic

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


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

    WaveClientRpc.ProtocolWaveClientRpc.Interface rpcImpl =
        new WaveClientRpc.ProtocolWaveClientRpc.Interface() {
      @Override
      public void open(RpcController controller, ProtocolOpenRequest request,
          RpcCallback<ProtocolWaveletUpdate> callback) {
        assertTrue(receivedOpenRequest.compareAndSet(false, true));
        assertEquals(USER, request.getParticipantId());
        assertEquals(WAVE, request.getWaveId());

        // Return a valid response.
        callback.run(cannedResponse);
View Full Code Here

    final Task<?> timeoutTask = Tasks.action("timeoutTimer", new Runnable()
    {
      @Override
      public void run()
      {
        if (committed.compareAndSet(false, true))
        {
          result.fail(new TimeoutException());
        }
      }
    });
View Full Code Here

    _task.addListener(new PromiseListener<T>()
    {
      @Override
      public void onResolved(Promise<T> resolvedPromise)
      {
        if (committed.compareAndSet(false, true))
        {
          Promises.propagateResult(_task, result);
        }
      }
    });
View Full Code Here

    final Directory dir = newDirectory();
    final IndexWriter writer = new IndexWriter(dir,
        newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random())).setInfoStream(new InfoStream() {
        @Override
        public void message(String component, final String message) {
          if (message.startsWith("now flush at close") && thrown.compareAndSet(false, true)) {
            throw new OutOfMemoryError("fake OOME at " + message);
          }
        }

        @Override
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

                    }

                    // Was the target path included in the delta? This might
                    // mean that sub-bundles have changed
                    boolean targetPathChanged = event.getDelta().findMember(targetPath) != null;
                    update.compareAndSet(false, targetPathChanged);

                    if (update.get()) {
                        project.forceRefresh();
                        project.setChanged();
                        bndLauncher.update();
View Full Code Here

     * delivery of P1, Q1, Q2, P2: FIFO (implemented by UNICAST) says messages need to be delivered only in the
     * order in which they were sent by their senders
     */
    protected void removeAndPassUp(Table<Message> win, Address sender) {
        final AtomicBoolean processing=win.getProcessing();
        if(!processing.compareAndSet(false, true))
            return;

        boolean released_processing=false;
        try {
            while(true) {
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.