[jira] [Commented] (OPENNLP-1224) Use Daemon threads in executor services

2018-11-13 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/OPENNLP-1224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16686104#comment-16686104
 ] 

ASF GitHub Bot commented on OPENNLP-1224:
-

kojisekig closed pull request #338: OPENNLP-1224 Daemon threads
URL: https://github.com/apache/opennlp/pull/338
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/opennlp-tools/src/main/java/opennlp/tools/cmdline/PerformanceMonitor.java 
b/opennlp-tools/src/main/java/opennlp/tools/cmdline/PerformanceMonitor.java
index 082b27c75..f7a869e98 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/cmdline/PerformanceMonitor.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/cmdline/PerformanceMonitor.java
@@ -36,8 +36,12 @@
  */
 public class PerformanceMonitor {
 
-  private ScheduledExecutorService scheduler =
-  Executors.newScheduledThreadPool(1);
+  private ScheduledExecutorService scheduler = 
Executors.newScheduledThreadPool(1, runnable -> {
+Thread thread = new Thread(runnable);
+thread.setName("opennlp.tools.cmdline.PerformanceMonitor");
+thread.setDaemon(true);
+return thread;
+  });
 
   private final String unit;
 
diff --git 
a/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/GISTrainer.java 
b/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/GISTrainer.java
index e8f61774a..19d2c635e 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/GISTrainer.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/GISTrainer.java
@@ -481,7 +481,14 @@ public GISModel trainModel(int iterations, DataIndexer di, 
Prior modelPrior, int
   /* Estimate and return the model parameters. */
   private void findParameters(int iterations, double correctionConstant) {
 int threads = modelExpects.length;
-ExecutorService executor = Executors.newFixedThreadPool(threads);
+
+ExecutorService executor = Executors.newFixedThreadPool(threads, runnable 
-> {
+  Thread thread = new Thread(runnable);
+  
thread.setName("opennlp.tools.ml.maxent.ModelExpactationComputeTask.nextIteration()");
+  thread.setDaemon(true);
+  return thread;
+});
+
 CompletionService completionService =
 new ExecutorCompletionService<>(executor);
 double prevLL = 0.0;
diff --git 
a/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ParallelNegLogLikelihood.java
 
b/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ParallelNegLogLikelihood.java
index 36cacb3ab..2429d001c 100644
--- 
a/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ParallelNegLogLikelihood.java
+++ 
b/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ParallelNegLogLikelihood.java
@@ -104,7 +104,15 @@ public double valueAt(double[] x) {
* Compute tasks in parallel
*/
   private void computeInParallel(double[] x, Class 
taskClass) {
-ExecutorService executor = Executors.newFixedThreadPool(threads);
+
+ExecutorService executor = Executors.newFixedThreadPool(threads, runnable 
-> {
+  Thread thread = new Thread(runnable);
+  thread.setName(
+  
"opennlp.tools.ml.maxent.quasinewton.ParallelNegLogLikelihood.computeInParallel()");
+  thread.setDaemon(true);
+  return thread;
+});
+
 int taskSize = numContexts / threads;
 int leftOver = numContexts % threads;
 


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Use Daemon threads in executor services
> ---
>
> Key: OPENNLP-1224
> URL: https://issues.apache.org/jira/browse/OPENNLP-1224
> Project: OpenNLP
>  Issue Type: Improvement
>Reporter: Edd Spencer
>Assignee: Koji Sekiguchi
>Priority: Major
>
> For all executor services it would be ideal if they are configured to use 
> daemon threads. This will mean that should the process need to be shutdown it 
> will not wait until these threads are complete in order to do so (which can 
> take a long time depending on operation).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OPENNLP-1224) Use Daemon threads in executor services

2018-11-13 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/OPENNLP-1224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16686103#comment-16686103
 ] 

ASF GitHub Bot commented on OPENNLP-1224:
-

kojisekig commented on issue #338: OPENNLP-1224 Daemon threads
URL: https://github.com/apache/opennlp/pull/338#issuecomment-438541536
 
 
   Thank you, Edd! I'm sorry for late reply. We've talked about this last week 
among committers. This is very nice contribution! I'll merge this soon.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Use Daemon threads in executor services
> ---
>
> Key: OPENNLP-1224
> URL: https://issues.apache.org/jira/browse/OPENNLP-1224
> Project: OpenNLP
>  Issue Type: Improvement
>Reporter: Edd Spencer
>Assignee: Koji Sekiguchi
>Priority: Major
>
> For all executor services it would be ideal if they are configured to use 
> daemon threads. This will mean that should the process need to be shutdown it 
> will not wait until these threads are complete in order to do so (which can 
> take a long time depending on operation).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OPENNLP-1224) Use Daemon threads in executor services

2018-11-05 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/OPENNLP-1224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16675042#comment-16675042
 ] 

ASF GitHub Bot commented on OPENNLP-1224:
-

eddspencer opened a new pull request #338: OPENNLP-1224 Daemon threads
URL: https://github.com/apache/opennlp/pull/338
 
 
   Thank you for contributing to Apache OpenNLP.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [x] Is there a JIRA ticket associated with this PR? Is it referenced 
in the commit message?
   
   - [x] Does your PR title start with OPENNLP- where  is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.
   
   - [x] Has your PR been rebased against the latest commit within the target 
branch (typically master)?
   
   - [x] Is your initial contribution a single, squashed commit?
   
   ### For code changes:
   - [x] Have you ensured that the full suite of tests is executed via mvn 
clean install at the root opennlp folder?
   - [ ] Have you written or updated unit tests to verify your changes?
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
   - [ ] If applicable, have you updated the LICENSE file, including the main 
LICENSE file in opennlp folder?
   - [ ] If applicable, have you updated the NOTICE file, including the main 
NOTICE file found in opennlp folder?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which 
it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Use Daemon threads in executor services
> ---
>
> Key: OPENNLP-1224
> URL: https://issues.apache.org/jira/browse/OPENNLP-1224
> Project: OpenNLP
>  Issue Type: Improvement
>Reporter: Edd Spencer
>Priority: Major
>
> For all executor services it would be ideal if they are configured to use 
> daemon threads. This will mean that should the process need to be shutdown it 
> will not wait until these threads are complete in order to do so (which can 
> take a long time depending on operation).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)