Class AbstractJobTerminationStateService
java.lang.Object
org.opencastproject.terminationstate.api.AbstractJobTerminationStateService
- All Implemented Interfaces:
TerminationStateService
public abstract class AbstractJobTerminationStateService
extends Object
implements TerminationStateService
AbstractJobTerminationStateService.
Abstract implementation of of TerminationStateService API which checks
whether there are any jobs running before changing the termination state from
WAIT to READY once a termination notification has been received.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opencastproject.terminationstate.api.TerminationStateService
TerminationStateService.TerminationState -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longCount the current number of jobs this node is processingprotected org.opencastproject.serviceregistry.api.ServiceRegistrygetState()protected booleanIf waiting and no jobs running change the state to readyvoidsetServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry service) OSGI dependency injection of service registryvoid
-
Constructor Details
-
AbstractJobTerminationStateService
public AbstractJobTerminationStateService()
-
-
Method Details
-
setState
- Specified by:
setStatein interfaceTerminationStateService
-
getState
- Specified by:
getStatein interfaceTerminationStateService
-
countJobs
protected long countJobs() throws org.opencastproject.serviceregistry.api.ServiceRegistryExceptionCount the current number of jobs this node is processing- Returns:
- number jobs
- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException
-
readyToTerminate
protected boolean readyToTerminate()If waiting and no jobs running change the state to ready- Returns:
- ready to terminate
-
setServiceRegistry
public void setServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry service) OSGI dependency injection of service registry- Parameters:
service- ServiceRegistry instance
-
getServiceRegistry
protected org.opencastproject.serviceregistry.api.ServiceRegistry getServiceRegistry()
-