~ubuntu-branches/ubuntu/wily/geronimo-ejb-3.2-spec/wily-proposed

« back to all changes in this revision

Viewing changes to src/main/java/javax/ejb/AsyncResult.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2015-07-02 22:35:05 UTC
  • Revision ID: package-import@ubuntu.com-20150702223505-8bzgr9yp8m3bkvyw
Tags: upstream-1.0~alpha-1
ImportĀ upstreamĀ versionĀ 1.0~alpha-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
 
3
 * contributor license agreements.  See the NOTICE file distributed with
 
4
 * this work for additional information regarding copyright ownership.
 
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
 
6
 * (the "License"); you may not use this file except in compliance with
 
7
 * the License.  You may obtain a copy of the License at
 
8
 *
 
9
 *     http://www.apache.org/licenses/LICENSE-2.0
 
10
 *
 
11
 *  Unless required by applicable law or agreed to in writing, software
 
12
 *  distributed under the License is distributed on an "AS IS" BASIS,
 
13
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
14
 *  See the License for the specific language governing permissions and
 
15
 *  limitations under the License.
 
16
 */
 
17
//
 
18
// This source code implements specifications defined by the Java
 
19
// Community Process. In order to remain compliant with the specification
 
20
// DO NOT add / change / or delete method signatures!
 
21
//
 
22
package javax.ejb;
 
23
 
 
24
import java.util.concurrent.ExecutionException;
 
25
import java.util.concurrent.Future;
 
26
import java.util.concurrent.TimeUnit;
 
27
import java.util.concurrent.TimeoutException;
 
28
 
 
29
public final class AsyncResult<V> implements Future<V> {
 
30
        private final V result;
 
31
 
 
32
        public AsyncResult(V result) {
 
33
                this.result = result;
 
34
        }
 
35
        
 
36
        public boolean cancel(boolean mayInterruptIfRunning) {
 
37
                throw new IllegalStateException();
 
38
        }
 
39
 
 
40
        public V get() throws InterruptedException, ExecutionException {
 
41
                return result;
 
42
        }
 
43
 
 
44
        public V get(long timeout, TimeUnit unit) throws InterruptedException,
 
45
                        ExecutionException, TimeoutException {
 
46
                return result;
 
47
        }
 
48
 
 
49
        public boolean isCancelled() {
 
50
                return false;
 
51
        }
 
52
 
 
53
        public boolean isDone() {
 
54
                return true;
 
55
        }
 
56
}