Search in sources :

Example 1 with SnapshotMBeanServerConnection

use of sun.tools.jconsole.ProxyClient.SnapshotMBeanServerConnection in project jdk8u_jdk by JetBrains.

the class XMBeanAttributes method refreshAttributes.

// refreshAttributes(false) is called by tableChanged().
// in this case we must not call stopCellEditing, because it's already
// been called - e.g.
// lostFocus/mousePressed -> stopCellEditing -> setValueAt -> tableChanged
//                        -> refreshAttributes(false)
//
// Can be called in EDT - as long as the implementation of
// mbeansTab.getCachedMBeanServerConnection() and mbsc.flush() doesn't
// change
//
private void refreshAttributes(final boolean stopCellEditing) {
    SwingWorker<Void, Void> sw = new SwingWorker<Void, Void>() {

        @Override
        protected Void doInBackground() throws Exception {
            SnapshotMBeanServerConnection mbsc = mbeansTab.getSnapshotMBeanServerConnection();
            mbsc.flush();
            return null;
        }

        @Override
        protected void done() {
            try {
                get();
                if (stopCellEditing)
                    stopCellEditing();
                loadAttributes(mbean, mbeanInfo);
            } catch (Exception x) {
                if (JConsole.isDebug()) {
                    x.printStackTrace();
                }
            }
        }
    };
    mbeansTab.workerAdd(sw);
}
Also used : SwingWorker(javax.swing.SwingWorker) SnapshotMBeanServerConnection(sun.tools.jconsole.ProxyClient.SnapshotMBeanServerConnection) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) JMException(javax.management.JMException)

Aggregations

IOException (java.io.IOException)1 ExecutionException (java.util.concurrent.ExecutionException)1 JMException (javax.management.JMException)1 SwingWorker (javax.swing.SwingWorker)1 SnapshotMBeanServerConnection (sun.tools.jconsole.ProxyClient.SnapshotMBeanServerConnection)1