Package org.nuxeo.runtime.trackers.files
Class FileEventTracker
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.runtime.trackers.files.FileEventTracker
-
- All Implemented Interfaces:
Adaptable
,Component
,Extensible
,TimestampedService
public class FileEventTracker extends DefaultComponent
Files event tracker which delete files once the runtime leave the threads or at least once the associated marker object is garbaged. Note: for being backward compatible you may disable the thread events tracking by black-listing the default configuration component "org.nuxeo.runtime.trackers.files.threadstracking.config" in the runtime. This could be achieved by editing the "blacklist" file in your 'config' directory or using the @{link BlacklistComponent} annotation on your test class.- Since:
- 6.0
- Author:
- Stephane Lacoin at Nuxeo (aka matic)
- See Also:
ThreadEventHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileEventTracker.EnableThreadsTracking
protected static class
FileEventTracker.GCDelegate
protected class
FileEventTracker.ThreadDelegate
-
Field Summary
Fields Modifier and Type Field Description protected static org.nuxeo.runtime.trackers.files.FileEventTracker.SafeFileDeleteStrategy
deleteStrategy
protected FileEventListener
filesListener
protected FileEventTracker.GCDelegate
gc
protected static Log
log
protected ThreadLocal<FileEventTracker.ThreadDelegate>
threads
protected ThreadEventListener
threadsListener
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description FileEventTracker()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(ComponentContext context)
Activates the component.void
deactivate(ComponentContext context)
Deactivates the component.int
getApplicationStartedOrder()
The component notification order forComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext)
.protected FileEventHandler
onContext()
void
registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
static void
registerProtectedPath(String path)
Registers a protected path under which files should not be deletedprotected void
resetThreadDelegate()
protected void
setThreadDelegate(boolean isLongRunning)
void
start(ComponentContext context)
Start the component.-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, stop, unregister, unregisterContribution, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted
-
-
-
-
Field Detail
-
deleteStrategy
protected static org.nuxeo.runtime.trackers.files.FileEventTracker.SafeFileDeleteStrategy deleteStrategy
-
gc
protected final FileEventTracker.GCDelegate gc
-
threads
protected final ThreadLocal<FileEventTracker.ThreadDelegate> threads
-
threadsListener
protected final ThreadEventListener threadsListener
-
filesListener
protected final FileEventListener filesListener
-
-
Constructor Detail
-
FileEventTracker
public FileEventTracker()
-
-
Method Detail
-
registerProtectedPath
public static void registerProtectedPath(String path)
Registers a protected path under which files should not be deleted- Since:
- 7.2
-
activate
public void activate(ComponentContext context)
Description copied from interface:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
getApplicationStartedOrder
public int getApplicationStartedOrder()
Description copied from interface:Component
The component notification order forComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext)
.Components are notified in increasing order. Order 1000 is the default order for components that don't care. Order 100 is the repository initialization.
- Returns:
- the order, 1000 by default
-
start
public void start(ComponentContext context)
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
deactivate
public void deactivate(ComponentContext context)
Description copied from interface:Component
Deactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivate
in interfaceComponent
- Overrides:
deactivate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContribution
in classDefaultComponent
-
onContext
protected FileEventHandler onContext()
-
setThreadDelegate
protected void setThreadDelegate(boolean isLongRunning)
-
resetThreadDelegate
protected void resetThreadDelegate() throws IllegalStateException
- Throws:
IllegalStateException
-
-