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

COVERAGE SUMMARY FOR SOURCE FILE [FlushOperationImpl.java]

nameclass, %method, %block, %line, %
FlushOperationImpl.java100% (1/1)100% (4/4)100% (72/72)100% (17/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class FlushOperationImpl100% (1/1)100% (4/4)100% (72/72)100% (17/17)
<static initializer> 100% (1/1)100% (10/10)100% (2/2)
FlushOperationImpl (int, OperationCallback): void 100% (1/1)100% (7/7)100% (3/3)
handleLine (String): void 100% (1/1)100% (20/20)100% (4/4)
initialize (): void 100% (1/1)100% (35/35)100% (8/8)

1// Copyright (c) 2006  Dustin Sallings <dustin@spy.net>
2 
3package net.spy.memcached.protocol.ascii;
4 
5import java.nio.ByteBuffer;
6 
7import net.spy.memcached.ops.FlushOperation;
8import net.spy.memcached.ops.OperationCallback;
9import net.spy.memcached.ops.OperationState;
10import net.spy.memcached.ops.OperationStatus;
11 
12/**
13 * Memcached flush_all operation.
14 */
15final class FlushOperationImpl extends OperationImpl
16        implements FlushOperation {
17 
18        private static final byte[] FLUSH="flush_all\r\n".getBytes();
19 
20        private static final OperationStatus OK=
21                new OperationStatus(true, "OK");
22 
23        private final int delay;
24 
25        public FlushOperationImpl(int d, OperationCallback cb) {
26                super(cb);
27                delay=d;
28        }
29 
30        @Override
31        public void handleLine(String line) {
32                getLogger().debug("Flush completed successfully");
33                getCallback().receivedStatus(matchStatus(line, OK));
34                transitionState(OperationState.COMPLETE);
35        }
36 
37        @Override
38        public void initialize() {
39                ByteBuffer b=null;
40                if(delay == -1) {
41                        b=ByteBuffer.wrap(FLUSH);
42                } else {
43                        b=ByteBuffer.allocate(32);
44                        b.put( ("flush_all " + delay + "\r\n").getBytes());
45                        b.flip();
46                }
47                setBuffer(b);
48        }
49}

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