Interface Container

All Known Implementing Classes:
AdminServerContainer, CatalinaContainer, ComponentContainer, DelegatorContainer, EntityDataLoadContainer, JavaMailContainer, NamingServiceContainer, RmiServiceContainer, ServiceContainer, TestRunContainer

public interface Container
An OFBiz container. A container can be thought of as a background process.

When OFBiz starts, the main thread will create the Container instance and then call the container's init method. If the method returns without throwing an exception the container will be added to a list of initialized containers. After all instances have been created and initialized, the main thread will call the start method of each container in the list. When OFBiz shuts down, a separate shutdown thread will call the stop method of each container. Implementations should anticipate asynchronous calls to the methods by different threads.

Containers might be loaded more than once (have more than one instance).

  • Method Summary

    Modifier and Type
    Method
    Description
    Return the container name.
    void
    init(List<StartupCommand> ofbizCommands, String name, String configFile)
    Initialize the container.
    boolean
    Start the container process.
    void
    Stop the container process.
  • Method Details

    • init

      void init(List<StartupCommand> ofbizCommands, String name, String configFile) throws ContainerException
      Initialize the container. This method must not block - implementations should initialize internal structures and then return.
      Parameters:
      ofbizCommands - Command-line arguments.
      name - Unique name of the container's instance.
      configFile - always null but used to be the location of the global container configuration file which does not exist anymore
      Throws:
      ContainerException - If an error was encountered. Throwing this exception will halt container loading, so it should be thrown only when other containers might depend on this one.
    • start

      boolean start() throws ContainerException
      Start the container process. This method must not block - implementations that require thread blocking must create a separate thread and then return.
      Returns:
      true if the process started.
      Throws:
      ContainerException - If an error was encountered.
    • stop

      void stop() throws ContainerException
      Stop the container process. This method must not block.
      Throws:
      ContainerException - If an error was encountered.
    • getName

      String getName()
      Return the container name.
      Returns:
      Name of the container's instance.