java.rmi.server.ExportException Java Examples
The following examples show how to use
java.rmi.server.ExportException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UnicastServerRef.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #2
Source File: UnicastServerRef.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #3
Source File: UnicastServerRef.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #4
Source File: UnicastServerRef.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #5
Source File: UnicastServerRef.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #6
Source File: UnicastServerRef.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #7
Source File: UnicastServerRef.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #8
Source File: UnicastServerRef.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #9
Source File: UnicastServerRef.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #10
Source File: UnicastServerRef.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #11
Source File: UnicastServerRef.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #12
Source File: UnicastServerRef.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #13
Source File: UnicastServerRef.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Export this object, create the skeleton and stubs for this * dispatcher. Create a stub based on the type of the impl, * initialize it with the appropriate remote reference. Create the * target defined by the impl, dispatcher (this) and stub. * Export that target via the Ref. */ public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException { Class<?> implClass = impl.getClass(); Remote stub; try { stub = Util.createProxy(implClass, getClientRef(), forceStubUse); } catch (IllegalArgumentException e) { throw new ExportException( "remote object implements illegal remote interface", e); } if (stub instanceof RemoteStub) { setSkeleton(impl); } Target target = new Target(impl, this, stub, ref.getObjID(), permanent); ref.exportObject(target); hashToMethod_Map = hashToMethod_Maps.get(implClass); return stub; }
Example #14
Source File: Server.java From hottub with GNU General Public License v2.0 | 5 votes |
public static String start() throws Exception { int serverPort = 12345; ObjectName name = new ObjectName("test", "foo", "bar"); MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); SteMBean bean = new Ste(); jmxServer.registerMBean(bean, name); boolean exported = false; Random rnd = new Random(System.currentTimeMillis()); do { try { LocateRegistry.createRegistry(serverPort); exported = true; } catch (ExportException ee) { if (ee.getCause() instanceof BindException) { serverPort = rnd.nextInt(10000) + 4096; } else { throw ee; } } } while (!exported); JMXServiceURL serverUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + serverPort + "/test"); JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serverUrl, null, jmxServer); jmxConnector.start(); return serverUrl.toString(); }
Example #15
Source File: ObjectTable.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Add target to object table. If it is not a permanent entry, then * make sure that reaper thread is running to remove collected entries * and keep VM alive. */ static void putTarget(Target target) throws ExportException { ObjectEndpoint oe = target.getObjectEndpoint(); WeakRef weakImpl = target.getWeakImpl(); if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) { DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe); } synchronized (tableLock) { /** * Do nothing if impl has already been collected (see 6597112). Check while * holding tableLock to ensure that Reaper cannot process weakImpl in between * null check and put/increment effects. */ if (target.getImpl() != null) { if (objTable.containsKey(oe)) { throw new ExportException( "internal error: ObjID already in use"); } else if (implTable.containsKey(weakImpl)) { throw new ExportException("object already exported"); } objTable.put(oe, target); implTable.put(weakImpl, target); if (!target.isPermanent()) { incrementKeepAliveCount(); } } } }
Example #16
Source File: ObjectTable.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Add target to object table. If it is not a permanent entry, then * make sure that reaper thread is running to remove collected entries * and keep VM alive. */ static void putTarget(Target target) throws ExportException { ObjectEndpoint oe = target.getObjectEndpoint(); WeakRef weakImpl = target.getWeakImpl(); if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) { DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe); } synchronized (tableLock) { /** * Do nothing if impl has already been collected (see 6597112). Check while * holding tableLock to ensure that Reaper cannot process weakImpl in between * null check and put/increment effects. */ if (target.getImpl() != null) { if (objTable.containsKey(oe)) { throw new ExportException( "internal error: ObjID already in use"); } else if (implTable.containsKey(weakImpl)) { throw new ExportException("object already exported"); } objTable.put(oe, target); implTable.put(weakImpl, target); if (!target.isPermanent()) { incrementKeepAliveCount(); } } } }
Example #17
Source File: Server.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static String start() throws Exception { int serverPort = 12345; ObjectName name = new ObjectName("test", "foo", "bar"); MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); SteMBean bean = new Ste(); jmxServer.registerMBean(bean, name); boolean exported = false; Random rnd = new Random(System.currentTimeMillis()); do { try { LocateRegistry.createRegistry(serverPort); exported = true; } catch (ExportException ee) { if (ee.getCause() instanceof BindException) { serverPort = rnd.nextInt(10000) + 4096; } else { throw ee; } } } while (!exported); JMXServiceURL serverUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + serverPort + "/test"); JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serverUrl, null, jmxServer); jmxConnector.start(); return serverUrl.toString(); }
Example #18
Source File: ObjectTable.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Add target to object table. If it is not a permanent entry, then * make sure that reaper thread is running to remove collected entries * and keep VM alive. */ static void putTarget(Target target) throws ExportException { ObjectEndpoint oe = target.getObjectEndpoint(); WeakRef weakImpl = target.getWeakImpl(); if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) { DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe); } synchronized (tableLock) { /** * Do nothing if impl has already been collected (see 6597112). Check while * holding tableLock to ensure that Reaper cannot process weakImpl in between * null check and put/increment effects. */ if (target.getImpl() != null) { if (objTable.containsKey(oe)) { throw new ExportException( "internal error: ObjID already in use"); } else if (implTable.containsKey(weakImpl)) { throw new ExportException("object already exported"); } objTable.put(oe, target); implTable.put(weakImpl, target); if (!target.isPermanent()) { incrementKeepAliveCount(); } } } }
Example #19
Source File: Server.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static String start() throws Exception { int serverPort = 12345; ObjectName name = new ObjectName("test", "foo", "bar"); MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); SteMBean bean = new Ste(); jmxServer.registerMBean(bean, name); boolean exported = false; Random rnd = new Random(System.currentTimeMillis()); do { try { LocateRegistry.createRegistry(serverPort); exported = true; } catch (ExportException ee) { if (ee.getCause() instanceof BindException) { serverPort = rnd.nextInt(10000) + 4096; } else { throw ee; } } } while (!exported); JMXServiceURL serverUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + serverPort + "/test"); JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serverUrl, null, jmxServer); jmxConnector.start(); return serverUrl.toString(); }
Example #20
Source File: Server.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static String start() throws Exception { int serverPort = 12345; ObjectName name = new ObjectName("test", "foo", "bar"); MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); SteMBean bean = new Ste(); jmxServer.registerMBean(bean, name); boolean exported = false; Random rnd = new Random(System.currentTimeMillis()); do { try { LocateRegistry.createRegistry(serverPort); exported = true; } catch (ExportException ee) { if (ee.getCause() instanceof BindException) { serverPort = rnd.nextInt(10000) + 4096; } else { throw ee; } } } while (!exported); JMXServiceURL serverUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + serverPort + "/test"); JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serverUrl, null, jmxServer); jmxConnector.start(); return serverUrl.toString(); }
Example #21
Source File: ObjectTable.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Add target to object table. If it is not a permanent entry, then * make sure that reaper thread is running to remove collected entries * and keep VM alive. */ static void putTarget(Target target) throws ExportException { ObjectEndpoint oe = target.getObjectEndpoint(); WeakRef weakImpl = target.getWeakImpl(); if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) { DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe); } synchronized (tableLock) { /** * Do nothing if impl has already been collected (see 6597112). Check while * holding tableLock to ensure that Reaper cannot process weakImpl in between * null check and put/increment effects. */ if (target.getImpl() != null) { if (objTable.containsKey(oe)) { throw new ExportException( "internal error: ObjID already in use"); } else if (implTable.containsKey(weakImpl)) { throw new ExportException("object already exported"); } objTable.put(oe, target); implTable.put(weakImpl, target); if (!target.isPermanent()) { incrementKeepAliveCount(); } } } }
Example #22
Source File: Server.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static String start() throws Exception { int serverPort = 12345; ObjectName name = new ObjectName("test", "foo", "bar"); MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); SteMBean bean = new Ste(); jmxServer.registerMBean(bean, name); boolean exported = false; Random rnd = new Random(System.currentTimeMillis()); do { try { LocateRegistry.createRegistry(serverPort); exported = true; } catch (ExportException ee) { if (ee.getCause() instanceof BindException) { serverPort = rnd.nextInt(10000) + 4096; } else { throw ee; } } } while (!exported); JMXServiceURL serverUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + serverPort + "/test"); JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serverUrl, null, jmxServer); jmxConnector.start(); return serverUrl.toString(); }
Example #23
Source File: ObjectTable.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Add target to object table. If it is not a permanent entry, then * make sure that reaper thread is running to remove collected entries * and keep VM alive. */ static void putTarget(Target target) throws ExportException { ObjectEndpoint oe = target.getObjectEndpoint(); WeakRef weakImpl = target.getWeakImpl(); if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) { DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe); } synchronized (tableLock) { /** * Do nothing if impl has already been collected (see 6597112). Check while * holding tableLock to ensure that Reaper cannot process weakImpl in between * null check and put/increment effects. */ if (target.getImpl() != null) { if (objTable.containsKey(oe)) { throw new ExportException( "internal error: ObjID already in use"); } else if (implTable.containsKey(weakImpl)) { throw new ExportException("object already exported"); } objTable.put(oe, target); implTable.put(weakImpl, target); if (!target.isPermanent()) { incrementKeepAliveCount(); } } } }
Example #24
Source File: Server.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static String start() throws Exception { int serverPort = 12345; ObjectName name = new ObjectName("test", "foo", "bar"); MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); SteMBean bean = new Ste(); jmxServer.registerMBean(bean, name); boolean exported = false; Random rnd = new Random(System.currentTimeMillis()); do { try { LocateRegistry.createRegistry(serverPort); exported = true; } catch (ExportException ee) { if (ee.getCause() instanceof BindException) { serverPort = rnd.nextInt(10000) + 4096; } else { throw ee; } } } while (!exported); JMXServiceURL serverUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + serverPort + "/test"); JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serverUrl, null, jmxServer); jmxConnector.start(); return serverUrl.toString(); }
Example #25
Source File: ObjectTable.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Add target to object table. If it is not a permanent entry, then * make sure that reaper thread is running to remove collected entries * and keep VM alive. */ static void putTarget(Target target) throws ExportException { ObjectEndpoint oe = target.getObjectEndpoint(); WeakRef weakImpl = target.getWeakImpl(); if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) { DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe); } synchronized (tableLock) { /** * Do nothing if impl has already been collected (see 6597112). Check while * holding tableLock to ensure that Reaper cannot process weakImpl in between * null check and put/increment effects. */ if (target.getImpl() != null) { if (objTable.containsKey(oe)) { throw new ExportException( "internal error: ObjID already in use"); } else if (implTable.containsKey(weakImpl)) { throw new ExportException("object already exported"); } objTable.put(oe, target); implTable.put(weakImpl, target); if (!target.isPermanent()) { incrementKeepAliveCount(); } } } }
Example #26
Source File: Server.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static String start() throws Exception { int serverPort = 12345; ObjectName name = new ObjectName("test", "foo", "bar"); MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); SteMBean bean = new Ste(); jmxServer.registerMBean(bean, name); boolean exported = false; Random rnd = new Random(System.currentTimeMillis()); do { try { LocateRegistry.createRegistry(serverPort); exported = true; } catch (ExportException ee) { if (ee.getCause() instanceof BindException) { serverPort = rnd.nextInt(10000) + 4096; } else { throw ee; } } } while (!exported); JMXServiceURL serverUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + serverPort + "/test"); JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serverUrl, null, jmxServer); jmxConnector.start(); return serverUrl.toString(); }
Example #27
Source File: ObjectTable.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Add target to object table. If it is not a permanent entry, then * make sure that reaper thread is running to remove collected entries * and keep VM alive. */ static void putTarget(Target target) throws ExportException { ObjectEndpoint oe = target.getObjectEndpoint(); WeakRef weakImpl = target.getWeakImpl(); if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) { DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe); } synchronized (tableLock) { /** * Do nothing if impl has already been collected (see 6597112). Check while * holding tableLock to ensure that Reaper cannot process weakImpl in between * null check and put/increment effects. */ if (target.getImpl() != null) { if (objTable.containsKey(oe)) { throw new ExportException( "internal error: ObjID already in use"); } else if (implTable.containsKey(weakImpl)) { throw new ExportException("object already exported"); } objTable.put(oe, target); implTable.put(weakImpl, target); if (!target.isPermanent()) { incrementKeepAliveCount(); } } } }
Example #28
Source File: Server.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static String start() throws Exception { int serverPort = 12345; ObjectName name = new ObjectName("test", "foo", "bar"); MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); SteMBean bean = new Ste(); jmxServer.registerMBean(bean, name); boolean exported = false; Random rnd = new Random(System.currentTimeMillis()); do { try { LocateRegistry.createRegistry(serverPort); exported = true; } catch (ExportException ee) { if (ee.getCause() instanceof BindException) { serverPort = rnd.nextInt(10000) + 4096; } else { throw ee; } } } while (!exported); JMXServiceURL serverUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + serverPort + "/test"); JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serverUrl, null, jmxServer); jmxConnector.start(); return serverUrl.toString(); }
Example #29
Source File: ObjectTable.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Add target to object table. If it is not a permanent entry, then * make sure that reaper thread is running to remove collected entries * and keep VM alive. */ static void putTarget(Target target) throws ExportException { ObjectEndpoint oe = target.getObjectEndpoint(); WeakRef weakImpl = target.getWeakImpl(); if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) { DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe); } synchronized (tableLock) { /** * Do nothing if impl has already been collected (see 6597112). Check while * holding tableLock to ensure that Reaper cannot process weakImpl in between * null check and put/increment effects. */ if (target.getImpl() != null) { if (objTable.containsKey(oe)) { throw new ExportException( "internal error: ObjID already in use"); } else if (implTable.containsKey(weakImpl)) { throw new ExportException("object already exported"); } objTable.put(oe, target); implTable.put(weakImpl, target); if (!target.isPermanent()) { incrementKeepAliveCount(); } } } }
Example #30
Source File: Server.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static String start() throws Exception { int serverPort = 12345; ObjectName name = new ObjectName("test", "foo", "bar"); MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); SteMBean bean = new Ste(); jmxServer.registerMBean(bean, name); boolean exported = false; Random rnd = new Random(System.currentTimeMillis()); do { try { LocateRegistry.createRegistry(serverPort); exported = true; } catch (ExportException ee) { if (ee.getCause() instanceof BindException) { serverPort = rnd.nextInt(10000) + 4096; } else { throw ee; } } } while (!exported); JMXServiceURL serverUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + serverPort + "/test"); JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serverUrl, null, jmxServer); jmxConnector.start(); return serverUrl.toString(); }