@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,
byte[] data)
This acts as the ack for a completed procedure
|
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 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 typeKeeperException
- if we can't reach zookeeperpublic ZKProcedureUtil getZkController()
public String getMemberName()
ProcedureMemberRpcs
getMemberName
in interface ProcedureMemberRpcs
public void sendMemberAcquired(Subprocedure sub) throws IOException
sendMemberAcquired
in interface ProcedureMemberRpcs
sub
- the specified Subprocedure
IOException
- if we can't reach the coordinatorpublic void sendMemberCompleted(Subprocedure sub, byte[] data) throws IOException
sendMemberCompleted
in interface ProcedureMemberRpcs
sub
- the specified Subprocedure
data
- the data the member returns to the coordinator along with the notificationIOException
- if we can't reach the coordinatorpublic void sendMemberAborted(Subprocedure sub, ForeignException ee)
sendMemberAborted
in interface ProcedureMemberRpcs
sub
- 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)
ProcedureMemberRpcs
start
in interface ProcedureMemberRpcs
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException