|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.dream.AbstractComponent
org.objectweb.dream.protocol.channel.TCPIPProtocolImpl
public class TCPIPProtocolImpl
Implementation of the TCP/IP protocol.
Nested Class Summary | |
---|---|
protected class |
TCPIPProtocolImpl.ReaderTask
|
protected class |
TCPIPProtocolImpl.Session
|
Field Summary | |
---|---|
protected static String |
BIND_REPLY_CHUNK_NAME
|
protected ConnectionFactory |
connectionFactoryItf
|
protected int |
connectionRetry
|
protected ChunkFactoryReference<ExceptionChunk> |
exceptionChunkFactory
|
protected Map<IPExportIdentifier,ChannelFactory> |
exportedChanels
|
protected TCPIPProtocolImpl.Session |
firstAvailable
|
protected static String |
hostName
|
protected TCPIPProtocolImpl.Session |
lastAvailable
|
protected MessageCodec |
messageCodecItf
|
protected MessageManager |
messageManagerItf
|
protected int |
port
|
protected TCPIPProtocolImpl.ReaderTask |
readerTask
|
protected Set<TCPIPProtocolImpl.Session> |
sessions
|
protected int |
soLinger
|
protected int |
soTimeout
|
protected boolean |
tcpNoDelay
|
protected ThreadPoolManager |
threadPoolManager
|
Fields inherited from class org.objectweb.dream.AbstractComponent |
---|
bindingLogger, fcNeedAsyncStart, fcState, lifeCycleLogger, logger, weaveableC |
Fields inherited from interface org.objectweb.dream.protocol.channel.TCPIPProtocolAttributeController |
---|
CONNECTION_RETRY_DEFAULT |
Fields inherited from interface org.objectweb.dream.protocol.channel.TCPIPProtocol |
---|
ADDRESS, CONNECTION_RETRY, PORT, PORT_RANGE, SO_LINGER, SO_TIMEOUT, TCP_NO_DELAY |
Fields inherited from interface org.objectweb.dream.protocol.Protocol |
---|
ITF_NAME, LOWER_PROTOCOL_ITF_NAME |
Fields inherited from interface org.objectweb.dream.protocol.channel.ConnectionManager |
---|
ITF_NAME |
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController |
---|
STARTED, STOPPED |
Constructor Summary | |
---|---|
TCPIPProtocolImpl()
|
Method Summary | |
---|---|
protected void |
beforeFirstStart(Component componentItf)
|
OutgoingPush |
bind(ExportIdentifier exportId,
IncomingPush toClientPush,
Map<String,Object> hints)
Binds to a previously exported ChannelFactory interface designated
by the given export identifier. |
OutgoingPush |
bind(String hostName,
int port,
IncomingPush toClientPush)
Utility method. |
void |
bindFc(String clientItfName,
Object serverItf)
|
protected Socket |
createConnection(IPExportIdentifier exportIdentifier)
|
ExportIdentifier |
createExportIdentifier(Map<String,Object> info,
ExportIdentifier[] next)
Creates a new export identifier with the provided info |
IPExportIdentifier |
createExportIdentifier(String hostName,
int port)
Utility method. |
IPExportIdentifier |
export(ChannelFactory channel,
int port,
int range)
Utility method. |
ExportIdentifier |
export(ChannelFactory channel,
Map<String,Object> hints)
Exports a ChannelFactory interface using this protocol. |
protected TCPIPProtocolImpl.Session |
getAvailable()
|
int |
getConnectionRetry()
Returns the default value of the TCPIPProtocol.CONNECTION_RETRY
hint. |
int |
getPort()
Returns the default value of the TCPIPProtocol.PORT hint. |
int |
getSoLinger()
Returns the default value of the TCPIPProtocol.SO_LINGER hint. |
int |
getSoTimeout()
Returns the default value of the TCPIPProtocol.SO_TIMEOUT hint. |
boolean |
getTcpNoDelay()
Returns the default value of the TCPIPProtocol.TCP_NO_DELAY hint. |
protected TCPIPProtocolImpl.Session |
initSession(TCPIPProtocolImpl.Session session,
IncomingPush incomingPush)
|
String[] |
listFc()
|
void |
newConnection(Socket socket,
IPExportIdentifier identifier)
Informs the protocol component that a new connection has been opened. |
void |
prepareStopFc()
|
protected void |
sessionError(TCPIPProtocolImpl.Session session,
Exception exception)
|
protected void |
setAvailable(TCPIPProtocolImpl.Session session)
|
void |
setConnectionRetry(int connectionRetry)
Sets the default value of the TCPIPProtocol.CONNECTION_RETRY hint. |
void |
setPort(int port)
Sets the default value of the TCPIPProtocol.PORT hint. |
protected void |
setSocketOption(Socket sock)
|
void |
setSoLinger(int timeout)
Sets the default value of the TCPIPProtocol.SO_LINGER hint. |
void |
setSoTimeout(int timeout)
Sets the default value of the TCPIPProtocol.SO_TIMEOUT hint. |
void |
setTcpNoDelay(boolean tcpNoDelay)
Sets the default value of the TCPIPProtocol.TCP_NO_DELAY hint. |
protected void |
setThreadPoolManager(ThreadPoolManager threadPoolManager)
|
protected void |
silentClose(Socket socket)
|
protected void |
silentClose(TCPIPProtocolImpl.Session session)
|
void |
unexport(ExportIdentifier exportIdentifier)
Closes the export of a previously exported ChannelFactory
interface. |
Methods inherited from class org.objectweb.dream.AbstractComponent |
---|
bindFc, getFcNeedAsyncStart, getFcState, initComponent, lookupFc, setLogger, startFc, stopFc, unbindFc |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String BIND_REPLY_CHUNK_NAME
protected static String hostName
protected ChunkFactoryReference<ExceptionChunk> exceptionChunkFactory
protected Set<TCPIPProtocolImpl.Session> sessions
protected TCPIPProtocolImpl.Session firstAvailable
protected TCPIPProtocolImpl.Session lastAvailable
protected ThreadPoolManager threadPoolManager
protected TCPIPProtocolImpl.ReaderTask readerTask
protected Map<IPExportIdentifier,ChannelFactory> exportedChanels
protected int port
protected int connectionRetry
protected boolean tcpNoDelay
protected int soTimeout
protected int soLinger
protected ConnectionFactory connectionFactoryItf
protected MessageManager messageManagerItf
protected MessageCodec messageCodecItf
Constructor Detail |
---|
public TCPIPProtocolImpl()
Method Detail |
---|
public ExportIdentifier export(ChannelFactory channel, Map<String,Object> hints) throws ExportException
ChannelProtocol
ChannelFactory
interface using this protocol. This method
informs the protocol that the provided ChannelFactory
is
willing to accept connection. The returned export identifier is a specific
name for the exported channel.
export
in interface ChannelProtocol
channel
- a ChannelFactory
interface to export.hints
- additional parameters, can be null
.
ExportException
- if the export process fails.ChannelProtocol.export(ChannelFactory, Map)
public void unexport(ExportIdentifier exportIdentifier) throws InvalidExportIdentifierException
ChannelProtocol
ChannelFactory
interface. This methods do not close communication channels created by the
exported channel factory.
unexport
in interface ChannelProtocol
exportIdentifier
- the export identifier of the channel.
InvalidExportIdentifierException
- if the given export identifier is
incorrect.ChannelProtocol.unexport(ExportIdentifier)
public OutgoingPush bind(ExportIdentifier exportId, IncomingPush toClientPush, Map<String,Object> hints) throws InvalidExportIdentifierException, BindException
ChannelProtocol
ChannelFactory
interface designated
by the given export identifier. This methods instantiate a new
communication channel and returns an interface on which messages can be
sent to the server. In addition the toClientPush
interface
is the interface on which the client want to receive messages from the
server.
bind
in interface ChannelProtocol
exportId
- the identifier of the exported interface.toClientPush
- the interface on which the client want to receive
messages from the server, may be null
if no
messages are expected from the server.hints
- additional parameters, can be null
.
OutgoingPush
interface on which message can be
send over the new communication channel.
InvalidExportIdentifierException
- if the given export identifier is
incorrect.
BindException
- if the binding process fails.ChannelProtocol.bind(ExportIdentifier, IncomingPush, Map)
public ExportIdentifier createExportIdentifier(Map<String,Object> info, ExportIdentifier[] next) throws InvalidExportIdentifierException
Protocol
createExportIdentifier
in interface Protocol
info
- the info used to create the export identifier.next
- the export identifier of the lower level protocols.
InvalidExportIdentifierException
- if the export identifier can't be
created.Protocol.createExportIdentifier(Map,
ExportIdentifier[])
public IPExportIdentifier export(ChannelFactory channel, int port, int range) throws ExportException
TCPIPProtocol
export
in interface TCPIPProtocol
channel
- the channel to exportport
- the listening port on which the TCP/IP protocol will wait
incoming connection for an exported channel. range
- the range of listening ports on which the TCP/IP protocol will
try to open server socket. ExportException
- if the export process fails.TCPIPProtocol.export(ChannelFactory, int, int)
public OutgoingPush bind(String hostName, int port, IncomingPush toClientPush) throws InvalidExportIdentifierException, BindException
TCPIPProtocol
bind
in interface TCPIPProtocol
InvalidExportIdentifierException
BindException
TCPIPProtocol.bind(String, int, IncomingPush)
public IPExportIdentifier createExportIdentifier(String hostName, int port)
TCPIPProtocol
createExportIdentifier
in interface TCPIPProtocol
TCPIPProtocol.createExportIdentifier(String, int)
public void newConnection(Socket socket, IPExportIdentifier identifier)
ConnectionManager
newConnection
in interface ConnectionManager
socket
- the new connection.identifier
- the identifier of the server socket on which the new
connection has been established.ConnectionManager.newConnection(Socket, IPExportIdentifier)
protected final void silentClose(TCPIPProtocolImpl.Session session)
protected final void silentClose(Socket socket)
protected void setAvailable(TCPIPProtocolImpl.Session session)
protected TCPIPProtocolImpl.Session getAvailable()
protected TCPIPProtocolImpl.Session initSession(TCPIPProtocolImpl.Session session, IncomingPush incomingPush)
protected void setThreadPoolManager(ThreadPoolManager threadPoolManager)
protected void sessionError(TCPIPProtocolImpl.Session session, Exception exception)
protected Socket createConnection(IPExportIdentifier exportIdentifier) throws IOException
IOException
protected void setSocketOption(Socket sock) throws IOException
IOException
protected void beforeFirstStart(Component componentItf) throws IllegalLifeCycleException
beforeFirstStart
in class AbstractComponent
IllegalLifeCycleException
AbstractComponent.beforeFirstStart(Component)
public void prepareStopFc() throws IllegalLifeCycleException
prepareStopFc
in interface PrepareStopLifeCycleController
prepareStopFc
in class AbstractComponent
IllegalLifeCycleException
PrepareStopLifeCycleController.prepareStopFc()
public int getPort()
TCPIPProtocolAttributeController
TCPIPProtocol.PORT
hint.
getPort
in interface TCPIPProtocolAttributeController
port
attribute's value.TCPIPProtocolAttributeController.getPort()
public void setPort(int port)
TCPIPProtocolAttributeController
TCPIPProtocol.PORT
hint.
setPort
in interface TCPIPProtocolAttributeController
port
- the new port
attribute's value.TCPIPProtocolAttributeController.setPort(int)
public int getConnectionRetry()
TCPIPProtocolAttributeController
TCPIPProtocol.CONNECTION_RETRY
hint.
getConnectionRetry
in interface TCPIPProtocolAttributeController
TCPIPProtocolAttributeController.CONNECTION_RETRY_DEFAULT
by default, or the value set by
TCPIPProtocolAttributeController.setConnectionRetry(int)
.TCPIPProtocolAttributeController.getConnectionRetry()
public void setConnectionRetry(int connectionRetry)
TCPIPProtocolAttributeController
TCPIPProtocol.CONNECTION_RETRY
hint.
setConnectionRetry
in interface TCPIPProtocolAttributeController
connectionRetry
- the new connectionRetry
attribute's
value.TCPIPProtocolAttributeController.setConnectionRetry(int)
public int getSoLinger()
TCPIPProtocolAttributeController
TCPIPProtocol.SO_LINGER
hint.
getSoLinger
in interface TCPIPProtocolAttributeController
soLinger
attribute's value.TCPIPProtocolAttributeController.getSoLinger()
public void setSoLinger(int timeout)
TCPIPProtocolAttributeController
TCPIPProtocol.SO_LINGER
hint.
setSoLinger
in interface TCPIPProtocolAttributeController
timeout
- the new soLinger
attribute's value.TCPIPProtocolAttributeController.setSoLinger(int)
public int getSoTimeout()
TCPIPProtocolAttributeController
TCPIPProtocol.SO_TIMEOUT
hint.
getSoTimeout
in interface TCPIPProtocolAttributeController
soTimeout
attribute's value.TCPIPProtocolAttributeController.getSoTimeout()
public void setSoTimeout(int timeout)
TCPIPProtocolAttributeController
TCPIPProtocol.SO_TIMEOUT
hint.
setSoTimeout
in interface TCPIPProtocolAttributeController
timeout
- the new soTimeout
attribute's value.TCPIPProtocolAttributeController.setSoTimeout(int)
public boolean getTcpNoDelay()
TCPIPProtocolAttributeController
TCPIPProtocol.TCP_NO_DELAY
hint.
getTcpNoDelay
in interface TCPIPProtocolAttributeController
tcpNoDelay
attribute's value.TCPIPProtocolAttributeController.getTcpNoDelay()
public void setTcpNoDelay(boolean tcpNoDelay)
TCPIPProtocolAttributeController
TCPIPProtocol.TCP_NO_DELAY
hint.
setTcpNoDelay
in interface TCPIPProtocolAttributeController
tcpNoDelay
- the new tcpNoDelay
attribute's value.TCPIPProtocolAttributeController.setTcpNoDelay(boolean)
public String[] listFc()
listFc
in interface BindingController
BindingController.listFc()
public void bindFc(String clientItfName, Object serverItf) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException
bindFc
in interface BindingController
bindFc
in class AbstractComponent
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
BindingController.bindFc(String,
Object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |