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

COVERAGE SUMMARY FOR SOURCE FILE [ImmediateFuture.java]

nameclass, %method, %block, %line, %
ImmediateFuture.java100% (1/1)43%  (3/7)67%  (30/45)65%  (11/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ImmediateFuture100% (1/1)43%  (3/7)67%  (30/45)65%  (11/17)
cancel (boolean): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
get (long, TimeUnit): Boolean 0%   (0/1)0%   (0/9)0%   (0/3)
isCancelled (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
isDone (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
ImmediateFuture (Boolean): void 100% (1/1)100% (9/9)100% (4/4)
ImmediateFuture (Exception): void 100% (1/1)100% (12/12)100% (4/4)
get (): Boolean 100% (1/1)100% (9/9)100% (3/3)

1/**
2 *
3 */
4package net.spy.memcached.internal;
5 
6import java.util.concurrent.ExecutionException;
7import java.util.concurrent.Future;
8import java.util.concurrent.TimeUnit;
9import java.util.concurrent.TimeoutException;
10 
11/**
12 * A future that fires immediately.
13 */
14public class ImmediateFuture implements Future<Boolean> {
15        private final Boolean value;
16        private final ExecutionException exception;
17 
18        public ImmediateFuture(Boolean returnValue) {
19                value = returnValue;
20                exception = null;
21        }
22 
23        public ImmediateFuture(Exception e) {
24                value = null;
25                exception = new ExecutionException(e);
26        }
27 
28        public boolean cancel(boolean mayInterruptIfRunning) {
29                return false;
30        }
31 
32        public Boolean get() throws InterruptedException, ExecutionException {
33                if(exception != null) {
34                        throw exception;
35                }
36                return value;
37        }
38 
39        public Boolean get(long timeout, TimeUnit unit)
40                        throws InterruptedException, ExecutionException,
41                        TimeoutException {
42                if(exception != null) {
43                        throw exception;
44                }
45                return value;
46        }
47 
48        public boolean isCancelled() {
49                return false;
50        }
51 
52        public boolean isDone() {
53                return true;
54        }
55 
56}

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