public class Operation extends Object implements AutoCloseable
The operations framework is used to track blocking operations which might possibly hang. As a blocking operation cannot be checked by the calling thread itself, the classical alternative would be to fork a thread which monitors the operation. As this approach does not scale very well, the operations framework creates a lighweight Operation object around a potentially blocking operation using a try-with-resources block.
A metrics provider will check for all operations and use its limits (set by component-kernel.conf, to warn if too many operations are active (or are probably hanging).
Other frameworks can provider further help: SIRIUS-WEB e.g. provides a list of all operations using the async command in the system console.
Modifier and Type | Class and Description |
---|---|
static class |
Operation.OperationMetrics
Provides metrics of the operation monitoring.
|
Constructor and Description |
---|
Operation(Supplier<String> name,
Duration timeout)
Creates a new operation.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
static List<Operation> |
getActiveOperations()
Returns a list of all currently active operations
|
boolean |
isOvertime()
Determines if the duration of the operation is longer than its timeout
|
String |
toString() |
public Operation(Supplier<String> name, Duration timeout)
name
- the supplier used to compute a user readable name if the operation is rendered somewheretimeout
- the timeout. If the duration is longer than the given timeout,
this operation is considered "hanging"public void close()
close
in interface AutoCloseable
public boolean isOvertime()
Copyright © 2018. All rights reserved.