Class StandaloneContainerRunnable

java.lang.Object
org.openspaces.pu.container.standalone.StandaloneContainerRunnable
All Implemented Interfaces:
Runnable

public class StandaloneContainerRunnable extends Object implements Runnable
A standalone container runnable allowing to start a Spring based application context based on the provided parameters (BeanLevelProperties, ClusterInfo, and a list of config locations).

This runnable allows to start a processing unit container within a running thread, mainly allowing for custom class loader created based on the processing unit structure to be scoped only within the running thread. When using StandaloneProcessingUnitContainer.main(String[]) this feature is not required but when integrating the standalone container within another application this allows not to corrupt the external environment thread context class loader.

Author:
kimchy
  • Constructor Details

    • StandaloneContainerRunnable

      public StandaloneContainerRunnable(BeanLevelProperties beanLevelProperties, ClusterInfo clusterInfo, List<String> configLocations)
      Constructs a new standalone container runnable based on the provided configuration set parameters.
      Parameters:
      beanLevelProperties - The properties based configuration for Spring context
      clusterInfo - The cluster info configuration
      configLocations - List of config locations (string based)
  • Method Details

    • run

      public void run()
      Constructs a new Spring ApplicationContext based on the configured list of config locations. Also uses the provided ClusterInfo and BeanLevelProperties in order to further config the application context.
      Specified by:
      run in interface Runnable
    • isInitialized

      public boolean isInitialized()
      Returns true if the application context initialized successfully.
    • isRunning

      public boolean isRunning()
      Return true if this runnable is currently running.
    • stop

      public void stop()
      Stop this currently running container runnable.
    • getApplicationContext

      public org.springframework.context.ApplicationContext getApplicationContext()
      Returns Spring application context used as the backend for this container.
    • hasException

      public boolean hasException()
    • getException

      public Throwable getException()