Package org.olat.commons.coordinate.cluster.lock

Examples of org.olat.commons.coordinate.cluster.lock.ClusterLockManager


      Identity i1 = ManagerFactory.getManager().createAndPersistIdentity("u"+i, null, null, null, null);
      identities.add(i1);
    }
    DBFactory.getInstance().closeSession();

    ClusterLockManager cm = ClusterLockManager.getInstance();
    Identity ident = identities.get(0);
    Identity ident2 = identities.get(1);
    OLATResourceable ores = OresHelper.createOLATResourceableInstanceWithoutCheck(LockTest.class.getName(), new Long(123456789));
   
    // ------------------ test the clusterlockmanager ----------------------
    // create a lock
    String asset = OresHelper.createStringRepresenting(ores, "locktest");
    LockImpl li = cm.createLockImpl(asset, ident);
    cm.saveLock(li);
    DBFactory.getInstance().closeSession();
   
    // find it
    LockImpl l2 = cm.findLock(asset);
    assertNotNull(l2);
    assertEquals(li.getKey(), l2.getKey());
   
    // delete it
    cm.deleteLock(l2);
    DBFactory.getInstance().closeSession();
   
    // may not find it again
    LockImpl l3 = cm.findLock(asset);
    assertNull(l3);
   
   
    // ------------------ test the clusterlocker ----------------------   
    Locker cl = CoordinatorManager.getCoordinator().getLocker();
View Full Code Here

TOP

Related Classes of org.olat.commons.coordinate.cluster.lock.ClusterLockManager

Copyright © 2018 www.massapicom. 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.