org.restlet.engine.http.connector
Class Controller

java.lang.Object
  extended by org.restlet.engine.http.connector.BaseTask
      extended by org.restlet.engine.http.connector.Controller
All Implemented Interfaces:
Runnable

public class Controller
extends BaseTask

Controls the state of the server helper and its managed connections.

Author:
Jerome Louvel

Constructor Summary
Controller(BaseHelper<?> helper)
          Constructor.
 
Method Summary
protected  void controlConnections()
          Control each connection for messages to read or write.
protected  void controlHelper()
          Control the helper for inbound or outbound messages to handle.
protected  void execute(Runnable task)
          Executes the next task in a separate thread provided by the worker service, only if the worker service isn't busy.
protected  BaseHelper<?> getHelper()
          Returns the parent connector helper.
protected  ExecutorService getWorkerService()
          Returns the helper's worker service.
 boolean isOverloaded()
          Indicates if the controller is overloaded.
protected  boolean isWorkerServiceFull()
          Indicates if the helper's worker service is fully busy and can't accept more tasks.
 void run()
          Listens on the given server socket for incoming connections.
 void setOverloaded(boolean overloaded)
          Indicates if the controller is overloaded.
 
Methods inherited from class org.restlet.engine.http.connector.BaseTask
isRunning, setRunning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Controller

public Controller(BaseHelper<?> helper)
Constructor.

Parameters:
helper - The parent connector helper.
Method Detail

controlConnections

protected void controlConnections()
                           throws IOException
Control each connection for messages to read or write.

Throws:
IOException

controlHelper

protected void controlHelper()
Control the helper for inbound or outbound messages to handle.


execute

protected void execute(Runnable task)
Executes the next task in a separate thread provided by the worker service, only if the worker service isn't busy.

Parameters:
task - The next task to execute.

getHelper

protected BaseHelper<?> getHelper()
Returns the parent connector helper.

Returns:
The parent connector helper.

getWorkerService

protected ExecutorService getWorkerService()
Returns the helper's worker service.

Returns:
The helper's worker service.

isOverloaded

public boolean isOverloaded()
Indicates if the controller is overloaded.

Returns:
True if the controller is overloaded.

isWorkerServiceFull

protected boolean isWorkerServiceFull()
Indicates if the helper's worker service is fully busy and can't accept more tasks.

Returns:
True if the helper's worker service is fully busy.

run

public void run()
Listens on the given server socket for incoming connections.


setOverloaded

public void setOverloaded(boolean overloaded)
Indicates if the controller is overloaded.

Parameters:
overloaded - True if the controller is overloaded.


Copyright © 2005-2011 Noelios Technologies.