@InterfaceAudience.Private public class InMemoryProcedureIterator extends Object implements ProcedureStore.ProcedureIterator
Modifier and Type | Field and Description |
---|---|
private ProtoAndProcedure |
current |
private Iterator<ProtoAndProcedure> |
iter |
private List<ProtoAndProcedure> |
procs |
Constructor and Description |
---|
InMemoryProcedureIterator(List<ProtoAndProcedure> procs) |
Modifier and Type | Method and Description |
---|---|
private void |
checkNext() |
boolean |
hasNext()
Returns true if the iterator has more elements.
|
boolean |
isNextFinished()
Calling this method does not need to convert the protobuf message to the Procedure class, so
if it returns true we can call
ProcedureStore.ProcedureIterator.skipNext() to skip the procedure without
deserializing. |
private void |
moveToNext() |
Procedure<?> |
next()
Returns the next procedure in the iteration.
|
void |
reset()
Reset the Iterator by seeking to the beginning of the list.
|
void |
skipNext()
Skip the next procedure
This method is used to skip the deserializing of the procedure to increase performance, as
when calling next we need to convert the protobuf message to the Procedure class.
|
private final List<ProtoAndProcedure> procs
private Iterator<ProtoAndProcedure> iter
private ProtoAndProcedure current
public InMemoryProcedureIterator(List<ProtoAndProcedure> procs)
public void reset()
ProcedureStore.ProcedureIterator
reset
in interface ProcedureStore.ProcedureIterator
public boolean hasNext()
ProcedureStore.ProcedureIterator
hasNext
in interface ProcedureStore.ProcedureIterator
private void checkNext()
public boolean isNextFinished()
ProcedureStore.ProcedureIterator
ProcedureStore.ProcedureIterator.skipNext()
to skip the procedure without
deserializing. This could increase the performance.isNextFinished
in interface ProcedureStore.ProcedureIterator
private void moveToNext()
public void skipNext()
ProcedureStore.ProcedureIterator
skipNext
in interface ProcedureStore.ProcedureIterator
public Procedure<?> next() throws IOException
ProcedureStore.ProcedureIterator
next
in interface ProcedureStore.ProcedureIterator
IOException
- if there was an error fetching/deserializing the procedureCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.