public abstract class GremlinService
extends java.lang.Object
getExperiment(TrafficCoordinates)
) and actual calls to the Gremlin API.
A user obtains an instance of GremlinService
by invoking GremlinServiceFactory.getGremlinService()
.
The GremlinServiceFactory
accepts GremlinCoordinatesProvider
and GremlinConfigurationResolver
as arguments, so those may be supplied if that functionality is opted into.
The GremlinService
is used in the injection points created by the user. It's an argument to the Gremlin-provided
injection points, and also has methods like execute(TrafficCoordinates, Runnable)
and execute(TrafficCoordinates, Supplier)
to wrap arbitrary units of work in fault-injection.Modifier | Constructor and Description |
---|---|
protected |
GremlinService() |
Modifier and Type | Method and Description |
---|---|
void |
execute(TrafficCoordinates trafficCoordinates,
java.lang.Runnable underlying) |
<T> T |
execute(TrafficCoordinates trafficCoordinates,
java.util.function.Supplier<T> underlying) |
abstract java.util.Optional<ExperimentImpact> |
getExperiment(TrafficCoordinates trafficCoordinates)
Given a specific injection point (
TrafficCoordinates ), find an impact to inject, if applicable. |
abstract boolean |
hasExperiments()
Determine if any experiments are currently cached.
|
abstract void |
shutdown()
Shutdown all Gremlin resources
|
void |
tryInjectImpact(java.lang.String clazz,
java.lang.String method) |
java.lang.Runnable |
wrap(TrafficCoordinates trafficCoordinates,
java.lang.Runnable underlying) |
<T> java.util.function.Supplier<T> |
wrap(TrafficCoordinates trafficCoordinates,
java.util.function.Supplier<T> underlying) |
public void tryInjectImpact(java.lang.String clazz, java.lang.String method)
public abstract boolean hasExperiments()
public abstract java.util.Optional<ExperimentImpact> getExperiment(TrafficCoordinates trafficCoordinates)
TrafficCoordinates
), find an impact to inject, if applicable.
Is subject to some latency, as reading experiments requires calls to APItrafficCoordinates
- injection pointpublic abstract void shutdown() throws java.io.IOException
java.io.IOException
public <T> java.util.function.Supplier<T> wrap(TrafficCoordinates trafficCoordinates, java.util.function.Supplier<T> underlying)
public <T> T execute(TrafficCoordinates trafficCoordinates, java.util.function.Supplier<T> underlying)
public java.lang.Runnable wrap(TrafficCoordinates trafficCoordinates, java.lang.Runnable underlying)
public void execute(TrafficCoordinates trafficCoordinates, java.lang.Runnable underlying)