Package org.jacorb.orb.giop

Examples of org.jacorb.orb.giop.ClientConnectionManager


    private void initClientConnectionManager()
    {
        try
        {
            clientConnectionManager =
                new ClientConnectionManager( this,
                                             getTransportManager(),
                                             getGIOPConnectionManager());
            clientConnectionManager.configure(configuration);
        }
        catch( ConfigurationException ce )
View Full Code Here


    }


    private boolean checkServerActive(String host, int port, byte []object_key, boolean enp_reused)
    {
        ClientConnectionManager   cm           = null;
        IIOPAddress               address      = null;
        ClientConnection          connection   = null;
        LocateRequestOutputStream lros         = null;
        LocateReplyReceiver       receiver     = null;
        LocateReplyInputStream    lris         = null;
        boolean                   result       = false;

        cm = ((org.jacorb.orb.ORB)orb).getClientConnectionManager ();
        try
        {
            address = new IIOPAddress (host, port);
            address.configure(configuration);

            IIOPProfile iiopProfile = new IIOPProfile(address, object_key);
            iiopProfile.configure(configuration);

            connection = cm.getConnection(iiopProfile);
        }
        catch(ConfigurationException e)
        {
            logger.error("Failed to configure", e);
        }

        if (this.logger.isDebugEnabled())
        {
            this.logger.debug("Pinging " + host + " / " + port);
        }

        try
        {
            lros = new LocateRequestOutputStream (object_key, connection.getId(), 2);
            receiver = new LocateReplyReceiver((org.jacorb.orb.ORB)orb);

            connection.sendRequest(
                lros,
                receiver,
                lros.getRequestId (),
                true ); // response expected

            lris = receiver.getReply();

            switch (lris.rep_hdr.locate_status.value ())
            {
                case LocateStatusType_1_2._UNKNOWN_OBJECT:
                case LocateStatusType_1_2._LOC_SYSTEM_EXCEPTION:
                {

                    SystemException se = SystemExceptionHelper.read( lris );
                    if (enp_reused && (se instanceof org.omg.CORBA.OBJECT_NOT_EXIST))
                    {
                       // Endpoint is reused by another server and the new server
                       // returned OBJECT_NOT_EXIST, so give up using this endpoint.
                       // The return value can be interpreted as not available endpoint.
                       result = false;
                    }
                    else
                    {
                       result = true;
                    }
                    break;
                }
                case LocateStatusType_1_2._OBJECT_HERE:
                case LocateStatusType_1_2._OBJECT_FORWARD:
                case LocateStatusType_1_2._OBJECT_FORWARD_PERM:
                case LocateStatusType_1_2._LOC_NEEDS_ADDRESSING_MODE:
                default:
                {
                    result = true;
                    break;
                }
            }
        }
        catch (Throwable ex)
        {
            this.logger.debug("Exception while checking server active", ex);

            result = false;
        }
        finally
        {
            cm.releaseConnection (connection);
        }
        return result;
    }
View Full Code Here

    }


    private boolean checkServerActive(String host, int port, byte []object_key, boolean enp_reused)
    {
        ClientConnectionManager   cm           = null;
        IIOPAddress               address      = null;
        ClientConnection          connection   = null;
        LocateRequestOutputStream lros         = null;
        LocateReplyReceiver       receiver     = null;
        LocateReplyInputStream    lris         = null;
        boolean                   result       = false;

        cm = ((org.jacorb.orb.ORB)orb).getClientConnectionManager ();
        try
        {
            address = new IIOPAddress (host, port);
            address.configure(configuration);

            IIOPProfile iiopProfile = new IIOPProfile(address, object_key);
            iiopProfile.configure(configuration);

            connection = cm.getConnection(iiopProfile);
        }
        catch(ConfigurationException e)
        {
            logger.error("Failed to configure", e);
        }

        if (this.logger.isDebugEnabled())
        {
            this.logger.debug("Pinging " + host + " / " + port);
        }

        try
        {
            lros = new LocateRequestOutputStream (object_key, connection.getId(), 2);
            receiver = new LocateReplyReceiver((org.jacorb.orb.ORB)orb);

            connection.sendRequest(
                lros,
                receiver,
                lros.getRequestId (),
                true ); // response expected

            lris = receiver.getReply();

            switch (lris.rep_hdr.locate_status.value ())
            {
                case LocateStatusType_1_2._UNKNOWN_OBJECT:
                case LocateStatusType_1_2._LOC_SYSTEM_EXCEPTION:
                {

                    SystemException se = SystemExceptionHelper.read( lris );
                    if (enp_reused && (se instanceof org.omg.CORBA.OBJECT_NOT_EXIST))
                    {
                       // Endpoint is reused by another server and the new server
                       // returned OBJECT_NOT_EXIST, so give up using this endpoint.
                       // The return value can be interpreted as not available endpoint.
                       result = false;
                    }
                    else
                    {
                       result = true;
                    }
                    break;
                }
                case LocateStatusType_1_2._OBJECT_HERE:
                case LocateStatusType_1_2._OBJECT_FORWARD:
                case LocateStatusType_1_2._OBJECT_FORWARD_PERM:
                case LocateStatusType_1_2._LOC_NEEDS_ADDRESSING_MODE:
                default:
                {
                    result = true;
                    break;
                }
            }
        }
        catch (Throwable ex)
        {
            this.logger.debug("Exception while checking server active", ex);

            result = false;
        }
        finally
        {
            cm.releaseConnection (connection);
        }
        return result;
    }
View Full Code Here

    private void initClientConnectionManager()
    {
        try
        {
            clientConnectionManager =
                new ClientConnectionManager( this,
                                             getTransportManager(),
                                             getGIOPConnectionManager());
            clientConnectionManager.configure(configuration);
        }
        catch( ConfigurationException ce )
View Full Code Here

    private void initClientConnectionManager()
    {
        try
        {
            clientConnectionManager =
                new ClientConnectionManager( this,
                                             getTransportManager(),
                                             getGIOPConnectionManager());
            clientConnectionManager.configure(configuration);
        }
        catch( ConfigurationException ce )
View Full Code Here

    private void initClientConnectionManager()
    {
        try
        {
            clientConnectionManager =
                new ClientConnectionManager( this,
                                             getTransportManager(),
                                             getGIOPConnectionManager());
            clientConnectionManager.configure(configuration);
        }
        catch( ConfigurationException ce )
View Full Code Here

            timeout = true;

            Field fconnmgr = Delegate.class.getDeclaredField("conn_mg");
            fconnmgr.setAccessible(true);
            Delegate d = (Delegate) ((org.omg.CORBA.portable.ObjectImpl)server)._get_delegate();
            ClientConnectionManager ccm = (ClientConnectionManager) fconnmgr.get(d);
            Field connections = ClientConnectionManager.class.getDeclaredField("connections");
            connections.setAccessible(true);
            @SuppressWarnings("unchecked")
            HashMap<Profile, ClientConnection> c = (HashMap<Profile, ClientConnection>) connections.get(ccm);
View Full Code Here

        request.invoke();

        Field fconnmgr = Delegate.class.getDeclaredField("conn_mg");
        fconnmgr.setAccessible(true);
        Delegate d = (Delegate) ((org.omg.CORBA.portable.ObjectImpl)server)._get_delegate();
        ClientConnectionManager ccm = (ClientConnectionManager) fconnmgr.get(d);
        Field connections = ClientConnectionManager.class.getDeclaredField("connections");
        connections.setAccessible(true);
        @SuppressWarnings("unchecked")
        HashMap<Profile, ClientConnection> c = (HashMap<Profile, ClientConnection>) connections.get(ccm);
View Full Code Here

        catch (Throwable e)
        {
            Field fconnmgr = Delegate.class.getDeclaredField("conn_mg");
            fconnmgr.setAccessible(true);
            Delegate d = (Delegate) ((org.omg.CORBA.portable.ObjectImpl)server1)._get_delegate();
            ClientConnectionManager ccm = (ClientConnectionManager) fconnmgr.get(d);
            Field connections = ClientConnectionManager.class.getDeclaredField("connections");
            connections.setAccessible(true);
            @SuppressWarnings("unchecked")
            HashMap<Profile, ClientConnection> c = (HashMap<Profile, ClientConnection>) connections.get(ccm);
View Full Code Here

    }


    private boolean checkServerActive(String host, int port, byte []object_key, boolean enp_reused)
    {
        ClientConnectionManager   cm           = null;
        IIOPAddress               address      = null;
        ClientConnection          connection   = null;
        LocateRequestOutputStream lros         = null;
        LocateReplyReceiver       receiver     = null;
        LocateReplyInputStream    lris         = null;
        boolean                   result       = false;

        cm = ((org.jacorb.orb.ORB)orb).getClientConnectionManager ();
        try
        {
            address = new IIOPAddress (host, port);
            address.configure(configuration);

            IIOPProfile iiopProfile = new IIOPProfile(address, object_key, ((org.jacorb.orb.ORB)orb).getGIOPMinorVersion());
            iiopProfile.configure(configuration);

            connection = cm.getConnection(iiopProfile);
        }
        catch(ConfigurationException e)
        {
            logger.error("Failed to configure", e);
        }

        if (this.logger.isDebugEnabled())
        {
            this.logger.debug("Pinging " + host + " / " + port);
        }

        try
        {
            lros = new LocateRequestOutputStream ( orb, object_key, connection.getId(), 2);
            receiver = new LocateReplyReceiver();
            receiver.configure (configuration);

            connection.sendRequest(
                lros,
                receiver,
                lros.getRequestId (),
                true ); // response expected

            lris = receiver.getReply();

            switch (lris.rep_hdr.locate_status.value ())
            {
                case LocateStatusType_1_2._UNKNOWN_OBJECT:
                case LocateStatusType_1_2._LOC_SYSTEM_EXCEPTION:
                {

                    SystemException se = SystemExceptionHelper.read( lris );
                    if (enp_reused && (se instanceof org.omg.CORBA.OBJECT_NOT_EXIST))
                    {
                       // Endpoint is reused by another server and the new server
                       // returned OBJECT_NOT_EXIST, so give up using this endpoint.
                       // The return value can be interpreted as not available endpoint.
                       result = false;
                    }
                    else
                    {
                       result = true;
                    }
                    break;
                }
                case LocateStatusType_1_2._OBJECT_HERE:
                case LocateStatusType_1_2._OBJECT_FORWARD:
                case LocateStatusType_1_2._OBJECT_FORWARD_PERM:
                case LocateStatusType_1_2._LOC_NEEDS_ADDRESSING_MODE:
                default:
                {
                    result = true;
                    break;
                }
            }
        }
        catch (Throwable ex)
        {
            this.logger.debug("Exception while checking server active", ex);

            result = false;
        }
        finally
        {
            cm.releaseConnection (connection);
        }
        return result;
    }
View Full Code Here

TOP

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

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.