EMMA Coverage Report (generated Sun Aug 17 11:20:34 PDT 2014)
[all classes][net.digitaltsunami.tmeter.record]

COVERAGE SUMMARY FOR SOURCE FILE [QueuedTimeRecorder.java]

nameclass, %method, %block, %line, %
QueuedTimeRecorder.java100% (1/1)100% (4/4)100% (38/38)100% (12/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class QueuedTimeRecorder100% (1/1)100% (4/4)100% (38/38)100% (12/12)
QueuedTimeRecorder (TimeRecorder): void 100% (1/1)100% (14/14)100% (4/4)
QueuedTimeRecorder (TimeRecorder, ActionChainShutdownType): void 100% (1/1)100% (15/15)100% (4/4)
record (Timer): void 100% (1/1)100% (5/5)100% (2/2)
shutdown (): void 100% (1/1)100% (4/4)100% (2/2)

1package net.digitaltsunami.tmeter.record;
2 
3import net.digitaltsunami.tmeter.Timer;
4import net.digitaltsunami.tmeter.TimerShell;
5import net.digitaltsunami.tmeter.action.ActionChain;
6import net.digitaltsunami.tmeter.action.ActionChainShutdownType;
7import net.digitaltsunami.tmeter.action.TimeRecorderAction;
8 
9/**
10 * Time recorder that persists timers in a separate thread. This recorder does
11 * not perform the persistence of the timer, but wraps the recorder that will
12 * persist the timer.
13 * <p>
14 * As this implementation persists the timers using a queue, it may have
15 * unfinished work when the application is shutdown. This default behavior may
16 * be overridden by providing an {@link ActionChainShutdownType} to the
17 * constructor.
18 * 
19 * @author dhagberg
20 * 
21 */
22public class QueuedTimeRecorder implements TimeRecorder {
23 
24    private ActionChain chain;
25 
26    /**
27     * Create a wrapper for the
28     * 
29     * @param recorder
30     */
31    public QueuedTimeRecorder(TimeRecorder recorder) {
32        TimeRecorderAction action = new TimeRecorderAction(recorder);
33        chain = new ActionChain(action);
34    }
35 
36    public QueuedTimeRecorder(TimeRecorder recorder, ActionChainShutdownType shutdownType) {
37        TimeRecorderAction action = new TimeRecorderAction(recorder);
38        chain = new ActionChain(action, shutdownType);
39    }
40 
41    @Override
42    public void record(Timer timer) {
43        chain.submitCompletedTimer(timer);
44    }
45 
46    /**
47     * Complete the current queue of timers and stop processing. No timers
48     * submitted after this action will be processed.
49     */
50    public void shutdown() {
51        chain.shutdown();
52    }
53 
54}

[all classes][net.digitaltsunami.tmeter.record]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov