本文整理汇总了Java中javax.management.remote.rmi.RMIConnectorServer类的典型用法代码示例。如果您正苦于以下问题:Java RMIConnectorServer类的具体用法?Java RMIConnectorServer怎么用?Java RMIConnectorServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RMIConnectorServer类属于javax.management.remote.rmi包,在下文中一共展示了RMIConnectorServer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import javax.management.remote.rmi.RMIConnectorServer; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();
System.out.println("Creating connectorServer");
connectorServer = new RMIConnectorServer(url, null, impl, mbs);
System.out.println("Starting connectorServer");
connectorServer.start();
System.out.println("Making client");
RMIConnection cc = impl.newClient(null);
System.out.println("Closing client");
cc.close();
if (connectorServer.isActive()) {
System.out.println("Stopping connectorServer");
connectorServer.stop();
}
if (failure == null)
System.out.println("TEST PASSED, no deadlock");
else
System.out.println("TEST FAILED");
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:ConnectorStopDeadlockTest.java
示例2: connect
import javax.management.remote.rmi.RMIConnectorServer; //导入依赖的package包/类
private void connect() throws IOException {
System.out.println(
"JMXConnectorThread: Attempting JMX connection on: "
+ addr + " on port " + jmxPort);
JMXServiceURL url;
try {
url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"
+ addr + ":" + jmxPort + "/jmxrmi");
} catch (MalformedURLException e) {
throw new RuntimeException("Test failed.", e);
}
Map<String, Object> env = new HashMap<>();
if (useSSL) {
SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory();
env.put("com.sun.jndi.rmi.factory.socket", csf);
env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf);
}
// connect and immediately close
JMXConnector c = JMXConnectorFactory.connect(url, env);
c.close();
System.out.println("JMXConnectorThread: connection to JMX worked");
jmxConnectWorked = true;
checkRmiSocket();
latch.countDown(); // signal we are done.
}
开发者ID:campolake,项目名称:openjdk9,代码行数:26,代码来源:JMXAgentInterfaceBinding.java
示例3: init
import javax.management.remote.rmi.RMIConnectorServer; //导入依赖的package包/类
static JmxConnector init(Properties props) throws IOException {
Integer port = Integer.decode(props.getProperty(JMXEndpoint.JMX_RMI_PORT_PROPERTY));
if (!JmxConnectors.isPortAvailable(port))
return null;
String name = "com.devexperts.qd.monitoring:type=RmiServer,port=" + port;
RMIJRMPServerImpl srvImpl = new RMIJRMPServerImpl(port, null, null, null);
RMIConnectorServer rmiServer = new RMIConnectorServer(
new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + port + "/jmxrmi"),
null, srvImpl, ManagementFactory.getPlatformMBeanServer());
ConnectorImpl connector = new ConnectorImpl(name, rmiServer);
if (!JmxConnectors.addConnector(port, connector))
return null; // port is already taken
LocateRegistry.createRegistry(port);
connector.setRegistration(Management.registerMBean(rmiServer, null, name));
rmiServer.start();
QDLog.log.info("RMI management port is " + port);
return connector;
}
开发者ID:Devexperts,项目名称:QD,代码行数:22,代码来源:JmxRmi.java
示例4: maybeInitJmx
import javax.management.remote.rmi.RMIConnectorServer; //导入依赖的package包/类
private void maybeInitJmx()
{
if (System.getProperty("com.sun.management.jmxremote.port") != null)
return;
String jmxPort = System.getProperty("cassandra.jmx.local.port");
if (jmxPort == null)
return;
System.setProperty("java.rmi.server.hostname", InetAddress.getLoopbackAddress().getHostAddress());
RMIServerSocketFactory serverFactory = new RMIServerSocketFactoryImpl();
Map<String, ?> env = Collections.singletonMap(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, serverFactory);
try
{
LocateRegistry.createRegistry(Integer.valueOf(jmxPort), null, serverFactory);
JMXServiceURL url = new JMXServiceURL(String.format("service:jmx:rmi://localhost/jndi/rmi://localhost:%s/jmxrmi", jmxPort));
jmxServer = new RMIConnectorServer(url, env, ManagementFactory.getPlatformMBeanServer());
jmxServer.start();
}
catch (IOException e)
{
exitOrFail(1, e.getMessage(), e.getCause());
}
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:25,代码来源:CassandraDaemon.java
示例5: newJMXConnectorServer
import javax.management.remote.rmi.RMIConnectorServer; //导入依赖的package包/类
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
Map<String,?> environment,
MBeanServer mbeanServer)
throws IOException {
if (!serviceURL.getProtocol().equals("rmi")) {
throw new MalformedURLException("Protocol not rmi: " +
serviceURL.getProtocol());
}
return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:ServerProvider.java
示例6: newJMXConnectorServer
import javax.management.remote.rmi.RMIConnectorServer; //导入依赖的package包/类
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
Map<String,?> environment,
MBeanServer mbeanServer)
throws IOException {
if (!serviceURL.getProtocol().equals("iiop")) {
throw new MalformedURLException("Protocol not iiop: " +
serviceURL.getProtocol());
}
return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:ServerProvider.java
示例7: connect
import javax.management.remote.rmi.RMIConnectorServer; //导入依赖的package包/类
@Override
public @NotNull JMXConnector connect() throws IOException {
final Map<String, Object> environment = environment();
if (ssl) {
environment.put(Context.SECURITY_PROTOCOL, "ssl");
final SslRMIClientSocketFactory clientSocketFactory = new SslRMIClientSocketFactory();
environment.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, clientSocketFactory);
environment.put("com.sun.jndi.rmi.factory.socket", clientSocketFactory);
}
final JMXServiceURL address = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + address() + "/jmxrmi");
return JMXConnectorFactory.connect(address, environment);
}
开发者ID:nolequen,项目名称:jmx-prometheus-exporter,代码行数:13,代码来源:RMIConnector.java
示例8: test
import javax.management.remote.rmi.RMIConnectorServer; //导入依赖的package包/类
private static boolean test(String proto, MBeanServer mbs)
throws Exception {
System.out.println("Testing for proto " + proto);
JMXConnectorServer cs;
JMXServiceURL url = new JMXServiceURL(proto, null, 0);
try {
cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null,
mbs);
} catch (MalformedURLException e) {
System.out.println("System does not recognize URL: " + url +
"; ignoring");
return true;
}
cs.start();
JMXServiceURL addr = cs.getAddress();
JMXServiceURL rmiurl = new JMXServiceURL("rmi", null, 0);
JMXConnector client = JMXConnectorFactory.connect(addr);
MBeanServerConnection mbsc = client.getMBeanServerConnection();
ObjectName on = new ObjectName("x:proto=" + proto + ",ok=yes");
mbsc.createMBean(RMIConnectorServer.class.getName(),
on,
mletName,
new Object[] {rmiurl, null},
new String[] {JMXServiceURL.class.getName(),
Map.class.getName()});
System.out.println("Successfully deserialized with " + proto);
mbsc.unregisterMBean(on);
client.close();
cs.stop();
return true;
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:34,代码来源:TargetMBeanTest.java
示例9: newJMXConnectorServer
import javax.management.remote.rmi.RMIConnectorServer; //导入依赖的package包/类
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL url,
Map<String,?> map,
MBeanServer mbeanServer)
throws IOException {
final String protocol = url.getProtocol();
called = true;
System.out.println("JMXConnectorServerProviderImpl called");
if(protocol.equals("rmi"))
return new RMIConnectorServer(url, map, mbeanServer);
if(protocol.equals("throw-provider-exception"))
throw new JMXProviderException("I have been asked to throw");
throw new IllegalArgumentException("UNKNOWN PROTOCOL");
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:JMXConnectorServerProviderImpl.java
示例10: createJMXConnector
import javax.management.remote.rmi.RMIConnectorServer; //导入依赖的package包/类
private JMXConnector createJMXConnector() throws Exception {
JMXServiceURL url = new JMXServiceURL(this.urlString);
RMIServerSocketFactory ssf = new MX4JServerSocketFactory(
true, true, "any", "any", new LocalLogWriter(LogWriterImpl.FINE_LEVEL), new Properties());
RMIClientSocketFactory csf = new SslRMIClientSocketFactory();
Map env = new HashMap();
env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, ssf);
env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf);
return JMXConnectorFactory.connect(url, env);
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:13,代码来源:AdminDUnitTestCase.java
注:本文中的javax.management.remote.rmi.RMIConnectorServer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论