int objects = 10000;
if (args[0] != null) {
objects = Integer.parseInt(args[0]);
}
List objs = new LinkedList();
ObjectFactory of = ObjectFactory.getInstance();
long bfree = Runtime.getRuntime().freeMemory();
long btotal = Runtime.getRuntime().totalMemory();
long bmax = Runtime.getRuntime().maxMemory();
System.out.println("Before we create objects:");
System.out.println("------------------------------");
System.out.println("free: " + bfree);
System.out.println("total: " + btotal);
System.out.println("max: " + bmax);
for (int idx = 0; idx < objects; idx++) {
Connector cnn = of.createConnector();
Workers wkrs = of.createWorkers();
for (int idz = 0; idz < 26; idz++) {
Worker wk0 = of.createWorker();
wk0.setCurrentQueryString("/manager/status");
wk0.setCurrentUri("http://localhost/manager/status");
wk0.setMethod("GET");
wk0.setProtocol("http");
wk0.setRemoteAddr("?");
wk0.setRequestBytesReceived(132);
wk0.setRequestBytesSent(18532);
wk0.setStage("K");
wk0.setVirtualHost("?");
wkrs.getWorker().add(wk0);
}
cnn.setWorkers(wkrs);
RequestInfo rqinfo = of.createRequestInfo();
rqinfo.setBytesReceived(0);
rqinfo.setBytesSent(434374);
rqinfo.setErrorCount(10);
rqinfo.setMaxTime(850);
rqinfo.setProcessingTime(2634);
rqinfo.setRequestCount(1002);
cnn.setRequestInfo(rqinfo);
ThreadInfo thinfo = of.createThreadInfo();
thinfo.setCurrentThreadCount(50);
thinfo.setCurrentThreadsBusy(12);
thinfo.setMaxSpareThreads(50);
thinfo.setMaxThreads(150);
thinfo.setMinSpareThreads(10);
cnn.setThreadInfo(thinfo);
Jvm vm = of.createJvm();
Memory mem = of.createMemory();
mem.setFree(77280);
mem.setTotal(134210000);
mem.setMax(134217728);
vm.setMemory(mem);
Status st = of.createStatus();
st.setJvm(vm);
st.getConnector().add(cnn);
MonitorStats mstats = new MonitorStats(Stats.calculateStatus(st), Stats.calculateLoad(st), 0, Stats
.calculateMemoryLoad(st), Stats.calculateThreadLoad(st), "localhost", "8080", "http", System