Show / Hide Table of Contents

Class CallSlot

Represents a class that is immediately returned after transport sends RequestMsg. This class provides CallStatus and RequestID properties where the later is used to match the incoming ResponseMsg. CallSlots are kinds of "spirit-less" mailboxes that keep state about the call, but do not posess any threads/call events. Working with CallSlots from calling code's existing thread of execution is the most efficient way of working with Glue (in high load cases), as it does not create extra object instances (tasks do) for asynchronous coordination and continuation. It is possible to obtain an instance of CallSlot.AsTask in which case that instance is registered with the framework-internal reactor so task does complete normally even on timeout, however, in high-throughput apps (10K+ calls per second) this method is not the most efficient one as it allocates additional objects (task, list entry etc.) that eventually increase GC load for long runs. Note: A 3.2 Ghz 4-Core I7 server with 8Gb of ram can easily handle 40K 2-way calls a second (given little business server logic and simple payload). See also: CallReactor class

Inheritance
System.Object
CallSlot
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: NFX.Glue
Assembly: NFX.dll
Syntax
public sealed class CallSlot

Constructors

CallSlot(ClientEndPoint, ClientTransport, RequestMsg, CallStatus, Int32)

INTERNAL METHOD. Developers do not call! This constructor is used by an Async binding that delivers response after call slot was created

Declaration
public CallSlot(ClientEndPoint client, ClientTransport clientTransport, RequestMsg request, CallStatus status, int timeoutMs = 0)
Parameters
Type Name Description
ClientEndPoint client
ClientTransport clientTransport
RequestMsg request
CallStatus status
System.Int32 timeoutMs

CallSlot(ClientEndPoint, ClientTransport, Int64, DateTime, RequestMsg, ResponseMsg, Int32)

INTERNAL METHOD. Developers do not call! This constructor is used by a synchronous binding that delivers response right after sending it. ONLY for OneWayCall = false

Declaration
public CallSlot(ClientEndPoint client, ClientTransport clientTransport, long actualStartTimeTicks, DateTime actualStartTimeUtc, RequestMsg request, ResponseMsg response, int timeoutMs)
Parameters
Type Name Description
ClientEndPoint client
ClientTransport clientTransport
System.Int64 actualStartTimeTicks
System.DateTime actualStartTimeUtc
RequestMsg request
ResponseMsg response
System.Int32 timeoutMs

Fields

DEFAULT_TIMEOUT_MS

Declaration
public const int DEFAULT_TIMEOUT_MS = 20000
Field Value
Type Description
System.Int32

Properties

AsTask

Gets the CallSlot instance as a task that gets completed either instantly for one-way calls or when result arrives or timeout happens. The returned task never gets canceled

Declaration
public Task<CallSlot> AsTask { get; }
Property Value
Type Description
System.Threading.Tasks.Task<CallSlot>

Available

Returns true when response has come and available so no blocking will occur when reading response. This is a non-blocking call. Always returns true for operations marked as [OneWay]

Declaration
public bool Available { get; }
Property Value
Type Description
System.Boolean

CallContext

General-purpose property that clients can use for attaching an arbitrary context to this instance. This property has no use in the framework

Declaration
public object CallContext { get; set; }
Property Value
Type Description
System.Object

CallStatus

Returns current call status. Timeout is returned when response has not arrived from the other side in alotted time. This is a non-blocking call

Declaration
public CallStatus CallStatus { get; }
Property Value
Type Description
CallStatus

Client

Returns client endpoint that initiated this call

Declaration
public ClientEndPoint Client { get; }
Property Value
Type Description
ClientEndPoint

ClientTransport

Returns client transport that this instance is originated from

Declaration
public ClientTransport ClientTransport { get; }
Property Value
Type Description
ClientTransport

DispatchErrorMessage

Optionally returns reason of the dispatch message failure

Declaration
public string DispatchErrorMessage { get; }
Property Value
Type Description
System.String

OneWay

Indicates that this call does not expect a response message from the server side

Declaration
public bool OneWay { get; }
Property Value
Type Description
System.Boolean

RequestID

Returns request ID for the request that was sent and generated this slot instance

Declaration
public FID RequestID { get; }
Property Value
Type Description
FID

ResponseMsg

Blocks until response comes or timeout happens. Response message inspection happens in the context of a calling thread

Declaration
public ResponseMsg ResponseMsg { get; }
Property Value
Type Description
ResponseMsg

StartTime

Returns UTC timestamp of call initiation

Declaration
public DateTime StartTime { get; }
Property Value
Type Description
System.DateTime

StatRoundtripEndTimeTicks

When binding's MeasureStatTimes enabled, returns the operation end (when response arrives) tick count

Declaration
public long StatRoundtripEndTimeTicks { get; }
Property Value
Type Description
System.Int64

StatRoundtripTimeKey

When binding's MeasureStatTimes enabled, returns the name of the stat key

Declaration
public string StatRoundtripTimeKey { get; }
Property Value
Type Description
System.String

StatStartTimeTicks

When binding's MeasureStatTimes enabled, returns the operation start tick count

Declaration
public long StatStartTimeTicks { get; }
Property Value
Type Description
System.Int64

TimeoutMs

Returns timeout for this instance

Declaration
public int TimeoutMs { get; }
Property Value
Type Description
System.Int32

Methods

AsTaskReturning<TCallResult>()

Creates a wrapper task around CallSlot.AsTask and returns CallSlot.GetValue() as TCallResult-returning Task. Note: the created wrapper task is not cached

Declaration
public Task<TCallResult> AsTaskReturning<TCallResult>()
Returns
Type Description
System.Threading.Tasks.Task<TCallResult>
Type Parameters
Name Description
TCallResult

AsTaskReturningVoid()

Creates a wrapper task around CallSlot.AsTask and returns CallSlot.CheckVoidValue() Note: the created wrapper task is not cached

Declaration
public Task AsTaskReturningVoid()
Returns
Type Description
System.Threading.Tasks.Task

CheckVoidValue()

Checks for a valid void value returned from the other side, that is - gets the response message and checks it for errors, throwing RemoteError exception if one came from server. Accessing this property blocks calling thread until either ResponseMsg arrives or timeout expires. Check 'Available' property not to block. Accessing this method for [OneWay] methods throws.

Declaration
public void CheckVoidValue()

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

GetValue<T>()

Returns a value from the other side, that is - gets the response message and checks it for errors, throwing RemoteError exception if one came from server. Accessing this property blocks calling thread until either ResponseMsg arrives or timeout expires. Check 'Available' property not to block. Accessing this method for [OneWay] methods throws.

Declaration
public T GetValue<T>()
Returns
Type Description
T
Type Parameters
Name Description
T

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

Extension Methods

MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX