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
ConstructorsModifierConstructorDescriptionprotected
AbstractController
(EventManager eventManager) Initialization. -
Method Summary
Modifier and TypeMethodDescriptionvoid
enqueueRequest
(Request request) Enqueue a request for processing.int
Retrieves the max request size.getName()
Retrieves the service's name.float
Retrieves the current percentage using of request queue.int
Retrieves the thread pool size.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) Set the maximum value size for the queue.void
Set the service's name.void
setThreadPoolSize
(int maxSize) Set the thread pool size.void
shutdown()
Shutdown the service.void
start()
Start the service.abstract void
Subscribe.Methods inherited from class com.tenio.common.logger.SystemLogger
debug, trace, trace
Methods inherited from class com.tenio.common.logger.AbstractLogger
buildgen, error, error, info, info, info, info, info, info, info, info
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
- the event manager
-
-
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 for processing.- Specified by:
enqueueRequest
in interfaceController
- Parameters:
request
- the request
-
getMaxRequestQueueSize
public int getMaxRequestQueueSize()Description copied from interface:Controller
Retrieves the max request size.- Specified by:
getMaxRequestQueueSize
in interfaceController
- Returns:
- the max request size
-
setMaxRequestQueueSize
public void setMaxRequestQueueSize(int maxSize) Description copied from interface:Controller
Set the maximum value size for the queue.- Specified by:
setMaxRequestQueueSize
in interfaceController
- Parameters:
maxSize
- the max size
-
getThreadPoolSize
public int getThreadPoolSize()Description copied from interface:Controller
Retrieves the thread pool size.- Specified by:
getThreadPoolSize
in interfaceController
- Returns:
- the thread pool size
-
setThreadPoolSize
public void setThreadPoolSize(int maxSize) Description copied from interface:Controller
Set the thread pool size.- Specified by:
setThreadPoolSize
in interfaceController
- Parameters:
maxSize
- the max size
-
getPercentageUsedRequestQueue
public float getPercentageUsedRequestQueue()Description copied from interface:Controller
Retrieves the current percentage using of request queue.- Specified by:
getPercentageUsedRequestQueue
in interfaceController
- Returns:
- the percentage
-
subscribe
public abstract void subscribe()Subscribe. -
processRequest
Processes a request.- Parameters:
request
- the processing request
-