public class SocketOrChannelConnectionImpl extends EventHandlerBase implements CorbaConnection, Work
| Modifier and Type | Field and Description |
|---|---|
protected Acceptor |
acceptor |
protected CachedCodeBase |
cachedCodeBase |
protected MessageMediator |
clientReply_1_1 |
protected IOR |
codeBaseServerIOR |
protected CodeSetComponentInfo.CodeSetContext |
codeSetContext |
protected ConnectionCache |
connectionCache |
protected CorbaContactInfo |
contactInfo |
static boolean |
dprintWriteLocks |
protected long |
enqueueTime |
protected boolean |
isServer |
protected CorbaMessageMediator |
partialMessageMediator |
protected boolean |
postInitialContexts |
protected ReadTimeouts |
readTimeouts |
protected int |
requestId |
protected CorbaResponseWaitingRoom |
responseWaitingRoom |
protected MessageMediator |
serverRequest_1_1 |
protected int |
serverRequestCount |
protected boolean |
shouldReadGiopHeaderOnly |
protected Socket |
socket |
protected SocketChannel |
socketChannel |
protected int |
state |
protected Object |
stateEvent |
protected long |
timeStamp |
protected ORBUtilSystemException |
wrapper |
protected Object |
writeEvent |
protected boolean |
writeLocked |
orb, selectionKey, useSelectThreadToWait, useWorkerThreadForEvent, workABORT, CLOSE_RECVD, CLOSE_SENT, ESTABLISHED, OPENING| Modifier | Constructor and Description |
|---|---|
protected |
SocketOrChannelConnectionImpl(ORB orb) |
|
SocketOrChannelConnectionImpl(ORB orb,
Acceptor acceptor,
Socket socket) |
|
SocketOrChannelConnectionImpl(ORB orb,
Acceptor acceptor,
Socket socket,
boolean useSelectThreadToWait,
boolean useWorkerThread) |
protected |
SocketOrChannelConnectionImpl(ORB orb,
boolean useSelectThreadToWait,
boolean useWorkerThread) |
|
SocketOrChannelConnectionImpl(ORB orb,
CorbaContactInfo contactInfo,
boolean useSelectThreadToWait,
boolean useWorkerThread,
String socketType,
String hostname,
int port) |
|
SocketOrChannelConnectionImpl(ORB orb,
CorbaContactInfo contactInfo,
String socketType,
String hostname,
int port) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
OutputObject |
createOutputObject(MessageMediator messageMediator) |
protected boolean |
dispatch(CorbaMessageMediator messageMediator) |
void |
doWork()
This method denotes the actual work that is done by the work item.
|
void |
dprint(String msg) |
protected void |
dprint(String msg,
Throwable t) |
protected CorbaMessageMediator |
finishReadingBits(MessageMediator messageMediator) |
Acceptor |
getAcceptor()
Get the
Acceptor
that created this Connection. |
ORB |
getBroker() |
SelectableChannel |
getChannel() |
CodeBase |
getCodeBase() |
IOR |
getCodeBaseIOR() |
CodeSetComponentInfo.CodeSetContext |
getCodeSetContext() |
Connection |
getConnection() |
ConnectionCache |
getConnectionCache() |
ContactInfo |
getContactInfo()
Get the
ContactInfo
that created this Connection. |
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()
Get the
EventHandler
associated with this Acceptor. |
int |
getInterestOps() |
String |
getName()
This method will return the name of the work item.
|
int |
getNextRequestId() |
protected CorbaMessageMediator |
getPartialMessageMediator() |
ResponseWaitingRoom |
getResponseWaitingRoom() |
Socket |
getSocket() |
SocketChannel |
getSocketChannel() |
protected String |
getStateString(int state) |
long |
getTimeStamp()
Timestamps are used for connection management, in particular, for
reclaiming idle
Connections. |
void |
handleEvent() |
boolean |
isBusy()
Indicates if the
Connection is in the process of
sending or receiving a message. |
boolean |
isPostInitialContexts() |
boolean |
isServer()
|
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.
|
ByteBuffer |
read(ByteBuffer byteBuffer,
int offset,
int length,
long max_wait_time) |
ByteBuffer |
read(int size,
int offset,
int length,
long max_wait_time) |
protected CorbaMessageMediator |
readBits() |
void |
readFully(ByteBuffer byteBuffer,
int size,
long max_wait_time) |
void |
readFully(InputStream is,
byte[] buf,
int offset,
int size,
long max_wait_time) |
void |
registerWaiter(MessageMediator messageMediator)
Register an invocation's
MessageMediator
with the Connection. |
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(OutputObject outputObject) |
MessageMediator |
serverRequest_1_1_Get() |
void |
serverRequest_1_1_Put(MessageMediator x) |
void |
serverRequest_1_1_Remove() |
CorbaMessageMediator |
serverRequestMapGet(int requestId) |
void |
serverRequestMapPut(int requestId,
CorbaMessageMediator messageMediator) |
void |
serverRequestMapRemove(int requestId) |
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.
|
protected void |
setPartialMessageMediator(CorbaMessageMediator messageMediator) |
void |
setPostInitialContexts() |
protected void |
setReadGiopHeaderOnly(boolean shouldReadHeaderOnly) |
protected void |
setReadTimeouts(ReadTimeouts readTimeouts) |
void |
setState(String stateString)
The "state" of the
Connection. |
void |
setTimeStamp(long time)
Timestamps are used for connection management, in particular, for
reclaiming idle
Connections. |
void |
setUseSelectThreadToWait(boolean x) |
boolean |
shouldReadGiopHeaderOnly() |
boolean |
shouldRegisterReadEvent()
Used to determine if the
Connection should register
with the
TransportManager
Selector
to handle read events. |
boolean |
shouldRegisterServerReadEvent()
Used to determine if the
Connection should register
with the
TransportManager
Selector
to handle read events. |
boolean |
shouldUseDirectByteBuffers() |
String |
toString() |
void |
unregisterWaiter(MessageMediator messageMediator)
Unregister an invocation's
MessageMediator
with the Connection. |
InputObject |
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, setSelectionKey, setUseWorkerThreadForEvent, setWork, shouldUseSelectThreadToWait, shouldUseWorkerThreadForEventpublic static boolean dprintWriteLocks
protected long enqueueTime
protected SocketChannel socketChannel
protected CorbaContactInfo contactInfo
protected Acceptor acceptor
protected ConnectionCache connectionCache
protected Socket socket
protected long timeStamp
protected boolean isServer
protected int requestId
protected CorbaResponseWaitingRoom responseWaitingRoom
protected int state
protected Object stateEvent
protected Object writeEvent
protected boolean writeLocked
protected int serverRequestCount
protected boolean postInitialContexts
protected IOR codeBaseServerIOR
protected CachedCodeBase cachedCodeBase
protected ORBUtilSystemException wrapper
protected ReadTimeouts readTimeouts
protected boolean shouldReadGiopHeaderOnly
protected CorbaMessageMediator partialMessageMediator
protected CodeSetComponentInfo.CodeSetContext codeSetContext
protected MessageMediator clientReply_1_1
protected MessageMediator serverRequest_1_1
protected SocketOrChannelConnectionImpl(ORB orb)
protected SocketOrChannelConnectionImpl(ORB orb, boolean useSelectThreadToWait, boolean useWorkerThread)
public SocketOrChannelConnectionImpl(ORB orb, CorbaContactInfo contactInfo, boolean useSelectThreadToWait, boolean useWorkerThread, String socketType, String hostname, int port)
public SocketOrChannelConnectionImpl(ORB orb, CorbaContactInfo contactInfo, String socketType, String hostname, int port)
public SocketOrChannelConnectionImpl(ORB orb, Acceptor acceptor, Socket socket, boolean useSelectThreadToWait, boolean useWorkerThread)
public SocketChannel getSocketChannel()
getSocketChannel in interface CorbaConnectionpublic boolean shouldRegisterReadEvent()
ConnectionConnection should register
with the
TransportManager
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
TransportManager
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.protected CorbaMessageMediator readBits()
protected CorbaMessageMediator finishReadingBits(MessageMediator messageMediator)
protected boolean dispatch(CorbaMessageMediator messageMediator)
public boolean shouldUseDirectByteBuffers()
shouldUseDirectByteBuffers in interface CorbaConnectionpublic ByteBuffer read(int size, int offset, int length, long max_wait_time) throws IOException
read in interface CorbaConnectionIOExceptionpublic ByteBuffer read(ByteBuffer byteBuffer, int offset, int length, long max_wait_time) throws IOException
read in interface CorbaConnectionIOExceptionpublic void readFully(ByteBuffer byteBuffer, int size, long max_wait_time) throws IOException
IOExceptionpublic void readFully(InputStream is, byte[] buf, int offset, int size, long max_wait_time) throws IOException
IOExceptionpublic void write(ByteBuffer byteBuffer) throws IOException
write in interface CorbaConnectionIOExceptionpublic void close()
public void closeConnectionResources()
CorbaConnectioncloseConnectionResources in interface CorbaConnectionpublic Acceptor getAcceptor()
ConnectionAcceptor
that created this Connection.getAcceptor in interface EventHandlerAcceptorpublic ContactInfo getContactInfo()
ConnectionContactInfo
that created this Connection.ContactInfopublic EventHandler getEventHandler()
ConnectionEventHandler
associated with this Acceptor.EventHandlerpublic OutputObject createOutputObject(MessageMediator messageMediator)
public boolean isServer()
Connectiontrue if Connection an
Acceptor
created the Connection.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.public void setState(String stateString)
ConnectionConnection.
param statepublic void writeLock()
public void writeUnlock()
ConnectionConnection.public void sendWithoutLock(OutputObject outputObject)
public void registerWaiter(MessageMediator messageMediator)
ConnectionMessageMediator
with the Connection.
This is useful in protocols which support fragmentation.public void unregisterWaiter(MessageMediator messageMediator)
ConnectionMessageMediator
with the Connection.public InputObject waitForResponse(MessageMediator messageMediator)
Connectionpublic void setConnectionCache(ConnectionCache connectionCache)
public ConnectionCache getConnectionCache()
public void setUseSelectThreadToWait(boolean x)
setUseSelectThreadToWait in interface EventHandlersetUseSelectThreadToWait in class EventHandlerBasepublic void handleEvent()
handleEvent in interface EventHandlerhandleEvent in class EventHandlerBasepublic SelectableChannel getChannel()
getChannel in interface EventHandlerpublic int getInterestOps()
getInterestOps in interface EventHandlerpublic Connection getConnection()
getConnection in interface EventHandlerpublic String getName()
Workpublic void doWork()
Workpublic void setEnqueueTime(long timeInMillis)
WorksetEnqueueTime in interface Workpublic long getEnqueueTime()
WorkgetEnqueueTime in interface Workpublic boolean shouldReadGiopHeaderOnly()
shouldReadGiopHeaderOnly in interface CorbaConnectionprotected void setReadGiopHeaderOnly(boolean shouldReadHeaderOnly)
public ResponseWaitingRoom getResponseWaitingRoom()
getResponseWaitingRoom in interface CorbaConnectionpublic void serverRequestMapPut(int requestId,
CorbaMessageMediator messageMediator)
serverRequestMapPut in interface CorbaConnectionpublic CorbaMessageMediator serverRequestMapGet(int requestId)
serverRequestMapGet in interface CorbaConnectionpublic void serverRequestMapRemove(int requestId)
serverRequestMapRemove in interface CorbaConnectionpublic Socket getSocket()
getSocket in interface Connectionpublic void serverRequestProcessingBegins()
serverRequestProcessingBegins in interface CorbaConnectionpublic void serverRequestProcessingEnds()
serverRequestProcessingEnds in interface CorbaConnectionpublic int getNextRequestId()
getNextRequestId in interface CorbaConnectionpublic ORB getBroker()
getBroker in interface CorbaConnectionpublic CodeSetComponentInfo.CodeSetContext getCodeSetContext()
getCodeSetContext in interface CorbaConnectionpublic void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc)
setCodeSetContext in interface CorbaConnectionpublic MessageMediator clientRequestMapGet(int requestId)
clientRequestMapGet in interface CorbaConnectionpublic void clientReply_1_1_Put(MessageMediator x)
clientReply_1_1_Put in interface CorbaConnectionpublic MessageMediator clientReply_1_1_Get()
clientReply_1_1_Get in interface CorbaConnectionpublic void clientReply_1_1_Remove()
clientReply_1_1_Remove in interface CorbaConnectionpublic void serverRequest_1_1_Put(MessageMediator x)
serverRequest_1_1_Put in interface CorbaConnectionpublic MessageMediator serverRequest_1_1_Get()
serverRequest_1_1_Get in interface CorbaConnectionpublic void serverRequest_1_1_Remove()
serverRequest_1_1_Remove in interface CorbaConnectionprotected String getStateString(int state)
public boolean isPostInitialContexts()
isPostInitialContexts in interface CorbaConnectionpublic void setPostInitialContexts()
setPostInitialContexts in interface CorbaConnectionpublic void purgeCalls(SystemException systemException, boolean die, boolean lockHeld)
purgeCalls in interface CorbaConnectionminor_code - The minor code for the COMM_FAILURE major code.die - Kill the reader thread (this thread) before exiting.public void sendCloseConnection(GIOPVersion giopVersion) throws IOException
sendCloseConnection in interface CorbaConnectionIOExceptionpublic void sendMessageError(GIOPVersion giopVersion) throws IOException
sendMessageError in interface CorbaConnectionIOExceptionpublic void sendCancelRequest(GIOPVersion giopVersion, int requestId) throws IOException
sendCancelRequest in interface CorbaConnectionIOException - - 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
sendCancelRequestWithLock in interface CorbaConnectionIOExceptionpublic final void setCodeBaseIOR(IOR ior)
setCodeBaseIOR in interface CorbaConnectionpublic final IOR getCodeBaseIOR()
getCodeBaseIOR in interface CorbaConnectionpublic final CodeBase getCodeBase()
getCodeBase in interface CorbaConnectionprotected void setReadTimeouts(ReadTimeouts readTimeouts)
protected void setPartialMessageMediator(CorbaMessageMediator messageMediator)
protected CorbaMessageMediator getPartialMessageMediator()
public void dprint(String msg)
dprint in interface CorbaConnectionCopyright © 2018 JBoss by Red Hat. All rights reserved.