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
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
protected ProcedureMember
private String
private final ZKProcedureUtil
-
Constructor Summary
ConstructorDescriptionZKProcedureMemberRpcs
(ZKWatcher watcher, String procType) Must callstart(String, ProcedureMember)
before this can be used. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Pass along the found abort notification to the listenervoid
close()
Each subprocedure is being executed on a member.private void
Pass along the procedure global barrier notification to any listenersvoid
This should be called by the member and should write a serialized root cause exception as to the abort znode.void
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 procedurevoid
start
(String memberName, ProcedureMember listener) Initialize and start any threads or connections the member needs.private void
startNewSubprocedure
(String path) Kick off a new sub-procedure on the listener with the data stored in the passed znode.private void
private 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:ProcedureMemberRpcs
Each subprocedure is being executed on a member. This is the identifier for the member.- Specified by:
getMemberName
in 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:
sendMemberAcquired
in 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:
sendMemberCompleted
in interfaceProcedureMemberRpcs
- Parameters:
sub
- the specifiedSubprocedure
data
- 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:
sendMemberAborted
in interfaceProcedureMemberRpcs
- Parameters:
sub
- theSubprocedure
we 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:ProcedureMemberRpcs
Initialize and start any threads or connections the member needs.- Specified by:
start
in interfaceProcedureMemberRpcs
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-