The following java program will abort weblogic composites:
-
import java.util.Hashtable;
-
import java.util.List;
-
import java.util.Date;
-
import java.util.Calendar;
-
import javax.naming.Context;
-
import oracle.soa.management.facade.Component;
-
import oracle.soa.management.facade.ComponentInstance;
-
import oracle.soa.management.facade.Composite;
-
import oracle.soa.management.facade.Locator;
-
import oracle.soa.management.facade.LocatorFactory;
-
import oracle.soa.management.util.ComponentInstanceFilter;
-
import oracle.soa.management.util.CompositeInstanceFilter;
-
import oracle.soa.management.facade.CompositeInstance;
-
import oracle.soa.management.CompositeDN;
-
-
public class abort_running {
-
public abort_running() {
-
super();
-
}
-
-
Locator locator = null;
-
//Connection Details to Connect to Server
-
-
-
jndiProps.put("dedicated.connection", "true");
-
-
long num_aborted = 0;
-
long tot_instances = 0;
-
long num_instance = 0;
-
long display_interval = 20;
-
-
try {
-
//Connect to SOA Server
-
locator = LocatorFactory.createLocator(jndiProps);
-
CompositeInstanceFilter filter = new CompositeInstanceFilter();
-
-
-
cal.setTime(start);
-
-
-
//Set Minimum Creation Time
-
filter.setMinCreationDate(start);
-
//Set Maximum Creation Time
-
filter.setMaxCreationDate(end);
-
//Set for RUNNING State
-
filter.setState(0);
-
//For each of the returned composite
-
oracle.soa.management.CompositeDN compositeDN1 = (oracle.soa.management.CompositeDN) RJMOBJ;
-
composite = locator.lookupComposite(compositeDN1);
-
//System.out.println("Outer Loop");
-
//Get composite instances by filter
-
obInstances = composite.getInstances(filter);
-
//for each of the returned composite instances
-
tot_instances = obInstances.size();
-
display_interval = 20;
-
if (tot_instances<10000) display_interval = 20;
-
if (tot_instances<5000) display_interval = 10;
-
if (tot_instances<1000) display_interval = 5;
-
if (tot_instances<100) display_interval = 1;
-
if (tot_instances>0) {
-
System.out.println(" " + compositeDN1.getCompositeName() + " has " + obInstances.size() + " instances");
-
};
-
num_instance = 0;
-
num_instance++;
-
oracle.soa.management.facade.CompositeInstance instance = (oracle.soa.management.facade.CompositeInstance) RJMOBJ2;
-
if ((num_instance % display_interval)==0) {
-
prefix = compositeDN1.getCompositeName() + "(" + num_instance + "/" + tot_instances + ")";
-
System.out.println(prefix + " DN: " + instance.getCompositeDN() + " Instance: " + instance.getId() + " creation-date: " + instance.getCreationDate() + " state (" + instance.getState() + "): " + getStateAsString(instance.getState()));
-
}
-
//Set up a component filter
-
ComponentInstanceFilter cInstanceFilter = new ComponentInstanceFilter();
-
//Get child component instances
-
//For each child component instance
-
/*for (Object RJMOBJ3 : childComponentInstances) {
-
oracle.soa.management.facade.ComponentInstance cInstance = (oracle.soa.management.facade.ComponentInstance) RJMOBJ3;
-
System.out.println(prefix + " -> componentinstance: " + cInstance.getComponentName() + " type: " + cInstance.getServiceEngine().getEngineType() + " state: " +getStateAsString(cInstance.getState()));
-
System.out.println(prefix + " State: "+cInstance.getNormalizedStateAsString());
-
}*/
-
instance.abort();
-
num_aborted++;
-
}
-
obInstances=null;
-
-
} //for
-
-
}
-
-
-
}
-
//Note that this is dependent on whether the composite state is captured or not
-
if (state == CompositeInstance.STATE_COMPLETED_SUCCESSFULLY)
-
return ("success");
-
else if (state == CompositeInstance.STATE_FAULTED)
-
return ("faulted");
-
else if (state == CompositeInstance.STATE_RECOVERY_REQUIRED)
-
return ("recovery required");
-
else if (state == CompositeInstance.STATE_RUNNING)
-
return ("running");
-
else if (state == CompositeInstance.STATE_STALE)
-
return ("stale");
-
else
-
return ("unknown");
-
}
-
-
PROVIDER_URL_ADMIN = "t3://devsoavip1.ad.ic.ac.uk:7001/soa-infra";
-
PROVIDER_URL_SOA1 = "t3://devsoavip2.ad.ic.ac.uk:8001/soa-infra";
-
PROVIDER_URL_SOA2 = "t3://devsoavip3.ad.ic.ac.uk:8001/soa-infra";
-
-
abort_running abortcomposite=new abort_running();
-
abortcomposite.abortRunningComposite(PROVIDER_URL_SOA1);
-
}
-
}
Sql to watch abort process (Run as DSVSOAINFRA)
-
select
-
trunc(created_time), count('x'), min(created_time), max(created_time)
-
from composite_instance
-
where state=0
-
--and trunc(created_time) = trunc(to_date('05-AUG-2015','DD-MON-YYYY'))
-
group by trunc(created_time)
-
order by trunc(created_time)
-
;
RJM Article Type
Work Notes