当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionState类代码示例

本文整理汇总了Java中com.sun.tools.jconsole.JConsoleContext.ConnectionState的典型用法代码示例。如果您正苦于以下问题:Java ConnectionState类的具体用法?Java ConnectionState怎么用?Java ConnectionState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConnectionState类属于com.sun.tools.jconsole.JConsoleContext包,在下文中一共展示了ConnectionState类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: propertyChange

import com.sun.tools.jconsole.JConsoleContext.ConnectionState; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent ev) {
    String prop = ev.getPropertyName();
    if (JConsoleContext.CONNECTION_STATE_PROPERTY.equals(prop)) {
        ConnectionState newState = (ConnectionState)ev.getNewValue();
        
        /* 
           JConsole supports disconnection and reconnection
           The MBeanServerConnection will become invalid when
           disconnected. Need to use the new MBeanServerConnection object
           created at reconnection time. 
         */
        if (newState == ConnectionState.CONNECTED && tda != null) {
            mBeanDumper.setMBeanServerConnection(getContext().getMBeanServerConnection());
        }
    }
}
 
开发者ID:irockel,项目名称:tda,代码行数:17,代码来源:TDAPlugin.java

示例2: disconnect

import com.sun.tools.jconsole.JConsoleContext.ConnectionState; //导入依赖的package包/类
public void disconnect() {
    // Reset remote stub
    stub = null;
    // Close MBeanServer connection
    if (jmxc != null) {
        try {
            jmxc.close();
        } catch (IOException e) {
            // Ignore ???
        }
    }
    // Reset platform MBean references
    classLoadingMBean = null;
    compilationMBean = null;
    memoryMBean = null;
    operatingSystemMBean = null;
    runtimeMBean = null;
    threadMBean = null;
    sunOperatingSystemMXBean = null;
    garbageCollectorMBeans = null;
    // Set connection state to DISCONNECTED
    if (!isDead) {
        isDead = true;
        setConnectionState(ConnectionState.DISCONNECTED);
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:27,代码来源:ProxyClient.java

示例3: propertyChange

import com.sun.tools.jconsole.JConsoleContext.ConnectionState; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent ev) {
    String prop = ev.getPropertyName();
    if (prop == JConsoleContext.CONNECTION_STATE_PROPERTY) {
        ConnectionState newState = (ConnectionState)ev.getNewValue();
        // JConsole supports disconnection and reconnection
        // The MBeanServerConnection will become invalid when
        // disconnected. Need to use the new MBeanServerConnection object
        // created at reconnection time.
        if (newState == ConnectionState.CONNECTED && jtop != null) {
            jtop.setMBeanServerConnection(
                getContext().getMBeanServerConnection());
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:JTopPlugin.java

示例4: connect

import com.sun.tools.jconsole.JConsoleContext.ConnectionState; //导入依赖的package包/类
void connect() {
    setConnectionState(ConnectionState.CONNECTING);
    try {
        tryConnect();
        setConnectionState(ConnectionState.CONNECTED);
    } catch (Exception e) {
        if (JConsole.isDebug()) {
            e.printStackTrace();
        }
        setConnectionState(ConnectionState.DISCONNECTED);
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:13,代码来源:ProxyClient.java

示例5: setConnectionState

import com.sun.tools.jconsole.JConsoleContext.ConnectionState; //导入依赖的package包/类
private void setConnectionState(ConnectionState state) {
    ConnectionState oldState = this.connectionState;
    this.connectionState = state;
    propertyChangeSupport.firePropertyChange(CONNECTION_STATE_PROPERTY,
                                             oldState, state);
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:7,代码来源:ProxyClient.java

示例6: getConnectionState

import com.sun.tools.jconsole.JConsoleContext.ConnectionState; //导入依赖的package包/类
public ConnectionState getConnectionState() {
    return this.connectionState;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:4,代码来源:ProxyClient.java

示例7: connect

import com.sun.tools.jconsole.JConsoleContext.ConnectionState; //导入依赖的package包/类
private void connect() throws Exception {
    JConsoleContext jcCtx = this.getContext();
    MBeanServerConnection mbeanServerConn = jcCtx.getMBeanServerConnection();

    if (mbeanServerConn instanceof RemotingMBeanServerConnection) {
        final CommandContext cmdCtx
                = CommandContextFactory.getInstance().newCommandContext();
        if (connectUsingRemoting(cmdCtx,
                (RemotingMBeanServerConnection) mbeanServerConn)) {
            // Set a listener for connection state change.
            jcCtx.addPropertyChangeListener((PropertyChangeEvent evt) -> {
                log.tracef("Received property change %s value %s",
                        evt.getPropertyName(), evt.getNewValue());
                if (JConsoleContext.CONNECTION_STATE_PROPERTY.equals(evt.getPropertyName())) {
                    ConnectionState state = (ConnectionState) evt.getNewValue();
                    if (state == ConnectionState.CONNECTED) {
                        try {
                            // Rebuild the ModelControllerClient
                            RemotingMBeanServerConnection rmbsc
                                    = (RemotingMBeanServerConnection) getContext().getMBeanServerConnection();
                            connectUsingRemoting(cmdCtx, rmbsc);
                            connectedClient = cmdCtx.getModelControllerClient();
                            isConnected = true;
                        } catch (Exception ex) {
                            log.error(null, ex);
                        }
                    } else {
                        isConnected = false;
                    }
                }
            });
            connectedClient = cmdCtx.getModelControllerClient();
            Supplier<ModelControllerClient> client = () -> {
                return connectedClient;
            };
            init(cmdCtx, client);
        } else {
             JOptionPane.showInternalMessageDialog(jconsolePanel, MSG_CANNOT_ESTABLISH_CONNECTION);
        }
    } else {
        //show dialog
        dialog.start();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:45,代码来源:JConsoleCLIPlugin.java


注:本文中的com.sun.tools.jconsole.JConsoleContext.ConnectionState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。