@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 |
---|---|
private static org.slf4j.Logger |
LOG |
protected ProcedureMember |
member |
private String |
memberName |
private ZKProcedureUtil |
zkController |
Constructor and Description |
---|
ZKProcedureMemberRpcs(ZKWatcher 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() |
private void |
receivedReachedGlobalBarrier(String path)
Pass along the procedure global barrier notification to any listeners
|
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.
|
private void |
startNewSubprocedure(String path)
Kick off a new sub-procedure on the listener with the data stored in the passed znode.
|
private void |
waitForNewProcedures() |
private void |
watchForAbortedProcedures() |
private static final org.slf4j.Logger LOG
private final ZKProcedureUtil zkController
protected ProcedureMember member
private String memberName
public ZKProcedureMemberRpcs(ZKWatcher watcher, String procType) throws org.apache.zookeeper.KeeperException
start(String, ProcedureMember)
before this can be used.public ZKProcedureUtil getZkController()
public String getMemberName()
ProcedureMemberRpcs
getMemberName
in interface ProcedureMemberRpcs
private void receivedReachedGlobalBarrier(String path)
path
- full znode path that cause the notificationprivate void watchForAbortedProcedures()
private void waitForNewProcedures()
private void startNewSubprocedure(String path)
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.
path
- full path to the znode for the procedure to startpublic 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
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.