Here's the code in question...
jboss-service.xml:
hello
no hands
<depends optional-attribute-name="HelloWorld"
proxy-type="attribute">my.hello:service=hw1
HelloWorldMBean.java:
package hello;
import org.jboss.system.ServiceMBean;
public interface HelloWorldMBean extends ServiceMBean {
public void setMessage(String msg);
public void sayHi();
public void setHelloWorld(HelloWorldMBean hello);
public HelloWorldMBean getDirectRef();
public void echo();
}
HelloWorld.java:
package hello;
import org.jboss.system.ServiceMBeanSupport;
public class HelloWorld extends ServiceMBeanSupport implements HelloWorldMBean {
private double r;
private double incr = 1.7d;
private String message;
private HelloWorldMBean hello;
public HelloWorldMBean getDirectRef() {
return this;
}
public void setMessage(String msg) {
message = msg;
}
public void sayHi() {
r += Math.random() / incr;
}
public void setHelloWorld(HelloWorldMBean hello) {
this.hello = hello;
}
public void echo() {
hello.sayHi();
}
protected void startService() {
log.info("Starting " + message);
if (hello != null) {
double t1 = testEcho();
log.info("invoke ms " + t1 / 1000000.0);
}
}
protected void stopService() {
log.info("Stopping " + message);
}
private double testEcho() {
for (int i = 0; i < 50000; i++) {
hello.sayHi();
}
long start = System.currentTimeMillis();
for (int i = 0; i < 1000000; i++) {
hello.sayHi();
}
long elapsed = System.currentTimeMillis() - start;
double rate = (1000000 * 1000.0 / elapsed);
log.info("jmx " + rate);
return elapsed;
}
}
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840688#3840688
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840688
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user