Package org.jacorb.orb.portableInterceptor

Examples of org.jacorb.orb.portableInterceptor.ClientInterceptorHandler


            checkTimeout (reqET, repET);
        }

        ReplyReceiver       receiver = null;
        final ClientInterceptorHandler interceptors;

        if (orb.hasClientRequestInterceptors())
        {
            interceptors = new DefaultClientInterceptorHandler
            (
                    (DefaultClientInterceptorHandler)localInterceptors.get(),
                    orb,
                    ros,
                    self,
                    this,
                    piorOriginal,
                    connections[currentConnection.ordinal ()]
            );
        }
        else
        {
            interceptors = NullClientInterceptorHandler.getInstance();
        }

        if ( connections[currentConnection.ordinal ()] != null )
        {
           orb.notifyTransportListeners (connections[currentConnection.ordinal ()].getGIOPConnection());
        }

        if (orb.hasRequestInterceptors())
        {
            localInterceptors.set(interceptors);

            try
            {
                interceptors.handle_send_request();
            }
            catch (ForwardRequest fwd)
            {
                // Should not happen for remote requests
            }
            catch (RemarshalException re)
            {
                // RemarshalExceptions explicitely caught, because in
                // that case, localInterceptors must stay set
                throw re;
            }
            catch (RuntimeException e)
            {
                // If we are throwing a system exception then this will disrupt the call path.
                // Therefore nullify localInterceptors so it doesn't appear we are still in an
                // interceptor call.
                localInterceptors.set(null);

                throw e;
            }
        }

        ClientConnection connectionToUse = null;

        ReplyGroup group = null;
        try
        {
            synchronized (bind_sync)
            {
               if ( ! bound )
               {
                  // Somehow the connection got closed under us
                  throw new COMM_FAILURE("Connection closed");
               }
               else if (ros.getConnection() == connections[currentConnection.ordinal ()])
               {
                  // RequestOutputStream has been created for
                  // exactly this connection
                  connectionToUse = connections[currentConnection.ordinal ()];
               }
               else
               {
                    logger.debug("invoke: RemarshalException");

                    // RequestOutputStream has been created for
                    // another connection, so try again
                    throw new RemarshalException();
                }
            }

            group = getReplyGroup (connectionToUse);
            if ( !ros.response_expected() )  // oneway op
            {
                invoke_oneway (ros, connectionToUse, interceptors, group);
            }
            else
            {
                // response expected, synchronous or asynchronous
                receiver = new ReplyReceiver(this, group,
                                             ros.operation(),
                                             ros.getReplyEndTime(),
                                            interceptors, replyHandler, selectorManager);

                try
                {
                   receiver.configure(configuration);
                }
                catch (ConfigurationException ex)
                {
                   logger.error ("Configuration problem with ReplyReceiver", ex);
                   throw new INTERNAL ("Caught configuration exception setting up ReplyReceiver.");
                }

                group.addHolder (receiver);

                // Use the local copy of the client connection to avoid trouble
                // with something else affecting the real connections[currentConnection].
                connectionToUse.sendRequest(ros, receiver, ros.requestId(), true);
                getParsedIOR ().markLastUsedProfile ();
            }
        }
        catch ( org.omg.CORBA.SystemException cfe )
        {
            logger.debug("invoke[-->]: SystemException", cfe);

            if( !async )
            {
                // Remove ReplyReceiver to break up reference cycle
                // Otherwise gc will not detect this Delegate and
                // will never finalize it.
                if (group != null)
                    group.removeHolder(receiver);
            }

            try
            {
                interceptors.handle_receive_exception ( cfe );
            }
            catch (ForwardRequest fwd)
            {
                // Should not happen for remote requests
            }
View Full Code Here

TOP

Related Classes of org.jacorb.orb.portableInterceptor.ClientInterceptorHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.