I was thinking of creating a service MBean for monitoring certain parts of the server side of my application. Is it valid behavior of such an MBean to launch a Swing interface, say, in its startService() method (supposing it extends ServiceMBeanSupport)?

 

To find out, I created a simple MBean (see below) but unfortunately it makes JBoss hang when I try to shut down JBoss. I have added and removed the JFrame related code several times, and the result is always the same: With the JFrame code, JBoss hangs when shutting down.

 

Showing the JFrame is no problem – it pops up just like I wanted it.

 

Randahl

 

 

 

 

 

public class Server extends ServiceMBeanSupport implements ServerMBean {

            JFrame serverFrame;

 

            public void startService() {

                        serverFrame = new JFrame("Server");

                        serverFrame.show();

                        System.out.println("Server is started");

            }

           

            public void stopService() {

                        serverFrame.hide();

                        System.out.println("Server is stopped");

            }

}

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE server>

 

<server>

            <mbean code="dk.my.package.tree.Server" name="user:service=Test">

                        <depends>jboss:service=Naming</depends>

            </mbean>

</server>

Reply via email to