org.apache.hadoop.hbase.procedure
Class ProcedureMember

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

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class ProcedureMember
extends Object
implements Closeable

Process to kick off and manage a running Subprocedure on a member. This is the specialized part of a Procedure that actually does procedure type-specific work and reports back to the coordinator as it completes each phase.

If there is a connection error (controllerConnectionFailure(String, IOException)), all currently running subprocedures are notify to failed since there is no longer a way to reach any other members or coordinators since the rpcs are down.


Constructor Summary
ProcedureMember(ProcedureMemberRpcs rpcs, ThreadPoolExecutor pool, SubprocedureFactory factory)
          Instantiate a new ProcedureMember.
 
Method Summary
 void close()
          Best effort attempt to close the threadpool via Thread.interrupt.
 void controllerConnectionFailure(String message, IOException cause)
          The connection to the rest of the procedure group (member and coordinator) has been broken/lost/failed.
 Subprocedure createSubprocedure(String opName, byte[] data)
          This is separated from execution so that we can detect and handle the case where the subprocedure is invalid and inactionable due to bad info (like DISABLED snapshot type being sent here)
static ThreadPoolExecutor defaultPool(long wakeFrequency, long keepAlive, int procThreads, String memberName)
           
 void receiveAbortProcedure(String procName, ForeignException ee)
          Send abort to the specified procedure
 void receivedReachedGlobalBarrier(String procName)
          Notification that procedure coordinator has reached the global barrier
 boolean submitSubprocedure(Subprocedure subproc)
          Submit an subprocedure for execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcedureMember

public ProcedureMember(ProcedureMemberRpcs rpcs,
                       ThreadPoolExecutor pool,
                       SubprocedureFactory factory)
Instantiate a new ProcedureMember. This is a slave that executes subprocedures.

Parameters:
rpcs - controller used to send notifications to the procedure coordinator
pool - thread pool to submit subprocedures
factory - class that creates instances of a subprocedure.
Method Detail

defaultPool

public static ThreadPoolExecutor defaultPool(long wakeFrequency,
                                             long keepAlive,
                                             int procThreads,
                                             String memberName)

createSubprocedure

public Subprocedure createSubprocedure(String opName,
                                       byte[] data)
This is separated from execution so that we can detect and handle the case where the subprocedure is invalid and inactionable due to bad info (like DISABLED snapshot type being sent here)

Parameters:
opName -
data -
Returns:
subprocedure

submitSubprocedure

public boolean submitSubprocedure(Subprocedure subproc)
Submit an subprocedure for execution. This starts the local acquire phase.

Parameters:
subproc - the subprocedure to execute.
Returns:
true if the subprocedure was started correctly, false if it could not be started. In the latter case, the subprocedure holds a reference to the exception that caused the failure.

receivedReachedGlobalBarrier

public void receivedReachedGlobalBarrier(String procName)
Notification that procedure coordinator has reached the global barrier

Parameters:
procName - name of the subprocedure that should start running the the in-barrier phase

close

public void close()
           throws IOException
Best effort attempt to close the threadpool via Thread.interrupt.

Specified by:
close in interface Closeable
Throws:
IOException

controllerConnectionFailure

public void controllerConnectionFailure(String message,
                                        IOException cause)
The connection to the rest of the procedure group (member and coordinator) has been broken/lost/failed. This should fail any interested subprocedure, but not attempt to notify other members since we cannot reach them anymore.

Parameters:
message - description of the error
cause - the actual cause of the failure TODO i'm tempted to just remove this code completely and treat it like any other abort. Implementation wise, if this happens it is a ZK failure which means the RS will abort.

receiveAbortProcedure

public void receiveAbortProcedure(String procName,
                                  ForeignException ee)
Send abort to the specified procedure

Parameters:
procName - name of the procedure to about
ee - exception information about the abort


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.