Package com.sleepycat.je.rep.stream.Protocol

Examples of com.sleepycat.je.rep.stream.Protocol.ReplicaProtocolVersion


        /*
         * Wait to receive the replica's version, decide which protocol version
         * to use ourselves, and then reply with our version.
         */
        ReplicaProtocolVersion message =
            (ReplicaProtocolVersion) defaultProtocol.read(namedChannel);

        replicaNameIdPair = message.getNameIdPair();

        Feeder dup =
            repNode.feederManager().getFeeder(replicaNameIdPair.getName());
        if ((dup != null) ||
            (message.getNameIdPair().getName().
                    equals(feederNameIdPair.getName()))) {
            /* Reject the connection. */
            defaultProtocol.write(defaultProtocol.new DuplicateNodeReject
                                  ("This node: " + replicaNameIdPair +
                                   " is already in active use at the feeder "),
                                  namedChannel);
            SocketAddress dupAddress =
                namedChannel.getChannel().socket().getRemoteSocketAddress();
            throw new ExitException
                ("A replica with the id: " + replicaNameIdPair +
                 " is already active with this feeder. " +
                 " The duplicate replica resides at: " +
                 dupAddress);
        }

        /*
         * If the Replica's version is acceptable, use it, otherwise return the
         * default protocol at this node, in case the Replica can support it.
         */
        final int replicaVersion = message.getVersion();
        Protocol protocol = Protocol.get(repNode, replicaVersion);

        /*
         * If no suitable protocol was found, simply use the default protocol
         * at the feeder, it will be rejected by the Replica.
View Full Code Here


        /*
         * Wait to receive the replica's version, decide which protocol version
         * to use ourselves, and then reply with our version.
         */
        ReplicaProtocolVersion message =
            (ReplicaProtocolVersion) defaultProtocol.read(namedChannel);

        replicaNameIdPair = message.getNameIdPair();

        Feeder dup =
            repNode.feederManager().getFeeder(replicaNameIdPair.getName());
        if ((dup != null) ||
            (message.getNameIdPair().getName().
                    equals(feederNameIdPair.getName()))) {
            /* Reject the connection. */
            defaultProtocol.write(defaultProtocol.new DuplicateNodeReject
                                  ("This node: " + replicaNameIdPair +
                                   " is already in active use at the feeder "),
                                  namedChannel);
            SocketAddress dupAddress =
                namedChannel.getChannel().socket().getRemoteSocketAddress();
            throw new ExitException
                ("A replica with the id: " + replicaNameIdPair +
                 " is already active with this feeder. " +
                 " The duplicate replica resides at: " +
                 dupAddress);
        }

        /*
         * If the Replica's version is acceptable, use it, otherwise return the
         * default protocol at this node, in case the Replica can support it.
         */
        final int replicaVersion = message.getVersion();
        Protocol protocol = Protocol.get(repNode, replicaVersion);

        /*
         * If no suitable protocol was found, simply use the default protocol
         * at the feeder, it will be rejected by the Replica.
View Full Code Here

TOP

Related Classes of com.sleepycat.je.rep.stream.Protocol.ReplicaProtocolVersion

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.