Package com.sleepycat.je.rep.elections.Protocol

Examples of com.sleepycat.je.rep.elections.Protocol.MasterQueryResponse


                        synchronized (this) {
                            if ((currentProposal != null) &&
                                    (currentValue != null)) {
                                out = new PrintWriter(socket.getOutputStream(),
                                                      true);
                                MasterQueryResponse responseMessage =
                                    protocol.new MasterQueryResponse
                                        (currentProposal, currentValue);

                                /*
                                 * The request message may be of an earlier
                                 * version. If so, this node transparently read
                                 * the older version. JE only throws out
                                 * InvalidMessageException when the version of
                                 * the request message is newer than the
                                 * current protocol. To avoid sending a
                                 * response that the requester cannot
                                 * understand, we send a response in the same
                                 * version as that of the original request
                                 * message.
                                 */
                                responseMessage.setSendVersion
                                    (requestMessage.getSendVersion());
                                out.println(responseMessage.wireFormat());
                            }
                        }
                    } else if (requestMessage.getOp() == protocol.SHUTDOWN) {
                        LoggerUtils.logMsg
                            (logger, envImpl, formatter, Level.FINE,
View Full Code Here


                        if (me.getResponseMessage() == null) {
                            return;
                        }
                        if (me.getResponseMessage().getOp() ==
                            protocol.MASTER_QUERY_RESPONSE){
                            MasterQueryResponse accept =
                                (MasterQueryResponse) me.getResponseMessage();
                            MasterValue masterValue =
                                (MasterValue) accept.getValue();
                            if ((masterValue != null) &&
                                 masterValue.getNameId().
                                 equals(protocol.getNameIdPair())) {
                                /*
                                 * Should not transition to master as a result
                                 * of a query it risks imposing a hard recovery
                                 * on the replicas.
                                 */
                                return;
                            }
                            processResult(accept.getProposal(), masterValue);
                        }
                    }
                }.execute(logger, envImpl, formatter);
            }
        } finally {
View Full Code Here

                                               response.wireFormat());
                        }
                    }
                }.execute(logger, repImpl, formatter);
            }
            MasterQueryResponse bestResponse = null;
            for (MasterQueryResponse result : results) {
                if ((bestResponse == null) ||
                    (result.getProposal().
                            compareTo(bestResponse.getProposal()) > 0)) {
                    bestResponse = result;
                }
            }
            if (bestResponse == null) {
                throw new UnknownMasterException
                    ("Could not determine master from helpers at:" +
                     learnerSockets.toString());
            }
            return(MasterValue) bestResponse.getValue();
        } finally {
            pool.shutdown();
        }
    }
View Full Code Here

                        synchronized (this) {
                            if ((currentProposal != null) &&
                                    (currentValue != null)) {
                                out = new PrintWriter(socket.getOutputStream(),
                                                      true);
                                MasterQueryResponse responseMessage =
                                    protocol.new MasterQueryResponse
                                        (currentProposal, currentValue);
                                out.println(responseMessage.wireFormat());
                            }
                        }
                    } else if (requestMessage.getOp() == protocol.SHUTDOWN) {
                        LoggerUtils.logMsg
                            (logger, envImpl, formatter, Level.FINE,
View Full Code Here

                        if (me.getResponseMessage() == null) {
                            return;
                        }
                        if (me.getResponseMessage().getOp() ==
                            protocol.MASTER_QUERY_RESPONSE){
                            MasterQueryResponse accept =
                                (MasterQueryResponse) me.getResponseMessage();
                            processResult(accept.getProposal(),
                                          accept.getValue());
                        }
                    }
                }.execute(logger, envImpl, formatter);
            }
        } finally {
View Full Code Here

                                               response.wireFormat());
                        }
                    }
                }.execute(logger, repImpl, formatter);
            }
            MasterQueryResponse bestResponse = null;
            for (MasterQueryResponse result : results) {
                if ((bestResponse == null) ||
                    (result.getProposal().
                            compareTo(bestResponse.getProposal()) > 0)) {
                    bestResponse = result;
                }
            }
            if (bestResponse == null) {
                throw new UnknownMasterException
                    ("Could not determine master from helpers at:" +
                     learnerSockets.toString());
            }
            return(MasterValue) bestResponse.getValue();
        } finally {
            pool.shutdown();
        }
    }
View Full Code Here

TOP

Related Classes of com.sleepycat.je.rep.elections.Protocol.MasterQueryResponse

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.