injectSingletonSessionBeans() публичный Метод

Injects the storage for the singleton session beans.
public injectSingletonSessionBeans ( AppserverIo\Storage\StorageInterface $singletonSessionBeans ) : void
$singletonSessionBeans AppserverIo\Storage\StorageInterface The storage for the singleton session beans
Результат void
Пример #1
0
 /**
  * The main method that creates new instances in a separate context.
  *
  * @param \AppserverIo\Psr\Application\ApplicationInterface         $application          The application instance to register the class loader with
  * @param \AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface $managerConfiguration The manager configuration
  *
  * @return void
  */
 public static function visit(ApplicationInterface $application, ManagerNodeInterface $managerConfiguration)
 {
     // load the registered loggers
     $loggers = $application->getInitialContext()->getLoggers();
     // initialize the bean locator
     $beanLocator = new BeanLocator();
     // create the initial context instance
     $initialContext = new NamingContext();
     $initialContext->injectApplication($application);
     // initialize the stackable for the data, the stateful + singleton session beans and the naming directory
     $data = new StackableStorage();
     $instances = new GenericStackable();
     $singletonSessionBeans = new StackableStorage();
     $statefulSessionBeans = new StatefulSessionBeanMap();
     // initialize the default settings for the stateful session beans
     $statefulSessionBeanSettings = new DefaultStatefulSessionBeanSettings();
     $statefulSessionBeanSettings->mergeWithParams($managerConfiguration->getParamsAsArray());
     // create an instance of the object factory
     $objectFactory = new GenericObjectFactory();
     $objectFactory->injectInstances($instances);
     $objectFactory->injectApplication($application);
     $objectFactory->start();
     // add a garbage collector and timer service workers for each application
     $garbageCollector = new StandardGarbageCollector();
     $garbageCollector->injectApplication($application);
     $garbageCollector->start();
     // initialize the bean manager
     $beanManager = new BeanManager();
     $beanManager->injectData($data);
     $beanManager->injectApplication($application);
     $beanManager->injectResourceLocator($beanLocator);
     $beanManager->injectObjectFactory($objectFactory);
     $beanManager->injectInitialContext($initialContext);
     $beanManager->injectGarbageCollector($garbageCollector);
     $beanManager->injectStatefulSessionBeans($statefulSessionBeans);
     $beanManager->injectSingletonSessionBeans($singletonSessionBeans);
     $beanManager->injectDirectories($managerConfiguration->getDirectories());
     $beanManager->injectStatefulSessionBeanSettings($statefulSessionBeanSettings);
     // attach the instance
     $application->addManager($beanManager, $managerConfiguration);
 }