public class ConnectionImpl extends EventHandlerBase implements Connection, Work
orb, selectionKey, useSelectThreadToWait, useWorkerThreadForEvent, workABORT, CLOSE_RECVD, CLOSE_SENT, ESTABLISHED, OPENING| Modifier | Constructor and Description |
|---|---|
|
ConnectionImpl(ORB orb) |
|
ConnectionImpl(ORB orb,
Acceptor acceptor,
Socket socket) |
protected |
ConnectionImpl(ORB orb,
boolean useSelectThreadToWait,
boolean useWorkerThread) |
|
ConnectionImpl(ORB orb,
ContactInfo contactInfo,
String socketType,
String hostname,
int port) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
blockingRead() |
MessageMediator |
clientReply_1_1_Get() |
void |
clientReply_1_1_Put(MessageMediator x) |
void |
clientReply_1_1_Remove() |
MessageMediator |
clientRequestMapGet(int requestId) |
void |
close()
Note:it is possible for this to be called more than once
|
void |
closeConnectionResources()
Clean up all connection resources.
|
protected void |
closeSocketAndTemporarySelectors() |
protected void |
closeTemporarySelectors() |
protected void |
defineSocket(boolean useSelectThreadToWait,
Socket socket) |
protected void |
doOptimizedReadStrategy() |
void |
doWork() |
ByteBuffer |
extractAndProcessMessages(ByteBuffer byteBuffer) |
Acceptor |
getAcceptor() |
ORB |
getBroker() |
SelectableChannel |
getChannel() |
CodeBase |
getCodeBase() |
IOR |
getCodeBaseIOR() |
CodeSetComponentInfo.CodeSetContext |
getCodeSetContext() |
Connection |
getConnection() |
ConnectionCache |
getConnectionCache() |
ContactInfo |
getContactInfo() |
long |
getEnqueueTime() |
EventHandler |
getEventHandler() |
Queue<MessageMediator> |
getFragmentList(RequestId corbaRequestId) |
int |
getInterestOps() |
String |
getName() |
int |
getNextRequestId() |
ResponseWaitingRoom |
getResponseWaitingRoom() |
Socket |
getSocket() |
SocketChannel |
getSocketChannel() |
protected int |
getState() |
protected String |
getStateString(int state) |
protected TemporarySelector |
getTemporaryReadSelector() |
long |
getTimeStamp()
Timestamps are used for connection management, in particular, for
reclaiming idle
Connections. |
boolean |
hasSocketChannel() |
boolean |
isBusy()
Indicates if the
Connection is in the process of
sending or receiving a message. |
boolean |
isClosed()
Indicates if the
Connection is closed. |
boolean |
isPostInitialContexts() |
boolean |
isServer()
Indicates whether a CorbaContactInfo or CorbaAcceptor
created the
Connection. |
protected int |
nonBlockingRead() |
void |
purgeCalls(SystemException systemException,
boolean die,
boolean lockHeld)
Wake up the outstanding requests on the connection, and hand them
COMM_FAILURE exception with a given minor code.
|
boolean |
read()
Called to read incoming messages.
|
void |
registerWaiter(MessageMediator messageMediator)
Register an invocation's CorbaMessageMediator
with the
Connection. |
void |
removeFragmentList(RequestId corbaRequestId) |
void |
sendCancelRequest(GIOPVersion giopVersion,
int requestId)
Send a CancelRequest message.
|
void |
sendCancelRequestWithLock(GIOPVersion giopVersion,
int requestId) |
void |
sendCloseConnection(GIOPVersion giopVersion)
**********************************************************************
The following methods are for dealing with Connection cleaning for
better scalability of servers in high network load conditions.
|
protected void |
sendHelper(GIOPVersion giopVersion,
Message msg) |
void |
sendMessageError(GIOPVersion giopVersion) |
void |
sendWithoutLock(CDROutputObject outputObject) |
MessageMediator |
serverRequest_1_1_Get() |
void |
serverRequest_1_1_Put(MessageMediator x) |
void |
serverRequest_1_1_Remove() |
MessageMediator |
serverRequestMapGet(int reqId) |
void |
serverRequestMapPut(int reqId,
MessageMediator messageMediator) |
void |
serverRequestMapRemove(int reqId) |
void |
serverRequestProcessingBegins()
It is possible for a Close Connection to have been
* sent here, but we will not check for this.
|
void |
serverRequestProcessingEnds() |
void |
setCodeBaseIOR(IOR ior) |
void |
setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) |
void |
setConnectionCache(ConnectionCache connectionCache) |
void |
setEnqueueTime(long timeInMillis) |
void |
setPostInitialContexts() |
protected void |
setState(int state) |
void |
setState(String stateString)
The "state" of the
Connection. |
protected void |
setTcpTimeouts(TcpTimeouts tcpTimeouts) |
void |
setTimeStamp(long time)
Timestamps are used for connection management, in particular, for
reclaiming idle
Connections. |
void |
setUseSelectThreadToWait(boolean x) |
boolean |
shouldRegisterReadEvent()
Used to determine if the
Connection should register
with the CorbaTransportManager Selector
to handle read events. |
boolean |
shouldRegisterServerReadEvent()
Used to determine if the
Connection should register
with the
CorbaTransportManager Selector
to handle read events. |
String |
toString() |
void |
unregisterWaiter(MessageMediator messageMediator)
Unregister an invocation's * CorbaMessageMediator
with the
Connection. |
CDRInputObject |
waitForResponse(MessageMediator messageMediator)
If a message expect's a response then this method is called.
|
void |
write(ByteBuffer byteBuffer) |
void |
writeLock()
Sets the writeLock for this connection.
|
void |
writeUnlock()
Release a write lock on the
Connection. |
getSelectionKey, getWork, handleEvent, setSelectionKey, setUseWorkerThreadForEvent, setWork, shouldUseSelectThreadToWait, shouldUseWorkerThreadForEventprotected static final ORBUtilSystemException wrapper
protected SocketChannel socketChannel
protected ByteBuffer byteBuffer
protected long enqueueTime
protected ContactInfo contactInfo
protected Acceptor acceptor
protected ConnectionCache connectionCache
protected Socket socket
protected long timeStamp
protected boolean isServer
protected AtomicInteger requestId
protected ResponseWaitingRoom responseWaitingRoom
protected final Object stateEvent
protected final Object writeEvent
protected boolean writeLocked
protected int serverRequestCount
protected boolean postInitialContexts
protected IOR codeBaseServerIOR
protected CachedCodeBase cachedCodeBase
protected TcpTimeouts tcpTimeouts
protected TemporarySelector tmpReadSelector
protected final Object tmpReadSelectorLock
protected com.sun.corba.ee.impl.transport.ConnectionImpl.Dispatcher dispatcher
protected ConcurrentHashMap<RequestId,Queue<MessageMediator>> fragmentMap
protected CodeSetComponentInfo.CodeSetContext codeSetContext
protected MessageMediator clientReply_1_1
protected MessageMediator serverRequest_1_1
public ConnectionImpl(ORB orb)
protected ConnectionImpl(ORB orb, boolean useSelectThreadToWait, boolean useWorkerThread)
public ConnectionImpl(ORB orb, ContactInfo contactInfo, String socketType, String hostname, int port)
public SocketChannel getSocketChannel()
protected final void defineSocket(boolean useSelectThreadToWait,
Socket socket)
throws IOException
IOExceptionpublic boolean shouldRegisterReadEvent()
ConnectionConnection should register
with the CorbaTransportManager Selector
to 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.true if it should be registered.public boolean shouldRegisterServerReadEvent()
ConnectionConnection should register
with the
CorbaTransportManager Selector
to 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.true if it should be registered.public boolean read()
Connectiontrue if the thread calling read can be released.public boolean hasSocketChannel()
public void write(ByteBuffer byteBuffer) throws IOException
IOExceptionpublic void close()
public void closeConnectionResources()
Connectionprotected void closeSocketAndTemporarySelectors()
public Acceptor getAcceptor()
getAcceptor in interface EventHandlerpublic ContactInfo getContactInfo()
public EventHandler getEventHandler()
public boolean isServer()
ConnectionConnection.true if a CorbaAcceptor
created the Connection.public boolean isClosed()
ConnectionConnection is closed.true if the Connection is closed.public boolean isBusy()
ConnectionConnection is in the process of
sending or receiving a message.true if the Connection is busy.public long getTimeStamp()
ConnectionConnections.Connection was last used.public void setTimeStamp(long time)
ConnectionConnections.time - - the "time" the Connection was last used.protected int getState()
protected void setState(int state)
public void setState(String stateString)
ConnectionConnection.
param statepublic void writeLock()
public void writeUnlock()
ConnectionConnection.public void sendWithoutLock(CDROutputObject outputObject)
public void registerWaiter(MessageMediator messageMediator)
ConnectionConnection.
This is useful in protocols which support fragmentation.public void unregisterWaiter(MessageMediator messageMediator)
ConnectionConnection.public CDRInputObject waitForResponse(MessageMediator messageMediator)
Connectionpublic void setConnectionCache(ConnectionCache connectionCache)
public ConnectionCache getConnectionCache()
public void setUseSelectThreadToWait(boolean x)
setUseSelectThreadToWait in interface EventHandlersetUseSelectThreadToWait in class EventHandlerBasepublic SelectableChannel getChannel()
getChannel in interface EventHandlerpublic int getInterestOps()
getInterestOps in interface EventHandlerpublic Connection getConnection()
getConnection in interface EventHandlerpublic void setEnqueueTime(long timeInMillis)
setEnqueueTime in interface Workpublic long getEnqueueTime()
getEnqueueTime in interface Workpublic ResponseWaitingRoom getResponseWaitingRoom()
public void serverRequestMapPut(int reqId,
MessageMediator messageMediator)
public MessageMediator serverRequestMapGet(int reqId)
public void serverRequestMapRemove(int reqId)
public Queue<MessageMediator> getFragmentList(RequestId corbaRequestId)
public void removeFragmentList(RequestId corbaRequestId)
public Socket getSocket()
getSocket in interface Connectionpublic void serverRequestProcessingBegins()
public void serverRequestProcessingEnds()
public int getNextRequestId()
public ORB getBroker()
public CodeSetComponentInfo.CodeSetContext getCodeSetContext()
public void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc)
public MessageMediator clientRequestMapGet(int requestId)
public void clientReply_1_1_Put(MessageMediator x)
public MessageMediator clientReply_1_1_Get()
public void clientReply_1_1_Remove()
public void serverRequest_1_1_Put(MessageMediator x)
public MessageMediator serverRequest_1_1_Get()
public void serverRequest_1_1_Remove()
protected String getStateString(int state)
public boolean isPostInitialContexts()
public void setPostInitialContexts()
public void purgeCalls(SystemException systemException, boolean die, boolean lockHeld)
die - Kill the reader thread (this thread) before exiting.lockHeld - true if the calling thread holds the lock on the connectionpublic void sendCloseConnection(GIOPVersion giopVersion) throws IOException
IOExceptionpublic void sendMessageError(GIOPVersion giopVersion) throws IOException
IOExceptionpublic void sendCancelRequest(GIOPVersion giopVersion, int requestId) throws IOException
IOException - - could be due to abortive connection closure.protected void sendHelper(GIOPVersion giopVersion, Message msg) throws IOException
IOExceptionpublic void sendCancelRequestWithLock(GIOPVersion giopVersion, int requestId) throws IOException
IOExceptionpublic final void setCodeBaseIOR(IOR ior)
public final IOR getCodeBaseIOR()
public final CodeBase getCodeBase()
protected void setTcpTimeouts(TcpTimeouts tcpTimeouts)
protected void doOptimizedReadStrategy()
public ByteBuffer extractAndProcessMessages(ByteBuffer byteBuffer)
protected void blockingRead()
protected int nonBlockingRead()
protected TemporarySelector getTemporaryReadSelector() throws IOException
IOExceptionprotected void closeTemporarySelectors()
throws IOException
IOExceptionCopyright © 2017–2019 Eclipse Foundation. All rights reserved.