|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.progeeks.repository.DefaultLockManager
public class DefaultLockManager
Default implementation of repository lock manager that permits only one instance of the repository to be used at a time. Maintains the next repository item id to be assigned in a file in the root repository directory. This locking manager is safe to use with the meta-class cache.
| Field Summary | |
|---|---|
protected static java.lang.String |
ID_FILE
File used to save the id number to assign to the next added item. |
| Constructor Summary | |
|---|---|
DefaultLockManager()
|
|
| Method Summary | |
|---|---|
void |
createRepository(java.io.File repositoryDir)
Method invoked when a new repository is created. |
int |
getNextItemId()
Returns the next item id. |
void |
initialize(java.io.File repositoryDir)
Initializes the repository, locking its id file to ensure that only one process has access to the repository. |
Lock |
lockItem(RepositoryItem item,
boolean writeLock)
Lock the given item for reading and/or writing. |
Lock |
lockItem(java.lang.String itemId,
boolean writeLock)
Lock the given itemId for reading and/or writing. |
void |
releaseLock(Lock lock)
Release the lock held on the given item. |
void |
terminate()
Terminate the locking manager. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String ID_FILE
| Constructor Detail |
|---|
public DefaultLockManager()
| Method Detail |
|---|
public void initialize(java.io.File repositoryDir)
initialize in interface LockManagerpublic void terminate()
LockManager
terminate in interface LockManagerpublic int getNextItemId()
getNextItemId in interface LockManager
public Lock lockItem(RepositoryItem item,
boolean writeLock)
lockItem in interface LockManager
public Lock lockItem(java.lang.String itemId,
boolean writeLock)
lockItem in interface LockManagerpublic void releaseLock(Lock lock)
LockManager
releaseLock in interface LockManagerpublic void createRepository(java.io.File repositoryDir)
LockManager
createRepository in interface LockManager
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||