TOMEE-2301 - Add javadoc and a TODO Signed-off-by: brunobat <bruno...@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 <bruno...@gmail.com> Authored: Mon Dec 17 19:23:08 2018 +0000 Committer: brunobat <bruno...@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