EMMA Coverage Report (generated Tue Oct 27 11:32:50 PDT 2009)
[all classes][net.spy.memcached.protocol]

COVERAGE SUMMARY FOR SOURCE FILE [GetCallbackWrapper.java]

nameclass, %method, %block, %line, %
GetCallbackWrapper.java100% (1/1)100% (5/5)87%  (73/84)95%  (19.9/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class GetCallbackWrapper100% (1/1)100% (5/5)87%  (73/84)95%  (19.9/21)
complete (): void 100% (1/1)75%  (12/16)89%  (3.6/4)
gotData (String, int, byte []): void 100% (1/1)82%  (23/28)90%  (4.5/5)
<static initializer> 100% (1/1)86%  (12/14)92%  (1.8/2)
GetCallbackWrapper (int, GetOperation$Callback): void 100% (1/1)100% (18/18)100% (7/7)
receivedStatus (OperationStatus): void 100% (1/1)100% (8/8)100% (3/3)

1/**
2 *
3 */
4package net.spy.memcached.protocol;
5 
6import net.spy.memcached.ops.GetOperation;
7import net.spy.memcached.ops.OperationStatus;
8 
9/**
10 * Wrapper callback for use in optimized gets.
11 */
12public class GetCallbackWrapper implements GetOperation.Callback {
13 
14        private static final OperationStatus END=
15                new OperationStatus(true, "END");
16 
17        private boolean completed=false;
18        private int remainingKeys=0;
19        private GetOperation.Callback cb=null;
20 
21        public GetCallbackWrapper(int k, GetOperation.Callback c) {
22                super();
23                remainingKeys=k;
24                cb=c;
25        }
26 
27        public void gotData(String key, int flags, byte[] data) {
28                assert !completed : "Got data for a completed wrapped op";
29                cb.gotData(key, flags, data);
30                if(--remainingKeys == 0) {
31                        // Fake a status line
32                        receivedStatus(END);
33                }
34        }
35 
36        public void receivedStatus(OperationStatus status) {
37                if(!completed) {
38                        cb.receivedStatus(status);
39                }
40        }
41 
42        public void complete() {
43                assert !completed;
44                cb.complete();
45                completed=true;
46        }
47 
48}

[all classes][net.spy.memcached.protocol]
EMMA 2.0.5312 (C) Vladimir Roubtsov