|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.engine.Helper
org.restlet.engine.RestletHelper<T>
org.restlet.engine.ConnectorHelper<T>
org.restlet.engine.connector.BaseHelper<T>
org.restlet.engine.connector.ConnectionHelper<T>
public abstract class ConnectionHelper<T extends Connector>
Connector helper using network connections. Here is the list of parameters that are supported. They should be set in the connector's context before it is started:
| Parameter name | Value type | Default value | Description |
|---|---|---|---|
| maxConnectionsPerHost | int | -1 | Maximum number of concurrent connections per host (IP address). |
| initialConnections | int | 100 | Initial number of connections pre-created in the connections pool. This saves time during establishment of new connections as heavy byte buffers are simply reused. |
| maxTotalConnections | int | -1 | Maximum number of concurrent connections in total. |
| persistingConnections | boolean | true | Indicates if connections should be kept alive after a call. |
| pipeliningConnections | boolean | false | Indicates if pipelining connections are supported. |
| pooledConnections | boolean | true | Indicates if connections should be pooled to save instantiation time. |
| socketReceiveBufferSize | int | 8192 | The hinted size of the underlying TCP buffers used by the platform for inbound network I/O. |
| socketReuseAddress | boolean | true | Indicates if sockets can be reused right away even if they are busy (in TIME_WAIT or 2MSL wait state). |
| Field Summary |
|---|
| Fields inherited from class org.restlet.engine.connector.BaseHelper |
|---|
clientSide, controller, inboundMessages, outboundMessages |
| Constructor Summary | |
|---|---|
ConnectionHelper(T connector,
boolean clientSide)
Constructor. |
|
| Method Summary | |
|---|---|
protected void |
checkin(Connection<?> connection)
Checks in the connection back into the pool. |
protected Connection<T> |
checkout(SocketChannel socketChannel,
ConnectionController controller,
InetSocketAddress socketAddress)
Checks out a connection associated to the given socket from the pool. |
protected abstract Connection<T> |
createConnection(SocketChannel socketChannel,
ConnectionController controller,
InetSocketAddress socketAddress)
Creates a connection associated to the given socket. |
void |
createConnectionPool()
Creates the connection pool. |
abstract InboundWay |
createInboundWay(Connection<T> connection,
int bufferSize)
Creates an inbound way for the given connection. |
abstract OutboundWay |
createOutboundWay(Connection<T> connection,
int bufferSize)
Creates an outbound way for the given connection. |
protected void |
doFinishStop()
Finish stopping the helper. |
protected void |
doGracefulStop()
Do a graceful stop first. |
ConnectionPool<T> |
getConnectionPool()
Returns the connection pool. |
Set<Connection<T>> |
getConnections()
Returns the set of active connections. |
int |
getInitialConnections()
Returns the initial number of connections pre-created in the connections pool. |
int |
getMaxConnectionsPerHost()
Returns the maximum concurrent connections per host (IP address). |
int |
getMaxTotalConnections()
Returns the maximum number of concurrent connections allowed. |
int |
getSocketReceiveBufferSize()
Returns the hinted size of the underlying TCP buffers used by the platform for inbound network I/O. |
boolean |
isPersistingConnections()
Indicates if persistent connections should be used if possible. |
boolean |
isPipeliningConnections()
Indicates if pipelining connections are supported. |
boolean |
isPooledConnection()
Indicates if the connection objects should be pooled to save instantiation time. |
abstract boolean |
isProxying()
Indicates if the helper is going through a client proxy or is a server proxy. |
boolean |
isSocketReuseAddress()
Indicates if sockets can be reused right away even if they are busy (in TIME_WAIT or 2MSL wait state). |
| Methods inherited from class org.restlet.engine.ConnectorHelper |
|---|
getConnectorService, getContext, getProtocols, update |
| Methods inherited from class org.restlet.engine.RestletHelper |
|---|
getAttributes, getHelped, getHelpedParameters, getLogger, getMetadataService, handle, setHelped |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConnectionHelper(T connector,
boolean clientSide)
connector - The helped connector.clientSide - True if it is helping a client connector.| Method Detail |
|---|
protected void checkin(Connection<?> connection)
connection - The connection to check in.
protected Connection<T> checkout(SocketChannel socketChannel,
ConnectionController controller,
InetSocketAddress socketAddress)
throws IOException
socketChannel - The underlying NIO socket channel.controller - The underlying IO controller.socketAddress - The associated IP address.
IOException
protected abstract Connection<T> createConnection(SocketChannel socketChannel,
ConnectionController controller,
InetSocketAddress socketAddress)
throws IOException
socketChannel - The underlying NIO socket channel.controller - The underlying IO controller.socketAddress - The associated IP address.
IOExceptionpublic void createConnectionPool()
public abstract InboundWay createInboundWay(Connection<T> connection,
int bufferSize)
connection - The parent connection.bufferSize - The byte buffer size.
public abstract OutboundWay createOutboundWay(Connection<T> connection,
int bufferSize)
connection - The parent connection.bufferSize - The byte buffer size.
protected void doFinishStop()
BaseHelper
doFinishStop in class BaseHelper<T extends Connector>protected void doGracefulStop()
BaseHelper
doGracefulStop in class BaseHelper<T extends Connector>public ConnectionPool<T> getConnectionPool()
public Set<Connection<T>> getConnections()
public int getInitialConnections()
public int getMaxConnectionsPerHost()
public int getMaxTotalConnections()
public int getSocketReceiveBufferSize()
public boolean isPersistingConnections()
public boolean isPipeliningConnections()
public boolean isPooledConnection()
public abstract boolean isProxying()
public boolean isSocketReuseAddress()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||