Package ch.rswk.meta.engine
Class AbstractEngineWorkQueueService<C,T,R>
java.lang.Object
com.google.common.util.concurrent.AbstractExecutionThreadService
ch.rswk.meta.engine.AbstractEngineExecutionThreadService<C>
ch.rswk.meta.engine.AbstractEngineWorkQueueService<C,T,R>
- All Implemented Interfaces:
EngineServices.ConfigurableService<C>
,EngineServices.InfoProvidingService
,com.google.common.util.concurrent.Service
- Direct Known Subclasses:
LuceneService
public abstract class AbstractEngineWorkQueueService<C,T,R>
extends AbstractEngineExecutionThreadService<C>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
static enum
private static final record
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final int
private com.codahale.metrics.Meter
protected final long
private static final AbstractEngineWorkQueueService.WorkUnitWrapper
private com.codahale.metrics.Meter
private com.codahale.metrics.Timer
protected final String
protected final AbstractEngineWorkQueueService.ShutdownType
private static final Protocol.ErrorReplyFactory
private static final Protocol.ErrorReplyFactory
private static final Protocol.ErrorReplyFactory
private com.codahale.metrics.Timer
Fields inherited from class ch.rswk.meta.engine.AbstractEngineExecutionThreadService
runtime
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractEngineWorkQueueService
(int capacity, C config, long offerTimeout, EngineRuntime runtime, @Nullable String serviceId, AbstractEngineWorkQueueService.ShutdownType shutdownType) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
afterProcessWorkUnit
(T unit) protected void
beforeProcessWorkUnit
(T unit) protected int
protected int
protected com.google.common.util.concurrent.ListenableFuture
<R> offerWorkUnit
(T unit) protected abstract R
processWorkUnit
(T unit) protected void
run()
protected String
protected void
startUp()
protected void
Methods inherited from class ch.rswk.meta.engine.AbstractEngineExecutionThreadService
configClass, configReference, shutDown
Methods inherited from class com.google.common.util.concurrent.AbstractExecutionThreadService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, startAsync, state, stopAsync, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.rswk.meta.engine.EngineServices.ConfigurableService
config, onConfigChanged
Methods inherited from interface ch.rswk.meta.engine.EngineServices.InfoProvidingService
getServiceInfo
-
Field Details
-
POISON_UNIT
-
WORK_QUEUE_ERROR
-
WORK_QUEUE_FULL_ERROR
-
WORK_UNIT_ERROR
-
capacity
protected final int capacity -
offerTimeout
protected final long offerTimeout -
serviceId
-
shutdownType
-
workQueue
-
offerErrorMeter
private com.codahale.metrics.Meter offerErrorMeter -
processErrorMeter
private com.codahale.metrics.Meter processErrorMeter -
processTimer
private com.codahale.metrics.Timer processTimer -
workUnitTimer
private com.codahale.metrics.Timer workUnitTimer
-
-
Constructor Details
-
AbstractEngineWorkQueueService
public AbstractEngineWorkQueueService(int capacity, C config, long offerTimeout, EngineRuntime runtime, @Nullable String serviceId, AbstractEngineWorkQueueService.ShutdownType shutdownType)
-
-
Method Details
-
startUp
- Overrides:
startUp
in classAbstractEngineExecutionThreadService<C>
- Throws:
Exception
-
triggerShutdown
protected void triggerShutdown()- Overrides:
triggerShutdown
in classcom.google.common.util.concurrent.AbstractExecutionThreadService
-
offerWorkUnit
-
getRemainingCapacity
protected int getRemainingCapacity() -
getCapacityThreshold
protected int getCapacityThreshold() -
run
- Specified by:
run
in classcom.google.common.util.concurrent.AbstractExecutionThreadService
- Throws:
Exception
-
beforeProcessWorkUnit
-
processWorkUnit
- Throws:
ErrorReplyException
-
afterProcessWorkUnit
-
serviceName
- Overrides:
serviceName
in classAbstractEngineExecutionThreadService<C>
-