Package org.ghost4j

Class AbstractRemoteComponent

java.lang.Object
org.ghost4j.AbstractComponent
org.ghost4j.AbstractRemoteComponent
All Implemented Interfaces:
Component
Direct Known Subclasses:
AbstractRemoteAnalyzer, AbstractRemoteConverter, AbstractRemoteModifier, AbstractRemoteRenderer

public abstract class AbstractRemoteComponent extends AbstractComponent
Abstract remote converter component. Used as base class for remote components.
  • Field Details

    • logger

      private org.slf4j.Logger logger
      Logger used to log messages.
    • maxProcessCount

      protected int maxProcessCount
      Maximum number of parallel processes allowed for the converter.
    • processCount

      protected int processCount
      Number of parallel processes running.
  • Constructor Details

    • AbstractRemoteComponent

      public AbstractRemoteComponent()
  • Method Details

    • waitForFreeProcess

      public void waitForFreeProcess()
      Wait for a process to get free.
    • isStandAloneModeSupported

      public boolean isStandAloneModeSupported()
      Checks if the current class has a proper 'main' method declared.
      Returns:
      true id 'main' method was found
    • startRemoteServer

      protected int startRemoteServer(JavaFork fork) throws IOException
      Start a remote component server on a Javafork object.
      Parameters:
      fork - JavaFork used to run the server
      Returns:
      Port number used by the server
      Throws:
      IOException
    • getRemoteComponent

      protected Object getRemoteComponent(int serverPort, Class<?> clazz) throws Exception
      Get a client proxy of a remote component
      Parameters:
      serverPort - Server port
      clazz - Interface of the proxy
      Returns:
      The proxy object
      Throws:
      Exception
    • buildJavaFork

      protected JavaFork buildJavaFork()
      Create and return a new JavaFork for remote processing.
      Returns:
      A JavaFork
    • getMaxProcessCount

      public int getMaxProcessCount()
    • setMaxProcessCount

      public void setMaxProcessCount(int maxProcessCount)
    • getProcessCount

      public int getProcessCount()