Examples of acquire()


Examples of com.netflix.curator.framework.recipes.locks.InterProcessMutex.acquire()

    @Override
    public Object lockRoot(int id) {
        try {
            final InterProcessMutex mutex = new InterProcessMutex(client, ROOT_LOCKS + '/' + id);
            mutex.acquire();
            return mutex;
        } catch (Exception ex) {
            throw Throwables.propagate(ex);
        }
    }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.document.ODatabaseDocumentPool.acquire()

    // create document pool
    ODatabaseDocumentPool pool = new ODatabaseDocumentPool(DBURI, DBUSR, DBPWD);
    pool.setup(100, 200);

    // create the schema for the test class if it doesn't exist
    ODatabaseDocumentTx db = pool.acquire();
    try {
      OSchema schema = db.getMetadata().getSchema();
      if (!schema.existsClass(CLASSNAME)) {
        OClass oc = schema.createClass(CLASSNAME);
        oc.createProperty(PROPKEY, OType.STRING);
View Full Code Here

Examples of com.ponysdk.core.UIContext.acquire()

        if (applicationSession == null) throw new RuntimeException("Invalid session, please reload your application");

        JettyWebSocket jettyWebSocket;

        final UIContext uiContext = applicationSession.getUIContext(key);
        uiContext.acquire();
        try {
            UIContext.setCurrent(uiContext);
            jettyWebSocket = newJettyWebsocket();
            PPusher.get().initialize(jettyWebSocket);
        } finally {
View Full Code Here

Examples of com.sleepycat.je.latch.Latch.acquire()

    Lock lookupLock(Long nodeId)
        throws DatabaseException {

        int lockTableIndex = getLockTableIndex(nodeId);
        Latch latch = lockTableLatches[lockTableIndex];
        latch.acquire();
        try {
            return lookupLockInternal(nodeId, lockTableIndex);
        } finally {
            latch.release();
        }
View Full Code Here

Examples of com.sun.cldc.util.Semaphore.acquire()

    // the tests

    void testOne() {
        Semaphore sema = new Semaphore(1);
        sema.acquire();
        assertTrue(true);
    }

    void testTwo() {
        Semaphore sema = new Semaphore(0);
View Full Code Here

Examples of com.trendmicro.codi.lock.ZLock.acquire()

            String lockPath = "/locks/brk_" + broker_ip;
            ZLock brokerLock = new ZLock(lockPath);
            ZNode brokerNode = new ZNode("/broker/" + broker_ip);
            try{

                brokerLock.acquire(LockType.WRITE_LOCK);
                ZooKeeperInfo.Broker.Builder brkBuilder = ZooKeeperInfo.Broker.newBuilder();
                TextFormat.merge(new String(brokerNode.getContent()), brkBuilder);
                brkBuilder.clearStatus().setStatus(ZooKeeperInfo.Broker.Status.ONLINE);
                brokerNode.setContent(brkBuilder.build().toString().getBytes());
                myConsole.logResponseNL("success");
View Full Code Here

Examples of com.volantis.mcs.repository.lock.Lock.acquire()

            String principalName = args[1];
            Principal principal = new JDBCPrincipal(principalName);
            String resource = args[2];

            Lock lock = manager.getLock(resource);
            lock.acquire(principal);
        } else if (command.equals("unlock")) {

            if (args.length != 3) {
                usage("lock <principal> <resource>");
            }
View Full Code Here

Examples of edu.emory.mathcs.backport.java.util.concurrent.Semaphore.acquire()

            }.start();
        }
       
        producersFinished.acquire();
        long end1 = System.currentTimeMillis();
        consumersFinished.acquire();
        long end2 = System.currentTimeMillis();
       
        System.out.println("Results for destination="+destination+", producers="+PRODUCER_COUNT+", consumers="+CONSUMER_COUNT+", deliveryMode="+deliveryMode);
        System.out.println("Produced at messages/sec: "+ (PRODUCE_COUNT*1000.0/(end1-start)));
        System.out.println("Consumed at messages/sec: "+ (CONSUME_COUNT*1000.0/(end2-start)));       
View Full Code Here

Examples of hudson.slaves.WorkspaceList.acquire()

                    // this prevents multiple workspaces of the same job --- the behavior of Hudson < 1.319.
                    //
                    // OTOH, if a concurrent build is chosen, the user is willing to create a multiple workspace,
                    // so better throughput is achieved over time (modulo the initial cost of creating that many workspaces)
                    // by having multiple workspaces
                    WorkspaceList.Lease lease = l.acquire(ws, !concurrentBuild);
                    Launcher launcher = ws.createLauncher(listener);
                    try {
                        LOGGER.fine("Polling SCM changes of " + getName());
                        if (pollingBaseline==null) // see NOTE-NO-BASELINE above
                            calcPollingBaseline(lb,launcher,listener);
View Full Code Here

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

        final ConcurrentStartupChannel[] channels=new ConcurrentStartupChannel[count];
        try {
            // Create a semaphore and take all its permits
            Semaphore semaphore=new Semaphore(count);
            semaphore.acquire(count);

            // Create activation threads that will block on the semaphore
            for(int i=0;i < count;i++) {
                if(i == 0)
                    channels[i]=new ConcurrentStartupChannel(names[i], semaphore);
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.