public abstract class Service extends Component
Modifier | Constructor and Description |
---|---|
protected |
Service(String name)
Constructs a service with a given name.
|
Modifier and Type | Method and Description |
---|---|
void |
addDependency(Service service)
Adds a service this service depends on.
|
protected void |
available(boolean value)
Called when this service becomes available (it is ready and all its dependencies are available) or unavailable.
|
void |
awaitAvailable()
Availability changes between calls to this method are the responsibility of the user code, which must be able to handle a short interruption (e.g.
|
List<String> |
getDependedBy() |
String |
getDependencyGraph() |
List<String> |
getDependsOn() |
protected void |
init()
Called after bean properties have been set.
|
boolean |
isAvailable() |
boolean |
isReady() |
protected void |
postInit()
Called after bean properties have been set, and init() called.
|
protected void |
removeDependency(Service service)
Removes a dependency.
|
protected void |
setReady(boolean ready)
Sets the readiness of this service.
|
afterPropertiesSet, assertDuringInitialization, assertInitialized, destroy, getName, getType, isInitialized, shutdown, toString
protected Service(String name)
name
- The service's name.public void addDependency(Service service)
service
- The service this service depends on.protected void removeDependency(Service service)
init()
method.service
- @ManagedAttribute(currencyTimeLimit=0, description="Services that depend on this service") public List<String> getDependedBy()
@ManagedAttribute(currencyTimeLimit=0, description="Services this service depends on") public List<String> getDependsOn()
protected void init() throws Exception
Component
super.init()
before doing anything else in the method.protected void postInit() throws Exception
Component
super.postInit()
after doing anything else in the method.protected void available(boolean value)
value
- true
if this service is now available; false
otherwise.protected void setReady(boolean ready)
ready
- public void awaitAvailable() throws InterruptedException
InterruptedException
@ManagedAttribute(currencyTimeLimit=0) public boolean isReady()
@ManagedAttribute(currencyTimeLimit=0) public boolean isAvailable()
@ManagedAttribute public String getDependencyGraph()