diff options
author | Valerij Fredriksen <valerijf@oath.com> | 2018-05-29 11:27:56 +0200 |
---|---|---|
committer | Valerij Fredriksen <valerijf@oath.com> | 2018-05-29 11:27:56 +0200 |
commit | 6f264803850772d35ff69acd2900d9a2b7f0f292 (patch) | |
tree | d2f220cf04cb11218dad2daa3960ca9723e81a87 /node-admin | |
parent | b66ac5e2cfdbc2d6a3ba07af1768c9aeba72150e (diff) |
Add suspendConverge()
Diffstat (limited to 'node-admin')
-rw-r--r-- | node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/IdempotentTask.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/IdempotentTask.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/IdempotentTask.java index d2c09aae22a..2a9cdb3ae80 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/IdempotentTask.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/IdempotentTask.java @@ -38,4 +38,22 @@ public interface IdempotentTask<T extends TaskContext> { * @throws RuntimeException (or a subclass) if the task is unable to converge. */ boolean converge(T context); + + /** + * Converge the task towards some some state where it can be suspended. The + * TaskContext should provide enough to determine what kind of suspend is wanted, e.g. + * suspension of only the task, or the task and the resources/processes it manages. + * + * suspendConverge() must be idempotent: it may be called any number of times, or + * interrupted at any time e.g. by `kill -9`. + * + * suspendConverge() is not thread safe: The caller must ensure there is at most one + * invocation of suspendConverge() at any given time. + * + * @return false if already converged, i.e. was a no-op + * @throws RuntimeException (or a subclass) if the task is unable to suspend. + */ + default boolean suspendConverge(T context) { + return false; + } } |