Package org.jacorb.orb.giop

Examples of org.jacorb.orb.giop.RequestOutputStream


                                 boolean async )
        throws ApplicationException, RemarshalException
    {
        checkORB();

        RequestOutputStream ros      = (RequestOutputStream)os;
        ReplyReceiver       receiver = null;
        final ClientInterceptorHandler interceptors = new ClientInterceptorHandler
        (
            (ClientInterceptorHandler)localInterceptors.get(),
            orb,
            ros,
            self,
            this,
            piorOriginal,
            connection
        );

        orb.notifyTransportListeners (connection.getGIOPConnection());

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

            try
            {
                interceptors.handle_send_request();
            }
            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. RemarshalExceptions are explicitely not caught, because in
                // that case, localInterceptors must stay set

                localInterceptors.set(null);
                throw e;
            }
        }
        else
        {
            interceptors.handle_send_request();
        }


        try
        {
            if ( !ros.response_expected() )  // oneway op
            {
                invoke_oneway (ros, interceptors);
                return null;
            }
            // response expected, synchronous or asynchronous
            receiver = new ReplyReceiver(this, ros.operation(), ros.getReplyEndTime(),
                    interceptors, replyHandler);
            receiver.configure(configuration);

            // Store the receiver in pending_replies, so in the
            // case of a LocationForward a RemarshalException can
            // be thrown to *all* waiting threads.

            synchronized (pending_replies)
            {
                pending_replies.add(receiver);
            }

            ClientConnection cltconn = null;
            synchronized (bind_sync)
            {
                if (ros.getConnection() != connection)
                {
                    logger.debug("invoke: RemarshalException");

                    // RequestOutputStream has been created for
                    // another connection, so try again
                    throw new RemarshalException();
                }
                cltconn = connection;
            }
            // Use the local copy of the client connection to avoid trouble
            // with something else affecting the real connection.
            cltconn.sendRequest(ros, receiver, ros.requestId(), true);
        }
        catch ( org.omg.CORBA.SystemException cfe )
        {
            logger.debug("invoke: SystemException");

View Full Code Here


        throws RemarshalException, ApplicationException
    {
        switch (ros.syncScope())
        {
            case SYNC_NONE.value:
                RequestOutputStream copy = new RequestOutputStream(ros);
                passToTransport (copy);
                interceptors.handle_receive_other (SUCCESSFUL.value);
                break;

            case SYNC_WITH_TRANSPORT.value:
View Full Code Here

        {
            bind();

            ParsedIOR ior = getParsedIOR();

            RequestOutputStream out =
                new RequestOutputStream( orb,
                                         connection,
                                         connection.getId(),
                                         operation,
                                         responseExpected,
                                         getSyncScope(),
                                         getRequestStartTime(),
                                         requestEndTime,
                                         replyEndTime,
                                         ior.get_object_key(), ior.getEffectiveProfile().version().minor );

            // CodeSets are only negotiated once per connection,
            // not for each individual request
            // (CORBA 3.0, 13.10.2.6, second paragraph).
            if (!connection.isTCSNegotiated())
            {
                connection.setCodeSet(ior);
            }

            //Setting the codesets not until here results in the
            //header being writtend using the default codesets. On the
            //other hand, the server side must have already read the
            //header to discover the codeset service context.
            out.setCodeSets( connection.getTCS(), connection.getTCSW() );

            out.updateMutatorConnection (connection.getGIOPConnection());

            return out;
        }
    }
View Full Code Here

        while (true)
        {
            org.jacorb.orb.Delegate delegate =
                (org.jacorb.orb.Delegate)((org.omg.CORBA.portable.ObjectImpl)target)._get_delegate();

            final RequestOutputStream out = (RequestOutputStream)delegate.request(target, operation, response_expected);

            try
            {
                out.setRequest(this);

                for( Iterator it = ((org.jacorb.orb.NVList)arguments).iterator(); it.hasNext();)
                {
                    org.jacorb.orb.NamedValue namedValue = (org.jacorb.orb.NamedValue)it.next();
                    if( namedValue.flags() != org.omg.CORBA.ARG_OUT.value )
                    {
                        namedValue.send(out);
                    }
                }

                try
                {
                    logger.debug("delegate.invoke(...)");
                    reply = delegate.invoke(target, out);

                    if( response_expected )
                    {
                        _read_result();

                        if (info != null)
                        {
                            info.setResult (result_value.value());
                            InterceptorManager manager = orb.getInterceptorManager();
                            info.setCurrent (manager.getCurrent());

                            try
                            {
                                delegate.invokeInterceptors(info,
                                        ClientInterceptorIterator.RECEIVE_REPLY);
                            }
                            catch(RemarshalException e)
                            {
                                //not allowed to happen here anyway
                                throw new INTERNAL("should not happen");
                            }
                            info = null;
                        }
                    }
                }
                catch (RemarshalException e)
                {
                    logger.debug("RemarshalException", e);
                    // Try again
                    continue;
                }
                catch (ApplicationException e)
                {
                    logger.debug("ApplicationException", e);

                    org.omg.CORBA.Any any;
                    org.omg.CORBA.TypeCode typeCode;
                    String id = e.getId ();
                    int count = exceptions.count ();

                    logger.debug("exceptions.count: " + count);

                    for (int i = 0; i < count; i++)
                    {
                        try
                        {
                            typeCode = exceptions.item (i);

                            logger.debug(typeCode + " == " + id + "?");

                            if (id.equals (typeCode.id ()))
                            {
                                logger.debug("YES");
                                any = orb.create_any ();
                                any.read_value (e.getInputStream (), typeCode);
                                env.exception (new org.omg.CORBA.UnknownUserException (any));
                                break;
                            }
                        }
                        catch (org.omg.CORBA.TypeCodePackage.BadKind ex) // NOPMD
                        {
                            // Ignored
                        }
                        catch (org.omg.CORBA.Bounds ex)
                        {
                            break;
                        }
                    }

                    break;
                }
                catch (Exception e)
                {
                    logger.debug("Exception", e);
                    env.exception (e);
                    break;
                }

                break;
            }
            finally
            {
                out.close();
            }
        }
    }
View Full Code Here

                                 boolean async )
        throws ApplicationException, RemarshalException
    {
        checkORB();

        RequestOutputStream ros      = (RequestOutputStream)os;
        ReplyReceiver       receiver = null;
        final ClientInterceptorHandler interceptors = new ClientInterceptorHandler
        (
            (ClientInterceptorHandler)localInterceptors.get(),
            orb,
            ros,
            self,
            this,
            piorOriginal,
            connection
        );

        orb.notifyTransportListeners (connection.getGIOPConnection());

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

            try
            {
                interceptors.handle_send_request();
            }
            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. RemarshalExceptions are explicitely not caught, because in
                // that case, localInterceptors must stay set

                localInterceptors.set(null);
                throw e;
            }
        }
        else
        {
            interceptors.handle_send_request();
        }


        try
        {
            if ( !ros.response_expected() )  // oneway op
            {
                invoke_oneway (ros, interceptors);
                return null;
            }
            // response expected, synchronous or asynchronous
            receiver = new ReplyReceiver(this, ros.operation(), ros.getReplyEndTime(),
                    interceptors, replyHandler);
            receiver.configure(configuration);

            // Store the receiver in pending_replies, so in the
            // case of a LocationForward a RemarshalException can
            // be thrown to *all* waiting threads.

            synchronized (pending_replies)
            {
                pending_replies.add(receiver);
            }

            ClientConnection cltconn = null;
            synchronized (bind_sync)
            {
                if (ros.getConnection() != connection)
                {
                    logger.debug("invoke: RemarshalException");

                    // RequestOutputStream has been created for
                    // another connection, so try again
                    throw new RemarshalException();
                }
                cltconn = connection;
            }
            // Use the local copy of the client connection to avoid trouble
            // with something else affecting the real connection.
            cltconn.sendRequest(ros, receiver, ros.requestId(), true);
        }
        catch ( org.omg.CORBA.SystemException cfe )
        {
            logger.debug("invoke: SystemException");

View Full Code Here

        throws RemarshalException, ApplicationException
    {
        switch (ros.syncScope())
        {
            case SYNC_NONE.value:
                RequestOutputStream copy = new RequestOutputStream(ros);
                passToTransport (copy);
                interceptors.handle_receive_other (SUCCESSFUL.value);
                break;

            case SYNC_WITH_TRANSPORT.value:
View Full Code Here

        {
            bind();

            ParsedIOR ior = getParsedIOR();

            RequestOutputStream out =
                new RequestOutputStream( orb,
                                         connection,
                                         connection.getId(),
                                         operation,
                                         responseExpected,
                                         getSyncScope(),
                                         getRequestStartTime(),
                                         requestEndTime,
                                         replyEndTime,
                                         ior.get_object_key(), ior.getEffectiveProfile().version().minor );

            // CodeSets are only negotiated once per connection,
            // not for each individual request
            // (CORBA 3.0, 13.10.2.6, second paragraph).
            if (!connection.isTCSNegotiated())
            {
                connection.setCodeSet(ior);
            }

            //Setting the codesets not until here results in the
            //header being writtend using the default codesets. On the
            //other hand, the server side must have already read the
            //header to discover the codeset service context.
            out.setCodeSets( connection.getTCS(), connection.getTCSW() );

            out.updateMutatorConnection (connection.getGIOPConnection());

            return out;
        }
    }
View Full Code Here

        while (true)
        {
            org.jacorb.orb.Delegate delegate =
                (org.jacorb.orb.Delegate)((org.omg.CORBA.portable.ObjectImpl)target)._get_delegate();

            final RequestOutputStream out = (RequestOutputStream)delegate.request(target, operation, response_expected);

            try
            {
                out.setRequest(this);

                for( Iterator it = ((org.jacorb.orb.NVList)arguments).iterator(); it.hasNext();)
                {
                    org.jacorb.orb.NamedValue namedValue = (org.jacorb.orb.NamedValue)it.next();
                    if( namedValue.flags() != org.omg.CORBA.ARG_OUT.value )
                    {
                        namedValue.send(out);
                    }
                }

                try
                {
                    logger.debug("delegate.invoke(...)");
                    reply = delegate.invoke(target, out);

                    if( response_expected )
                    {
                        _read_result();

                        if (info != null)
                        {
                            info.setResult (result_value.value());
                            InterceptorManager manager = orb.getInterceptorManager();
                            info.setCurrent (manager.getCurrent());

                            try
                            {
                                delegate.invokeInterceptors(info,
                                        ClientInterceptorIterator.RECEIVE_REPLY);
                            }
                            catch(RemarshalException e)
                            {
                                //not allowed to happen here anyway
                                throw new INTERNAL("should not happen");
                            }
                            info = null;
                        }
                    }
                }
                catch (RemarshalException e)
                {
                    logger.debug("RemarshalException", e);
                    // Try again
                    continue;
                }
                catch (ApplicationException e)
                {
                    logger.debug("ApplicationException", e);

                    org.omg.CORBA.Any any;
                    org.omg.CORBA.TypeCode typeCode;
                    String id = e.getId ();
                    int count = exceptions.count ();

                    logger.debug("exceptions.count: " + count);

                    for (int i = 0; i < count; i++)
                    {
                        try
                        {
                            typeCode = exceptions.item (i);

                            logger.debug(typeCode + " == " + id + "?");

                            if (id.equals (typeCode.id ()))
                            {
                                logger.debug("YES");
                                any = orb.create_any ();
                                any.read_value (e.getInputStream (), typeCode);
                                env.exception (new org.omg.CORBA.UnknownUserException (any));
                                break;
                            }
                        }
                        catch (org.omg.CORBA.TypeCodePackage.BadKind ex) // NOPMD
                        {
                            // Ignored
                        }
                        catch (org.omg.CORBA.Bounds ex)
                        {
                            break;
                        }
                    }

                    break;
                }
                catch (Exception e)
                {
                    logger.debug("Exception", e);
                    env.exception (e);
                    break;
                }

                break;
            }
            finally
            {
                out.close();
            }
        }
    }
View Full Code Here

                                 boolean async )
        throws ApplicationException, RemarshalException
    {
        checkORB();

        RequestOutputStream ros      = (RequestOutputStream)os;
        ReplyReceiver       receiver = null;
        final ClientInterceptorHandler interceptors = new ClientInterceptorHandler
        (
            (ClientInterceptorHandler)localInterceptors.get(),
            orb,
            ros,
            self,
            this,
            piorOriginal,
            connection
        );

        orb.notifyTransportListeners (connection.getGIOPConnection());

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

            try
            {
                interceptors.handle_send_request();
            }
            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. RemarshalExceptions are explicitely not caught, because in
                // that case, localInterceptors must stay set

                localInterceptors.set(null);
                throw e;
            }
        }
        else
        {
            interceptors.handle_send_request();
        }


        try
        {
            if ( !ros.response_expected() )  // oneway op
            {
                invoke_oneway (ros, interceptors);
                return null;
            }
            // response expected, synchronous or asynchronous
            receiver = new ReplyReceiver(this, ros.operation(), ros.getReplyEndTime(),
                    interceptors, replyHandler);
            receiver.configure(configuration);

            // Store the receiver in pending_replies, so in the
            // case of a LocationForward a RemarshalException can
            // be thrown to *all* waiting threads.

            synchronized (pending_replies)
            {
                pending_replies.add(receiver);
            }

            ClientConnection cltconn = null;
            synchronized (bind_sync)
            {
                if (ros.getConnection() != connection)
                {
                    logger.debug("invoke: RemarshalException");

                    // RequestOutputStream has been created for
                    // another connection, so try again
                    throw new RemarshalException();
                }
                cltconn = connection;
            }
            // Use the local copy of the client connection to avoid trouble
            // with something else affecting the real connection.
            cltconn.sendRequest(ros, receiver, ros.requestId(), true);
        }
        catch ( org.omg.CORBA.SystemException cfe )
        {
            logger.debug("invoke: SystemException");

View Full Code Here

        throws RemarshalException, ApplicationException
    {
        switch (ros.syncScope())
        {
            case SYNC_NONE.value:
                RequestOutputStream copy = new RequestOutputStream(ros);
                passToTransport (copy);
                interceptors.handle_receive_other (SUCCESSFUL.value);
                break;

            case SYNC_WITH_TRANSPORT.value:
View Full Code Here

TOP

Related Classes of org.jacorb.orb.giop.RequestOutputStream

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.