Class DistributedWorkQueueWorkAssigner
- java.lang.Object
-
- org.apache.accumulo.master.replication.DistributedWorkQueueWorkAssigner
-
- All Implemented Interfaces:
WorkAssigner
- Direct Known Subclasses:
SequentialWorkAssigner,UnorderedWorkAssigner
public abstract class DistributedWorkQueueWorkAssigner extends Object implements WorkAssigner
Common methods forWorkAssigners
-
-
Field Summary
Fields Modifier and Type Field Description protected AccumuloClientclientprotected AccumuloConfigurationconfprotected intmaxQueueSizeprotected DistributedWorkQueueworkQueueprotected ZooCachezooCache
-
Constructor Summary
Constructors Constructor Description DistributedWorkQueueWorkAssigner()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidassignWork()protected abstract voidcleanupFinishedWork()Remove finished replication work from the internal statevoidconfigure(AccumuloConfiguration conf, AccumuloClient client)protected voidcreateWork()Scan over theReplicationSchema.WorkSectionof the replication table adding work for entries that have data to replicate and have not already been queued.protected abstract Set<String>getQueuedWork(ReplicationTarget target)protected abstract intgetQueueSize()protected abstract voidinitializeQueuedWork()Set up any internal state before using the WorkAssignerprotected voidinitializeWorkQueue(AccumuloConfiguration conf)Initialize the DistributedWorkQueue using the proper ZK locationprotected booleanisWorkRequired(Replication.Status status)protected abstract booleanqueueWork(org.apache.hadoop.fs.Path path, ReplicationTarget target)Queue the given work for the targetprotected abstract voidremoveQueuedWork(ReplicationTarget target, String queueKey)Remove the given work from the internal stateprotected voidsetClient(AccumuloClient client)protected voidsetMaxQueueSize(int maxQueueSize)protected voidsetWorkQueue(DistributedWorkQueue workQueue)protected voidsetZooCache(ZooCache zooCache)protected abstract booleanshouldQueueWork(ReplicationTarget target)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.accumulo.server.replication.WorkAssigner
getName
-
-
-
-
Field Detail
-
client
protected AccumuloClient client
-
conf
protected AccumuloConfiguration conf
-
workQueue
protected DistributedWorkQueue workQueue
-
maxQueueSize
protected int maxQueueSize
-
zooCache
protected ZooCache zooCache
-
-
Method Detail
-
isWorkRequired
protected boolean isWorkRequired(Replication.Status status)
-
setClient
protected void setClient(AccumuloClient client)
-
setWorkQueue
protected void setWorkQueue(DistributedWorkQueue workQueue)
-
setMaxQueueSize
protected void setMaxQueueSize(int maxQueueSize)
-
setZooCache
protected void setZooCache(ZooCache zooCache)
-
initializeWorkQueue
protected void initializeWorkQueue(AccumuloConfiguration conf)
Initialize the DistributedWorkQueue using the proper ZK location
-
configure
public void configure(AccumuloConfiguration conf, AccumuloClient client)
- Specified by:
configurein interfaceWorkAssigner
-
assignWork
public void assignWork()
- Specified by:
assignWorkin interfaceWorkAssigner
-
createWork
protected void createWork()
Scan over theReplicationSchema.WorkSectionof the replication table adding work for entries that have data to replicate and have not already been queued.
-
shouldQueueWork
protected abstract boolean shouldQueueWork(ReplicationTarget target)
- Returns:
- Can replication work for the given
ReplicationTargetbe submitted to be worked on.
-
getQueueSize
protected abstract int getQueueSize()
- Returns:
- the size of the queued work
-
initializeQueuedWork
protected abstract void initializeQueuedWork()
Set up any internal state before using the WorkAssigner
-
queueWork
protected abstract boolean queueWork(org.apache.hadoop.fs.Path path, ReplicationTarget target)Queue the given work for the target- Parameters:
path- File to replicatetarget- Target for the work- Returns:
- True if the work was queued, false otherwise
-
getQueuedWork
protected abstract Set<String> getQueuedWork(ReplicationTarget target)
- Parameters:
target- Target for the work- Returns:
- Queued work for the given target
-
removeQueuedWork
protected abstract void removeQueuedWork(ReplicationTarget target, String queueKey)
Remove the given work from the internal state
-
cleanupFinishedWork
protected abstract void cleanupFinishedWork()
Remove finished replication work from the internal state
-
-