Photon Server API
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Properties | Events | List of all members
ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase Class Reference

Collects data from ICounter instances and publishes the data in a specified interval using an ICounterSampleWriter implementation. More...

Inheritance diagram for ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase:
ExitGames.Diagnostics.Monitoring.CounterSampleSender

Public Member Functions

virtual void Start ()
 Starts this instance to collect and publish counter data. More...
 
virtual void Stop ()
 Stops this instance. More...
 
IDisposable SubscribeToChannel (Channel< CounterSampleMessage > channel)
 Subscribes the sender to a channel of CounterSampleMessages. More...
 
void IncrementErrorCount ()
 
void ResetErrorCount ()
 
void Dispose ()
 Disposes this instance. More...
 
void RaiseErrorEvent (Exception exception)
 Invokes the OnError event. More...
 
void RaiseOnDisconnetedEvent ()
 Invokes the OnDisconnected event. More...
 

Public Attributes

const int DefaultInitialDelay = 10
 
const int DefaultSendInterval = 10
 
const int DefaultMaxRetryCount = -1
 
readonly string SenderId
 The local sender id. More...
 
readonly int InitialDelay = DefaultInitialDelay
 Time period to start publishing data since expired. More...
 
readonly int SendInterval = DefaultSendInterval
 The publish interval in seconds. More...
 
readonly int MaxRetryCount = DefaultMaxRetryCount
 Gets a value indicating how many error can occur during publishing before the counter publishers stops publishing. If a value equal or less than than zero is specified the counter publisher will never stop if an error occurred. The default value is -1; More...
 
readonly ICounterSampleWriter Writer
 The used ICounterSampleWriter to write data out. More...
 
readonly PoolFiber Fiber = new PoolFiber()
 The fiber for async sending. More...
 

Static Public Attributes

static readonly ILogger Log = LogManager.GetCurrentClassLogger()
 Provides a ILogger instance used to log messages into the logging framework. More...
 

Protected Member Functions

 CounterSampleSenderBase (string senderId, int initialDelay, int sendInterval, int maxRetryCount, ICounterSampleWriter writer)
 Initializes a new instance of the CounterSampleSender class. More...
 
virtual void Dispose (bool disposing)
 Stops the sender. More...
 

Properties

int ErrorCount [get]
 Gets the number of errors that occurred since the last successful publish. The counter publisher tries to publish the data again until the MaxRetryCount is reached. TODO: MT insecure More...
 
long State [get, set]
 0 = stopped, running > 0. More...
 
bool Running [get]
 
int SampleCount [get]
 The current sample count. TODO: MT insecure More...
 

Events

EventHandler< UnhandledExceptionEventArgs > OnError
 Fired when an unhandled Exception occurs during publishing. The instance stops publishing data if that happens. More...
 
EventHandler OnDisconnected
 Occurs when the underling ISocketSender is disconnected. More...
 

Detailed Description

Collects data from ICounter instances and publishes the data in a specified interval using an ICounterSampleWriter implementation.

Constructor & Destructor Documentation

ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.CounterSampleSenderBase ( string  senderId,
int  initialDelay,
int  sendInterval,
int  maxRetryCount,
ICounterSampleWriter  writer 
)
inlineprotected

Initializes a new instance of the CounterSampleSender class.

Parameters
senderIdThe sender id.
initialDelayThe publish after first seconds pass.
sendIntervalThe publish interval.
maxRetryCountMax retry count of publishing data before full stop.
writerThe data writer.

Member Function Documentation

void ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.Dispose ( )
inline

Disposes this instance.

virtual void ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.Dispose ( bool  disposing)
inlineprotectedvirtual

Stops the sender.

Parameters
disposingThe disposing.
void ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.IncrementErrorCount ( )
inline
void ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.RaiseErrorEvent ( Exception  exception)
inline

Invokes the OnError event.

Parameters
exceptionThe exception.
void ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.RaiseOnDisconnetedEvent ( )
inline

Invokes the OnDisconnected event.

void ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.ResetErrorCount ( )
inline
virtual void ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.Start ( )
inlinevirtual

Starts this instance to collect and publish counter data.

virtual void ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.Stop ( )
inlinevirtual

Stops this instance.

IDisposable ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.SubscribeToChannel ( Channel< CounterSampleMessage channel)
inline

Subscribes the sender to a channel of CounterSampleMessages.

Parameters
channelThe channel.
Returns
A subscription.

Member Data Documentation

const int ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.DefaultInitialDelay = 10
const int ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.DefaultMaxRetryCount = -1
const int ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.DefaultSendInterval = 10
readonly PoolFiber ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.Fiber = new PoolFiber()

The fiber for async sending.

readonly int ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.InitialDelay = DefaultInitialDelay

Time period to start publishing data since expired.

readonly ILogger ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.Log = LogManager.GetCurrentClassLogger()
static

Provides a ILogger instance used to log messages into the logging framework.

readonly int ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.MaxRetryCount = DefaultMaxRetryCount

Gets a value indicating how many error can occur during publishing before the counter publishers stops publishing. If a value equal or less than than zero is specified the counter publisher will never stop if an error occurred. The default value is -1;

readonly string ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.SenderId

The local sender id.

readonly int ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.SendInterval = DefaultSendInterval

The publish interval in seconds.

readonly ICounterSampleWriter ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.Writer

The used ICounterSampleWriter to write data out.

Property Documentation

int ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.ErrorCount
get

Gets the number of errors that occurred since the last successful publish. The counter publisher tries to publish the data again until the MaxRetryCount is reached. TODO: MT insecure

bool ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.Running
get
int ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.SampleCount
get

The current sample count. TODO: MT insecure

long ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.State
getset

0 = stopped, running > 0.

Event Documentation

EventHandler ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.OnDisconnected

Occurs when the underling ISocketSender is disconnected.

EventHandler<UnhandledExceptionEventArgs> ExitGames.Diagnostics.Monitoring.CounterSampleSenderBase.OnError

Fired when an unhandled Exception occurs during publishing. The instance stops publishing data if that happens.