Openfire 3.5.0.rc1 Javadoc

org.jivesoftware.util.lock
Class LockManager

java.lang.Object
  extended by org.jivesoftware.util.lock.LockManager

public class LockManager
extends Object

Manager of Locks that could be valid when running within a cluster or when in local mode. By default the LockManager will use a LocalLockFactory but you can set new factories by sending setLockFactory(LockFactory).

Author:
Gaston Dombiak

Constructor Summary
LockManager()
           
 
Method Summary
static Lock getLock(Object key)
          Returns an existing Lock on the specified key or creates a new one if none was found.
static LockFactory getLockFactory()
          Returns the existing lock factory being used for creating new Locks.
static void setLockFactory(LockFactory lockFactory)
          Sets the lock factory to use for creating new Locks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockManager

public LockManager()
Method Detail

getLockFactory

public static LockFactory getLockFactory()
Returns the existing lock factory being used for creating new Locks.

Returns:
the existing lock factory being used for creating new Locks.

setLockFactory

public static void setLockFactory(LockFactory lockFactory)
Sets the lock factory to use for creating new Locks. If null then use LocalLockFactory.

Parameters:
lockFactory - the new lock factory to use for creating new Locks.

getLock

public static Lock getLock(Object key)
Returns an existing Lock on the specified key or creates a new one if none was found. This operation should be thread safe. Successive calls with the same key may or may not return the same Lock. However, different threads asking for the same Lock at the same time will get the same Lock object.

Parameters:
key - the object that defines the visibility or scope of the lock.
Returns:
an existing lock on the specified key or creates a new one if none was found.

Openfire 3.5.0.rc1 Javadoc

Copyright © 2003-2007 Jive Software.