Examples of LockResult


Examples of org.olat.core.util.coordinate.LockResult

   *      org.olat.modules.webFeed.models.Item, org.olat.core.id.Identity)
   */
  public LockResult acquireLock(OLATResourceable feed, Item item, Identity identity) {
    String key = itemKey(item, feed);
    OLATResourceable itemResource = OresHelper.createOLATResourceableType(key);
    LockResult lockResult = CoordinatorManager.getCoordinator().getLocker().acquireLock(itemResource, identity, key);
    return lockResult;
  }
View Full Code Here

Examples of org.olat.core.util.coordinate.LockResult

   * @param identity
   *            the identity who wishes to obtain the lock
   * @return the lockresult
   */
  private LockResult acquireLock(String key, Identity identity) {
    LockResult lockResult;
    boolean logDebug = log.isDebug();
    synchronized (locks) { //o_clusterOK by:fj, by definition we are in singleVM mode
      LockEntry oldLockEntry = locks.get(key);
      if (oldLockEntry == null || identity.getName().equals(oldLockEntry.getOwner().getName())) {
        // no one has the lock aquired yet - or user reacquired its own
View Full Code Here

Examples of org.olat.core.util.coordinate.LockResult

   
    // ------------------ 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");
    long lock1Ac = res11.getLockAquiredTime();
    assertTrue(res11.isSuccess());
    DBFactory.getInstance().closeSession();

    // acquire by another identity must fail
    LockResult res2 = cl.acquireLock(ores, ident2, "abc");
    assertFalse(res2.isSuccess());
    DBFactory.getInstance().closeSession();

    // reacquire same identity
    LockResult res3 = cl.acquireLock(ores, ident, "abc");
    assertTrue(res3.isSuccess());
    DBFactory.getInstance().closeSession();

    // test the admin
    List<LockEntry> entries = cl.adminOnlyGetLockEntries();
    assertEquals(1, entries.size());
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.