public class RepeatContextSupport extends SynchronizedAttributeAccessor implements RepeatContext
Constructor and Description |
---|
RepeatContextSupport(RepeatContext parent)
Constructor for
RepeatContextSupport . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Allow resources to be cleared, especially in destruction callbacks.
|
RepeatContext |
getParent()
If batches are nested, then the inner batch will be created with the
outer one as a parent.
|
int |
getStartedCount()
Public access to a counter for the number of operations attempted.
|
void |
increment()
Used by clients to increment the started count.
|
boolean |
isCompleteOnly()
Public accessor for the complete flag.
|
boolean |
isTerminateOnly()
Public accessor for the termination flag.
|
void |
registerDestructionCallback(String name,
Runnable callback)
Register a callback to be executed on close, associated with the
attribute having the given name.
|
void |
setCompleteOnly()
Signal to the framework that the current batch should complete normally,
independent of the current
CompletionPolicy . |
void |
setTerminateOnly()
Signal to the framework that the current batch should complete
abnormally, independent of the current
CompletionPolicy . |
attributeNames, equals, getAttribute, hasAttribute, hashCode, removeAttribute, setAttribute, setAttributeIfAbsent, toString
public RepeatContextSupport(RepeatContext parent)
RepeatContextSupport
. The parent can be null, but
should be set to the enclosing repeat context if there is one, e.g. if
this context is an inner loop.parent
- public boolean isCompleteOnly()
RepeatContext
isCompleteOnly
in interface RepeatContext
public void setCompleteOnly()
RepeatContext
CompletionPolicy
.setCompleteOnly
in interface RepeatContext
public boolean isTerminateOnly()
RepeatContext
isTerminateOnly
in interface RepeatContext
public void setTerminateOnly()
RepeatContext
CompletionPolicy
.setTerminateOnly
in interface RepeatContext
public RepeatContext getParent()
RepeatContext
getParent
in interface RepeatContext
public void increment()
public int getStartedCount()
RepeatContext
getStartedCount
in interface RepeatContext
public void registerDestructionCallback(String name, Runnable callback)
RepeatContext
Runnable
callback should not
throw any exceptions.registerDestructionCallback
in interface RepeatContext
name
- the name of the attribute to associated this callback with.
If this attribute is removed the callback should never be called.callback
- a Runnable
to execute when the context is closed.public void close()
RepeatContext
close
in interface RepeatContext
Copyright © 2014 Pivotal. All rights reserved.