I want blocked exucute some method on my MBean if that method execute allredy. I use 
in my method doOperation 
synchronized(this)
  | {
  |      //some code......
  | }
For example if Client 1 start remote invocation this method, and after some time 
Client2 start remote invocation this method, Client2 will wait until invocation from 
Client1 return result. I write simple MBean for test it.
 
public class MyMbean extends org.jboss.system.ServiceMBeanSupport {
  | 
  |   String name = "simple";
  |   public void start() throws java.lang.Exception {   
  |   }
  | 
  |   public String getName(){
  |     return name;
  |   }
  | 
  |   public void stop() {
  |   }
  | 
  |   public void doOperation(String name,long time){
  |     System.out.println("start operation " + name);
  |     synchronized(this){
  |     try{
  |       Thread.currentThread().sleep(time);
  |     }
  |     catch(Exception e){
  |       e.printStackTrace();
  |     }
  |     this.name = name;
  |     System.out.println("stop operation " + name);
  |   }
  |   }
  | }

This exaple work fine.
Is it right method to solve my problem, or under Jboss i must use another method? 

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3849984#3849984

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3849984


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to