Class ZKProcedureMemberRpcs
- All Implemented Interfaces:
Closeable,AutoCloseable,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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprotected ProcedureMemberprivate Stringprivate final ZKProcedureUtil -
Constructor Summary
ConstructorsConstructorDescriptionZKProcedureMemberRpcs(ZKWatcher watcher, String procType) Must callstart(String, ProcedureMember)before this can be used. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPass along the found abort notification to the listenervoidclose()Each subprocedure is being executed on a member.private voidPass along the procedure global barrier notification to any listenersvoidThis should be called by the member and should write a serialized root cause exception as to the abort znode.voidThis attempts to create an acquired state znode for the procedure (snapshot name).voidsendMemberCompleted(Subprocedure sub, byte[] data) This acts as the ack for a completed procedurevoidstart(String memberName, ProcedureMember listener) Initialize and start any threads or connections the member needs.private voidstartNewSubprocedure(String path) Kick off a new sub-procedure on the listener with the data stored in the passed znode.private voidprivate void
-
Field Details
-
LOG
-
zkController
-
member
-
memberName
-
-
Constructor Details
-
ZKProcedureMemberRpcs
public ZKProcedureMemberRpcs(ZKWatcher watcher, String procType) throws org.apache.zookeeper.KeeperException Must callstart(String, ProcedureMember)before this can be used.
-
-
Method Details
-
getZkController
-
getMemberName
Description copied from interface:ProcedureMemberRpcsEach subprocedure is being executed on a member. This is the identifier for the member.- Specified by:
getMemberNamein interfaceProcedureMemberRpcs- Returns:
- the member name
-
receivedReachedGlobalBarrier
Pass along the procedure global barrier notification to any listeners- Parameters:
path- full znode path that cause the notification
-
watchForAbortedProcedures
-
waitForNewProcedures
-
startNewSubprocedure
Kick off a new sub-procedure on the listener with the data stored in the passed znode.Will attempt to create the same procedure multiple times if an procedure znode with the same name is created. It is left up the coordinator to ensure this doesn't occur.
- Parameters:
path- full path to the znode for the procedure to start
-
sendMemberAcquired
This attempts to create an acquired state znode for the procedure (snapshot name). It then looks for the reached znode to trigger in-barrier execution. If not present we have a watcher, if present then trigger the in-barrier action.- Specified by:
sendMemberAcquiredin interfaceProcedureMemberRpcs- Parameters:
sub- the specifiedSubprocedure- Throws:
IOException- if we can't reach the coordinator
-
sendMemberCompleted
This acts as the ack for a completed procedure- Specified by:
sendMemberCompletedin interfaceProcedureMemberRpcs- Parameters:
sub- the specifiedSubproceduredata- the data the member returns to the coordinator along with the notification- Throws:
IOException- if we can't reach the coordinator
-
sendMemberAborted
This should be called by the member and should write a serialized root cause exception as to the abort znode.- Specified by:
sendMemberAbortedin interfaceProcedureMemberRpcs- Parameters:
sub- theSubprocedurewe are abortingee- the reason why the member's subprocedure aborted
-
abort
Pass along the found abort notification to the listener- Parameters:
abortZNode- full znode path to the failed procedure information
-
start
Description copied from interface:ProcedureMemberRpcsInitialize and start any threads or connections the member needs.- Specified by:
startin interfaceProcedureMemberRpcs
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-