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
ModifierConstructorDescriptionprotected
AbstractController
(EventManager eventManager) Initialization. -
Method Summary
Modifier and TypeMethodDescriptionvoid
enqueueRequest
(Request request) Enqueue a request from a request queue for processing.int
Retrieves the maximum size of a request queue.getName()
Retrieves the service's name.float
Retrieves the current percentage using of a request queue.int
Retrieves the thread pool size using for processes.void
Initializes a new service.boolean
Determines whether the service is activated.abstract void
processRequest
(Request request) Processes a request.void
run()
void
setMaxRequestQueueSize
(int maxSize) Sets the maximum value size for the request queue.void
Set the service's name.void
setThreadPoolSize
(int maxSize) Set the thread pool size using for processes.void
shutdown()
Shutdown the service.void
start()
Start the service.abstract void
Subscribe all events for handling.Methods inherited from class com.tenio.common.logger.SystemLogger
debug, debugEvent, isDebugEnabled, isTraceEnabled, trace, trace
Methods inherited from class com.tenio.common.logger.AbstractLogger
buildgen, error, error, error, info, info, info, info, info, info, info, info, isErrorEnabled, isInfoEnabled
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:Service
Initializes a new service.- Specified by:
initialize
in interfaceService
-
start
public void start()Description copied from interface:Service
Start the service. -
shutdown
public void shutdown()Description copied from interface:Service
Shutdown the service. -
getName
Description copied from interface:Service
Retrieves the service's name. -
setName
Description copied from interface:Service
Set the service's name. -
isActivated
public boolean isActivated()Description copied from interface:Service
Determines whether the service is activated.- Specified by:
isActivated
in interfaceService
- Returns:
true
if the service is activated,false
otherwise
-
enqueueRequest
Description copied from interface:Controller
Enqueue a request from a request queue for processing.- Specified by:
enqueueRequest
in interfaceController
- Parameters:
request
- the processingRequest
-
getMaxRequestQueueSize
public int getMaxRequestQueueSize()Description copied from interface:Controller
Retrieves the maximum size of a request queue.- Specified by:
getMaxRequestQueueSize
in interfaceController
- 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 interfaceController
- 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 interfaceController
- 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 interfaceController
- 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 interfaceController
- Returns:
- the percentage of using (
float
value)
-
subscribe
public abstract void subscribe()Subscribe all events for handling. -
processRequest
Processes a request.- Parameters:
request
- the processingRequest
-