net.sf.sasl.distributed.lock
Interface ILockSessionFactory

All Known Implementing Classes:
LockSessionFactory

public interface ILockSessionFactory

A lock session factory is the root to create and configure new lock sessions. The implementation of the lock session factory should be thread safe. A lock session factory must definitely not create sessions which are robust against all sorts of evil code, for example creating two lock sessions for the same thread and locking over them the same lock key.

Since:
0.0.1 (sasl-distributed-lock-library)
Author:
Philipp Förmer

Method Summary
 ILockSession getActiveThreadSharedSession(boolean allowCreate)
          Returns an active lock session for the current thread, if there exists one (a call to getActiveThreadSharedSession(true) was done before).
 ILockSession openNewLockSession()
          Creates and configures a fresh new lock session and returns it.
 void release()
          Releases the lock session factory.
 

Method Detail

openNewLockSession

ILockSession openNewLockSession()
Creates and configures a fresh new lock session and returns it.

Returns:
non null
Since:
0.0.1 (sasl-distributed-lock-library)

getActiveThreadSharedSession

ILockSession getActiveThreadSharedSession(boolean allowCreate)
Returns an active lock session for the current thread, if there exists one (a call to getActiveThreadSharedSession(true) was done before). If there exists no active lock session and allowCreate is true, than a new lock session will be created for the thread and returned. Else null will be returned.

Parameters:
allowCreate - true or false.
Returns:
null or non null
Since:
0.0.1 (sasl-distributed-lock-library)

release

void release()
Releases the lock session factory. All critical acquired resources by the lock sessions, for example held lock sessions, should get released immediately.

Since:
0.0.1 (sasl-distributed-lock-library)
See Also:
DisposableBean.destroy()


Copyright © 2010. All Rights Reserved.