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 booleanprotected booleanprotected booleanprotected shortprotected booleanprotected Connectionprotected ContactInfoprotected Requestprotected ByteBufferprotected Messageprivate longprotected CDRInputObjectprotected static final InterceptorsSystemExceptionprotected booleanprivate static byteprotected Messageprotected ORBprotected CDROutputObjectprotected ProtocolHandlerprotected Stringprotected LocateReplyOrReplyMessageprotected IORprotected RequestMessageprotected byteprotected booleanprotected static final ORBUtilSystemException -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMessageMediatorImpl(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 voidaddExceptionDetailMessage(MessageMediator mediator, SystemException ex, ServiceContexts serviceContexts) private voidaddMessageMediatorToWorkQueue(MessageMediator messageMediator) private voidbeginRequest(MessageMediator messageMediator) voidprivate voidconnectionInfo(Connection conn) protected SystemExceptionconvertThrowableToSystemException(Throwable throwable, CompletionStatus completionStatus) private CDROutputObjectcreateAppropriateOutputObject(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 MessageMediatorcreateResponseHelper(MessageMediator messageMediator, ReplyMessage reply, IOR ior) protected MessageMediatorcreateResponseHelper(MessageMediator messageMediator, ServiceContexts svc) protected MessageMediatorcreateResponseHelper(MessageMediator messageMediator, ServiceContexts svc, boolean user) private voidcreateSystemExceptionResponse(MessageMediator messageMediator, SystemException ex, ServiceContexts svc) createUnknownExceptionResponse(MessageMediator messageMediator, UnknownException ex) createUserExceptionResponse(MessageMediator messageMediator, ServiceContexts svc) booleandispatch()NOTE: This call is the transition from the transport block to the protocol block.private voiddispatchError(MessageMediator messageMediator, String msg, Throwable t) voiddoWork()Execute dispatch in its own WorkerThread.private voidendRequest(MessageMediator messageMediator) booleanbooleanbooleanvoidUsed to send the message (or its last fragment).private voidgeneralMessage(String msg) shortbytelongThis 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.intprotected ServiceContextsgetServiceContextsForReply(MessageMediator messageMediator, ServiceContexts contexts) bytebyteIf 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 bytegetStreamFormatVersionForThisRequest(IOR ior, GIOPVersion giopVersion) intprotected voidhandleAddressingDisposition(MessageMediator messageMediator, AddressingDispositionException ex) voidhandleDIIReply(InputStream inputStream) voidhandleInput(CancelRequestMessage header) voidhandleInput(FragmentMessage_1_1 header) voidhandleInput(FragmentMessage_1_2 header) voidhandleInput(LocateReplyMessage_1_0 header) voidhandleInput(LocateReplyMessage_1_1 header) voidhandleInput(LocateReplyMessage_1_2 header) voidhandleInput(LocateRequestMessage_1_0 header) voidhandleInput(LocateRequestMessage_1_1 header) voidhandleInput(LocateRequestMessage_1_2 header) voidhandleInput(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.voidhandleInput(ReplyMessage_1_0 header) voidhandleInput(ReplyMessage_1_1 header) voidhandleInput(ReplyMessage_1_2 header) voidhandleInput(RequestMessage_1_0 header) voidhandleInput(RequestMessage_1_1 header) voidhandleInput(RequestMessage_1_2 header) protected voidhandleLocateRequest(MessageMediator messageMediator) voidhandleRequest(LocateRequestMessage msg, MessageMediator messageMediator) voidhandleRequest(RequestMessage msg, MessageMediator messageMediator) booleanhandleRequest(MessageMediator messageMediator) protected voidhandleRequestRequest(MessageMediator messageMediator) voidhandleThrowableDuringServerDispatch(MessageMediator messageMediator, Throwable throwable, CompletionStatus completionStatus) protected voidhandleThrowableDuringServerDispatch(MessageMediator messageMediator, Throwable throwable, CompletionStatus completionStatus, int iteration) private voidvoidUsed to initialize message headers.booleanbooleanbooleanbooleanisOneWay()booleanbooleanprivate voidmessageInfo(Message msg, RequestId rid) private voidmoreFragmentsInfo(boolean moreFragments) private voidpoolToUseInfo(int id) private voidprocessCancelRequest(int cancelReqId) private voidprivate voidreportConnection(Connection conn) private voidreportException(String msg, Throwable thr) private voidreportGIOPVersion(GIOPVersion vers) private voidrequestIdInfo(int id) private voidresumeOptimizedReadProcessing(Message message) protected voidrunInterceptors(MessageMediator messageMediator, ReplyMessage reply) protected voidrunRemoveThreadInfo(MessageMediator messageMediator) protected voidrunServantPostInvoke(MessageMediator messageMediator) voidprivate voidsendResponse(MessageMediator messageMediator) booleanbooleanvoidsetDIIException(Exception exception) voidsetDIIInfo(Request diiRequest) voidsetEnqueueTime(long timeInMillis) This methods sets the time in millis in the work item, when this work item was enqueued in the work queue.voidsetExecutePIInResponseConstructor(boolean b) voidvoidsetExecuteReturnServantInResponseConstructor(boolean b) private voidvoidsetInputObject(CDRInputObject inputObject) voidsetOutputObject(CDROutputObject outputObject) voidsetReplyExceptionDetailMessage(String message) voidvoidprivate voidprivate voidprivate voidprivate voidunmarshalDIIUserException(String repoId, InputStream is) private voidunmarshalRequestID(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:
getRequestIdFromRawBytesin interfaceMessageMediator
-
getBroker
- Specified by:
getBrokerin interfaceMessageMediator
-
getContactInfo
- Specified by:
getContactInfoin interfaceMessageMediator
-
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
- Specified by:
waitForResponsein interfaceMessageMediator
-
setOutputObject
- Specified by:
setOutputObjectin interfaceMessageMediator
-
getOutputObject
- Specified by:
getOutputObjectin interfaceMessageMediator
-
setInputObject
- Specified by:
setInputObjectin interfaceMessageMediator
-
getInputObject
- Specified by:
getInputObjectin interfaceMessageMediator
-
setReplyHeader
- Specified by:
setReplyHeaderin interfaceMessageMediator
-
getLocateReplyHeader
- Specified by:
getLocateReplyHeaderin interfaceMessageMediator
-
getReplyHeader
- Specified by:
getReplyHeaderin interfaceMessageMediator
-
setReplyExceptionDetailMessage
- Specified by:
setReplyExceptionDetailMessagein interfaceMessageMediator
-
getRequestHeader
- Specified by:
getRequestHeaderin interfaceMessageMediator
-
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
- Specified by:
getOperationNamein interfaceMessageMediator
-
getRequestServiceContexts
- Specified by:
getRequestServiceContextsin interfaceMessageMediator
-
setRequestServiceContexts
- Specified by:
setRequestServiceContextsin interfaceMessageMediator
-
getReplyServiceContexts
- Specified by:
getReplyServiceContextsin interfaceMessageMediator
-
sendCancelRequestIfFinalFragmentNotSent
public void sendCancelRequestIfFinalFragmentNotSent()- Specified by:
sendCancelRequestIfFinalFragmentNotSentin interfaceMessageMediator
-
sentFullMessage
public boolean sentFullMessage() -
sentFragment
public boolean sentFragment() -
setDIIInfo
- Specified by:
setDIIInfoin interfaceMessageMediator
-
isDIIRequest
public boolean isDIIRequest()- Specified by:
isDIIRequestin interfaceMessageMediator
-
unmarshalDIIUserException
- Specified by:
unmarshalDIIUserExceptionin interfaceMessageMediator
-
setDIIException
- Specified by:
setDIIExceptionin interfaceMessageMediator
-
handleDIIReply
- Specified by:
handleDIIReplyin interfaceMessageMediator
-
getDispatchHeader
- Specified by:
getDispatchHeaderin interfaceMessageMediator
-
getThreadPoolToUse
public int getThreadPoolToUse()- Specified by:
getThreadPoolToUsein interfaceMessageMediator
-
reportException
-
reportConnection
-
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
- Specified by:
getForwardedIORin interfaceMessageMediator
-
getSystemExceptionReply
- Specified by:
getSystemExceptionReplyin interfaceMessageMediator
-
getObjectKeyCacheEntry
- Specified by:
getObjectKeyCacheEntryin interfaceMessageMediator
-
getProtocolHandler
- Specified by:
getProtocolHandlerin interfaceMessageMediator
-
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:
-
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
-
handleRequest
- Specified by:
handleRequestin 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: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:
IOException- If an IO error occurs
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
requestIdInfo
@InfoMethod private void requestIdInfo(int id) -
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
unmarshalRequestID
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
moreFragmentsInfo
@InfoMethod private void moreFragmentsInfo(boolean moreFragments) -
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
reportGIOPVersion
-
handleInput
- Specified by:
handleInputin interfaceMessageHandler- Throws:
IOException
-
throwNotImplemented
-
processCancelRequest
private void processCancelRequest(int cancelReqId) -
handleRequest
- Specified by:
handleRequestin interfaceProtocolHandler
-
handleRequest
- Specified by:
handleRequestin 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:
handleThrowableDuringServerDispatchin 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:
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
-
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:
cancelRequestin 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: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
-
getName
Description copied from interface:WorkThis method will return the name of the work item.
-