Package org.jboss.msc.service
Class ServiceRegistrationImpl
- java.lang.Object
-
- org.jboss.msc.service.ServiceRegistrationImpl
-
- All Implemented Interfaces:
Dependency
,Value<java.lang.Object>
final class ServiceRegistrationImpl extends java.lang.Object implements Dependency
A single service registration.
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description ServiceRegistrationImpl(ServiceContainerImpl container, ServiceName name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDemand()
Notify that adependent
enteredactive mode
.void
addDependent(Dependent dependent)
Add a dependent to this controller.(package private) void
clearInstance(ServiceControllerImpl<?> oldInstance)
void
dependentStarted()
Notify that adependent
is starting.void
dependentStopped()
Notify that adependent
is stopping.(package private) ServiceContainerImpl
getContainer()
ServiceControllerImpl<?>
getDependencyController()
Get the controller for this dependency, ornull
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 adependent
leftactive mode
.void
removeDependent(Dependent dependent)
Remove a dependent from this controller.(package private) void
setInstance(ServiceControllerImpl<?> instance)
Set the instance.
-
-
-
Field Detail
-
container
private final ServiceContainerImpl container
The service container which contains this registration.
-
name
private final ServiceName name
The name of this registration.
-
dependents
private final IdentityHashSet<Dependent> dependents
The set of dependents on this registration.
-
instance
private ServiceControllerImpl<?> instance
The current instance.
-
demandedByCount
private int demandedByCount
The number of dependent instances which place a demand-to-start on this registration. If this value is >0, propagate a demand to the instance, if any.
-
-
Constructor Detail
-
ServiceRegistrationImpl
ServiceRegistrationImpl(ServiceContainerImpl container, ServiceName name)
-
-
Method Detail
-
getDependents
IdentityHashSet<Dependent> getDependents()
Returns the dependents set.- Returns:
- the dependents set
-
addDependent
public void addDependent(Dependent dependent)
Add a dependent to this controller.- Specified by:
addDependent
in interfaceDependency
- Parameters:
dependent
- the dependent to add
-
removeDependent
public void removeDependent(Dependent dependent)
Remove a dependent from this controller.- Specified by:
removeDependent
in interfaceDependency
- Parameters:
dependent
- the dependent to remove
-
setInstance
void setInstance(ServiceControllerImpl<?> instance) throws DuplicateServiceException
Set the instance.- Parameters:
instance
- the new instance- Throws:
DuplicateServiceException
- if there is already an instance
-
clearInstance
void clearInstance(ServiceControllerImpl<?> oldInstance)
-
getContainer
ServiceContainerImpl getContainer()
-
dependentStopped
public void dependentStopped()
Description copied from interface:Dependency
Notify that adependent
is stopping. This method must not be called under a lock.- Specified by:
dependentStopped
in interfaceDependency
-
getValue
public java.lang.Object getValue() throws java.lang.IllegalStateException
Description copied from interface:Dependency
Get the installed instance value, if any exists.- Specified by:
getValue
in interfaceDependency
- Specified by:
getValue
in interfaceValue<java.lang.Object>
- Returns:
- the installed service value
- Throws:
java.lang.IllegalStateException
- if an error occurs
-
getName
public ServiceName getName()
Description copied from interface:Dependency
Get the name of this dependency.- Specified by:
getName
in interfaceDependency
- Returns:
- the name
-
getDependencyController
public ServiceControllerImpl<?> getDependencyController()
Description copied from interface:Dependency
Get the controller for this dependency, ornull
if there is none currently.- Specified by:
getDependencyController
in interfaceDependency
- Returns:
- the controller, or
null
for none
-
dependentStarted
public void dependentStarted()
Description copied from interface:Dependency
Notify that adependent
is starting. This method must not be called under a lock.- Specified by:
dependentStarted
in interfaceDependency
-
addDemand
public void addDemand()
Description copied from interface:Dependency
Notify that adependent
enteredactive mode
. This method must not be called under a lock.- Specified by:
addDemand
in interfaceDependency
-
removeDemand
public void removeDemand()
Description copied from interface:Dependency
Notify that adependent
leftactive mode
. This method must not be called under a lock.- Specified by:
removeDemand
in interfaceDependency
-
getInstance
ServiceControllerImpl<?> getInstance()
-
-