[jboss-cvs] JBossAS SVN: r82548 - in projects/ejb3/trunk/docs/tutorial: asynch and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 26 02:07:47 EST 2008


Author: jaikiran
Date: 2008-12-26 02:07:46 -0500 (Fri, 26 Dec 2008)
New Revision: 82548

Added:
   projects/ejb3/trunk/docs/tutorial/asynch/
   projects/ejb3/trunk/docs/tutorial/asynch/asynch.html
   projects/ejb3/trunk/docs/tutorial/asynch/asynch.wiki
   projects/ejb3/trunk/docs/tutorial/asynch/build.xml
   projects/ejb3/trunk/docs/tutorial/asynch/jndi.properties
   projects/ejb3/trunk/docs/tutorial/asynch/log4j.xml
   projects/ejb3/trunk/docs/tutorial/asynch/pom.xml
   projects/ejb3/trunk/docs/tutorial/asynch/src/
Removed:
   projects/ejb3/trunk/docs/tutorial/asynch/asynch.html
   projects/ejb3/trunk/docs/tutorial/asynch/asynch.wiki
   projects/ejb3/trunk/docs/tutorial/asynch/build.xml
   projects/ejb3/trunk/docs/tutorial/asynch/jndi.properties
   projects/ejb3/trunk/docs/tutorial/asynch/log4j.xml
   projects/ejb3/trunk/docs/tutorial/asynch/src/
Modified:
   projects/ejb3/trunk/docs/tutorial/asynch/src/org/jboss/tutorial/asynch/client/Client.java
Log:
Working version of the JBoss specific Asynchronous invocations of EJB

Copied: projects/ejb3/trunk/docs/tutorial/asynch (from rev 82032, projects/oldstuff/ejb3/docs/tutorial/asynch)

Deleted: projects/ejb3/trunk/docs/tutorial/asynch/asynch.html
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/asynch/asynch.html	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/asynch/asynch.html	2008-12-26 07:07:46 UTC (rev 82548)
@@ -1,81 +0,0 @@
-<html>
-<body>
-<p>
-<h2> Asynchronous calls</h2>
-
-</p><p>
-A JBoss extension to EJB 3.0 is that from the remote or local interface of a stateful session bean, stateless session bean or service bean you can obtain an asynchronous proxy. Methods called on the asynchronous proxy will be executed asynchronously, and the results can be obtained later on.
-</p><p>
-<h3>Example simple ServicePOJO</h3>
-
-Take a look at <a href="src/org/jboss/tutorial/asynch/bean/Echo.java">Echo.java</a> and <a href="src/org/jboss/tutorial/asynch/bean/EchoRemote.java">EchoRemote.java</a>. They define a normal stateless session bean with a remote interface, nothing special. Now take a look at <a href="src/org/jboss/tutorial/asynch/client/Client.java">Client.java</a>. It shows an example of asynchronous calls on a remote interface. We will walk through what it does here. The following lines just obtain the remote interface of the bean and call a method following the standard synchronous usage pattern
-<pre>
-   InitialContext ctx = new InitialContext();
-   Echo echo = (Echo)ctx.lookup(org.jboss.tutorial.asynch.bean.Echo.class.getName());
-   System.out.println("-------- Synchronous call");
-   String ret = echo.echo("normal call");
-   System.out.println(ret);
-</pre>
-</p><p>
-Next we obtain the asynchronous proxy and make a call via that. The method will be invoked asynchronously
-</p><p>
-<pre>
-   Echo asynchEcho = Asynch.getAsynchronousProxy(echo);
-   System.out.println("-------- Asynchronous call");
-   ret = asynchEcho.echo("asynchronous call");
-   System.out.println("Direct return of async invocation is: " + ret);
-</pre>
-</p><p>
-As shown, you obtain the asynchronous proxy by calling <tt>org.jboss.ejb3.asynchronous.Asynch.getAsynchronousProxy()</tt> . All methods invoked on this proxy are invoked asynchronously, and the returned value will always be null (or 0 in the case of numeric primitive types). In this example, the echo() method called has low overhead, but imagine if this was a method that took a long time. In this case it would be good to be able to go ahead with some other tasks. In Client.java, we make another call on the normal remote interface while "waiting" for the asynchronous call.
-</p><p>
-<pre>
-   System.out.println("-------- Synchronous call");
-   ret = echo.echo("normal call 2");
-   System.out.println(ret);
-</pre>
-</p><p>
-Now that we have finished everything we want to do while waiting for the asynchronus call to complete, we cast the asynchronus proxy to <tt>AsynchProvider</tt> and get hold of the <tt>Future</tt> contained.
-</p><p>
-<pre>
-      System.out.println("-------- Result of Asynchronous call");
-      AsynchProvider provider = (AsynchProvider)asynchEcho;
-      Future future = provider.getFuture();
-</pre>
-</p><p>
-Next we make sure that the asynchronus invocation has completed, and get the return value of the asynchronus invocation.
-<pre>
-      System.out.println("Waiting for asynbch invocation to complete");
-      while (!future.isDone())
-      {
-         Thread.sleep(100);
-      }
-      ret = (String)future.get();
-      System.out.println(ret);
-</pre>
-</p><p>
-</p><p>
-<h3>Building and running</h3>
-
-To build and run the example, make sure you have ejb3.deployer installed in JBoss 4.0.x and have JBoss running. See the reference manual on how to install EJB 3.0.
-</p><p>
-<pre>
-Unix:    $ export JBOSS_HOME=&lt;where your jboss 4.0 distribution is&gt;
-Windows: $ set JBOSS_HOME=&lt;where your jboss 4.0 distribution is&gt;
-$ ant
-$ ant run
-Buildfile: build.xml
-
-run:
-     [java] -------- Synchronous call
-     [java] normal call
-     [java] -------- Asynchronous call
-     [java] Direct return of async invocation is: null
-     [java] -------- Synchronous call
-     [java] normal call 2
-     [java] -------- Result of Asynchronous call
-     [java] Waiting for asynbch invocation to complete
-     [java] asynchronous call
-</pre>
-</p>
-</body>
-</html>

Copied: projects/ejb3/trunk/docs/tutorial/asynch/asynch.html (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/asynch/asynch.html)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/asynch/asynch.html	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/asynch/asynch.html	2008-12-26 07:07:46 UTC (rev 82548)
@@ -0,0 +1,81 @@
+<html>
+<body>
+<p>
+<h2> Asynchronous calls</h2>
+
+</p><p>
+A JBoss extension to EJB 3.0 is that from the remote or local interface of a stateful session bean, stateless session bean or service bean you can obtain an asynchronous proxy. Methods called on the asynchronous proxy will be executed asynchronously, and the results can be obtained later on.
+</p><p>
+<h3>Example simple ServicePOJO</h3>
+
+Take a look at <a href="src/org/jboss/tutorial/asynch/bean/Echo.java">Echo.java</a> and <a href="src/org/jboss/tutorial/asynch/bean/EchoRemote.java">EchoRemote.java</a>. They define a normal stateless session bean with a remote interface, nothing special. Now take a look at <a href="src/org/jboss/tutorial/asynch/client/Client.java">Client.java</a>. It shows an example of asynchronous calls on a remote interface. We will walk through what it does here. The following lines just obtain the remote interface of the bean and call a method following the standard synchronous usage pattern
+<pre>
+   InitialContext ctx = new InitialContext();
+   Echo echo = (Echo)ctx.lookup(org.jboss.tutorial.asynch.bean.Echo.class.getName());
+   System.out.println("-------- Synchronous call");
+   String ret = echo.echo("normal call");
+   System.out.println(ret);
+</pre>
+</p><p>
+Next we obtain the asynchronous proxy and make a call via that. The method will be invoked asynchronously
+</p><p>
+<pre>
+   Echo asynchEcho = Asynch.getAsynchronousProxy(echo);
+   System.out.println("-------- Asynchronous call");
+   ret = asynchEcho.echo("asynchronous call");
+   System.out.println("Direct return of async invocation is: " + ret);
+</pre>
+</p><p>
+As shown, you obtain the asynchronous proxy by calling <tt>org.jboss.ejb3.asynchronous.Asynch.getAsynchronousProxy()</tt> . All methods invoked on this proxy are invoked asynchronously, and the returned value will always be null (or 0 in the case of numeric primitive types). In this example, the echo() method called has low overhead, but imagine if this was a method that took a long time. In this case it would be good to be able to go ahead with some other tasks. In Client.java, we make another call on the normal remote interface while "waiting" for the asynchronous call.
+</p><p>
+<pre>
+   System.out.println("-------- Synchronous call");
+   ret = echo.echo("normal call 2");
+   System.out.println(ret);
+</pre>
+</p><p>
+Now that we have finished everything we want to do while waiting for the asynchronus call to complete, we cast the asynchronus proxy to <tt>AsynchProvider</tt> and get hold of the <tt>Future</tt> contained.
+</p><p>
+<pre>
+      System.out.println("-------- Result of Asynchronous call");
+      AsynchProvider provider = (AsynchProvider)asynchEcho;
+      Future future = provider.getFuture();
+</pre>
+</p><p>
+Next we make sure that the asynchronus invocation has completed, and get the return value of the asynchronus invocation.
+<pre>
+      System.out.println("Waiting for asynbch invocation to complete");
+      while (!future.isDone())
+      {
+         Thread.sleep(100);
+      }
+      ret = (String)future.get();
+      System.out.println(ret);
+</pre>
+</p><p>
+</p><p>
+<h3>Building and running</h3>
+
+To build and run the example, make sure you have ejb3.deployer installed in JBoss 4.0.x and have JBoss running. See the reference manual on how to install EJB 3.0.
+</p><p>
+<pre>
+Unix:    $ export JBOSS_HOME=&lt;where your jboss 4.0 distribution is&gt;
+Windows: $ set JBOSS_HOME=&lt;where your jboss 4.0 distribution is&gt;
+$ ant
+$ ant run
+Buildfile: build.xml
+
+run:
+     [java] -------- Synchronous call
+     [java] normal call
+     [java] -------- Asynchronous call
+     [java] Direct return of async invocation is: null
+     [java] -------- Synchronous call
+     [java] normal call 2
+     [java] -------- Result of Asynchronous call
+     [java] Waiting for asynbch invocation to complete
+     [java] asynchronous call
+</pre>
+</p>
+</body>
+</html>

Deleted: projects/ejb3/trunk/docs/tutorial/asynch/asynch.wiki
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/asynch/asynch.wiki	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/asynch/asynch.wiki	2008-12-26 07:07:46 UTC (rev 82548)
@@ -1,72 +0,0 @@
-!!! Asynchronous calls
-
-A JBoss extension to EJB 3.0 is that from the remote or local interface of a stateful session bean, stateless session bean or service bean you can obtain an asynchronous proxy. Methods called on the asynchronous proxy will be executed asynchronously, and the results can be obtained later on.
-
-!!Example simple ServicePOJO
-Take a look at [Echo.java|src/org/jboss/tutorial/asynch/bean/Echo.java] and [EchoRemote.java|src/org/jboss/tutorial/asynch/bean/EchoRemote.java]. They define a normal stateless session bean with a remote interface, nothing special. Now take a look at [Client.java|src/org/jboss/tutorial/asynch/client/Client.java]. It shows an example of asynchronous calls on a remote interface. We will walk through what it does here. The following lines just obtain the remote interface of the bean and call a method following the standard synchronous usage pattern
-{{{
-   InitialContext ctx = new InitialContext();
-   Echo echo = (Echo)ctx.lookup(org.jboss.tutorial.asynch.bean.Echo.class.getName());
-   System.out.println("-------- Synchronous call");
-   String ret = echo.echo("normal call");
-   System.out.println(ret);
-}}}
-
-Next we obtain the asynchronous proxy and make a call via that. The method will be invoked asynchronously
-
-{{{
-   Echo asynchEcho = Asynch.getAsynchronousProxy(echo);
-   System.out.println("-------- Asynchronous call");
-   ret = asynchEcho.echo("asynchronous call");
-   System.out.println("Direct return of async invocation is: " + ret);
-}}}
-
-As shown, you obtain the asynchronous proxy by calling {{org.jboss.ejb3.asynchronous.Asynch.getAsynchronousProxy()}} . All methods invoked on this proxy are invoked asynchronously, and the returned value will always be null (or 0 in the case of numeric primitive types). In this example, the echo() method called has low overhead, but imagine if this was a method that took a long time. In this case it would be good to be able to go ahead with some other tasks. In Client.java, we make another call on the normal remote interface while "waiting" for the asynchronous call.
-
-{{{
-   System.out.println("-------- Synchronous call");
-   ret = echo.echo("normal call 2");
-   System.out.println(ret);
-}}}
-
-Now that we have finished everything we want to do while waiting for the asynchronus call to complete, we cast the asynchronus proxy to {{AsynchProvider}} and get hold of the {{Future}} contained.
-
-{{{
-      System.out.println("-------- Result of Asynchronous call");
-      AsynchProvider provider = (AsynchProvider)asynchEcho;
-      Future future = provider.getFuture();
-}}}
-
-Next we make sure that the asynchronus invocation has completed, and get the return value of the asynchronus invocation.
-{{{
-      System.out.println("Waiting for asynbch invocation to complete");
-      while (!future.isDone())
-      {
-         Thread.sleep(100);
-      }
-      ret = (String)future.get();
-      System.out.println(ret);
-}}}
-
-
-!!Building and running
-To build and run the example, make sure you have ejb3.deployer installed in JBoss 4.0.x and have JBoss running. See the reference manual on how to install EJB 3.0.
-
-{{{
-Unix:    $ export JBOSS_HOME=<where your jboss 4.0 distribution is>
-Windows: $ set JBOSS_HOME=<where your jboss 4.0 distribution is>
-$ ant
-$ ant run
-Buildfile: build.xml
-
-run:
-     [java] -------- Synchronous call
-     [java] normal call
-     [java] -------- Asynchronous call
-     [java] Direct return of async invocation is: null
-     [java] -------- Synchronous call
-     [java] normal call 2
-     [java] -------- Result of Asynchronous call
-     [java] Waiting for asynbch invocation to complete
-     [java] asynchronous call
-}}}

Copied: projects/ejb3/trunk/docs/tutorial/asynch/asynch.wiki (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/asynch/asynch.wiki)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/asynch/asynch.wiki	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/asynch/asynch.wiki	2008-12-26 07:07:46 UTC (rev 82548)
@@ -0,0 +1,72 @@
+!!! Asynchronous calls
+
+A JBoss extension to EJB 3.0 is that from the remote or local interface of a stateful session bean, stateless session bean or service bean you can obtain an asynchronous proxy. Methods called on the asynchronous proxy will be executed asynchronously, and the results can be obtained later on.
+
+!!Example simple ServicePOJO
+Take a look at [Echo.java|src/org/jboss/tutorial/asynch/bean/Echo.java] and [EchoRemote.java|src/org/jboss/tutorial/asynch/bean/EchoRemote.java]. They define a normal stateless session bean with a remote interface, nothing special. Now take a look at [Client.java|src/org/jboss/tutorial/asynch/client/Client.java]. It shows an example of asynchronous calls on a remote interface. We will walk through what it does here. The following lines just obtain the remote interface of the bean and call a method following the standard synchronous usage pattern
+{{{
+   InitialContext ctx = new InitialContext();
+   Echo echo = (Echo)ctx.lookup(org.jboss.tutorial.asynch.bean.Echo.class.getName());
+   System.out.println("-------- Synchronous call");
+   String ret = echo.echo("normal call");
+   System.out.println(ret);
+}}}
+
+Next we obtain the asynchronous proxy and make a call via that. The method will be invoked asynchronously
+
+{{{
+   Echo asynchEcho = Asynch.getAsynchronousProxy(echo);
+   System.out.println("-------- Asynchronous call");
+   ret = asynchEcho.echo("asynchronous call");
+   System.out.println("Direct return of async invocation is: " + ret);
+}}}
+
+As shown, you obtain the asynchronous proxy by calling {{org.jboss.ejb3.asynchronous.Asynch.getAsynchronousProxy()}} . All methods invoked on this proxy are invoked asynchronously, and the returned value will always be null (or 0 in the case of numeric primitive types). In this example, the echo() method called has low overhead, but imagine if this was a method that took a long time. In this case it would be good to be able to go ahead with some other tasks. In Client.java, we make another call on the normal remote interface while "waiting" for the asynchronous call.
+
+{{{
+   System.out.println("-------- Synchronous call");
+   ret = echo.echo("normal call 2");
+   System.out.println(ret);
+}}}
+
+Now that we have finished everything we want to do while waiting for the asynchronus call to complete, we cast the asynchronus proxy to {{AsynchProvider}} and get hold of the {{Future}} contained.
+
+{{{
+      System.out.println("-------- Result of Asynchronous call");
+      AsynchProvider provider = (AsynchProvider)asynchEcho;
+      Future future = provider.getFuture();
+}}}
+
+Next we make sure that the asynchronus invocation has completed, and get the return value of the asynchronus invocation.
+{{{
+      System.out.println("Waiting for asynbch invocation to complete");
+      while (!future.isDone())
+      {
+         Thread.sleep(100);
+      }
+      ret = (String)future.get();
+      System.out.println(ret);
+}}}
+
+
+!!Building and running
+To build and run the example, make sure you have ejb3.deployer installed in JBoss 4.0.x and have JBoss running. See the reference manual on how to install EJB 3.0.
+
+{{{
+Unix:    $ export JBOSS_HOME=<where your jboss 4.0 distribution is>
+Windows: $ set JBOSS_HOME=<where your jboss 4.0 distribution is>
+$ ant
+$ ant run
+Buildfile: build.xml
+
+run:
+     [java] -------- Synchronous call
+     [java] normal call
+     [java] -------- Asynchronous call
+     [java] Direct return of async invocation is: null
+     [java] -------- Synchronous call
+     [java] normal call 2
+     [java] -------- Result of Asynchronous call
+     [java] Waiting for asynbch invocation to complete
+     [java] asynchronous call
+}}}

Deleted: projects/ejb3/trunk/docs/tutorial/asynch/build.xml
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/asynch/build.xml	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/asynch/build.xml	2008-12-26 07:07:46 UTC (rev 82548)
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- ======================================================================= -->
-<!-- JBoss build file                                                       -->
-<!-- ======================================================================= -->
-
-<project name="JBoss" default="ejbjar" basedir=".">
-
-   <property environment="env"/>
-   <property name="src.dir" value="${basedir}/src"/>
-   <property name="jboss.home" value="${env.JBOSS_HOME}"/>
-   <property name="jboss.server.config" value="all"/>
-   <property name="build.dir" value="${basedir}/build"/>
-   <property name="build.classes.dir" value="${build.dir}/classes"/>
-
-   <!-- Build classpath -->
-   <path id="classpath">
-      <!-- So that we can get jndi.properties for InitialContext and log4j.xml
-   -->
-      <pathelement location="${basedir}"/>
-      <fileset dir="${jboss.home}/lib">
-         <include name="**/*.jar"/>
-      </fileset>
-      <fileset dir="${jboss.home}/server/${jboss.server.config}/lib">
-         <include name="**/*.jar"/>
-      </fileset>
-      <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/ejb3.deployer">
-         <include name="*.jar"/>
-      </fileset>
-      <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/jboss-aop-jdk50.deployer">
-         <include name="*.jar"/>
-      </fileset>
-      <pathelement location="${build.classes.dir}"/>
-   </path>
-
-   <property name="build.classpath" refid="classpath"/>
-
-   <!-- =================================================================== -->
-   <!-- Prepares the build directory                                        -->
-   <!-- =================================================================== -->
-   <target name="prepare">
-      <mkdir dir="${build.dir}"/>
-      <mkdir dir="${build.classes.dir}"/>
-   </target>
-
-   <!-- =================================================================== -->
-   <!-- Compiles the source code                                            -->
-   <!-- =================================================================== -->
-   <target name="compile" depends="prepare">
-      <javac srcdir="${src.dir}"
-         destdir="${build.classes.dir}"
-         debug="on"
-         deprecation="on"
-         optimize="off"
-         includes="**">
-         <classpath refid="classpath"/>
-      </javac>
-   </target>
-
-   <target name="ejbjar" depends="compile">
-      <jar jarfile="build/tutorial.jar">
-         <fileset dir="${build.classes.dir}">
-            <include name="**/*.class"/>
-         </fileset>
-      </jar>
-      <copy file="build/tutorial.jar" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
-   </target>
-
-   <target name="run" depends="ejbjar">
-      <java classname="org.jboss.tutorial.asynch.client.Client" fork="yes" dir=".">
-         <classpath refid="classpath"/>
-      </java>
-   </target>
-
-   <!-- =================================================================== -->
-   <!-- Cleans up generated stuff                                           -->
-   <!-- =================================================================== -->
-   <target name="clean.db">
-      <delete dir="${jboss.home}/server/${jboss.server.config}/data/hypersonic"/>
-   </target>
-
-   <target name="clean">
-      <delete dir="${build.dir}"/>
-      <delete file="${jboss.home}/server/${jboss.server.config}/deploy/tutorial.jar"/>
-   </target>
-
-
-</project>
-

Copied: projects/ejb3/trunk/docs/tutorial/asynch/build.xml (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/asynch/build.xml)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/asynch/build.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/asynch/build.xml	2008-12-26 07:07:46 UTC (rev 82548)
@@ -0,0 +1,81 @@
+<?xml version="1.0"?>
+
+<!-- ======================================================================= -->
+<!-- JBoss build file                                                       -->
+<!-- ======================================================================= -->
+
+<project name="JBoss" default="ejbjar" basedir=".">
+
+   <property environment="env"/>
+   <property name="src.dir" value="${basedir}/src"/>
+	<property name="jboss.home" value="${env.JBOSS_HOME}"/>
+	<property name="jboss.server.config" value="default"/>
+	<property name="build.dir" value="${basedir}/build"/>
+   	<property name="build.classes.dir" value="${build.dir}/classes"/>
+	<property name="build.artifact" value="jboss-ejb3-tutorial-asynch.jar"/>
+
+   <!-- Build classpath -->
+   <path id="classpath">
+      <!-- So that we can get jndi.properties for InitialContext -->
+      <pathelement location="${basedir}"/>
+   		<!-- Only the jbossall-client.jar should ideally be sufficient -->
+      <fileset dir="${jboss.home}/client">
+         <include name="**/jbossall-client.jar"/>
+      </fileset>
+      <pathelement location="${build.classes.dir}"/>
+   </path>
+
+   <property name="build.classpath" refid="classpath"/>
+
+   <!-- =================================================================== -->
+   <!-- Prepares the build directory                                        -->
+   <!-- =================================================================== -->
+   <target name="prepare">
+      <mkdir dir="${build.dir}"/>
+      <mkdir dir="${build.classes.dir}"/>
+   </target>
+
+   <!-- =================================================================== -->
+   <!-- Compiles the source code                                            -->
+   <!-- =================================================================== -->
+   <target name="compile" depends="prepare">
+      <javac srcdir="${src.dir}"
+         destdir="${build.classes.dir}"
+         debug="on"
+         deprecation="on"
+         optimize="off"
+         includes="**">
+         <classpath refid="classpath"/>
+      </javac>
+   </target>
+
+   <target name="ejbjar" depends="compile">
+      <jar jarfile="build/${build.artifact}">
+         <fileset dir="${build.classes.dir}">
+            <include name="**/*.class"/>
+         </fileset>
+      </jar>
+      <copy file="build/${build.artifact}" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
+   </target>
+
+   <target name="run" depends="ejbjar">
+      <java classname="org.jboss.tutorial.asynch.client.Client" fork="yes" dir=".">
+         <classpath refid="classpath"/>
+      </java>
+   </target>
+
+   <!-- =================================================================== -->
+   <!-- Cleans up generated stuff                                           -->
+   <!-- =================================================================== -->
+   <target name="clean.db">
+      <delete dir="${jboss.home}/server/${jboss.server.config}/data/hypersonic"/>
+   </target>
+
+   <target name="clean">
+      <delete dir="${build.dir}"/>
+      <delete file="${jboss.home}/server/${jboss.server.config}/deploy/${build.artifact}"/>
+   </target>
+
+
+</project>
+

Deleted: projects/ejb3/trunk/docs/tutorial/asynch/jndi.properties
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/asynch/jndi.properties	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/asynch/jndi.properties	2008-12-26 07:07:46 UTC (rev 82548)
@@ -1,3 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=localhost

Copied: projects/ejb3/trunk/docs/tutorial/asynch/jndi.properties (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/asynch/jndi.properties)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/asynch/jndi.properties	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/asynch/jndi.properties	2008-12-26 07:07:46 UTC (rev 82548)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=localhost

Deleted: projects/ejb3/trunk/docs/tutorial/asynch/log4j.xml
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/asynch/log4j.xml	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/asynch/log4j.xml	2008-12-26 07:07:46 UTC (rev 82548)
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- ===================================================================== -->
-<!--                                                                       -->
-<!--  Log4j Configuration                                                  -->
-<!--                                                                       -->
-<!-- ===================================================================== -->
-
-<!-- $Id$ -->
-
-<!--
-   | For more configuration infromation and examples see the Jakarta Log4j
-   | owebsite: http://jakarta.apache.org/log4j
- -->
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-   
-<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
-      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
-      <param name="Target" value="System.out"/>
-      <param name="Threshold" value="INFO"/>
-
-      <layout class="org.apache.log4j.PatternLayout">
-         <!-- The default pattern: Date Priority [Category] Messagen -->
-         <!--
-         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
-         -->
-         <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L)  -%m%n"/>
-      </layout>
-</appender>
-
-   <root>
-      <appender-ref ref="CONSOLE"/>
-   </root>
-
-</log4j:configuration>

Copied: projects/ejb3/trunk/docs/tutorial/asynch/log4j.xml (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/asynch/log4j.xml)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/asynch/log4j.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/asynch/log4j.xml	2008-12-26 07:07:46 UTC (rev 82548)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id$ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+   
+<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Messagen -->
+         <!--
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+         -->
+         <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L)  -%m%n"/>
+      </layout>
+</appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: projects/ejb3/trunk/docs/tutorial/asynch/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/asynch/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/asynch/pom.xml	2008-12-26 07:07:46 UTC (rev 82548)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  
+
+  
+   
+  <!-- Model Version -->
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.jboss.ejb3</groupId>
+    <artifactId>jboss-ejb3-tutorial-common</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>../common/</relativePath>
+  </parent>
+
+  <properties>
+    <ejb3.tutorial.client>org.jboss.tutorial.asynch.client.Client</ejb3.tutorial.client>
+  
+  </properties>
+
+
+  <artifactId>jboss-ejb3-tutorial-asynch</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>JBoss Extension - Asynchronous EJB3 Calls</name>
+  <url>http://labs.jboss.com/jbossejb3/</url>
+  <description>
+    Tutorial about asynchronous EJB3 calls - a JBoss extension
+  </description>
+
+
+</project>


Property changes on: projects/ejb3/trunk/docs/tutorial/asynch/pom.xml
___________________________________________________________________
Name: svn:executable
   + *

Copied: projects/ejb3/trunk/docs/tutorial/asynch/src (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/asynch/src)

Modified: projects/ejb3/trunk/docs/tutorial/asynch/src/org/jboss/tutorial/asynch/client/Client.java
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/asynch/src/org/jboss/tutorial/asynch/client/Client.java	2008-12-24 23:43:57 UTC (rev 82546)
+++ projects/ejb3/trunk/docs/tutorial/asynch/src/org/jboss/tutorial/asynch/client/Client.java	2008-12-26 07:07:46 UTC (rev 82548)
@@ -21,23 +21,25 @@
  */
 package org.jboss.tutorial.asynch.client;
 
+import java.util.concurrent.Future;
+
 import javax.naming.InitialContext;
-import org.jboss.aspects.asynch.Future;
-import org.jboss.ejb3.asynchronous.Asynch;
+
+import org.jboss.ejb3.common.proxy.plugins.async.AsyncUtils;
 import org.jboss.tutorial.asynch.bean.Echo;
 
-
 public class Client
 {
    public static void main(String[] args) throws Exception
    {
       InitialContext ctx = new InitialContext();
-      Echo echo = (Echo)ctx.lookup("EchoBean/remote");
+      Echo echo = (Echo) ctx.lookup("EchoBean/remote");
       System.out.println("-------- Synchronous call");
       String ret = echo.echo("normal call");
       System.out.println(ret);
 
-      Echo asynchEcho = (Echo) Asynch.getAsynchronousProxy(echo);
+      // Create the asynchronous proxy
+      Echo asynchEcho = AsyncUtils.mixinAsync(echo);
       System.out.println("-------- Asynchronous call");
       ret = asynchEcho.echo("asynchronous call");
       System.out.println("Direct return of async invocation is: " + ret);
@@ -47,16 +49,11 @@
       System.out.println(ret);
 
       System.out.println("-------- Result of Asynchronous call");
-      Future future = Asynch.getFutureResult(asynchEcho);
+      Future<String> future = (Future<String>) AsyncUtils.getFutureResult(asynchEcho);
 
-      System.out.println("Waiting for asynbch invocation to complete");
-      while (!future.isDone())
-      {
-         Thread.sleep(100);
-      }
-      ret = (String)future.get();
+      // blocking call
+      ret = (String) future.get();
       System.out.println(ret);
 
-
    }
 }




More information about the jboss-cvs-commits mailing list