Package com.sun.corba.ee.impl.protocol
Class MessageMediatorImpl
java.lang.Object
com.sun.corba.ee.impl.protocol.MessageMediatorImpl
- All Implemented Interfaces:
MessageHandler
,MessageMediator
,ProtocolHandler
,Work
,ResponseHandler
public class MessageMediatorImpl
extends Object
implements MessageMediator, ProtocolHandler, MessageHandler, Work
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
protected boolean
protected short
protected boolean
protected Connection
protected ContactInfo
protected Request
protected ByteBuffer
protected Message
private long
protected CDRInputObject
protected static final InterceptorsSystemException
protected boolean
private static byte
protected Message
protected ORB
protected CDROutputObject
protected ProtocolHandler
protected String
protected LocateReplyOrReplyMessage
protected IOR
protected RequestMessage
protected byte
protected boolean
protected static final ORBUtilSystemException
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
MessageMediatorImpl
(ORB orb, Connection connection) MessageMediatorImpl
(ORB orb, Connection connection, Message dispatchHeader, ByteBuffer byteBuffer) MessageMediatorImpl
(ORB orb, ContactInfo contactInfo, Connection connection, GIOPVersion giopVersion, IOR ior, int requestId, short addrDisposition, String operationName, boolean isOneWay) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addExceptionDetailMessage
(MessageMediator mediator, SystemException ex, ServiceContexts serviceContexts) private void
addMessageMediatorToWorkQueue
(MessageMediator messageMediator) private void
beginRequest
(MessageMediator messageMediator) void
private void
connectionInfo
(Connection conn) protected SystemException
convertThrowableToSystemException
(Throwable throwable, CompletionStatus completionStatus) private CDROutputObject
createAppropriateOutputObject
(MessageMediator messageMediator, Message msg, LocateReplyMessage reply) Called by the servant during a method invocation.createLocationForward
(MessageMediator messageMediator, IOR ior, ServiceContexts svc) Called by the servant during a method invocation.createResponse
(MessageMediator messageMediator, ServiceContexts svc) protected MessageMediator
createResponseHelper
(MessageMediator messageMediator, ReplyMessage reply, IOR ior) protected MessageMediator
createResponseHelper
(MessageMediator messageMediator, ServiceContexts svc) protected MessageMediator
createResponseHelper
(MessageMediator messageMediator, ServiceContexts svc, boolean user) private void
createSystemExceptionResponse
(MessageMediator messageMediator, SystemException ex, ServiceContexts svc) createUnknownExceptionResponse
(MessageMediator messageMediator, UnknownException ex) createUserExceptionResponse
(MessageMediator messageMediator, ServiceContexts svc) boolean
dispatch()
NOTE: This call is the transition from the transport block to the protocol block.private void
dispatchError
(MessageMediator messageMediator, String msg, Throwable t) void
doWork()
Execute dispatch in its own WorkerThread.private void
endRequest
(MessageMediator messageMediator) boolean
boolean
boolean
void
Used to send the message (or its last fragment).private void
generalMessage
(String msg) short
byte
long
This methods gets the time in millis in the work item, when this work item was enqueued in the work queue.getName()
This method will return the name of the work item.int
protected ServiceContexts
getServiceContextsForReply
(MessageMediator messageMediator, ServiceContexts contexts) byte
byte
If the RMI-IIOP maximum stream format version service context is present, it indicates the maximum stream format version we could use for the reply.private byte
getStreamFormatVersionForThisRequest
(IOR ior, GIOPVersion giopVersion) int
protected void
handleAddressingDisposition
(MessageMediator messageMediator, AddressingDispositionException ex) void
handleDIIReply
(InputStream inputStream) void
handleInput
(CancelRequestMessage header) void
handleInput
(FragmentMessage_1_1 header) void
handleInput
(FragmentMessage_1_2 header) void
handleInput
(LocateReplyMessage_1_0 header) void
handleInput
(LocateReplyMessage_1_1 header) void
handleInput
(LocateReplyMessage_1_2 header) void
handleInput
(LocateRequestMessage_1_0 header) void
handleInput
(LocateRequestMessage_1_1 header) void
handleInput
(LocateRequestMessage_1_2 header) void
handleInput
(Message header) Used for message types for which we don't have concrete classes, yet, such as CloseConnection and MessageError, as well as unknown types.void
handleInput
(ReplyMessage_1_0 header) void
handleInput
(ReplyMessage_1_1 header) void
handleInput
(ReplyMessage_1_2 header) void
handleInput
(RequestMessage_1_0 header) void
handleInput
(RequestMessage_1_1 header) void
handleInput
(RequestMessage_1_2 header) protected void
handleLocateRequest
(MessageMediator messageMediator) void
handleRequest
(LocateRequestMessage msg, MessageMediator messageMediator) void
handleRequest
(RequestMessage msg, MessageMediator messageMediator) boolean
handleRequest
(MessageMediator messageMediator) protected void
handleRequestRequest
(MessageMediator messageMediator) void
handleThrowableDuringServerDispatch
(MessageMediator messageMediator, Throwable throwable, CompletionStatus completionStatus) protected void
handleThrowableDuringServerDispatch
(MessageMediator messageMediator, Throwable throwable, CompletionStatus completionStatus, int iteration) private void
void
Used to initialize message headers.boolean
boolean
boolean
boolean
isOneWay()
boolean
boolean
private void
messageInfo
(Message msg, RequestId rid) private void
moreFragmentsInfo
(boolean moreFragments) private void
poolToUseInfo
(int id) private void
processCancelRequest
(int cancelReqId) private void
private void
reportConnection
(Connection conn) private void
reportException
(String msg, Throwable thr) private void
reportGIOPVersion
(GIOPVersion vers) private void
requestIdInfo
(int id) private void
resumeOptimizedReadProcessing
(Message message) protected void
runInterceptors
(MessageMediator messageMediator, ReplyMessage reply) protected void
runRemoveThreadInfo
(MessageMediator messageMediator) protected void
runServantPostInvoke
(MessageMediator messageMediator) void
private void
sendResponse
(MessageMediator messageMediator) boolean
boolean
void
setDIIException
(Exception exception) void
setDIIInfo
(Request diiRequest) 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
setExecutePIInResponseConstructor
(boolean b) void
void
setExecuteReturnServantInResponseConstructor
(boolean b) private void
void
setInputObject
(CDRInputObject inputObject) void
setOutputObject
(CDROutputObject outputObject) void
setReplyExceptionDetailMessage
(String message) void
void
private void
private void
private void
private void
unmarshalDIIUserException
(String repoId, InputStream is) private void
unmarshalRequestID
(Message_1_2 message)
-
Field Details
-
wrapper
-
interceptorWrapper
-
orb
-
contactInfo
-
connection
-
addrDisposition
protected short addrDisposition -
outputObject
-
inputObject
-
messageHeader
-
requestHeader
-
replyHeader
-
replyExceptionDetailMessage
-
replyIOR
-
dispatchHeader
-
dispatchByteBuffer
-
streamFormatVersion
protected byte streamFormatVersion -
streamFormatVersionSet
protected boolean streamFormatVersionSet -
diiRequest
-
cancelRequestAlreadySent
protected boolean cancelRequestAlreadySent -
protocolHandler
-
_executeReturnServantInResponseConstructor
protected boolean _executeReturnServantInResponseConstructor -
_executeRemoveThreadInfoInResponseConstructor
protected boolean _executeRemoveThreadInfoInResponseConstructor -
_executePIInResponseConstructor
protected boolean _executePIInResponseConstructor -
localMaxVersion
private static byte localMaxVersion -
enqueueTime
private long enqueueTime -
isThreadDone
protected boolean isThreadDone
-
-
Constructor Details
-
MessageMediatorImpl
public MessageMediatorImpl(ORB orb, ContactInfo contactInfo, Connection connection, GIOPVersion giopVersion, IOR ior, int requestId, short addrDisposition, String operationName, boolean isOneWay) -
MessageMediatorImpl
-
MessageMediatorImpl
public MessageMediatorImpl(ORB orb, Connection connection, Message dispatchHeader, ByteBuffer byteBuffer)
-
-
Method Details
-
getRequestIdFromRawBytes
- Specified by:
getRequestIdFromRawBytes
in interfaceMessageMediator
-
getBroker
- Specified by:
getBroker
in interfaceMessageMediator
-
getContactInfo
- Specified by:
getContactInfo
in interfaceMessageMediator
-
getConnection
- Specified by:
getConnection
in interfaceMessageMediator
-
initializeMessage
public void initializeMessage()Description copied from interface:MessageMediator
Used to initialize message headers. Note: this should be moved to aRequestDispatcher
.- Specified by:
initializeMessage
in interfaceMessageMediator
-
finishSendingRequest
public void finishSendingRequest()Description copied from interface:MessageMediator
Used to send the message (or its last fragment). Note: this should be moved to aRequestDispatcher
.- Specified by:
finishSendingRequest
in interfaceMessageMediator
-
waitForResponse
- Specified by:
waitForResponse
in interfaceMessageMediator
-
setOutputObject
- Specified by:
setOutputObject
in interfaceMessageMediator
-
getOutputObject
- Specified by:
getOutputObject
in interfaceMessageMediator
-
setInputObject
- Specified by:
setInputObject
in interfaceMessageMediator
-
getInputObject
- Specified by:
getInputObject
in interfaceMessageMediator
-
setReplyHeader
- Specified by:
setReplyHeader
in interfaceMessageMediator
-
getLocateReplyHeader
- Specified by:
getLocateReplyHeader
in interfaceMessageMediator
-
getReplyHeader
- Specified by:
getReplyHeader
in interfaceMessageMediator
-
setReplyExceptionDetailMessage
- Specified by:
setReplyExceptionDetailMessage
in interfaceMessageMediator
-
getRequestHeader
- Specified by:
getRequestHeader
in interfaceMessageMediator
-
getGIOPVersion
- Specified by:
getGIOPVersion
in interfaceMessageMediator
-
getEncodingVersion
public byte getEncodingVersion()- Specified by:
getEncodingVersion
in interfaceMessageMediator
-
getRequestId
public int getRequestId()- Specified by:
getRequestId
in interfaceMessageMediator
-
isOneWay
public boolean isOneWay()- Specified by:
isOneWay
in interfaceMessageMediator
-
getOperationName
- Specified by:
getOperationName
in interfaceMessageMediator
-
getRequestServiceContexts
- Specified by:
getRequestServiceContexts
in interfaceMessageMediator
-
setRequestServiceContexts
- Specified by:
setRequestServiceContexts
in interfaceMessageMediator
-
getReplyServiceContexts
- Specified by:
getReplyServiceContexts
in interfaceMessageMediator
-
sendCancelRequestIfFinalFragmentNotSent
public void sendCancelRequestIfFinalFragmentNotSent()- Specified by:
sendCancelRequestIfFinalFragmentNotSent
in interfaceMessageMediator
-
sentFullMessage
public boolean sentFullMessage() -
sentFragment
public boolean sentFragment() -
setDIIInfo
- Specified by:
setDIIInfo
in interfaceMessageMediator
-
isDIIRequest
public boolean isDIIRequest()- Specified by:
isDIIRequest
in interfaceMessageMediator
-
unmarshalDIIUserException
- Specified by:
unmarshalDIIUserException
in interfaceMessageMediator
-
setDIIException
- Specified by:
setDIIException
in interfaceMessageMediator
-
handleDIIReply
- Specified by:
handleDIIReply
in interfaceMessageMediator
-
getDispatchHeader
- Specified by:
getDispatchHeader
in interfaceMessageMediator
-
getThreadPoolToUse
public int getThreadPoolToUse()- Specified by:
getThreadPoolToUse
in interfaceMessageMediator
-
reportException
-
reportConnection
-
dispatch
public boolean dispatch()NOTE: This call is the transition from the transport block to the protocol block.- Specified by:
dispatch
in interfaceMessageMediator
-
getStreamFormatVersion
public byte getStreamFormatVersion()- Specified by:
getStreamFormatVersion
in interfaceMessageMediator
-
getStreamFormatVersionForReply
public byte getStreamFormatVersionForReply()If the RMI-IIOP maximum stream format version service context is present, it indicates the maximum stream format version we could use for the reply. If it isn't present, the default is 2 for GIOP 1.3 or greater, 1 for lower. This is only sent on requests. Clients can find out the server's maximum by looking for a tagged component in the IOR.- Specified by:
getStreamFormatVersionForReply
in interfaceMessageMediator
-
isSystemExceptionReply
public boolean isSystemExceptionReply()- Specified by:
isSystemExceptionReply
in interfaceMessageMediator
-
isUserExceptionReply
public boolean isUserExceptionReply()- Specified by:
isUserExceptionReply
in interfaceMessageMediator
-
isLocationForwardReply
public boolean isLocationForwardReply()- Specified by:
isLocationForwardReply
in interfaceMessageMediator
-
isDifferentAddrDispositionRequestedReply
public boolean isDifferentAddrDispositionRequestedReply()- Specified by:
isDifferentAddrDispositionRequestedReply
in interfaceMessageMediator
-
getAddrDispositionReply
public short getAddrDispositionReply()- Specified by:
getAddrDispositionReply
in interfaceMessageMediator
-
getForwardedIOR
- Specified by:
getForwardedIOR
in interfaceMessageMediator
-
getSystemExceptionReply
- Specified by:
getSystemExceptionReply
in interfaceMessageMediator
-
getObjectKeyCacheEntry
- Specified by:
getObjectKeyCacheEntry
in interfaceMessageMediator
-
getProtocolHandler
- Specified by:
getProtocolHandler
in interfaceMessageMediator
-
createReply
Description copied from interface:ResponseHandler
Called by the servant during a method invocation. The servant should call this method to create a reply marshal buffer if no exception occurred.- Specified by:
createReply
in interfaceMessageMediator
- Specified by:
createReply
in interfaceResponseHandler
- Returns:
- an OutputStream suitable for marshalling the reply.
- See Also:
-
createExceptionReply
Description copied from interface:ResponseHandler
Called by the servant during a method invocation. The servant should call this method to create a reply marshal buffer if a user exception occurred.- Specified by:
createExceptionReply
in interfaceMessageMediator
- Specified by:
createExceptionReply
in interfaceResponseHandler
- Returns:
- an OutputStream suitable for marshalling the exception ID and the user exception body.
-
executeReturnServantInResponseConstructor
public boolean executeReturnServantInResponseConstructor()- Specified by:
executeReturnServantInResponseConstructor
in interfaceMessageMediator
-
setExecuteReturnServantInResponseConstructor
public void setExecuteReturnServantInResponseConstructor(boolean b) - Specified by:
setExecuteReturnServantInResponseConstructor
in interfaceMessageMediator
-
executeRemoveThreadInfoInResponseConstructor
public boolean executeRemoveThreadInfoInResponseConstructor()- Specified by:
executeRemoveThreadInfoInResponseConstructor
in interfaceMessageMediator
-
setExecuteRemoveThreadInfoInResponseConstructor
public void setExecuteRemoveThreadInfoInResponseConstructor(boolean b) - Specified by:
setExecuteRemoveThreadInfoInResponseConstructor
in interfaceMessageMediator
-
executePIInResponseConstructor
public boolean executePIInResponseConstructor()- Specified by:
executePIInResponseConstructor
in interfaceMessageMediator
-
setExecutePIInResponseConstructor
public void setExecutePIInResponseConstructor(boolean b) - Specified by:
setExecutePIInResponseConstructor
in interfaceMessageMediator
-
getStreamFormatVersionForThisRequest
-
handleRequest
- Specified by:
handleRequest
in interfaceProtocolHandler
-
messageInfo
-
connectionInfo
-
resumeOptimizedReadProcessing
-
poolToUseInfo
@InfoMethod private void poolToUseInfo(int id) -
addMessageMediatorToWorkQueue
-
setWorkThenPoolOrResumeOptimizedRead
-
setWorkThenReadOrResumeOptimizedRead
-
setInputObject
private void setInputObject() -
signalResponseReceived
private void signalResponseReceived() -
handleInput
Description copied from interface:MessageHandler
Used for message types for which we don't have concrete classes, yet, such as CloseConnection and MessageError, as well as unknown types.- Specified by:
handleInput
in interfaceMessageHandler
- Parameters:
header
- Message to handle- Throws:
IOException
- If an IO error occurs
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
requestIdInfo
@InfoMethod private void requestIdInfo(int id) -
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
unmarshalRequestID
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
moreFragmentsInfo
@InfoMethod private void moreFragmentsInfo(boolean moreFragments) -
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
reportGIOPVersion
-
handleInput
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
IOException
-
throwNotImplemented
-
processCancelRequest
private void processCancelRequest(int cancelReqId) -
handleRequest
- Specified by:
handleRequest
in interfaceProtocolHandler
-
handleRequest
- Specified by:
handleRequest
in interfaceProtocolHandler
-
beginRequest
-
dispatchError
-
sendResponse
-
endRequest
-
handleRequestRequest
-
handleLocateRequest
-
createAppropriateOutputObject
private CDROutputObject createAppropriateOutputObject(MessageMediator messageMediator, Message msg, LocateReplyMessage reply) -
handleThrowableDuringServerDispatch
public void handleThrowableDuringServerDispatch(MessageMediator messageMediator, Throwable throwable, CompletionStatus completionStatus) - Specified by:
handleThrowableDuringServerDispatch
in interfaceProtocolHandler
-
handleThrowableDuringServerDispatch
protected void handleThrowableDuringServerDispatch(MessageMediator messageMediator, Throwable throwable, CompletionStatus completionStatus, int iteration) -
convertThrowableToSystemException
protected SystemException convertThrowableToSystemException(Throwable throwable, CompletionStatus completionStatus) -
handleAddressingDisposition
protected void handleAddressingDisposition(MessageMediator messageMediator, AddressingDispositionException ex) -
createResponse
- Specified by:
createResponse
in interfaceProtocolHandler
-
createUserExceptionResponse
public MessageMediator createUserExceptionResponse(MessageMediator messageMediator, ServiceContexts svc) - Specified by:
createUserExceptionResponse
in interfaceProtocolHandler
-
createUnknownExceptionResponse
public MessageMediator createUnknownExceptionResponse(MessageMediator messageMediator, UnknownException ex) - Specified by:
createUnknownExceptionResponse
in interfaceProtocolHandler
-
createSystemExceptionResponse
public MessageMediator createSystemExceptionResponse(MessageMediator messageMediator, SystemException ex, ServiceContexts svc) - Specified by:
createSystemExceptionResponse
in interfaceProtocolHandler
-
addExceptionDetailMessage
private void addExceptionDetailMessage(MessageMediator mediator, SystemException ex, ServiceContexts serviceContexts) -
createLocationForward
public MessageMediator createLocationForward(MessageMediator messageMediator, IOR ior, ServiceContexts svc) - Specified by:
createLocationForward
in interfaceProtocolHandler
-
createResponseHelper
protected MessageMediator createResponseHelper(MessageMediator messageMediator, ServiceContexts svc) -
createResponseHelper
protected MessageMediator createResponseHelper(MessageMediator messageMediator, ServiceContexts svc, boolean user) -
createResponseHelperInfo
-
createResponseHelper
protected MessageMediator createResponseHelper(MessageMediator messageMediator, ReplyMessage reply, IOR ior) -
runServantPostInvoke
-
runInterceptors
-
runRemoveThreadInfo
-
generalMessage
-
getServiceContextsForReply
protected ServiceContexts getServiceContextsForReply(MessageMediator messageMediator, ServiceContexts contexts) -
releaseByteBufferToPool
private void releaseByteBufferToPool() -
cancelRequest
public void cancelRequest()- Specified by:
cancelRequest
in interfaceMessageMediator
-
ignoringThrowable
-
doWork
public void doWork()Execute dispatch in its own WorkerThread. Prior to this method being called this object must be initialized with a valid connection (CorbaConnection), orb (ORB), dispatchHeader (Message) and dispatchByteBuffer (ByteBuffer). -
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
-
getName
Description copied from interface:Work
This method will return the name of the work item.
-