<%
final String threads = request.getParameter("threads");
final String period = request.getParameter("period");
try {
for (int t = 0; t < Integer.parseInt(threads); t++ ) {
System.out.println("starting thread " + t + " of " + threads);
Thread thread = new Thread(new Runnable() {
public void run() {
try {
System.out.println("started with period " + period);
Thread.sleep(Integer.parseInt(period) * 1000);
}
catch (Throwable t) {
t.printStackTrace();
}
}
});
thread.start();
};
}
catch (Throwable t) {
t.printStackTrace();
}
%>
and you invoke it as
http://acme.com:10001/wlstuck/index.jsp?threads=30&period=40
and you redeploy with
import os
theapplication=str(sys.argv[1])
print "redeploying", theapplication
os.system("rm -rf /opt/oracle/domains/osbts1do/servers/osbts1as/tmp/_WL_user/" + theapplication + "/")
connect('Pierluigi', 'weblogic1', 't3://acme.com:9001')
redeploy(theapplication)
exit()
problem is that these threads will not be part of the WebLogic thread pool, and as such they will not be monitored.
A better option is a shell script:
for i in {1..30}
do
wget http://acme.com:10001//wlstuck &
done
and the index.jst is simply:
Thread.sleep(390 * 1000);