@Override protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException { final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setRegistryPort(url.getPort()); rmiServiceExporter.setServiceName(url.getPath()); rmiServiceExporter.setServiceInterface(type); rmiServiceExporter.setService(impl); try { rmiServiceExporter.afterPropertiesSet(); } catch (RemoteException e) { throw new RpcException(e.getMessage(), e); } return new Runnable() { @Override public void run() { try { rmiServiceExporter.destroy(); } catch (Throwable e) { logger.warn(e.getMessage(), e); } } }; }
@Override protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException { final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setRegistryPort(url.getPort()); rmiServiceExporter.setServiceName(url.getPath()); rmiServiceExporter.setServiceInterface(type); rmiServiceExporter.setService(impl); try { rmiServiceExporter.afterPropertiesSet(); } catch (RemoteException e) { throw new RpcException(e.getMessage(), e); } return new Runnable() { @Override public void run() { try { rmiServiceExporter.destroy(); } catch (Throwable e) { logger.warn(e.getMessage(), e); } } }; }
@Override protected void onInit() { super.onInit(); if (this.registryHost != null) { this.exporter.setRegistryHost(this.registryHost); } this.exporter.setRegistryPort(this.registryPort); if (this.remoteInvocationExecutor != null) { this.exporter.setRemoteInvocationExecutor(this.remoteInvocationExecutor); } this.exporter.setService(this); this.exporter.setServiceInterface(RequestReplyExchanger.class); this.exporter.setServiceName(SERVICE_NAME_PREFIX + this.requestChannelName); try { this.exporter.afterPropertiesSet(); } catch (RemoteException e) { throw new IllegalStateException(e); } }
@Before public void createExporter() throws RemoteException { RmiServiceExporter exporter = new RmiServiceExporter(); exporter.setService(new TestExchanger()); exporter.setServiceInterface(RequestReplyExchanger.class); exporter.setServiceName("testRemoteHandler"); exporter.setRegistryPort(port); exporter.afterPropertiesSet(); }
@Bean public RmiServiceExporter rmiLabelServiceExporter(LabelRmiService labelRmiService) { //SecurityManager sm = new SecurityManager(); //System.setSecurityManager(sm); System.setProperty("java.rmi.server.codebase","localhost"); RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setService(labelRmiService); rmiServiceExporter.setServiceName("labelRmiService"); rmiServiceExporter.setServiceInterface(LabelRmiService.class); rmiServiceExporter.setRegistryPort(1999); return rmiServiceExporter; } }
public String start(String host, int port) throws RemoteException { String name = inputStream.getClass().getName() + UUID.randomUUID(); rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setServiceName(name); rmiServiceExporter.setRegistryPort(port); rmiServiceExporter.setRegistryHost(host); rmiServiceExporter.setServiceInterface(RemoteInputStreamServer.class); rmiServiceExporter.setService(this); rmiServiceExporter.afterPropertiesSet(); return name; }
@Bean public RmiServiceExporter rmiServiceExporter(final UserService userService) { final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setServiceName("UserService"); rmiServiceExporter.setService(userService); rmiServiceExporter.setServiceInterface(UserService.class); rmiServiceExporter.setRegistryPort(1199); return rmiServiceExporter; }
public String start(String host, int port) throws RemoteException { String name = inputStream.getClass().getName() + UUID.randomUUID(); rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setServiceName(name); rmiServiceExporter.setRegistryPort(port); rmiServiceExporter.setRegistryHost(host); rmiServiceExporter.setServiceInterface(RemoteInputStreamServer.class); rmiServiceExporter.setService(this); rmiServiceExporter.afterPropertiesSet(); return name; }
private RmiServiceExporter createExporter(final Service service, final Class<? extends Service> serviceInterface) { try { RmiServiceExporter serviceExporter; ClassLoader classLoader = service.getClass().getClassLoader(); ClassLoader originalClassLoader = ClassUtils.overrideThreadContextClassLoader(classLoader); try { serviceExporter = new RmiServiceExporter(); } finally { if (originalClassLoader != null) { Thread.currentThread().setContextClassLoader(originalClassLoader); } } serviceExporter.setService(service); serviceExporter.setServiceName(service.getServiceId()); serviceExporter.setServiceInterface(serviceInterface); serviceExporter.setRegistry(registry); serviceExporter.setBeanClassLoader(classLoader); serviceExporter.afterPropertiesSet(); allExporters.add(serviceExporter); logger.debug("created RmiServiceExporter: " + serviceExporter); return serviceExporter; } catch (final Exception e) { logger.error("Unable to create RMI exporter.", e); throw new IllegalStateException("Unable to create RMI exporter.", e); } }
RmiServiceExporter e = new RmiServiceExporter(); e.setServiceName("SCSP"); e.setService(myServiceObj); e.setServiceInterface(example.SCSP.class); e.prepare(); // read the doc; I'm not sure this is the exact method
@Bean public RmiServiceExporter registerService(BarService barService) { RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setServiceName("BarService"); rmiServiceExporter.setService(barService); rmiServiceExporter.setServiceInterface(BarService.class); rmiServiceExporter.setRegistryPort(5000); return rmiServiceExporter; }
RmiServiceExporter exporter = new RmiServiceExporter(); exporter.setService(new ApplicationImpl()); exporter.setServiceInterface(Application.class); exporter.setServiceName("application"); exporter.afterPropertiesSet();
/** * @param name 远程对象名 * @param classz 接口类 * @param springBean springBean对象 * @return */ private RmiServiceExporter registerRmiService(String name, Class classz, Object springBean) { RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setService(springBean); rmiServiceExporter.setServiceName(name); rmiServiceExporter.setServiceInterface(classz); rmiServiceExporter.setRegistryPort(RmiSettingHelper.getMainPort()); return rmiServiceExporter; } }
@Override protected void onInit() { super.onInit(); if (this.registryHost != null) { this.exporter.setRegistryHost(this.registryHost); } this.exporter.setRegistryPort(this.registryPort); if (this.remoteInvocationExecutor != null) { this.exporter.setRemoteInvocationExecutor(this.remoteInvocationExecutor); } this.exporter.setService(this); this.exporter.setServiceInterface(RequestReplyExchanger.class); this.exporter.setServiceName(SERVICE_NAME_PREFIX + this.requestChannelName); try { this.exporter.afterPropertiesSet(); } catch (RemoteException e) { throw new IllegalStateException(e); } }
@Override protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException { final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setRegistryPort(url.getPort()); rmiServiceExporter.setServiceName(url.getPath()); rmiServiceExporter.setServiceInterface(type); rmiServiceExporter.setService(impl); try { rmiServiceExporter.afterPropertiesSet(); } catch (RemoteException e) { throw new RpcException(e.getMessage(), e); } return new Runnable() { @Override public void run() { try { rmiServiceExporter.destroy(); } catch (Throwable e) { logger.warn(e.getMessage(), e); } } }; }
@Override protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException { final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setRegistryPort(url.getPort()); rmiServiceExporter.setServiceName(url.getPath()); rmiServiceExporter.setServiceInterface(type); rmiServiceExporter.setService(impl); try { rmiServiceExporter.afterPropertiesSet(); } catch (RemoteException e) { throw new RpcException(e.getMessage(), e); } return new Runnable() { @Override public void run() { try { rmiServiceExporter.destroy(); } catch (Throwable e) { logger.warn(e.getMessage(), e); } } }; }
protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException { final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setRegistryPort(url.getPort()); rmiServiceExporter.setServiceName(url.getPath()); rmiServiceExporter.setServiceInterface(type); rmiServiceExporter.setService(impl); try { rmiServiceExporter.afterPropertiesSet(); } catch (RemoteException e) { throw new RpcException(e.getMessage(), e); } return new Runnable() { public void run() { try { rmiServiceExporter.destroy(); } catch (Throwable e) { logger.warn(e.getMessage(), e); } } }; }
protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException { final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setRegistryPort(url.getPort()); rmiServiceExporter.setServiceName(url.getPath()); rmiServiceExporter.setServiceInterface(type); rmiServiceExporter.setService(impl); try { rmiServiceExporter.afterPropertiesSet(); } catch (RemoteException e) { throw new RpcException(e.getMessage(), e); } return new Runnable() { public void run() { try { rmiServiceExporter.destroy(); } catch (Throwable e) { logger.warn(e.getMessage(), e); } } }; }
@Override protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException { final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setRegistryPort(url.getPort()); rmiServiceExporter.setServiceName(url.getPath()); rmiServiceExporter.setServiceInterface(type); rmiServiceExporter.setService(impl); try { rmiServiceExporter.afterPropertiesSet(); } catch (RemoteException e) { throw new RpcException(e.getMessage(), e); } return new Runnable() { @Override public void run() { try { rmiServiceExporter.destroy(); } catch (Throwable e) { logger.warn(e.getMessage(), e); } } }; }
@Override protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException { final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setRegistryPort(url.getPort()); rmiServiceExporter.setServiceName(url.getPath()); rmiServiceExporter.setServiceInterface(type); rmiServiceExporter.setService(impl); try { rmiServiceExporter.afterPropertiesSet(); } catch (RemoteException e) { throw new RpcException(e.getMessage(), e); } return new Runnable() { @Override public void run() { try { rmiServiceExporter.destroy(); } catch (Throwable e) { logger.warn(e.getMessage(), e); } } }; }