Package org.exoplatform.container.jmx
Class MX4JComponentAdapter<T>
- java.lang.Object
-
- org.exoplatform.container.AbstractComponentAdapter<T>
-
- org.exoplatform.container.jmx.MX4JComponentAdapter<T>
-
- All Implemented Interfaces:
Serializable,javax.enterprise.context.spi.Contextual<T>,javax.enterprise.inject.spi.PassivationCapable,ComponentAdapter<T>,ComponentAdapter<T>
- Direct Known Subclasses:
ManageableComponentAdapter
public class MX4JComponentAdapter<T> extends AbstractComponentAdapter<T> implements javax.enterprise.context.spi.Contextual<T>, javax.enterprise.inject.spi.PassivationCapable
- Version:
- $Revision: 1.5 $
- Author:
- James Strachan, Mauro Talevi, Jeppe Cramon, Benjamin Mestrallet
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ExoContainerexocontainer.protected Tinstance_protected booleanisInitializedprotected booleanisSingletonIndicates whether or not it should be managed as a singletonprotected Locklockprotected AtomicReference<Class<? extends Annotation>>scopeThe scope of the adapter
-
Constructor Summary
Constructors Modifier Constructor Description MX4JComponentAdapter(ExoContainer holder, ConcurrentContainer container, Object key, Class<T> implementation)protectedMX4JComponentAdapter(ExoContainer holder, ConcurrentContainer container, Object key, Class<T> implementation, Lock lock)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Tcreate()Must be used to create Singleton or Prototype onlyTcreate(javax.enterprise.context.spi.CreationalContext<T> creationalContext)protected TcreateInstance(javax.enterprise.context.spi.Context ctx)voiddestroy(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)booleanequals(Object obj)TgetComponentInstance()Retrieve the component instance.StringgetId()Class<? extends Annotation>getScope()Gives the scope of the adapterprotected static MethodgetSetMethod(Class<?> clazz, String name, Class<?> pluginClass)Finds the best "set method" according to the given method name and type of plugininthashCode()booleanisSingleton()Indicates whether or not this adapter is a singletonprotected booleanmanageScope(boolean isSingleton, boolean isInitialized, boolean hasInjectableConstructor, boolean isInjectPresent)Defines the scope of the component-
Methods inherited from class org.exoplatform.container.AbstractComponentAdapter
checkTypeCompatibility, getComponentImplementation, getComponentKey, toString
-
-
-
-
Field Detail
-
instance_
protected transient volatile T instance_
-
lock
protected final transient Lock lock
-
isSingleton
protected volatile boolean isSingleton
Indicates whether or not it should be managed as a singleton
-
isInitialized
protected transient volatile boolean isInitialized
-
scope
protected final transient AtomicReference<Class<? extends Annotation>> scope
The scope of the adapter
-
exocontainer
protected final transient ExoContainer exocontainer
.
-
-
Constructor Detail
-
MX4JComponentAdapter
public MX4JComponentAdapter(ExoContainer holder, ConcurrentContainer container, Object key, Class<T> implementation)
-
MX4JComponentAdapter
protected MX4JComponentAdapter(ExoContainer holder, ConcurrentContainer container, Object key, Class<T> implementation, Lock lock)
-
-
Method Detail
-
getComponentInstance
public T getComponentInstance()
Description copied from interface:ComponentAdapterRetrieve the component instance. This method will usually create a new instance each time it is called, but that is not required.- Specified by:
getComponentInstancein interfaceComponentAdapter<T>- Returns:
- the component instance.
-
getScope
public Class<? extends Annotation> getScope()
Gives the scope of the adapter
-
createInstance
protected T createInstance(javax.enterprise.context.spi.Context ctx)
-
isSingleton
public boolean isSingleton()
Indicates whether or not this adapter is a singleton- Specified by:
isSingletonin interfaceComponentAdapter<T>
-
getSetMethod
protected static Method getSetMethod(Class<?> clazz, String name, Class<?> pluginClass)
Finds the best "set method" according to the given method name and type of plugin
-
create
protected T create()
Must be used to create Singleton or Prototype only
-
create
public T create(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
- Specified by:
createin interfacejavax.enterprise.context.spi.Contextual<T>
-
destroy
public void destroy(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
- Specified by:
destroyin interfacejavax.enterprise.context.spi.Contextual<T>
-
getId
public String getId()
- Specified by:
getIdin interfacejavax.enterprise.inject.spi.PassivationCapable
-
manageScope
protected boolean manageScope(boolean isSingleton, boolean isInitialized, boolean hasInjectableConstructor, boolean isInjectPresent)Defines the scope of the component- Returns:
trueif the component is considered as a singleton,falseotherwise.
-
-