Examples of acquireLock()


Examples of net.greghaines.jesque.client.ClientImpl.acquireLock()

    public void acquireLockSuccess() {
        LOG.info("Running acquireLockSuccess()...");
        final Client client = new ClientImpl(CONFIG);
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "me", 10));
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "me", 10));
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "me", 10));
    }

    @Test
    public void acquireLockFail() {
        LOG.info("Running acquireLockFail()...");
View Full Code Here

Examples of net.greghaines.jesque.client.ClientImpl.acquireLock()

    @Test
    public void acquireLockFail() {
        LOG.info("Running acquireLockFail()...");
        final Client client = new ClientImpl(CONFIG);
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "pete", 10000));
        Assert.assertFalse("Acquired lock that should have been in use.",
                client.acquireLock("systemLockA", "george", 10));
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "pete", 10000));
    }
View Full Code Here

Examples of net.greghaines.jesque.client.ClientImpl.acquireLock()

    public void acquireLockFail() {
        LOG.info("Running acquireLockFail()...");
        final Client client = new ClientImpl(CONFIG);
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "pete", 10000));
        Assert.assertFalse("Acquired lock that should have been in use.",
                client.acquireLock("systemLockA", "george", 10));
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "pete", 10000));
    }

    @Test
    public void unpermittedJob() {
View Full Code Here

Examples of net.greghaines.jesque.client.ClientImpl.acquireLock()

        LOG.info("Running acquireLockFail()...");
        final Client client = new ClientImpl(CONFIG);
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "pete", 10000));
        Assert.assertFalse("Acquired lock that should have been in use.",
                client.acquireLock("systemLockA", "george", 10));
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "pete", 10000));
    }

    @Test
    public void unpermittedJob() {
        final Job job = new Job("TestAction", new Object[] { 1, 2.3, true, "test", Arrays.asList("inner", 4.5) });
View Full Code Here

Examples of net.sourceforge.ganttproject.document.Document.acquireLock()

        if (!document.canWrite()) {
            myWorkbenchFacade.showErrorDialog(i18n.getText("msg10"));
            saveProjectAs(project);
            return;
        }
        if (!document.acquireLock()) {
            myWorkbenchFacade.showErrorDialog(i18n.getText("msg14"));
            saveProjectAs(project);
            return;
        }
        try {
View Full Code Here

Examples of org.apache.roller.business.runnable.ThreadManager.acquireLock()

           
            if(!mgr.isLocked(this)) {
               
                log.debug("Attempting to acquire lock");
               
                lockAcquired = mgr.acquireLock(this);
               
                // now if we have a lock then run the task
                if(lockAcquired) {
                    log.debug("Lock acquired, running task");
                    this.runTask();
View Full Code Here

Examples of org.apache.roller.business.runnable.ThreadManager.acquireLock()

       
        // need a test task to play with
        RollerTask task = new TestTask();
       
        // try to acquire a lock
        boolean lockAcquired = mgr.acquireLock(task);
        assertTrue(lockAcquired);
        TestUtils.endSession(true);
       
        // make sure task is locked
        boolean stillLocked = mgr.isLocked(task);
View Full Code Here

Examples of org.exist.storage.txn.Txn.acquireLock()

        final Subject currentUser = broker.getSubject();
       
        try {
            broker.setSubject(pool.getSecurityManager().getSystemSubject());
            txn = transact.beginTransaction();
            txn.acquireLock(collection.getLock(), Lock.WRITE_LOCK);
            final IndexInfo info = collection.validateXMLResource(txn, broker, uri, data);
            final DocumentImpl doc = info.getDocument();
            doc.getMetadata().setMimeType(MimeType.XML_TYPE.getName());
            doc.getPermissions().setMode(Permission.DEFAULT_SYSTSEM_RESOURCE_PERM);
            fullURI = getFullURI(broker.getBrokerPool(), doc.getURI());
View Full Code Here

Examples of org.olat.core.util.coordinate.Locker.acquireLock()

   
    // ------------------ test the clusterlocker ----------------------   
    Locker cl = CoordinatorManager.getCoordinator().getLocker();
   
    // acquire
    LockResult res1 = cl.acquireLock(ores, ident, "abc");
    assertTrue(res1.isSuccess());
    DBFactory.getInstance().closeSession();
   
    // reacquire same identity (get from db)
    LockResult res11 = cl.acquireLock(ores, ident, "abc");
View Full Code Here

Examples of org.olat.core.util.coordinate.Locker.acquireLock()

    LockResult res1 = cl.acquireLock(ores, ident, "abc");
    assertTrue(res1.isSuccess());
    DBFactory.getInstance().closeSession();
   
    // reacquire same identity (get from db)
    LockResult res11 = cl.acquireLock(ores, ident, "abc");
    long lock1Ac = res11.getLockAquiredTime();
    assertTrue(res11.isSuccess());
    DBFactory.getInstance().closeSession();

    // acquire by another identity must fail
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.