View Javadoc

1   /*
2      Copyright 2009 Ramon Servadei
3   
4      Licensed under the Apache License, Version 2.0 (the "License");
5      you may not use this file except in compliance with the License.
6      You may obtain a copy of the License at
7   
8          http://www.apache.org/licenses/LICENSE-2.0
9   
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15   */
16  package fulmine.util.log;
17  
18  /**
19   * A component that maintains statistics for queued items. 
20   * 
21   * @author Ramon Servadei
22   */
23  public interface IStatistics extends Runnable
24  {
25      /**
26       * Process a new event in the current interval.
27       * 
28       * @param elapsedTimeMicroSecs
29       *            the elapsed time of this event on its queue (its latency)
30       */
31      void processEvent(long elapsedTimeMicroSecs);
32  
33      /**
34       * Signals the end of a sampling interval. This will execute some form of
35       * statistics logging, dependent on the implementation.
36       * 
37       * @param queueSize
38       *            the queue size at the end of this interval
39       * @param popped
40       *            the number of items popped in this interval
41       * @param job
42       *            the job to execute in addition to any native logging
43       */
44      void intervalFinished(int queueSize, int popped);
45  }