Class ServiceRegistrationInMemoryImpl
java.lang.Object
org.opencastproject.serviceregistry.api.ServiceRegistrationInMemoryImpl
- All Implemented Interfaces:
ServiceRegistration
Simple implementation of a service registration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringHost that is running the serviceprotected booleanTrue if this service is activeprotected booleanTrue if this service in in maintenance modeprotected booleanTrue if this service produces jobsprotected booleanTrue if this service is onlineprotected StringPath to the serviceprotected JobProducerThe service instanceprotected StringService type -
Constructor Summary
ConstructorsConstructorDescriptionServiceRegistrationInMemoryImpl(String type, String host, String path, boolean jobProducer) Creates a new service registration.ServiceRegistrationInMemoryImpl(JobProducer service, String host) Creates a new service registration. -
Method Summary
Modifier and TypeMethodDescriptionintGets the job signature which changed last time the service state to error.getHost()Gets the last time the service has been declared onlinegetPath()Returns the actual service instance.Gets the current state of the serviceGets the last date when state was changedintGets the job signature which changed last time the service state to warningbooleanisActive()booleanWhether the service is in maintenance mode.booleanbooleanisOnline()voidsetMaintenance(boolean maintenance) Sets the service's maintenance mode.toString()
-
Field Details
-
serviceType
Service type -
host
Host that is running the service -
path
Path to the service -
service
The service instance -
isJobProducer
protected boolean isJobProducerTrue if this service produces jobs -
isActive
protected boolean isActiveTrue if this service is active -
isOnline
protected boolean isOnlineTrue if this service is online -
isInMaintenanceMode
protected boolean isInMaintenanceModeTrue if this service in in maintenance mode
-
-
Constructor Details
-
ServiceRegistrationInMemoryImpl
Creates a new service registration. The service is initially online and not in maintenance mode.- Parameters:
type- the service typehost- the service hostpath- the path to the servicejobProducer-trueif the service is a job producer
-
ServiceRegistrationInMemoryImpl
Creates a new service registration. The service is initially online and not in maintenance mode.- Parameters:
service- the local service instancehost- the host that the service is running on
-
-
Method Details
-
getServiceType
- Specified by:
getServiceTypein interfaceServiceRegistration- Returns:
- the type of service
- See Also:
-
getHost
- Specified by:
getHostin interfaceServiceRegistration- Returns:
- the host providing the service endpoint.
- See Also:
-
getPath
- Specified by:
getPathin interfaceServiceRegistration- Returns:
- The relative path to the service endpoint.
- See Also:
-
isJobProducer
public boolean isJobProducer()- Specified by:
isJobProducerin interfaceServiceRegistration- Returns:
- Whether the service performs long running operations using Jobs.
- See Also:
-
isActive
public boolean isActive()- Specified by:
isActivein interfaceServiceRegistration- Returns:
- Whether the service is active
- See Also:
-
isOnline
public boolean isOnline()- Specified by:
isOnlinein interfaceServiceRegistration- Returns:
- Whether the service is online
- See Also:
-
isInMaintenanceMode
public boolean isInMaintenanceMode()Whether the service is in maintenance mode. If a server was in maintenance mode when shut down, it will remain in maintenance mode when it comes back online- Specified by:
isInMaintenanceModein interfaceServiceRegistration- See Also:
-
setMaintenance
public void setMaintenance(boolean maintenance) Sets the service's maintenance mode.- Parameters:
maintenance-trueif the service is in maintenance mode
-
getService
Returns the actual service instance.- Returns:
- the service
-
getOnlineFrom
Gets the last time the service has been declared online- Specified by:
getOnlineFromin interfaceServiceRegistration- Returns:
- the onlineFrom
- See Also:
-
getServiceState
Description copied from interface:ServiceRegistrationGets the current state of the service- Specified by:
getServiceStatein interfaceServiceRegistration- Returns:
- current state
-
getStateChanged
Description copied from interface:ServiceRegistrationGets the last date when state was changed- Specified by:
getStateChangedin interfaceServiceRegistration- Returns:
- last date when state was changed
-
getErrorStateTrigger
public int getErrorStateTrigger()Description copied from interface:ServiceRegistrationGets the job signature which changed last time the service state to error.- Specified by:
getErrorStateTriggerin interfaceServiceRegistration- Returns:
- the signature from error state trigger job
-
getWarningStateTrigger
public int getWarningStateTrigger()Description copied from interface:ServiceRegistrationGets the job signature which changed last time the service state to warning- Specified by:
getWarningStateTriggerin interfaceServiceRegistration- Returns:
- the signature from warning state trigger job
-
toString
-