Package org.infinispan.factories
Class ComponentRegistry
- java.lang.Object
-
- org.infinispan.factories.AbstractComponentRegistry
-
- org.infinispan.factories.ComponentRegistry
-
- All Implemented Interfaces:
Cloneable
,org.infinispan.commons.api.Lifecycle
public class ComponentRegistry extends AbstractComponentRegistry
Named cache specific components- Since:
- 4.0
- Author:
- Manik Surtani
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.infinispan.factories.AbstractComponentRegistry
AbstractComponentRegistry.Component
-
-
Field Summary
Fields Modifier and Type Field Description protected WeakReference<ClassLoader>
defaultClassLoader
-
Fields inherited from class org.infinispan.factories.AbstractComponentRegistry
DEBUG_DEPENDENCIES, state
-
-
Constructor Summary
Constructors Constructor Description ComponentRegistry(String cacheName, Configuration configuration, AdvancedCache<?,?> cache, GlobalComponentRegistry globalComponents, ClassLoader defaultClassLoader)
Creates an instance of the component registry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
bootstrapComponents()
Invoked afterBootstrapFactory
is registered but before anyModuleCommandInitializer
.void
cacheComponents()
Invoked last after all services are wiredprotected AbstractComponentFactory
createComponentFactoryInternal(Class<?> componentClass, String cfClass)
org.infinispan.commons.marshall.StreamingMarshaller
getCacheMarshaller()
Caching shortcut for #getComponent(StreamingMarshaller.class, KnownComponentNames.CACHE_MARSHALLER);String
getCacheName()
protected ClassLoader
getClassLoader()
CommandsFactory
getCommandsFactory()
Caching shortcut for #getLocalComponent(CommandsFactory.class);<T> T
getComponent(String componentTypeName, String name, boolean nameIsFQCN)
ComponentMetadataRepo
getComponentMetadataRepo()
DistributionManager
getDistributionManager()
Caching shortcut for #getComponent(DistributionManager.class);protected AbstractComponentFactory
getFactory(Class<?> componentClass)
Retrieves a component factory instance capable of constructing components of a specified type.GlobalComponentRegistry
getGlobalComponentRegistry()
<T> T
getLocalComponent(Class<T> componentType)
<T> T
getLocalComponent(String componentTypeName, String name, boolean nameIsFQCN)
protected Log
getLog()
protected <T> T
getOrCreateComponent(Class<T> componentClass, String name, boolean nameIsFQCN)
PerCacheInboundInvocationHandler
getPerCacheInboundInvocationHandler()
Caching shortcut for #getComponent(PerCacheInboundInvocationHandler.class);ResponseGenerator
getResponseGenerator()
Caching shortcut for #getComponent(ResponseGenerator.class);StateTransferLock
getStateTransferLock()
Caching shortcut for #getComponent(StateTransferManager.class);StateTransferManager
getStateTransferManager()
Caching shortcut for #getComponent(StateTransferManager.class);TimeService
getTimeService()
TransactionTable
getTransactionTable()
VersionGenerator
getVersionGenerator()
Caching shortcut for #getLocalComponent(VersionGenerator.class)protected AbstractComponentRegistry.Component
lookupComponent(String componentClassName, String name, boolean nameIsFQCN)
protected AbstractComponentRegistry.Component
lookupLocalComponent(String componentClassName, String name, boolean nameIsFQCN)
protected void
registerComponentInternal(Object component, String name, boolean nameIsFQCN)
void
registerVersionGenerator(NumericVersionGenerator newVersionGenerator)
void
start()
This starts the components in the registry, connecting to channels, starting service threads, etc.void
stop()
Stops the component and sets its status toComponentStatus.TERMINATED
once it is done.-
Methods inherited from class org.infinispan.factories.AbstractComponentRegistry
addShutdownHook, clone, getComponent, getComponent, getComponent, getComponent, getConfiguration, getOptionalComponent, getOrCreateComponent, getOrCreateComponent, getRegisteredComponents, getStatus, invocationsAllowed, postStart, registerComponent, registerComponent, registerComponent, registerDefaultClassLoader, registerNonVolatileComponent, registerNonVolatileComponent, registerNullComponent, removeShutdownHook, resetVolatileComponents, rewire, throwStackAwareConfigurationException, wireDependencies
-
-
-
-
Field Detail
-
defaultClassLoader
protected final WeakReference<ClassLoader> defaultClassLoader
-
-
Constructor Detail
-
ComponentRegistry
public ComponentRegistry(String cacheName, Configuration configuration, AdvancedCache<?,?> cache, GlobalComponentRegistry globalComponents, ClassLoader defaultClassLoader)
Creates an instance of the component registry. The configuration passed in is automatically registered.- Parameters:
configuration
- configuration with which this is createdcache
- cacheglobalComponents
- Shared Component Registry to delegate to
-
-
Method Detail
-
getClassLoader
protected ClassLoader getClassLoader()
- Specified by:
getClassLoader
in classAbstractComponentRegistry
-
getLog
protected Log getLog()
- Specified by:
getLog
in classAbstractComponentRegistry
-
getComponent
public final <T> T getComponent(String componentTypeName, String name, boolean nameIsFQCN)
- Overrides:
getComponent
in classAbstractComponentRegistry
-
getLocalComponent
public final <T> T getLocalComponent(String componentTypeName, String name, boolean nameIsFQCN)
-
getLocalComponent
public final <T> T getLocalComponent(Class<T> componentType)
-
lookupComponent
protected final AbstractComponentRegistry.Component lookupComponent(String componentClassName, String name, boolean nameIsFQCN)
- Overrides:
lookupComponent
in classAbstractComponentRegistry
-
lookupLocalComponent
protected final AbstractComponentRegistry.Component lookupLocalComponent(String componentClassName, String name, boolean nameIsFQCN)
-
getGlobalComponentRegistry
public final GlobalComponentRegistry getGlobalComponentRegistry()
-
getOrCreateComponent
protected final <T> T getOrCreateComponent(Class<T> componentClass, String name, boolean nameIsFQCN)
- Overrides:
getOrCreateComponent
in classAbstractComponentRegistry
-
getFactory
protected AbstractComponentFactory getFactory(Class<?> componentClass)
Description copied from class:AbstractComponentRegistry
Retrieves a component factory instance capable of constructing components of a specified type. If the factory doesn't exist in the registry, one is created.- Overrides:
getFactory
in classAbstractComponentRegistry
- Parameters:
componentClass
- type of component to construct- Returns:
- component factory capable of constructing such components
-
registerComponentInternal
protected final void registerComponentInternal(Object component, String name, boolean nameIsFQCN)
- Overrides:
registerComponentInternal
in classAbstractComponentRegistry
-
createComponentFactoryInternal
protected AbstractComponentFactory createComponentFactoryInternal(Class<?> componentClass, String cfClass)
- Overrides:
createComponentFactoryInternal
in classAbstractComponentRegistry
-
start
public void start()
Description copied from class:AbstractComponentRegistry
This starts the components in the registry, connecting to channels, starting service threads, etc. If the component is not in theComponentStatus.INITIALIZING
state, it will be initialized first.- Specified by:
start
in interfaceorg.infinispan.commons.api.Lifecycle
- Overrides:
start
in classAbstractComponentRegistry
-
stop
public void stop()
Description copied from class:AbstractComponentRegistry
Stops the component and sets its status toComponentStatus.TERMINATED
once it is done. If the component is not in theComponentStatus.RUNNING
state, this is a no-op.- Specified by:
stop
in interfaceorg.infinispan.commons.api.Lifecycle
- Overrides:
stop
in classAbstractComponentRegistry
-
getTimeService
public TimeService getTimeService()
- Specified by:
getTimeService
in classAbstractComponentRegistry
-
getCacheName
public String getCacheName()
-
getCacheMarshaller
public org.infinispan.commons.marshall.StreamingMarshaller getCacheMarshaller()
Caching shortcut for #getComponent(StreamingMarshaller.class, KnownComponentNames.CACHE_MARSHALLER);
-
getStateTransferManager
public StateTransferManager getStateTransferManager()
Caching shortcut for #getComponent(StateTransferManager.class);
-
getDistributionManager
public DistributionManager getDistributionManager()
Caching shortcut for #getComponent(DistributionManager.class);
-
getResponseGenerator
public ResponseGenerator getResponseGenerator()
Caching shortcut for #getComponent(ResponseGenerator.class);
-
getCommandsFactory
public CommandsFactory getCommandsFactory()
Caching shortcut for #getLocalComponent(CommandsFactory.class);
-
getStateTransferLock
public StateTransferLock getStateTransferLock()
Caching shortcut for #getComponent(StateTransferManager.class);
-
getVersionGenerator
public VersionGenerator getVersionGenerator()
Caching shortcut for #getLocalComponent(VersionGenerator.class)
-
getPerCacheInboundInvocationHandler
public PerCacheInboundInvocationHandler getPerCacheInboundInvocationHandler()
Caching shortcut for #getComponent(PerCacheInboundInvocationHandler.class);
-
bootstrapComponents
protected void bootstrapComponents()
Invoked afterBootstrapFactory
is registered but before anyModuleCommandInitializer
. This is a good place to register components that don't have any dependency.
-
cacheComponents
public void cacheComponents()
Invoked last after all services are wired
-
getComponentMetadataRepo
public ComponentMetadataRepo getComponentMetadataRepo()
- Specified by:
getComponentMetadataRepo
in classAbstractComponentRegistry
-
getTransactionTable
public final TransactionTable getTransactionTable()
-
registerVersionGenerator
public final void registerVersionGenerator(NumericVersionGenerator newVersionGenerator)
-
-