public class HazelCastClusterFileStateCache extends ClusterFileStateCache implements ClusterInterface, com.hazelcast.core.MembershipListener, com.hazelcast.core.EntryListener<String,HazelCastClusterFileState>, com.hazelcast.core.MessageListener<ClusterMessage>
Modifier and Type | Field and Description |
---|---|
static int |
DebugByteLock |
static int |
DebugCleanup |
static int |
DebugClusterEntry |
static int |
DebugClusterMessage |
static int |
DebugExpire |
static int |
DebugFileAccess |
static int |
DebugFileDataUpdate |
static int |
DebugFileStatus |
static int |
DebugMembership |
static int |
DebugNearCache |
static int |
DebugOplock |
static int |
DebugPerNode |
static int |
DebugRemoteTask |
static int |
DebugRemoteTiming |
static int |
DebugRename |
static int |
DebugStateCache |
static long |
DefaultNearCacheTimeout |
static long |
MaximumNearCacheTimeout |
static long |
MinimumNearCacheTimeout |
DefaultExpireCheckInterval, DefaultFileStateExpireInterval, MinimumExpireCheckInterval, MinimumFileStateExpireInterval
Constructor and Description |
---|
HazelCastClusterFileStateCache()
Class constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addLock(FileState fstate,
FileLock lock)
Add a lock to this file
|
boolean |
addOpLock(FileState fstate,
OpLockDetails oplock,
NetworkFile netFile)
Add an oplock
|
boolean |
canReadFile(ClusterFileState clState,
long offset,
long len,
int pid)
Check if the file is readable for the specified section of the file and process id
|
boolean |
canWriteFile(ClusterFileState clState,
long offset,
long len,
int pid)
Check if the file is writeable for the specified section of the file and process id
|
void |
changeOpLockType(OpLockDetails oplock,
int newTyp)
Change an oplock type
|
protected boolean |
checkFileAccess(ClusterFileState clState,
long offset,
long len,
int pid,
boolean writeCheck)
Check file access using a remote call
|
protected void |
clearLowPriorityStateUpdates(int updateMask)
Clear some, or all, low priority state updates that may be queued
|
void |
clearOpLock(FileState fstate)
Clear an oplock
|
FileLock |
createFileLockObject(NetworkFile file,
long offset,
long len,
int pid)
Create a file lock object
|
void |
dumpCache(boolean dumpAttribs)
Dump the state cache entries to the debug device
|
void |
entryAdded(com.hazelcast.core.EntryEvent<String,HazelCastClusterFileState> event)
Invoked when an entry is added to the clustered cache
|
void |
entryEvicted(com.hazelcast.core.EntryEvent<String,HazelCastClusterFileState> event)
Invoked when an entry is evicted from the clustered cache
|
void |
entryRemoved(com.hazelcast.core.EntryEvent<String,HazelCastClusterFileState> event)
Invoked when an entry is removed from the clustered cache
|
void |
entryUpdated(com.hazelcast.core.EntryEvent<String,HazelCastClusterFileState> event)
Invoked when an entry is updated in the clustered cache
|
Enumeration<String> |
enumerateCache()
Enumerate the file state cache
|
FileState |
findFileState(String path)
Find the file state for the specified path
|
FileState |
findFileState(String path,
boolean create)
Find the file state for the specified path, and optionally create a new file state if not
found
|
FileState |
findFileState(String path,
boolean create,
int status)
Find the file state for the specified path, and optionally create a new file state if not
found with the specified initial status
|
String |
getClusterName()
Return the cluster name
|
FileStateProxy |
getFileStateProxy(FileState fstate)
Return a file state proxy for the specified file state
|
ClusterNode |
getLocalNode()
Return the local node details
|
ClusterNodeList |
getNodeList()
Return the list of nodes
|
NotifyChangeHandler |
getNotifyChangeHandler()
Return the change notification handler, if configured for the filesystem
|
OpLockDetails |
getOpLock(FileState fstate)
Return the oplock details for a file, or null if there is no oplock
|
OpLockManager |
getOpLockManager()
Return the oplock manager
|
PerNodeState |
getPerNodeState(ClusterFileState fState,
boolean createState)
Return the per node state for a file state, and optionally create a new per node state
|
PerNodeState |
getPerNodeState(String path,
boolean createState)
Return the per node state for a file path, and optionally create a new per node state
|
ClusterFileStateCache |
getStateCache()
Return the associated cluster state cache
|
protected HazelCastClusterFileState |
getStateFromNearCache(String path)
Try and get a file state from the near cache
|
ThreadRequestPool |
getThreadPool()
Return the thread pool
|
FileAccessToken |
grantFileAccess(FileOpenParams params,
FileState fstate,
int fileSts)
Grant the required file access
|
boolean |
hasActiveLocks(FileState fstate)
Check if there are active locks on this file
|
boolean |
hasDebugLevel(int flg)
Check if the specified debug level is enabled
|
boolean |
hasNearCache()
Check if the near-cache is enabled
|
boolean |
hasNotifyChangeHandler()
Check if the change notification handler is set
|
boolean |
hasSendNotExistStates()
Check if none existent file/folder states should be sent to the cluster
|
boolean |
hasTaskDebug()
Check if remote task debugging is enabled
|
boolean |
hasTaskTiming()
Check if remote task timing is enabled
|
void |
initializeCache(org.springframework.extensions.config.ConfigElement config,
ServerConfiguration srvConfig)
Initialize the file state cache
|
protected boolean |
isLocalKey(String path)
Check if the path is in the locally owned cache partition
|
void |
memberAdded(com.hazelcast.core.MembershipEvent membershipEvent)
Cluster member added
|
void |
memberRemoved(com.hazelcast.core.MembershipEvent membershipEvent)
Cluster member removed
|
int |
numberOfStates()
Return the number of states in the cache
|
void |
onMessage(com.hazelcast.core.Message<ClusterMessage> hzMessage)
Cluster topic message listener
|
protected void |
procDataUpdate(DataUpdateMessage msg)
Process a remote file data update message
|
protected void |
procFileStateRename(StateRenameMessage msg)
Process a remote file state rename message
|
protected void |
procFileStateUpdate(StateUpdateMessage msg)
Process a remote file state update message
|
protected void |
procOpLockBreakNotify(OpLockMessage msg)
Process a remote oplock break notify message
|
protected void |
procOpLockBreakRequest(OpLockMessage msg)
Process a remote oplock break request message
|
protected void |
procOpLockTypeChange(OpLockMessage msg)
Process a remote oplock type change message
|
int |
releaseFileAccess(FileState fstate,
FileAccessToken token)
Release access to a file
|
protected boolean |
remoteUpdateState(ClusterFileState clState,
int updateMask)
Update a file state using a remote task call
|
void |
removeAllFileStates()
Remove all file states from the cache
|
int |
removeExpiredFileStates()
Remove expired file states from the cache
As the cache data is spread across the cluster we only expire file states that are stored on
the local node.
|
FileState |
removeFileState(String path)
Remove the file state for the specified path
|
void |
removeLock(FileState fstate,
FileLock lock)
Remove a lock on this file
|
protected int |
removeMemberData(com.hazelcast.core.Member member)
Remove cluster cache data that is owned by the specified cluster member as the member has left
the cluster (such as file locks and oplocks).
|
void |
renameFileState(String newPath,
FileState state,
boolean isDir)
Rename a file state, remove the existing entry, update the path and add the state back into
the cache using the new path.
|
void |
requestOplockBreak(String path,
OpLockDetails oplock,
SMBSrvSession sess,
SMBSrvPacket pkt)
Request an oplock break
|
void |
setDataUpdateCompleted(FileState fstate)
Indicate that a data update has completed for the specified file
|
void |
setDataUpdateInProgress(FileState fstate)
Indicate a data update is in progress for the specified file
|
void |
setLocalNode(ClusterNode localNode)
Set the local cluster node
|
void |
setNodeList(ClusterNodeList nodeList)
Set the cluster node list
|
void |
setNotifyChangeHandler(NotifyChangeHandler notifyHandler)
Set the change notification handler
|
void |
setOpLockManager(OpLockManager oplockMgr)
Set the oplock manager
|
void |
setSendNotExistStates(boolean notExist)
Set the send none existent file/folder states to the cluster
|
void |
shutdownCluster()
Shutdown the cluster
|
void |
startCluster()
Start the cluster
|
void |
updateFileState(ClusterFileState clState,
int updateMask)
Update a file state, notify the cluster of the updates
|
protected void |
updateNearCacheState(ClusterFileState clState)
Update a near-cache state with a new state received from a remote task call
|
addNodeToPurgeList, clusterRunning, getCluster, isClusteredCache, setCluster, setDriverDetails, stateCacheShuttingDown, stateCacheStarted
addStateCacheListener, addStateListener, getCheckInterval, getFileStateExpireInterval, getStateCacheListener, getStateListener, hasDebug, hasDebugExpiredStates, hasDumpOnShutdown, hasStateCacheListener, hasStateListener, isCaseSensitive, removeStateCacheListener, removeStateListener, setCaseSensitive, setCheckInterval, setDebug, setDebugExpiredStates, setDumpOnShutdown, setFileStateExpireInterval
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasDebug
public static final int DebugStateCache
public static final int DebugExpire
public static final int DebugNearCache
public static final int DebugOplock
public static final int DebugByteLock
public static final int DebugFileAccess
public static final int DebugMembership
public static final int DebugCleanup
public static final int DebugPerNode
public static final int DebugClusterEntry
public static final int DebugClusterMessage
public static final int DebugRemoteTask
public static final int DebugRemoteTiming
public static final int DebugRename
public static final int DebugFileDataUpdate
public static final int DebugFileStatus
public static final long DefaultNearCacheTimeout
public static final long MinimumNearCacheTimeout
public static final long MaximumNearCacheTimeout
public HazelCastClusterFileStateCache()
public void initializeCache(org.springframework.extensions.config.ConfigElement config, ServerConfiguration srvConfig) throws InvalidConfigurationException
initializeCache
in class FileStateCache
srvConfig
- ServerConfigurationconfig
- ConfigElementInvalidConfigurationException
public int numberOfStates()
numberOfStates
in class FileStateCache
public Enumeration<String> enumerateCache()
public void dumpCache(boolean dumpAttribs)
dumpCache
in class FileStateCache
dumpAttribs
- booleanpublic FileStateProxy getFileStateProxy(FileState fstate)
getFileStateProxy
in class FileStateCache
fstate
- FileStatepublic final boolean hasNearCache()
public FileState findFileState(String path)
findFileState
in class FileStateCache
path
- Stringpublic FileState findFileState(String path, boolean create)
findFileState
in class FileStateCache
path
- Stringcreate
- booleanpublic FileState findFileState(String path, boolean create, int status)
findFileState
in class FileStateCache
path
- Stringcreate
- booleanstatus
- intpublic FileState removeFileState(String path)
removeFileState
in class FileStateCache
path
- Stringpublic void renameFileState(String newPath, FileState state, boolean isDir)
renameFileState
in class FileStateCache
newPath
- Stringstate
- FileStateisDir
- booleanpublic void removeAllFileStates()
removeAllFileStates
in class FileStateCache
public int removeExpiredFileStates()
removeExpiredFileStates
in class FileStateCache
public OpLockDetails getOpLock(FileState fstate)
getOpLock
in class FileStateCache
fstate
- FileStatepublic boolean addOpLock(FileState fstate, OpLockDetails oplock, NetworkFile netFile) throws ExistingOpLockException
addOpLock
in class FileStateCache
fstate
- FileStateoplock
- OpLockDetailsnetFile
- NetworkFileExistingOpLockException
public void clearOpLock(FileState fstate)
clearOpLock
in class FileStateCache
fstate
- FileStatepublic FileLock createFileLockObject(NetworkFile file, long offset, long len, int pid)
createFileLockObject
in class FileStateCache
file
- NetworkFileoffset
- longlen
- longpid
- intpublic boolean hasActiveLocks(FileState fstate)
hasActiveLocks
in class FileStateCache
fstate
- FileStatepublic void addLock(FileState fstate, FileLock lock) throws LockConflictException
addLock
in class FileStateCache
fstate
- FileStatelock
- FileLockLockConflictException
public void removeLock(FileState fstate, FileLock lock) throws NotLockedException
removeLock
in class FileStateCache
fstate
- FileStatelock
- FileLockNotLockedException
public void startCluster() throws Exception
startCluster
in interface ClusterInterface
Exception
public void shutdownCluster() throws Exception
shutdownCluster
in interface ClusterInterface
Exception
public void requestOplockBreak(String path, OpLockDetails oplock, SMBSrvSession sess, SMBSrvPacket pkt) throws IOException, DeferFailedException
requestOplockBreak
in class FileStateCache
path
- Stringoplock
- OpLockDetailssess
- SMBSrvSessionpkt
- SMBSrvPacketIOException
DeferFailedException
public void changeOpLockType(OpLockDetails oplock, int newTyp)
changeOpLockType
in class FileStateCache
oplock
- OpLockDetailsnewTyp
- intpublic void memberAdded(com.hazelcast.core.MembershipEvent membershipEvent)
memberAdded
in interface com.hazelcast.core.MembershipListener
membershipEvent
- MembershipEventpublic void memberRemoved(com.hazelcast.core.MembershipEvent membershipEvent)
memberRemoved
in interface com.hazelcast.core.MembershipListener
membershipEvent
- MembershipEventprotected int removeMemberData(com.hazelcast.core.Member member)
member
- Memberpublic PerNodeState getPerNodeState(ClusterFileState fState, boolean createState)
getPerNodeState
in class ClusterFileStateCache
fState
- ClusterFileStatecreateState
- booleanpublic PerNodeState getPerNodeState(String path, boolean createState)
getPerNodeState
in class ClusterFileStateCache
path
- StringcreateState
- booleanpublic FileAccessToken grantFileAccess(FileOpenParams params, FileState fstate, int fileSts) throws FileSharingException, AccessDeniedException, FileExistsException
grantFileAccess
in class FileStateCache
params
- FileOpenParamsfstate
- FileStatefileSts
- intFileSharingException
AccessDeniedException
FileExistsException
public int releaseFileAccess(FileState fstate, FileAccessToken token)
releaseFileAccess
in class FileStateCache
fstate
- FileStatetoken
- FileAccessTokenpublic boolean canReadFile(ClusterFileState clState, long offset, long len, int pid)
canReadFile
in class ClusterFileStateCache
clState
- ClusterFileStateoffset
- longlen
- longpid
- intpublic boolean canWriteFile(ClusterFileState clState, long offset, long len, int pid)
canWriteFile
in class ClusterFileStateCache
clState
- ClusterFileStateoffset
- longlen
- longpid
- intprotected boolean checkFileAccess(ClusterFileState clState, long offset, long len, int pid, boolean writeCheck)
clState
- ClusterFileStateoffset
- longlen
- longpid
- intwriteCheck
- booleanprotected boolean remoteUpdateState(ClusterFileState clState, int updateMask)
clState
- ClusterFileStateupdateMask
- intpublic void updateFileState(ClusterFileState clState, int updateMask)
updateFileState
in class ClusterFileStateCache
clState
- ClusterFileStateupdateMask
- intpublic String getClusterName()
getClusterName
in interface ClusterInterface
public ClusterNodeList getNodeList()
getNodeList
in interface ClusterInterface
public ClusterNode getLocalNode()
getLocalNode
in interface ClusterInterface
public ClusterFileStateCache getStateCache()
getStateCache
in interface ClusterInterface
public ThreadRequestPool getThreadPool()
getThreadPool
in interface ClusterInterface
public boolean hasSendNotExistStates()
hasSendNotExistStates
in interface ClusterInterface
public OpLockManager getOpLockManager()
getOpLockManager
in interface ClusterInterface
public boolean hasNotifyChangeHandler()
public NotifyChangeHandler getNotifyChangeHandler()
getNotifyChangeHandler
in interface ClusterInterface
public void setSendNotExistStates(boolean notExist)
setSendNotExistStates
in interface ClusterInterface
notExist
- booleanpublic void setOpLockManager(OpLockManager oplockMgr)
setOpLockManager
in interface ClusterInterface
oplockMgr
- OpLockManagerpublic void setNotifyChangeHandler(NotifyChangeHandler notifyHandler)
setNotifyChangeHandler
in interface ClusterInterface
notifyHandler
- NotifyChangeHandlerpublic void setNodeList(ClusterNodeList nodeList)
setNodeList
in interface ClusterInterface
nodeList
- ClusterNodeListpublic void setLocalNode(ClusterNode localNode)
setLocalNode
in interface ClusterInterface
localNode
- ClusterNodepublic final boolean hasDebugLevel(int flg)
flg
- intpublic final boolean hasTaskDebug()
public final boolean hasTaskTiming()
public void entryAdded(com.hazelcast.core.EntryEvent<String,HazelCastClusterFileState> event)
entryAdded
in interface com.hazelcast.core.EntryListener<String,HazelCastClusterFileState>
event
- entry eventpublic void entryRemoved(com.hazelcast.core.EntryEvent<String,HazelCastClusterFileState> event)
entryRemoved
in interface com.hazelcast.core.EntryListener<String,HazelCastClusterFileState>
event
- entry eventpublic void entryUpdated(com.hazelcast.core.EntryEvent<String,HazelCastClusterFileState> event)
entryUpdated
in interface com.hazelcast.core.EntryListener<String,HazelCastClusterFileState>
event
- entry eventpublic void entryEvicted(com.hazelcast.core.EntryEvent<String,HazelCastClusterFileState> event)
entryEvicted
in interface com.hazelcast.core.EntryListener<String,HazelCastClusterFileState>
event
- entry eventpublic void onMessage(com.hazelcast.core.Message<ClusterMessage> hzMessage)
onMessage
in interface com.hazelcast.core.MessageListener<ClusterMessage>
hzMessage
- ClusterMessageprotected void procOpLockBreakRequest(OpLockMessage msg)
msg
- OpLockMessageprotected void procOpLockBreakNotify(OpLockMessage msg)
msg
- OpLockMessageprotected void procOpLockTypeChange(OpLockMessage msg)
msg
- OpLockMessageprotected void procFileStateUpdate(StateUpdateMessage msg)
msg
- StateUpdateMessageprotected void procFileStateRename(StateRenameMessage msg)
msg
- StateRenameMessageprotected void procDataUpdate(DataUpdateMessage msg)
msg
- DataUpdateMessageprotected boolean isLocalKey(String path)
path
- Stringprotected final void clearLowPriorityStateUpdates(int updateMask)
updateMask
- intprotected final void updateNearCacheState(ClusterFileState clState)
clState
- ClusterFileStatepublic void setDataUpdateInProgress(FileState fstate)
setDataUpdateInProgress
in class FileStateCache
fstate
- FileStatepublic void setDataUpdateCompleted(FileState fstate)
setDataUpdateCompleted
in class FileStateCache
fstate
- FileStateprotected final HazelCastClusterFileState getStateFromNearCache(String path)
path
- StringCopyright © 2005–2017 Alfresco Software. All rights reserved.