org.entityfs.lock.impl
Class EntityLockFactory

java.lang.Object
  extended by org.entityfs.lock.impl.EntityLockFactory

public class EntityLockFactory
extends Object

The entity lock factory is used by all EntityLockAdapterFactory:s to create locks for entities and to create standalone locks.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
entityfs-core

Constructor Summary
EntityLockFactory(boolean fair)
          Create the factory.
 
Method Summary
 EntityLock createEntityLock(Lockable locked, boolean readLock, boolean writeLock)
          Create an entity read lock, write lock or a lock that is both.
 ReentrantLock createLock()
          Create a standalone lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityLockFactory

public EntityLockFactory(boolean fair)
Create the factory.

Parameters:
fair - Should fair queuing be used when acquiring the created locks?
Method Detail

createEntityLock

public EntityLock createEntityLock(Lockable locked,
                                   boolean readLock,
                                   boolean writeLock)
Create an entity read lock, write lock or a lock that is both.

Parameters:
locked - The lockable object that the lock should be created for.
readLock - Is the lock a read lock?
writeLock - Is the lock a write lock?
Returns:
The created lock.

createLock

public ReentrantLock createLock()
Create a standalone lock.

Returns:
The created lock.