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, work
ABORT, 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
Connection s. |
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
Connection s. |
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, shouldUseWorkerThreadForEvent
public 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 CorbaConnection
public boolean shouldRegisterReadEvent()
Connection
Connection
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()
Connection
Connection
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()
Connection
true
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 CorbaConnection
public ByteBuffer read(int size, int offset, int length, long max_wait_time) throws IOException
read
in interface CorbaConnection
IOException
public ByteBuffer read(ByteBuffer byteBuffer, int offset, int length, long max_wait_time) throws IOException
read
in interface CorbaConnection
IOException
public void readFully(ByteBuffer byteBuffer, int size, long max_wait_time) throws IOException
IOException
public void readFully(InputStream is, byte[] buf, int offset, int size, long max_wait_time) throws IOException
IOException
public void write(ByteBuffer byteBuffer) throws IOException
write
in interface CorbaConnection
IOException
public void close()
public void closeConnectionResources()
CorbaConnection
closeConnectionResources
in interface CorbaConnection
public Acceptor getAcceptor()
Connection
Acceptor
that created this Connection
.getAcceptor
in interface EventHandler
Acceptor
public ContactInfo getContactInfo()
Connection
ContactInfo
that created this Connection
.ContactInfo
public EventHandler getEventHandler()
Connection
EventHandler
associated with this Acceptor
.EventHandler
public OutputObject createOutputObject(MessageMediator messageMediator)
public boolean isServer()
Connection
true
if Connection
an
Acceptor
created the Connection
.public boolean isBusy()
Connection
Connection
is in the process of
sending or receiving a message.true
if the Connection
is busy.public long getTimeStamp()
Connection
Connection
s.Connection
was last used.public void setTimeStamp(long time)
Connection
Connection
s.time
- - the "time" the Connection
was last used.public void setState(String stateString)
Connection
Connection
.
param statepublic void writeLock()
public void writeUnlock()
Connection
Connection
.public void sendWithoutLock(OutputObject outputObject)
public void registerWaiter(MessageMediator messageMediator)
Connection
MessageMediator
with the Connection
.
This is useful in protocols which support fragmentation.public void unregisterWaiter(MessageMediator messageMediator)
Connection
MessageMediator
with the Connection
.public InputObject waitForResponse(MessageMediator messageMediator)
Connection
public void setConnectionCache(ConnectionCache connectionCache)
public ConnectionCache getConnectionCache()
public void setUseSelectThreadToWait(boolean x)
setUseSelectThreadToWait
in interface EventHandler
setUseSelectThreadToWait
in class EventHandlerBase
public void handleEvent()
handleEvent
in interface EventHandler
handleEvent
in class EventHandlerBase
public SelectableChannel getChannel()
getChannel
in interface EventHandler
public int getInterestOps()
getInterestOps
in interface EventHandler
public Connection getConnection()
getConnection
in interface EventHandler
public String getName()
Work
public void doWork()
Work
public void setEnqueueTime(long timeInMillis)
Work
setEnqueueTime
in interface Work
public long getEnqueueTime()
Work
getEnqueueTime
in interface Work
public boolean shouldReadGiopHeaderOnly()
shouldReadGiopHeaderOnly
in interface CorbaConnection
protected void setReadGiopHeaderOnly(boolean shouldReadHeaderOnly)
public ResponseWaitingRoom getResponseWaitingRoom()
getResponseWaitingRoom
in interface CorbaConnection
public void serverRequestMapPut(int requestId, CorbaMessageMediator messageMediator)
serverRequestMapPut
in interface CorbaConnection
public CorbaMessageMediator serverRequestMapGet(int requestId)
serverRequestMapGet
in interface CorbaConnection
public void serverRequestMapRemove(int requestId)
serverRequestMapRemove
in interface CorbaConnection
public Socket getSocket()
getSocket
in interface Connection
public void serverRequestProcessingBegins()
serverRequestProcessingBegins
in interface CorbaConnection
public void serverRequestProcessingEnds()
serverRequestProcessingEnds
in interface CorbaConnection
public int getNextRequestId()
getNextRequestId
in interface CorbaConnection
public ORB getBroker()
getBroker
in interface CorbaConnection
public CodeSetComponentInfo.CodeSetContext getCodeSetContext()
getCodeSetContext
in interface CorbaConnection
public void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc)
setCodeSetContext
in interface CorbaConnection
public MessageMediator clientRequestMapGet(int requestId)
clientRequestMapGet
in interface CorbaConnection
public void clientReply_1_1_Put(MessageMediator x)
clientReply_1_1_Put
in interface CorbaConnection
public MessageMediator clientReply_1_1_Get()
clientReply_1_1_Get
in interface CorbaConnection
public void clientReply_1_1_Remove()
clientReply_1_1_Remove
in interface CorbaConnection
public void serverRequest_1_1_Put(MessageMediator x)
serverRequest_1_1_Put
in interface CorbaConnection
public MessageMediator serverRequest_1_1_Get()
serverRequest_1_1_Get
in interface CorbaConnection
public void serverRequest_1_1_Remove()
serverRequest_1_1_Remove
in interface CorbaConnection
protected String getStateString(int state)
public boolean isPostInitialContexts()
isPostInitialContexts
in interface CorbaConnection
public void setPostInitialContexts()
setPostInitialContexts
in interface CorbaConnection
public void purgeCalls(SystemException systemException, boolean die, boolean lockHeld)
purgeCalls
in interface CorbaConnection
minor_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 CorbaConnection
IOException
public void sendMessageError(GIOPVersion giopVersion) throws IOException
sendMessageError
in interface CorbaConnection
IOException
public void sendCancelRequest(GIOPVersion giopVersion, int requestId) throws IOException
sendCancelRequest
in interface CorbaConnection
IOException
- - could be due to abortive connection closure.protected void sendHelper(GIOPVersion giopVersion, Message msg) throws IOException
IOException
public void sendCancelRequestWithLock(GIOPVersion giopVersion, int requestId) throws IOException
sendCancelRequestWithLock
in interface CorbaConnection
IOException
public final void setCodeBaseIOR(IOR ior)
setCodeBaseIOR
in interface CorbaConnection
public final IOR getCodeBaseIOR()
getCodeBaseIOR
in interface CorbaConnection
public final CodeBase getCodeBase()
getCodeBase
in interface CorbaConnection
protected void setReadTimeouts(ReadTimeouts readTimeouts)
protected void setPartialMessageMediator(CorbaMessageMediator messageMediator)
protected CorbaMessageMediator getPartialMessageMediator()
public void dprint(String msg)
dprint
in interface CorbaConnection
Copyright © 2016 JBoss by Red Hat. All rights reserved.