Class FileLockManager
- java.lang.Object
-
- org.apache.manifoldcf.core.lockmanager.BaseLockManager
-
- org.apache.manifoldcf.core.lockmanager.FileLockManager
-
- All Implemented Interfaces:
ILockManager
public class FileLockManager extends BaseLockManager
This is the file-based lock manager.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classFileLockManager.ByteArrayBuffer-
Nested classes/interfaces inherited from class org.apache.manifoldcf.core.lockmanager.BaseLockManager
BaseLockManager.LockDescription
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String_rcsidprotected static intBASE_SIZEprotected static java.lang.IntegerlockPoolInitializationprotected static LockPoolmyFileLocksprotected java.io.FilesynchDirectorystatic java.lang.StringsynchDirectoryPropertySynchronization directory property - local to this implementation of ILockManager-
Fields inherited from class org.apache.manifoldcf.core.lockmanager.BaseLockManager
activePrefix, anonymousServiceNamePrefix, anonymousServiceTypeCounter, globalData, globalFlags, localLocks, localSections, myLocks, mySections, serviceDataPrefix, serviceListPrefix, servicePrefix, serviceTypeLockPrefix, threadID, TYPE_READ, TYPE_WRITE, TYPE_WRITENONEX
-
-
Constructor Summary
Constructors Constructor Description FileLockManager()FileLockManager(java.io.File synchDirectory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckGlobalFlag(java.lang.String flagName)Check the condition of a specified flag.voidclearGlobalFlag(java.lang.String flagName)Clear a flag.protected static java.lang.StringgetFlagResourceName(java.lang.String flagName)Calculate the name of a flag resource.protected LockPoolgetGlobalLockPool()Override this method to change the nature of global locks.static java.io.FilegetSynchDirectoryProperty()Get the synch directory property.protected java.lang.StringmakeFilePath(java.lang.String key)Create a file path given a key name.byte[]readData(java.lang.String resourceName)Read data from a shared data resource.voidsetGlobalFlag(java.lang.String flagName)Raise a flag.voidwriteData(java.lang.String resourceName, byte[] data)Write data to a shared data resource.-
Methods inherited from class org.apache.manifoldcf.core.lockmanager.BaseLockManager
buildServiceListEntry, buildServiceTypeLockName, checkServiceActive, cleanupInactiveService, clear, clearLocks, constructUniqueServiceName, countActiveServices, deleteServiceData, endServiceActivity, enter, enterCriticalSections, enterLocks, enterLocksNoWait, enterNonExWrite, enterNonExWriteCriticalSection, enterNonExWriteLock, enterNonExWriteLockNoWait, enterNonExWriteNoWait, enterNoWait, enterRead, enterReadCriticalSection, enterReadLock, enterReadLockNoWait, enterReadNoWait, enterWrite, enterWriteCriticalSection, enterWriteLock, enterWriteLockNoWait, enterWriteNoWait, getSharedConfiguration, getSortedUniqueLocks, leave, leaveCriticalSections, leaveLocks, leaveNonExWrite, leaveNonExWriteCriticalSection, leaveNonExWriteLock, leaveRead, leaveReadCriticalSection, leaveReadLock, leaveWrite, leaveWriteCriticalSection, leaveWriteLock, makeActiveServiceFlagName, makeRegisteredServiceFlagName, makeServiceCounterName, makeServiceDataName, readServiceCounter, readServiceData, readServiceName, registerServiceBeginServiceActivity, registerServiceBeginServiceActivity, retrieveServiceData, scanServiceData, timedWait, updateServiceData, writeServiceCounter, writeServiceData, writeServiceName
-
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
synchDirectoryProperty
public static final java.lang.String synchDirectoryProperty
Synchronization directory property - local to this implementation of ILockManager- See Also:
- Constant Field Values
-
lockPoolInitialization
protected static final java.lang.Integer lockPoolInitialization
-
myFileLocks
protected static LockPool myFileLocks
-
synchDirectory
protected java.io.File synchDirectory
-
BASE_SIZE
protected static final int BASE_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileLockManager
public FileLockManager(java.io.File synchDirectory) throws ManifoldCFException- Throws:
ManifoldCFException
-
FileLockManager
public FileLockManager() throws ManifoldCFException- Throws:
ManifoldCFException
-
-
Method Detail
-
getSynchDirectoryProperty
public static java.io.File getSynchDirectoryProperty() throws ManifoldCFExceptionGet the synch directory property.- Throws:
ManifoldCFException
-
getFlagResourceName
protected static java.lang.String getFlagResourceName(java.lang.String flagName)
Calculate the name of a flag resource.- Parameters:
flagName- is the name of the flag.- Returns:
- the name for the flag resource.
-
setGlobalFlag
public void setGlobalFlag(java.lang.String flagName) throws ManifoldCFExceptionRaise a flag. Use this method to assert a condition, or send a global signal. The flag will be reset when the entire system is restarted.- Specified by:
setGlobalFlagin interfaceILockManager- Overrides:
setGlobalFlagin classBaseLockManager- Parameters:
flagName- is the name of the flag to set.- Throws:
ManifoldCFException
-
clearGlobalFlag
public void clearGlobalFlag(java.lang.String flagName) throws ManifoldCFExceptionClear a flag. Use this method to clear a condition, or retract a global signal.- Specified by:
clearGlobalFlagin interfaceILockManager- Overrides:
clearGlobalFlagin classBaseLockManager- Parameters:
flagName- is the name of the flag to clear.- Throws:
ManifoldCFException
-
checkGlobalFlag
public boolean checkGlobalFlag(java.lang.String flagName) throws ManifoldCFExceptionCheck the condition of a specified flag.- Specified by:
checkGlobalFlagin interfaceILockManager- Overrides:
checkGlobalFlagin classBaseLockManager- Parameters:
flagName- is the name of the flag to check.- Returns:
- true if the flag is set, false otherwise.
- Throws:
ManifoldCFException
-
readData
public byte[] readData(java.lang.String resourceName) throws ManifoldCFExceptionRead data from a shared data resource. Use this method to read any existing data, or get a null back if there is no such resource. Note well that this is not necessarily an atomic operation, and it must thus be protected by a lock.- Specified by:
readDatain interfaceILockManager- Overrides:
readDatain classBaseLockManager- Parameters:
resourceName- is the global name of the resource.- Returns:
- a byte array containing the data, or null.
- Throws:
ManifoldCFException
-
writeData
public void writeData(java.lang.String resourceName, byte[] data) throws ManifoldCFExceptionWrite data to a shared data resource. Use this method to write a body of data into a shared resource. Note well that this is not necessarily an atomic operation, and it must thus be protected by a lock.- Specified by:
writeDatain interfaceILockManager- Overrides:
writeDatain classBaseLockManager- Parameters:
resourceName- is the global name of the resource.data- is the byte array containing the data. Pass null if you want to delete the resource completely.- Throws:
ManifoldCFException
-
getGlobalLockPool
protected LockPool getGlobalLockPool()
Override this method to change the nature of global locks.- Overrides:
getGlobalLockPoolin classBaseLockManager
-
makeFilePath
protected java.lang.String makeFilePath(java.lang.String key)
Create a file path given a key name.- Parameters:
key- is the key name.- Returns:
- the file path.
-
-