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

COVERAGE SUMMARY FOR SOURCE FILE [CheckedOperationTimeoutException.java]

nameclass, %method, %block, %line, %
CheckedOperationTimeoutException.java100% (1/1)75%  (3/4)96%  (75/78)94%  (17/18)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CheckedOperationTimeoutException100% (1/1)75%  (3/4)96%  (75/78)94%  (17/18)
getOperations (): Collection 0%   (0/1)0%   (0/3)0%   (0/1)
CheckedOperationTimeoutException (String, Collection): void 100% (1/1)100% (9/9)100% (3/3)
CheckedOperationTimeoutException (String, Operation): void 100% (1/1)100% (6/6)100% (2/2)
createMessage (String, Collection): String 100% (1/1)100% (60/60)100% (12/12)

1package net.spy.memcached.internal;
2 
3import java.util.Collection;
4import java.util.Collections;
5import java.util.concurrent.TimeoutException;
6 
7import net.spy.memcached.MemcachedNode;
8import net.spy.memcached.ops.Operation;
9 
10/**
11 * Timeout exception that tracks the original operation.
12 */
13public class CheckedOperationTimeoutException extends TimeoutException {
14 
15        private final Collection<Operation> operations;
16 
17        /**
18         * Construct a CheckedOperationTimeoutException with the given message
19         * and operation.
20         *
21         * @param message the message
22         * @param op the operation that timed out
23         */
24        public CheckedOperationTimeoutException(String message, Operation op) {
25                this(message, Collections.singleton(op));
26        }
27 
28        public CheckedOperationTimeoutException(String message,
29                        Collection<Operation> ops) {
30                super(createMessage(message, ops));
31                operations = ops;
32        }
33 
34        private static String createMessage(String message,
35                        Collection<Operation> ops) {
36                StringBuilder rv = new StringBuilder(message);
37                rv.append(" - failing node");
38                rv.append(ops.size() == 1 ? ": " : "s: ");
39                boolean first = true;
40                for(Operation op : ops) {
41                        if(first) {
42                                first = false;
43                        } else {
44                                rv.append(", ");
45                        }
46                        MemcachedNode node = op == null ? null : op.getHandlingNode();
47                        rv.append(node == null ? "<unknown>" : node.getSocketAddress());
48                }
49                return rv.toString();
50        }
51 
52        /**
53         * Get the operation that timed out.
54         */
55        public Collection<Operation> getOperations() {
56                return operations;
57        }
58}

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