Class CallReactor
Facilititates execution of asynchronous client calls and their corresponding callback functions. This class introduces callback execution latency and is handy for cases where eventual event flow need to execute regardless of timing. The latency depends on other callback implementation as the reactor services all calls from a single thread
Inheritance
System.Object
CallReactor
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: NFX.Glue
Assembly: NFX.dll
Syntax
public sealed class CallReactor
Constructors
CallReactor(Call[])
Declaration
public CallReactor(params Call[] calls)
Parameters
Type | Name | Description |
---|---|---|
Call[] | calls |
CallReactor(Action<CallReactor>, Object, Call[])
Declaration
public CallReactor(Action<CallReactor> finishAction, object context, params Call[] calls)
Parameters
Type | Name | Description |
---|---|---|
System.Action<CallReactor> | finishAction | |
System.Object | context | |
Call[] | calls |
CallReactor(Boolean, Call[])
Declaration
public CallReactor(bool isBackground, params Call[] calls)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isBackground | |
Call[] | calls |
CallReactor(Boolean, Action<CallReactor>, Object, Call[])
Declaration
public CallReactor(bool isBackground, Action<CallReactor> finishAction, object context, params Call[] calls)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isBackground | |
System.Action<CallReactor> | finishAction | |
System.Object | context | |
Call[] | calls |
CallReactor(IEnumerable<Call>)
Declaration
public CallReactor(IEnumerable<Call> calls)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Call> | calls |
CallReactor(IEnumerable<Call>, Action<CallReactor>, Object)
Declaration
public CallReactor(IEnumerable<Call> calls, Action<CallReactor> finishAction, object context)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Call> | calls | |
System.Action<CallReactor> | finishAction | |
System.Object | context |
CallReactor(IEnumerable<Call>, Boolean)
Declaration
public CallReactor(IEnumerable<Call> calls, bool isBackground)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Call> | calls | |
System.Boolean | isBackground |
CallReactor(IEnumerable<Call>, Boolean, Action<CallReactor>, Object)
Declaration
public CallReactor(IEnumerable<Call> calls, bool isBackground, Action<CallReactor> finishAction, object context)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Call> | calls | |
System.Boolean | isBackground | |
System.Action<CallReactor> | finishAction | |
System.Object | context |
Fields
THREAD_NAME
Declaration
public const string THREAD_NAME = "Glue Call Reactor"
Field Value
Type | Description |
---|---|
System.String |
THREAD_SLEEP_MSEC
Declaration
public const int THREAD_SLEEP_MSEC = 25
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
Calls
Enumerates all calls that this reactor instance services
Declaration
public IEnumerable<Call> Calls { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Call> |
Context
Gets/sets reactor-wide context which is originally supplied in .ctor or null
Declaration
public object Context { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
Exception
Returns an exception surfaced during reactor operation or null
Declaration
public Exception Exception { get; }
Property Value
Type | Description |
---|---|
System.Exception |
Finished
Retunrs true when all calls have finished processing
Declaration
public bool Finished { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
Wait()
Blocks until all calls managed by this reactor instance have ended
Declaration
public void Wait()
WaitAll(IEnumerable<CallReactor>)
Waits for all reactors to finish
Declaration
public static void WaitAll(IEnumerable<CallReactor> reactors)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<CallReactor> | reactors |