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 privateMessageMediatorImpl(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:
getRequestIdFromRawBytesin interfaceMessageMediator
-
getBroker
public ORB getBroker()
- Specified by:
getBrokerin interfaceMessageMediator
-
getContactInfo
public ContactInfo getContactInfo()
- Specified by:
getContactInfoin interfaceMessageMediator
-
getConnection
public Connection getConnection()
- Specified by:
getConnectionin interfaceMessageMediator
-
initializeMessage
public void initializeMessage()
Description copied from interface:MessageMediatorUsed to initialize message headers. Note: this should be moved to aRequestDispatcher.- Specified by:
initializeMessagein interfaceMessageMediator
-
finishSendingRequest
public void finishSendingRequest()
Description copied from interface:MessageMediatorUsed to send the message (or its last fragment). Note: this should be moved to aRequestDispatcher.- Specified by:
finishSendingRequestin interfaceMessageMediator
-
waitForResponse
public CDRInputObject waitForResponse()
- Specified by:
waitForResponsein interfaceMessageMediator
-
setOutputObject
public void setOutputObject(CDROutputObject outputObject)
- Specified by:
setOutputObjectin interfaceMessageMediator
-
getOutputObject
public CDROutputObject getOutputObject()
- Specified by:
getOutputObjectin interfaceMessageMediator
-
setInputObject
public void setInputObject(CDRInputObject inputObject)
- Specified by:
setInputObjectin interfaceMessageMediator
-
getInputObject
public CDRInputObject getInputObject()
- Specified by:
getInputObjectin interfaceMessageMediator
-
setReplyHeader
public void setReplyHeader(LocateReplyOrReplyMessage header)
- Specified by:
setReplyHeaderin interfaceMessageMediator
-
getLocateReplyHeader
public LocateReplyMessage getLocateReplyHeader()
- Specified by:
getLocateReplyHeaderin interfaceMessageMediator
-
getReplyHeader
public ReplyMessage getReplyHeader()
- Specified by:
getReplyHeaderin interfaceMessageMediator
-
setReplyExceptionDetailMessage
public void setReplyExceptionDetailMessage(java.lang.String message)
- Specified by:
setReplyExceptionDetailMessagein interfaceMessageMediator
-
getRequestHeader
public RequestMessage getRequestHeader()
- Specified by:
getRequestHeaderin interfaceMessageMediator
-
getGIOPVersion
public GIOPVersion getGIOPVersion()
- Specified by:
getGIOPVersionin interfaceMessageMediator
-
getEncodingVersion
public byte getEncodingVersion()
- Specified by:
getEncodingVersionin interfaceMessageMediator
-
getRequestId
public int getRequestId()
- Specified by:
getRequestIdin interfaceMessageMediator
-
isOneWay
public boolean isOneWay()
- Specified by:
isOneWayin interfaceMessageMediator
-
getOperationName
public java.lang.String getOperationName()
- Specified by:
getOperationNamein interfaceMessageMediator
-
getRequestServiceContexts
public ServiceContexts getRequestServiceContexts()
- Specified by:
getRequestServiceContextsin interfaceMessageMediator
-
setRequestServiceContexts
public void setRequestServiceContexts(ServiceContexts sc)
- Specified by:
setRequestServiceContextsin interfaceMessageMediator
-
getReplyServiceContexts
public ServiceContexts getReplyServiceContexts()
- Specified by:
getReplyServiceContextsin interfaceMessageMediator
-
sendCancelRequestIfFinalFragmentNotSent
public void sendCancelRequestIfFinalFragmentNotSent()
- Specified by:
sendCancelRequestIfFinalFragmentNotSentin interfaceMessageMediator
-
sentFullMessage
public boolean sentFullMessage()
-
sentFragment
public boolean sentFragment()
-
setDIIInfo
public void setDIIInfo(Request diiRequest)
- Specified by:
setDIIInfoin interfaceMessageMediator
-
isDIIRequest
public boolean isDIIRequest()
- Specified by:
isDIIRequestin interfaceMessageMediator
-
unmarshalDIIUserException
public java.lang.Exception unmarshalDIIUserException(java.lang.String repoId, InputStream is)- Specified by:
unmarshalDIIUserExceptionin interfaceMessageMediator
-
setDIIException
public void setDIIException(java.lang.Exception exception)
- Specified by:
setDIIExceptionin interfaceMessageMediator
-
handleDIIReply
public void handleDIIReply(InputStream inputStream)
- Specified by:
handleDIIReplyin interfaceMessageMediator
-
getDispatchHeader
public Message getDispatchHeader()
- Specified by:
getDispatchHeaderin interfaceMessageMediator
-
getThreadPoolToUse
public int getThreadPoolToUse()
- Specified by:
getThreadPoolToUsein 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:
dispatchin interfaceMessageMediator
-
getStreamFormatVersion
public byte getStreamFormatVersion()
- Specified by:
getStreamFormatVersionin 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:
getStreamFormatVersionForReplyin interfaceMessageMediator
-
isSystemExceptionReply
public boolean isSystemExceptionReply()
- Specified by:
isSystemExceptionReplyin interfaceMessageMediator
-
isUserExceptionReply
public boolean isUserExceptionReply()
- Specified by:
isUserExceptionReplyin interfaceMessageMediator
-
isLocationForwardReply
public boolean isLocationForwardReply()
- Specified by:
isLocationForwardReplyin interfaceMessageMediator
-
isDifferentAddrDispositionRequestedReply
public boolean isDifferentAddrDispositionRequestedReply()
- Specified by:
isDifferentAddrDispositionRequestedReplyin interfaceMessageMediator
-
getAddrDispositionReply
public short getAddrDispositionReply()
- Specified by:
getAddrDispositionReplyin interfaceMessageMediator
-
getForwardedIOR
public IOR getForwardedIOR()
- Specified by:
getForwardedIORin interfaceMessageMediator
-
getSystemExceptionReply
public SystemException getSystemExceptionReply()
- Specified by:
getSystemExceptionReplyin interfaceMessageMediator
-
getObjectKeyCacheEntry
public ObjectKeyCacheEntry getObjectKeyCacheEntry()
- Specified by:
getObjectKeyCacheEntryin interfaceMessageMediator
-
getProtocolHandler
public ProtocolHandler getProtocolHandler()
- Specified by:
getProtocolHandlerin interfaceMessageMediator
-
createReply
public OutputStream createReply()
Description copied from interface:ResponseHandlerCalled 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:
createReplyin interfaceMessageMediator- Specified by:
createReplyin interfaceResponseHandler- Returns:
- an OutputStream suitable for marshalling the reply.
- See Also:
portablepackage comments for unimplemented features
-
createExceptionReply
public OutputStream createExceptionReply()
Description copied from interface:ResponseHandlerCalled 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:
createExceptionReplyin interfaceMessageMediator- Specified by:
createExceptionReplyin interfaceResponseHandler- Returns:
- an OutputStream suitable for marshalling the exception ID and the user exception body.
-
executeReturnServantInResponseConstructor
public boolean executeReturnServantInResponseConstructor()
- Specified by:
executeReturnServantInResponseConstructorin interfaceMessageMediator
-
setExecuteReturnServantInResponseConstructor
public void setExecuteReturnServantInResponseConstructor(boolean b)
- Specified by:
setExecuteReturnServantInResponseConstructorin interfaceMessageMediator
-
executeRemoveThreadInfoInResponseConstructor
public boolean executeRemoveThreadInfoInResponseConstructor()
- Specified by:
executeRemoveThreadInfoInResponseConstructorin interfaceMessageMediator
-
setExecuteRemoveThreadInfoInResponseConstructor
public void setExecuteRemoveThreadInfoInResponseConstructor(boolean b)
- Specified by:
setExecuteRemoveThreadInfoInResponseConstructorin interfaceMessageMediator
-
executePIInResponseConstructor
public boolean executePIInResponseConstructor()
- Specified by:
executePIInResponseConstructorin interfaceMessageMediator
-
setExecutePIInResponseConstructor
public void setExecutePIInResponseConstructor(boolean b)
- Specified by:
setExecutePIInResponseConstructorin interfaceMessageMediator
-
getStreamFormatVersionForThisRequest
private byte getStreamFormatVersionForThisRequest(IOR ior, GIOPVersion giopVersion)
-
handleRequest
public boolean handleRequest(MessageMediator messageMediator)
- Specified by:
handleRequestin 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:MessageHandlerUsed for message types for which we don't have concrete classes, yet, such as CloseConnection and MessageError, as well as unknown types.- Specified by:
handleInputin 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:
handleInputin interfaceMessageHandler- Throws:
java.io.IOException
-
handleInput
public void handleInput(RequestMessage_1_1 header) throws java.io.IOException
- Specified by:
handleInputin 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:
handleInputin 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:
handleInputin interfaceMessageHandler- Throws:
java.io.IOException
-
handleInput
public void handleInput(ReplyMessage_1_1 header) throws java.io.IOException
- Specified by:
handleInputin 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:
handleInputin interfaceMessageHandler- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateRequestMessage_1_0 header) throws java.io.IOException
- Specified by:
handleInputin interfaceMessageHandler- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateRequestMessage_1_1 header) throws java.io.IOException
- Specified by:
handleInputin interfaceMessageHandler- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateRequestMessage_1_2 header) throws java.io.IOException
- Specified by:
handleInputin interfaceMessageHandler- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateReplyMessage_1_0 header) throws java.io.IOException
- Specified by:
handleInputin interfaceMessageHandler- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateReplyMessage_1_1 header) throws java.io.IOException
- Specified by:
handleInputin interfaceMessageHandler- Throws:
java.io.IOException
-
handleInput
public void handleInput(LocateReplyMessage_1_2 header) throws java.io.IOException
- Specified by:
handleInputin interfaceMessageHandler- Throws:
java.io.IOException
-
handleInput
public void handleInput(FragmentMessage_1_1 header) throws java.io.IOException
- Specified by:
handleInputin interfaceMessageHandler- Throws:
java.io.IOException
-
handleInput
public void handleInput(FragmentMessage_1_2 header) throws java.io.IOException
- Specified by:
handleInputin interfaceMessageHandler- Throws:
java.io.IOException
-
reportGIOPVersion
@InfoMethod private void reportGIOPVersion(GIOPVersion vers)
-
handleInput
public void handleInput(CancelRequestMessage header) throws java.io.IOException
- Specified by:
handleInputin 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:
handleRequestin interfaceProtocolHandler
-
handleRequest
public void handleRequest(LocateRequestMessage msg, MessageMediator messageMediator)
- Specified by:
handleRequestin 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:
handleThrowableDuringServerDispatchin 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:
createResponsein interfaceProtocolHandler
-
createUserExceptionResponse
public MessageMediator createUserExceptionResponse(MessageMediator messageMediator, ServiceContexts svc)
- Specified by:
createUserExceptionResponsein interfaceProtocolHandler
-
createUnknownExceptionResponse
public MessageMediator createUnknownExceptionResponse(MessageMediator messageMediator, UnknownException ex)
- Specified by:
createUnknownExceptionResponsein interfaceProtocolHandler
-
createSystemExceptionResponse
public MessageMediator createSystemExceptionResponse(MessageMediator messageMediator, SystemException ex, ServiceContexts svc)
- Specified by:
createSystemExceptionResponsein interfaceProtocolHandler
-
addExceptionDetailMessage
private void addExceptionDetailMessage(MessageMediator mediator, SystemException ex, ServiceContexts serviceContexts)
-
createLocationForward
public MessageMediator createLocationForward(MessageMediator messageMediator, IOR ior, ServiceContexts svc)
- Specified by:
createLocationForwardin 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:
cancelRequestin 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:WorkThis methods sets the time in millis in the work item, when this work item was enqueued in the work queue.- Specified by:
setEnqueueTimein interfaceWork
-
getEnqueueTime
public long getEnqueueTime()
Description copied from interface:WorkThis methods gets the time in millis in the work item, when this work item was enqueued in the work queue.- Specified by:
getEnqueueTimein interfaceWork
-
-