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 a controller.
-
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 from a request queue for processing.intRetrieves the maximum size of a request queue.getName()Retrieves the service's name.floatRetrieves the current percentage using of a request queue.intRetrieves the thread pool size using for processes.voidInitializes a new service.booleanDetermines whether the service is activated.abstract voidprocessRequest(Request request) Processes a request.voidrun()voidsetMaxRequestQueueSize(int maxSize) Sets the maximum value size for the request queue.voidSet the service's name.voidsetThreadPoolSize(int maxSize) Set the thread pool size using for processes.voidshutdown()Shutdown the service.voidstart()Start the service.abstract voidSubscribe all events for handling.Methods inherited from class com.tenio.common.logger.SystemLogger
debug, debugEvent, isDebugEnabled, isTraceEnabled, trace, traceMethods inherited from class com.tenio.common.logger.AbstractLogger
buildgen, error, error, error, info, info, info, info, info, info, info, info, isErrorEnabled, isInfoEnabledMethods 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- theEventManager
-
-
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:
trueif the service is activated,falseotherwise
-
enqueueRequest
Description copied from interface:ControllerEnqueue a request from a request queue for processing.- Specified by:
enqueueRequestin interfaceController- Parameters:
request- the processingRequest
-
getMaxRequestQueueSize
public int getMaxRequestQueueSize()Description copied from interface:ControllerRetrieves the maximum size of a request queue.- Specified by:
getMaxRequestQueueSizein interfaceController- Returns:
- the maximum request queue size (
integervalue)
-
setMaxRequestQueueSize
public void setMaxRequestQueueSize(int maxSize) Description copied from interface:ControllerSets the maximum value size for the request queue.- Specified by:
setMaxRequestQueueSizein interfaceController- Parameters:
maxSize- the maximum size of a request queue (integervalue)
-
getThreadPoolSize
public int getThreadPoolSize()Description copied from interface:ControllerRetrieves the thread pool size using for processes.- Specified by:
getThreadPoolSizein interfaceController- Returns:
- the thread pool size (
integervalue)
-
setThreadPoolSize
public void setThreadPoolSize(int maxSize) Description copied from interface:ControllerSet the thread pool size using for processes.- Specified by:
setThreadPoolSizein interfaceController- Parameters:
maxSize- the thread pool size (integervalue)
-
getPercentageUsedRequestQueue
public float getPercentageUsedRequestQueue()Description copied from interface:ControllerRetrieves the current percentage using of a request queue.- Specified by:
getPercentageUsedRequestQueuein interfaceController- Returns:
- the percentage of using (
floatvalue)
-
subscribe
public abstract void subscribe()Subscribe all events for handling. -
processRequest
Processes a request.- Parameters:
request- the processingRequest
-