org.apache.hadoop.hbase.procedure
Class ZKProcedureCoordinatorRpcs

java.lang.Object
  extended by org.apache.hadoop.hbase.procedure.ZKProcedureCoordinatorRpcs
All Implemented Interfaces:
Closeable, ProcedureCoordinatorRpcs

@InterfaceAudience.Private
public class ZKProcedureCoordinatorRpcs
extends Object
implements ProcedureCoordinatorRpcs

ZooKeeper based ProcedureCoordinatorRpcs for a ProcedureCoordinator


Field Summary
protected  ProcedureCoordinator coordinator
           
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
ZKProcedureCoordinatorRpcs(ZooKeeperWatcher watcher, String procedureClass, String coordName)
           
 
Method Summary
protected  void abort(String abortNode)
          Receive a notification and propagate it to the local coordinator
 void close()
           
 void resetMembers(Procedure proc)
          Delete znodes that are no longer in use.
 void sendAbortToMembers(Procedure proc, ForeignException ee)
          This is the abort message being sent by the coordinator to member TODO this code isn't actually used but can be used to issue a cancellation from the coordinator.
 void sendGlobalBarrierAcquire(Procedure proc, byte[] info, List<String> nodeNames)
          The "acquire" phase.
 void sendGlobalBarrierReached(Procedure proc, List<String> nodeNames)
          Notify members that all members have acquired their parts of the barrier and that they can now execute under the global barrier.
 boolean start(ProcedureCoordinator coordinator)
          Start monitoring znodes in ZK - subclass hook to start monitoring znodes they are about.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG

coordinator

protected ProcedureCoordinator coordinator
Constructor Detail

ZKProcedureCoordinatorRpcs

public ZKProcedureCoordinatorRpcs(ZooKeeperWatcher watcher,
                                  String procedureClass,
                                  String coordName)
                           throws org.apache.zookeeper.KeeperException
Parameters:
watcher - zookeeper watcher. Owned by this and closed via close()
procedureClass - procedure type name is a category for when there are multiple kinds of procedures.-- this becomes a znode so be aware of the naming restrictions
coordName - name of the node running the coordinator
Throws:
org.apache.zookeeper.KeeperException - if an unexpected zk error occurs
Method Detail

sendGlobalBarrierAcquire

public final void sendGlobalBarrierAcquire(Procedure proc,
                                           byte[] info,
                                           List<String> nodeNames)
                                    throws IOException,
                                           IllegalArgumentException
The "acquire" phase. The coordinator creates a new procType/acquired/ znode dir. If znodes appear, first acquire to relevant listener or sets watch waiting for notification of the acquire node

Specified by:
sendGlobalBarrierAcquire in interface ProcedureCoordinatorRpcs
Parameters:
proc - the Procedure
info - data to be stored in the acquire node
nodeNames - children of the acquire phase
Throws:
IOException - if any failure occurs.
IllegalArgumentException - if the procedure was already marked as failed

sendGlobalBarrierReached

public void sendGlobalBarrierReached(Procedure proc,
                                     List<String> nodeNames)
                              throws IOException
Description copied from interface: ProcedureCoordinatorRpcs
Notify members that all members have acquired their parts of the barrier and that they can now execute under the global barrier. Must come after calling ProcedureCoordinatorRpcs.sendGlobalBarrierAcquire(Procedure, byte[], List)

Specified by:
sendGlobalBarrierReached in interface ProcedureCoordinatorRpcs
Parameters:
proc - name of the procedure to start
nodeNames - members to tell we have reached in-barrier phase
Throws:
IOException - if we can't reach the remote notification mechanism

resetMembers

public final void resetMembers(Procedure proc)
                        throws IOException
Delete znodes that are no longer in use.

Specified by:
resetMembers in interface ProcedureCoordinatorRpcs
Parameters:
proc - name of the procedure to reset
Throws:
IOException - if the remote notification mechanism cannot be reached

start

public final boolean start(ProcedureCoordinator coordinator)
Start monitoring znodes in ZK - subclass hook to start monitoring znodes they are about.

Specified by:
start in interface ProcedureCoordinatorRpcs
Returns:
true if succeed, false if encountered initialization errors.

sendAbortToMembers

public final void sendAbortToMembers(Procedure proc,
                                     ForeignException ee)
This is the abort message being sent by the coordinator to member TODO this code isn't actually used but can be used to issue a cancellation from the coordinator.

Specified by:
sendAbortToMembers in interface ProcedureCoordinatorRpcs
Parameters:
proc - name of the procedure that was aborted
ee - the reason why the procedure needs to be aborted

abort

protected void abort(String abortNode)
Receive a notification and propagate it to the local coordinator

Parameters:
abortNode - full znode path to the failed procedure information

close

public final void close()
                 throws IOException
Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.