final class ServiceRegistrationImpl extends java.lang.Object implements Dependency
| Modifier and Type | Field and Description |
|---|---|
private ServiceContainerImpl |
container
The service container which contains this registration.
|
private int |
demandedByCount
The number of dependent instances which place a demand-to-start on this registration.
|
private IdentityHashSet<Dependent> |
dependents
The set of dependents on this registration.
|
private ServiceControllerImpl<?> |
instance
The current instance.
|
private ServiceName |
name
The name of this registration.
|
| Constructor and Description |
|---|
ServiceRegistrationImpl(ServiceContainerImpl container,
ServiceName name) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDemand()
Notify that a
dependent entered active mode. |
void |
addDependent(Dependent dependent)
Add a dependent to this controller.
|
(package private) void |
clearInstance(ServiceControllerImpl<?> oldInstance) |
void |
dependentStarted()
Notify that a
dependent is starting. |
void |
dependentStopped()
Notify that a
dependent is stopping. |
(package private) ServiceContainerImpl |
getContainer() |
ServiceControllerImpl<?> |
getDependencyController()
Get the controller for this dependency, or
null if there is none currently. |
(package private) IdentityHashSet<Dependent> |
getDependents()
Returns the dependents set.
|
(package private) ServiceControllerImpl<?> |
getInstance() |
ServiceName |
getName()
Get the name of this dependency.
|
java.lang.Object |
getValue()
Get the installed instance value, if any exists.
|
void |
removeDemand()
Notify that a
dependent left active mode. |
void |
removeDependent(Dependent dependent)
Remove a dependent from this controller.
|
(package private) void |
setInstance(ServiceControllerImpl<?> instance)
Set the instance.
|
private final ServiceContainerImpl container
private final ServiceName name
private final IdentityHashSet<Dependent> dependents
private ServiceControllerImpl<?> instance
private int demandedByCount
ServiceRegistrationImpl(ServiceContainerImpl container, ServiceName name)
IdentityHashSet<Dependent> getDependents()
public void addDependent(Dependent dependent)
addDependent in interface Dependencydependent - the dependent to addpublic void removeDependent(Dependent dependent)
removeDependent in interface Dependencydependent - the dependent to removevoid setInstance(ServiceControllerImpl<?> instance) throws DuplicateServiceException
instance - the new instanceDuplicateServiceException - if there is already an instancevoid clearInstance(ServiceControllerImpl<?> oldInstance)
ServiceContainerImpl getContainer()
public void dependentStopped()
Dependencydependent is stopping.
This method must not be called under a lock.dependentStopped in interface Dependencypublic java.lang.Object getValue()
throws java.lang.IllegalStateException
DependencygetValue in interface DependencygetValue in interface Value<java.lang.Object>java.lang.IllegalStateException - if an error occurspublic ServiceName getName()
DependencygetName in interface Dependencypublic ServiceControllerImpl<?> getDependencyController()
Dependencynull if there is none currently.getDependencyController in interface Dependencynull for nonepublic void dependentStarted()
Dependencydependent is starting.
This method must not be called under a lock.dependentStarted in interface Dependencypublic void addDemand()
Dependencydependent entered active mode.
This method must not be called under a lock.addDemand in interface Dependencypublic void removeDemand()
Dependencydependent left active mode.
This method must not be called under a lock.removeDemand in interface DependencyServiceControllerImpl<?> getInstance()