public OMElement sleepOperation(OMElement topParam) {
topParam.build();
topParam.detach();
OMElement param = topParam.getFirstChildWithName(new QName("load"));
String l = param.getText();
long time = Long.parseLong(l);
try {
Thread.sleep(time);
} catch (InterruptedException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
Long c = null;
Object o = serviceContext.getProperty("count");
if (o == null) {
c = new Long(1);
serviceContext.setProperty("count", c);
} else {
c = (Long) o;
c = new Long(c.longValue() + 1);
serviceContext.setProperty("count", c);
}
String cName = "anonymous";
Object cn = serviceContext.getProperty("cName");
if (cn != null) {
cName = (String) cn;
}
String sName = "anonymous";
Object s = System.getProperty("server_name");
if (s != null) {
sName = (String) s;
}
String msg = "Server: " + sName + " processed the request " + c.toString() + " from client: " + cName;
System.out.println(msg);
param.setText(msg);
return topParam;
}
|