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 java.lang.Object implements MessageMediator, ProtocolHandler, MessageHandler, Work
-
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description private
MessageMediatorImpl(ORB orb, Connection connection)
MessageMediatorImpl(ORB orb, Connection connection, Message dispatchHeader, java.nio.ByteBuffer byteBuffer)
MessageMediatorImpl(ORB orb, ContactInfo contactInfo, Connection connection, GIOPVersion giopVersion, IOR ior, int requestId, short addrDisposition, java.lang.String operationName, boolean isOneWay)
-
Method Summary
-
-
-
Field Detail
-
wrapper
protected static final ORBUtilSystemException wrapper
-
interceptorWrapper
protected static final InterceptorsSystemException interceptorWrapper
-
orb
protected ORB orb
-
contactInfo
protected ContactInfo contactInfo
-
connection
protected Connection connection
-
addrDisposition
protected short addrDisposition
-
outputObject
protected CDROutputObject outputObject
-
inputObject
protected CDRInputObject inputObject
-
messageHeader
protected Message messageHeader
-
requestHeader
protected RequestMessage requestHeader
-
replyHeader
protected LocateReplyOrReplyMessage replyHeader
-
replyExceptionDetailMessage
protected java.lang.String replyExceptionDetailMessage
-
replyIOR
protected IOR replyIOR
-
dispatchHeader
protected Message dispatchHeader
-
dispatchByteBuffer
protected java.nio.ByteBuffer dispatchByteBuffer
-
streamFormatVersion
protected byte streamFormatVersion
-
streamFormatVersionSet
protected boolean streamFormatVersionSet
-
diiRequest
protected Request diiRequest
-
cancelRequestAlreadySent
protected boolean cancelRequestAlreadySent
-
protocolHandler
protected ProtocolHandler 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 Detail
-
MessageMediatorImpl
public MessageMediatorImpl(ORB orb, ContactInfo contactInfo, Connection connection, GIOPVersion giopVersion, IOR ior, int requestId, short addrDisposition, java.lang.String operationName, boolean isOneWay)
-
MessageMediatorImpl
private MessageMediatorImpl(ORB orb, Connection connection)
-
MessageMediatorImpl
public MessageMediatorImpl(ORB orb, Connection connection, Message dispatchHeader, java.nio.ByteBuffer byteBuffer)
-
-
Method Detail
-
getRequestIdFromRawBytes
public RequestId getRequestIdFromRawBytes()
- Specified by:
getRequestIdFromRawBytes
in interfaceMessageMediator
-
getBroker
public ORB getBroker()
- Specified by:
getBroker
in interfaceMessageMediator
-
getContactInfo
public ContactInfo getContactInfo()
- Specified by:
getContactInfo
in interfaceMessageMediator
-
getConnection
public Connection 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
public CDRInputObject waitForResponse()
- Specified by:
waitForResponse
in interfaceMessageMediator
-
setOutputObject
public void setOutputObject(CDROutputObject outputObject)
- Specified by:
setOutputObject
in interfaceMessageMediator
-
getOutputObject
public CDROutputObject getOutputObject()
- Specified by:
getOutputObject
in interfaceMessageMediator
-
setInputObject
public void setInputObject(CDRInputObject inputObject)
- Specified by:
setInputObject
in interfaceMessageMediator
-
getInputObject
public CDRInputObject getInputObject()
- Specified by:
getInputObject
in interfaceMessageMediator
-
setReplyHeader
public void setReplyHeader(LocateReplyOrReplyMessage header)
- Specified by:
setReplyHeader
in interfaceMessageMediator
-
getLocateReplyHeader
public LocateReplyMessage getLocateReplyHeader()
- Specified by:
getLocateReplyHeader
in interfaceMessageMediator
-
getReplyHeader
public ReplyMessage getReplyHeader()
- Specified by:
getReplyHeader
in interfaceMessageMediator
-
setReplyExceptionDetailMessage
public void setReplyExceptionDetailMessage(java.lang.String message)
- Specified by:
setReplyExceptionDetailMessage
in interfaceMessageMediator
-
getRequestHeader
public RequestMessage getRequestHeader()
- Specified by:
getRequestHeader
in interfaceMessageMediator
-
getGIOPVersion
public GIOPVersion 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
public java.lang.String getOperationName()
- Specified by:
getOperationName
in interfaceMessageMediator
-
getRequestServiceContexts
public ServiceContexts getRequestServiceContexts()
- Specified by:
getRequestServiceContexts
in interfaceMessageMediator
-
setRequestServiceContexts
public void setRequestServiceContexts(ServiceContexts sc)
- Specified by:
setRequestServiceContexts
in interfaceMessageMediator
-
getReplyServiceContexts
public ServiceContexts getReplyServiceContexts()
- Specified by:
getReplyServiceContexts
in interfaceMessageMediator
-
sendCancelRequestIfFinalFragmentNotSent
public void sendCancelRequestIfFinalFragmentNotSent()
- Specified by:
sendCancelRequestIfFinalFragmentNotSent
in interfaceMessageMediator
-
sentFullMessage
public boolean sentFullMessage()
-
sentFragment
public boolean sentFragment()
-
setDIIInfo
public void setDIIInfo(Request diiRequest)
- Specified by:
setDIIInfo
in interfaceMessageMediator
-
isDIIRequest
public boolean isDIIRequest()
- Specified by:
isDIIRequest
in interfaceMessageMediator
-
unmarshalDIIUserException
public java.lang.Exception unmarshalDIIUserException(java.lang.String repoId, InputStream is)
- Specified by:
unmarshalDIIUserException
in interfaceMessageMediator
-
setDIIException
public void setDIIException(java.lang.Exception exception)
- Specified by:
setDIIException
in interfaceMessageMediator
-
handleDIIReply
public void handleDIIReply(InputStream inputStream)
- Specified by:
handleDIIReply
in interfaceMessageMediator
-
getDispatchHeader
public Message getDispatchHeader()
- Specified by:
getDispatchHeader
in interfaceMessageMediator
-
getThreadPoolToUse
public int getThreadPoolToUse()
- Specified by:
getThreadPoolToUse
in interfaceMessageMediator
-
reportException
@InfoMethod private void reportException(java.lang.String msg, java.lang.Throwable thr)
-
reportConnection
@InfoMethod private void reportConnection(Connection conn)
-
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
public IOR getForwardedIOR()
- Specified by:
getForwardedIOR
in interfaceMessageMediator
-
getSystemExceptionReply
public SystemException getSystemExceptionReply()
- Specified by:
getSystemExceptionReply
in interfaceMessageMediator
-
getObjectKeyCacheEntry
public ObjectKeyCacheEntry getObjectKeyCacheEntry()
- Specified by:
getObjectKeyCacheEntry
in interfaceMessageMediator
-
getProtocolHandler
public ProtocolHandler getProtocolHandler()
- Specified by:
getProtocolHandler
in interfaceMessageMediator
-
createReply
public OutputStream 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:
portable
package comments for unimplemented features
-
createExceptionReply
public OutputStream 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
private byte getStreamFormatVersionForThisRequest(IOR ior, GIOPVersion giopVersion)
-
handleRequest
public boolean handleRequest(MessageMediator messageMediator)
- Specified by:
handleRequest
in interfaceProtocolHandler
-
connectionInfo
@InfoMethod private void connectionInfo(Connection conn)
-
resumeOptimizedReadProcessing
private void resumeOptimizedReadProcessing(Message message)
-
poolToUseInfo
@InfoMethod private void poolToUseInfo(int id)
-
addMessageMediatorToWorkQueue
private void addMessageMediatorToWorkQueue(MessageMediator messageMediator)
-
setWorkThenPoolOrResumeOptimizedRead
private void setWorkThenPoolOrResumeOptimizedRead(Message header)
-
setWorkThenReadOrResumeOptimizedRead
private void setWorkThenReadOrResumeOptimizedRead(Message header)
-
setInputObject
private void setInputObject()
-
signalResponseReceived
private void signalResponseReceived()
-
handleInput
public void handleInput(Message header) throws java.io.IOException
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:
java.io.IOException
- If an IO error occurs
-
handleInput
public void handleInput(RequestMessage_1_0 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
handleInput
public void handleInput(RequestMessage_1_1 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
requestIdInfo
@InfoMethod private void requestIdInfo(int id)
-
handleInput
public void handleInput(RequestMessage_1_2 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
unmarshalRequestID
private void unmarshalRequestID(Message_1_2 message)
-
handleInput
public void handleInput(ReplyMessage_1_0 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
handleInput
public void handleInput(ReplyMessage_1_1 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
moreFragmentsInfo
@InfoMethod private void moreFragmentsInfo(boolean moreFragments)
-
handleInput
public void handleInput(ReplyMessage_1_2 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateRequestMessage_1_0 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateRequestMessage_1_1 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateRequestMessage_1_2 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateReplyMessage_1_0 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateReplyMessage_1_1 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateReplyMessage_1_2 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
handleInput
public void handleInput(FragmentMessage_1_1 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
handleInput
public void handleInput(FragmentMessage_1_2 header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
reportGIOPVersion
@InfoMethod private void reportGIOPVersion(GIOPVersion vers)
-
handleInput
public void handleInput(CancelRequestMessage header) throws java.io.IOException
- Specified by:
handleInput
in interfaceMessageHandler
- Throws:
java.io.IOException
-
throwNotImplemented
private void throwNotImplemented(java.lang.String msg)
-
processCancelRequest
private void processCancelRequest(int cancelReqId)
-
handleRequest
public void handleRequest(RequestMessage msg, MessageMediator messageMediator)
- Specified by:
handleRequest
in interfaceProtocolHandler
-
handleRequest
public void handleRequest(LocateRequestMessage msg, MessageMediator messageMediator)
- Specified by:
handleRequest
in interfaceProtocolHandler
-
beginRequest
private void beginRequest(MessageMediator messageMediator)
-
dispatchError
private void dispatchError(MessageMediator messageMediator, java.lang.String msg, java.lang.Throwable t)
-
sendResponse
private void sendResponse(MessageMediator messageMediator)
-
endRequest
private void endRequest(MessageMediator messageMediator)
-
handleRequestRequest
protected void handleRequestRequest(MessageMediator messageMediator)
-
handleLocateRequest
protected void handleLocateRequest(MessageMediator messageMediator)
-
createAppropriateOutputObject
private CDROutputObject createAppropriateOutputObject(MessageMediator messageMediator, Message msg, LocateReplyMessage reply)
-
handleThrowableDuringServerDispatch
public void handleThrowableDuringServerDispatch(MessageMediator messageMediator, java.lang.Throwable throwable, CompletionStatus completionStatus)
- Specified by:
handleThrowableDuringServerDispatch
in interfaceProtocolHandler
-
handleThrowableDuringServerDispatch
protected void handleThrowableDuringServerDispatch(MessageMediator messageMediator, java.lang.Throwable throwable, CompletionStatus completionStatus, int iteration)
-
convertThrowableToSystemException
protected SystemException convertThrowableToSystemException(java.lang.Throwable throwable, CompletionStatus completionStatus)
-
handleAddressingDisposition
protected void handleAddressingDisposition(MessageMediator messageMediator, AddressingDispositionException ex)
-
createResponse
public MessageMediator createResponse(MessageMediator messageMediator, ServiceContexts svc)
- 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
@InfoMethod private void createResponseHelperInfo(ReplyMessage reply)
-
createResponseHelper
protected MessageMediator createResponseHelper(MessageMediator messageMediator, ReplyMessage reply, IOR ior)
-
runServantPostInvoke
protected void runServantPostInvoke(MessageMediator messageMediator)
-
runInterceptors
protected void runInterceptors(MessageMediator messageMediator, ReplyMessage reply)
-
runRemoveThreadInfo
protected void runRemoveThreadInfo(MessageMediator messageMediator)
-
generalMessage
@InfoMethod private void generalMessage(java.lang.String msg)
-
getServiceContextsForReply
protected ServiceContexts getServiceContextsForReply(MessageMediator messageMediator, ServiceContexts contexts)
-
releaseByteBufferToPool
private void releaseByteBufferToPool()
-
cancelRequest
public void cancelRequest()
- Specified by:
cancelRequest
in interfaceMessageMediator
-
ignoringThrowable
@InfoMethod private void ignoringThrowable(java.lang.Throwable thr)
-
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
-
-