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 interface
ConnectionImpl.Dispatcher
-
Field Summary
Fields Modifier and Type Field Description protected Acceptor
acceptor
private NioBufferWriter
bufferWriter
protected java.nio.ByteBuffer
byteBuffer
protected CachedCodeBase
cachedCodeBase
protected MessageMediator
clientReply_1_1
protected IOR
codeBaseServerIOR
protected CodeSetComponentInfo.CodeSetContext
codeSetContext
protected ConnectionCache
connectionCache
protected ContactInfo
contactInfo
private java.lang.Throwable
discardedThrowable
protected ConnectionImpl.Dispatcher
dispatcher
(package private) static ConnectionImpl.Dispatcher
DISPATCHER
protected long
enqueueTime
protected java.util.concurrent.ConcurrentHashMap<RequestId,java.util.Queue<MessageMediator>>
fragmentMap
protected boolean
isServer
private MessageParser
messageParser
protected boolean
postInitialContexts
protected java.util.concurrent.atomic.AtomicInteger
requestId
protected ResponseWaitingRoom
responseWaitingRoom
protected MessageMediator
serverRequest_1_1
protected int
serverRequestCount
(package private) java.util.Map<java.lang.Integer,MessageMediator>
serverRequestMap
protected java.net.Socket
socket
protected java.nio.channels.SocketChannel
socketChannel
private SocketChannelReader
socketChannelReader
private int
state
protected java.lang.Object
stateEvent
protected TcpTimeouts
tcpTimeouts
protected long
timeStamp
protected TemporarySelector
tmpReadSelector
protected java.lang.Object
tmpReadSelectorLock
protected static ORBUtilSystemException
wrapper
protected java.lang.Object
writeEvent
protected boolean
writeLocked
-
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)
protected
ConnectionImpl(ORB orb, boolean useSelectThreadToWait, boolean useWorkerThread)
ConnectionImpl(ORB orb, Acceptor acceptor, java.net.Socket socket)
private
ConnectionImpl(ORB orb, Acceptor acceptor, java.net.Socket socket, boolean useSelectThreadToWait, boolean useWorkerThread)
private
ConnectionImpl(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 void
addedEntryToFragmentMap(RequestId corbaRequestId)
private void
addMessageMediatorToWorkQueue(MessageMediator messageMediator)
protected void
blockingRead()
(package private) void
clearDiscardedThrowable()
Clears the throwable, if any, that occurred during the latestdoWork()
call.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 oncevoid
closeConnectionResources()
Clean up all connection resources.protected void
closeSocketAndTemporarySelectors()
protected void
closeTemporarySelectors()
private void
closingReadSelector(TemporarySelector tmpReadSelector)
private void
closingSocketChannel()
private MessageMediator
createMessageMediator()
protected void
defineSocket(boolean useSelectThreadToWait, java.net.Socket socket)
private void
doNotCloseBusyConnection()
protected void
doOptimizedReadStrategy()
void
doWork()
This method denotes the actual work that is done by the work item.private void
exceptionInfo(java.lang.String string, java.lang.Throwable t)
private void
exceptionInfo(java.lang.Throwable t)
java.nio.ByteBuffer
extractAndProcessMessages(java.nio.ByteBuffer byteBuffer)
Acceptor
getAcceptor()
ORB
getBroker()
java.nio.channels.SelectableChannel
getChannel()
CodeBase
getCodeBase()
IOR
getCodeBaseIOR()
CodeSetComponentInfo.CodeSetContext
getCodeSetContext()
Connection
getConnection()
ConnectionCache
getConnectionCache()
ContactInfo
getContactInfo()
(package private) java.lang.Throwable
getDiscardedThrowable()
Returns the throwable, if any, that occurred during the latestdoWork()
call.long
getEnqueueTime()
This methods gets the time in millis in the work item, when this work item was enqueued in the work queue.EventHandler
getEventHandler()
java.util.Queue<MessageMediator>
getFragmentList(RequestId corbaRequestId)
int
getInterestOps()
java.lang.String
getName()
This method will return the name of the work item.int
getNextRequestId()
ResponseWaitingRoom
getResponseWaitingRoom()
java.net.Socket
getSocket()
java.nio.channels.SocketChannel
getSocketChannel()
protected int
getState()
protected java.lang.String
getStateString(int state)
protected TemporarySelector
getTemporaryReadSelector()
long
getTimeStamp()
Timestamps are used for connection management, in particular, for reclaiming idleConnection
s.boolean
hasSocketChannel()
private void
IOExceptionOnClose(java.lang.Exception e)
boolean
isBusy()
Indicates if theConnection
is in the process of sending or receiving a message.boolean
isClosed()
Indicates if theConnection
is closed.boolean
isPostInitialContexts()
boolean
isServer()
Indicates whether a CorbaContactInfo or CorbaAcceptor created theConnection
.private void
localStateInfo(int localState)
protected int
nonBlockingRead()
private void
parseBytesAndDispatchMessages()
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.private void
queuedMessageFragment(RequestId corbaRequestId)
private void
queueUpWork(MessageMediator messageMediator)
boolean
read()
Called to read incoming messages.private java.nio.ByteBuffer
read(int offset, int length)
private MessageMediator
readBits()
private void
readFully(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 void
readFullySleeping(int time)
void
registerWaiter(MessageMediator messageMediator)
Register an invocation's CorbaMessageMediator with theConnection
.void
removeFragmentList(RequestId corbaRequestId)
private void
resumeSelectOnMainSelector()
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)
This methods sets the time in millis in the work item, when this work item was enqueued in the work queue.void
setPostInitialContexts()
protected void
setState(int state)
void
setState(java.lang.String stateString)
The "state" of theConnection
.protected void
setTcpTimeouts(TcpTimeouts tcpTimeouts)
void
setTimeStamp(long time)
Timestamps are used for connection management, in particular, for reclaiming idleConnection
s.void
setUseSelectThreadToWait(boolean x)
boolean
shouldRegisterReadEvent()
Used to determine if theConnection
should register with the CorbaTransportManager Selector to handle read events.boolean
shouldRegisterServerReadEvent()
Used to determine if theConnection
should register with the CorbaTransportManager Selector to handle read events.java.lang.String
toString()
private void
traceMessageBodyReceived(ORB orb, java.nio.ByteBuffer buf)
private void
unregisterForEventAndPurgeCalls(SystemException ex)
void
unregisterWaiter(MessageMediator messageMediator)
Unregister an invocation's * CorbaMessageMediator with theConnection
.CDRInputObject
waitForResponse(MessageMediator messageMediator)
If a message expect's a response then this method is called.void
write(java.nio.ByteBuffer byteBuffer)
void
writeLock()
Sets the writeLock for this connection.void
writeUnlock()
Release a write lock on theConnection
.private void
writeUsingNio(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:
getSocketChannel
in 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:Connection
Used to determine if theConnection
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.- Specified by:
shouldRegisterReadEvent
in interfaceConnection
- Returns:
true
if it should be registered.
-
shouldRegisterServerReadEvent
public boolean shouldRegisterServerReadEvent()
Description copied from interface:Connection
Used to determine if theConnection
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.- Specified by:
shouldRegisterServerReadEvent
in interfaceConnection
- Returns:
true
if it should be registered.
-
read
public boolean read()
Description copied from interface:Connection
Called to read incoming messages.- Specified by:
read
in interfaceConnection
- Returns:
true
if 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:
hasSocketChannel
in 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.IOException
Reads 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:
write
in 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:
close
in interfaceConnection
-
closeConnectionResources
public void closeConnectionResources()
Description copied from interface:Connection
Clean up all connection resources. Used when shutting down an ORB.- Specified by:
closeConnectionResources
in 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:
getAcceptor
in interfaceConnection
- Specified by:
getAcceptor
in interfaceEventHandler
-
getContactInfo
public ContactInfo getContactInfo()
- Specified by:
getContactInfo
in interfaceConnection
-
getEventHandler
public EventHandler getEventHandler()
- Specified by:
getEventHandler
in interfaceConnection
-
isServer
public boolean isServer()
Description copied from interface:Connection
Indicates whether a CorbaContactInfo or CorbaAcceptor created theConnection
.- Specified by:
isServer
in interfaceConnection
- Returns:
true
if a CorbaAcceptor created theConnection
.
-
isClosed
public boolean isClosed()
Description copied from interface:Connection
Indicates if theConnection
is closed.- Specified by:
isClosed
in interfaceConnection
- Returns:
true
if theConnection
is closed.
-
isBusy
public boolean isBusy()
Description copied from interface:Connection
Indicates if theConnection
is in the process of sending or receiving a message.- Specified by:
isBusy
in interfaceConnection
- Returns:
true
if theConnection
is busy.
-
getTimeStamp
public long getTimeStamp()
Description copied from interface:Connection
Timestamps are used for connection management, in particular, for reclaiming idleConnection
s.- Specified by:
getTimeStamp
in interfaceConnection
- Returns:
- the "time" the
Connection
was last used.
-
setTimeStamp
public void setTimeStamp(long time)
Description copied from interface:Connection
Timestamps are used for connection management, in particular, for reclaiming idleConnection
s.- Specified by:
setTimeStamp
in interfaceConnection
- Parameters:
time
- - the "time" theConnection
was last used.
-
getState
protected int getState()
-
setState
protected void setState(int state)
-
setState
public void setState(java.lang.String stateString)
Description copied from interface:Connection
The "state" of theConnection
.- Specified by:
setState
in 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:
writeLock
in interfaceConnection
-
writeUnlock
public void writeUnlock()
Description copied from interface:Connection
Release a write lock on theConnection
.- Specified by:
writeUnlock
in interfaceConnection
-
sendWithoutLock
public void sendWithoutLock(CDROutputObject outputObject)
- Specified by:
sendWithoutLock
in interfaceConnection
-
registerWaiter
public void registerWaiter(MessageMediator messageMediator)
Description copied from interface:Connection
Register an invocation's CorbaMessageMediator with theConnection
. This is useful in protocols which support fragmentation.- Specified by:
registerWaiter
in interfaceConnection
- Parameters:
messageMediator
- mediator to register
-
unregisterWaiter
public void unregisterWaiter(MessageMediator messageMediator)
Description copied from interface:Connection
Unregister an invocation's * CorbaMessageMediator with theConnection
.- Specified by:
unregisterWaiter
in interfaceConnection
- Parameters:
messageMediator
- mediator to unregister
-
waitForResponse
public CDRInputObject waitForResponse(MessageMediator messageMediator)
Description copied from interface:Connection
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).- Specified by:
waitForResponse
in interfaceConnection
- Parameters:
messageMediator
- mediator to process- Returns:
- stream
-
setConnectionCache
public void setConnectionCache(ConnectionCache connectionCache)
- Specified by:
setConnectionCache
in interfaceConnection
-
getConnectionCache
public ConnectionCache getConnectionCache()
- Specified by:
getConnectionCache
in interfaceConnection
-
setUseSelectThreadToWait
public void setUseSelectThreadToWait(boolean x)
- Specified by:
setUseSelectThreadToWait
in interfaceEventHandler
- Overrides:
setUseSelectThreadToWait
in classEventHandlerBase
-
getChannel
public java.nio.channels.SelectableChannel getChannel()
- Specified by:
getChannel
in interfaceEventHandler
-
getInterestOps
public int getInterestOps()
- Specified by:
getInterestOps
in interfaceEventHandler
-
getConnection
public Connection getConnection()
- Specified by:
getConnection
in interfaceEventHandler
-
getName
public java.lang.String getName()
Description copied from interface:Work
This method will return the name of the work item.
-
doWork
public void doWork()
Description copied from interface:Work
This method denotes the actual work that is done by the work item.
-
setEnqueueTime
public void setEnqueueTime(long timeInMillis)
Description copied from interface:Work
This methods sets the time in millis in the work item, when this work item was enqueued in the work queue.- Specified by:
setEnqueueTime
in interfaceWork
-
getEnqueueTime
public long getEnqueueTime()
Description copied from interface:Work
This methods gets the time in millis in the work item, when this work item was enqueued in the work queue.- Specified by:
getEnqueueTime
in interfaceWork
-
getResponseWaitingRoom
public ResponseWaitingRoom getResponseWaitingRoom()
- Specified by:
getResponseWaitingRoom
in interfaceConnection
-
serverRequestMapPut
public void serverRequestMapPut(int reqId, MessageMediator messageMediator)
- Specified by:
serverRequestMapPut
in interfaceConnection
-
serverRequestMapGet
public MessageMediator serverRequestMapGet(int reqId)
- Specified by:
serverRequestMapGet
in interfaceConnection
-
serverRequestMapRemove
public void serverRequestMapRemove(int reqId)
- Specified by:
serverRequestMapRemove
in interfaceConnection
-
getFragmentList
public java.util.Queue<MessageMediator> getFragmentList(RequestId corbaRequestId)
- Specified by:
getFragmentList
in interfaceConnection
-
removeFragmentList
public void removeFragmentList(RequestId corbaRequestId)
- Specified by:
removeFragmentList
in interfaceConnection
-
getSocket
public java.net.Socket getSocket()
- Specified by:
getSocket
in 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:
serverRequestProcessingBegins
in interfaceConnection
-
serverRequestProcessingEnds
public void serverRequestProcessingEnds()
- Specified by:
serverRequestProcessingEnds
in interfaceConnection
-
getNextRequestId
public int getNextRequestId()
- Specified by:
getNextRequestId
in interfaceConnection
-
getBroker
public ORB getBroker()
- Specified by:
getBroker
in interfaceConnection
-
getCodeSetContext
public CodeSetComponentInfo.CodeSetContext getCodeSetContext()
- Specified by:
getCodeSetContext
in interfaceConnection
-
setCodeSetContext
public void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc)
- Specified by:
setCodeSetContext
in interfaceConnection
-
clientRequestMapGet
public MessageMediator clientRequestMapGet(int requestId)
- Specified by:
clientRequestMapGet
in interfaceConnection
-
clientReply_1_1_Put
public void clientReply_1_1_Put(MessageMediator x)
- Specified by:
clientReply_1_1_Put
in interfaceConnection
-
clientReply_1_1_Get
public MessageMediator clientReply_1_1_Get()
- Specified by:
clientReply_1_1_Get
in interfaceConnection
-
clientReply_1_1_Remove
public void clientReply_1_1_Remove()
- Specified by:
clientReply_1_1_Remove
in interfaceConnection
-
serverRequest_1_1_Put
public void serverRequest_1_1_Put(MessageMediator x)
- Specified by:
serverRequest_1_1_Put
in interfaceConnection
-
serverRequest_1_1_Get
public MessageMediator serverRequest_1_1_Get()
- Specified by:
serverRequest_1_1_Get
in interfaceConnection
-
serverRequest_1_1_Remove
public void serverRequest_1_1_Remove()
- Specified by:
serverRequest_1_1_Remove
in interfaceConnection
-
getStateString
protected java.lang.String getStateString(int state)
-
isPostInitialContexts
public boolean isPostInitialContexts()
- Specified by:
isPostInitialContexts
in interfaceConnection
-
setPostInitialContexts
public void setPostInitialContexts()
- Specified by:
setPostInitialContexts
in 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:
purgeCalls
in 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:
sendCloseConnection
in interfaceConnection
- Throws:
java.io.IOException
-
sendMessageError
public void sendMessageError(GIOPVersion giopVersion) throws java.io.IOException
- Specified by:
sendMessageError
in 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:
sendCancelRequest
in 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:
sendCancelRequestWithLock
in interfaceConnection
- Throws:
java.io.IOException
-
setCodeBaseIOR
public final void setCodeBaseIOR(IOR ior)
- Specified by:
setCodeBaseIOR
in interfaceConnection
-
getCodeBaseIOR
public final IOR getCodeBaseIOR()
- Specified by:
getCodeBaseIOR
in interfaceConnection
-
getCodeBase
public final CodeBase getCodeBase()
- Specified by:
getCodeBase
in 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:
toString
in 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)
-
-