Package com.sun.corba.se.pept.transport
Interface Connection
- All Known Subinterfaces:
CorbaConnection
- All Known Implementing Classes:
SocketFactoryConnectionImpl,SocketOrChannelConnectionImpl
public interface Connection
Connection represents a transport in the
PEPt architecture.
- Author:
- Harold Carr
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close theConnection.Get theAcceptorthat created thisConnection.Get theContactInfothat created thisConnection.Get theEventHandlerassociated with thisAcceptor.longTimestamps are used for connection management, in particular, for reclaiming idleConnections.booleanisBusy()Indicates if theConnectionis in the process of sending or receiving a message.booleanisServer()booleanread()Called to read incoming messages.voidregisterWaiter(MessageMediator messageMediator) Register an invocation'sMessageMediatorwith theConnection.voidsendWithoutLock(OutputObject outputObject) voidsetConnectionCache(ConnectionCache connectionCache) voidThe "state" of theConnection.voidsetTimeStamp(long time) Timestamps are used for connection management, in particular, for reclaiming idleConnections.booleanUsed to determine if theConnectionshould register with theTransportManagerSelectorto handle read events.booleanUsed to determine if theConnectionshould register with theTransportManagerSelectorto handle read events.voidunregisterWaiter(MessageMediator messageMediator) Unregister an invocation'sMessageMediatorwith theConnection.waitForResponse(MessageMediator messageMediator) If a message expect's a response then this method is called.voidGrab a write lock on theConnection.voidRelease a write lock on theConnection.
-
Method Details
-
shouldRegisterReadEvent
boolean shouldRegisterReadEvent()Used to determine if theConnectionshould register with theTransportManagerSelectorto handle read events. For example, an HTTP transport would not register since the requesting thread would just block on read when waiting for the reply.- Returns:
trueif it should be registered.
-
shouldRegisterServerReadEvent
boolean shouldRegisterServerReadEvent()Used to determine if theConnectionshould register with theTransportManagerSelectorto handle read events. For example, an HTTP transport would not register since the requesting thread would just block on read when waiting for the reply.- Returns:
trueif it should be registered.
-
read
boolean read()Called to read incoming messages.- Returns:
trueif the thread calling read can be released.
-
close
void close()Close theConnection. -
getAcceptor
Acceptor getAcceptor()Get theAcceptorthat created thisConnection.- Returns:
Acceptor
-
getContactInfo
ContactInfo getContactInfo()Get theContactInfothat created thisConnection.- Returns:
ContactInfo
-
getEventHandler
EventHandler getEventHandler()Get theEventHandlerassociated with thisAcceptor.- Returns:
EventHandler
-
isServer
boolean isServer()- Returns:
trueifConnectionanAcceptorcreated theConnection.
-
isBusy
boolean isBusy()Indicates if theConnectionis in the process of sending or receiving a message.- Returns:
trueif theConnectionis busy.
-
getTimeStamp
long getTimeStamp()Timestamps are used for connection management, in particular, for reclaiming idleConnections.- Returns:
- the "time" the
Connectionwas last used.
-
setTimeStamp
void setTimeStamp(long time) Timestamps are used for connection management, in particular, for reclaiming idleConnections.- Parameters:
time- - the "time" theConnectionwas last used.
-
setState
The "state" of theConnection. param state -
writeLock
void writeLock()Grab a write lock on theConnection. If another thread already has a write lock then the calling thread will block until the lock is released. The calling thread must callwriteUnlock()when it is done. -
writeUnlock
void writeUnlock()Release a write lock on theConnection. -
sendWithoutLock
-
registerWaiter
Register an invocation'sMessageMediatorwith theConnection. This is useful in protocols which support fragmentation.- Parameters:
messageMediator-
-
waitForResponse
If a message expect's a response then this method is called. This method might block on a read (e.g., HTTP), put the calling thread to sleep while another thread read's the response (e.g., GIOP), or it may use the calling thread to perform the server-side work (e.g., Solaris Doors).- Parameters:
messageMediator-
-
unregisterWaiter
Unregister an invocation'sMessageMediatorwith theConnection.- Parameters:
messageMediator-
-
setConnectionCache
-
getConnectionCache
ConnectionCache getConnectionCache()
-