Atavism Version 2018.1AGIS API

atavism.server.util
Class ObjectLockManager

java.lang.Object
  extended by atavism.server.util.ObjectLockManager

public class ObjectLockManager
extends java.lang.Object

a map of oids to a lock. useful for locking an object when you dont have an entity. for example, in the proxyplugin, we want to make sure there are no other threads processing a request for a given oid, to avoid out of order processing. you must make sure you have only one objectlockmanager.

Author:
cedeno

Constructor Summary
ObjectLockManager()
           
 
Method Summary
 java.util.concurrent.locks.Lock getLock(OID mobOid)
           
static void lockAll(java.util.Collection<java.util.concurrent.locks.Lock> locks)
          Utility method that attempts to lock a set of peer locks.
static void lockAll(java.util.concurrent.locks.Lock... locks)
          a wrapper around lockAll(Collection locks) to make it simple if you do not want to create a collection object
static boolean tryLockAll(java.util.Collection<java.util.concurrent.locks.Lock> locks, long time)
          Utility method that attempts to lock a set of peer locks.
static void unlockAll(java.util.Collection<java.util.concurrent.locks.Lock> locks)
          Utility method that releases a set of peer locks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectLockManager

public ObjectLockManager()
Method Detail

getLock

public java.util.concurrent.locks.Lock getLock(OID mobOid)

lockAll

public static void lockAll(java.util.concurrent.locks.Lock... locks)
a wrapper around lockAll(Collection locks) to make it simple if you do not want to create a collection object

Parameters:
locks -

lockAll

public static void lockAll(java.util.Collection<java.util.concurrent.locks.Lock> locks)
Utility method that attempts to lock a set of peer locks. It will attempt each lock, and back out if it is unable.

Parameters:
locks -

unlockAll

public static void unlockAll(java.util.Collection<java.util.concurrent.locks.Lock> locks)
Utility method that releases a set of peer locks.

Parameters:
locks -

tryLockAll

public static boolean tryLockAll(java.util.Collection<java.util.concurrent.locks.Lock> locks,
                                 long time)
Utility method that attempts to lock a set of peer locks. It will attempt each lock, and back out if it is unable. If the time limit is exceeded, it will return false, and all of the locks will have been released.

Parameters:
locks - - set of locks to acquire
time - - maximum amount of time to wait before giving up.


Copyright © 2018 Dragonsan Studios Sp. z o.o.