66
77namespace Splunk
88{
9+ /// <summary>
10+ /// Class used at HEC loggers to control batch process.
11+ /// </summary>
912 public class BatchManager
1013 {
11- ConcurrentBag < object > events ;
14+ readonly ConcurrentBag < object > events ;
15+ readonly uint batchSizeCount ;
16+ readonly uint batchIntervalInMiliseconds ;
17+ readonly Timer timer ;
18+ readonly Action < List < object > > emitAction ;
19+
1220 bool isDisposed ;
1321 bool isDisposing ;
14- uint batchSizeCount ;
15- uint batchIntervalInMiliseconds ;
16- Timer timer ;
17- Action < List < object > > emitAction ;
1822
23+ /// <summary>
24+ /// Initializes a new instance of the <see cref="T:Splunk.BatchManager"/> class.
25+ /// </summary>
26+ /// <param name="batchSizeCount">Batch size count.</param>
27+ /// <param name="batchIntervalInMiliseconds">Batch interval in miliseconds.</param>
28+ /// <param name="emitAction">Emit action to be invoked at Emit process.</param>
1929 public BatchManager ( uint batchSizeCount , uint batchIntervalInMiliseconds , Action < List < object > > emitAction )
2030 {
2131 events = new ConcurrentBag < object > ( ) ;
@@ -69,6 +79,10 @@ void Emit()
6979 emitAction ? . Invoke ( emitEvents ) ;
7080 }
7181
82+ /// <summary>
83+ /// Add the specified item for futher batch emit process.
84+ /// </summary>
85+ /// <param name="item">Item to be added for next batch emit process.</param>
7286 public void Add ( object item )
7387 {
7488 if ( ! isDisposed && ! isDisposing )
@@ -79,6 +93,14 @@ public void Add(object item)
7993 }
8094 }
8195
96+ /// <summary>
97+ /// Releases all resource used by the <see cref="T:Splunk.BatchManager"/> object.
98+ /// </summary>
99+ /// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="T:Splunk.BatchManager"/>. The
100+ /// <see cref="Dispose"/> method leaves the <see cref="T:Splunk.BatchManager"/> in an unusable state. After
101+ /// calling <see cref="Dispose"/>, you must release all references to the <see cref="T:Splunk.BatchManager"/> so
102+ /// the garbage collector can reclaim the memory that the <see cref="T:Splunk.BatchManager"/> was occupying.
103+ /// </remarks>
82104 public void Dispose ( )
83105 {
84106 if ( ! isDisposed )
0 commit comments