-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CircuitBreaker Initial based on akka 2.0.5
- Add passing tests from akka 2.0.5 - Add CircuitBreakerState.cs with Open, HalfOpen, and Closed states - Add AtomicState which extends AtomicLong (mirrors functionality of State trait) - Add OpenCircuitException - Add CircuitBreaker documentation - Remove Scheduler from current implementation - Remove inappropriate xmldoc on illegalstateexception - Update flow on AtomicState::CallThrough method to be clearer and more closely match original - Add clarifying comments on "Fire and forget" NotifyTransitionListeners
- Loading branch information
Showing
11 changed files
with
1,118 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Runtime.Serialization; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Akka.Pattern; | ||
|
||
namespace Akka.TestKit | ||
{ | ||
public class TestBreaker | ||
{ | ||
public CountdownEvent HalfOpenLatch { get; private set; } | ||
public CountdownEvent OpenLatch { get; private set; } | ||
public CountdownEvent ClosedLatch { get; private set; } | ||
public CircuitBreaker Instance { get; private set; } | ||
|
||
public TestBreaker( CircuitBreaker instance ) | ||
{ | ||
HalfOpenLatch = new CountdownEvent( 1 ); | ||
OpenLatch = new CountdownEvent( 1 ); | ||
ClosedLatch = new CountdownEvent( 1 ); | ||
Instance = instance; | ||
Instance.OnClose( ( ) => { if ( !ClosedLatch.IsSet ) ClosedLatch.Signal( ); } ) | ||
.OnHalfOpen( ( ) => { if ( !HalfOpenLatch.IsSet ) HalfOpenLatch.Signal( ); } ) | ||
.OnOpen( ( ) => { if ( !OpenLatch.IsSet ) OpenLatch.Signal( ); } ); | ||
} | ||
|
||
|
||
} | ||
} |
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
Oops, something went wrong.