View Javadoc
1   /*
2    * JBoss, Home of Professional Open Source
3    * Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
4    * contributors by the @authors tag. See the copyright.txt in the
5    * distribution for a full listing of individual contributors.
6    *
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * http://www.apache.org/licenses/LICENSE-2.0
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  package org.jboss.as.quickstarts.ejb.asynchronous;
18  
19  import java.util.concurrent.Future;
20  
21  import javax.ejb.Remote;
22  
23  /**
24   * Business interface to access asynchronous methods of the SLSB.
25   * 
26   * @author <a href="mailto:wfink@redhat.com">Wolf-Dieter Fink</a>
27   */
28  @Remote
29  public interface AsynchronousAccess {
30  
31      /**
32       * A method which is called and will not returning a result. It will be started and run to complete the work. The sleep
33       * should simulate a complex action.
34       */
35      void fireAndForget(long sleepTime);
36  
37      /**
38       * A method which is called and will return a result. It will be started and return the result after completed the work. The
39       * sleep should simulate a complex action.
40       */
41      Future<String> longerRunning(long sleepTime);
42  
43      /**
44       * A method that throws a Exception to demonstrate the behavior if the asynchronous processing fail.
45       * 
46       * @return never
47       * @throws Exception ever for demonstration purpose
48       */
49      Future<String> failure() throws IllegalAccessException;
50  }