summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntje Fuhrmann2012-10-01 06:16:16 (EDT)
committerRobert Sauer2012-10-01 06:16:16 (EDT)
commit249278e89c5dc7c5520f37f2206cf7d0a7f87c3f (patch)
tree03ad1cb5bce9f24ae282f1419c73dd65f24b40fb
parent7d837c77b1739313d561ae4d250f72b9b5f25ea8 (diff)
downloadorg.eclipse.stardust.engine-249278e89c5dc7c5520f37f2206cf7d0a7f87c3f.zip
org.eclipse.stardust.engine-249278e89c5dc7c5520f37f2206cf7d0a7f87c3f.tar.gz
org.eclipse.stardust.engine-249278e89c5dc7c5520f37f2206cf7d0a7f87c3f.tar.bz2
Jira-ID: CRNT-19573
Provide list of rolled back PIs (having crashed activity threads due to runtime exception) git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/engine@59672 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/LocalAdministrationService.java15
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/RemoteAdministrationService.java16
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/beans/RemoteAdministrationServiceImpl.java30
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/TunnelingLocalAdministrationService.java16
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/TunnelingRemoteAdministrationService.java17
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/beans/TunnelingAdministrationServiceImpl.java37
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AdministrationService.java13
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AuditTrailHealthReport.java95
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AuditTrailHealthReportGenerator.java339
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/cli/console/DashboardCommand.java64
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/AdministrationServiceImpl.java195
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/EventUtils.java8
12 files changed, 641 insertions, 204 deletions
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/LocalAdministrationService.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/LocalAdministrationService.java
index d4827c6..d1b8800 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/LocalAdministrationService.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/LocalAdministrationService.java
@@ -634,6 +634,21 @@ public interface LocalAdministrationService extends javax.ejb.EJBLocalObject
public org.eclipse.stardust.engine.api.runtime.AuditTrailHealthReport
getAuditTrailHealthReport()
throws org.eclipse.stardust.engine.api.ejb2.WorkflowException;
+
+ /**
+ * Determines key indicators of audit trail health.
+ *
+ * @return A status report indicating some important indicators of audit trail health.
+ *
+ * @throws org.eclipse.stardust.engine.api.ejb2.WorkflowException as a wrapper for
+ * org.eclipse.stardust.engine.api.ejb2.PublicExceptions and org.eclipse.stardust.engine.api.ejb2.ResourceExceptions
+ *
+ * @see org.eclipse.stardust.engine.api.runtime.AdministrationService#getAuditTrailHealthReport(boolean countOnly)
+ *
+ */
+ public org.eclipse.stardust.engine.api.runtime.AuditTrailHealthReport
+ getAuditTrailHealthReport(boolean countOnly)
+ throws org.eclipse.stardust.engine.api.ejb2.WorkflowException;
/**
* Recovers the complete CARNOT runtime environment.Executed in a separate transaction.
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/RemoteAdministrationService.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/RemoteAdministrationService.java
index 7e5b011..47195eb 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/RemoteAdministrationService.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/RemoteAdministrationService.java
@@ -657,6 +657,22 @@ public interface RemoteAdministrationService extends javax.ejb.EJBObject
getAuditTrailHealthReport()
throws org.eclipse.stardust.engine.api.ejb2.WorkflowException,
java.rmi.RemoteException;
+
+ /**
+ * Determines key indicators of audit trail health.
+ *
+ * @return A status report indicating some important indicators of audit trail health.
+ *
+ * @throws org.eclipse.stardust.engine.api.ejb2.WorkflowException as a wrapper for
+ * org.eclipse.stardust.engine.api.ejb2.PublicExceptions and org.eclipse.stardust.engine.api.ejb2.ResourceExceptions
+ *
+ * @see org.eclipse.stardust.engine.api.runtime.AdministrationService#getAuditTrailHealthReport(boolean countOnly)
+ *
+ */
+ public org.eclipse.stardust.engine.api.runtime.AuditTrailHealthReport
+ getAuditTrailHealthReport(boolean countOnly)
+ throws org.eclipse.stardust.engine.api.ejb2.WorkflowException,
+ java.rmi.RemoteException;
/**
* Recovers the complete CARNOT runtime environment.Executed in a separate transaction.
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/beans/RemoteAdministrationServiceImpl.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/beans/RemoteAdministrationServiceImpl.java
index 26e556c..8af9d1e 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/beans/RemoteAdministrationServiceImpl.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/beans/RemoteAdministrationServiceImpl.java
@@ -984,6 +984,36 @@ public class RemoteAdministrationServiceImpl extends org.eclipse.stardust.engine
throw new org.eclipse.stardust.engine.api.ejb2.WorkflowException(e);
}
}
+
+ /**
+ * Determines key indicators of audit trail health.
+ *
+ * @return A status report indicating some important indicators of audit trail health.
+ *
+ * @throws org.eclipse.stardust.engine.api.ejb2.WorkflowException as a wrapper for
+ * org.eclipse.stardust.engine.api.ejb2.PublicExceptions and org.eclipse.stardust.engine.api.ejb2.ResourceExceptions
+ *
+ * @see org.eclipse.stardust.engine.api.runtime.AdministrationService#getAuditTrailHealthReport(boolean countOnly)
+ *
+ */
+ public org.eclipse.stardust.engine.api.runtime.AuditTrailHealthReport
+ getAuditTrailHealthReport(boolean countOnly)
+ throws org.eclipse.stardust.engine.api.ejb2.WorkflowException
+ {
+ try
+ {
+ return ((org.eclipse.stardust.engine.api.runtime.AdministrationService)
+ service).getAuditTrailHealthReport(countOnly);
+ }
+ catch(org.eclipse.stardust.common.error.PublicException e)
+ {
+ throw new org.eclipse.stardust.engine.api.ejb2.WorkflowException(e);
+ }
+ catch(org.eclipse.stardust.common.error.ResourceException e)
+ {
+ throw new org.eclipse.stardust.engine.api.ejb2.WorkflowException(e);
+ }
+ }
/**
* Recovers the complete CARNOT runtime environment.Executed in a separate transaction.
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/TunnelingLocalAdministrationService.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/TunnelingLocalAdministrationService.java
index 3bd7bb1..cdc98dc 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/TunnelingLocalAdministrationService.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/TunnelingLocalAdministrationService.java
@@ -672,6 +672,22 @@ public interface TunnelingLocalAdministrationService extends javax.ejb.EJBLocalO
getAuditTrailHealthReport(
org.eclipse.stardust.engine.api.ejb2.tunneling.TunneledContext __tunneledContext)
throws org.eclipse.stardust.engine.api.ejb2.WorkflowException;
+
+ /**
+ * Determines key indicators of audit trail health.
+ *
+ * @return A status report indicating some important indicators of audit trail health.
+ *
+ * @throws org.eclipse.stardust.engine.api.ejb2.WorkflowException as a wrapper for
+ * org.eclipse.stardust.engine.api.ejb2.PublicExceptions and org.eclipse.stardust.engine.api.ejb2.ResourceExceptions
+ *
+ * @see org.eclipse.stardust.engine.api.runtime.AdministrationService#getAuditTrailHealthReport(boolean countOnly)
+ *
+ */
+ public org.eclipse.stardust.engine.api.runtime.AuditTrailHealthReport
+ getAuditTrailHealthReport(boolean countOnly,
+ org.eclipse.stardust.engine.api.ejb2.tunneling.TunneledContext __tunneledContext)
+ throws org.eclipse.stardust.engine.api.ejb2.WorkflowException;
/**
* Recovers the complete CARNOT runtime environment.Executed in a separate transaction.
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/TunnelingRemoteAdministrationService.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/TunnelingRemoteAdministrationService.java
index 51fc34b..4d50ef4 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/TunnelingRemoteAdministrationService.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/TunnelingRemoteAdministrationService.java
@@ -695,6 +695,23 @@ public interface TunnelingRemoteAdministrationService extends javax.ejb.EJBObjec
org.eclipse.stardust.engine.api.ejb2.tunneling.TunneledContext __tunneledContext)
throws org.eclipse.stardust.engine.api.ejb2.WorkflowException,
java.rmi.RemoteException;
+
+ /**
+ * Determines key indicators of audit trail health.
+ *
+ * @return A status report indicating some important indicators of audit trail health.
+ *
+ * @throws org.eclipse.stardust.engine.api.ejb2.WorkflowException as a wrapper for
+ * org.eclipse.stardust.engine.api.ejb2.PublicExceptions and org.eclipse.stardust.engine.api.ejb2.ResourceExceptions
+ *
+ * @see org.eclipse.stardust.engine.api.runtime.AdministrationService#getAuditTrailHealthReport(boolean countOnly)
+ *
+ */
+ public org.eclipse.stardust.engine.api.runtime.AuditTrailHealthReport
+ getAuditTrailHealthReport(boolean countOnly,
+ org.eclipse.stardust.engine.api.ejb2.tunneling.TunneledContext __tunneledContext)
+ throws org.eclipse.stardust.engine.api.ejb2.WorkflowException,
+ java.rmi.RemoteException;
/**
* Recovers the complete CARNOT runtime environment.Executed in a separate transaction.
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/beans/TunnelingAdministrationServiceImpl.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/beans/TunnelingAdministrationServiceImpl.java
index c2a8715..a9f3de4 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/beans/TunnelingAdministrationServiceImpl.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/ejb2/tunneling/beans/TunnelingAdministrationServiceImpl.java
@@ -1160,6 +1160,43 @@ public class TunnelingAdministrationServiceImpl extends org.eclipse.stardust.eng
clearInvocationContext(__tunneledContext, __invocationContextBackup);
}
}
+
+ /**
+ * Determines key indicators of audit trail health.
+ *
+ * @return A status report indicating some important indicators of audit trail health.
+ *
+ * @throws org.eclipse.stardust.engine.api.ejb2.WorkflowException as a wrapper for
+ * org.eclipse.stardust.engine.api.ejb2.PublicExceptions and org.eclipse.stardust.engine.api.ejb2.ResourceExceptions
+ *
+ * @see org.eclipse.stardust.engine.api.runtime.AdministrationService#getAuditTrailHealthReport(boolean countOnly)
+ *
+ */
+ public org.eclipse.stardust.engine.api.runtime.AuditTrailHealthReport
+ getAuditTrailHealthReport(boolean countOnly,
+ org.eclipse.stardust.engine.api.ejb2.tunneling.TunneledContext __tunneledContext)
+ throws org.eclipse.stardust.engine.api.ejb2.WorkflowException
+ {
+ java.util.Map __invocationContextBackup = null;
+ try
+ {
+ __invocationContextBackup = initInvocationContext(__tunneledContext);
+ return ((org.eclipse.stardust.engine.api.runtime.AdministrationService)
+ service).getAuditTrailHealthReport(countOnly);
+ }
+ catch(org.eclipse.stardust.common.error.PublicException e)
+ {
+ throw new org.eclipse.stardust.engine.api.ejb2.WorkflowException(e);
+ }
+ catch(org.eclipse.stardust.common.error.ResourceException e)
+ {
+ throw new org.eclipse.stardust.engine.api.ejb2.WorkflowException(e);
+ }
+ finally
+ {
+ clearInvocationContext(__tunneledContext, __invocationContextBackup);
+ }
+ }
/**
* Recovers the complete CARNOT runtime environment.Executed in a separate transaction.
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AdministrationService.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AdministrationService.java
index b057290..dd09b5c 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AdministrationService.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AdministrationService.java
@@ -431,6 +431,19 @@ public interface AdministrationService extends Service
public AuditTrailHealthReport getAuditTrailHealthReport();
/**
+ * Determines key indicators of audit trail health.
+ *
+ * @param countOnly
+ * Determines if report should include the process instances oids or just the
+ * total count of oids. If countOnly is set to true the total count of
+ * process instances will be included in report. If countOnly is set to false
+ * a list containing the process instances oids will be included in report.
+ * @return A status report indicating some important indicators of audit trail health.
+ */
+ @ExecutionPermission(id=ExecutionPermission.Id.readAuditTrailStatistics)
+ public AuditTrailHealthReport getAuditTrailHealthReport(boolean countOnly);
+
+ /**
* Recovers the complete CARNOT runtime environment.Executed in a separate transaction.
* By default the execution is synchronous. Only if there are non fatal errors
* (e.g. locking conflicts), for the affected process instances, a successor asynchronous attempt
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AuditTrailHealthReport.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AuditTrailHealthReport.java
index 393dd2f..df37eb6 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AuditTrailHealthReport.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AuditTrailHealthReport.java
@@ -11,6 +11,8 @@
package org.eclipse.stardust.engine.api.runtime;
import java.io.Serializable;
+import java.util.Collections;
+import java.util.Set;
/**
* Provides key indicators of audit trail health.
@@ -28,6 +30,13 @@ public class AuditTrailHealthReport implements Serializable
private final long nPisHavingCrashedThreads;
private final long nPisHavingCrashedEventBindings;
private final long nPendingAiAborts;
+
+ private Set<Long> nPendingPiCompletesSet = Collections.emptySet();
+ private Set<Long> nPendingPiAbortsSet = Collections.emptySet();
+ private Set<Long> nPendingAiAbortsSet = Collections.emptySet();
+ private Set<Long> nPisHavingCrashedAisSet = Collections.emptySet();
+ private Set<Long> nPisHavingCrashedThreadsSet = Collections.emptySet();
+ private Set<Long> nPisHavingCrashedEventBindingsSet = Collections.emptySet();
public AuditTrailHealthReport(long nPendingPiCompletes, long nPendingPiAborts,
long nPendingAiAborts, long nPisHavingCrashedAis, long nPisHavingCrashedThreads,
@@ -40,6 +49,23 @@ public class AuditTrailHealthReport implements Serializable
this.nPisHavingCrashedThreads = nPisHavingCrashedThreads;
this.nPisHavingCrashedEventBindings = nPisHavingCrashedEventBindings;
}
+
+ public AuditTrailHealthReport(Set<Long> nPendingPiCompletesSet,
+ Set<Long> nPendingPiAbortsSet, Set<Long> nPendingAiAbortsSet,
+ Set<Long> nPisHavingCrashedAisSet, Set<Long> nPisHavingCrashedThreadsSet,
+ Set<Long> nPisHavingCrashedEventBindingsSet)
+ {
+ this(nPendingPiCompletesSet.size(), nPendingPiAbortsSet.size(), nPendingAiAbortsSet
+ .size(), nPisHavingCrashedAisSet.size(), nPisHavingCrashedThreadsSet.size(),
+ nPisHavingCrashedEventBindingsSet.size());
+ this.nPendingPiCompletesSet = nPendingPiCompletesSet;
+ this.nPendingPiAbortsSet = nPendingPiAbortsSet;
+ this.nPendingAiAbortsSet = nPendingAiAbortsSet;
+ this.nPisHavingCrashedAisSet = nPisHavingCrashedAisSet;
+ this.nPisHavingCrashedThreadsSet = nPisHavingCrashedThreadsSet;
+ this.nPisHavingCrashedEventBindingsSet = nPisHavingCrashedEventBindingsSet;
+ }
+
/**
* Gets the number of process instances not having further pending activities, but not
@@ -109,4 +135,73 @@ public class AuditTrailHealthReport implements Serializable
{
return nPisHavingCrashedThreads;
}
+
+ /**
+ * Gets the set of process instances oids not having further pending activities, but not
+ * beeing marked as completed itself. Performing a process recovery on such processes
+ * is recommended.
+ *
+ * @return The set of process instances oids.
+ */
+ public Set<Long> getProcessInstancesLackingCompletion()
+ {
+ return nPendingPiCompletesSet;
+ }
+
+ /**
+ * Gets the set of process instances oids which had been scheduled for abortion but did
+ * not succeed.
+ * Performing a process recovery on such processes is recommended.
+ *
+ * @return The set of process instances oids.
+ */
+ public Set<Long> getProcessInstancesLackingAbortion()
+ {
+ return nPendingPiAbortsSet;
+ }
+
+ /**
+ * Gets the set of process instances oids having activity instances which had been scheduled for abortion but did
+ * not succeed.
+ * Performing a process recovery on such processes is recommended.
+ *
+ * @return The set of process instances oids.
+ */
+ public Set<Long> getActivityInstancesLackingAbortion()
+ {
+ return nPendingAiAbortsSet;
+ }
+
+ /**
+ * Gets the set of process instances oids likely to have crashed activity instances.
+ * Performing a process recovery on such processes is recommended.
+ *
+ * @return The set of process instances oids.
+ */
+ public Set<Long> getProcessInstancesHavingCrashedActivities()
+ {
+ return nPisHavingCrashedAisSet;
+ }
+
+ /**
+ * Gets the set of process instances oids likely to have crashed activity threads.
+ * Performing a process recovery on such processes is recommended.
+ *
+ * @return The set of process instances oids.
+ */
+ public Set<Long> getProcessInstancesHavingCrashedThreads()
+ {
+ return nPisHavingCrashedThreadsSet;
+ }
+
+ /**
+ * Gets the set of process instances oids likely to have crashed event bindings.
+ * Performing a process recovery on such processes is recommended.
+ *
+ * @return The set of process instances oids.
+ */
+ public Set<Long> getProcessInstancesHavingCrashedEventBindings()
+ {
+ return nPisHavingCrashedEventBindingsSet;
+ }
} \ No newline at end of file
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AuditTrailHealthReportGenerator.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AuditTrailHealthReportGenerator.java
new file mode 100644
index 0000000..d1adf28
--- /dev/null
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/runtime/AuditTrailHealthReportGenerator.java
@@ -0,0 +1,339 @@
+package org.eclipse.stardust.engine.api.runtime;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.stardust.common.CollectionUtils;
+import org.eclipse.stardust.common.error.PublicException;
+import org.eclipse.stardust.engine.core.persistence.Column;
+import org.eclipse.stardust.engine.core.persistence.Join;
+import org.eclipse.stardust.engine.core.persistence.Predicates;
+import org.eclipse.stardust.engine.core.persistence.QueryDescriptor;
+import org.eclipse.stardust.engine.core.persistence.jdbc.QueryUtils;
+import org.eclipse.stardust.engine.core.persistence.jdbc.SessionFactory;
+import org.eclipse.stardust.engine.core.runtime.beans.ActivityInstanceBean;
+import org.eclipse.stardust.engine.core.runtime.beans.AuditTrailTransitionBean;
+import org.eclipse.stardust.engine.core.runtime.beans.EventUtils;
+import org.eclipse.stardust.engine.core.runtime.beans.ProcessInstanceBean;
+import org.eclipse.stardust.engine.core.runtime.beans.TransitionTokenBean;
+
+public class AuditTrailHealthReportGenerator
+{
+ private org.eclipse.stardust.engine.core.persistence.jdbc.Session session;
+
+ public AuditTrailHealthReportGenerator()
+ {
+ session = (org.eclipse.stardust.engine.core.persistence.jdbc.Session) SessionFactory
+ .getSession(SessionFactory.AUDIT_TRAIL);
+ }
+
+ public static AuditTrailHealthReport getReport(boolean countOnly)
+ {
+ AuditTrailHealthReportGenerator generator = new AuditTrailHealthReportGenerator();
+ AuditTrailHealthReport report = null;
+ if (countOnly)
+ {
+ report = generator.createCountOnlyReport();
+ }
+ else
+ {
+ report = generator.createUnrestrictedReport();
+ }
+ return report;
+ }
+
+ private AuditTrailHealthReport createCountOnlyReport()
+ {
+ long nPendingPiCompletes = getNumberOfProcessInstancesLackingCompletion();
+ long nPendingPiAborts = getNumberOfProcessInstancesLackingAbortion();
+ long nPendingAiAborts = getNumberOfActivityInstancesLackingAbortion();
+ long nPisHavingCrashedAis = getNumberOfProcessInstancesHavingCrashedActivities();
+ long nPisHavingCrashedThreads = getProcessInstancesHavingCrashedThreadsSet().size();
+ long nPisHavingCrashedEventBindings = EventUtils.countDeactiveEventBindings();
+
+ return new AuditTrailHealthReport(nPendingPiCompletes, nPendingPiAborts,
+ nPendingAiAborts, nPisHavingCrashedAis, nPisHavingCrashedThreads,
+ nPisHavingCrashedEventBindings);
+ }
+
+ private AuditTrailHealthReport createUnrestrictedReport()
+ {
+ Set<Long> nPendingPiCompletesSet = getProcessInstancesLackingCompletionSet();
+ Set<Long> nPendingPiAbortsSet = getProcessInstancesLackingAbortionSet();
+ Set<Long> nPendingAiAbortsSet = getActivityInstancesLackingAbortionSet();
+ Set<Long> nPisHavingCrashedAisSet = getProcessInstancesHavingCrashedActivitiesSet();
+ Set<Long> nPisHavingCrashedThreadsSet = getProcessInstancesHavingCrashedThreadsSet();
+ Set<Long> nPisHavingCrashedEventBindingsSet = EventUtils.getDeactiveEventBindings();
+ return new AuditTrailHealthReport(nPendingPiCompletesSet, nPendingPiAbortsSet,
+ nPendingAiAbortsSet, nPisHavingCrashedAisSet, nPisHavingCrashedThreadsSet,
+ nPisHavingCrashedEventBindingsSet);
+ }
+
+ private long getNumberOfActivityInstancesLackingAbortion()
+ {
+ return getNumberOfQuery(getActivityInstancesLackingAbortionQuery());
+ }
+
+ private long getNumberOfProcessInstancesLackingAbortion()
+ {
+ return getNumberOfQuery(getProcessInstancesLackingAbortionQuery());
+ }
+
+ private long getNumberOfProcessInstancesLackingCompletion()
+ {
+ return getNumberOfQuery(getProcessInstancesLackingCompletionQuery());
+ }
+
+ private long getNumberOfProcessInstancesHavingCrashedActivities()
+ {
+ return getNumberOfQuery(getProcessInstancesHavingCrashedActivitiesQuery());
+ }
+
+ private long getNumberOfQuery(QueryDescriptor query)
+ {
+ return session.getCount(query.getType(), query.getQueryExtension());
+ }
+
+ private Set<Long> getProcessInstancesHavingCrashedThreadsSet()
+ {
+ return calculateCrashedPIs();
+ }
+
+ private Set<Long> calculateCrashedPIs()
+ {
+ QueryDescriptor q = getProcessInstancesHavingCrashedThreadsQuery();
+ HashMap<Long, Set<Long>> zeroTargetTokensPerProcessInstance = new HashMap<Long, Set<Long>>();
+ HashMap<Long, Long> transitionOidToModel = new HashMap<Long, Long>();
+ Set<Long> involvedTransitionOids = new HashSet<Long>();
+ ResultSet resultSet = session.executeQuery(q.getType(), q.getQueryExtension());
+ try
+ {
+ while (resultSet.next())
+ {
+ Long oid = resultSet.getLong(1);
+ Long transitionOid = resultSet.getLong(2);
+ Long modelOid = resultSet.getLong(3);
+
+ involvedTransitionOids.add(transitionOid);
+ transitionOidToModel.put(transitionOid, modelOid);
+
+ Set<Long> transitionOids = zeroTargetTokensPerProcessInstance.get(oid);
+ if (transitionOids == null)
+ {
+ transitionOids = new HashSet<Long>();
+ }
+ transitionOids.add(transitionOid);
+ zeroTargetTokensPerProcessInstance.put(oid, transitionOids);
+ }
+ }
+ catch (SQLException e)
+ {
+ throw new PublicException("Failed evaluating recovery status.", e);
+ }
+ finally
+ {
+ QueryUtils.closeResultSet(resultSet);
+ }
+
+ // Retrieve targetActivityOid from transitionOid.
+ Map<Long, Long> targetActivityOidPerTransitionOid = new HashMap<Long, Long>();
+ for (Long transitionOid : involvedTransitionOids)
+ {
+ AuditTrailTransitionBean transition = AuditTrailTransitionBean.findByOid(
+ transitionOid, transitionOidToModel.get(transitionOid));
+ if (transition != null)
+ {
+ targetActivityOidPerTransitionOid.put(transitionOid,
+ transition.getTargetActivity());
+ }
+ }
+
+ // Retrieve count of all source activities of a target activity.
+ Map<Long, Long> countOfTransitionSourcesPerTargetActivity = new HashMap<Long, Long>();
+ for (Long targetActivityOid : targetActivityOidPerTransitionOid.values())
+ {
+ QueryDescriptor query = QueryDescriptor
+ .from(AuditTrailTransitionBean.class)
+ .select(AuditTrailTransitionBean.FR__OID)
+ .where(
+ Predicates.isEqual(AuditTrailTransitionBean.FR__TGT_ACTIVITY,
+ targetActivityOid));
+ long transitionCount = session.getCount(AuditTrailTransitionBean.class,
+ query.getQueryExtension());
+ countOfTransitionSourcesPerTargetActivity
+ .put(targetActivityOid, transitionCount);
+ }
+ QueryUtils.closeResultSet(resultSet);
+
+ // Iterate over all existing trans_token entries having '0' targetActivityInstance
+ // to see if ALL source activities are contained.
+ Set<Long> crashedPIs = new HashSet<Long>();
+ for (Map.Entry<Long, Set<Long>> entry : zeroTargetTokensPerProcessInstance
+ .entrySet())
+ {
+ Set<Long> transitionOids = entry.getValue();
+
+ Map<Long, Long> countOfInvolvedActivityOids = new HashMap<Long, Long>();
+ for (Long transitionOid : transitionOids)
+ {
+ Long activityOid = targetActivityOidPerTransitionOid.get(transitionOid);
+ Long count = countOfInvolvedActivityOids.get(activityOid);
+ if (count == null)
+ {
+ count = Long.valueOf(0);
+ }
+ count++;
+ countOfInvolvedActivityOids.put(activityOid, count);
+ }
+
+ for (Map.Entry<Long, Long> entry2 : countOfInvolvedActivityOids.entrySet())
+ {
+ // Only crashed candidate if trans_token targetActivityInstanceOids of ALL
+ // source activities are '0'
+ if (countOfTransitionSourcesPerTargetActivity.get(entry2.getKey()) == entry2
+ .getValue())
+ {
+ crashedPIs.add(entry.getKey());
+ }
+ }
+ }
+ return crashedPIs;
+ }
+
+ private QueryDescriptor getProcessInstancesHavingCrashedThreadsQuery()
+ {
+ QueryDescriptor q = QueryDescriptor
+ .from(ProcessInstanceBean.class)
+ .select(
+ new Column[] {
+ ProcessInstanceBean.FR__OID, TransitionTokenBean.FR__TRANSITION,
+ TransitionTokenBean.FR__MODEL})
+ .where(
+ Predicates.notInList(ProcessInstanceBean.FR__STATE, new int[] {
+ ProcessInstanceState.COMPLETED, ProcessInstanceState.ABORTED}));
+ Join join = new Join(TransitionTokenBean.class).on(ProcessInstanceBean.FR__OID,
+ TransitionTokenBean.FIELD__PROCESS_INSTANCE).andOnConstant(
+ TransitionTokenBean.FR__TARGET, "0");
+ q.getQueryExtension().addJoin(join);
+ return q;
+ }
+
+ private QueryDescriptor getProcessInstancesHavingCrashedActivitiesQuery()
+ {
+ QueryDescriptor q = QueryDescriptor
+ .from(ProcessInstanceBean.class)
+ .select(ProcessInstanceBean.FR__OID)
+ .where(
+ Predicates.andTerm(
+ Predicates.isNotNull(TransitionTokenBean.FR__PROCESS_INSTANCE),
+ Predicates.notInList(ProcessInstanceBean.FR__STATE, new int[] {
+ ProcessInstanceState.COMPLETED,
+ ProcessInstanceState.ABORTED})));
+ Join join = new Join(TransitionTokenBean.class).on(ProcessInstanceBean.FR__OID,
+ TransitionTokenBean.FIELD__PROCESS_INSTANCE).andOnConstant(
+ TransitionTokenBean.FR__IS_CONSUMED, "0");
+ join.setRequired(false);
+ Join join2 = new Join(ActivityInstanceBean.class).on(
+ TransitionTokenBean.FR__TARGET, ActivityInstanceBean.FIELD__OID).andWhere(
+ Predicates.inList(ActivityInstanceBean.FR__STATE, new int[] {
+ ActivityInstanceState.CREATED, ActivityInstanceState.INTERRUPTED}));
+ q.getQueryExtension().addJoin(join).addJoin(join2);
+ return q;
+ }
+
+ private QueryDescriptor getProcessInstancesLackingCompletionQuery()
+ {
+ QueryDescriptor q = QueryDescriptor
+ .from(ProcessInstanceBean.class)
+ .select(ProcessInstanceBean.FR__OID)
+ .where(
+ Predicates.andTerm(Predicates
+ .isNull(TransitionTokenBean.FR__PROCESS_INSTANCE), Predicates
+ .notInList(ProcessInstanceBean.FR__STATE,
+ new int[] {
+ ProcessInstanceState.COMPLETED,
+ ProcessInstanceState.ABORTED,
+ ProcessInstanceState.ABORTING})));
+ Join join = new Join(TransitionTokenBean.class).on(ProcessInstanceBean.FR__OID,
+ TransitionTokenBean.FIELD__PROCESS_INSTANCE).andOnConstant(
+ TransitionTokenBean.FR__IS_CONSUMED, "0");
+ join.setRequired(false);
+ q.getQueryExtension().addJoin(join);
+ return q;
+ }
+
+ private Set<Long> getProcessInstancesHavingCrashedActivitiesSet()
+ {
+ return getQueryResult(getProcessInstancesHavingCrashedActivitiesQuery());
+ }
+
+ private Set<Long> getProcessInstancesLackingCompletionSet()
+ {
+ return getQueryResult(getProcessInstancesLackingCompletionQuery());
+ }
+
+ private Set<Long> getQueryResult(QueryDescriptor q)
+ {
+ return getQueryResult(q, ProcessInstanceBean.FIELD__OID);
+ }
+
+ private Set<Long> getQueryResult(QueryDescriptor q, String columnLabel)
+ {
+ Set<Long> pis = CollectionUtils.newSet();
+ ResultSet resultSet = session.executeQuery(q);
+ try
+ {
+ while (resultSet.next())
+ {
+ pis.add(resultSet.getLong(columnLabel));
+ }
+ }
+ catch (SQLException e)
+ {
+ throw new PublicException("Failed evaluating recovery status.", e);
+ }
+ finally
+ {
+ QueryUtils.closeResultSet(resultSet);
+ }
+ return pis;
+ }
+
+ private Set<Long> getProcessInstancesLackingAbortionSet()
+ {
+ return getQueryResult(getProcessInstancesLackingAbortionQuery());
+ }
+
+ private QueryDescriptor getProcessInstancesLackingAbortionQuery()
+ {
+ QueryDescriptor q = QueryDescriptor
+ .from(ProcessInstanceBean.class)
+ .select(ProcessInstanceBean.FR__OID)
+ .where(
+ Predicates.inList(ProcessInstanceBean.FR__STATE,
+ new int[] {ProcessInstanceState.ABORTING}));
+ return q;
+ }
+
+ private Set<Long> getActivityInstancesLackingAbortionSet()
+ {
+ return getQueryResult(getActivityInstancesLackingAbortionQuery(),
+ ActivityInstanceBean.FIELD__PROCESS_INSTANCE);
+ }
+
+ private QueryDescriptor getActivityInstancesLackingAbortionQuery()
+ {
+ QueryDescriptor q = QueryDescriptor
+ .from(ActivityInstanceBean.class)
+ .select(ActivityInstanceBean.FR__PROCESS_INSTANCE)
+ .where(
+ Predicates.inList(ActivityInstanceBean.FR__STATE,
+ new int[] {ActivityInstanceState.ABORTING}));
+ return q;
+ }
+
+}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/cli/console/DashboardCommand.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/cli/console/DashboardCommand.java
index 522e697..a668319 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/cli/console/DashboardCommand.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/cli/console/DashboardCommand.java
@@ -11,7 +11,9 @@
package org.eclipse.stardust.engine.cli.console;
import java.text.MessageFormat;
+import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
import org.eclipse.stardust.common.utils.console.ConsoleCommand;
import org.eclipse.stardust.common.utils.console.Options;
@@ -32,6 +34,8 @@ import org.eclipse.stardust.engine.api.runtime.ServiceFactoryLocator;
*/
public class DashboardCommand extends ConsoleCommand
{
+ private static final String SHOW_OIDS = "showOids";
+
private static final Options argTypes = new Options();
private static final String OVERVIEW = "overview";
@@ -45,6 +49,8 @@ public class DashboardCommand extends ConsoleCommand
"Evaluates some overall indicators (default option).", false);
argTypes.register("-" + RECOVERY, "-r", RECOVERY,
"Evaluates process recovery related indicators.", false);
+ argTypes.register("-" + SHOW_OIDS, "-so", SHOW_OIDS,
+ "Shows a list of process instances oids of -recovery option result.", false);
}
public Options getOptions()
@@ -116,19 +122,36 @@ public class DashboardCommand extends ConsoleCommand
print("");
- AuditTrailHealthReport report = serviceFactory.getAdministrationService()
- .getAuditTrailHealthReport();
- print("Number of process instances likely to have ..");
- print(MessageFormat.format(" .. pending process completion:\t{0}", new Object[] {new Long(
- report.getNumberOfProcessInstancesLackingCompletion())}));
- print(MessageFormat.format(" .. pending process abortion:\t{0}", new Object[] {new Long(
- report.getNumberOfProcessInstancesLackingAbortion())}));
- print(MessageFormat.format(" .. pending activity abortion:\t{0}", new Object[] {new Long(
- report.getNumberOfActivityInstancesLackingAbortion())}));
- print(MessageFormat.format(" .. crashed activity instances:\t{0}", new Object[] {new Long(
- report.getNumberOfProcessInstancesHavingCrashedActivities())}));
- print(MessageFormat.format(" .. crashed activity threads:\t{0}", new Object[] {new Long(
- report.getNumberOfProcessInstancesHavingCrashedThreads())}));
+ boolean countOnly = !options.containsKey(SHOW_OIDS);
+ AuditTrailHealthReport report = serviceFactory.getAdministrationService().getAuditTrailHealthReport(countOnly);
+ if(countOnly)
+ {
+ print("Number of process instances likely to have ..");
+ print(MessageFormat.format(" .. pending process completion:\t{0}", new Object[] {new Long(
+ report.getNumberOfProcessInstancesLackingCompletion())}));
+ print(MessageFormat.format(" .. pending process abortion:\t{0}", new Object[] {new Long(
+ report.getNumberOfProcessInstancesLackingAbortion())}));
+ print(MessageFormat.format(" .. pending activity abortion:\t{0}", new Object[] {new Long(
+ report.getNumberOfActivityInstancesLackingAbortion())}));
+ print(MessageFormat.format(" .. crashed activity instances:\t{0}", new Object[] {new Long(
+ report.getNumberOfProcessInstancesHavingCrashedActivities())}));
+ print(MessageFormat.format(" .. crashed activity threads:\t{0}", new Object[] {new Long(
+ report.getNumberOfProcessInstancesHavingCrashedThreads())}));
+ }
+ else
+ {
+ print("List of process instances oids likely to have ..");
+ print(MessageFormat.format(" .. pending process completion:\t{0}",
+ getOids(report.getProcessInstancesLackingCompletion())));
+ print(MessageFormat.format(" .. pending process abortion:\t{0}", getOids(
+ report.getProcessInstancesLackingAbortion())));
+ print(MessageFormat.format(" .. pending activity abortion:\t{0}", getOids(
+ report.getActivityInstancesLackingAbortion())));
+ print(MessageFormat.format(" .. crashed activity instances:\t{0}", getOids(
+ report.getProcessInstancesHavingCrashedActivities())));
+ print(MessageFormat.format(" .. crashed activity threads:\t{0}", getOids(
+ report.getProcessInstancesHavingCrashedThreads())));
+ }
print("");
}
@@ -136,6 +159,21 @@ public class DashboardCommand extends ConsoleCommand
return 0;
}
+ private String getOids(Set<Long> oidSet)
+ {
+ StringBuilder oids = new StringBuilder();
+ for (Iterator iterator = oidSet.iterator(); iterator.hasNext();)
+ {
+ Long oid = (Long) iterator.next();
+ oids.append(oid);
+ if (iterator.hasNext())
+ {
+ oids.append(", ");
+ }
+ }
+ return oidSet.isEmpty() ? "none" : oids.toString();
+ }
+
public String getSummary()
{
return "Retrieves health and performance indicators from a runtime\n"
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/AdministrationServiceImpl.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/AdministrationServiceImpl.java
index 11317ed..2541452 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/AdministrationServiceImpl.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/AdministrationServiceImpl.java
@@ -15,7 +15,6 @@ import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.sql.Statement;
import java.text.MessageFormat;
import java.util.*;
@@ -646,196 +645,12 @@ public class AdministrationServiceImpl
public AuditTrailHealthReport getAuditTrailHealthReport()
{
- Session session = (Session) SessionFactory.getSession(SessionFactory.AUDIT_TRAIL);
-
- final String schemaPrefix = StringUtils.isEmpty(session.getSchemaName())
- ? ""
- : session.getSchemaName() + ".";
-
- long nPendingPiCompletes = 0;
- long nPendingPiAborts = 0;
- long nPendingAiAborts = 0;
- long nPisHavingCrashedAis = 0;
- long nPisHavingCrashedThreads = 0;
- long nPisHavingCrashedEventBindings = 0;
-
- Statement stmt = null;
- try
- {
- stmt = session.getConnection().createStatement();
- ResultSet rs = null;
- try
- {
- nPisHavingCrashedEventBindings = EventUtils.countDeactiveEventBindings();
-
- rs = stmt.executeQuery(
- "SELECT COUNT(pi." + ProcessInstanceBean.FIELD__OID + ")"
- + " FROM " + schemaPrefix + ProcessInstanceBean.TABLE_NAME + " pi"
- + " WHERE pi." + ProcessInstanceBean.FIELD__STATE + " NOT IN (" + ProcessInstanceState.COMPLETED + ", " + ProcessInstanceState.ABORTED + ", " + ProcessInstanceState.ABORTING + ")"
- + " AND NOT EXISTS ("
- + " SELECT tk." + TransitionTokenBean.FIELD__PROCESS_INSTANCE
- + " FROM " + schemaPrefix + TransitionTokenBean.TABLE_NAME + " tk"
- + " WHERE tk." + TransitionTokenBean.FIELD__PROCESS_INSTANCE + " = pi." + ProcessInstanceBean.FIELD__OID
- + " AND tk." + TransitionTokenBean.FIELD__IS_CONSUMED + " = 0"
- + " )");
-
- if (rs.next())
- {
- nPendingPiCompletes = rs.getLong(1);
- }
- QueryUtils.closeResultSet(rs);
-
- rs = stmt.executeQuery(
- "SELECT COUNT(pi." + ProcessInstanceBean.FIELD__OID + ")"
- + " FROM " + schemaPrefix + ProcessInstanceBean.TABLE_NAME + " pi"
- + " WHERE pi." + ProcessInstanceBean.FIELD__STATE + " = " + ProcessInstanceState.ABORTING);
-
- if (rs.next())
- {
- nPendingPiAborts = rs.getLong(1);
- }
- QueryUtils.closeResultSet(rs);
-
- rs = stmt.executeQuery(
- "SELECT COUNT(ai." + ActivityInstanceBean.FIELD__OID + ")"
- + " FROM " + schemaPrefix + ActivityInstanceBean.TABLE_NAME + " ai"
- + " WHERE ai." + ActivityInstanceBean.FIELD__STATE + " = " + ActivityInstanceState.ABORTING);
-
- if (rs.next())
- {
- nPendingAiAborts = rs.getLong(1);
- }
- QueryUtils.closeResultSet(rs);
-
- rs = stmt.executeQuery(
- "SELECT COUNT(pi." + ProcessInstanceBean.FIELD__OID + ")"
- + " FROM " + schemaPrefix + ProcessInstanceBean.TABLE_NAME + " pi"
- + " WHERE pi." + ProcessInstanceBean.FIELD__STATE + " NOT IN (" + ProcessInstanceState.COMPLETED + ", " + ProcessInstanceState.ABORTED + ")"
- + " AND EXISTS ("
- + " SELECT tk." + TransitionTokenBean.FIELD__PROCESS_INSTANCE
- + " FROM " + schemaPrefix + TransitionTokenBean.TABLE_NAME + " tk,"
- + " " + schemaPrefix + ActivityInstanceBean.TABLE_NAME + " ai"
- + " WHERE tk." + TransitionTokenBean.FIELD__PROCESS_INSTANCE + " = pi." + ProcessInstanceBean.FIELD__OID
- + " AND tk." + TransitionTokenBean.FIELD__IS_CONSUMED + " = 0"
- + " AND tk." + TransitionTokenBean.FIELD__TARGET + " = ai." + ActivityInstanceBean.FIELD__OID
- + " AND ai." + ActivityInstanceBean.FIELD__STATE + " IN (" + ActivityInstanceState.CREATED + ", " + ActivityInstanceState.INTERRUPTED + ")"
- + ")");
- if (rs.next())
- {
- nPisHavingCrashedAis = rs.getLong(1);
- }
- QueryUtils.closeResultSet(rs);
-
- nPisHavingCrashedThreads = 0;
- rs = stmt.executeQuery(
- "SELECT pi." + ProcessInstanceBean.FIELD__OID + ", tk." + TransitionTokenBean.FIELD__TRANSITION + ", tk." + TransitionTokenBean.FIELD__MODEL
- + " FROM " + schemaPrefix + ProcessInstanceBean.TABLE_NAME + " pi, "+ schemaPrefix + TransitionTokenBean.TABLE_NAME + " tk"
- + " WHERE pi." + ProcessInstanceBean.FIELD__STATE + " NOT IN (" + ProcessInstanceState.COMPLETED + ", " + ProcessInstanceState.ABORTED + ")"
- + " AND tk." + TransitionTokenBean.FIELD__PROCESS_INSTANCE + " = pi." + ProcessInstanceBean.FIELD__OID
- + " AND tk." + TransitionTokenBean.FIELD__TARGET + " = 0"
- );
- HashMap<Long, Set<Long>> zeroTargetTokensPerProcessInstance = new HashMap<Long, Set<Long>>();
- HashMap<Long,Long> transitionOidToModel = new HashMap<Long,Long>();
- Set<Long> involvedTransitionOids = new HashSet<Long>();
- while (rs.next())
- {
- Long oid = rs.getLong(1);
- Long transitionOid = rs.getLong(2);
- Long modelOid = rs.getLong(3);
-
- involvedTransitionOids.add(transitionOid);
- transitionOidToModel.put(transitionOid, modelOid);
-
- Set<Long> transitionOids = zeroTargetTokensPerProcessInstance.get(oid);
- if (transitionOids == null)
- {
- transitionOids = new HashSet<Long>();
- }
- transitionOids.add(transitionOid);
- zeroTargetTokensPerProcessInstance.put(oid, transitionOids);
- }
- QueryUtils.closeResultSet(rs);
-
- // Retrieve targetActivityOid from transitionOid.
- Map<Long, Long> targetActivityOidPerTransitionOid = new HashMap<Long,Long>();
- for (Long transitionOid : involvedTransitionOids)
- {
- AuditTrailTransitionBean transition = AuditTrailTransitionBean.findByOid(
- transitionOid, transitionOidToModel.get(transitionOid));
- if (transition != null)
- {
- targetActivityOidPerTransitionOid.put(transitionOid,
- transition.getTargetActivity());
- }
- }
-
- // Retrieve count of all source activities of a target activity.
- Map<Long, Long> countOfTransitionSourcesPerTargetActivity = new HashMap<Long,Long>();
- for (Long targetActivityOid : targetActivityOidPerTransitionOid.values())
- {
- rs = stmt.executeQuery(
- "SELECT COUNT(tr." + AuditTrailTransitionBean.FIELD__OID + ")"
- + " FROM " + schemaPrefix + AuditTrailTransitionBean.TABLE_NAME + " tr"
- + " WHERE tr." + AuditTrailTransitionBean.FIELD__TGT_ACTIVITY + " = " + targetActivityOid
- );
-
- if (rs.next())
- {
- long transitionCount = rs.getLong(1);
-
- countOfTransitionSourcesPerTargetActivity.put(targetActivityOid,
- transitionCount);
- }
- }
- QueryUtils.closeResultSet(rs);
-
- // Iterate over all existing trans_token entries having '0' targetActivityInstance to see if ALL source activities are contained.
- Set<Long> crashedPIs = new HashSet<Long>();
- for (Map.Entry<Long, Set<Long>> entry : zeroTargetTokensPerProcessInstance.entrySet())
- {
- Set<Long> transitionOids = entry.getValue();
-
- Map<Long, Long> countOfInvolvedActivityOids = new HashMap<Long,Long>();
- for (Long transitionOid : transitionOids)
- {
- Long activityOid = targetActivityOidPerTransitionOid.get(transitionOid);
- Long count = countOfInvolvedActivityOids.get(activityOid);
- if (count == null)
- {
- count = Long.valueOf(0);
- }
- count++;
- countOfInvolvedActivityOids.put(activityOid, count);
- }
-
- for (Map.Entry<Long,Long> entry2 : countOfInvolvedActivityOids.entrySet())
- {
- // Only crashed candidate if trans_token targetActivityInstanceOids of ALL source activities are '0'
- if (countOfTransitionSourcesPerTargetActivity.get(entry2.getKey()) == entry2.getValue())
- {
- crashedPIs.add(entry.getKey());
- }
- }
- }
- nPisHavingCrashedThreads = crashedPIs.size();
- }
- finally
- {
- QueryUtils.closeResultSet(rs);
- }
- }
- catch (SQLException e)
- {
- throw new PublicException("Failed evaluating recovery status.", e);
- }
- finally
- {
- QueryUtils.closeStatement(stmt);
- }
+ return getAuditTrailHealthReport(true);
+ }
- return new AuditTrailHealthReport(nPendingPiCompletes, nPendingPiAborts,
- nPendingAiAborts, nPisHavingCrashedAis, nPisHavingCrashedThreads,
- nPisHavingCrashedEventBindings);
+ public AuditTrailHealthReport getAuditTrailHealthReport(boolean countOnly)
+ {
+ return AuditTrailHealthReportGenerator.getReport(countOnly);
}
public void recoverRuntimeEnvironment()
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/EventUtils.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/EventUtils.java
index d0c1efa..7390db6 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/EventUtils.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/EventUtils.java
@@ -713,6 +713,12 @@ public class EventUtils
public static long countDeactiveEventBindings()
{
+ Set processes = getDeactiveEventBindings();
+ return processes.size();
+ }
+
+ public static Set getDeactiveEventBindings()
+ {
// get all from event binding where type > DEACTIVE_TYPE
ResultIterator iterator = SessionFactory.getSession(SessionFactory.AUDIT_TRAIL).getIterator(
EventBindingBean.class, //
@@ -733,6 +739,6 @@ public class EventUtils
}
processes.add(objectOID);
}
- return processes.size();
+ return processes;
}
} \ No newline at end of file