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 2010/03/26 16:10:12 UTC
svn commit: r927905 -
/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineController.java
Author: cwiklik
Date: Fri Mar 26 15:10:11 2010
New Revision: 927905
URL: http://svn.apache.org/viewvc?rev=927905&view=rev
Log:
UIMA-1726 Removed DoNotProcessList. The list is no longer supported and replaced with JMX lookups.
Modified:
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineController.java
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineController.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineController.java?rev=927905&r1=927904&r2=927905&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineController.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineController.java Fri Mar 26 15:10:11 2010
@@ -245,8 +245,6 @@ public abstract class BaseAnalysisEngine
// Set to true when stopping the service
private volatile boolean releasedAllCASes;
- protected List<DoNotProcessEntry> doNotProcessList = new ArrayList<DoNotProcessEntry>();
-
private ScheduledExecutorService daemonServiceExecutor = null;
private static final UimaAsVersion uimaAsVersion = new UimaAsVersion();
@@ -2716,103 +2714,6 @@ public abstract class BaseAnalysisEngine
public boolean isAwaitingCacheCallbackNotification() {
return awaitingCacheCallbackNotification;
}
-
- public void addEndpointToDoNotProcessList(String anEndpointName) {
- if (!isEndpointOnDontProcessList(anEndpointName)) {
- if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
- "addEndpointToDoNotProcessList", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
- "UIMAEE_add_endpoint_to_do_not_process_list__INFO",
- new Object[] { getComponentName(), anEndpointName });
- }
- // Given endpoint will be removed from DoNotProcess list in 30 minutes.
- doNotProcessList.add(new DoNotProcessEntry(DoNotProcessTTL, anEndpointName));
- }
- }
-
- public boolean isEndpointOnDontProcessList(String anEndpointName) {
- for (Iterator<DoNotProcessEntry> it = doNotProcessList.iterator(); it.hasNext();) {
- DoNotProcessEntry entry = it.next();
- if (entry.getEndpointName().equals(anEndpointName)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Invoked by a cleaner thread this method removed entries from a DoNotProcess list that are older
- * than 30 minutes.
- */
- public void evictExpiredEntries() {
- try {
- for (Iterator<DoNotProcessEntry> it = doNotProcessList.iterator(); it.hasNext();) {
- DoNotProcessEntry entry = it.next();
- if (entry.hasExpired()) {
- doNotProcessList.remove(entry);
- }
- }
- } catch (Exception e) {
-
- }
- }
-
- // An entry for the DoNotProcess list. Holds endpoints that are no longer
- // reachable. Each entry expires in 30 minutes of its creation and is
- // subsequently removed from the list.
- private static class DoNotProcessEntry {
- private long timeToLive;
-
- private String endpointName;
-
- private long entryTime;
-
- public DoNotProcessEntry(long aTimeToLive, String anEndpointName) {
- timeToLive = aTimeToLive;
- endpointName = anEndpointName;
- entryTime = System.currentTimeMillis();
- }
-
- public boolean hasExpired() {
- long now = System.currentTimeMillis();
- if (now > (entryTime + timeToLive)) {
- return true;
- }
- return false;
- }
-
- public String getEndpointName() {
- return endpointName;
- }
- }
-
- // Cleanup thread
- protected static class UimaAsServiceCleanupThread implements Runnable {
-
- private AnalysisEngineController controller;
-
- public UimaAsServiceCleanupThread(AnalysisEngineController aController) {
- controller = aController;
- }
-
- public void run() {
- controller.evictExpiredEntries();
- }
- }
-
- /**
- * Registers runnable cleanup thread. It will run at a given intervals until the service is
- * stopped.
- *
- * @param sleepInterval
- * - how often to run in millis
- */
- protected void startServiceCleanupThread(long sleepInterval) {
- daemonServiceExecutor = Executors.newScheduledThreadPool(1);
- daemonServiceExecutor.scheduleWithFixedDelay(new UimaAsServiceCleanupThread(this), 0,
- sleepInterval, TimeUnit.MILLISECONDS);
- }
-
public void changeState(ServiceState state) {
currentState = state;
}