-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
addressed all javadoc warnings (#11)
* Also added a NOOP implementation of FailureFlags Signed-off-by: Jeff Nickoloff <[email protected]>
- Loading branch information
Showing
10 changed files
with
160 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
package com.gremlin.failureflags; | ||
|
||
/** | ||
* Behaviors implement specific effects or symptoms of failures that an application will experience in calls to | ||
* FailureFlags.invoke(...). When processing multiple experiments, delays should be applied before other failure types | ||
* and those failure types that can be processed without changing flow should be applied first. If multiple experiments | ||
* result in changing control flow (like exceptions, shutdowns, panics, etc.) then the behavior chain may not realize | ||
* some effects. | ||
* | ||
* This is a functional interface. An adopter might use Lambdas to provide behavior inline. | ||
* */ | ||
@FunctionalInterface | ||
public interface Behavior { | ||
/** | ||
* applyBehavior applies any behavior described by the effect statements in each experiment in the provided array. | ||
* | ||
* @param experiments an ordered array of active Experiments to apply | ||
* */ | ||
void applyBehavior(Experiment[] experiments); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
package com.gremlin.failureflags; | ||
|
||
/** | ||
* FailureFlags is an interface exposing the core functionality of the FailureFlags system. Code to this interface to | ||
* improve testability of your code. GremlinFailureFlags is the default implementation. | ||
* */ | ||
public interface FailureFlags { | ||
/** | ||
* invoke will fetch and apply the provided behaviors for any experiments targeting the provided Failure Flag. | ||
* @param flag the FailureFlag to invoke | ||
* @param behavior the specific or inline behavior to use for any active experiments | ||
* @return an array of active Experiments. null if there are no active experiments targeting the provided Failure Flag. | ||
* */ | ||
Experiment[] invoke(FailureFlag flag, Behavior behavior); | ||
/** | ||
* invoke will fetch and apply default behaviors for any experiments targeting the provided Failure Flag. | ||
* @param flag the FailureFlag to invoke | ||
* @return an array of active Experiments. null if there are no active experiments targeting the provided Failure Flag. | ||
* */ | ||
Experiment[] invoke(FailureFlag flag); | ||
/** | ||
* fetchExperiment retrieves the list of active experiments targeting the provided Failure Flag. | ||
* | ||
* @return null if there are no active experiments targeting the provided Failure Flag. | ||
* @param flag the FailureFlag to invoke | ||
* @return an array of active Experiments. null if there are no active experiments targeting the provided Failure Flag. | ||
* */ | ||
Experiment[] fetch(FailureFlag flag); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/gremlin/failureflags/NoopFailureFlags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.gremlin.failureflags; | ||
|
||
/** | ||
* NoopFailureFlags is a stub implementation of FailureFlags. It does nothing and its methods always return null. | ||
* */ | ||
public class NoopFailureFlags implements FailureFlags { | ||
@Override | ||
public Experiment[] invoke(FailureFlag flag, Behavior behavior) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Experiment[] invoke(FailureFlag flag) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Experiment[] fetch(FailureFlag flag) { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters