ObjectPoolUtil

Description

static class Tinman.Core.System.ObjectPoolUtil

Helper class for managing object pools.

Public / Methods

Debug​Interval​Tick


public static method DebugIntervalTick → ()

This method must be called repeatedly in order to provide the periodic output of debug logging messages.

This method is called automatically from the following methods:

Client code should call this method only if the above calls are not sufficient for maintaining periodic debug output.

Name​With​Identity


[Pure]
public static method NameWithIdentity → (2)

name in : string

[not-null]
The base name.

obj in : object

The object.

returns → string

The resulting object pool name.

Creates an object pool name based on the given name in and the object identity of obj in.

Pool​Clear


[ThreadSafe]
public static method PoolClear → ()

Calls IObjectPoolBaseThreadSafe.ClearThreadSafe on all registered object pools that implement IObjectPoolBaseThreadSafe.

Pool​Create


[ThreadSafe]
public static method PoolCreate → (1)

pool in : IObjectPoolBase

[not-null]
The pool to register.

Registers the given newly created object pool in.

The PoolDestroy method must always be called for pool in when the given pool in is discarded (via IDisposable.Dispose or IDeletable.Delete) or when shutting down (see TinmanModule.Shutdown).

Pool​Destroy


[ThreadSafe]
public static method PoolDestroy → (1)

pool in : IObjectPoolBase

[not-null]
The object pool that is going to be destroyed right after this method has returned.

Unregisters the given pool in, which is about to be destroyed.

Statistics


[ThreadSafe]
public static method Statistics → (3)

totalMemory out : int64

Output for the total memory consumption of all object pools.

filter opt : PredicateDelegate<ObjectPoolStats> = null

Optional filter to apply to each ObjectPoolStats value. If null, all values will be collected.

sort opt : CompareDelegate<ObjectPoolStats> = null

Optional sort order to apply to the collected ObjectPoolStats values. If null, the values will be sorted ascending according to ObjectPoolStats.PoolName (see StringUtil.Compare).

returns → ObjectPoolStats [ ]

The object pool statistics, optionally filtered and sorted.

Calls IObjectPoolBase.Statistics on all registered pools and returns the collected statistic values.

Public / Attributes

Debug​Interval


[DebugHelper]
public static attribute DebugInterval → (get,set)

value : int32

[>=0]
The debug interval, in seconds. Set to 0 to disable.

Sets the time interval to use for logging usage statistics of all registered object pools.

Log messages are emitted by Logger. Please refer to ObjectPoolStats for details on the message format for usage statistics.

The default value is 0 (i.e. disabled).

Logging

Logger


public static readonly attribute Logger → (ILogger)

The logger object of this class.