List of usage examples for org.springframework.remoting.rmi RmiServiceExporter setRegistryPort
public void setRegistryPort(int registryPort)
From source file:org.javassonne.networking.impl.RemotingUtils.java
/** * This method takes an object and exposes it as a remove RMI service. The * class that is passed should be the interface that you want the service * exposed as. The name and port will be used to create the url for the * service. e.g. if you provide the name "foo", port 5555, and your ip * address is 123.45.67.89, the following url will access the service: * rmi://123.45.67.89:5555/foo//from w ww.j a v a 2 s . c om * * @param svc * - the object that is to be exposed as a remote RMI service * @param svcinterface * - the interface on the object to expose * @param name * - the name of the service for the url * @return - the url of the service (can be passed to others to connect to) * * @throws RemoteException * @throws UnknownHostException */ public static synchronized ServiceInfo exportRMIService(Object svc, Class svcinterface, int port, String name) throws RemoteException, UnknownHostException { RmiServiceExporter exporter = new RmiServiceExporter(); exporter.setRegistryPort(port); exporter.setServiceInterface(svcinterface); exporter.setService(svc); exporter.setServiceName(name); exporter.afterPropertiesSet(); exporter.prepare(); serviceMap_.put(name, exporter); ServiceInfo info = ServiceInfo.create("_rmi._tcp.local.", name, port, "path=index.html"); // return "rmi://"+LOCAL_HOST+":"+port+"/"+name; return info; }
From source file:org.lightadmin.core.config.context.LightAdminRemoteConfiguration.java
private RmiServiceExporter createRmiServiceExporter(final Object service, final String serviceName) throws RemoteException { RmiServiceExporter rmiServiceExporter = new RmiServiceExporter(); rmiServiceExporter.setServiceName(serviceName); rmiServiceExporter.setService(service); rmiServiceExporter.setServiceInterface(ClassUtils.getAllInterfaces(service)[0]); rmiServiceExporter.setRegistryPort(1199); rmiServiceExporter.afterPropertiesSet(); return rmiServiceExporter; }
From source file:com.rk.grid.cluster.master.Broker.java
private void doRMIExport() throws RemoteException { /*//from w ww . j a v a 2 s .c o m * <bean id="broker" class="grid.client.Broker"></bean> <bean class="org.springframework.remoting.rmi.RmiServiceExporter"> <property name="serviceName" value="clustered-executor-service" /> <property name="service" ref="broker" /> <property name="serviceInterface" value="grid.common.IBroker"/> <property name="registryPort" value="1234" /> </bean> */ try { RmiServiceExporter s = new RmiServiceExporter(); s.setServiceName(this.serviceName); s.setService(this); s.setServiceInterface(IBroker.class); s.setRegistryPort(this.port); s.afterPropertiesSet(); this.rmiServiceExporter = s; } catch (Throwable e) { e.printStackTrace(); throw new RuntimeException(e); } }
From source file:au.com.jwatmuff.genericp2p.rmi.RMIPeerManager.java
private void refreshService(PeerService service) { RmiServiceExporter exporter = new RmiServiceExporter(); exporter.setRegistryPort(registryPort); exporter.setServiceName(service.name); exporter.setServiceInterface(service.serviceClass); exporter.setService(service.implementation); try {//from w w w .j a va 2 s .co m service.exporter.destroy(); exporter.afterPropertiesSet(); exporter.prepare(); service.exporter = exporter; } catch (RemoteException e) { log.error("Refreshing service " + service.name + " (" + service + ") failed", e); } }
From source file:org.grouter.core.RouterServerImpl.java
/** * If there is a rmi port configured then we register the router in jndi. * <p/>/*from w w w.j av a2s .c om*/ * Lookup up bean in context and use our config files parameters to set * port etc and finally call prepare to fire things up. */ private void initRmi() { logger.info("Check if we are to register as RMI service"); if (router.getRmiRegistryPort() > 0 || router.getRmiServicePort() > 0) { try { logger.info("Trying to register in router as RMI service jndi"); logger.info("Rmiregistryport :" + router.getRmiRegistryPort()); logger.info("Rmiserviceport :" + router.getRmiServicePort()); logger.debug("Get rmi exporter bean from context :" + RMI_SERVICE_EXPORTER_FACTORY_BEAN); RmiServiceExporter rmiServiceExporter = (RmiServiceExporter) context .getBean(RMI_SERVICE_EXPORTER_FACTORY_BEAN); rmiServiceExporter.setRegistryPort(router.getRmiRegistryPort()); rmiServiceExporter.setServicePort(router.getRmiServicePort()); logger.debug("Calling prepare on rmi exporter"); rmiServiceExporter.prepare(); logger.info("Registered ok as RMI service jndi"); } catch (RemoteException e) { logger.error("Failed to register router as RMI service in JNDI", e); } } else { logger.info("Router was no tconfigured to use RMI - rmi ports missing in config file"); } }