@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 public void run() { try { rmiServiceExporter.destroy(); } catch (Throwable e) { logger.warn(e.getMessage(), e); } } };
@Override public void afterPropertiesSet() throws RemoteException { prepare(); }
@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); } }
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
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); } }
@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 public void run() { try { rmiServiceExporter.destroy(); } catch (Throwable e) { logger.warn(e.getMessage(), e); } } };
@Override public void afterPropertiesSet() throws RemoteException { prepare(); }
@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(); }
@Override public void destroy() { try { super.destroy(); this.exporter.destroy(); } catch (Exception e) { throw new IllegalStateException(e); } }
public void prepare() throws RemoteException { if(enabled) { super.prepare(); } }
@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; }
public void destroy() throws RemoteException { if(enabled) { super.destroy(); } }
public void prepare() throws RemoteException { if(enabled) { super.prepare(); } }
@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 void destroy() throws RemoteException { if(enabled) { super.destroy(); } }
@Override public void afterPropertiesSet() throws RemoteException { prepare(); }
RmiServiceExporter exporter = new RmiServiceExporter(); exporter.setService(new ApplicationImpl()); exporter.setServiceInterface(Application.class); exporter.setServiceName("application"); exporter.afterPropertiesSet();