本文整理汇总了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());
}
}
}
示例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);
}
}
示例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());
}
}
}
示例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);
}
}
示例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);
}
示例6: getConnectionState
import com.sun.tools.jconsole.JConsoleContext.ConnectionState; //导入依赖的package包/类
public ConnectionState getConnectionState() {
return this.connectionState;
}
示例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();
}
}