You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2019/08/02 17:30:47 UTC
svn commit: r1864248 [3/7] - in
/uima/uima-ducc/trunk/uima-ducc-pullservice/src:
main/java/org/apache/uima/ducc/ps/
main/java/org/apache/uima/ducc/ps/net/iface/
main/java/org/apache/uima/ducc/ps/net/impl/
main/java/org/apache/uima/ducc/ps/sd/ main/java...
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/dgen/iface/IDuccGeneratorUimaReferenceByName.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/dgen/iface/IDuccGeneratorUimaReferenceByName.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/dgen/iface/IDuccGeneratorUimaReferenceByName.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/dgen/iface/IDuccGeneratorUimaReferenceByName.java Fri Aug 2 17:30:46 2019
@@ -19,12 +19,15 @@
package org.apache.uima.ducc.ps.service.dgen.iface;
-public interface IDuccGeneratorUimaReferenceByName extends IDuccGeneratorUimaDeployableConfiguration {
+public interface IDuccGeneratorUimaReferenceByName
+ extends IDuccGeneratorUimaDeployableConfiguration {
- public String getReferenceByName();
- public void setReferenceByName(String referenceByName);
-
- public int getThreadCount();
- public void setThreadCount(int threadCount);
+ public String getReferenceByName();
+
+ public void setReferenceByName(String referenceByName);
+
+ public int getThreadCount();
+
+ public void setThreadCount(int threadCount);
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/IErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/IErrorHandler.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/IErrorHandler.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/IErrorHandler.java Fri Aug 2 17:30:46 2019
@@ -21,6 +21,6 @@ package org.apache.uima.ducc.ps.service.
import org.apache.uima.ducc.ps.service.errors.IServiceErrorHandler.Action;
public interface IErrorHandler {
-
- public Action handle();
+
+ public Action handle();
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/IServiceErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/IServiceErrorHandler.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/IServiceErrorHandler.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/IServiceErrorHandler.java Fri Aug 2 17:30:46 2019
@@ -21,12 +21,14 @@ package org.apache.uima.ducc.ps.service.
import org.apache.uima.ducc.ps.service.IServiceComponent;
import org.apache.uima.ducc.ps.service.metrics.IWindowStats;
-public interface IServiceErrorHandler extends IServiceComponent{
- public enum Action {TERMINATE, CONTINUE};
-
- public Action handleProcessError(Exception e, IServiceComponent source, IWindowStats stats);
-
- // Handle framework errors
- public Action handle(Exception e, IServiceComponent source);
-
+public interface IServiceErrorHandler extends IServiceComponent {
+ public enum Action {
+ TERMINATE, CONTINUE
+ };
+
+ public Action handleProcessError(Exception e, IServiceComponent source, IWindowStats stats);
+
+ // Handle framework errors
+ public Action handle(Exception e, IServiceComponent source);
+
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/InvalidOverrideParameterException.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/InvalidOverrideParameterException.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/InvalidOverrideParameterException.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/InvalidOverrideParameterException.java Fri Aug 2 17:30:46 2019
@@ -20,12 +20,12 @@ package org.apache.uima.ducc.ps.service.
public class InvalidOverrideParameterException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = -4948849140814646049L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4948849140814646049L;
- public InvalidOverrideParameterException(String msg) {
- super(msg);
- }
+ public InvalidOverrideParameterException(String msg) {
+ super(msg);
+ }
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ProcessErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ProcessErrorHandler.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ProcessErrorHandler.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ProcessErrorHandler.java Fri Aug 2 17:30:46 2019
@@ -23,14 +23,16 @@ import org.apache.uima.ducc.ps.service.e
public class ProcessErrorHandler implements IErrorHandler {
- private Threshold threshold;
- public ProcessErrorHandler(Threshold threshold) {
- this.threshold = threshold;
- }
- @Override
- public Action handle() {
- // TODO Auto-generated method stub
- return null;
- }
+ private Threshold threshold;
+
+ public ProcessErrorHandler(Threshold threshold) {
+ this.threshold = threshold;
+ }
+
+ @Override
+ public Action handle() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ReconnectErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ReconnectErrorHandler.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ReconnectErrorHandler.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ReconnectErrorHandler.java Fri Aug 2 17:30:46 2019
@@ -23,15 +23,16 @@ import org.apache.uima.ducc.ps.service.e
public class ReconnectErrorHandler implements IErrorHandler {
- private Threshold threshold;
-
- public ReconnectErrorHandler(Threshold threshold) {
- this.threshold = threshold;
- }
- @Override
- public Action handle() {
- // TODO Auto-generated method stub
- return null;
- }
+ private Threshold threshold;
+
+ public ReconnectErrorHandler(Threshold threshold) {
+ this.threshold = threshold;
+ }
+
+ @Override
+ public Action handle() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceException.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceException.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceException.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceException.java Fri Aug 2 17:30:46 2019
@@ -20,12 +20,13 @@ package org.apache.uima.ducc.ps.service.
public class ServiceException extends Exception {
- private static final long serialVersionUID = 1L;
-
- public ServiceException(String msg, Exception cause) {
- super(msg, cause);
- }
- public ServiceException(String msg) {
- super(msg);
- }
+ private static final long serialVersionUID = 1L;
+
+ public ServiceException(String msg, Exception cause) {
+ super(msg, cause);
+ }
+
+ public ServiceException(String msg) {
+ super(msg);
+ }
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceInitializationException.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceInitializationException.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceInitializationException.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceInitializationException.java Fri Aug 2 17:30:46 2019
@@ -18,15 +18,16 @@
*/
package org.apache.uima.ducc.ps.service.errors;
-public class ServiceInitializationException extends Exception{
+public class ServiceInitializationException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public ServiceInitializationException(String msg) {
+ super(msg);
+ }
+
+ public ServiceInitializationException(String msg, Exception e) {
+ super(msg, e);
+ }
- private static final long serialVersionUID = 1L;
- public ServiceInitializationException(String msg) {
- super(msg);
- }
- public ServiceInitializationException(String msg, Exception e) {
- super(msg,e);
- }
-
-
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceProcessException.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceProcessException.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceProcessException.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/ServiceProcessException.java Fri Aug 2 17:30:46 2019
@@ -19,14 +19,16 @@
package org.apache.uima.ducc.ps.service.errors;
public class ServiceProcessException extends RuntimeException {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public ServiceProcessException(String msg) {
- super(msg);
- }
- public ServiceProcessException(String msg, Exception e) {
- super(msg, e);
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public ServiceProcessException(String msg) {
+ super(msg);
+ }
+
+ public ServiceProcessException(String msg, Exception e) {
+ super(msg, e);
+ }
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/Thresholds.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/Thresholds.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/Thresholds.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/Thresholds.java Fri Aug 2 17:30:46 2019
@@ -19,24 +19,30 @@
package org.apache.uima.ducc.ps.service.errors;
public class Thresholds {
-
- private Thresholds() {}
-
- public static Threshold newThreshold(long maxErrors, long windowSize) {
- return new Threshold(maxErrors, windowSize);
- }
- public static class Threshold {
- private long maxErrors;
- private long windowSize;
- public Threshold(long maxErrors, long windowSize) {
- this.maxErrors = maxErrors;
- this.windowSize = windowSize;
- }
- public long getMaxErrors() {
- return maxErrors;
- }
- public long getWindow() {
- return windowSize;
- }
- }
+
+ private Thresholds() {
+ }
+
+ public static Threshold newThreshold(long maxErrors, long windowSize) {
+ return new Threshold(maxErrors, windowSize);
+ }
+
+ public static class Threshold {
+ private long maxErrors;
+
+ private long windowSize;
+
+ public Threshold(long maxErrors, long windowSize) {
+ this.maxErrors = maxErrors;
+ this.windowSize = windowSize;
+ }
+
+ public long getMaxErrors() {
+ return maxErrors;
+ }
+
+ public long getWindow() {
+ return windowSize;
+ }
+ }
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/builtin/DefaultErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/builtin/DefaultErrorHandler.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/builtin/DefaultErrorHandler.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/builtin/DefaultErrorHandler.java Fri Aug 2 17:30:46 2019
@@ -23,16 +23,16 @@ import org.apache.uima.ducc.ps.service.I
import org.apache.uima.ducc.ps.service.errors.IServiceErrorHandler;
import org.apache.uima.ducc.ps.service.metrics.IWindowStats;
-
public class DefaultErrorHandler implements IServiceErrorHandler {
-
- @Override
- public Action handleProcessError(Exception e, IServiceComponent source, IWindowStats stats) {
- return Action.TERMINATE;
- }
- @Override
- public Action handle(Exception e, IServiceComponent source) {
- return Action.TERMINATE;
- }
-
+
+ @Override
+ public Action handleProcessError(Exception e, IServiceComponent source, IWindowStats stats) {
+ return Action.TERMINATE;
+ }
+
+ @Override
+ public Action handle(Exception e, IServiceComponent source) {
+ return Action.TERMINATE;
+ }
+
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/builtin/WindowBasedErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/builtin/WindowBasedErrorHandler.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/builtin/WindowBasedErrorHandler.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/errors/builtin/WindowBasedErrorHandler.java Fri Aug 2 17:30:46 2019
@@ -25,66 +25,70 @@ import org.apache.uima.ducc.ps.service.I
import org.apache.uima.ducc.ps.service.errors.IServiceErrorHandler;
import org.apache.uima.ducc.ps.service.metrics.IWindowStats;
-public class WindowBasedErrorHandler implements IServiceErrorHandler {
+public class WindowBasedErrorHandler implements IServiceErrorHandler {
- private int errorThreshold=1;
- private int windowSize = 1;
- private long errorCount=0;
- private long errorSequences[];
-
-
- public WindowBasedErrorHandler withMaxFrameworkErrors(int maxFrameworkError) {
- this.errorThreshold = maxFrameworkError;
- return this;
- }
- public WindowBasedErrorHandler withProcessErrorWindow(int errorWindow ) {
- this.windowSize = errorWindow;
- return this;
- }
- public WindowBasedErrorHandler build() {
- if (windowSize >= errorThreshold && errorThreshold > 1) {
- errorSequences = new long[errorThreshold - 1];
- Arrays.fill(errorSequences, -windowSize);
- }
- return this;
- }
-
- public boolean exceededErrorWindow(long taskCount) {
- if (errorThreshold == 0) {
- return false;
- }
- ++errorCount;
-
- // If no window check if total errors have REACHED the threshold
- if (errorSequences == null) {
- return (errorCount >= errorThreshold);
- }
- // Insert in array by replacing one that is outside the window.
- int i = errorThreshold - 1;
- while (--i >= 0) {
- if (errorSequences[i] <= taskCount - windowSize) {
- errorSequences[i] = taskCount;
- return false;
- }
- }
- // If insert fails then have reached threshold.
- // Should not be called again after returning true as may return false!
- // But may be called again if no action specified, but then it doesn't matter.
- return true;
- }
-
- @Override
- public Action handleProcessError(Exception e, IServiceComponent source, IWindowStats stats) {
- Action action = Action.CONTINUE;
- if ( exceededErrorWindow(stats.getSuccessCount()) ) {
- action = Action.TERMINATE;
- }
- return action;
- }
- @Override
- public Action handle(Exception e, IServiceComponent source) {
- return Action.TERMINATE;
- }
-
+ private int errorThreshold = 1;
+
+ private int windowSize = 1;
+
+ private long errorCount = 0;
+
+ private long errorSequences[];
+
+ public WindowBasedErrorHandler withMaxFrameworkErrors(int maxFrameworkError) {
+ this.errorThreshold = maxFrameworkError;
+ return this;
+ }
+
+ public WindowBasedErrorHandler withProcessErrorWindow(int errorWindow) {
+ this.windowSize = errorWindow;
+ return this;
+ }
+
+ public WindowBasedErrorHandler build() {
+ if (windowSize >= errorThreshold && errorThreshold > 1) {
+ errorSequences = new long[errorThreshold - 1];
+ Arrays.fill(errorSequences, -windowSize);
+ }
+ return this;
+ }
+
+ public boolean exceededErrorWindow(long taskCount) {
+ if (errorThreshold == 0) {
+ return false;
+ }
+ ++errorCount;
+
+ // If no window check if total errors have REACHED the threshold
+ if (errorSequences == null) {
+ return (errorCount >= errorThreshold);
+ }
+ // Insert in array by replacing one that is outside the window.
+ int i = errorThreshold - 1;
+ while (--i >= 0) {
+ if (errorSequences[i] <= taskCount - windowSize) {
+ errorSequences[i] = taskCount;
+ return false;
+ }
+ }
+ // If insert fails then have reached threshold.
+ // Should not be called again after returning true as may return false!
+ // But may be called again if no action specified, but then it doesn't matter.
+ return true;
+ }
+
+ @Override
+ public Action handleProcessError(Exception e, IServiceComponent source, IWindowStats stats) {
+ Action action = Action.CONTINUE;
+ if (exceededErrorWindow(stats.getSuccessCount())) {
+ action = Action.TERMINATE;
+ }
+ return action;
+ }
+
+ @Override
+ public Action handle(Exception e, IServiceComponent source) {
+ return Action.TERMINATE;
+ }
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/CustomProcessorExample.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/CustomProcessorExample.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/CustomProcessorExample.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/CustomProcessorExample.java Fri Aug 2 17:30:46 2019
@@ -25,36 +25,39 @@ import org.apache.uima.ducc.ps.service.p
import org.apache.uima.util.Level;
import org.apache.uima.util.Logger;
-public class CustomProcessorExample implements IServiceProcessor{
+public class CustomProcessorExample implements IServiceProcessor {
- private Logger logger = UIMAFramework.getLogger(CustomProcessorExample.class);
- @Override
- public void initialize() throws ServiceInitializationException {
- logger.log(Level.INFO,"... initialize() called");
- }
-
- @Override
- public IProcessResult process(String serializedTask) {
- logger.log(Level.INFO,"... process() called");
- return new SuccessResultExample("");
- }
-
- @Override
- public void stop() {
- logger.log(Level.INFO,"... stop() called");
-
- }
- public void setScaleout(int howManyThreads) {
- logger.log(Level.INFO,"... setScaleout() called");
- }
- public int getScaleout() {
- logger.log(Level.INFO,"... getScaleout() called");
- return 1;
- }
-
- @Override
- public void setErrorHandlerWindow(int maxErrors, int windowSize) {
- logger.log(Level.INFO,"... setErrorHandlerWindow() called");
+ private Logger logger = UIMAFramework.getLogger(CustomProcessorExample.class);
- }
+ @Override
+ public void initialize() throws ServiceInitializationException {
+ logger.log(Level.INFO, "... initialize() called");
+ }
+
+ @Override
+ public IProcessResult process(String serializedTask) {
+ logger.log(Level.INFO, "... process() called");
+ return new SuccessResultExample("");
+ }
+
+ @Override
+ public void stop() {
+ logger.log(Level.INFO, "... stop() called");
+
+ }
+
+ public void setScaleout(int howManyThreads) {
+ logger.log(Level.INFO, "... setScaleout() called");
+ }
+
+ public int getScaleout() {
+ logger.log(Level.INFO, "... getScaleout() called");
+ return 1;
+ }
+
+ @Override
+ public void setErrorHandlerWindow(int maxErrors, int windowSize) {
+ logger.log(Level.INFO, "... setErrorHandlerWindow() called");
+
+ }
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/SuccessResultExample.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/SuccessResultExample.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/SuccessResultExample.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/processor/SuccessResultExample.java Fri Aug 2 17:30:46 2019
@@ -23,36 +23,40 @@ import java.io.StringWriter;
import org.apache.uima.ducc.ps.service.processor.IProcessResult;
-public class SuccessResultExample implements IProcessResult{
+public class SuccessResultExample implements IProcessResult {
- private Exception exception;
- private String success;
-
- public SuccessResultExample(String success) {
- this.success = success;
- }
- public SuccessResultExample(Exception exception) {
- this.exception = exception;
- }
- @Override
- public boolean terminateProcess() {
- return false;
- }
-
- @Override
- public String getResult() {
- return success;
- }
-
- @Override
- public String getError() {
- StringWriter stackTraceBuffer = new StringWriter();
- exception.printStackTrace(new PrintWriter(stackTraceBuffer));
- return stackTraceBuffer.toString();
- }
- @Override
- public Exception getExceptionObject() {
- return exception;
- }
+ private Exception exception;
+
+ private String success;
+
+ public SuccessResultExample(String success) {
+ this.success = success;
+ }
+
+ public SuccessResultExample(Exception exception) {
+ this.exception = exception;
+ }
+
+ @Override
+ public boolean terminateProcess() {
+ return false;
+ }
+
+ @Override
+ public String getResult() {
+ return success;
+ }
+
+ @Override
+ public String getError() {
+ StringWriter stackTraceBuffer = new StringWriter();
+ exception.printStackTrace(new PrintWriter(stackTraceBuffer));
+ return stackTraceBuffer.toString();
+ }
+
+ @Override
+ public Exception getExceptionObject() {
+ return exception;
+ }
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/registry/RegistryClientExample.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/registry/RegistryClientExample.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/registry/RegistryClientExample.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/examples/registry/RegistryClientExample.java Fri Aug 2 17:30:46 2019
@@ -24,15 +24,16 @@ import org.apache.uima.ducc.ps.service.r
public class RegistryClientExample implements IRegistryClient {
- private String targetURL;
-
- public RegistryClientExample(String targetURL) {
- this.targetURL = targetURL;
- }
- @Override
- public String lookUp(String currentTarget) throws RegistryNotAvailableException {
+ private String targetURL;
- return targetURL;
- }
+ public RegistryClientExample(String targetURL) {
+ this.targetURL = targetURL;
+ }
+
+ @Override
+ public String lookUp(String currentTarget) throws RegistryNotAvailableException {
+
+ return targetURL;
+ }
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/jmx/JMXAgent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/jmx/JMXAgent.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/jmx/JMXAgent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/jmx/JMXAgent.java Fri Aug 2 17:30:46 2019
@@ -34,73 +34,78 @@ import org.apache.uima.util.Level;
import org.apache.uima.util.Logger;
public class JMXAgent {
- private JMXConnectorServer jmxConnector;
- private Logger logger;
- private String assignedJmxPort;
-
- public JMXAgent(String assignedJmxPort, Logger logger) {
- this.assignedJmxPort = assignedJmxPort;
- this.logger = logger;
- }
-
- public int initialize() throws ServiceInitializationException {
- String key = "com.sun.management.jmxremote.authenticate";
- String value = System.getProperty(key);
- logger.log(Level.INFO, key + "=" + value);
- int rmiRegistryPort = 2099; // start with a default port setting
- if (assignedJmxPort != null) {
- try {
- int tmp = Integer.parseInt(assignedJmxPort);
- rmiRegistryPort = tmp;
- } catch (NumberFormatException nfe) {
- // default to 2099
- logger.log(Level.WARNING, "startJmxAgent", nfe);
- }
- }
- boolean done = false;
-// JMXServiceURL url = null;
- // retry until a valid rmi port is found
- while (!done) {
- try {
- LocateRegistry.createRegistry(rmiRegistryPort);
- done = true;
- // Got a valid port
- } catch (Exception exx) {
- // Try again with a different port
- rmiRegistryPort++;
- }
- } // while
- return rmiRegistryPort;
- }
- /**
- * Start RMI registry so the JMX clients can connect to the JVM via JMX.
- *
- * @return JMX connect URL
- * @throws Exception
- */
- public String start(int rmiRegistryPort) throws ServiceInitializationException {
- JMXServiceURL url = null;
- try {
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-
- String hostname = InetAddress.getLocalHost().getHostName();
-
- String s = String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", hostname, rmiRegistryPort);
- url = new JMXServiceURL(s);
- jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
- jmxConnector.start();
- } catch (Exception e) {
- url = null;
- logger.log(Level.WARNING,
- "startJmxAgent Unable to Start JMX Connector. Running with *No* JMX Connectivity");
- }
- if (url == null) {
- return ""; // empty string
- } else {
- return url.toString();
- }
- }
- public void stop() throws IOException {
- jmxConnector.stop();
- }
+ private JMXConnectorServer jmxConnector;
+
+ private Logger logger;
+
+ private String assignedJmxPort;
+
+ public JMXAgent(String assignedJmxPort, Logger logger) {
+ this.assignedJmxPort = assignedJmxPort;
+ this.logger = logger;
+ }
+
+ public int initialize() throws ServiceInitializationException {
+ String key = "com.sun.management.jmxremote.authenticate";
+ String value = System.getProperty(key);
+ logger.log(Level.INFO, key + "=" + value);
+ int rmiRegistryPort = 2099; // start with a default port setting
+ if (assignedJmxPort != null) {
+ try {
+ int tmp = Integer.parseInt(assignedJmxPort);
+ rmiRegistryPort = tmp;
+ } catch (NumberFormatException nfe) {
+ // default to 2099
+ logger.log(Level.WARNING, "startJmxAgent", nfe);
+ }
+ }
+ boolean done = false;
+ // JMXServiceURL url = null;
+ // retry until a valid rmi port is found
+ while (!done) {
+ try {
+ LocateRegistry.createRegistry(rmiRegistryPort);
+ done = true;
+ // Got a valid port
+ } catch (Exception exx) {
+ // Try again with a different port
+ rmiRegistryPort++;
+ }
+ } // while
+ return rmiRegistryPort;
+ }
+
+ /**
+ * Start RMI registry so the JMX clients can connect to the JVM via JMX.
+ *
+ * @return JMX connect URL
+ * @throws Exception
+ */
+ public String start(int rmiRegistryPort) throws ServiceInitializationException {
+ JMXServiceURL url = null;
+ try {
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+
+ String hostname = InetAddress.getLocalHost().getHostName();
+
+ String s = String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", hostname,
+ rmiRegistryPort);
+ url = new JMXServiceURL(s);
+ jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
+ jmxConnector.start();
+ } catch (Exception e) {
+ url = null;
+ logger.log(Level.WARNING,
+ "startJmxAgent Unable to Start JMX Connector. Running with *No* JMX Connectivity");
+ }
+ if (url == null) {
+ return ""; // empty string
+ } else {
+ return url.toString();
+ }
+ }
+
+ public void stop() throws IOException {
+ jmxConnector.stop();
+ }
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/jmx/JmxAEProcessInitMonitor.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/jmx/JmxAEProcessInitMonitor.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/jmx/JmxAEProcessInitMonitor.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/jmx/JmxAEProcessInitMonitor.java Fri Aug 2 17:30:46 2019
@@ -40,264 +40,251 @@ import org.apache.uima.ducc.ps.service.m
import org.apache.uima.util.Level;
import org.apache.uima.util.Logger;
-
public class JmxAEProcessInitMonitor implements Runnable {
- private volatile boolean running = false;
- private MBeanServer server = null;
- private IServiceMonitor monitor;
- private static int howManySeenSoFar = 1;
- private Logger logger;
-
- public List<IUimaPipelineAEComponent> aeStateList =
- new ArrayList<>();
-
- public JmxAEProcessInitMonitor(IServiceMonitor monitor,Logger logger )
- {
- server = ManagementFactory.getPlatformMBeanServer();
- this.monitor = monitor;
- this.logger = logger;
- }
-
- private IUimaPipelineAEComponent getUimaAeByName(String name) {
- for (IUimaPipelineAEComponent aeState : aeStateList) {
- if (aeState.getAeName().equals(name)) {
- return aeState;
- }
- }
-
- return null;
- }
- public void updateAgentWhenRunning() {
- running = true;
- try {
- run();
- } catch (Exception ex) {
- logger.log(Level.WARNING, "", ex);
- }
- }
- public void run() {
- if ( running ) {
- return; // the process is in Running state
- }
- try {
- // create an ObjectName with UIMA JMX naming convention to
- // enable
- // finding deployed uima components.
- ObjectName uimaServicePattern = new ObjectName(
- "org.apache.uima:*");
- // Fetch UIMA MBean names from JMX Server that match above
- // name pattern
- Set<ObjectInstance> mbeans = new HashSet<>(
- server.queryMBeans(uimaServicePattern, null));
- List<IUimaPipelineAEComponent> componentsToDelete = new ArrayList<>();
- boolean updateMonitor = false;
- for (ObjectInstance instance : mbeans) {
- String targetName = instance.getObjectName()
- .getKeyProperty("name");
- if (targetName.endsWith("FlowController") || targetName.trim().endsWith("DUCC.Job")) { // skip FC
- continue;
- }
- // Only interested in AEs
- if (instance
- .getClassName()
- .equals("org.apache.uima.analysis_engine.impl.AnalysisEngineManagementImpl")) {
- String[] aeObjectNameParts = instance.getObjectName()
- .toString().split(",");
- if (aeObjectNameParts.length == 3) {
- // this is uima aggregate MBean. Skip it. We only
- // care about this
- // aggregate's pipeline components.
- continue;
- }
- StringBuilder sb = new StringBuilder();
- // compose component name from jmx ObjectName
- for (String part : aeObjectNameParts) {
- if (part.startsWith("org.apache.uima:type")
- || part.startsWith("s=")) {
- continue; // skip service name part of the name
- } else {
- sb.append("/");
- if (part.endsWith("Components")) {
- part = part.substring(0,
- part.indexOf("Components")).trim();
- }
- sb.append(part.substring(part.indexOf("=") + 1));
- }
- }
- // Fetch a proxy to the AE Management object which holds
- // AE stats
- AnalysisEngineManagement proxy = JMX.newMBeanProxy(
- server, instance.getObjectName(),
- AnalysisEngineManagement.class);
-
- IUimaPipelineAEComponent aeState = null;
- if ((aeState = getUimaAeByName(sb.toString())) == null) {
- // Not interested in AEs that are in a Ready State
- if (AnalysisEngineManagement.State.valueOf(
- proxy.getState()).equals(
- AnalysisEngineManagement.State.Ready)) {
- continue;
- }
- aeState = new UimaPipelineAEComponent(
- sb.toString(), proxy.getThreadId(),
- AnalysisEngineManagement.State
- .valueOf(proxy.getState()));
- aeStateList.add(aeState);
- ((UimaPipelineAEComponent) aeState).startInitialization = System
- .currentTimeMillis();
- aeState.setAeState(AnalysisEngineManagement.State.Initializing);
- updateMonitor = true;
- } else {
- // continue publishing AE state while the AE is
- // initializing
- if (AnalysisEngineManagement.State
- .valueOf(proxy.getState())
- .equals(AnalysisEngineManagement.State.Initializing)) {
- updateMonitor = true;
- aeState.setInitializationTime(System
- .currentTimeMillis()
- - ((UimaPipelineAEComponent) aeState).startInitialization);
- // publish state if the AE just finished
- // initializing and is now in Ready state
- } else if (aeState
- .getAeState()
- .equals(AnalysisEngineManagement.State.Initializing)
- && AnalysisEngineManagement.State
- .valueOf(proxy.getState())
- .equals(AnalysisEngineManagement.State.Ready)) {
- aeState.setAeState(AnalysisEngineManagement.State.Ready);
- updateMonitor = true;
- synchronized (this) {
- try {
- wait(5);
- } catch (InterruptedException ex) {
- }
- }
- aeState.setInitializationTime(proxy
- .getInitializationTime());
- // AE reached ready state we no longer need to
- // publish its state
- componentsToDelete.add(aeState);
- }
- }
- if (logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE,
- "UimaAEJmxMonitor.run()---- AE Name:" + proxy.getName()
- + " AE State:" + proxy.getState()
- + " AE init time="
- + aeState.getInitializationTime()
- + " Proxy Init time="
- + proxy.getInitializationTime()
- + " Proxy Thread ID:"
- + proxy.getThreadId()) ;
- }
- }
- }
- howManySeenSoFar = 1; // reset error counter
- if (updateMonitor && !running ) {
- if ( logger.isLoggable(Level.FINE)) {
- logger.log(Level.FINE,"UimaAEJmxMonitor.run() ---- Publishing UimaPipelineAEComponent List - size="
- + aeStateList.size());
- }
- try {
- if ( monitor != null ) {
- StringBuilder sb = new StringBuilder();
- for( IUimaPipelineAEComponent ae : aeStateList ) {
- sb.append("[").
- append(ae.getAeName()).
- append(",").
- append(ae.getAeState()).
- append(",").
- append(ae.getInitializationTime()).
- append(",").
- append(ae.getAeThreadId()).append("]");
- }
- Properties initState = new Properties();
- initState.setProperty("SERVICE_UIMA_INIT_STATE", sb.toString());
- monitor.onStateChange( initState);
- //agent.notify(false, aeStateList);
- }
- } catch (Exception ex) {
- throw ex;
- } finally {
- // remove components that reached Ready state
- for (IUimaPipelineAEComponent aeState : componentsToDelete) {
- aeStateList.remove(aeState);
- }
- }
- }
-
- } catch (UndeclaredThrowableException e) {
- if (!(e.getCause() instanceof InstanceNotFoundException)) {
- if (howManySeenSoFar > 3) { // allow up three errors of this
- // kind
- if ( logger.isLoggable(Level.INFO) ) {
- logger.log(Level.INFO,"", e);
- }
- howManySeenSoFar = 1;
- throw e;
- }
- howManySeenSoFar++;
- } else {
- // AE not fully initialized yet, ignore the exception
- }
- } catch (Throwable e) {
- howManySeenSoFar = 1;
- logger.log(Level.WARNING, "", e);
- }
- }
-
-
- public class UimaPipelineAEComponent implements IUimaPipelineAEComponent {
-
- private static final long serialVersionUID = 1L;
-
- String name;
- State state;
- long threadId;
- long initializationTime;
- public transient long startInitialization;
-
- public UimaPipelineAEComponent(String name, long threadId, State state) {
- this.name = name;
- this.threadId = threadId;
- this.state = state;
- }
- public long getInitializationTime() {
- return initializationTime;
- }
- public void setInitializationTime(long initializationTime) {
- this.initializationTime = initializationTime;
- }
-
-
-
- public String getAeName() {
- // TODO Auto-generated method stub
- return name;
- }
-
-
- public State getAeState() {
- // TODO Auto-generated method stub
- return state;
- }
-
- public void setAeState(State state ){
- this.state = state;
- }
- public long getAeThreadId() {
- // TODO Auto-generated method stub
- return threadId;
- }
-
- }
- public interface IUimaPipelineAEComponent extends Serializable{
- public String getAeName();
- public State getAeState();
- public void setAeState(State state );
- public long getAeThreadId();
- public long getInitializationTime();
- public void setInitializationTime(long initializationTime);
- }
+ private volatile boolean running = false;
+
+ private MBeanServer server = null;
+
+ private IServiceMonitor monitor;
+
+ private static int howManySeenSoFar = 1;
+
+ private Logger logger;
+
+ public List<IUimaPipelineAEComponent> aeStateList = new ArrayList<>();
+
+ public JmxAEProcessInitMonitor(IServiceMonitor monitor, Logger logger) {
+ server = ManagementFactory.getPlatformMBeanServer();
+ this.monitor = monitor;
+ this.logger = logger;
+ }
+
+ private IUimaPipelineAEComponent getUimaAeByName(String name) {
+ for (IUimaPipelineAEComponent aeState : aeStateList) {
+ if (aeState.getAeName().equals(name)) {
+ return aeState;
+ }
+ }
+
+ return null;
+ }
+
+ public void updateAgentWhenRunning() {
+ running = true;
+ try {
+ run();
+ } catch (Exception ex) {
+ logger.log(Level.WARNING, "", ex);
+ }
+ }
+
+ public void run() {
+ if (running) {
+ return; // the process is in Running state
+ }
+ try {
+ // create an ObjectName with UIMA JMX naming convention to
+ // enable
+ // finding deployed uima components.
+ ObjectName uimaServicePattern = new ObjectName("org.apache.uima:*");
+ // Fetch UIMA MBean names from JMX Server that match above
+ // name pattern
+ Set<ObjectInstance> mbeans = new HashSet<>(server.queryMBeans(uimaServicePattern, null));
+ List<IUimaPipelineAEComponent> componentsToDelete = new ArrayList<>();
+ boolean updateMonitor = false;
+ for (ObjectInstance instance : mbeans) {
+ String targetName = instance.getObjectName().getKeyProperty("name");
+ if (targetName.endsWith("FlowController") || targetName.trim().endsWith("DUCC.Job")) { // skip
+ // FC
+ continue;
+ }
+ // Only interested in AEs
+ if (instance.getClassName()
+ .equals("org.apache.uima.analysis_engine.impl.AnalysisEngineManagementImpl")) {
+ String[] aeObjectNameParts = instance.getObjectName().toString().split(",");
+ if (aeObjectNameParts.length == 3) {
+ // this is uima aggregate MBean. Skip it. We only
+ // care about this
+ // aggregate's pipeline components.
+ continue;
+ }
+ StringBuilder sb = new StringBuilder();
+ // compose component name from jmx ObjectName
+ for (String part : aeObjectNameParts) {
+ if (part.startsWith("org.apache.uima:type") || part.startsWith("s=")) {
+ continue; // skip service name part of the name
+ } else {
+ sb.append("/");
+ if (part.endsWith("Components")) {
+ part = part.substring(0, part.indexOf("Components")).trim();
+ }
+ sb.append(part.substring(part.indexOf("=") + 1));
+ }
+ }
+ // Fetch a proxy to the AE Management object which holds
+ // AE stats
+ AnalysisEngineManagement proxy = JMX.newMBeanProxy(server, instance.getObjectName(),
+ AnalysisEngineManagement.class);
+
+ IUimaPipelineAEComponent aeState = null;
+ if ((aeState = getUimaAeByName(sb.toString())) == null) {
+ // Not interested in AEs that are in a Ready State
+ if (AnalysisEngineManagement.State.valueOf(proxy.getState())
+ .equals(AnalysisEngineManagement.State.Ready)) {
+ continue;
+ }
+ aeState = new UimaPipelineAEComponent(sb.toString(), proxy.getThreadId(),
+ AnalysisEngineManagement.State.valueOf(proxy.getState()));
+ aeStateList.add(aeState);
+ ((UimaPipelineAEComponent) aeState).startInitialization = System.currentTimeMillis();
+ aeState.setAeState(AnalysisEngineManagement.State.Initializing);
+ updateMonitor = true;
+ } else {
+ // continue publishing AE state while the AE is
+ // initializing
+ if (AnalysisEngineManagement.State.valueOf(proxy.getState())
+ .equals(AnalysisEngineManagement.State.Initializing)) {
+ updateMonitor = true;
+ aeState.setInitializationTime(System.currentTimeMillis()
+ - ((UimaPipelineAEComponent) aeState).startInitialization);
+ // publish state if the AE just finished
+ // initializing and is now in Ready state
+ } else if (aeState.getAeState().equals(AnalysisEngineManagement.State.Initializing)
+ && AnalysisEngineManagement.State.valueOf(proxy.getState())
+ .equals(AnalysisEngineManagement.State.Ready)) {
+ aeState.setAeState(AnalysisEngineManagement.State.Ready);
+ updateMonitor = true;
+ synchronized (this) {
+ try {
+ wait(5);
+ } catch (InterruptedException ex) {
+ }
+ }
+ aeState.setInitializationTime(proxy.getInitializationTime());
+ // AE reached ready state we no longer need to
+ // publish its state
+ componentsToDelete.add(aeState);
+ }
+ }
+ if (logger.isLoggable(Level.FINE)) {
+ logger.log(Level.FINE,
+ "UimaAEJmxMonitor.run()---- AE Name:" + proxy.getName() + " AE State:"
+ + proxy.getState() + " AE init time=" + aeState.getInitializationTime()
+ + " Proxy Init time=" + proxy.getInitializationTime()
+ + " Proxy Thread ID:" + proxy.getThreadId());
+ }
+ }
+ }
+ howManySeenSoFar = 1; // reset error counter
+ if (updateMonitor && !running) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.log(Level.FINE,
+ "UimaAEJmxMonitor.run() ---- Publishing UimaPipelineAEComponent List - size="
+ + aeStateList.size());
+ }
+ try {
+ if (monitor != null) {
+ StringBuilder sb = new StringBuilder();
+ for (IUimaPipelineAEComponent ae : aeStateList) {
+ sb.append("[").append(ae.getAeName()).append(",").append(ae.getAeState()).append(",")
+ .append(ae.getInitializationTime()).append(",").append(ae.getAeThreadId())
+ .append("]");
+ }
+ Properties initState = new Properties();
+ initState.setProperty("SERVICE_UIMA_INIT_STATE", sb.toString());
+ monitor.onStateChange(initState);
+ // agent.notify(false, aeStateList);
+ }
+ } catch (Exception ex) {
+ throw ex;
+ } finally {
+ // remove components that reached Ready state
+ for (IUimaPipelineAEComponent aeState : componentsToDelete) {
+ aeStateList.remove(aeState);
+ }
+ }
+ }
+
+ } catch (UndeclaredThrowableException e) {
+ if (!(e.getCause() instanceof InstanceNotFoundException)) {
+ if (howManySeenSoFar > 3) { // allow up three errors of this
+ // kind
+ if (logger.isLoggable(Level.INFO)) {
+ logger.log(Level.INFO, "", e);
+ }
+ howManySeenSoFar = 1;
+ throw e;
+ }
+ howManySeenSoFar++;
+ } else {
+ // AE not fully initialized yet, ignore the exception
+ }
+ } catch (Throwable e) {
+ howManySeenSoFar = 1;
+ logger.log(Level.WARNING, "", e);
+ }
+ }
+
+ public class UimaPipelineAEComponent implements IUimaPipelineAEComponent {
+
+ private static final long serialVersionUID = 1L;
+
+ String name;
+
+ State state;
+
+ long threadId;
+
+ long initializationTime;
+
+ public transient long startInitialization;
+
+ public UimaPipelineAEComponent(String name, long threadId, State state) {
+ this.name = name;
+ this.threadId = threadId;
+ this.state = state;
+ }
+
+ public long getInitializationTime() {
+ return initializationTime;
+ }
+
+ public void setInitializationTime(long initializationTime) {
+ this.initializationTime = initializationTime;
+ }
+
+ public String getAeName() {
+ // TODO Auto-generated method stub
+ return name;
+ }
+
+ public State getAeState() {
+ // TODO Auto-generated method stub
+ return state;
+ }
+
+ public void setAeState(State state) {
+ this.state = state;
+ }
+
+ public long getAeThreadId() {
+ // TODO Auto-generated method stub
+ return threadId;
+ }
+
+ }
+
+ public interface IUimaPipelineAEComponent extends Serializable {
+ public String getAeName();
+
+ public State getAeState();
+
+ public void setAeState(State state);
+
+ public long getAeThreadId();
+
+ public long getInitializationTime();
+
+ public void setInitializationTime(long initializationTime);
+ }
}
\ No newline at end of file
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/main/Application.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/main/Application.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/main/Application.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/main/Application.java Fri Aug 2 17:30:46 2019
@@ -20,5 +20,5 @@
package org.apache.uima.ducc.ps.service.main;
public interface Application {
- public void onServiceStop();
+ public void onServiceStop();
}
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/main/PullService.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/main/PullService.java?rev=1864248&r1=1864247&r2=1864248&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/main/PullService.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/main/PullService.java Fri Aug 2 17:30:46 2019
@@ -18,7 +18,6 @@
*/
package org.apache.uima.ducc.ps.service.main;
-
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -54,321 +53,346 @@ import org.apache.uima.util.Level;
import org.apache.uima.util.Logger;
public class PullService implements IService {
- Logger logger = UIMAFramework.getLogger(PullService.class);
- // provide processing threads
- private ScheduledThreadPoolExecutor threadPool ;
- // how many processing threads
- private int scaleout=1;
- // amount of time to wait when client has no tasks to give
- private int waitTimeInMillis=1000;
-
- // application assigned service label
- private String type;
- private volatile boolean initialized = false;
- // ******************************************
- // application must plugin IRegistryClient instance or
- // specify clientURL to use. It's an error if neither
- // is provided
- private String clientURL;
- private IRegistryClient registryClient;
- // ******************************************
-
- // internal error handler
- private IServiceErrorHandler errorHandler=null;
- //
- private IServiceMonitor serviceMonitor=null;
- // internal transport to communicate with remote client
- private IServiceTransport transport=null;
- // internal protocol handler
- private IServiceProtocolHandler protocolHandler=null;
- // application provided service processor
- private IServiceProcessor serviceProcessor;
- // counts down when thread completes initialization or fails
- // while initializing
- private CountDownLatch threadsReady;
- // holds Future to every process thread
- private List<Future<String>> threadHandleList =
- new ArrayList<>();
-
- private Lock initLock = new ReentrantLock();
-
- private Application application=null;
-
-
- public PullService(String type) {
- this(type,null);
-
- }
-
- public PullService(String type, Application application ) {
- this.type = type;
-
- this.application = application;
- }
-
- public String getType() {
- return type;
- }
- public void setWaitTime(int waitTimeInMillis) {
- this.waitTimeInMillis = waitTimeInMillis;
- }
- public void setScaleout(int scaleout) {
- this.scaleout = scaleout;
- this.threadsReady = new CountDownLatch(scaleout);
- }
- private void setErrorHandler(IServiceErrorHandler errorHandler) {
- this.errorHandler = errorHandler;
- }
- private void setMonitor(IServiceMonitor monitor) {
- this.serviceMonitor = monitor;
- }
- private void setProtocolHandler(IServiceProtocolHandler protocolHandler) {
- this.protocolHandler = protocolHandler;
- }
- private void setTransport(IServiceTransport transport) {
- this.transport = transport;
- }
- public void setServiceProcessor(IServiceProcessor serviceProcessor) {
- this.serviceProcessor = serviceProcessor;
- }
-
- public void setRegistryClient(IRegistryClient registryClient) {
- this.registryClient = registryClient;
- }
- public void setClientURL(String clientURL) {
- this.clientURL = clientURL;
- }
- private void initializeDefaultRegistryClient() throws ServiceInitializationException {
- ITargetURI target;
- if (clientURL == null || clientURL.isEmpty()) {
- throw new ServiceInitializationException(
- "Application must plugin IRegistryClient instance or provide a valid client URL");
- }
- try {
- target = TargetURIFactory.newTarget(clientURL);
- } catch (ServiceException e) {
- throw new ServiceInitializationException("Unsupported registry URL " + clientURL, e);
- }
- registryClient = new DefaultRegistryClient(target);
-
- }
-
- @Override
- public void initialize() throws ServiceInitializationException {
- // only one thread can call this method
- initLock.lock();
-
- try {
- if ( initialized ) {
- // Already initialized
- return;
- }
- // if application does not plug in IRegistruClient instance use a default
- // builtin registry which requires application provided client URL
- if (registryClient == null) {
- // the following will throw exception if client URL not specified
- initializeDefaultRegistryClient();
- }
- // Use default wait strategy when a driver is out of work.
- INoTaskAvailableStrategy waitStrategy =
- new DefaultNoTaskAvailableStrategy(waitTimeInMillis);
-
- // add default transport
- transport = new HttpServiceTransport(registryClient, scaleout);
-
- // contract is that the service will block in this method until
- // all process threads initialize. Use a latch to block until this
- // happens. Each process thread will count this down after initialization
- if ( threadsReady == null ) {
- this.threadsReady = new CountDownLatch(scaleout);
- }
- // contract is that the service will block in start() until application
- // calls stop() or there is a fatal error. Each process thread will count
- // this down just before thread dies.
- CountDownLatch stopLatch = new CountDownLatch(scaleout);
- serviceProcessor.setScaleout(scaleout);
- // add default protocol handler
- protocolHandler =
- new DefaultServiceProtocolHandler.Builder()
- .withProcessor(serviceProcessor)
- .withNoTaskStrategy(waitStrategy)
- .withService(this)
- .withTransport(transport)
- .withDoneLatch(stopLatch)
- .withInitCompleteLatch(threadsReady)
- .build();
-
-
- // first initialize Processors. The ServiceThreadFactory creates
- // as many threads as defined in 'scaleout'
- threadPool =
- new ScheduledThreadPoolExecutor(scaleout, new ServiceThreadFactory());
-
- // Create and start worker threads that pull Work Items from a client.
- // Each worker thread calls processor.initialize() and counts down the
- // 'threadsReady' latch. When all threads finish initializing they all
- // block until application calls IService.start()
- for (int j = 0; j < scaleout; j++) {
- threadHandleList.add( threadPool.submit(protocolHandler));
- }
- // wait until all process threads initialize
- threadsReady.await();
- if ( protocolHandler.initialized() ) {
- logger.log(Level.INFO,"Service Initialized ...........");
- initializeMonitor();
- initializeTransport();
- initialized = true;
-
- } else {
- logger.log(Level.INFO, "Protocol Handler Failed Initialization ...........");
- throw new ServiceInitializationException("Service Protocol Handler Failed Initialization");
- }
-
- } catch( ServiceInitializationException e) {
- System.out.println(">>>>>>>>>>>>>> ServiceInitializationException in Pullservice.initialize()");
- throw e;
- } catch( InterruptedException e) {
- Thread.currentThread().interrupt();
- threadPool.shutdownNow();
- throw new ServiceInitializationException("Service interrupted during initialization - shutting down process threads");
- } catch( Exception e) {
- System.out.println(">>>>>>>>>>>>>> Error in Pullservice.initialize()");
- throw new ServiceInitializationException("",e);
- }
- finally {
- initLock.unlock();
- }
-
- }
-
- @Override
- public void start() throws ExecutionException, ServiceException {
- if ( !initialized ) {
- throw new IllegalStateException("Application must call initialize() before calling start()");
- }
- try {
- // unblock process threads to begin fetching and processing
- // tasks.
- protocolHandler.start();
- // wait until all process threads terminate
- waitForProcessThreads();
-
- } catch(InterruptedException e) {
- Thread.currentThread().interrupt();
- if ( threadPool.isTerminating() ) {
- return;
- } else {
- // thread has been interrupted, force executor shutdown
- threadPool.shutdownNow();
- }
- }
-
- }
- @Override
- public void stop() {
- // process threads should stop first to avoid trying to pull new
- // work while threads are running
- //stopProcessThreadPool();
- logger.log(Level.INFO, "Stopping Process Thread Pool");
- threadPool.shutdownNow();
- // close connection to remote client and cleanup
- stopTransport();
- System.out.println(">>>>>>>> "+Utils.getTimestamp()+" "+Utils.getShortClassname(this.getClass())+" .stop()-transport stopped");
- stopProtocolHandler(false);
- System.out.println(">>>>>>>> "+Utils.getTimestamp()+" "+Utils.getShortClassname(this.getClass())+" .stop()-protocol handler stopped");
- stopServiceProcessor();
- System.out.println(">>>>>>>> "+Utils.getTimestamp()+" "+Utils.getShortClassname(this.getClass())+" .stop()-processor stopped");
- // monitor should be stopped last to keep posting updates to observer
- stopMonitor();
- System.out.println(">>>>>>>> "+Utils.getTimestamp()+" "+Utils.getShortClassname(this.getClass())+" .stop()-monitor stopped");
- }
- public void quiesceAndStop() {
- // when quiescing, let the process threads finish processing
- stopProtocolHandler(true); // true = quiesce
- System.out.println(">>>>>>>> "+Utils.getTimestamp()+" "+Utils.getShortClassname(this.getClass())+" .quiesceAndStop()-protocol handler stopped");
- // close connection to remote client and cleanup
- stopTransport();
- System.out.println(">>>>>>>> "+Utils.getTimestamp()+" "+Utils.getShortClassname(this.getClass())+" .quiesceAndStop()-transport stopped");
- stopServiceProcessor();
- System.out.println(">>>>>>>> "+Utils.getTimestamp()+" "+Utils.getShortClassname(this.getClass())+" .quiesceAndStop()-processor stopped");
- // monitor should be stopped last to keep posting updates to observer
- stopMonitor();
- System.out.println(">>>>>>>> "+Utils.getTimestamp()+" "+Utils.getShortClassname(this.getClass())+" .quiesceAndStop()-monitor stopped");
- }
- private void waitForProcessThreads() throws InterruptedException, ExecutionException {
- for (Future<String> future : threadHandleList) {
- // print the return value of Future, notice the output delay in console
- // because Future.get() waits for task to get completed
- String result = future.get();
- logger.log(Level.INFO, "Thread:" + Thread.currentThread().getName() + " Terminated " + new Date() + "::" + result);
- }
- stopProcessThreadPool();
- if ( Objects.nonNull(application) ) {
- application.onServiceStop();
- }
- }
-
-
- private void initializeTransport() throws ServiceInitializationException {
- try {
- transport.initialize();
- } catch( Exception cause) {
- throw new ServiceInitializationException("Service Unable to Initialize Transport", cause);
- }
- }
-
- private void initializeMonitor() throws ServiceInitializationException {
- if ( serviceMonitor != null ) {
- try {
- serviceMonitor.initialize();
- } catch( Exception cause) {
- throw new ServiceInitializationException("Service Unable to Initialize Monitor", cause);
- }
- }
- }
-
- private void stopProcessThreadPool() {
- if (threadPool != null ) {
-
- try {
- logger.log(Level.INFO, "Stopping Process Thread Pool");
- threadPool.shutdownNow();
-
- // below probably not needed since this is done in start()
- threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
- logger.log(Level.INFO, "Process Thread Pool Stopped");
-
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
-
- }
-
-
- private void stopMonitor() {
- if ( serviceMonitor != null ) {
- serviceMonitor.stop();
- }
- }
- private void stopServiceProcessor() {
- if ( serviceProcessor != null ) {
- serviceProcessor.stop();
- }
- }
- private void stopProtocolHandler(boolean quiesce) {
- if ( quiesce ) {
- protocolHandler.quiesceAndStop();
- } else {
- protocolHandler.stop();
- }
- }
- private void stopTransport() {
- transport.stop(false); // !quiesce
- }
- public static void main(String[] args) {
+ Logger logger = UIMAFramework.getLogger(PullService.class);
+
+ // provide processing threads
+ private ScheduledThreadPoolExecutor threadPool;
+
+ // how many processing threads
+ private int scaleout = 1;
+
+ // amount of time to wait when client has no tasks to give
+ private int waitTimeInMillis = 1000;
+
+ // application assigned service label
+ private String type;
+
+ private volatile boolean initialized = false;
+
+ // ******************************************
+ // application must plugin IRegistryClient instance or
+ // specify clientURL to use. It's an error if neither
+ // is provided
+ private String clientURL;
+
+ private IRegistryClient registryClient;
+ // ******************************************
+
+ // internal error handler
+ private IServiceErrorHandler errorHandler = null;
+
+ //
+ private IServiceMonitor serviceMonitor = null;
+
+ // internal transport to communicate with remote client
+ private IServiceTransport transport = null;
+
+ // internal protocol handler
+ private IServiceProtocolHandler protocolHandler = null;
+
+ // application provided service processor
+ private IServiceProcessor serviceProcessor;
+
+ // counts down when thread completes initialization or fails
+ // while initializing
+ private CountDownLatch threadsReady;
+
+ // holds Future to every process thread
+ private List<Future<String>> threadHandleList = new ArrayList<>();
+
+ private Lock initLock = new ReentrantLock();
+
+ private Application application = null;
+
+ public PullService(String type) {
+ this(type, null);
+
+ }
+
+ public PullService(String type, Application application) {
+ this.type = type;
+
+ this.application = application;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setWaitTime(int waitTimeInMillis) {
+ this.waitTimeInMillis = waitTimeInMillis;
+ }
+
+ public void setScaleout(int scaleout) {
+ this.scaleout = scaleout;
+ this.threadsReady = new CountDownLatch(scaleout);
+ }
+
+ private void setErrorHandler(IServiceErrorHandler errorHandler) {
+ this.errorHandler = errorHandler;
+ }
+
+ private void setMonitor(IServiceMonitor monitor) {
+ this.serviceMonitor = monitor;
+ }
+
+ private void setProtocolHandler(IServiceProtocolHandler protocolHandler) {
+ this.protocolHandler = protocolHandler;
+ }
+
+ private void setTransport(IServiceTransport transport) {
+ this.transport = transport;
+ }
+
+ public void setServiceProcessor(IServiceProcessor serviceProcessor) {
+ this.serviceProcessor = serviceProcessor;
+ }
+
+ public void setRegistryClient(IRegistryClient registryClient) {
+ this.registryClient = registryClient;
+ }
+
+ public void setClientURL(String clientURL) {
+ this.clientURL = clientURL;
+ }
+
+ private void initializeDefaultRegistryClient() throws ServiceInitializationException {
+ ITargetURI target;
+ if (clientURL == null || clientURL.isEmpty()) {
+ throw new ServiceInitializationException(
+ "Application must plugin IRegistryClient instance or provide a valid client URL");
+ }
+ try {
+ target = TargetURIFactory.newTarget(clientURL);
+ } catch (ServiceException e) {
+ throw new ServiceInitializationException("Unsupported registry URL " + clientURL, e);
+ }
+ registryClient = new DefaultRegistryClient(target);
+
+ }
+
+ @Override
+ public void initialize() throws ServiceInitializationException {
+ // only one thread can call this method
+ initLock.lock();
+
+ try {
+ if (initialized) {
+ // Already initialized
+ return;
+ }
+ // if application does not plug in IRegistruClient instance use a default
+ // builtin registry which requires application provided client URL
+ if (registryClient == null) {
+ // the following will throw exception if client URL not specified
+ initializeDefaultRegistryClient();
+ }
+ // Use default wait strategy when a driver is out of work.
+ INoTaskAvailableStrategy waitStrategy = new DefaultNoTaskAvailableStrategy(waitTimeInMillis);
+
+ // add default transport
+ transport = new HttpServiceTransport(registryClient, scaleout);
+
+ // contract is that the service will block in this method until
+ // all process threads initialize. Use a latch to block until this
+ // happens. Each process thread will count this down after initialization
+ if (threadsReady == null) {
+ this.threadsReady = new CountDownLatch(scaleout);
+ }
+ // contract is that the service will block in start() until application
+ // calls stop() or there is a fatal error. Each process thread will count
+ // this down just before thread dies.
+ CountDownLatch stopLatch = new CountDownLatch(scaleout);
+ serviceProcessor.setScaleout(scaleout);
+ // add default protocol handler
+ protocolHandler = new DefaultServiceProtocolHandler.Builder().withProcessor(serviceProcessor)
+ .withNoTaskStrategy(waitStrategy).withService(this).withTransport(transport)
+ .withDoneLatch(stopLatch).withInitCompleteLatch(threadsReady).build();
+
+ // first initialize Processors. The ServiceThreadFactory creates
+ // as many threads as defined in 'scaleout'
+ threadPool = new ScheduledThreadPoolExecutor(scaleout, new ServiceThreadFactory());
+
+ // Create and start worker threads that pull Work Items from a client.
+ // Each worker thread calls processor.initialize() and counts down the
+ // 'threadsReady' latch. When all threads finish initializing they all
+ // block until application calls IService.start()
+ for (int j = 0; j < scaleout; j++) {
+ threadHandleList.add(threadPool.submit(protocolHandler));
+ }
+ // wait until all process threads initialize
+ threadsReady.await();
+ if (protocolHandler.initialized()) {
+ logger.log(Level.INFO, "Service Initialized ...........");
+ initializeMonitor();
+ initializeTransport();
+ initialized = true;
+
+ } else {
+ logger.log(Level.INFO, "Protocol Handler Failed Initialization ...........");
+ throw new ServiceInitializationException("Service Protocol Handler Failed Initialization");
+ }
+
+ } catch (ServiceInitializationException e) {
+ System.out
+ .println(">>>>>>>>>>>>>> ServiceInitializationException in Pullservice.initialize()");
+ throw e;
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ threadPool.shutdownNow();
+ throw new ServiceInitializationException(
+ "Service interrupted during initialization - shutting down process threads");
+ } catch (Exception e) {
+ System.out.println(">>>>>>>>>>>>>> Error in Pullservice.initialize()");
+ throw new ServiceInitializationException("", e);
+ } finally {
+ initLock.unlock();
+ }
+
+ }
+
+ @Override
+ public void start() throws ExecutionException, ServiceException {
+ if (!initialized) {
+ throw new IllegalStateException("Application must call initialize() before calling start()");
+ }
+ try {
+ // unblock process threads to begin fetching and processing
+ // tasks.
+ protocolHandler.start();
+ // wait until all process threads terminate
+ waitForProcessThreads();
+
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ if (threadPool.isTerminating()) {
+ return;
+ } else {
+ // thread has been interrupted, force executor shutdown
+ threadPool.shutdownNow();
+ }
+ }
+
+ }
+
+ @Override
+ public void stop() {
+ // process threads should stop first to avoid trying to pull new
+ // work while threads are running
+ // stopProcessThreadPool();
+ logger.log(Level.INFO, "Stopping Process Thread Pool");
+ threadPool.shutdownNow();
+ // close connection to remote client and cleanup
+ stopTransport();
+ System.out.println(">>>>>>>> " + Utils.getTimestamp() + " "
+ + Utils.getShortClassname(this.getClass()) + " .stop()-transport stopped");
+ stopProtocolHandler(false);
+ System.out.println(">>>>>>>> " + Utils.getTimestamp() + " "
+ + Utils.getShortClassname(this.getClass()) + " .stop()-protocol handler stopped");
+ stopServiceProcessor();
+ System.out.println(">>>>>>>> " + Utils.getTimestamp() + " "
+ + Utils.getShortClassname(this.getClass()) + " .stop()-processor stopped");
+ // monitor should be stopped last to keep posting updates to observer
+ stopMonitor();
+ System.out.println(">>>>>>>> " + Utils.getTimestamp() + " "
+ + Utils.getShortClassname(this.getClass()) + " .stop()-monitor stopped");
+ }
+
+ public void quiesceAndStop() {
+ // when quiescing, let the process threads finish processing
+ stopProtocolHandler(true); // true = quiesce
+ System.out.println(
+ ">>>>>>>> " + Utils.getTimestamp() + " " + Utils.getShortClassname(this.getClass())
+ + " .quiesceAndStop()-protocol handler stopped");
+ // close connection to remote client and cleanup
+ stopTransport();
+ System.out.println(">>>>>>>> " + Utils.getTimestamp() + " "
+ + Utils.getShortClassname(this.getClass()) + " .quiesceAndStop()-transport stopped");
+ stopServiceProcessor();
+ System.out.println(">>>>>>>> " + Utils.getTimestamp() + " "
+ + Utils.getShortClassname(this.getClass()) + " .quiesceAndStop()-processor stopped");
+ // monitor should be stopped last to keep posting updates to observer
+ stopMonitor();
+ System.out.println(">>>>>>>> " + Utils.getTimestamp() + " "
+ + Utils.getShortClassname(this.getClass()) + " .quiesceAndStop()-monitor stopped");
+ }
+
+ private void waitForProcessThreads() throws InterruptedException, ExecutionException {
+ for (Future<String> future : threadHandleList) {
+ // print the return value of Future, notice the output delay in console
+ // because Future.get() waits for task to get completed
+ String result = future.get();
+ logger.log(Level.INFO, "Thread:" + Thread.currentThread().getName() + " Terminated "
+ + new Date() + "::" + result);
+ }
+ stopProcessThreadPool();
+ if (Objects.nonNull(application)) {
+ application.onServiceStop();
+ }
+ }
+
+ private void initializeTransport() throws ServiceInitializationException {
+ try {
+ transport.initialize();
+ } catch (Exception cause) {
+ throw new ServiceInitializationException("Service Unable to Initialize Transport", cause);
+ }
+ }
+
+ private void initializeMonitor() throws ServiceInitializationException {
+ if (serviceMonitor != null) {
+ try {
+ serviceMonitor.initialize();
+ } catch (Exception cause) {
+ throw new ServiceInitializationException("Service Unable to Initialize Monitor", cause);
+ }
+ }
+ }
+
+ private void stopProcessThreadPool() {
+ if (threadPool != null) {
+
+ try {
+ logger.log(Level.INFO, "Stopping Process Thread Pool");
+ threadPool.shutdownNow();
+
+ // below probably not needed since this is done in start()
+ threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
+ logger.log(Level.INFO, "Process Thread Pool Stopped");
+
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ }
+
+ private void stopMonitor() {
+ if (serviceMonitor != null) {
+ serviceMonitor.stop();
+ }
+ }
+
+ private void stopServiceProcessor() {
+ if (serviceProcessor != null) {
+ serviceProcessor.stop();
+ }
+ }
+
+ private void stopProtocolHandler(boolean quiesce) {
+ if (quiesce) {
+ protocolHandler.quiesceAndStop();
+ } else {
+ protocolHandler.stop();
+ }
+ }
+
+ private void stopTransport() {
+ transport.stop(false); // !quiesce
+ }
- }
+ public static void main(String[] args) {
+ }
}