You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2018/12/26 14:02:25 UTC

[01/13] tomee git commit: TOMEE-2301 - Add ThreadFactory example

Repository: tomee
Updated Branches:
  refs/heads/master 1ff8ad889 -> 113644b66


TOMEE-2301 - Add ThreadFactory example

Signed-off-by: brunobat <br...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/92b291b1
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/92b291b1
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/92b291b1

Branch: refs/heads/master
Commit: 92b291b1d652734fbd87c75d76eeae8d95d0617c
Parents: 2aaca11
Author: brunobat <br...@gmail.com>
Authored: Mon Dec 17 11:30:16 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Mon Dec 17 11:30:16 2018 +0000

----------------------------------------------------------------------
 .../superbiz/executor/ThreadFactoryService.java  | 17 ++++++++++++++++-
 .../executor/ThreadFactoryServiceTest.java       | 19 ++++++++++++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/92b291b1/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
index 17086e5..6847c54 100644
--- a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
+++ b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
@@ -32,11 +32,26 @@ public class ThreadFactoryService {
     @Resource
     private ManagedThreadFactory factory;
 
-    public void asyncTask(final int value) {
+    public Thread asyncTask(final int value) {
         LOGGER.info("Create asyncTask");
         final Thread thread = factory.newThread(longRunnableTask(value, 100, null));
         thread.setName("pretty asyncTask");
         thread.start();
+        return thread;
+    }
+
+    public Thread asyncHangingTask(final int value) throws InterruptedException {
+        LOGGER.info("Create asyncTask");
+        final Thread thread = factory.newThread(longRunnableTask(value, 1000000, null));
+        thread.setName("pretty asyncTask");
+        thread.start();
+        TimeUnit.MILLISECONDS.sleep(50);
+        if (thread.isAlive()) {
+            // This will cause any wait in the thread to resume.
+            // This will call the InterruptedException block in the longRunnableTask method.
+            thread.interrupt();
+        }
+        return thread;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/tomee/blob/92b291b1/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
index 8518c28..e2e15c6 100644
--- a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
+++ b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
@@ -12,6 +12,10 @@ import javax.inject.Inject;
 import java.util.concurrent.TimeUnit;
 import java.util.logging.Logger;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -46,8 +50,21 @@ public class ThreadFactoryServiceTest {
     @Test
     public void asyncTask() throws InterruptedException {
 
-        factoryService.asyncTask(1);
+        final Thread thread = factoryService.asyncTask(1);
+        assertTrue(thread.isAlive());
+
+        LOGGER.info("Do something else");
+        TimeUnit.MILLISECONDS.sleep(200);
+
+        assertFalse(thread.isAlive());
+    }
+
+    @Test
+    public void asyncHangingTask() throws InterruptedException {
+
+        final Thread thread = factoryService.asyncHangingTask(1);
         LOGGER.info("Do something else");
         TimeUnit.MILLISECONDS.sleep(200);
+        assertFalse(thread.isAlive());
     }
 }
\ No newline at end of file


[04/13] tomee git commit: Merge remote-tracking branch 'upstream/master' into executor-example

Posted by jl...@apache.org.
Merge remote-tracking branch 'upstream/master' into executor-example


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/69c9f671
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/69c9f671
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/69c9f671

Branch: refs/heads/master
Commit: 69c9f6712833442449db37e7671710c9c5cdf68c
Parents: ab1de6c ce2998f
Author: brunobat <br...@gmail.com>
Authored: Tue Dec 18 19:27:31 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Tue Dec 18 19:27:31 2018 +0000

----------------------------------------------------------------------
 .../resource/AutoConnectionTrackerTest.java     |  46 ++-
 docs/app-clients-and-jndi.adoc                  |   4 +-
 docs/application-composer/getting-started.adoc  |   2 +-
 ...application-discovery-via-the-classpath.adoc |   2 +-
 docs/application-resources.adoc                 |   4 +-
 docs/basics---getting-things.adoc               |   2 +-
 docs/basics---transactions.adoc                 |   2 +-
 docs/configuring-datasources.adoc               |   4 +-
 docs/constructor-injection.adoc                 |   2 +-
 docs/datasource-config.adoc                     |   2 +-
 docs/developer/json/index.adoc                  |   4 +-
 .../testing/applicationcomposer/index.adoc      |  26 +-
 docs/developer/testing/arquillian/index.adoc    |   2 +-
 docs/documentation.adoc                         |   2 +-
 docs/documentation.old.adoc                     |   2 +-
 docs/ejb-local-ref.adoc                         |   2 +-
 docs/ejb-ref.adoc                               |   2 +-
 docs/ejb-refs.adoc                              |   4 +-
 docs/embedded-and-remotable.adoc                |  10 +-
 docs/generating-ejb-3-annotations.adoc          |   4 +-
 docs/hello-world.adoc                           |   2 +-
 docs/jndi-names.adoc                            |   4 +-
 docs/jpa-concepts.adoc                          |   4 +-
 docs/local-client-injection.adoc                |  20 +-
 docs/lookup-of-other-ejbs-example.adoc          |   8 +-
 docs/new-in-openejb-3.0.adoc                    |   6 +-
 docs/persistence-context.adoc                   |   2 +-
 docs/persistence-unit-ref.adoc                  |   6 +-
 docs/quickstart.adoc                            |   2 +-
 docs/resource-injection.adoc                    |   6 +-
 docs/resource-ref-for-datasource.adoc           |   2 +-
 docs/security-annotations.adoc                  |   8 +-
 docs/singleton-beans.adoc                       |  44 +--
 docs/spring-and-openejb-3.0.adoc                |   4 +-
 docs/spring-ejb-and-jpa.adoc                    |  10 +-
 docs/tomcat-object-factory.adoc                 |   2 +-
 docs/tomee-and-security.adoc                    |   2 +-
 docs/transaction-annotations.adoc               |   6 +-
 examples/mp-rest-client/README.md               | 138 +++++++++
 examples/mp-rest-client/pom.xml                 | 121 ++++++++
 .../org/superbiz/rest/ApplicationConfig.java    |  26 ++
 .../src/main/java/org/superbiz/rest/Book.java   |  50 ++++
 .../main/java/org/superbiz/rest/BookBean.java   |  60 ++++
 .../java/org/superbiz/rest/BookResource.java    |  71 +++++
 .../org/superbiz/rest/BookResourceClient.java   |  57 ++++
 .../org/superbiz/rest/BookResourceTest.java     |  77 +++++
 .../src/test/resources/META-INF/beans.xml       |   1 +
 .../META-INF/microprofile-config.properties     |   1 +
 .../src/test/resources/arquillian.xml           |  38 +++
 examples/pom.xml                                |   4 +-
 .../maven/plugin/AbstractAddressMojo.java       |  21 ++
 .../maven/plugin/AbstractCommandMojo.java       |   9 +
 .../maven/plugin/AbstractDeployMojo.java        |   6 +
 .../maven/plugin/AbstractSynchronizable.java    |  63 +++++
 .../openejb/maven/plugin/AbstractTomEEMojo.java | 281 +++++++++++++++++++
 .../openejb/maven/plugin/BuildTomEEMojo.java    |  20 ++
 .../maven/plugin/ConfigTestTomEEMojo.java       |   2 +
 .../openejb/maven/plugin/DebugTomEEMojo.java    |   1 +
 .../apache/openejb/maven/plugin/DeployMojo.java |  11 +
 .../apache/openejb/maven/plugin/ExecMojo.java   |  11 +
 .../openejb/maven/plugin/ListEjbMojo.java       |  13 +
 .../openejb/maven/plugin/RunTomEEMojo.java      |   2 +
 .../openejb/maven/plugin/StartTomEEMojo.java    |   1 +
 .../openejb/maven/plugin/StopTomEEMojo.java     |   1 +
 .../org/apache/openejb/maven/plugin/Synch.java  |  24 ++
 .../openejb/maven/plugin/Synchronization.java   |  43 +++
 .../openejb/maven/plugin/TomEEException.java    |  14 +
 .../openejb/maven/plugin/UnDeployMojo.java      |   1 +
 .../maven/plugin/UpdatableTomEEMojo.java        |  41 +++
 .../apache/openejb/maven/plugin/cli/Args.java   |   9 +
 .../maven/plugin/customizer/monkey/Monkey.java  |  12 +-
 .../monkey/classloader/ClassLoaderFactory.java  |  15 +
 .../monkey/file/PatchFolderFinder.java          |  10 +
 .../customizer/monkey/index/FileIndexer.java    |  30 ++
 .../plugin/customizer/monkey/index/Item.java    |  38 ++-
 .../customizer/monkey/jar/JarPatcher.java       |  11 +
 .../openejb/maven/plugin/runner/ExecRunner.java |   9 +
 pom.xml                                         |  39 ++-
 .../test/java/org/apache/tomee/TomEECliIT.java  |  57 +++-
 79 files changed, 1575 insertions(+), 130 deletions(-)
----------------------------------------------------------------------



[05/13] tomee git commit: TOMEE-2301 - use countDownLatch and runnable class

Posted by jl...@apache.org.
TOMEE-2301 - use countDownLatch and runnable class

Signed-off-by: brunobat <br...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/46cb50f4
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/46cb50f4
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/46cb50f4

Branch: refs/heads/master
Commit: 46cb50f4a0a819863f8b6b3c9e5b85b158d890b0
Parents: 69c9f67
Author: brunobat <br...@gmail.com>
Authored: Tue Dec 18 23:34:41 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Tue Dec 18 23:34:41 2018 +0000

----------------------------------------------------------------------
 .../superbiz/executor/ThreadFactoryService.java | 77 ++++++++++++--------
 1 file changed, 45 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/46cb50f4/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
index 43e93d9..c0166f7 100644
--- a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
+++ b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
@@ -3,11 +3,10 @@ package org.superbiz.executor;
 import javax.annotation.Resource;
 import javax.enterprise.concurrent.ManagedThreadFactory;
 import javax.enterprise.context.RequestScoped;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.logging.Logger;
 
-import static java.util.Objects.nonNull;
-
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -38,12 +37,18 @@ public class ThreadFactoryService {
      * @param value to compute
      * @return The thread we created
      */
-    public Thread asyncTask(final int value) {
+    public int asyncTask(final int value) throws InterruptedException {
         LOGGER.info("Create asyncTask");
-        final Thread thread = factory.newThread(longRunnableTask(value, 100, null));
+        final CountDownLatch countDownLatch = new CountDownLatch(1);
+        final LongTask longTask = new LongTask(value, 1000000, countDownLatch);
+
+        final Thread thread = factory.newThread(longTask);
         thread.setName("pretty asyncTask");
         thread.start();
-        return thread;
+
+        countDownLatch.await(200, TimeUnit.MILLISECONDS);
+
+        return longTask.getResult();
     }
 
     /**
@@ -53,37 +58,45 @@ public class ThreadFactoryService {
      * @return The thread we created
      * @throws InterruptedException
      */
-    public Thread asyncHangingTask(final int value) throws InterruptedException {
-        LOGGER.info("Create asyncTask");
-        final Thread thread = factory.newThread(longRunnableTask(value, 1000000, null));
-        thread.setName("pretty asyncTask");
+    public int asyncHangingTask(final int value) throws InterruptedException {
+        LOGGER.info("Create asyncHangingTask");
+        final CountDownLatch countDownLatch = new CountDownLatch(1);
+        final LongTask longTask = new LongTask(value, 1000000, countDownLatch);
+
+        final Thread thread = factory.newThread(longTask);
+        thread.setName("pretty asyncHangingTask");
         thread.start();
-        TimeUnit.MILLISECONDS.sleep(50);
+
+        countDownLatch.await(200, TimeUnit.MILLISECONDS);
+
         if (thread.isAlive()) {
             // This will cause any wait in the thread to resume.
             // This will call the InterruptedException block in the longRunnableTask method.
             thread.interrupt();
         }
-        return thread;
+        return longTask.getResult();
     }
 
-    /**
-     * TODO create a proper runnable class were we store the result and we check periodically if we need to stop the execution.
-     * Will simulate a long running operation
-     *
-     * @param value          The value to compute
-     * @param taskDurationMs the time length of the operation
-     * @param errorMessage   If not null an exception with be thrown with this message
-     * @return a {@link Runnable}
-     */
-    private Runnable longRunnableTask(final int value,
-                                      final int taskDurationMs,
-                                      final String errorMessage) {
-        return () -> {
-            if (nonNull(errorMessage)) {
-                LOGGER.severe("Exception will be thrown");
-                throw new RuntimeException(errorMessage);
-            }
+    public static class LongTask implements Runnable {
+        private final int value;
+        private final long taskDurationMs;
+        private final CountDownLatch countDownLatch;
+        private int result;
+
+        public LongTask(final int value,
+                        final long taskDurationMs,
+                        final CountDownLatch countDownLatch) {
+            this.value = value;
+            this.taskDurationMs = taskDurationMs;
+            this.countDownLatch = countDownLatch;
+        }
+
+        public int getResult() {
+            return result;
+        }
+
+        @Override
+        public void run() {
             try {
                 // Simulate a long processing task using TimeUnit to sleep.
                 TimeUnit.MILLISECONDS.sleep(taskDurationMs);
@@ -91,10 +104,10 @@ public class ThreadFactoryService {
                 throw new RuntimeException("Problem while waiting");
             }
 
-            Integer result = value + 1;
+            result = value + 1;
             LOGGER.info("longRunnableTask complete. Value is " + result);
-            // Cannot return result with a Runnable.
-        };
+            countDownLatch.countDown();
+            // Cannot return result with a Runnable. Must store and access it later.
+        }
     }
-
 }


[02/13] tomee git commit: Merge remote-tracking branch 'upstream/master' into executor-example

Posted by jl...@apache.org.
Merge remote-tracking branch 'upstream/master' into executor-example


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/2c6ce4ac
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/2c6ce4ac
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/2c6ce4ac

Branch: refs/heads/master
Commit: 2c6ce4ac6c71af538b1f9107e7584e4dc4aa42e2
Parents: 92b291b d5d191d
Author: brunobat <br...@gmail.com>
Authored: Mon Dec 17 19:11:22 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Mon Dec 17 19:11:22 2018 +0000

----------------------------------------------------------------------
 .gitignore                                      |    2 +
 .../arquillian/common/TomEEContainer.java       |    4 +
 .../arquillian/remote/RemoteTomEEContainer.java |    3 +
 .../arquillian-tomee-webprofile-tests/pom.xml   |    2 +-
 .../arquillian/tests/bmp/local/BigFinder.java   |   22 +
 .../tests/bmp/local/BigFinderBean.java          |   57 +
 .../tests/bmp/local/BigFinderHome.java          |   25 +
 .../arquillian/tests/bmp/local/BigFinderPK.java |   24 +
 .../tests/bmp/local/BmpLocalEntityTest.java     |   62 +
 .../tests/bmp/local/FinderServlet.java          |   33 +
 .../arquillian/tests/bmp/local/FinderTest.java  |   25 +
 .../tests/bmp/local/FinderTestBean.java         |   86 +
 .../tests/bmp/local/FinderTestHome.java         |   25 +
 .../arquillian/tests/bmp/local/IntegerPK.java   |   99 +
 .../tests/bmp/local/LittleFinder.java           |   22 +
 .../tests/bmp/local/LittleFinderBean.java       |   55 +
 .../tests/bmp/local/LittleFinderHome.java       |   25 +
 .../tests/bmp/local/LittleFinderPK.java         |   25 +
 .../arquillian/tests/bmp/local/StringPK.java    |   71 +
 .../arquillian/tests/bmp/remote/BigFinder.java  |   22 +
 .../tests/bmp/remote/BigFinderBean.java         |   57 +
 .../tests/bmp/remote/BigFinderHome.java         |   25 +
 .../tests/bmp/remote/BigFinderPK.java           |   24 +
 .../tests/bmp/remote/BmpRemoteEntityTest.java   |   62 +
 .../tests/bmp/remote/FinderServlet.java         |   33 +
 .../arquillian/tests/bmp/remote/FinderTest.java |   24 +
 .../tests/bmp/remote/FinderTestBean.java        |   82 +
 .../tests/bmp/remote/FinderTestHome.java        |   25 +
 .../arquillian/tests/bmp/remote/IntegerPK.java  |   99 +
 .../tests/bmp/remote/LittleFinder.java          |   22 +
 .../tests/bmp/remote/LittleFinderBean.java      |   55 +
 .../tests/bmp/remote/LittleFinderHome.java      |   25 +
 .../tests/bmp/remote/LittleFinderPK.java        |   25 +
 .../arquillian/tests/bmp/remote/StringPK.java   |   71 +
 .../arquillian/tests/cmp/CmpServlet.java        |   16 +
 .../openejb/arquillian/tests/cmp/MyCmpBean.java |   16 +
 .../arquillian/tests/cmp/MyLocalHome.java       |   16 +
 .../arquillian/tests/cmp/MyLocalObject.java     |   16 +
 .../arquillian/tests/cmp/MyRemoteHome.java      |   16 +
 .../arquillian/tests/cmp/MyRemoteObject.java    |   16 +
 .../arquillian/tests/cmp/sample/ActorBean.java  |   70 +
 .../tests/cmp/sample/ActorDetails.java          |   39 +
 .../tests/cmp/sample/CustomOrmXmlTest.java      |   76 +
 .../arquillian/tests/cmp/sample/LocalActor.java |   29 +
 .../tests/cmp/sample/LocalActorHome.java        |   31 +
 .../arquillian/tests/cmp/sample/LocalMovie.java |   39 +
 .../tests/cmp/sample/LocalMovieHome.java        |   33 +
 .../arquillian/tests/cmp/sample/MovieBean.java  |  118 +
 .../tests/cmp/sample/MovieDetails.java          |   45 +
 .../tests/cmp/sample/MoviesBusiness.java        |   25 +
 .../tests/cmp/sample/MoviesBusinessBean.java    |   80 +
 .../tests/cmp/sample/MoviesBusinessHome.java    |   27 +
 .../tests/cmp/sample/MoviesServlet.java         |   91 +
 .../securityejb/SecurityEJBPropagationTest.java |    4 +-
 .../src/test/resources/arquillian.xml           |    2 +
 .../arquillian/tests/bmp/local/ejb-jar.xml      |   65 +
 .../openejb/arquillian/tests/bmp/local/web.xml  |   42 +
 .../arquillian/tests/bmp/remote/ejb-jar.xml     |   65 +
 .../openejb/arquillian/tests/bmp/remote/web.xml |   42 +
 .../arquillian/tests/cmp/sample/custom-orm.xml  |   54 +
 .../arquillian/tests/cmp/sample/ejb-jar.xml     |  164 +
 .../arquillian/tests/cmp/sample/openejb-jar.xml |   34 +
 .../arquillian/tests/cmp/sample/persistence.xml |   32 +
 .../openejb/arquillian/tests/cmp/sample/web.xml |   48 +
 .../src/test/resources/test/context.xml         |   20 +
 .../java/org/apache/openejb/BeanContext.java    |   11 +-
 .../org/apache/openejb/ClassLoaderUtil.java     |    3 +-
 .../org/apache/openejb/OpenEjbContainer.java    |    3 +-
 .../openejb/assembler/classic/Assembler.java    |   35 +-
 .../openejb/assembler/classic/EjbResolver.java  |    2 +-
 .../classic/EnterpriseBeanBuilder.java          |    3 +-
 .../classic/InterceptorBindingBuilder.java      |    4 +-
 .../openejb/assembler/classic/JndiBuilder.java  |    2 +-
 .../assembler/classic/JndiEncBuilder.java       |    2 +-
 .../assembler/classic/MethodInfoUtil.java       |    3 +-
 .../assembler/classic/ValidatorBuilder.java     |    8 +-
 .../openejb/cdi/ManagedSecurityService.java     |   73 +-
 .../openejb/cdi/ThreadSingletonServiceImpl.java |    2 +
 .../apache/openejb/cdi/WebappBeanManager.java   |    3 +-
 .../java/org/apache/openejb/cli/Bootstrap.java  |   47 +-
 .../java/org/apache/openejb/cli/MainImpl.java   |    6 +-
 .../openejb/config/AnnotationDeployer.java      |   34 +-
 .../org/apache/openejb/config/AutoConfig.java   |  131 +-
 .../apache/openejb/config/CmpJpaConversion.java |  101 +-
 .../config/ConfigurableClasspathArchive.java    |    3 +-
 .../openejb/config/ConfigurationFactory.java    |    8 +-
 .../apache/openejb/config/DeploymentLoader.java |   45 +-
 .../openejb/config/EjbJarInfoBuilder.java       |    4 +-
 .../openejb/config/InitEjbDeployments.java      |    2 +-
 .../config/PersistenceContextAnnFactory.java    |    2 +-
 .../openejb/config/QuickServerXmlParser.java    |    2 +-
 .../org/apache/openejb/config/ServiceUtils.java |   12 +-
 .../openejb/config/sys/SaxAppCtxConfig.java     |    9 +-
 .../apache/openejb/config/sys/SaxOpenejb.java   |   19 +-
 .../apache/openejb/core/BaseSessionContext.java |    3 +-
 .../apache/openejb/core/cmp/cmp2/EjbSelect.java |    4 +-
 .../openejb/core/ivm/IntraVmArtifact.java       |    4 +-
 .../openejb/core/ivm/naming/IvmContext.java     |   10 +-
 .../openejb/core/managed/SimplePassivater.java  |    4 +-
 .../openejb/core/mdb/MdbInstanceManager.java    |    6 +-
 .../core/security/jaas/SQLLoginModule.java      |    8 +-
 .../singleton/SingletonEjbObjectHandler.java    |    2 +-
 .../openejb/core/stateful/SimplePassivater.java |    4 +-
 .../openejb/core/timer/EJBCronTrigger.java      |   10 +-
 .../openejb/core/timer/MemoryTimerStore.java    |    3 +-
 .../openejb/core/webservices/JaxWsUtils.java    |    6 +-
 .../stat/descriptive/DescriptiveStatistics.java |    4 +-
 .../openejb/resource/AutoConnectionTracker.java |    6 +-
 .../resource/jdbc/dbcp/BasicDataSource.java     |    2 +-
 .../jdbc/dbcp/BasicManagedDataSource.java       |    2 +-
 .../resource/jdbc/router/FailOverRouter.java    |    2 +-
 .../apache/openejb/util/AnnotationFinder.java   |   11 +-
 .../java/org/apache/openejb/util/Index.java     |    6 +-
 .../openejb/util/IntrospectionSupport.java      |    2 +-
 .../apache/openejb/util/Log4jPrintWriter.java   |    4 +-
 .../java/org/apache/openejb/util/Logger.java    |    4 +-
 .../apache/openejb/util/LoggingPrintWriter.java |    4 +-
 .../java/org/apache/openejb/util/Messages.java  |    2 +-
 .../apache/openejb/util/PojoSerialization.java  |   16 +-
 .../java/org/apache/openejb/util/Strings.java   |    2 +-
 .../org/apache/openejb/util/URISupport.java     |   10 +-
 .../org/apache/openejb/util/UpdateChecker.java  |    2 +-
 .../java/org/apache/openejb/util/UrlCache.java  |    2 +-
 .../openejb/util/helper/CommandHelper.java      |    6 +-
 .../util/proxy/LocalBeanProxyFactory.java       |    2 +-
 .../openejb/web/LightweightWebAppBuilder.java   |    2 +-
 .../apache/openejb/config/Messages.properties   |    3 +
 .../src/main/resources/test-orm.xml             |   32 +
 .../apache/openejb/config/InjectionTest.java    |    2 +-
 .../config/rules/ValidationKeysAuditorTest.java |    4 +-
 .../openejb/core/LegacyInterfaceTest.java       |   77 +-
 .../openejb/core/ivm/naming/IvmContextTest.java |    8 +-
 .../core/security/SecurityServiceImplTest.java  |    3 +-
 .../core/stateful/StatefulContainerTest.java    |    6 +-
 .../core/stateless/StatelessContainerTest.java  |    3 +-
 .../stateless/StatelessInvocationStatsTest.java |    3 +-
 .../stateless/StatelessMetaAnnotationTest.java  |    3 +-
 .../core/stateless/StatelessPoolStatsTest.java  |    3 +-
 .../core/webservices/JPACMDIntegrationTest.java |  341 +
 .../StatelessWithAroundInvokeOnlyTest.java      |    2 +-
 .../openejb/ivm/naming/IvmContextTest.java      |    4 +-
 .../test/entity/cmp2/model/StorageBean.java     |    4 +-
 .../org/apache/openejb/util/ReferencesTest.java |    4 +-
 .../openejb/util/proxy/SampleLocalBean.java     |    2 +-
 .../org/apache/openejb/javaagent/Agent.java     |    2 +-
 .../org/apache/openejb/jee/BooleanAdapter.java  |    2 +-
 .../jee/HandlerChainsStringQNameAdapter.java    |    2 +-
 .../openejb/jee/oejb2/NamespaceFilter.java      |    2 +-
 .../org/apache/openejb/junit/OpenEjbRunner.java |    4 +-
 .../java/org/apache/openejb/loader/Options.java |   12 +-
 .../loader/provisining/MavenResolver.java       |    2 +-
 docs/Configuring-in-tomee.adoc                  |   49 +
 docs/Configuring-in-tomee.md                    |   45 -
 docs/activemqresourceadapter-config.adoc        |   90 +
 docs/activemqresourceadapter-config.md          |   69 -
 docs/admin/cluster/index.adoc                   |   23 +-
 docs/admin/configuration/application.adoc       |   16 +-
 docs/admin/configuration/containers.adoc        |  100 +-
 docs/admin/configuration/index.adoc             |    4 +-
 docs/admin/configuration/resources.adoc         |  128 +-
 docs/admin/configuration/server.adoc            |    4 +-
 docs/admin/index.adoc                           |    2 +-
 docs/advanced/client/jndi.adoc                  |   24 +-
 docs/advanced/index.adoc                        |    2 +-
 docs/advanced/jms/jms-configuration.adoc        |    4 +-
 docs/advanced/setup/index.adoc                  |    9 +-
 docs/advanced/shading/index.adoc                |    4 +-
 docs/advanced/tomee-embedded/index.adoc         |    4 +-
 docs/alternate-descriptors.adoc                 |  124 +
 docs/alternate-descriptors.md                   |  117 -
 docs/annotations,-xml-and-defaults.adoc         |   22 +
 docs/annotations,-xml-and-defaults.md           |  569 --
 docs/app-clients-and-jndi.adoc                  |   74 +
 docs/app-clients-and-jndi.md                    |   73 -
 docs/application-composer/advanced.adoc         |  111 +
 docs/application-composer/advanced.md           |   90 -
 docs/application-composer/getting-started.adoc  |  234 +
 docs/application-composer/getting-started.md    |  188 -
 docs/application-composer/history.adoc          |   48 +
 docs/application-composer/history.md            |   38 -
 docs/application-composer/index.adoc            |   20 +
 docs/application-composer/index.md              |   18 -
 docs/application-deployment-solutions.adoc      |   92 +
 docs/application-deployment-solutions.md        |   78 -
 ...application-discovery-via-the-classpath.adoc |  111 +
 docs/application-discovery-via-the-classpath.md |   94 -
 docs/application-resources.adoc                 |  375 +
 docs/application-resources.md                   |  250 -
 docs/arquillian-available-adapters.adoc         |  319 +
 docs/arquillian-available-adapters.md           |  264 -
 docs/arquillian-getting-started.adoc            |   41 +
 docs/arquillian-getting-started.md              |   24 -
 docs/basics---getting-things.adoc               |  108 +
 docs/basics---getting-things.md                 |  107 -
 docs/basics---security.adoc                     |   55 +
 docs/basics---security.md                       |   55 -
 docs/basics---transactions.adoc                 |   67 +
 docs/basics---transactions.md                   |   60 -
 docs/bmpentitycontainer-config.adoc             |   55 +
 docs/bmpentitycontainer-config.md               |   37 -
 docs/bouncy-castle.adoc                         |   40 +
 docs/bouncy-castle.md                           |   34 -
 docs/built-in-type-converters.adoc              |  101 +
 docs/built-in-type-converters.md                |   94 -
 docs/callbacks.adoc                             |  169 +
 docs/callbacks.md                               |  167 -
 docs/changing-jms-implementations.adoc          |  161 +
 docs/changing-jms-implementations.md            |  136 -
 docs/client-server-transports.adoc              |   39 +
 docs/client-server-transports.md                |   22 -
 docs/clients.adoc                               |  101 +
 docs/clients.md                                 |  104 -
 docs/cmpentitycontainer-config.adoc             |   53 +
 docs/cmpentitycontainer-config.md               |   36 -
 docs/collapsed-ear.adoc                         |   49 +
 docs/collapsed-ear.md                           |   46 -
 docs/common-datasource-configurations.adoc      |  123 +
 docs/common-datasource-configurations.md        |  115 -
 docs/common-errors.adoc                         |   31 +
 docs/common-errors.md                           |   30 -
 docs/common-persistenceprovider-properties.adoc |   50 +
 docs/common-persistenceprovider-properties.md   |   47 -
 docs/comparison.adoc                            |  231 +
 docs/comparison.md                              |  222 -
 docs/concepts.adoc                              |   83 +
 docs/concepts.md                                |   79 -
 docs/configuration.adoc                         |  151 +
 docs/configuration.md                           |  144 -
 docs/configuring-containers-in-tests.adoc       |   30 +
 docs/configuring-containers-in-tests.md         |   27 -
 docs/configuring-datasources-in-tests.adoc      |   68 +
 docs/configuring-datasources-in-tests.md        |   60 -
 docs/configuring-datasources.adoc               |  204 +
 docs/configuring-datasources.md                 |  170 -
 docs/configuring-durations.adoc                 |   70 +
 docs/configuring-durations.md                   |   67 -
 docs/configuring-javamail.adoc                  |   44 +
 docs/configuring-javamail.md                    |   41 -
 docs/configuring-logging-in-tests.adoc          |  121 +
 docs/configuring-logging-in-tests.md            |  118 -
 docs/configuring-persistenceunits-in-tests.adoc |  160 +
 docs/configuring-persistenceunits-in-tests.md   |  144 -
 docs/constructor-injection.adoc                 |  103 +
 docs/constructor-injection.md                   |   98 -
 docs/containers-and-resources.adoc              |  474 ++
 docs/containers-and-resources.md                |  483 --
 docs/contrib/debug/debug-intellij.adoc          |  182 +
 docs/contrib/debug/debug-intellij.md            |  133 -
 docs/custom-injection.adoc                      |  209 +
 docs/custom-injection.md                        |  193 -
 docs/datasource-config.adoc                     |  535 ++
 docs/datasource-config.md                       |  541 --
 docs/datasource-configuration-by-creator.adoc   |  160 +
 docs/datasource-configuration-by-creator.md     |  155 -
 docs/datasource-password-encryption.adoc        |  168 +
 docs/datasource-password-encryption.md          |  128 -
 docs/deamon/lin-service.adoc                    |   24 +
 docs/deamon/lin-service.md                      |   17 -
 docs/deamon/win-service.adoc                    |   24 +
 docs/deamon/win-service.md                      |   17 -
 docs/declaring-references.adoc                  |    5 +
 docs/declaring-references.md                    |    6 -
 docs/deploy-tool.adoc                           |  167 +
 docs/deploy-tool.md                             |  165 -
 docs/deploying-in-tomee.adoc                    |   73 +
 docs/deploying-in-tomee.md                      |   73 -
 docs/deployment-id.adoc                         |  236 +
 docs/deployment-id.md                           |  231 -
 docs/deployments.adoc                           |  153 +
 docs/deployments.md                             |  135 -
 docs/details-on-openejb-jar.adoc                |  156 +
 docs/details-on-openejb-jar.md                  |  156 -
 docs/developer/classloading/index.adoc          |    1 -
 docs/developer/ide/index.adoc                   |    8 +-
 docs/developer/index.adoc                       |    2 +-
 docs/developer/json/index.adoc                  |    3 +-
 .../testing/applicationcomposer/index.adoc      |   50 +-
 docs/developer/testing/arquillian/index.adoc    |   24 +-
 docs/developer/testing/other/index.adoc         |   10 +-
 docs/developer/tools/gradle-plugins.adoc        |    2 +-
 .../tools/maven/applicationcomposer.adoc        |    8 +-
 docs/developer/tools/maven/embedded.adoc        |    2 +-
 docs/developer/tools/maven/tomee.adoc           |   18 +-
 docs/docs.adoc                                  |    8 +-
 docs/documentation.adoc                         |  103 +
 docs/documentation.md                           |  106 -
 docs/documentation.old.adoc                     |   98 +
 docs/documentation.old.md                       |  102 -
 docs/dynamic-datasource.adoc                    |  224 +
 docs/dynamic-datasource.md                      |  220 -
 docs/eclipse-plugin.adoc                        |   41 +
 docs/eclipse-plugin.md                          |   42 -
 docs/ejb-failover.adoc                          |   93 +
 docs/ejb-failover.md                            |   89 -
 docs/ejb-local-ref.adoc                         |   56 +
 docs/ejb-local-ref.md                           |   52 -
 docs/ejb-over-ssl.adoc                          |  137 +
 docs/ejb-over-ssl.md                            |  100 -
 docs/ejb-ref.adoc                               |   55 +
 docs/ejb-ref.md                                 |   50 -
 docs/ejb-refs.adoc                              |  199 +
 docs/ejb-refs.md                                |  178 -
 docs/ejb-request-logging.adoc                   |  158 +
 docs/ejb-request-logging.md                     |   98 -
 docs/ejbd-transport.adoc                        |  212 +
 docs/ejbd-transport.md                          |  136 -
 docs/embedded-and-remotable.adoc                |  177 +
 docs/embedded-and-remotable.md                  |  181 -
 docs/embedded-configuration.adoc                |  138 +
 docs/embedded-configuration.md                  |  135 -
 docs/embedding.adoc                             |   34 +
 docs/embedding.md                               |   30 -
 docs/failover-logging.adoc                      |   58 +
 docs/failover-logging.md                        |   42 -
 docs/faq.adoc                                   |  108 +
 docs/faq.md                                     |   99 -
 docs/features.adoc                              |    5 +
 docs/features.md                                |    6 -
 docs/from-glassfish-to-tomee.adoc               |   11 +
 docs/from-glassfish-to-tomee.md                 |    7 -
 ...esting-with-openejb,-jetty-and-selenium.adoc |  238 +
 ...-testing-with-openejb,-jetty-and-selenium.md |  240 -
 docs/generating-ejb-3-annotations.adoc          |   65 +
 docs/generating-ejb-3-annotations.md            |   61 -
 docs/getting-started.adoc                       |  178 +
 docs/getting-started.md                         |  172 -
 docs/hello-world.adoc                           |  263 +
 docs/hello-world.md                             |  250 -
 docs/hibernate.adoc                             |  103 +
 docs/hibernate.md                               |   98 -
 docs/initialcontext-config.adoc                 |   44 +
 docs/initialcontext-config.md                   |   26 -
 docs/installation-drop-in-war.adoc              |   55 +
 docs/installation-drop-in-war.md                |   45 -
 docs/installation.adoc                          |   35 +
 docs/installation.md                            |   34 -
 docs/installing-tomee.adoc                      |   87 +
 docs/installing-tomee.md                        |   71 -
 docs/java7.adoc                                 |   40 +
 docs/java7.md                                   |   40 -
 docs/javaagent-with-maven-surefire.adoc         |   38 +
 docs/javaagent-with-maven-surefire.md           |   57 -
 docs/javaagent.adoc                             |   66 +
 docs/javaagent.md                               |   61 -
 docs/javaee7-status.adoc                        |  218 +
 docs/javaee7-status.md                          |  185 -
 docs/javamailsession-config.adoc                |   44 +
 docs/javamailsession-config.md                  |   26 -
 docs/jms-resources-and-mdb-container.adoc       |  362 +
 docs/jms-resources-and-mdb-container.md         |  283 -
 docs/jmsconnectionfactory-config.adoc           |  104 +
 docs/jmsconnectionfactory-config.md             |   87 -
 docs/jndi-names.adoc                            |  401 ++
 docs/jndi-names.md                              |  372 -
 docs/jpa-concepts.adoc                          |  227 +
 docs/jpa-concepts.md                            |  220 -
 docs/jpa-usage.adoc                             |   48 +
 docs/jpa-usage.md                               |   52 -
 docs/local-client-injection.adoc                |   87 +
 docs/local-client-injection.md                  |   87 -
 docs/local-server.adoc                          |   56 +
 docs/local-server.md                            |   61 -
 docs/lookup-of-other-ejbs-example.adoc          |  148 +
 docs/lookup-of-other-ejbs-example.md            |  149 -
 docs/managedcontainer-config.adoc               |   44 +
 docs/managedcontainer-config.md                 |   26 -
 docs/manual-installation.adoc                   |  148 +
 docs/manual-installation.md                     |  224 -
 docs/maven.adoc                                 |   63 +
 docs/maven.md                                   |   42 -
 docs/maven/build-mojo.adoc                      | 1169 +++
 docs/maven/build-mojo.md                        | 1426 ----
 docs/maven/configtest-mojo.adoc                 | 1086 +++
 docs/maven/configtest-mojo.md                   | 1328 ----
 docs/maven/debug-mojo.adoc                      | 1139 +++
 docs/maven/debug-mojo.md                        | 1395 ----
 docs/maven/deploy-mojo.adoc                     |  196 +
 docs/maven/deploy-mojo.md                       |  255 -
 docs/maven/exec-mojo.adoc                       | 1277 ++++
 docs/maven/exec-mojo.md                         | 1551 ----
 docs/maven/help-mojo.adoc                       |  115 +
 docs/maven/help-mojo.md                         |  149 -
 docs/maven/index.adoc                           |  178 +
 docs/maven/index.md                             |  148 -
 docs/maven/list-mojo.adoc                       |  132 +
 docs/maven/list-mojo.md                         |  169 -
 docs/maven/run-mojo.adoc                        | 1139 +++
 docs/maven/run-mojo.md                          | 1395 ----
 docs/maven/start-mojo.adoc                      | 1139 +++
 docs/maven/start-mojo.md                        | 1395 ----
 docs/maven/stop-mojo.adoc                       | 1086 +++
 docs/maven/stop-mojo.md                         | 1328 ----
 docs/maven/undeploy-mojo.adoc                   |  159 +
 docs/maven/undeploy-mojo.md                     |  209 -
 docs/messagedrivencontainer-config.adoc         |   87 +
 docs/messagedrivencontainer-config.md           |   67 -
 docs/multicast-discovery.adoc                   |   93 +
 docs/multicast-discovery.md                     |   83 -
 docs/multiple-business-interface-hazzards.adoc  |  209 +
 docs/multiple-business-interface-hazzards.md    |  202 -
 docs/multipoint-considerations.adoc             |   31 +
 docs/multipoint-considerations.md               |   30 -
 docs/multipoint-discovery.adoc                  |   87 +
 docs/multipoint-discovery.md                    |   75 -
 docs/multipoint-recommendations.adoc            |  153 +
 docs/multipoint-recommendations.md              |  141 -
 docs/multipulse-discovery.adoc                  |  112 +
 docs/multipulse-discovery.md                    |   94 -
 docs/new-in-openejb-3.0.adoc                    |  157 +
 docs/new-in-openejb-3.0.md                      |  179 -
 docs/openejb-3.adoc                             |   69 +
 docs/openejb-3.md                               |   72 -
 docs/openejb-binaries.adoc                      |   34 +
 docs/openejb-binaries.md                        |   27 -
 docs/openejb-eclipse-plugin.adoc                |   22 +
 docs/openejb-eclipse-plugin.md                  |   22 -
 docs/openejb-jsr-107-integration.adoc           |   24 +
 docs/openejb-jsr-107-integration.md             |   25 -
 docs/openejb.xml.adoc                           |  100 +
 docs/openejb.xml.md                             |   96 -
 docs/openjpa.adoc                               |  132 +
 docs/openjpa.md                                 |  113 -
 docs/orb-config.adoc                            |   42 +
 docs/orb-config.md                              |   26 -
 docs/persistence-context.adoc                   |   61 +
 docs/persistence-context.md                     |   57 -
 docs/persistence-unit-ref.adoc                  |   95 +
 docs/persistence-unit-ref.md                    |   91 -
 docs/properties-listing.adoc                    |  729 ++
 docs/properties-listing.md                      |   94 -
 docs/properties-tool.adoc                       |  219 +
 docs/properties-tool.md                         |  216 -
 docs/property-overriding.adoc                   |   64 +
 docs/property-overriding.md                     |   65 -
 docs/provisioning.adoc                          |  102 +
 docs/provisioning.md                            |   78 -
 docs/proxyfactory-config.adoc                   |   44 +
 docs/proxyfactory-config.md                     |   26 -
 docs/queue-config.adoc                          |   50 +
 docs/queue-config.md                            |   36 -
 docs/quickstart.adoc                            |   69 +
 docs/quickstart.md                              |   71 -
 docs/remote-server.adoc                         |   72 +
 docs/remote-server.md                           |   64 -
 docs/resource-injection.adoc                    |  209 +
 docs/resource-injection.md                      |  184 -
 docs/resource-ref-for-datasource.adoc           |   55 +
 docs/resource-ref-for-datasource.md             |   46 -
 docs/running-a-standalone-openejb-server.adoc   |   77 +
 docs/running-a-standalone-openejb-server.md     |   95 -
 docs/securing-a-web-service.adoc                |  240 +
 docs/securing-a-web-service.md                  |  242 -
 docs/security-annotations.adoc                  |  301 +
 docs/security-annotations.md                    |  296 -
 docs/security.adoc                              |  201 +
 docs/security.md                                |  148 -
 docs/securityservice-config.adoc                |   52 +
 docs/securityservice-config.md                  |   36 -
 docs/service-locator.adoc                       |  168 +
 docs/service-locator.md                         |  171 -
 docs/services.adoc                              |   28 +
 docs/services.md                                |   20 -
 docs/singleton-beans.adoc                       |  232 +
 docs/singleton-beans.md                         |  226 -
 docs/singleton-ejb.adoc                         |    7 +
 docs/singleton-ejb.md                           |    6 -
 docs/singletoncontainer-config.adoc             |   71 +
 docs/singletoncontainer-config.md               |   56 -
 docs/spring-and-openejb-3.0.adoc                |  234 +
 docs/spring-and-openejb-3.0.md                  |  190 -
 docs/spring-ejb-and-jpa.adoc                    |  197 +
 docs/spring-ejb-and-jpa.md                      |  173 -
 docs/spring.adoc                                |  139 +
 docs/spring.md                                  |  124 -
 docs/ssh.adoc                                   |   63 +
 docs/ssh.md                                     |   51 -
 docs/standalone-server.adoc                     |   24 +
 docs/standalone-server.md                       |   27 -
 docs/startup.adoc                               |  272 +
 docs/startup.md                                 |  296 -
 docs/statefulcontainer-config.adoc              |  167 +
 docs/statefulcontainer-config.md                |  160 -
 docs/statelesscontainer-config.adoc             |  445 ++
 docs/statelesscontainer-config.md               |  461 --
 docs/system-properties-files.adoc               |   25 +
 docs/system-properties-files.md                 |   22 -
 docs/system-properties.adoc                     |   71 +
 docs/system-properties.md                       |   68 -
 docs/telnet-console.adoc                        |  165 +
 docs/telnet-console.md                          |  166 -
 docs/tip-concurrency.adoc                       |   34 +
 docs/tip-concurrency.md                         |   26 -
 docs/tip-jersey-client.adoc                     |   35 +
 docs/tip-jersey-client.md                       |   22 -
 docs/tip-weblogic.adoc                          |   22 +
 docs/tip-weblogic.md                            |   17 -
 docs/tomcat-object-factory.adoc                 |   17 +
 docs/tomcat-object-factory.md                   |   15 -
 docs/tomee-and-eclipse.adoc                     |  140 +
 docs/tomee-and-eclipse.md                       |  145 -
 docs/tomee-and-hibernate.adoc                   |  173 +
 docs/tomee-and-hibernate.md                     |  163 -
 docs/tomee-and-intellij.adoc                    |   82 +
 docs/tomee-and-intellij.md                      |   81 -
 docs/tomee-and-netbeans.adoc                    |  107 +
 docs/tomee-and-netbeans.md                      |   97 -
 docs/tomee-and-security.adoc                    |   56 +
 docs/tomee-and-security.md                      |   45 -
 docs/tomee-and-webspheremq.adoc                 |   26 +
 docs/tomee-and-webspheremq.md                   |  136 -
 docs/tomee-directory-structure.adoc             |   25 +
 docs/tomee-directory-structure.md               |   61 -
 docs/tomee-embedded-maven-plugin.adoc           |  787 ++
 docs/tomee-embedded-maven-plugin.md             |  959 ---
 docs/tomee-jaas.adoc                            |   93 +
 docs/tomee-jaas.md                              |   73 -
 docs/tomee-logging-in-eclipse.adoc              |   19 +
 docs/tomee-logging-in-eclipse.md                |   13 -
 docs/tomee-logging.adoc                         |   32 +
 docs/tomee-logging.md                           |   33 -
 docs/tomee-maven-plugin.adoc                    |  178 +
 docs/tomee-maven-plugin.md                      |  148 -
 docs/tomee-mp-getting-started.adoc              |  103 +
 docs/tomee-mp-getting-started.md                |   65 -
 docs/tomee-version-policies.adoc                |   55 +
 docs/tomee-version-policies.md                  |   28 -
 docs/tomee-webaccess.adoc                       |   18 +
 docs/tomee-webaccess.md                         |   21 -
 docs/tomee-webapp.adoc                          |   75 +
 docs/tomee-webapp.md                            |   62 -
 docs/topic-config.adoc                          |   50 +
 docs/topic-config.md                            |   36 -
 docs/transaction-annotations.adoc               |  230 +
 docs/transaction-annotations.md                 |  219 -
 docs/transactionmanager-config.adoc             |  183 +
 docs/transactionmanager-config.md               |  166 -
 docs/understanding-callbacks.adoc               |   98 +
 docs/understanding-callbacks.md                 |   92 -
 docs/understanding-the-directory-layout.adoc    |   74 +
 docs/understanding-the-directory-layout.md      |   72 -
 docs/unix-daemon.adoc                           |  158 +
 docs/unix-daemon.md                             |  108 -
 docs/validation-tool.adoc                       |  143 +
 docs/validation-tool.md                         |  141 -
 docs/version-checker.adoc                       |   13 +
 docs/version-checker.md                         |   12 -
 examples/README.adoc                            |   21 +
 examples/access-timeout-meta/README.adoc        |  281 +
 examples/access-timeout-meta/README.md          |  253 -
 examples/access-timeout/README.adoc             |  216 +
 examples/access-timeout/README.md               |  199 -
 examples/applicationcomposer-jaxws-cdi/pom.xml  |    2 +-
 examples/arquillian-jpa/pom.xml                 |  227 +-
 .../test/persistence/PersistenceTest.java       |   40 +-
 examples/cdi-basic/README.md                    |    5 +-
 .../connector-starter-api/pom.xml               |   50 -
 .../connector/starter/api/InboundListener.java  |   24 -
 .../connector/starter/api/SampleConnection.java |   26 -
 .../starter/api/SampleConnectionFactory.java    |   28 -
 .../src/main/resources/META-INF/LICENSE         |  202 -
 .../src/main/resources/META-INF/NOTICE          |    7 -
 .../connector-starter-impl/pom.xml              |   60 -
 .../starter/adapter/SampleActivationSpec.java   |   54 -
 .../adapter/SampleConnectionFactoryImpl.java    |   69 -
 .../starter/adapter/SampleConnectionImpl.java   |   44 -
 .../adapter/SampleManagedConnection.java        |  139 -
 .../adapter/SampleManagedConnectionFactory.java |  108 -
 .../SampleManagedConnectionMetaData.java        |   58 -
 .../starter/adapter/SampleResourceAdapter.java  |   92 -
 .../src/main/resources/META-INF/LICENSE         |  202 -
 .../src/main/resources/META-INF/NOTICE          |    7 -
 .../connector-starter-rar/pom.xml               |   43 -
 .../src/main/rar/META-INF/LICENSE               |  294 -
 .../src/main/rar/META-INF/NOTICE                |    5 -
 .../src/main/rar/META-INF/ra.xml                |   58 -
 .../connector-starter-sample-war/pom.xml        |  150 -
 .../src/main/java/org/superbiz/Receiver.java    |   35 -
 .../src/main/java/org/superbiz/Sender.java      |   52 -
 .../src/main/resources/META-INF/LICENSE         |  202 -
 .../src/main/resources/META-INF/NOTICE          |    7 -
 .../src/main/resources/META-INF/ejb-jar.xml     |   23 -
 .../org/tomitribe/connector/starter/Runner.java |  104 -
 .../src/test/resources/arquillian.xml           |   30 -
 .../connector-ear-sample/moviefun-ear/pom.xml   |   74 -
 examples/connector-ear-sample/pom.xml           |  205 -
 examples/ear-testing/business-logic/pom.xml     |    2 +-
 examples/ear-testing/business-model/pom.xml     |    2 +-
 examples/ear-testing/pom.xml                    |    2 +-
 examples/github-stylesheet.css                  |    4 +
 examples/javamail/pom.xml                       |    2 +-
 examples/mp-config-example/README.adoc          |   67 +
 examples/mp-config-example/pom.xml              |   92 +
 .../org/superbiz/config/PropertiesRest.java     |   80 +
 .../src/main/resources/META-INF/beans.xml       |    0
 .../META-INF/microprofile-config.properties     |    3 +
 .../org/superbiz/config/PropertiesRestTest.java |   53 +
 .../src/test/resources/arquillian.xml           |   30 +
 examples/mp-faulttolerance-retry/README.md      |  215 +
 examples/mp-faulttolerance-retry/pom.xml        |   93 +
 .../java/org/superbiz/rest/WeatherGateway.java  |  115 +
 .../WeatherGatewayBusyServiceException.java     |   20 +
 .../rest/WeatherGatewayTimeoutException.java    |   21 +
 .../java/org/superbiz/rest/WeatherService.java  |   73 +
 .../org/superbiz/rest/WeatherServiceTest.java   |   94 +
 .../src/test/resources/arquillian.xml           |   30 +
 .../src/test/resources/beans.xml                |    7 +
 examples/mp-metrics-counted/pom.xml             |   33 +-
 .../src/main/webapp/WEB-INF/web.xml             |   25 +
 examples/mp-metrics-histogram/README.md         |  182 +
 examples/mp-metrics-histogram/pom.xml           |  109 +
 .../org/superbiz/histogram/WeatherService.java  |   66 +
 .../src/main/webapp/WEB-INF/web.xml             |   25 +
 .../superbiz/histogram/WeatherServiceTest.java  |  167 +
 .../src/test/resources/arquillian.xml           |   30 +
 examples/mp-metrics-metered/pom.xml             |   70 +
 .../java/org/superbiz/rest/WeatherService.java  |   33 +
 examples/mp-metrics-timed/pom.xml               |   37 +-
 .../src/main/webapp/WEB-INF/web.xml             |   25 +
 examples/mp-opentracing-traced/pom.xml          |   88 +
 .../src/test/resources/arquillian.xml           |   30 +
 examples/mp-rest-jwt/README.md                  |  307 +
 examples/mp-rest-jwt/pom.xml                    |  208 +
 .../main/java/org/superbiz/moviefun/Movie.java  |   70 +
 .../java/org/superbiz/moviefun/MoviesBean.java  |   61 +
 .../moviefun/rest/ApplicationConfig.java        |   28 +
 .../rest/MoviesMPJWTConfigurationProvider.java  |   56 +
 .../org/superbiz/moviefun/rest/MoviesRest.java  |   77 +
 .../java/org/superbiz/moviefun/MoviesTest.java  |  132 +
 .../java/org/superbiz/moviefun/TokenUtils.java  |  257 +
 .../resources/META-INF/application-client.xml   |    1 +
 .../mp-rest-jwt/src/test/resources/Token1.json  |   17 +
 .../mp-rest-jwt/src/test/resources/Token2.json  |   14 +
 .../src/test/resources/arquillian.xml           |   32 +
 .../src/test/resources/privateKey.pem           |   28 +
 .../src/test/resources/publicKey.pem            |    9 +
 examples/mvc-cxf/README.md                      |   23 +
 examples/mvc-cxf/pom.xml                        |  143 +
 .../superbiz/application/MVCApplication.java    |   23 +
 .../org/superbiz/controller/HomeController.java |   32 +
 .../superbiz/controller/PersonController.java   |  154 +
 .../main/java/org/superbiz/model/Address.java   |   72 +
 .../main/java/org/superbiz/model/Errors.java    |   50 +
 .../main/java/org/superbiz/model/Messages.java  |   39 +
 .../main/java/org/superbiz/model/Person.java    |  125 +
 .../superbiz/persistence/PersonProducer.java    |   43 +
 .../superbiz/persistence/PersonRepository.java  |   29 +
 .../src/main/resources/META-INF/beans.xml       |   24 +
 .../src/main/resources/META-INF/persistence.xml |   40 +
 .../src/main/webapp/WEB-INF/views/change.jsp    |  134 +
 .../src/main/webapp/WEB-INF/views/home.jsp      |   37 +
 .../src/main/webapp/WEB-INF/views/insert.jsp    |  131 +
 .../src/main/webapp/WEB-INF/views/list.jsp      |   92 +
 examples/mvc-cxf/src/main/webapp/index.jsp      |   28 +
 .../bootstrap/css/bootstrap-datepicker.css      |  471 ++
 .../resources/bootstrap/css/bootstrap-theme.css |  587 ++
 .../bootstrap/css/bootstrap-theme.css.map       |    1 +
 .../bootstrap/css/bootstrap-theme.min.css       |    6 +
 .../bootstrap/css/bootstrap-theme.min.css.map   |    1 +
 .../resources/bootstrap/css/bootstrap.css       | 6757 ++++++++++++++++++
 .../resources/bootstrap/css/bootstrap.css.map   |    1 +
 .../resources/bootstrap/css/bootstrap.min.css   |    6 +
 .../bootstrap/css/bootstrap.min.css.map         |    1 +
 .../fonts/glyphicons-halflings-regular.eot      |  Bin 0 -> 20127 bytes
 .../fonts/glyphicons-halflings-regular.svg      |  288 +
 .../fonts/glyphicons-halflings-regular.ttf      |  Bin 0 -> 45404 bytes
 .../fonts/glyphicons-halflings-regular.woff     |  Bin 0 -> 23424 bytes
 .../fonts/glyphicons-halflings-regular.woff2    |  Bin 0 -> 18028 bytes
 .../bootstrap/js/bootstrap-datepicker.js        | 2096 ++++++
 .../js/bootstrap-datepicker.pt-BR.min.js        |    1 +
 .../webapp/resources/bootstrap/js/bootstrap.js  | 2377 ++++++
 .../resources/bootstrap/js/bootstrap.min.js     |    7 +
 .../webapp/resources/bootstrap/js/jquery.min.js |    4 +
 .../main/webapp/resources/bootstrap/js/npm.js   |   13 +
 .../src/main/webapp/resources/images/tomee.png  |  Bin 0 -> 6217 bytes
 .../src/main/webapp/templates/footer.jsp        |   46 +
 .../mvc-cxf/src/main/webapp/templates/menu.jsp  |   47 +
 examples/pom.xml                                |   10 +-
 examples/rest-mp-jwt/README.md                  |    4 -
 examples/rest-mp-jwt/pom.xml                    |  279 -
 .../main/java/org/superbiz/moviefun/Movie.java  |  102 -
 .../java/org/superbiz/moviefun/MoviesBean.java  |   91 -
 .../moviefun/rest/ApplicationConfig.java        |   28 -
 .../org/superbiz/moviefun/rest/LoadRest.java    |   42 -
 .../rest/MoviesMPJWTConfigurationProvider.java  |   63 -
 .../org/superbiz/moviefun/rest/MoviesRest.java  |  113 -
 .../java/org/superbiz/rest/GreetingService.java |   41 -
 .../src/main/resources/META-INF/persistence.xml |   31 -
 examples/rest-mp-jwt/src/main/tomee/tomee.xml   |   27 -
 .../java/org/superbiz/moviefun/MoviesTest.java  |   88 -
 .../java/org/superbiz/moviefun/TokenUtils.java  |  257 -
 .../org/superbiz/rest/GreetingServiceTest.java  |   61 -
 .../resources/META-INF/application-client.xml   |    1 -
 .../rest-mp-jwt/src/test/resources/Token1.json  |   20 -
 .../rest-mp-jwt/src/test/resources/Token2.json  |   12 -
 .../src/test/resources/arquillian.xml           |   32 -
 .../src/test/resources/privateKey.pem           |   28 -
 .../src/test/resources/publicKey.pem            |    9 -
 .../moviefun/MoviesArquillianHtmlUnitTest.java  |    2 +-
 maven/tomee-webapp-archetype/pom.xml            |    4 +-
 .../main/resources/archetype-resources/pom.xml  |    6 +-
 mp-jwt/pom.xml                                  |   12 +
 .../tomee/microprofile/jwt/MPJWTFilter.java     |   52 +-
 .../tomee/microprofile/jwt/cdi/ClaimBean.java   |   19 +-
 .../microprofile/jwt/cdi/MPJWTCDIExtension.java |   48 +-
 .../config/ConfigurableJWTAuthContextInfo.java  |  326 +
 .../jwt/config/JWTAuthContextInfo.java          |   66 +-
 .../MPJWTSecurityAnnotationsInterceptor.java    |    9 +-
 .../principal/DefaultJWTCallerPrincipal.java    |    2 +
 .../DefaultJWTCallerPrincipalFactory.java       |   11 +-
 .../jwt/principal/JWTCallerPrincipal.java       |    2 +
 .../META-INF/org.apache.openejb.extension       |    2 +-
 pom.xml                                         |   15 +-
 .../server/cxf/rs/ApplicationFeatureTest.java   |   87 +
 .../discovery/MulticastDiscoveryAgent.java      |   10 +-
 .../discovery/MultipointDiscoveryAgent.java     |   10 +-
 .../server/discovery/MultipointServer.java      |   42 +-
 .../apache/openejb/server/rest/RESTService.java |    2 +
 .../openejb/server/webservices/WsServlet.java   |    8 +-
 .../server/webservices/saaj/SaajUniverse.java   |   18 +-
 tck/cdi-embedded/dev-tests.xml                  |   60 +
 tck/cdi-tomee/dev-tests.xml                     |   62 +
 .../test/resources/META-INF/cdi-tck.properties  |    2 +-
 tck/microprofile-tck/config/pom.xml             |   44 +
 .../MicroProfileConfigTCKArchiveProcessor.java  |   12 +-
 .../config/src/test/resources/arquillian.xml    |   34 +-
 tck/microprofile-tck/fault-tolerance/pom.xml    |   38 +
 .../src/test/resources/arquillian.xml           |   27 +-
 tck/microprofile-tck/health/pom.xml             |   38 +
 .../health/src/test/resources/arquillian.xml    |   27 +-
 tck/microprofile-tck/jwt/pom.xml                |   55 +-
 .../jwt/AppDeploymentExtension.java             |   77 -
 .../jwt/JWTAuthContextInfoProvider.java         |   63 -
 .../tomee/microprofile/jwt/TCKTokenParser.java  |   40 -
 .../tck/jwt/JWTAuthContextInfoProvider.java     |   56 +
 .../jwt/MicroProfileJWTTCKArchiveProcessor.java |  123 +
 .../tck/jwt/MicroProfileJWTTCKExtension.java    |   29 +
 .../tck/jwt/config/KeyApplication.java          |   27 +
 .../config/PublicKeyAsJWKLocationURLTest.java   |  178 +
 .../jwt/config/PublicKeyAsPEMLocationTest.java  |  161 +
 .../tck/jwt/jwk/PublicKeyAsJWKSTest.java        |   85 +
 ...lipse.microprofile.jwt.tck.util.ITokenParser |    1 -
 ....jboss.arquillian.core.spi.LoadableExtension |    2 +-
 .../jwt/src/test/resources/arquillian.xml       |   58 +-
 .../jwt/src/test/resources/dev.xml              |   59 +-
 .../jwt/src/test/resources/publicKey4k.pem      |   14 +
 .../jwt/src/test/resources/signer-keyset4k.jwk  |   12 +
 tck/microprofile-tck/metrics/pom.xml            |   38 +
 .../metrics/src/test/resources/arquillian.xml   |   33 +-
 tck/microprofile-tck/openapi/pom.xml            |   39 +-
 .../openapi/src/test/resources/arquillian.xml   |   35 +-
 tck/microprofile-tck/opentracing/pom.xml        |   38 +
 .../src/test/resources/arquillian.xml           |   27 +-
 tck/microprofile-tck/rest-client/pom.xml        |   38 +
 ...croProfileRestClientTCKArchiveProcessor.java |   71 -
 .../MicroProfileRestClientTCKExtension.java     |   27 -
 ....jboss.arquillian.core.spi.LoadableExtension |    1 -
 .../src/test/resources/arquillian.xml           |   33 +-
 .../src/main/resources/META-INF/plume/NOTICE    |   23 +
 .../src/main/resources/META-INF/plus/NOTICE     |   45 +
 .../test/java/org/apache/tomee/TomEECliIT.java  |    6 +-
 .../tomee/catalina/TomcatSecurityService.java   |    6 +-
 .../tomee/catalina/TomcatWebAppBuilder.java     |   10 +-
 .../org/apache/tomee/installer/Installer.java   |   18 +-
 .../java/org/apache/tomee/embedded/Main.java    |    2 +-
 .../microprofile/config/TomEEConfigSource.java  |   64 +
 ...eclipse.microprofile.config.spi.ConfigSource |   17 +
 .../tomee-microprofile-webapp/pom.xml           |   12 +-
 tomee/tomee-plume-webapp/pom.xml                |  134 +
 .../src/main/resources/META-INF/NOTICE          |   75 +-
 tomee/tomee-plus-webapp/pom.xml                 |  134 +
 .../src/main/resources/META-INF/NOTICE          |   91 +
 .../openejb/mockito/MockitoExtension.java       |    2 +-
 772 files changed, 54339 insertions(+), 35739 deletions(-)
----------------------------------------------------------------------



[10/13] tomee git commit: use countdownlatch

Posted by jl...@apache.org.
use countdownlatch

Signed-off-by: brunobat <br...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/1d99d91b
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/1d99d91b
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/1d99d91b

Branch: refs/heads/master
Commit: 1d99d91bf9711396cca3c80c01331a2296c53683
Parents: cc2cd4c
Author: brunobat <br...@gmail.com>
Authored: Mon Dec 24 16:09:04 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Mon Dec 24 16:09:04 2018 +0000

----------------------------------------------------------------------
 .../executor/ThreadFactoryServiceTest.java      | 32 +++++++++++++++++---
 1 file changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/1d99d91b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
index 7ab2d15..efe2771 100644
--- a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
+++ b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
@@ -7,11 +7,15 @@ import org.jboss.shrinkwrap.api.asset.EmptyAsset;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.superbiz.executor.ThreadFactoryService.LongTask;
 
 import javax.inject.Inject;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 import java.util.logging.Logger;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -33,6 +37,8 @@ import static org.junit.Assert.assertEquals;
 @RunWith(Arquillian.class)
 public class ThreadFactoryServiceTest {
 
+    private static final Logger LOGGER = Logger.getLogger(ThreadFactoryServiceTest.class.getSimpleName());
+
     @Inject
     private ThreadFactoryService factoryService;
 
@@ -43,16 +49,32 @@ public class ThreadFactoryServiceTest {
                 .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
     }
 
-    //TODO failing to load due to missing DeployerBusinessRemote
     @Test
     public void asyncTask() throws InterruptedException {
-        //task was completed
-        assertEquals(2, factoryService.asyncTask(1));
+        final CountDownLatch countDownLatch = new CountDownLatch(1);
+        final LongTask longTask = new LongTask(1, 50, countDownLatch);
+        factoryService.asyncTask(longTask);
+
+        countDownLatch.await(200, TimeUnit.MILLISECONDS); // With the countdown latch we don't block unnecessarily.
+        LOGGER.info("task was completed");
+
+        assertEquals(2, longTask.getResult());
     }
 
     @Test
     public void asyncHangingTask() throws InterruptedException {
-        // task was interrupted and operation was not completed.
-        assertEquals(1, factoryService.asyncHangingTask(1));
+        final CountDownLatch countDownLatch = new CountDownLatch(1);
+        final LongTask longTask = new LongTask(1, 1000000, countDownLatch);
+
+        try {
+            factoryService.asyncHangingTask(longTask);
+        } catch (RuntimeException e) {
+            //
+        }
+        countDownLatch.await(200, TimeUnit.MILLISECONDS);
+        LOGGER.info("task was interrupted and operation was not completed.");
+
+//        assertTrue(longTask.getIsTerminated());
+        assertEquals(1, longTask.getResult());
     }
 }
\ No newline at end of file


[09/13] tomee git commit: use countdownlatch

Posted by jl...@apache.org.
use countdownlatch

Signed-off-by: brunobat <br...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/cc2cd4cf
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/cc2cd4cf
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/cc2cd4cf

Branch: refs/heads/master
Commit: cc2cd4cf5fcf8b44829d75461de544003ed8e1db
Parents: fad8df9
Author: brunobat <br...@gmail.com>
Authored: Mon Dec 24 16:08:54 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Mon Dec 24 16:08:54 2018 +0000

----------------------------------------------------------------------
 .../superbiz/executor/ThreadFactoryService.java | 28 ++++++++------------
 1 file changed, 11 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/cc2cd4cf/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
index 223b592..629e9db 100644
--- a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
+++ b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
@@ -5,6 +5,7 @@ import javax.enterprise.concurrent.ManagedThreadFactory;
 import javax.enterprise.context.RequestScoped;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.logging.Logger;
 
 /**
@@ -34,47 +35,34 @@ public class ThreadFactoryService {
     /**
      * Happy path.
      *
-     * @param value to compute
-     * @return The thread we created
+     * @param longTask to compute
      */
-    public int asyncTask(final int value) throws InterruptedException {
+    public void asyncTask(final LongTask longTask) throws InterruptedException {
         LOGGER.info("Create asyncTask");
-        final CountDownLatch countDownLatch = new CountDownLatch(1);
-        final LongTask longTask = new LongTask(value, 1000000, countDownLatch);
 
         final Thread thread = factory.newThread(longTask);
         thread.setName("pretty asyncTask");
         thread.start();
-
-        countDownLatch.await(200, TimeUnit.MILLISECONDS);
-
-        return longTask.getResult();
     }
 
     /**
      * Example where we have to stop a thread.
      *
-     * @param value
-     * @return The thread we created
+     * @param longTask
      * @throws InterruptedException
      */
-    public int asyncHangingTask(final int value) throws InterruptedException {
+    public void asyncHangingTask(final Runnable longTask) {
         LOGGER.info("Create asyncHangingTask");
-        final CountDownLatch countDownLatch = new CountDownLatch(1);
-        final LongTask longTask = new LongTask(value, 1000000, countDownLatch);
 
         final Thread thread = factory.newThread(longTask);
         thread.setName("pretty asyncHangingTask");
         thread.start();
 
-        countDownLatch.await(200, TimeUnit.MILLISECONDS);
-
         if (thread.isAlive()) {
             // This will cause any wait in the thread to resume.
             // This will call the InterruptedException block in the longRunnableTask method.
             thread.interrupt();
         }
-        return longTask.getResult();
     }
 
     /**
@@ -85,6 +73,7 @@ public class ThreadFactoryService {
         private final long taskDurationMs;
         private final CountDownLatch countDownLatch;
         private int result;
+        private AtomicBoolean isTerminated = new AtomicBoolean(false);
 
         public LongTask(final int value,
                         final long taskDurationMs,
@@ -98,12 +87,17 @@ public class ThreadFactoryService {
             return result;
         }
 
+        public boolean getIsTerminated() {
+            return isTerminated.get();
+        }
+
         @Override
         public void run() {
             try {
                 // Simulate a long processing task using TimeUnit to sleep.
                 TimeUnit.MILLISECONDS.sleep(taskDurationMs);
             } catch (InterruptedException e) {
+                isTerminated.set(false);
                 throw new RuntimeException("Problem while waiting");
             }
 


[11/13] tomee git commit: Finish ThreadFactory Example

Posted by jl...@apache.org.
Finish ThreadFactory Example

Signed-off-by: brunobat <br...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/2f636699
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/2f636699
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/2f636699

Branch: refs/heads/master
Commit: 2f636699d8ba79e753c37887a60cda50ac749329
Parents: 1d99d91
Author: brunobat <br...@gmail.com>
Authored: Wed Dec 26 12:14:11 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Wed Dec 26 12:14:11 2018 +0000

----------------------------------------------------------------------
 .../superbiz/executor/ThreadFactoryService.java |  3 +-
 .../executor/ThreadFactoryServiceTest.java      | 50 ++++++++++----------
 2 files changed, 28 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/2f636699/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
index 629e9db..93df490 100644
--- a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
+++ b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
@@ -97,7 +97,8 @@ public class ThreadFactoryService {
                 // Simulate a long processing task using TimeUnit to sleep.
                 TimeUnit.MILLISECONDS.sleep(taskDurationMs);
             } catch (InterruptedException e) {
-                isTerminated.set(false);
+                isTerminated.set(true);
+                countDownLatch.countDown();
                 throw new RuntimeException("Problem while waiting");
             }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/2f636699/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
index efe2771..de5ba56 100644
--- a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
+++ b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
@@ -1,5 +1,22 @@
 package org.superbiz.executor;
 
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
@@ -17,22 +34,11 @@ import java.util.logging.Logger;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * This demonstrates used managed threads inside a container.
+ * <br>
+ * We use CountDownLatch to demonstrate the thread management because it's faster and
+ * safer that simply using a sleep and hope the other thread has completed.
  */
 @RunWith(Arquillian.class)
 public class ThreadFactoryServiceTest {
@@ -66,15 +72,11 @@ public class ThreadFactoryServiceTest {
         final CountDownLatch countDownLatch = new CountDownLatch(1);
         final LongTask longTask = new LongTask(1, 1000000, countDownLatch);
 
-        try {
-            factoryService.asyncHangingTask(longTask);
-        } catch (RuntimeException e) {
-            //
-        }
+        factoryService.asyncHangingTask(longTask);
+
         countDownLatch.await(200, TimeUnit.MILLISECONDS);
-        LOGGER.info("task was interrupted and operation was not completed.");
+        LOGGER.info("task should have been interrupted and its operation not completed.");
 
-//        assertTrue(longTask.getIsTerminated());
-        assertEquals(1, longTask.getResult());
+        assertTrue(longTask.getIsTerminated());
     }
 }
\ No newline at end of file


[08/13] tomee git commit: TOMEE-2301 - todo

Posted by jl...@apache.org.
TOMEE-2301 - todo

Signed-off-by: brunobat <br...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/fad8df9f
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/fad8df9f
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/fad8df9f

Branch: refs/heads/master
Commit: fad8df9f59cf80d4207a416b0c282ccd666c17d8
Parents: 624693b
Author: brunobat <br...@gmail.com>
Authored: Thu Dec 20 00:00:13 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Thu Dec 20 00:00:13 2018 +0000

----------------------------------------------------------------------
 .../test/java/org/superbiz/executor/ThreadFactoryServiceTest.java   | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/fad8df9f/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
index 9a4c205..7ab2d15 100644
--- a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
+++ b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
@@ -43,6 +43,7 @@ public class ThreadFactoryServiceTest {
                 .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
     }
 
+    //TODO failing to load due to missing DeployerBusinessRemote
     @Test
     public void asyncTask() throws InterruptedException {
         //task was completed


[13/13] tomee git commit: Merge remote-tracking branch 'upstream/master' into executor-example

Posted by jl...@apache.org.
Merge remote-tracking branch 'upstream/master' into executor-example


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/113644b6
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/113644b6
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/113644b6

Branch: refs/heads/master
Commit: 113644b665415b0908b0948cb323be4ef40251ef
Parents: 40b41a3 1ff8ad8
Author: brunobat <br...@gmail.com>
Authored: Wed Dec 26 12:34:48 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Wed Dec 26 12:34:48 2018 +0000

----------------------------------------------------------------------
 .../arquillian/tests/filter/AllFilterTest.java  |   1 -
 .../tests/realm/CdiLazyRealmTOMEE1490Test.java  |   4 +-
 arquillian/arquillian-tomee-tests/pom.xml       |  39 ++
 docs/configuration.adoc                         |   2 +-
 docs/embedded-and-remotable.adoc                |   2 +-
 docs/embedding.adoc                             |   2 +-
 docs/faq.adoc                                   |   2 +-
 docs/getting-started.adoc                       |   2 +-
 docs/installation.adoc                          |   2 +-
 docs/local-server.adoc                          |   2 +-
 docs/manual-installation.adoc                   |   2 +-
 docs/property-overriding.adoc                   |   2 +-
 docs/remote-server.adoc                         |   2 +-
 docs/securing-a-web-service.adoc                |   2 +-
 docs/system-properties-files.adoc               |   2 +-
 docs/telnet-console.adoc                        |   2 +-
 docs/validation-tool.adoc                       |   2 +-
 examples/jpa-hibernate/README.md                |  15 +-
 examples/moviefun-rest/README.md                | 404 +++++++++++++++++++
 examples/mp-custom-healthcheck/README.adoc      | 146 +++++++
 examples/mp-custom-healthcheck/pom.xml          |  94 +++++
 .../java/org/superbiz/WeatherApiStatus.java     |  52 +++
 .../main/java/org/superbiz/WeatherEndpoint.java |  45 +++
 .../java/org/superbiz/WeatherException.java     |  27 ++
 .../main/java/org/superbiz/WeatherGateway.java  |  63 +++
 .../org/superbiz/WeatherServiceHealthCheck.java |  48 +++
 .../src/main/resources/beans.xml                |   7 +
 .../org/superbiz/test/WeatherServiceTest.java   | 124 ++++++
 .../src/test/resources/arquillian.xml           |  29 ++
 examples/mp-faulttolerance-fallback/README.adoc | 121 ++++++
 examples/mp-faulttolerance-fallback/pom.xml     | 107 +++++
 .../rest/WeatherDayStatusFallbackHandler.java   |  34 ++
 .../org/superbiz/rest/WeatherException.java     |  20 +
 .../java/org/superbiz/rest/WeatherService.java  |  60 +++
 .../org/superbiz/rest/WeatherServiceTest.java   |  74 ++++
 .../src/test/resources/arquillian.xml           |  30 ++
 .../src/test/resources/beans.xml                |   7 +
 examples/mp-opentracing-traced/README.adoc      |  64 +++
 examples/mvc-cxf/README.adoc                    |  24 ++
 examples/mvc-cxf/README.md                      |  23 --
 examples/mvc-resteasy/README.adoc               |  23 ++
 examples/mvc-resteasy/pom.xml                   | 143 +++++++
 .../java/org/superbiz/mvc/MVCApplication.java   |  22 +
 .../java/org/superbiz/mvc/TomeeController.java  |  38 ++
 .../src/main/resources/META-INF/beans.xml       |  23 ++
 .../src/main/webapp/WEB-INF/views/hello.jsp     |  28 ++
 .../src/main/webapp/WEB-INF/web.xml             |  28 ++
 examples/mvc-resteasy/src/main/webapp/index.jsp |  28 ++
 .../src/test/java/org/superbiz/mvc/MVCTest.java |  74 ++++
 .../src/test/resources/arquillian.xml           |  31 ++
 examples/persistence-fragment/README.md         |   6 +-
 examples/pom.xml                                |   3 +
 .../META-INF/org.apache.openejb.extension       |   1 -
 owasp-dc-suppression.xml                        |  80 ++++
 pom.xml                                         |  61 ++-
 .../apache/openejb/server/rest/RESTService.java |   7 +-
 .../apache-tomee/src/main/resources/service.bat |   2 +-
 tomee/tomee-plume-webapp/pom.xml                |   3 +-
 tomee/tomee-plus-webapp/pom.xml                 |   3 +-
 59 files changed, 2242 insertions(+), 52 deletions(-)
----------------------------------------------------------------------



[12/13] tomee git commit: Use CountDownLatch instead of sleep while waiting for other threads.

Posted by jl...@apache.org.
Use CountDownLatch instead of sleep while waiting for other threads.

Signed-off-by: brunobat <br...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/40b41a38
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/40b41a38
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/40b41a38

Branch: refs/heads/master
Commit: 40b41a38df22fc3f9c531684b8ecbc76edabd5b9
Parents: 2f63669
Author: brunobat <br...@gmail.com>
Authored: Wed Dec 26 12:30:28 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Wed Dec 26 12:30:28 2018 +0000

----------------------------------------------------------------------
 .../executor/ManagedScheduledService.java       | 53 ++++++++++----------
 .../superbiz/executor/ThreadFactoryService.java |  4 +-
 .../executor/ManagedScheduledServiceTest.java   | 11 ++--
 3 files changed, 36 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/40b41a38/examples/concurrency-utils/src/main/java/org/superbiz/executor/ManagedScheduledService.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ManagedScheduledService.java b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ManagedScheduledService.java
index c0f2bdb..e9e2cb5 100644
--- a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ManagedScheduledService.java
+++ b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ManagedScheduledService.java
@@ -21,6 +21,7 @@ import javax.annotation.Resource;
 import javax.enterprise.concurrent.ManagedScheduledExecutorService;
 import javax.enterprise.context.RequestScoped;
 import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
@@ -56,15 +57,17 @@ public class ManagedScheduledService {
      * executor uses a runnable to perform the operations.<br>
      * If an exception happens, the task will stop and you can catch the exception with the {@link ScheduledFuture}.
      *
-     * @param value        The value to compute
-     * @param errorMessage If not null an exception with be thrown with this message
+     * @param value          The value to compute
+     * @param errorMessage   If not null an exception with be thrown with this message
+     * @param countDownLatch
      * @return An object where you can cancel the periodic task and check for exceptions.
      */
     public ScheduledFuture<?> periodicFixedDelayTask(final int value,
-                                                     final String errorMessage) {
+                                                     final String errorMessage,
+                                                     final CountDownLatch countDownLatch) {
         LOGGER.info("longRunnableTask scheduled");
         return executor.scheduleAtFixedRate(
-                longRunnableTask(value, 10, errorMessage), 0, 100, TimeUnit.MILLISECONDS);
+                longRunnableTask(value, 10, errorMessage, countDownLatch), 0, 100, TimeUnit.MILLISECONDS);
     }
 
     /**
@@ -77,22 +80,14 @@ public class ManagedScheduledService {
      */
     private Runnable longRunnableTask(final int value,
                                       final int taskDurationMs,
-                                      final String errorMessage) {
+                                      final String errorMessage,
+                                      final CountDownLatch countDownLatch) {
         return () -> {
-            if (nonNull(errorMessage)) {
-                LOGGER.severe("Exception will be thrown");
-                throw new RuntimeException(errorMessage);
-            }
-            try {
-                // Simulate a long processing task using TimeUnit to sleep.
-                TimeUnit.MILLISECONDS.sleep(taskDurationMs);
-            } catch (InterruptedException e) {
-                throw new RuntimeException("Problem while waiting");
-            }
-
+            failOrWait(taskDurationMs, errorMessage);
             Integer result = value + 1;
             LOGGER.info("longRunnableTask complete. Value is " + result);
             // Cannot return result with a Runnable.
+            countDownLatch.countDown();
         };
     }
 
@@ -109,21 +104,25 @@ public class ManagedScheduledService {
                                                final String errorMessage) {
         return () -> {
             LOGGER.info("longCallableTask start");
-            if (nonNull(errorMessage)) {
-                LOGGER.severe("Exception will be thrown");
-                throw new RuntimeException(errorMessage);
-            }
-
-            try {
-                // Simulate a long processing task using TimeUnit to sleep.
-                TimeUnit.MILLISECONDS.sleep(taskDurationMs);
-            } catch (InterruptedException e) {
-                throw new RuntimeException("Problem while waiting");
-            }
+            failOrWait(taskDurationMs, errorMessage);
             LOGGER.info("longCallableTask complete");
             // We can return a result with a Callable.
             return value + 1;
         };
     }
 
+    private void failOrWait(final int taskDurationMs,
+                            final String errorMessage) {
+        if (nonNull(errorMessage)) {
+            LOGGER.severe("Exception will be thrown");
+            throw new RuntimeException(errorMessage);
+        }
+        try {
+            // Simulate a long processing task using TimeUnit to sleep.
+            TimeUnit.MILLISECONDS.sleep(taskDurationMs);
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Problem while waiting");
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/tomee/blob/40b41a38/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
index 93df490..a0d0d6c 100644
--- a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
+++ b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
@@ -66,7 +66,9 @@ public class ThreadFactoryService {
     }
 
     /**
-     * Runnable rung task simulating a lengthy operation
+     * Runnable rung task simulating a lengthy operation.
+     * In the other test classes we use anonymous classes.
+     * It's useful to have a "real" class in this case to be able to access the result of the operation.
      */
     public static class LongTask implements Runnable {
         private final int value;

http://git-wip-us.apache.org/repos/asf/tomee/blob/40b41a38/examples/concurrency-utils/src/test/java/org/superbiz/executor/ManagedScheduledServiceTest.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ManagedScheduledServiceTest.java b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ManagedScheduledServiceTest.java
index 1a859ba..61f9750 100644
--- a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ManagedScheduledServiceTest.java
+++ b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ManagedScheduledServiceTest.java
@@ -25,6 +25,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import javax.inject.Inject;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledFuture;
@@ -75,9 +76,10 @@ public class ManagedScheduledServiceTest {
      */
     @Test
     public void periodicFixedDelayTask() throws InterruptedException {
-        final ScheduledFuture<?> scheduledFuture = scheduledService.periodicFixedDelayTask(1, null);
+        final CountDownLatch countDownLatch = new CountDownLatch(4); // execute 4 times
+        final ScheduledFuture<?> scheduledFuture = scheduledService.periodicFixedDelayTask(1, null, countDownLatch);
         LOGGER.info("Do some other work while we wait for the tasks");
-        TimeUnit.MILLISECONDS.sleep(500);
+        countDownLatch.await(500, TimeUnit.MILLISECONDS);
         if (!scheduledFuture.isCancelled()) {
             scheduledFuture.cancel(true);
             LOGGER.info("task stopped");
@@ -107,10 +109,11 @@ public class ManagedScheduledServiceTest {
      */
     @Test
     public void periodicFixedDelayTaskWithException() {
-        final ScheduledFuture<?> scheduledFuture = scheduledService.periodicFixedDelayTask(1, "Planned exception");
+        final CountDownLatch countDownLatch = new CountDownLatch(1);
+        final ScheduledFuture<?> scheduledFuture = scheduledService.periodicFixedDelayTask(1, "Planned exception", countDownLatch);
 
         try {
-            TimeUnit.MILLISECONDS.sleep(500);
+            countDownLatch.await(200, TimeUnit.MILLISECONDS);
             // please note that this thread will pause here until an exception is thrown.
             // The scheduler uses a Runnable that will never return a result.
             scheduledFuture.get(200, TimeUnit.MILLISECONDS);


[03/13] tomee git commit: TOMEE-2301 - Add javadoc and a TODO

Posted by jl...@apache.org.
TOMEE-2301 - Add javadoc and a TODO

Signed-off-by: brunobat <br...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/ab1de6cb
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/ab1de6cb
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/ab1de6cb

Branch: refs/heads/master
Commit: ab1de6cb4b3f4d2c51bb24f3340910a83e5fffbe
Parents: 2c6ce4a
Author: brunobat <br...@gmail.com>
Authored: Mon Dec 17 19:23:08 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Mon Dec 17 19:23:08 2018 +0000

----------------------------------------------------------------------
 .../org/superbiz/executor/ThreadFactoryService.java   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/ab1de6cb/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
index 6847c54..43e93d9 100644
--- a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
+++ b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
@@ -32,6 +32,12 @@ public class ThreadFactoryService {
     @Resource
     private ManagedThreadFactory factory;
 
+    /**
+     * Happy path.
+     *
+     * @param value to compute
+     * @return The thread we created
+     */
     public Thread asyncTask(final int value) {
         LOGGER.info("Create asyncTask");
         final Thread thread = factory.newThread(longRunnableTask(value, 100, null));
@@ -40,6 +46,13 @@ public class ThreadFactoryService {
         return thread;
     }
 
+    /**
+     * Example where we have to stop a thread.
+     *
+     * @param value
+     * @return The thread we created
+     * @throws InterruptedException
+     */
     public Thread asyncHangingTask(final int value) throws InterruptedException {
         LOGGER.info("Create asyncTask");
         final Thread thread = factory.newThread(longRunnableTask(value, 1000000, null));
@@ -55,6 +68,7 @@ public class ThreadFactoryService {
     }
 
     /**
+     * TODO create a proper runnable class were we store the result and we check periodically if we need to stop the execution.
      * Will simulate a long running operation
      *
      * @param value          The value to compute


[06/13] tomee git commit: TOMEE-2301 - update test

Posted by jl...@apache.org.
TOMEE-2301 - update test

Signed-off-by: brunobat <br...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/5a6818be
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/5a6818be
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/5a6818be

Branch: refs/heads/master
Commit: 5a6818be981f4ee719d252bc953a2700fb1a3581
Parents: 46cb50f
Author: brunobat <br...@gmail.com>
Authored: Tue Dec 18 23:35:04 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Tue Dec 18 23:35:04 2018 +0000

----------------------------------------------------------------------
 .../executor/ThreadFactoryServiceTest.java      | 23 +++++---------------
 1 file changed, 5 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/5a6818be/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
index e2e15c6..9a4c205 100644
--- a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
+++ b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
@@ -9,11 +9,9 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import javax.inject.Inject;
-import java.util.concurrent.TimeUnit;
 import java.util.logging.Logger;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
 
 
 /**
@@ -35,8 +33,6 @@ import static org.junit.Assert.assertTrue;
 @RunWith(Arquillian.class)
 public class ThreadFactoryServiceTest {
 
-    private static final Logger LOGGER = Logger.getLogger(ThreadFactoryServiceTest.class.getSimpleName());
-
     @Inject
     private ThreadFactoryService factoryService;
 
@@ -49,22 +45,13 @@ public class ThreadFactoryServiceTest {
 
     @Test
     public void asyncTask() throws InterruptedException {
-
-        final Thread thread = factoryService.asyncTask(1);
-        assertTrue(thread.isAlive());
-
-        LOGGER.info("Do something else");
-        TimeUnit.MILLISECONDS.sleep(200);
-
-        assertFalse(thread.isAlive());
+        //task was completed
+        assertEquals(2, factoryService.asyncTask(1));
     }
 
     @Test
     public void asyncHangingTask() throws InterruptedException {
-
-        final Thread thread = factoryService.asyncHangingTask(1);
-        LOGGER.info("Do something else");
-        TimeUnit.MILLISECONDS.sleep(200);
-        assertFalse(thread.isAlive());
+        // task was interrupted and operation was not completed.
+        assertEquals(1, factoryService.asyncHangingTask(1));
     }
 }
\ No newline at end of file


[07/13] tomee git commit: TOMEE-2301 - add javadoc

Posted by jl...@apache.org.
TOMEE-2301 - add javadoc

Signed-off-by: brunobat <br...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/624693bb
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/624693bb
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/624693bb

Branch: refs/heads/master
Commit: 624693bbc1fbcb790c6c4a4f1944e8f3c2d818e5
Parents: 5a6818b
Author: brunobat <br...@gmail.com>
Authored: Wed Dec 19 23:59:58 2018 +0000
Committer: brunobat <br...@gmail.com>
Committed: Wed Dec 19 23:59:58 2018 +0000

----------------------------------------------------------------------
 .../src/main/java/org/superbiz/executor/ThreadFactoryService.java | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/624693bb/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
index c0166f7..223b592 100644
--- a/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
+++ b/examples/concurrency-utils/src/main/java/org/superbiz/executor/ThreadFactoryService.java
@@ -77,6 +77,9 @@ public class ThreadFactoryService {
         return longTask.getResult();
     }
 
+    /**
+     * Runnable rung task simulating a lengthy operation
+     */
     public static class LongTask implements Runnable {
         private final int value;
         private final long taskDurationMs;