org.norther.tammi.spray.connector
Interface ChannelConnector

All Superinterfaces:
Connector, Executable, ExecutableConnector, Runnable, Startable, TCPConnector
All Known Implementing Classes:
DefaultChannelConnector

public interface ChannelConnector
extends TCPConnector

An interface to channel connectors.

Author:
Ilkka Priha

Method Summary
 int getChannelTimeout()
          Gets the timeout to wait for an asynchronous I/O operation from a channel.
 int getSelectorCount()
          Gets the number of selectors to apply.
 int getSelectorTimeout()
          Gets the timeout to wait for selected channels to be ready for I/O.
 void setAddress(String addr)
          Sets the address of the server of the connection.
 void setChannelTimeout(int timeout)
          Sets the timeout to wait for an asynchronous I/O operation.
 void setSelectorCount(int count)
          Sets the number of selectors to apply.
 void setSelectorTimeout(int timeout)
          Sets the timeout to wait for selected channels to be ready for I/O.
 
Methods inherited from interface org.norther.tammi.spray.connector.TCPConnector
getReceiveBufferSize, getSendBufferSize, getServerBufferSize, getSoLinger, getSoTimeout, isTcpNoDelay, setReceiveBufferSize, setSendBufferSize, setServerBufferSize, setSoLinger, setSoTimeout, setTcpNoDelay
 
Methods inherited from interface org.norther.tammi.spray.connector.ExecutableConnector
getConnectionCount, getRequestExecutorName, setRequestExecutorName
 
Methods inherited from interface org.norther.tammi.spray.connector.Connector
getAddress, getConnectionTimeout, getFilterName, getKeyAlias, getLoggerName, getMaxIdleConnections, getName, getPort, getProvider, getRedirectPort, getRequestTimeout, isKeepConnection, isLoggingDisabled, isSecure, keepConnection, setConnectionTimeout, setFilterName, setKeyAlias, setKeyPassword, setLoggerName, setLoggingDisabled, setMaxIdleConnections, setPort, setProvider, setRedirectPort, setRequestTimeout, setSecure
 
Methods inherited from interface org.norther.tammi.core.base.Startable
isStarted, start, stop
 
Methods inherited from interface org.norther.tammi.core.thread.Executable
getExecutorName, setExecutorName
 
Methods inherited from interface org.norther.tammi.core.base.Startable
isStarted, start, stop
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

setAddress

void setAddress(String addr)
                throws UnknownHostException
Sets the address of the server of the connection. This is used in multi-homed servers to accept requests from the specified address only.

Parameters:
addr - the address of the server.
Throws:
UnknownHostException - if not found.

getChannelTimeout

int getChannelTimeout()
Gets the timeout to wait for an asynchronous I/O operation from a channel.

Returns:
the timeout for channels in msecs.

setChannelTimeout

void setChannelTimeout(int timeout)
Sets the timeout to wait for an asynchronous I/O operation. -1 waits until notified, 0 reads/writes immediately, other values wait the specified number of msecs.

Parameters:
timeout - the timeout for channels in msecs.

getSelectorTimeout

int getSelectorTimeout()
Gets the timeout to wait for selected channels to be ready for I/O.

Returns:
the timeout for selectors in msecs.

setSelectorTimeout

void setSelectorTimeout(int timeout)
Sets the timeout to wait for selected channels to be ready for I/O. -1 waits for an OS-specific poll to finish, 0 selects immediately, other values wait the specified number of msecs.

Note that selector threads in Linux seem to suspend for exactly 100 seconds during longer intervals without selections if the selector timeout is not specified.

Parameters:
timeout - the timeout for channels in msecs.

getSelectorCount

int getSelectorCount()
Gets the number of selectors to apply.

Returns:
the number of idle selectors.

setSelectorCount

void setSelectorCount(int count)
Sets the number of selectors to apply. 0 indicates a per-thread connection model without selectors for idle connections, 1 applies the same selector to accept new connections and to keep alive idle connections, greater values reserve one selector for accepting new connections and the rest for idle connections.

Note that the per-thread model doesn't work for SSL connections.

Note that this value cannot be changed while the connector is running.

Parameters:
count - the number of idle selectors.
Throws:
IllegalStateException - if the connector is running.


Copyright © 2004 The Norther Organization. All rights reserved.