IBM Support

JSP to list service steps that have save execution context set

Troubleshooting


Problem

Your services are running slowly and you suspect that save execution context might be the problem. Saving the execution context is expensive. The enclosed JSP shows what you need to change in your services and nested services to turn off save execution context

Resolving The Problem

Create the JSP listed below. Call it findExecution.jsp and place it in your appserver per the instructions included in document 1439685 JSP Page to test and debug access to a datasource. Access as http://yourhost:yourport/teamworks/findExecution.lsw

Enter the name of the parent service you want to investigate. The code in the JSP will walk the dependency tree looking at all services and nested services to list steps within that service that currently have save execution context on.

Note: Coaches can not be turned off and end states have a checkbox, but the checkbox is not used, we do not save execution context on end states.

The code used in this example is internal API's. There is no guarantee that this will work in future releases of teamworks. This was tested this from 6.0.1 to 6.2.1. If you have a large number of nested services, the JSP might take a few minutes to render.

If the JSP fails to complete, try this sql instead:

select process.NAME as processName, item.NAME as itemName, item.TWCOMPONENT_NAME as componentName
from LSW_PROCESS process, LSW_PROCESS_ITEM item
where process.PROCESS_ID = item.PROCESS_ID
and item.SAVE_EXEC_CONTEXT='T'
and ITEM.TWCOMPONENT_NAME != 'Coach'
and ITEM.TWCOMPONENT_NAME != 'ExitPoint'


The reason that exit points and coaches are excluded is ExitPoints do not save execution context, even when it is turned on and
Coaches MUST save execution context, but that is not likely to be what is affecting you.

------cut here-----

<%@page import="java.io.PrintWriter"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.math.BigDecimal"%>
<%@page import="com.lombardisoftware.client.persistence.TWProcess"%>
<%@page import="com.lombardisoftware.core.TeamWorksException"%>
<%@page import="java.util.List"%>
<%@page import="com.lombardisoftware.client.persistence.common.PODependency"%>
<%@page import="com.lombardisoftware.client.persistence.common.DependencyHelper"%>
<%@page import="com.lombardisoftware.server.ejb.persistence.PersistenceServices"%>
<%@page import="com.lombardisoftware.client.delegate.PersistenceServicesDelegateFactory"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.lombardisoftware.client.persistence.TWProcessItem"%>
<%@page import="com.lombardisoftware.server.ejb.persistence.FindByNameFilter"%>
<%!
String serviceName = "SQL Execute Statement";
boolean isChecked = true;

public HashMap<BigDecimal, TWProcess> walkDependencies (BigDecimal processID) throws TeamWorksException {
HashMap<BigDecimal, TWProcess> map = new HashMap<BigDecimal, TWProcess>();
List<PODependency> deps = DependencyHelper.getDependsOn(PersistenceServices.TYPE_TWPROCESS, processID);
for (PODependency dep:deps) {
if (dep.getReferenceType() == PersistenceServices.TYPE_PROCESS_ID) { // the found reference must be a service
if (!map.containsKey(dep.getReferenceId())) { // if we already have this service, don't walk it's tree again
TWProcess process = (TWProcess) PersistenceServicesDelegateFactory.getInstance().newInstance().findByPrimaryKey("TWProcess", dep.getReferenceId());
map.put(dep.getReferenceId(), process);
map.putAll(walkDependencies (dep.getReferenceId()));
}
}
}
return map;
}
public List<TWProcessItem> getProcessItemsWithSaveSet (TWProcess process) {
List<TWProcessItem> list = process.getProcessItems();
ArrayList<TWProcessItem> saveItems = new ArrayList<TWProcessItem>();
for (TWProcessItem item:list) {
if (!item.getTWComponentName().equals("Coach") &amp;&amp; !item.getTWComponentName().equals("ExitPoint")) {
if (item.getSaveExecutionContext()) {
saveItems.add(item);
}
}
}
return saveItems;
}
%>
<%
String req = request.getParameter ("serviceName");
if (req != null) {
serviceName = req;
}
if (request.getParameter("isChecked") == null) {
isChecked = false;
}
else {
isChecked = true;
}

%>
<form method="post" action="<%=request.getRequestURI()%>">
Main Service Name:<input size="40" type="text" value="<%=serviceName%>" name="serviceName"/><br>
<input type="checkbox" <%if (request.getParameter("isChecked") != null) {%>checked<%}%> value="foo" name = "isChecked"/> Hide Services with no "Save Execution Context" Components

<input type="submit" value="submit"/>

</form>

<%
try {
    FindByNameFilter nameFilter = new FindByNameFilter (serviceName);
    List processes = (List) PersistenceServicesDelegateFactory.getInstance().newInstance().findByFilter("TWProcess",nameFilter);
    if (processes.size() != 1) {
        out.println ("Unable to find service named:" + serviceName);
        return;
    }
    TWProcess parent = processes.get(0);
    HashMap map = walkDependencies(parent.getId());
    if (map.size() == 0) {
        out.println ("No service dependencies found for service:" + serviceName);
    }
        
    for (TWProcess process:map.values()) {
        List items = getProcessItemsWithSaveSet(process);
        if (items.size() == 0) {
            if (!isChecked) {
                out.println ("[" + process.getName() + "");
out.println ("\tNo items with changeable save execution contexts");
}
}
else {
out.println ("" + process.getName() + "");
}
for (TWProcessItem item:items) {
out.println ("\t" + item.getName());
}
}

}
catch (Exception e) {
PrintWriter pw = new PrintWriter (out);
%>
There was an getting the dependencies <%=serviceName %><br>
<%
e.printStackTrace (pw);

}
%>
</pre>]

------cut here-----
[{"Product":{"code":"SSFPRP","label":"WebSphere Lombardi Edition"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Java","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"6.2.1;6.2;6.1;6.0.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

483

Document Information

More support for:
WebSphere Lombardi Edition

Software version:
6.2.1, 6.2, 6.1, 6.0.1

Operating system(s):
AIX, HP-UX, Linux, Solaris, Windows

Document number:
139449

Modified date:
15 June 2018

UID

swg21439875

Manage My Notification Subscriptions