Package com.sleepycat.je.rep.impl

Examples of com.sleepycat.je.rep.impl.RepGroupImpl


               DatabaseException,
               ExitException {

        NodeGroupInfo nodeGroup =
            (Protocol.NodeGroupInfo)(protocol.read(namedChannel));
        final RepGroupImpl group = repNode.getGroup();
        RepNodeImpl node = group.getNode(nodeGroup.getNodeName());

        try {

            if (nodeGroup.getNodeId() != replicaNameIdPair.getId()) {
                throw new ExitException
                    ("The replica node id sent during protocol negotiation: " +
                     replicaNameIdPair +
                     " differs from the one sent in the MembershipInfo " +
                     "request: " + nodeGroup.getNodeId());
            }

            if (node == null) {
                /* Not currently a member. */
                try {
                    repNode.getRepGroupDB().ensureMember(nodeGroup);
                    node =
                        repNode.getGroup().getMember(nodeGroup.getNodeName());
                    if (node == null) {
                        throw EnvironmentFailureException.unexpectedState
                            ("Node: " + nodeGroup.getNameIdPair() +
                             " not found");
                    }
                } catch (InsufficientReplicasException e) {
                    throw new ExitException(e);
                } catch (InsufficientAcksException e) {
                    throw new ExitException(e);
                } catch (NodeConflictException e) {
                    throw new ExitException(e);
                }
            } else if (node.isRemoved()) {
                throw new ExitException
                    ("Node: " + nodeGroup.getNameIdPair() +
                     " is no longer a member of the group." +
                     " It was explicitly removed.");
            }

            doGroupChecks(nodeGroup, group);
            doNodeChecks(nodeGroup, node);
        } catch (ExitException exception) {
            LoggerUtils.info
                (logger, repNode.getRepImpl(), exception.getMessage());
            protocol.write(protocol.new NodeGroupInfoReject
                           (exception.getMessage()), namedChannel);
            throw exception;
        }

        /* Id is now established for sure, update the pair. */
        replicaNameIdPair.update(node.getNameIdPair());
        namedChannel.setNameIdPair(replicaNameIdPair);
        LoggerUtils.fine(logger, repNode.getRepImpl(),
                         "Channel Mapping: " + replicaNameIdPair + " is at " +
                         namedChannel.getChannel());
        protocol.write(protocol.new NodeGroupInfoOK(group.getUUID(),
                                                    replicaNameIdPair),
                       namedChannel);
    }
View Full Code Here


        learner.addListener(masterChangeListener);
        learner.start();
        try {
            /* Notify the listener about the current master. */
            final ReplicationGroup repGroup = repGroupAdmin.getGroup();
            final RepGroupImpl group = RepInternal.getRepGroupImpl(repGroup);

            /*
             * In the absence of a network failure, the query should result in
             * a call to the notify method of MonitorChanegListener.
             */
            learner.queryForMaster(group.getLearnerSockets());

            /* Notify JoinGroupEvents for those current active nodes. */
            notifyJoinGroupEventsForActiveNodes(repGroup);
        } catch (UnknownMasterException ume) {
            /* The Listener will be informed when a Master is elected. */
 
View Full Code Here

     * Fire a GroupChangeEvent.
     */
    public void notifyGroupChange(String nodeName, GroupChangeType opType)
        throws DatabaseException {

        RepGroupImpl repGroup = repNode.getGroup();
        GroupChange changeEvent =
            getProtocol(repGroup).new GroupChange(repGroup, nodeName, opType);
        refreshMonitors(repGroup, changeEvent);
    }
View Full Code Here

            /* Already notified. */
            return;
        }

        joinTime = System.currentTimeMillis();
        RepGroupImpl repGroup = repNode.getGroup();
        JoinGroup joinEvent =
            getProtocol(repGroup).new JoinGroup(repNode.getNodeName(),
                                                repNode.getMasterName(),
                                                joinTime);
        refreshMonitors(repGroup, joinEvent);
View Full Code Here

        if (joinTime == 0) {
            /* No join event, therefore no matching leave event. */
            return;
        }

        RepGroupImpl repGroup = repNode.getGroup();
        LeaveGroup leaveEvent =
            getProtocol(repGroup).new LeaveGroup(repNode.getNodeName(),
                                                 repNode.getMasterName(),
                                                 reason,
                                                 joinTime,
View Full Code Here

    /**
     * Dumps the contents of the replication group database.
     */
    private void dumpGroup() {
        RepGroupImpl group = RepGroupDB.getGroup(envHome);
        out.println(group);
    }
View Full Code Here

    private void checkParameters() {
        try {
            if (!envHome.exists()) {
                printUsage("Directory:" + envHome + " does not exist.");
            }
            final RepGroupImpl group = RepGroupDB.getGroup(envHome);
            if (createEnv) {
                printUsage("Environment exists:" + envHome +
                           "but -createEnv was specified.");
            }
            final RepNodeImpl node = group.getNode(nodeName);
            if (node == null) {
                if (! createNode) {
                    printUsage("The node:" + nodeName +
                               " is not a member of the group:" + group +
                               ". Use -createNode to create a new one.");
                }
            } else {
                /* Node exists, check arguments if any. */
                if (groupName == null) {
                    groupName = group.getName();
                } else if (!groupName.equals(group.getName())) {
                    printUsage("-groupname:" + groupName +
                               ", does match the name:" + group.getName() +
                               " in the environment.");
                }

                if (hostPort == null) {
                    hostPort = node.getHostPortPair();
View Full Code Here

TOP

Related Classes of com.sleepycat.je.rep.impl.RepGroupImpl

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.