[JBoss-user] [Management, JMX/JBoss] - Re: More on thread pool MBean...what am I doing wrong?

2006-05-31 Thread yair.zaslavsky
Ok, I fixed the code

@Service (objectName="trail:service=TestThreadPool")
@Management(TestThreadPool.class)
@Depends ("jboss.system:service=ThreadPool")
public class TestThreadPoolMBean implements TestThreadPool {

static public class MyTask implements Runnable 
{
public void run()
{
try
{
System.out.println("hello world!!");
FileOutputStream fos = new 
FileOutputStream("c:\bla.txt");
fos.write("hello world!".getBytes());
fos.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

ThreadPool pool;
ThreadPoolMBean poolMBean;



 public int add(int a,int b)
 {
return a+b;
 }


public void doSomething() 
{
//pool.run(new MyTask());

pool = poolMBean.getInstance();

if (pool == null)
System.out.println("null thread pool!");
else
pool.run(new MyTask());


}


public void create() throws Exception {
// TODO Auto-generated method stub


//pool = new BasicThreadPool("MyPool");


try
{
  MBeanServer server = MBeanServerLocator.locate();

   poolMBean = (ThreadPoolMBean) MBeanProxyExt.create(
   ThreadPoolMBean.class,
"jboss.system:service=ThreadPool",
server);
   
   if (poolMBean != null)
   System.out.println("succeeded in looking up the thread pool 
mbean");

}
catch (Exception e)
{
e.printStackTrace();
throw e;
}
  
   

}


public void destroy() throws Exception {
// TODO Auto-generated method stub

}


public void stop() throws Exception {
// TODO Auto-generated method stub

}


public void start() throws Exception {
// TODO Auto-generated method stub

}

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

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


---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Management, JMX/JBoss] - Re: More on thread pool MBean...what am I doing wrong?

2006-05-30 Thread yair.zaslavsky
Thank you for the comment,
but besides this, is my code correct?

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

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


---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Management, JMX/JBoss] - Re: More on thread pool MBean...what am I doing wrong?

2006-05-30 Thread [EMAIL PROTECTED]
thread pools are not usable outside of the server jvm. Use an mdb, jms, or ejb3 
asynch extension to run a task on the server.

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

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


---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user