mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge 3.2 to HEAD:
16691: Merge 3.1 to 3.2 15827: Fixed bug in delete node event processing 16695: Merge 3.1 to 3.2 16163: Added timestamp tracking via file state cache, added support for . and .. pseudo entries in wildcard folder search git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16976 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -51,6 +51,10 @@ public class FileStateTable
|
||||
|
||||
private long m_cacheTimer = 2 * 60000L; // 2 minutes default
|
||||
|
||||
// File state listener, can veto expiring of file states
|
||||
|
||||
private FileStateListener m_stateListener;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
@@ -287,6 +291,11 @@ public class FileStateTable
|
||||
|
||||
FileState state = m_stateTable.get(enm.nextElement());
|
||||
|
||||
// Check if there is a state listener
|
||||
|
||||
if ( m_stateListener != null)
|
||||
m_stateListener.fileStateClosed(state);
|
||||
|
||||
// DEBUG
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
@@ -336,19 +345,23 @@ public class FileStateTable
|
||||
|
||||
if (state.hasExpired(curTime) && state.getOpenCount() == 0)
|
||||
{
|
||||
|
||||
// Remove the expired file state
|
||||
|
||||
m_stateTable.remove(state.getPath());
|
||||
|
||||
// DEBUG
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Expired file state: " + state);
|
||||
|
||||
// Update the expired count
|
||||
|
||||
expiredCnt++;
|
||||
// Check with the state listener before removing the file state, if enabled
|
||||
|
||||
if ( hasStateListener() == false || m_stateListener.fileStateExpired( state) == true)
|
||||
{
|
||||
// Remove the expired file state
|
||||
|
||||
m_stateTable.remove(state.getPath());
|
||||
|
||||
// DEBUG
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Expired file state: " + state);
|
||||
|
||||
// Update the expired count
|
||||
|
||||
expiredCnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -381,4 +394,32 @@ public class FileStateTable
|
||||
logger.debug(" " + fname + "(" + state.getSecondsToExpire(curTime) + ") : " + state);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a file state listener
|
||||
*
|
||||
* @param l FileStateListener
|
||||
*/
|
||||
public final void addStateListener(FileStateListener l) {
|
||||
m_stateListener = l;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a file state listener
|
||||
*
|
||||
* @param l FileStateListener
|
||||
*/
|
||||
public final void removeStateListener(FileStateListener l) {
|
||||
if ( m_stateListener == l)
|
||||
m_stateListener = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the file state listener is set
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public final boolean hasStateListener() {
|
||||
return m_stateListener != null ? true : false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user