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 ServiceContainerImplcontainerThe service container which contains this registration.private intdemandedByCountThe number of dependent instances which place a demand-to-start on this registration.private IdentityHashSet<Dependent>dependentsThe set of dependents on this registration.private ServiceControllerImpl<?>instanceThe current instance.private ServiceNamenameThe 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 voidaddDemand()Notify that adependententeredactive mode.voidaddDependent(Dependent dependent)Add a dependent to this controller.(package private) voidclearInstance(ServiceControllerImpl<?> oldInstance)voiddependentStarted()Notify that adependentis starting.voiddependentStopped()Notify that adependentis stopping.(package private) ServiceContainerImplgetContainer()ServiceControllerImpl<?>getDependencyController()Get the controller for this dependency, ornullif there is none currently.(package private) IdentityHashSet<Dependent>getDependents()Returns the dependents set.(package private) ServiceControllerImpl<?>getInstance()ServiceNamegetName()Get the name of this dependency.java.lang.ObjectgetValue()Get the installed instance value, if any exists.voidremoveDemand()Notify that adependentleftactive mode.voidremoveDependent(Dependent dependent)Remove a dependent from this controller.(package private) voidsetInstance(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:
addDependentin interfaceDependency- Parameters:
dependent- the dependent to add
-
removeDependent
public void removeDependent(Dependent dependent)
Remove a dependent from this controller.- Specified by:
removeDependentin 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:DependencyNotify that adependentis stopping. This method must not be called under a lock.- Specified by:
dependentStoppedin interfaceDependency
-
getValue
public java.lang.Object getValue() throws java.lang.IllegalStateExceptionDescription copied from interface:DependencyGet the installed instance value, if any exists.- Specified by:
getValuein interfaceDependency- Specified by:
getValuein 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:DependencyGet the name of this dependency.- Specified by:
getNamein interfaceDependency- Returns:
- the name
-
getDependencyController
public ServiceControllerImpl<?> getDependencyController()
Description copied from interface:DependencyGet the controller for this dependency, ornullif there is none currently.- Specified by:
getDependencyControllerin interfaceDependency- Returns:
- the controller, or
nullfor none
-
dependentStarted
public void dependentStarted()
Description copied from interface:DependencyNotify that adependentis starting. This method must not be called under a lock.- Specified by:
dependentStartedin interfaceDependency
-
addDemand
public void addDemand()
Description copied from interface:DependencyNotify that adependententeredactive mode. This method must not be called under a lock.- Specified by:
addDemandin interfaceDependency
-
removeDemand
public void removeDemand()
Description copied from interface:DependencyNotify that adependentleftactive mode. This method must not be called under a lock.- Specified by:
removeDemandin interfaceDependency
-
getInstance
ServiceControllerImpl<?> getInstance()
-
-