Package org.apache.openejb.client

Examples of org.apache.openejb.client.ClusterResponse


            if (requestType == RequestType.NOP_REQUEST) {
                return;
            }

            ClusterResponse clusterResponse = null;

            if (requestType == RequestType.CLUSTER_REQUEST) {
                clusterResponse = clusterHandler.processRequest(ois, clientProtocol);

                //Check for immediate failure
                final Throwable failure = clusterResponse.getFailure();
                if (null != clusterResponse && null != failure) {

                    clusterHandler.getLogger().debug("Failed to write to ClusterResponse", failure);

                    try {
                        info.setOutputStream(new CountingOutputStream(rawOut));
                        oos = new ObjectOutputStream(info.getOutputStream());
                        clusterResponse.setMetaData(clientProtocol);
                        clusterResponse.writeExternal(oos);
                        oos.flush();
                    } catch (IOException ie) {
                        final String m = "Failed to write to ClusterResponse: " + ie.getMessage();
                        clusterHandler.getLogger().error(m, ie);
                        throw Exceptions.newIOException(m, ie);
View Full Code Here


    public ClusterResponse processRequest(final ObjectInputStream in, final ProtocolMetaData metaData) throws Exception {

        final ClusterRequest req = new ClusterRequest();
        req.setMetaData(metaData);

        final ClusterResponse res = new ClusterResponse();
        res.setMetaData(metaData);

        try {
            req.readExternal(in);
        } catch (IOException e) {
            res.setFailure(e);
            return res;
        } catch (ClassNotFoundException e) {
            res.setFailure(new IOException().initCause(e));
            return res;
        }

        final ClusterMetaData currentClusterMetaData = data.current();

        if (req.getClusterMetaDataVersion() < currentClusterMetaData.getVersion()) {
            if (logger.isDebugEnabled()) {
                final URI[] locations = currentClusterMetaData.getLocations();
                if (locations.length < 10) {
                    logger.debug("Sending client updated cluster locations: [" + Join.join(", ", locations) + "]");
                } else {
                    logger.debug("Sending client updated cluster locations: " + locations.length + " locations total");
                }
            }
            res.setUpdatedMetaData(currentClusterMetaData);
        } else {
            res.setCurrent();
        }

        return res;
    }
View Full Code Here

    public void processResponse(final Response response, final ObjectOutputStream out, final ProtocolMetaData metaData) throws Exception {
        if (null != response) {

            if (ClusterResponse.class.isInstance(response)) {

                final ClusterResponse res = (ClusterResponse) response;

                try {
                    res.setMetaData(metaData);
                    res.writeExternal(out);
                } catch (IOException e) {
                    logger.error("Failed to write to ClusterResponse", e);
                    throw e;
                }
            } else {
View Full Code Here

    public ClusterResponse processRequest(final ObjectInputStream in, final ProtocolMetaData metaData) throws Exception {

        final ClusterRequest req = new ClusterRequest();
        req.setMetaData(metaData);

        final ClusterResponse res = new ClusterResponse();
        res.setMetaData(metaData);

        try {
            req.readExternal(in);
        } catch (final IOException e) {
            res.setFailure(e);
            return res;
        } catch (final ClassNotFoundException e) {
            res.setFailure(new IOException().initCause(e));
            return res;
        }

        final ClusterMetaData currentClusterMetaData = data.current();

        if (req.getClusterMetaDataVersion() < currentClusterMetaData.getVersion()) {
            if (logger.isDebugEnabled()) {
                final URI[] locations = currentClusterMetaData.getLocations();
                if (locations.length < 10) {
                    logger.debug("Sending client updated cluster locations: [" + Join.join(", ", locations) + "]");
                } else {
                    logger.debug("Sending client updated cluster locations: " + locations.length + " locations total");
                }
            }
            res.setUpdatedMetaData(currentClusterMetaData);
        } else {
            res.setCurrent();
        }

        return res;
    }
View Full Code Here

    public void processResponse(final Response response, final ObjectOutputStream out, final ProtocolMetaData metaData) throws Exception {
        if (null != response) {

            if (ClusterResponse.class.isInstance(response)) {

                final ClusterResponse res = (ClusterResponse) response;

                try {
                    res.setMetaData(metaData);
                    res.writeExternal(out);
                } catch (final IOException e) {
                    logger.error("Failed to write to ClusterResponse", e);
                    throw e;
                }
            } else {
View Full Code Here

            if (requestType == RequestType.NOP_REQUEST) {
                return;
            }

            ClusterResponse clusterResponse = null;

            if (requestType == RequestType.CLUSTER_REQUEST) {
                clusterResponse = clusterHandler.processRequest(ois, clientProtocol);

                //Check for immediate failure
                final Throwable failure = clusterResponse.getFailure();
                if (null != clusterResponse && null != failure) {

                    clusterHandler.getLogger().debug("Failed to write to ClusterResponse", failure);

                    try {
                        info.setOutputStream(new CountingOutputStream(rawOut));
                        oos = new ObjectOutputStream(info.getOutputStream());
                        clusterResponse.setMetaData(clientProtocol);
                        clusterResponse.writeExternal(oos);
                        oos.flush();
                    } catch (final IOException ie) {
                        final String m = "Failed to write to ClusterResponse: " + ie.getMessage();
                        clusterHandler.getLogger().error(m, ie);
                        throw Exceptions.newIOException(m, ie);
View Full Code Here

    }


    public void processRequest(ObjectInputStream in, ObjectOutputStream out) throws IOException {
        ClusterRequest req = new ClusterRequest();
        ClusterResponse res = new ClusterResponse();

        try {
            req.readExternal(in);
        } catch (IOException e) {
            res.setFailure(e);
            sendErrorResponse("Cannot read ClusterRequest", e, res, out);
            throw e;
        } catch (ClassNotFoundException e) {
            res.setFailure(e);
            sendErrorResponse("Cannot read ClusterRequest", e, res, out);
            throw (IOException) new IOException().initCause(e);
        }

        ClusterMetaData currentClusterMetaData = data.current();

        if (req.getClusterMetaDataVersion() < currentClusterMetaData.getVersion()){
            if (logger.isDebugEnabled()) {
                URI[] locations = currentClusterMetaData.getLocations();
                if (locations.length < 10) {
                    logger.debug("Sending client updated cluster locations: [" + Join.join(", ", locations) + "]");
                } else {
                    logger.debug("Sending client updated cluster locations: " + locations.length + " locations total");
                }
            }
            res.setUpdatedMetaData(currentClusterMetaData);
        } else {
            res.setCurrent();
        }

        try {
            res.writeExternal(out);
        } catch (IOException e) {
            logger.error("Failed to write to ClusterResponse", e);
            throw e;
        }
    }
View Full Code Here

            if (requestType == RequestType.NOP_REQUEST) {
                return;
            }

            ClusterResponse clusterResponse = null;

            if (requestType == RequestType.CLUSTER_REQUEST) {
                clusterResponse = clusterHandler.processRequest(ois, clientProtocol);

                //Check for immediate failure
                final Throwable failure = clusterResponse.getFailure();
                if (null != clusterResponse && null != failure) {

                    clusterHandler.getLogger().debug("Failed to write to ClusterResponse", failure);

                    try {
                        info.setOutputStream(new CountingOutputStream(rawOut));
                        oos = new ObjectOutputStream(info.getOutputStream());
                        clusterResponse.setMetaData(clientProtocol);
                        clusterResponse.writeExternal(oos);
                        oos.flush();
                    } catch (IOException ie) {
                        final String m = "Failed to write to ClusterResponse: " + ie.getMessage();
                        clusterHandler.getLogger().error(m, ie);
                        throw Exceptions.newIOException(m, ie);
View Full Code Here

TOP

Related Classes of org.apache.openejb.client.ClusterResponse

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.