eXo Kernel :: Container Multi-Threaded 2.5.0-CR2

org.exoplatform.container
Class ConcurrentContainerMT

java.lang.Object
  extended by org.exoplatform.container.AbstractContainer
      extended by org.exoplatform.container.AbstractInterceptor
          extended by org.exoplatform.container.ConcurrentContainer
              extended by org.exoplatform.container.ConcurrentContainerMT
All Implemented Interfaces:
Serializable, Container, Interceptor, Disposable, Startable

public class ConcurrentContainerMT
extends ConcurrentContainer

Version:
$Id$
Author:
Nicolas Filotto
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.exoplatform.container.ConcurrentContainer
ConcurrentContainer.CreationalContextComponentAdapter<T>
 
Field Summary
static String THREAD_POOL_SIZE_PARAM_NAME
          The name of the system parameter to indicate the total amount of threads to use for the kernel
 
Fields inherited from class org.exoplatform.container.ConcurrentContainer
children, componentAdapters, componentKeyToAdapterCache, orderedComponentAdapters
 
Fields inherited from class org.exoplatform.container.AbstractInterceptor
holder, parent
 
Fields inherited from class org.exoplatform.container.AbstractContainer
delegate
 
Constructor Summary
ConcurrentContainerMT()
          Creates a new container with the default ComponentAdapterFactory and a parent container.
ConcurrentContainerMT(ExoContainer holder, ExoContainer parent)
          Creates a new container with the default ComponentAdapterFactory and a parent container.
 
Method Summary
<T> ConcurrentContainer.CreationalContextComponentAdapter<T>
addComponentToCtx(Object key)
          
<T> T
createComponent(Class<T> clazz)
           
<T> T
createComponent(Class<T> clazz, InitParams params)
           
<T> ComponentTask<T>
createComponentTask(Constructor<T> constructor, InitParams params, List<Dependency> dependencies, DependencyStackListener caller)
           
protected
<T> T
execute(ComponentTask<T> task, ConcurrentContainer.CreationalContextComponentAdapter<?> cCtx)
           
<T> Object[]
getArguments(Constructor<T> constructor, InitParams params, List<Dependency> dependencies)
           
<T> T
getComponentFromSharedMemory(Object key)
          Gives a value from the shared memory
protected
<T> T
getComponentInstanceFromContext(ComponentAdapter<T> componentAdapter, Class<T> bindType)
          
<T> List<T>
getComponentInstancesOfType(Class<T> componentType)
          A multi-threaded implementation of the start method
 ComponentTaskContext getComponentTaskContext()
          Gives the current context
<T> Constructor<T>
getConstructor(Class<T> clazz, List<Dependency> dependencies)
           
protected  ComponentAdapterFactory getDefaultComponentAdapterFactory()
           
 String getId()
          
 void initialize()
          
<T> boolean
initializeComponent(Class<T> targetClass, List<Dependency> dependencies, List<ComponentTask<Void>> componentInitTasks, DependencyStackListener caller)
          Initializes the instance by injecting objects into fields and the methods with the annotation Inject
 void loadArguments(Object[] args)
           
 void loadDependencies(Object originalComponentKey, ComponentTaskContext ctx, Collection<Dependency> dependencies, ComponentTaskType type)
           
 void onStartupComplete()
          
 void removeComponentFromCtx(Object key)
          
 void setComponentTaskContext(ComponentTaskContext ctx)
          Set the current context
 void start()
          A multi-threaded implementation of the start method
protected  void start(Collection<ComponentAdapter<?>> adapters, Map<ComponentAdapter<?>,Object> alreadyStarted, Set<ComponentAdapter<?>> startInProgress, AtomicReference<Exception> error, boolean skippable)
          Starts all the provided adapters
 
Methods inherited from class org.exoplatform.container.ConcurrentContainer
accept, addMethods, addOrderedComponentAdapter, dispose, getCache, getComponentAdapter, getComponentAdapterOfType, getComponentAdapters, getComponentAdaptersOfType, getComponentInstance, getComponentInstanceOfType, getComponentInstances, getHolder, getInstance, getManagementContext, getMBeanServer, getScopingObjectName, initializeComponent, registerComponent, registerComponentImplementation, registerComponentInstance, setHolder, stop, unregisterComponent
 
Methods inherited from class org.exoplatform.container.AbstractInterceptor
setParent, setSuccessor
 
Methods inherited from class org.exoplatform.container.AbstractContainer
getSuccessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.exoplatform.container.spi.Container
getSuccessor
 

Field Detail

THREAD_POOL_SIZE_PARAM_NAME

public static final String THREAD_POOL_SIZE_PARAM_NAME
The name of the system parameter to indicate the total amount of threads to use for the kernel

See Also:
Constant Field Values
Constructor Detail

ConcurrentContainerMT

public ConcurrentContainerMT()
Creates a new container with the default ComponentAdapterFactory and a parent container.


ConcurrentContainerMT

public ConcurrentContainerMT(ExoContainer holder,
                             ExoContainer parent)
Creates a new container with the default ComponentAdapterFactory and a parent container.

Parameters:
holder - the holder of the container
parent - the parent container (used for component dependency lookups).
Method Detail

initialize

public void initialize()

Specified by:
initialize in interface Container
Overrides:
initialize in class ConcurrentContainer

getDefaultComponentAdapterFactory

protected ComponentAdapterFactory getDefaultComponentAdapterFactory()
Overrides:
getDefaultComponentAdapterFactory in class ConcurrentContainer

getComponentInstanceFromContext

protected <T> T getComponentInstanceFromContext(ComponentAdapter<T> componentAdapter,
                                                Class<T> bindType)

Overrides:
getComponentInstanceFromContext in class ConcurrentContainer

getComponentFromSharedMemory

public <T> T getComponentFromSharedMemory(Object key)
Gives a value from the shared memory


addComponentToCtx

public <T> ConcurrentContainer.CreationalContextComponentAdapter<T> addComponentToCtx(Object key)

Overrides:
addComponentToCtx in class ConcurrentContainer

removeComponentFromCtx

public void removeComponentFromCtx(Object key)

Overrides:
removeComponentFromCtx in class ConcurrentContainer

getComponentInstancesOfType

public <T> List<T> getComponentInstancesOfType(Class<T> componentType)
                                    throws ContainerException
A multi-threaded implementation of the start method

Specified by:
getComponentInstancesOfType in interface Container
Overrides:
getComponentInstancesOfType in class ConcurrentContainer
Throws:
ContainerException

start

public void start()
A multi-threaded implementation of the start method

Specified by:
start in interface Startable
Overrides:
start in class ConcurrentContainer

start

protected void start(Collection<ComponentAdapter<?>> adapters,
                     Map<ComponentAdapter<?>,Object> alreadyStarted,
                     Set<ComponentAdapter<?>> startInProgress,
                     AtomicReference<Exception> error,
                     boolean skippable)
Starts all the provided adapters


getConstructor

public <T> Constructor<T> getConstructor(Class<T> clazz,
                                         List<Dependency> dependencies)
                              throws Exception
Throws:
Exception

initializeComponent

public <T> boolean initializeComponent(Class<T> targetClass,
                                       List<Dependency> dependencies,
                                       List<ComponentTask<Void>> componentInitTasks,
                                       DependencyStackListener caller)
Initializes the instance by injecting objects into fields and the methods with the annotation Inject

Returns:
true if at least Inject annotation has been found, false otherwise

createComponent

public <T> T createComponent(Class<T> clazz)
                  throws Exception
Overrides:
createComponent in class ConcurrentContainer
Throws:
Exception

createComponent

public <T> T createComponent(Class<T> clazz,
                             InitParams params)
                  throws Exception
Specified by:
createComponent in interface Container
Overrides:
createComponent in class ConcurrentContainer
Throws:
Exception

createComponentTask

public <T> ComponentTask<T> createComponentTask(Constructor<T> constructor,
                                                InitParams params,
                                                List<Dependency> dependencies,
                                                DependencyStackListener caller)
                                     throws Exception
Throws:
Exception

loadArguments

public void loadArguments(Object[] args)

loadDependencies

public void loadDependencies(Object originalComponentKey,
                             ComponentTaskContext ctx,
                             Collection<Dependency> dependencies,
                             ComponentTaskType type)
                      throws Exception
Throws:
Exception

getComponentTaskContext

public ComponentTaskContext getComponentTaskContext()
Gives the current context


setComponentTaskContext

public void setComponentTaskContext(ComponentTaskContext ctx)
Set the current context


execute

protected <T> T execute(ComponentTask<T> task,
                        ConcurrentContainer.CreationalContextComponentAdapter<?> cCtx)
             throws Exception
Throws:
Exception

getArguments

public <T> Object[] getArguments(Constructor<T> constructor,
                                 InitParams params,
                                 List<Dependency> dependencies)

getId

public String getId()

Specified by:
getId in interface Interceptor
Overrides:
getId in class AbstractInterceptor

onStartupComplete

public void onStartupComplete()


eXo Kernel :: Container Multi-Threaded 2.5.0-CR2

Copyright © 2014 eXo Platform SAS. All Rights Reserved.