Class AbstractController

java.lang.Object
com.tenio.common.logger.AbstractLogger
com.tenio.common.logger.SystemLogger
com.tenio.core.manager.AbstractManager
com.tenio.core.controller.AbstractController
All Implemented Interfaces:
Controller, Service, ServiceListener, Runnable
Direct Known Subclasses:
InternalProcessorServiceImpl

public abstract class AbstractController extends AbstractManager implements Controller, Runnable
The abstracted class for a controller.
  • Constructor Details

    • AbstractController

      protected AbstractController(EventManager eventManager)
      Initialization.
      Parameters:
      eventManager - the EventManager
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
    • initialize

      public void initialize()
      Description copied from interface: Service
      Initializes a new service.
      Specified by:
      initialize in interface Service
    • start

      public void start()
      Description copied from interface: Service
      Start the service.
      Specified by:
      start in interface Service
    • shutdown

      public void shutdown()
      Description copied from interface: Service
      Shutdown the service.
      Specified by:
      shutdown in interface Service
    • getName

      public String getName()
      Description copied from interface: Service
      Retrieves the service's name.
      Specified by:
      getName in interface Service
      Returns:
      the String service's name
    • setName

      public void setName(String name)
      Description copied from interface: Service
      Set the service's name.
      Specified by:
      setName in interface Service
      Parameters:
      name - the String service's name
    • isActivated

      public boolean isActivated()
      Description copied from interface: Service
      Determines whether the service is activated.
      Specified by:
      isActivated in interface Service
      Returns:
      true if the service is activated, false otherwise
    • enqueueRequest

      public void enqueueRequest(Request request)
      Description copied from interface: Controller
      Enqueue a request from a request queue for processing.
      Specified by:
      enqueueRequest in interface Controller
      Parameters:
      request - the processing Request
    • getMaxRequestQueueSize

      public int getMaxRequestQueueSize()
      Description copied from interface: Controller
      Retrieves the maximum size of a request queue.
      Specified by:
      getMaxRequestQueueSize in interface Controller
      Returns:
      the maximum request queue size (integer value)
    • setMaxRequestQueueSize

      public void setMaxRequestQueueSize(int maxSize)
      Description copied from interface: Controller
      Sets the maximum value size for the request queue.
      Specified by:
      setMaxRequestQueueSize in interface Controller
      Parameters:
      maxSize - the maximum size of a request queue (integer value)
    • getThreadPoolSize

      public int getThreadPoolSize()
      Description copied from interface: Controller
      Retrieves the thread pool size using for processes.
      Specified by:
      getThreadPoolSize in interface Controller
      Returns:
      the thread pool size (integer value)
    • setThreadPoolSize

      public void setThreadPoolSize(int maxSize)
      Description copied from interface: Controller
      Set the thread pool size using for processes.
      Specified by:
      setThreadPoolSize in interface Controller
      Parameters:
      maxSize - the thread pool size (integer value)
    • getPercentageUsedRequestQueue

      public float getPercentageUsedRequestQueue()
      Description copied from interface: Controller
      Retrieves the current percentage using of a request queue.
      Specified by:
      getPercentageUsedRequestQueue in interface Controller
      Returns:
      the percentage of using (float value)
    • subscribe

      public abstract void subscribe()
      Subscribe all events for handling.
    • processRequest

      public abstract void processRequest(Request request)
      Processes a request.
      Parameters:
      request - the processing Request