Java Code Examples for com.sun.tools.jconsole.JConsoleContext

Following code examples demonstrate how to use com.sun.tools.jconsole.JConsoleContextfrom java. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.sun.tools.jconsole.JConsoleContextand various code implementation of this class.

  public void propertyChange(PropertyChangeEvent ev) {
    String prop = ev.getPropertyName();
    if (JConsoleContext.CONNECTION_STATE_PROPERTY.equals(prop)) {
      ConnectionState newState = (ConnectionState) ev.getNewValue();

      
      if (newState == ConnectionState.CONNECTED && threadlogic != null) {
        mBeanDumper.setMBeanServerConnection(getContext().getMBeanServerConnection());
      }
    }
  } 


    public void propertyChange(PropertyChangeEvent ev) {
        String prop = ev.getPropertyName();
        if (prop == null ? JConsoleContext.CONNECTION_STATE_PROPERTY == null : prop.equals(JConsoleContext.CONNECTION_STATE_PROPERTY)) {
            ConnectionState oldState = (ConnectionState)ev.getOldValue();
            ConnectionState newState = (ConnectionState)ev.getNewValue();
            if (newState == ConnectionState.CONNECTED && graph != null) {
                graph.setMBeanServerConnection(
                    getContext().getMBeanServerConnection());
            }
        }
    } 

    public void propertyChange(PropertyChangeEvent ev) {
        String prop = ev.getPropertyName();
        if (prop == JConsoleContext.CONNECTION_STATE_PROPERTY) {
            ConnectionState newState = (ConnectionState) ev.getNewValue();
            if (newState == ConnectionState.CONNECTED && stats.size() != 0) {
                for (Stats status : stats) {
                    status.setConnection(
                            getContext().getMBeanServerConnection());
                }
            } else if (newState == ConnectionState.DISCONNECTED &&
                       stats.size() != 0) {
                for (int i = 0; i < stats.size(); i++) {
                    Stats status = stats.remove(i);
                    status.setConnection(null);
                    status = null;
                }
            }
        }
    } 

    public void propertyChange(PropertyChangeEvent ev) {
        String prop = ev.getPropertyName();
        if (prop == JConsoleContext.CONNECTION_STATE_PROPERTY) {
            ConnectionState newState = (ConnectionState)ev.getNewValue();
            if (newState == ConnectionState.CONNECTED && jtop != null) {
                jtop.setMBeanServerConnection(
                    getContext().getMBeanServerConnection());
            }
        }
    } 

   public void propertyChange(PropertyChangeEvent ev) {
       String prop = ev.getPropertyName();
       if (prop == JConsoleContext.CONNECTION_STATE_PROPERTY) {
           ConnectionState newState = (ConnectionState)ev.getNewValue();
           if (newState == ConnectionState.CONNECTED && requestWatcher != null) {
               requestWatcher.setMBeanServerConnection(
                   getContext().getMBeanServerConnection());
           }
       }
   } 

Advertisement
Javadoc
JConsoleContext represents a JConsole connection to a target application.

JConsoleContex

t notifies any PropertyChangeListeners about the {@linkplain #CONNECTION_STATE_PROPERTY ConnectionState property change to ConnectionState#CONNECTED CONNECTED and ConnectionState#DISCONNECTED DISCONNECTED. The JConsoleContext instance will be the source for any generated events. @since 1.6

Read More
Advertisement