com.sleepycat.je.rep.impl.node
Class MasterTransfer

java.lang.Object
  extended by com.sleepycat.je.rep.impl.node.MasterTransfer

public class MasterTransfer
extends Object

A Master Transfer operation.

Each Master Transfer operation uses a separate instance of this class. There is usually no more than one instance in the lifetime of a master node, because if the transfer succeeds, the old master node environment becomes invalid and must be closed. However, if an operation times out, another operation can try again later. Or, a second operation can "forcibly" supersede an existing operation in progress.

See Also:
ReplicatedEnvironment.transferMaster(Set, int, TimeUnit)

Nested Class Summary
(package private) static class MasterTransfer.VLSNProgress
          An event of interest in the pursuit of our goal of completing the Master Transfer.
 
Constructor Summary
MasterTransfer(Set<String> replicas, long timeout, RepNode repNode)
           
 
Method Summary
 boolean abort(Exception e)
          Aborts an existing, in-progress Master Transfer operation, if it hasn't reached the point of no return.
(package private)  void addFeeder(Feeder f)
          Enables the given Feeder to contribute to this Master Transfer operation.
(package private)  long getStartTime()
           
(package private)  void giveUp(String replicaNodeName)
          Informs this Master Transfer operation that the named Feeder is shutting down, because its replica connection has been lost.
(package private)  void noteProgress(MasterTransfer.VLSNProgress p)
          Accepts a Progress event and posts it to our queue for processing by the Master Transfer operation thread.
(package private)  String transfer()
          Performs the core processing of a Master Transfer operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MasterTransfer

MasterTransfer(Set<String> replicas,
               long timeout,
               RepNode repNode)
Method Detail

abort

public boolean abort(Exception e)
Aborts an existing, in-progress Master Transfer operation, if it hasn't reached the point of no return.

Returns:
true, if the operation was cancelled, false if it's too late for a clean cancellation.

noteProgress

void noteProgress(MasterTransfer.VLSNProgress p)
Accepts a Progress event and posts it to our queue for processing by the Master Transfer operation thread.


giveUp

void giveUp(String replicaNodeName)
Informs this Master Transfer operation that the named Feeder is shutting down, because its replica connection has been lost. This of course means that we can't expect this Feeder to soon catch up with our VLSN. In particular, if we have reached Phase 2 on the strength of the progress of only this one Feeder, then we must revert back to Phase 1.

Actually all we do here is post a special kind of "progress" event to our queue; it gets processed for real in the chooseReplica() thread, along with all the other events.

See Also:
chooseReplica()

transfer

String transfer()
Performs the core processing of a Master Transfer operation. We first wait for one of the candidate target replica nodes to become completely synchronized. We then send a message to all nodes in the group (including ourselves) announcing which node is to become the new master.

If the operation fails we release any transaction commit/abort threads that may have been blocked during phase 2 of the wait. However, in the success case the release of any such transaction threads is done as a natural by-product of the invalidation of the environment when it discovers that it is no longer master (the MasterReplicaTransitionException).


addFeeder

void addFeeder(Feeder f)
Enables the given Feeder to contribute to this Master Transfer operation. Called from the FeederManager when a new Feeder is established during the time when a Master Transfer operation is already in progress.


getStartTime

long getStartTime()


Copyright (c) 2004-2012 Oracle. All rights reserved.