Package com.sun.corba.ee.impl.transport
Class ConnectionImpl
- java.lang.Object
-
- com.sun.corba.ee.impl.transport.EventHandlerBase
-
- com.sun.corba.ee.impl.transport.ConnectionImpl
-
- All Implemented Interfaces:
Connection,Work,Connection,EventHandler
- Direct Known Subclasses:
NoConnectionCacheImpl.NCCConnectionImpl,SocketFactoryConnectionImpl
public class ConnectionImpl extends EventHandlerBase implements Connection, Work
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interfaceConnectionImpl.Dispatcher
-
Field Summary
Fields Modifier and Type Field Description protected Acceptoracceptorprivate NioBufferWriterbufferWriterprotected java.nio.ByteBufferbyteBufferprotected CachedCodeBasecachedCodeBaseprotected MessageMediatorclientReply_1_1protected IORcodeBaseServerIORprotected CodeSetComponentInfo.CodeSetContextcodeSetContextprotected ConnectionCacheconnectionCacheprotected ContactInfocontactInfoprivate java.lang.ThrowablediscardedThrowableprotected ConnectionImpl.Dispatcherdispatcher(package private) static ConnectionImpl.DispatcherDISPATCHERprotected longenqueueTimeprotected java.util.concurrent.ConcurrentHashMap<RequestId,java.util.Queue<MessageMediator>>fragmentMapprotected booleanisServerprivate MessageParsermessageParserprotected booleanpostInitialContextsprotected java.util.concurrent.atomic.AtomicIntegerrequestIdprotected ResponseWaitingRoomresponseWaitingRoomprotected MessageMediatorserverRequest_1_1protected intserverRequestCount(package private) java.util.Map<java.lang.Integer,MessageMediator>serverRequestMapprotected java.net.Socketsocketprotected java.nio.channels.SocketChannelsocketChannelprivate SocketChannelReadersocketChannelReaderprivate intstateprotected java.lang.ObjectstateEventprotected TcpTimeoutstcpTimeoutsprotected longtimeStampprotected TemporarySelectortmpReadSelectorprotected java.lang.ObjecttmpReadSelectorLockprotected static ORBUtilSystemExceptionwrapperprotected java.lang.ObjectwriteEventprotected booleanwriteLocked-
Fields inherited from class com.sun.corba.ee.impl.transport.EventHandlerBase
orb, selectionKey, useSelectThreadToWait, useWorkerThreadForEvent, work
-
Fields inherited from interface com.sun.corba.ee.spi.transport.Connection
ABORT, CLOSE_RECVD, CLOSE_SENT, ESTABLISHED, OPENING
-
-
Constructor Summary
Constructors Modifier Constructor Description ConnectionImpl(ORB orb)protectedConnectionImpl(ORB orb, boolean useSelectThreadToWait, boolean useWorkerThread)ConnectionImpl(ORB orb, Acceptor acceptor, java.net.Socket socket)privateConnectionImpl(ORB orb, Acceptor acceptor, java.net.Socket socket, boolean useSelectThreadToWait, boolean useWorkerThread)privateConnectionImpl(ORB orb, ContactInfo contactInfo, boolean useSelectThreadToWait, boolean useWorkerThread, java.lang.String socketType, java.lang.String hostname, int port)ConnectionImpl(ORB orb, ContactInfo contactInfo, java.lang.String socketType, java.lang.String hostname, int port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddedEntryToFragmentMap(RequestId corbaRequestId)private voidaddMessageMediatorToWorkQueue(MessageMediator messageMediator)protected voidblockingRead()(package private) voidclearDiscardedThrowable()Clears the throwable, if any, that occurred during the latestdoWork()call.MessageMediatorclientReply_1_1_Get()voidclientReply_1_1_Put(MessageMediator x)voidclientReply_1_1_Remove()MessageMediatorclientRequestMapGet(int requestId)voidclose()Note:it is possible for this to be called more than oncevoidcloseConnectionResources()Clean up all connection resources.protected voidcloseSocketAndTemporarySelectors()protected voidcloseTemporarySelectors()private voidclosingReadSelector(TemporarySelector tmpReadSelector)private voidclosingSocketChannel()private MessageMediatorcreateMessageMediator()protected voiddefineSocket(boolean useSelectThreadToWait, java.net.Socket socket)private voiddoNotCloseBusyConnection()protected voiddoOptimizedReadStrategy()voiddoWork()This method denotes the actual work that is done by the work item.private voidexceptionInfo(java.lang.String string, java.lang.Throwable t)private voidexceptionInfo(java.lang.Throwable t)java.nio.ByteBufferextractAndProcessMessages(java.nio.ByteBuffer byteBuffer)AcceptorgetAcceptor()ORBgetBroker()java.nio.channels.SelectableChannelgetChannel()CodeBasegetCodeBase()IORgetCodeBaseIOR()CodeSetComponentInfo.CodeSetContextgetCodeSetContext()ConnectiongetConnection()ConnectionCachegetConnectionCache()ContactInfogetContactInfo()(package private) java.lang.ThrowablegetDiscardedThrowable()Returns the throwable, if any, that occurred during the latestdoWork()call.longgetEnqueueTime()This methods gets the time in millis in the work item, when this work item was enqueued in the work queue.EventHandlergetEventHandler()java.util.Queue<MessageMediator>getFragmentList(RequestId corbaRequestId)intgetInterestOps()java.lang.StringgetName()This method will return the name of the work item.intgetNextRequestId()ResponseWaitingRoomgetResponseWaitingRoom()java.net.SocketgetSocket()java.nio.channels.SocketChannelgetSocketChannel()protected intgetState()protected java.lang.StringgetStateString(int state)protected TemporarySelectorgetTemporaryReadSelector()longgetTimeStamp()Timestamps are used for connection management, in particular, for reclaiming idleConnections.booleanhasSocketChannel()private voidIOExceptionOnClose(java.lang.Exception e)booleanisBusy()Indicates if theConnectionis in the process of sending or receiving a message.booleanisClosed()Indicates if theConnectionis closed.booleanisPostInitialContexts()booleanisServer()Indicates whether a CorbaContactInfo or CorbaAcceptor created theConnection.private voidlocalStateInfo(int localState)protected intnonBlockingRead()private voidparseBytesAndDispatchMessages()voidpurgeCalls(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.private voidqueuedMessageFragment(RequestId corbaRequestId)private voidqueueUpWork(MessageMediator messageMediator)booleanread()Called to read incoming messages.private java.nio.ByteBufferread(int offset, int length)private MessageMediatorreadBits()private voidreadFully(java.io.InputStream is, byte[] buf, int offset, int length)Reads data from the input stream, adding it the end of the existing buffer.private voidreadFullySleeping(int time)voidregisterWaiter(MessageMediator messageMediator)Register an invocation's CorbaMessageMediator with theConnection.voidremoveFragmentList(RequestId corbaRequestId)private voidresumeSelectOnMainSelector()voidsendCancelRequest(GIOPVersion giopVersion, int requestId)Send a CancelRequest message.voidsendCancelRequestWithLock(GIOPVersion giopVersion, int requestId)voidsendCloseConnection(GIOPVersion giopVersion)********************************************************************** The following methods are for dealing with Connection cleaning for better scalability of servers in high network load conditions.protected voidsendHelper(GIOPVersion giopVersion, Message msg)voidsendMessageError(GIOPVersion giopVersion)voidsendWithoutLock(CDROutputObject outputObject)MessageMediatorserverRequest_1_1_Get()voidserverRequest_1_1_Put(MessageMediator x)voidserverRequest_1_1_Remove()MessageMediatorserverRequestMapGet(int reqId)voidserverRequestMapPut(int reqId, MessageMediator messageMediator)voidserverRequestMapRemove(int reqId)voidserverRequestProcessingBegins()It is possible for a Close Connection to have been * sent here, but we will not check for this.voidserverRequestProcessingEnds()voidsetCodeBaseIOR(IOR ior)voidsetCodeSetContext(CodeSetComponentInfo.CodeSetContext csc)voidsetConnectionCache(ConnectionCache connectionCache)voidsetEnqueueTime(long timeInMillis)This methods sets the time in millis in the work item, when this work item was enqueued in the work queue.voidsetPostInitialContexts()protected voidsetState(int state)voidsetState(java.lang.String stateString)The "state" of theConnection.protected voidsetTcpTimeouts(TcpTimeouts tcpTimeouts)voidsetTimeStamp(long time)Timestamps are used for connection management, in particular, for reclaiming idleConnections.voidsetUseSelectThreadToWait(boolean x)booleanshouldRegisterReadEvent()Used to determine if theConnectionshould register with the CorbaTransportManager Selector to handle read events.booleanshouldRegisterServerReadEvent()Used to determine if theConnectionshould register with the CorbaTransportManager Selector to handle read events.java.lang.StringtoString()private voidtraceMessageBodyReceived(ORB orb, java.nio.ByteBuffer buf)private voidunregisterForEventAndPurgeCalls(SystemException ex)voidunregisterWaiter(MessageMediator messageMediator)Unregister an invocation's * CorbaMessageMediator with theConnection.CDRInputObjectwaitForResponse(MessageMediator messageMediator)If a message expect's a response then this method is called.voidwrite(java.nio.ByteBuffer byteBuffer)voidwriteLock()Sets the writeLock for this connection.voidwriteUnlock()Release a write lock on theConnection.private voidwriteUsingNio(java.nio.ByteBuffer byteBuffer)-
Methods inherited from class com.sun.corba.ee.impl.transport.EventHandlerBase
getSelectionKey, getWork, handleEvent, setSelectionKey, setUseWorkerThreadForEvent, setWork, shouldUseSelectThreadToWait, shouldUseWorkerThreadForEvent
-
-
-
-
Field Detail
-
wrapper
protected static final ORBUtilSystemException wrapper
-
socketChannel
protected java.nio.channels.SocketChannel socketChannel
-
messageParser
private MessageParser messageParser
-
socketChannelReader
private SocketChannelReader socketChannelReader
-
discardedThrowable
private java.lang.Throwable discardedThrowable
-
byteBuffer
protected java.nio.ByteBuffer byteBuffer
-
enqueueTime
protected long enqueueTime
-
contactInfo
protected ContactInfo contactInfo
-
acceptor
protected Acceptor acceptor
-
connectionCache
protected ConnectionCache connectionCache
-
socket
protected java.net.Socket socket
-
timeStamp
protected long timeStamp
-
isServer
protected boolean isServer
-
requestId
protected java.util.concurrent.atomic.AtomicInteger requestId
-
responseWaitingRoom
protected ResponseWaitingRoom responseWaitingRoom
-
state
private int state
-
stateEvent
protected final java.lang.Object stateEvent
-
writeEvent
protected final java.lang.Object writeEvent
-
writeLocked
protected boolean writeLocked
-
serverRequestCount
protected int serverRequestCount
-
serverRequestMap
java.util.Map<java.lang.Integer,MessageMediator> serverRequestMap
-
postInitialContexts
protected boolean postInitialContexts
-
codeBaseServerIOR
protected IOR codeBaseServerIOR
-
cachedCodeBase
protected CachedCodeBase cachedCodeBase
-
tcpTimeouts
protected TcpTimeouts tcpTimeouts
-
tmpReadSelector
protected TemporarySelector tmpReadSelector
-
tmpReadSelectorLock
protected final java.lang.Object tmpReadSelectorLock
-
bufferWriter
private NioBufferWriter bufferWriter
-
dispatcher
protected ConnectionImpl.Dispatcher dispatcher
-
DISPATCHER
static final ConnectionImpl.Dispatcher DISPATCHER
-
fragmentMap
protected java.util.concurrent.ConcurrentHashMap<RequestId,java.util.Queue<MessageMediator>> fragmentMap
-
codeSetContext
protected CodeSetComponentInfo.CodeSetContext codeSetContext
-
clientReply_1_1
protected MessageMediator clientReply_1_1
-
serverRequest_1_1
protected MessageMediator serverRequest_1_1
-
-
Constructor Detail
-
ConnectionImpl
public ConnectionImpl(ORB orb)
-
ConnectionImpl
protected ConnectionImpl(ORB orb, boolean useSelectThreadToWait, boolean useWorkerThread)
-
ConnectionImpl
private ConnectionImpl(ORB orb, ContactInfo contactInfo, boolean useSelectThreadToWait, boolean useWorkerThread, java.lang.String socketType, java.lang.String hostname, int port)
-
ConnectionImpl
public ConnectionImpl(ORB orb, ContactInfo contactInfo, java.lang.String socketType, java.lang.String hostname, int port)
-
ConnectionImpl
private ConnectionImpl(ORB orb, Acceptor acceptor, java.net.Socket socket, boolean useSelectThreadToWait, boolean useWorkerThread)
-
-
Method Detail
-
getSocketChannel
public java.nio.channels.SocketChannel getSocketChannel()
- Specified by:
getSocketChannelin interfaceConnection
-
getDiscardedThrowable
java.lang.Throwable getDiscardedThrowable()
Returns the throwable, if any, that occurred during the latestdoWork()call. Currently used only by unit tests.
-
clearDiscardedThrowable
void clearDiscardedThrowable()
Clears the throwable, if any, that occurred during the latestdoWork()call. Currently used only by unit tests.
-
defineSocket
protected final void defineSocket(boolean useSelectThreadToWait, java.net.Socket socket) throws java.io.IOException- Throws:
java.io.IOException
-
shouldRegisterReadEvent
public boolean shouldRegisterReadEvent()
Description copied from interface:ConnectionUsed to determine if theConnectionshould 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.- Specified by:
shouldRegisterReadEventin interfaceConnection- Returns:
trueif it should be registered.
-
shouldRegisterServerReadEvent
public boolean shouldRegisterServerReadEvent()
Description copied from interface:ConnectionUsed to determine if theConnectionshould 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.- Specified by:
shouldRegisterServerReadEventin interfaceConnection- Returns:
trueif it should be registered.
-
read
public boolean read()
Description copied from interface:ConnectionCalled to read incoming messages.- Specified by:
readin interfaceConnection- Returns:
trueif the thread calling read can be released.
-
readBits
private MessageMediator readBits()
-
unregisterForEventAndPurgeCalls
private void unregisterForEventAndPurgeCalls(SystemException ex)
-
createMessageMediator
private MessageMediator createMessageMediator()
-
traceMessageBodyReceived
private void traceMessageBodyReceived(ORB orb, java.nio.ByteBuffer buf)
-
hasSocketChannel
public boolean hasSocketChannel()
- Specified by:
hasSocketChannelin interfaceConnection
-
read
private java.nio.ByteBuffer read(int offset, int length) throws java.io.IOException- Throws:
java.io.IOException
-
readFully
private void readFully(java.io.InputStream is, byte[] buf, int offset, int length) throws java.io.IOExceptionReads data from the input stream, adding it the end of the existing buffer. At least one byte will always be read.- Parameters:
is- the input stream from which to readbuf- the buffer into which to readoffset- the first position in the buffer into which to readlength-- Throws:
java.io.IOException
-
write
public void write(java.nio.ByteBuffer byteBuffer) throws java.io.IOException- Specified by:
writein interfaceConnection- Throws:
java.io.IOException
-
writeUsingNio
private void writeUsingNio(java.nio.ByteBuffer byteBuffer) throws java.io.IOException- Throws:
java.io.IOException
-
close
public void close()
Note:it is possible for this to be called more than once- Specified by:
closein interfaceConnection
-
closeConnectionResources
public void closeConnectionResources()
Description copied from interface:ConnectionClean up all connection resources. Used when shutting down an ORB.- Specified by:
closeConnectionResourcesin interfaceConnection
-
closingSocketChannel
@InfoMethod private void closingSocketChannel()
-
IOExceptionOnClose
@InfoMethod private void IOExceptionOnClose(java.lang.Exception e)
-
closeSocketAndTemporarySelectors
protected void closeSocketAndTemporarySelectors()
-
getAcceptor
public Acceptor getAcceptor()
- Specified by:
getAcceptorin interfaceConnection- Specified by:
getAcceptorin interfaceEventHandler
-
getContactInfo
public ContactInfo getContactInfo()
- Specified by:
getContactInfoin interfaceConnection
-
getEventHandler
public EventHandler getEventHandler()
- Specified by:
getEventHandlerin interfaceConnection
-
isServer
public boolean isServer()
Description copied from interface:ConnectionIndicates whether a CorbaContactInfo or CorbaAcceptor created theConnection.- Specified by:
isServerin interfaceConnection- Returns:
trueif a CorbaAcceptor created theConnection.
-
isClosed
public boolean isClosed()
Description copied from interface:ConnectionIndicates if theConnectionis closed.- Specified by:
isClosedin interfaceConnection- Returns:
trueif theConnectionis closed.
-
isBusy
public boolean isBusy()
Description copied from interface:ConnectionIndicates if theConnectionis in the process of sending or receiving a message.- Specified by:
isBusyin interfaceConnection- Returns:
trueif theConnectionis busy.
-
getTimeStamp
public long getTimeStamp()
Description copied from interface:ConnectionTimestamps are used for connection management, in particular, for reclaiming idleConnections.- Specified by:
getTimeStampin interfaceConnection- Returns:
- the "time" the
Connectionwas last used.
-
setTimeStamp
public void setTimeStamp(long time)
Description copied from interface:ConnectionTimestamps are used for connection management, in particular, for reclaiming idleConnections.- Specified by:
setTimeStampin interfaceConnection- Parameters:
time- - the "time" theConnectionwas last used.
-
getState
protected int getState()
-
setState
protected void setState(int state)
-
setState
public void setState(java.lang.String stateString)
Description copied from interface:ConnectionThe "state" of theConnection.- Specified by:
setStatein interfaceConnection- Parameters:
stateString- state to set
-
writeLock
public void writeLock()
Sets the writeLock for this connection. If the writeLock is already set by someone else, block till the writeLock is released and can set by us. IMPORTANT: this connection's lock must be acquired before setting the writeLock and must be unlocked after setting the writeLock.- Specified by:
writeLockin interfaceConnection
-
writeUnlock
public void writeUnlock()
Description copied from interface:ConnectionRelease a write lock on theConnection.- Specified by:
writeUnlockin interfaceConnection
-
sendWithoutLock
public void sendWithoutLock(CDROutputObject outputObject)
- Specified by:
sendWithoutLockin interfaceConnection
-
registerWaiter
public void registerWaiter(MessageMediator messageMediator)
Description copied from interface:ConnectionRegister an invocation's CorbaMessageMediator with theConnection. This is useful in protocols which support fragmentation.- Specified by:
registerWaiterin interfaceConnection- Parameters:
messageMediator- mediator to register
-
unregisterWaiter
public void unregisterWaiter(MessageMediator messageMediator)
Description copied from interface:ConnectionUnregister an invocation's * CorbaMessageMediator with theConnection.- Specified by:
unregisterWaiterin interfaceConnection- Parameters:
messageMediator- mediator to unregister
-
waitForResponse
public CDRInputObject waitForResponse(MessageMediator messageMediator)
Description copied from interface:ConnectionIf 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).- Specified by:
waitForResponsein interfaceConnection- Parameters:
messageMediator- mediator to process- Returns:
- stream
-
setConnectionCache
public void setConnectionCache(ConnectionCache connectionCache)
- Specified by:
setConnectionCachein interfaceConnection
-
getConnectionCache
public ConnectionCache getConnectionCache()
- Specified by:
getConnectionCachein interfaceConnection
-
setUseSelectThreadToWait
public void setUseSelectThreadToWait(boolean x)
- Specified by:
setUseSelectThreadToWaitin interfaceEventHandler- Overrides:
setUseSelectThreadToWaitin classEventHandlerBase
-
getChannel
public java.nio.channels.SelectableChannel getChannel()
- Specified by:
getChannelin interfaceEventHandler
-
getInterestOps
public int getInterestOps()
- Specified by:
getInterestOpsin interfaceEventHandler
-
getConnection
public Connection getConnection()
- Specified by:
getConnectionin interfaceEventHandler
-
getName
public java.lang.String getName()
Description copied from interface:WorkThis method will return the name of the work item.
-
doWork
public void doWork()
Description copied from interface:WorkThis method denotes the actual work that is done by the work item.
-
setEnqueueTime
public void setEnqueueTime(long timeInMillis)
Description copied from interface:WorkThis methods sets the time in millis in the work item, when this work item was enqueued in the work queue.- Specified by:
setEnqueueTimein interfaceWork
-
getEnqueueTime
public long getEnqueueTime()
Description copied from interface:WorkThis methods gets the time in millis in the work item, when this work item was enqueued in the work queue.- Specified by:
getEnqueueTimein interfaceWork
-
getResponseWaitingRoom
public ResponseWaitingRoom getResponseWaitingRoom()
- Specified by:
getResponseWaitingRoomin interfaceConnection
-
serverRequestMapPut
public void serverRequestMapPut(int reqId, MessageMediator messageMediator)- Specified by:
serverRequestMapPutin interfaceConnection
-
serverRequestMapGet
public MessageMediator serverRequestMapGet(int reqId)
- Specified by:
serverRequestMapGetin interfaceConnection
-
serverRequestMapRemove
public void serverRequestMapRemove(int reqId)
- Specified by:
serverRequestMapRemovein interfaceConnection
-
getFragmentList
public java.util.Queue<MessageMediator> getFragmentList(RequestId corbaRequestId)
- Specified by:
getFragmentListin interfaceConnection
-
removeFragmentList
public void removeFragmentList(RequestId corbaRequestId)
- Specified by:
removeFragmentListin interfaceConnection
-
getSocket
public java.net.Socket getSocket()
- Specified by:
getSocketin interfaceConnection
-
serverRequestProcessingBegins
public void serverRequestProcessingBegins()
It is possible for a Close Connection to have been * sent here, but we will not check for this. A "lazy" * Exception will be thrown in the Worker thread after the * incoming request has been processed even though the connection * is closed before the request is processed. This is o.k because * it is a boundary condition. To prevent it we would have to add * more locks which would reduce performance in the normal case.- Specified by:
serverRequestProcessingBeginsin interfaceConnection
-
serverRequestProcessingEnds
public void serverRequestProcessingEnds()
- Specified by:
serverRequestProcessingEndsin interfaceConnection
-
getNextRequestId
public int getNextRequestId()
- Specified by:
getNextRequestIdin interfaceConnection
-
getBroker
public ORB getBroker()
- Specified by:
getBrokerin interfaceConnection
-
getCodeSetContext
public CodeSetComponentInfo.CodeSetContext getCodeSetContext()
- Specified by:
getCodeSetContextin interfaceConnection
-
setCodeSetContext
public void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc)
- Specified by:
setCodeSetContextin interfaceConnection
-
clientRequestMapGet
public MessageMediator clientRequestMapGet(int requestId)
- Specified by:
clientRequestMapGetin interfaceConnection
-
clientReply_1_1_Put
public void clientReply_1_1_Put(MessageMediator x)
- Specified by:
clientReply_1_1_Putin interfaceConnection
-
clientReply_1_1_Get
public MessageMediator clientReply_1_1_Get()
- Specified by:
clientReply_1_1_Getin interfaceConnection
-
clientReply_1_1_Remove
public void clientReply_1_1_Remove()
- Specified by:
clientReply_1_1_Removein interfaceConnection
-
serverRequest_1_1_Put
public void serverRequest_1_1_Put(MessageMediator x)
- Specified by:
serverRequest_1_1_Putin interfaceConnection
-
serverRequest_1_1_Get
public MessageMediator serverRequest_1_1_Get()
- Specified by:
serverRequest_1_1_Getin interfaceConnection
-
serverRequest_1_1_Remove
public void serverRequest_1_1_Remove()
- Specified by:
serverRequest_1_1_Removein interfaceConnection
-
getStateString
protected java.lang.String getStateString(int state)
-
isPostInitialContexts
public boolean isPostInitialContexts()
- Specified by:
isPostInitialContextsin interfaceConnection
-
setPostInitialContexts
public void setPostInitialContexts()
- Specified by:
setPostInitialContextsin interfaceConnection
-
purgeCalls
public 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.Also, delete connection from connection table and stop the reader thread.
Note that this should only ever be called by the Reader thread for this connection.- Specified by:
purgeCallsin interfaceConnection- Parameters:
die- Kill the reader thread (this thread) before exiting.lockHeld- true if the calling thread holds the lock on the connection
-
sendCloseConnection
public void sendCloseConnection(GIOPVersion giopVersion) throws java.io.IOException
********************************************************************** The following methods are for dealing with Connection cleaning for better scalability of servers in high network load conditions. ************************************************************************- Specified by:
sendCloseConnectionin interfaceConnection- Throws:
java.io.IOException
-
sendMessageError
public void sendMessageError(GIOPVersion giopVersion) throws java.io.IOException
- Specified by:
sendMessageErrorin interfaceConnection- Throws:
java.io.IOException
-
sendCancelRequest
public void sendCancelRequest(GIOPVersion giopVersion, int requestId) throws java.io.IOException
Send a CancelRequest message. This does not lock the connection, so the caller needs to ensure this method is called appropriately.- Specified by:
sendCancelRequestin interfaceConnection- Throws:
java.io.IOException- - could be due to abortive connection closure.
-
sendHelper
protected void sendHelper(GIOPVersion giopVersion, Message msg) throws java.io.IOException
- Throws:
java.io.IOException
-
sendCancelRequestWithLock
public void sendCancelRequestWithLock(GIOPVersion giopVersion, int requestId) throws java.io.IOException
- Specified by:
sendCancelRequestWithLockin interfaceConnection- Throws:
java.io.IOException
-
setCodeBaseIOR
public final void setCodeBaseIOR(IOR ior)
- Specified by:
setCodeBaseIORin interfaceConnection
-
getCodeBaseIOR
public final IOR getCodeBaseIOR()
- Specified by:
getCodeBaseIORin interfaceConnection
-
getCodeBase
public final CodeBase getCodeBase()
- Specified by:
getCodeBasein interfaceConnection
-
setTcpTimeouts
protected void setTcpTimeouts(TcpTimeouts tcpTimeouts)
-
doOptimizedReadStrategy
protected void doOptimizedReadStrategy()
-
extractAndProcessMessages
public java.nio.ByteBuffer extractAndProcessMessages(java.nio.ByteBuffer byteBuffer)
-
parseBytesAndDispatchMessages
private void parseBytesAndDispatchMessages()
-
blockingRead
protected void blockingRead()
-
queueUpWork
private void queueUpWork(MessageMediator messageMediator)
-
nonBlockingRead
protected int nonBlockingRead()
-
addMessageMediatorToWorkQueue
private void addMessageMediatorToWorkQueue(MessageMediator messageMediator)
-
resumeSelectOnMainSelector
private void resumeSelectOnMainSelector()
-
getTemporaryReadSelector
protected TemporarySelector getTemporaryReadSelector() throws java.io.IOException
- Throws:
java.io.IOException
-
closeTemporarySelectors
protected void closeTemporarySelectors() throws java.io.IOException- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
exceptionInfo
@InfoMethod private void exceptionInfo(java.lang.Throwable t)
-
exceptionInfo
@InfoMethod private void exceptionInfo(java.lang.String string, java.lang.Throwable t)
-
readFullySleeping
@InfoMethod private void readFullySleeping(int time)
-
doNotCloseBusyConnection
@InfoMethod private void doNotCloseBusyConnection()
-
localStateInfo
@InfoMethod private void localStateInfo(int localState)
-
addedEntryToFragmentMap
@InfoMethod private void addedEntryToFragmentMap(RequestId corbaRequestId)
-
queuedMessageFragment
@InfoMethod private void queuedMessageFragment(RequestId corbaRequestId)
-
closingReadSelector
@InfoMethod private void closingReadSelector(TemporarySelector tmpReadSelector)
-
-