public abstract class Controller extends Object
Modifier and Type | Field and Description |
---|---|
protected ConnectionHelper<?> |
helper
The parent connector helper.
|
protected boolean |
overloaded
Indicates if the controller is overloaded.
|
protected boolean |
running
Indicates if the task is running.
|
Constructor and Description |
---|
Controller(ConnectionHelper<?> helper)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doInit()
Initializes the controller before entering the control loop.
|
protected void |
doRelease()
Method called-back with the controller stops running.
|
protected void |
doRun(long sleepTime)
Do the actual controller work.
|
protected ConnectionHelper<?> |
getHelper()
Returns the parent connector helper.
|
protected ExecutorService |
getWorkerService()
Returns the helper's worker service.
|
boolean |
isOverloaded()
Indicates if the controller is overloaded.
|
boolean |
isRunning()
Indicates if the task is running.
|
void |
run()
Listens on the given server socket for incoming connections.
|
void |
setOverloaded(boolean overloaded)
Indicates if the controller is overloaded.
|
void |
shutdown()
Abort the controller.
|
protected final ConnectionHelper<?> helper
protected boolean overloaded
protected boolean running
public Controller(ConnectionHelper<?> helper)
helper
- The parent connector helper.protected void doInit()
protected void doRelease()
protected void doRun(long sleepTime) throws IOException
run()
to provide an
easy method to overload.sleepTime
- The maximum amount of sleep time.IOException
protected ConnectionHelper<?> getHelper()
protected ExecutorService getWorkerService()
public boolean isOverloaded()
public boolean isRunning()
public void run()
public void setOverloaded(boolean overloaded)
overloaded
- True if the controller is overloaded.public void shutdown()
Copyright © 2005–2018. All rights reserved.