Package org.nuxeo.ecm.core.work
Class StreamWorkManager
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.core.work.WorkManagerImpl
org.nuxeo.ecm.core.work.StreamWorkManager
- All Implemented Interfaces:
WorkManager,Adaptable,Component,Extensible,TimestampedService
WorkManager impl that appends works into a Log. Works are therefore immutable (no state update) and can not be listed
for performance reason.
- Since:
- 9.3
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.nuxeo.ecm.core.work.WorkManagerImpl
WorkManagerImpl.WorkCompletionSynchronizer, WorkManagerImpl.WorkThreadPoolExecutorNested classes/interfaces inherited from interface org.nuxeo.ecm.core.work.api.WorkManager
WorkManager.Scheduling -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final StringDeprecated.static final Stringprotected WorkQueueMetricsprotected longprotected LogManagerstatic final Stringprotected Settingsprotected longstatic final longstatic final Stringprotected booleanstatic final Stringprotected StreamManagerprotected StreamProcessorprotected Topologyprotected Topologystatic final Stringstatic final Stringstatic final StringFields inherited from class org.nuxeo.ecm.core.work.WorkManagerImpl
active, categoryToQueueId, completionSynchronizer, DEAD_LETTER_QUEUE, DEAD_LETTER_QUEUE_CODEC, DEFAULT_CATEGORY, DEFAULT_QUEUE_ID, executors, GLOBAL_METRIC_PREFIX, IMPL_EP, NAME, QUEUES_EP, queuing, registry, SHUTDOWN_DELAY_MS_KEY, shutdownInProgress, started, THREAD_PREFIX, WORKMANAGER_PROCESSING_DISABLE, WORKMANAGER_PROCESSING_ENABLEDFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidactivateQueueMetrics(String queueId) booleanawaitCompletion(String queueId, long duration, TimeUnit unit) Waits for completion of work in a given queue.protected booleanawaitCompletionOnQueue(String queueId, long duration, TimeUnit unit) protected voiddeactivateQueueMetrics(String queueId) intThe component notification order forComponent.start(ComponentContext).getCodec()protected Stringprotected StringDeprecated.protected LogManagerprotected longgetLowWaterMark(String queueId) getMetrics(String queueId) Gets the metrics for thequeueIdprotected WorkQueueMetricsgetMetricsWithNuxeoClassLoader(String queueId) protected intprotected intgetPartitions(int maxThreads) protected RecordFilterChainprotected Stringprotected StreamManagervoidinit()Starts up thisWorkManagerand attempts to resume work previously suspended and saved atWorkManager.shutdown(long, java.util.concurrent.TimeUnit)time.protected voidbooleanisProcessingEnabled(String queueId) Is processing enabled for a given queue id.voidschedule(Work work, WorkManager.Scheduling scheduling, boolean afterCommit) Schedules work for execution at a later time, with a specific scheduling policy.protected booleanscheduleAfterCommit(Work work, WorkManager.Scheduling scheduling) Schedule after commit.booleanShuts down thisWorkManagerand attempts to suspend and save the running and scheduled work instances.booleanshutdownQueue(String queueId, long timeout, TimeUnit unit) Shuts down a work queue and attempts to suspend and save the running and scheduled work instances.voidstart(ComponentContext context) Start the component.booleanMethods inherited from class org.nuxeo.ecm.core.work.WorkManagerImpl
awaitCompletion, enableProcessing, enableProcessing, getCategoryQueueId, getExecutor, getTimestampAfter, getWorkQueueDescriptor, getWorkQueueIds, getWorkState, hasWorkInState, index, initDeadLetterQueueStream, isProcessingDisabled, isProcessingEnabled, isQueuingEnabled, isStarted, noScheduledOrRunningWork, registerContribution, schedule, schedule, schedule, setName, shutdownExecutorsMethods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, stop, unregister, unregisterContribution, unregisterExtension
-
Field Details
-
WORK_LOG_CONFIG_PROP
- See Also:
-
DEFAULT_WORK_LOG_CONFIG
Deprecated.- See Also:
-
WORK_CODEC_PROP
- See Also:
-
DEFAULT_WORK_CODEC
- See Also:
-
WORK_OVER_PROVISIONING_PROP
- See Also:
-
DEFAULT_WORK_OVER_PROVISIONING
- See Also:
-
DEFAULT_CONCURRENCY
public static final int DEFAULT_CONCURRENCY- See Also:
-
lastMetrics
-
lastMetricTime
protected long lastMetricTime -
CACHE_LAST_METRIC_DURATION_MS
protected long CACHE_LAST_METRIC_DURATION_MS -
NAMESPACE_PREFIX
- See Also:
-
STATETTL_KEY
- Since:
- 10.2
- See Also:
-
STORESTATE_KEY
- Since:
- 10.2
- See Also:
-
STATETTL_DEFAULT_VALUE
public static final long STATETTL_DEFAULT_VALUE- Since:
- 10.2
- See Also:
-
COMPUTATION_FILTER_CLASS_KEY
- Since:
- 11.1
- See Also:
-
COMPUTATION_FILTER_STORE_KEY
- Since:
- 11.1
- See Also:
-
COMPUTATION_FILTER_STORE_TTL_KEY
- Since:
- 11.1
- See Also:
-
COMPUTATION_FILTER_THRESHOLD_SIZE_KEY
- Since:
- 11.1
- See Also:
-
COMPUTATION_FILTER_PREFIX_KEY
- Since:
- 11.1
- See Also:
-
topology
-
topologyDisabled
-
settings
-
streamProcessor
-
logManager
-
streamManager
-
storeState
protected boolean storeState -
stateTTL
protected long stateTTL
-
-
Constructor Details
-
StreamWorkManager
public StreamWorkManager()
-
-
Method Details
-
getOverProvisioningFactor
protected int getOverProvisioningFactor() -
getCodecName
-
getCodec
-
schedule
Description copied from interface:WorkManagerSchedules work for execution at a later time, with a specific scheduling policy.- Specified by:
schedulein interfaceWorkManager- Overrides:
schedulein classWorkManagerImpl- Parameters:
work- the work to executescheduling- the scheduling policyafterCommit- iftrueand the work is scheduled, it will only be run after the current transaction (if any) has committed- See Also:
-
getApplicationStartedOrder
public int getApplicationStartedOrder()Description copied from interface:ComponentThe component notification order forComponent.start(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.
- Specified by:
getApplicationStartedOrderin interfaceComponent- Overrides:
getApplicationStartedOrderin classWorkManagerImpl- Returns:
- the order, 1000 by default
-
start
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classWorkManagerImpl
-
getRecordFilter
-
getRecordFilterOptions
-
getRecordFilterClass
-
init
public void init()Description copied from interface:WorkManagerStarts up thisWorkManagerand attempts to resume work previously suspended and saved atWorkManager.shutdown(long, java.util.concurrent.TimeUnit)time.- Specified by:
initin interfaceWorkManager- Overrides:
initin classWorkManagerImpl
-
getLogManager
-
getStreamManager
-
getLogConfig
Deprecated. -
isProcessingEnabled
Description copied from interface:WorkManagerIs processing enabled for a given queue id.- Specified by:
isProcessingEnabledin interfaceWorkManager- Overrides:
isProcessingEnabledin classWorkManagerImpl
-
initTopology
protected void initTopology() -
getPartitions
protected int getPartitions(int maxThreads) -
activateQueueMetrics
-
deactivateQueueMetrics
-
shutdownQueue
Description copied from interface:WorkManagerShuts down a work queue and attempts to suspend and save the running and scheduled work instances.- Specified by:
shutdownQueuein interfaceWorkManager- Overrides:
shutdownQueuein classWorkManagerImpl- Parameters:
queueId- the queue idtimeout- the time to waitunit- the timeout unit- Returns:
trueif shutdown is done,falseif there are still some threads executing after the timeout
-
shutdown
Description copied from interface:WorkManagerShuts down thisWorkManagerand attempts to suspend and save the running and scheduled work instances.- Specified by:
shutdownin interfaceWorkManager- Overrides:
shutdownin classWorkManagerImpl- Parameters:
timeout- the time to waittimeUnit- the timeout unit- Returns:
trueif shutdown is done,falseif there are still some threads executing after the timeout
-
getMetricsWithNuxeoClassLoader
-
getMetrics
Description copied from interface:WorkManagerGets the metrics for thequeueId- Specified by:
getMetricsin interfaceWorkManager- Overrides:
getMetricsin classWorkManagerImpl
-
awaitCompletion
public boolean awaitCompletion(String queueId, long duration, TimeUnit unit) throws InterruptedException Description copied from interface:WorkManagerWaits for completion of work in a given queue.- Specified by:
awaitCompletionin interfaceWorkManager- Overrides:
awaitCompletionin classWorkManagerImpl- Parameters:
queueId- the queue idduration- the time to waitunit- the timeout unit- Returns:
trueif all work completed in the queue, orfalseif there is still some non-completed work after the timeout- Throws:
InterruptedException
-
awaitCompletionOnQueue
protected boolean awaitCompletionOnQueue(String queueId, long duration, TimeUnit unit) throws InterruptedException - Throws:
InterruptedException
-
getLowWaterMark
-
scheduleAfterCommit
Description copied from class:WorkManagerImplSchedule after commit. Returnsfalseif impossible (no transaction or transaction manager).- Overrides:
scheduleAfterCommitin classWorkManagerImpl
-
supportsProcessingDisabling
public boolean supportsProcessingDisabling()- Specified by:
supportsProcessingDisablingin interfaceWorkManager- Overrides:
supportsProcessingDisablingin classWorkManagerImpl- Returns:
- true if the implementation supports processing disabling
-