@InterfaceAudience.Private public class ZKProcedureMemberRpcs extends Object implements ProcedureMemberRpcs
There can only be one ZKProcedureMemberRpcs per procedure type per member,
since each procedure type is bound to a single set of znodes. You can have multiple
ZKProcedureMemberRpcs on the same server, each serving a different member
name, but each individual rpcs is still bound to a single member name (and since they are
used to determine global progress, its important to not get this wrong).
To make this slightly more confusing, you can run multiple, concurrent procedures at the same time (as long as they have different types), from the same controller, but the same node name must be used for each procedure (though there is no conflict between the two procedure as long as they have distinct names).
There is no real error recovery with this mechanism currently -- if any the coordinator fails, its re-initialization will delete the znodes and require all in progress subprocedures to start anew.
| Modifier and Type | Field and Description |
|---|---|
protected ProcedureMember |
member |
| Constructor and Description |
|---|
ZKProcedureMemberRpcs(ZooKeeperWatcher watcher,
String procType)
Must call
start(String, ProcedureMember) before this can be used. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
abort(String abortZNode)
Pass along the found abort notification to the listener
|
void |
close() |
String |
getMemberName()
Each subprocedure is being executed on a member.
|
ZKProcedureUtil |
getZkController() |
void |
sendMemberAborted(Subprocedure sub,
ForeignException ee)
This should be called by the member and should write a serialized root cause exception as
to the abort znode.
|
void |
sendMemberAcquired(Subprocedure sub)
This attempts to create an acquired state znode for the procedure (snapshot name).
|
void |
sendMemberCompleted(Subprocedure sub)
This acts as the ack for a completed snapshot
|
void |
start(String memberName,
ProcedureMember listener)
Initialize and start any threads or connections the member needs.
|
protected ProcedureMember member
public ZKProcedureMemberRpcs(ZooKeeperWatcher watcher, String procType) throws org.apache.zookeeper.KeeperException
start(String, ProcedureMember) before this can be used.watcher - ZooKeeperWatcher to be owned by this. Closed via
close().procType - name of the znode describing the procedure typeorg.apache.zookeeper.KeeperException - if we can't reach zookeeperpublic ZKProcedureUtil getZkController()
public String getMemberName()
ProcedureMemberRpcsgetMemberName in interface ProcedureMemberRpcspublic void sendMemberAcquired(Subprocedure sub) throws IOException
sendMemberAcquired in interface ProcedureMemberRpcssub - the specified SubprocedureIOException - if we can't reach the coordinatorpublic void sendMemberCompleted(Subprocedure sub) throws IOException
sendMemberCompleted in interface ProcedureMemberRpcssub - the specified SubprocedureIOException - if we can't reach the coordinatorpublic void sendMemberAborted(Subprocedure sub, ForeignException ee)
sendMemberAborted in interface ProcedureMemberRpcssub - the Subprocedure we are abortingee - the reason why the member's subprocedure abortedprotected void abort(String abortZNode)
abortZNode - full znode path to the failed procedure informationpublic void start(String memberName, ProcedureMember listener)
ProcedureMemberRpcsstart in interface ProcedureMemberRpcspublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2014 The Apache Software Foundation. All rights reserved.