org.entityfs.lock.cmd
Interface LockCommandExecutor

All Known Implementing Classes:
LockCommandExecutorImpl

public interface LockCommandExecutor

The LockCommandExecutor's execute(Collection) method takes a collection of lock commands and executes them in an order that it decides to be appropriate. It is used to implement an locking strategy such as "parent first and hash code order".

The default implementation of this interface is LockCommandExecutorImpl.

Since:
1.0
Author:
Karl Gustafsson

Method Summary
 LockCollection execute(Collection<? extends LockCommand> c)
          Execute the supplied lock commands and return the collection of locked locks.
 LockCollection execute(LockCommand... commands)
          Execute the supplied lock commands and return the collection of locked locks.
 

Method Detail

execute

LockCollection execute(Collection<? extends LockCommand> c)
                       throws EntityNotFoundException
Execute the supplied lock commands and return the collection of locked locks.

Implementations should make sure that, when all locks are locked, they are valid with respect to the commands that were supplied. More specifically, that locked parent directories are still parent directories of the entities whose parents this method was instructed to lock.

Parameters:
c - The collection of lock commands. May be null.
Returns:
The collection of locked locks. If the file system where all entities live is not locking, this collection is empty.
Throws:
EntityNotFoundException - If any of the lock command involves a deleted entity.

execute

LockCollection execute(LockCommand... commands)
                       throws EntityNotFoundException
Execute the supplied lock commands and return the collection of locked locks.

Implementations should make sure that, when all locks are locked, they are valid with respect to the commands that were supplied. More specifically, that locked parent directories are still parent directories of the entities whose parents this method was instructed to lock.

Parameters:
commands - The lock commands. May be null.
Returns:
The collection of locked locks. If the file system where all entities live is not locking, this collection is empty.
Throws:
EntityNotFoundException - If any of the lock command involves a deleted entity.
Since:
1.1