Package java.util.concurrent

Examples of java.util.concurrent.Semaphore.release()


                }
            );
        }

        Assert.assertTrue(startedLatch.await(10, TimeUnit.SECONDS));
        semaphore.release(3);
        Assert.assertTrue(finishedLatch.await(10, TimeUnit.SECONDS));
        verify(client, times(3)).exists(Mockito.<String>any(), anyBoolean());

        ensurePath.ensure(curator);
        verifyNoMoreInteractions(client);
View Full Code Here


                                                else
                                                {
                                                    countList.add(newCount);
                                                }

                                                semaphore.release();
                                            }

                                            @Override
                                            public void stateChanged(CuratorFramework client, ConnectionState newState)
                                            {
View Full Code Here

          es.submit(new Runnable() {
            @Override
            public void run() {
              parse.execute(new NullWriter(), new Object[] { parent });
              runs.incrementAndGet();
              semaphore.release();
            }
          });
          if (System.currentTimeMillis() - start > TIME * 1000) {
            break;
          }
View Full Code Here

                if (sipStack.getStackLogger().isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
                  sipStack.getStackLogger().logDebug("releasing semaphore for message " + message);
                }
                //release the semaphore so that another thread can process another message from the call id queue in the correct order
                // or a new message from another call id queue
                semaphore.release();
                if(messagesOrderingMap.isEmpty()) {
                    synchronized (messagesOrderingMap) {
                        messagesOrderingMap.notify();
                    }
                }
View Full Code Here

    private void leaveIOCriticalSection(String key) {
        synchronized (socketCreationMap) {
            Semaphore creationSemaphore = socketCreationMap.get(key);
            if (creationSemaphore != null) {
                creationSemaphore.release();
            }
        }
    }

    private void enterIOCriticalSection(String key) throws IOException {
View Full Code Here

                if (Boolean.FALSE.equals(object)) {
                    ok.compareAndSet(true, false);
                } else if (object instanceof Throwable) {
                    ok.compareAndSet(true, false);
                }
                s.release();
            }
        };
        int notOwnedCount = 0;
        for (InternalPartitionImpl partition : partitions) {
            Address owner = partition.getOwner();
View Full Code Here

                            .createErrorLoggingResponseHandler(node.getLogger(SyncReplicaVersion.class)));
                    op.setPartitionId(partition.getPartitionId());
                    nodeEngine.getOperationService().executeOperation(op);
                } else {
                    ok.set(false);
                    s.release();
                }
            } else {
                if (owner == null) {
                    ok.set(false);
                }
View Full Code Here

                    ok.set(false);
                }
                notOwnedCount++;
            }
        }
        s.release(notOwnedCount);
        try {
            if (ok.get()) {
                return s.tryAcquire(partitionCount, 10, TimeUnit.SECONDS) && ok.get();
            } else {
                return false;
View Full Code Here

         {
            activators[i] = new StaggeredWebDeployerActivator(semaphore, names[i], sync, regionsToActivate);
            caches[i] = activators[i].getCacheSPI();

            // Release the semaphore to allow the thread to start working
            semaphore.release(1);

            activators[i].start();
            TestingUtil.sleepThread(sleepTimeBetweenNodeStarts);
         }
View Full Code Here

               System.out.println("Run " + x + "-- /" + names[i] + " deactivated on A");
               stressors[i].startPuts();
            }

            // Release the semaphore to allow the threads to start work
            semaphore.release(count);

            // Sleep to ensure the threads get all the semaphore tickets
            // and to ensure puts are actively in progress
            TestingUtil.sleepThread((long) 1000);
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.