1 package org.skife.jdbi.v2;
2
3 /**
4 * This class collects timing information for every database operation.
5 */
6 public interface TimingCollector
7 {
8 /**
9 * This method is executed every time there is information to collect. Grouping of the
10 * timing information is up to the implementation of this interface.
11 *
12 * @param ctx The Statement Context, which contains additional information about the
13 * statement that just ran.
14 * @param elapsedTime The elapsed time in nanoseconds.
15 */
16 void collect(long elapsedTime, StatementContext ctx);
17
18 /**
19 * A No Operation Timing Collector. It can be used to "plug" into DBI if more sophisticated
20 * collection is not needed.
21 */
22 TimingCollector NOP_TIMING_COLLECTOR = new NopTimingCollector();
23
24 public static final class NopTimingCollector implements TimingCollector
25 {
26 public void collect(final long elapsedTime, final StatementContext ctx)
27 {
28 // GNDN
29 }
30 };
31 }