Package com.tenio.core.controller
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
The abstracted class for controllers.
-
Field Summary
Fields inherited from class com.tenio.core.manager.AbstractManager
eventManager -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractController(EventManager eventManager) Initialization. -
Method Summary
Modifier and TypeMethodDescriptionvoidenqueueRequest(Request request) Enqueue a request for processing.intRetrieves the max request size.getName()Retrieves the service's name.floatRetrieves the current percentage using of request queue.intRetrieves the thread pool size.voidInitializes a new service.booleanDetermines whether the service is activated.abstract voidprocessRequest(Request request) Processes a request.voidrun()voidsetMaxRequestQueueSize(int maxSize) Set the maximum value size for the queue.voidSet the service's name.voidsetThreadPoolSize(int maxSize) Set the thread pool size.voidshutdown()Shutdown the service.voidstart()Start the service.abstract voidSubscribe.Methods inherited from class com.tenio.common.logger.SystemLogger
debug, trace, traceMethods inherited from class com.tenio.common.logger.AbstractLogger
buildgen, error, error, info, info, info, info, info, info, info, infoMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tenio.core.service.ServiceListener
onDestroyed, onInitialized, onRunning, onShutdown, onStarted
-
Constructor Details
-
AbstractController
Initialization.- Parameters:
eventManager- the event manager
-
-
Method Details
-
run
public void run() -
initialize
public void initialize()Description copied from interface:ServiceInitializes a new service.- Specified by:
initializein interfaceService
-
start
public void start()Description copied from interface:ServiceStart the service. -
shutdown
public void shutdown()Description copied from interface:ServiceShutdown the service. -
getName
Description copied from interface:ServiceRetrieves the service's name. -
setName
Description copied from interface:ServiceSet the service's name. -
isActivated
public boolean isActivated()Description copied from interface:ServiceDetermines whether the service is activated.- Specified by:
isActivatedin interfaceService- Returns:
- true if the service is activated, false otherwise
-
enqueueRequest
Description copied from interface:ControllerEnqueue a request for processing.- Specified by:
enqueueRequestin interfaceController- Parameters:
request- the request
-
getMaxRequestQueueSize
public int getMaxRequestQueueSize()Description copied from interface:ControllerRetrieves the max request size.- Specified by:
getMaxRequestQueueSizein interfaceController- Returns:
- the max request size
-
setMaxRequestQueueSize
public void setMaxRequestQueueSize(int maxSize) Description copied from interface:ControllerSet the maximum value size for the queue.- Specified by:
setMaxRequestQueueSizein interfaceController- Parameters:
maxSize- the max size
-
getThreadPoolSize
public int getThreadPoolSize()Description copied from interface:ControllerRetrieves the thread pool size.- Specified by:
getThreadPoolSizein interfaceController- Returns:
- the thread pool size
-
setThreadPoolSize
public void setThreadPoolSize(int maxSize) Description copied from interface:ControllerSet the thread pool size.- Specified by:
setThreadPoolSizein interfaceController- Parameters:
maxSize- the max size
-
getPercentageUsedRequestQueue
public float getPercentageUsedRequestQueue()Description copied from interface:ControllerRetrieves the current percentage using of request queue.- Specified by:
getPercentageUsedRequestQueuein interfaceController- Returns:
- the percentage
-
subscribe
public abstract void subscribe()Subscribe. -
processRequest
Processes a request.- Parameters:
request- the processing request
-