/** * this remote server creates registry at giver Localhost and port number,then registers serve * object on the registry. * * @param args */ public static void main(String[] args) { Registry aRegistry; try { String RMIPortNum = args[0]; int processID = Integer.parseInt(args[1]); int processCount = Integer.parseInt(args[2]); Process exportedProcess = new Process(processCount, processID, RMIPortNum); aRegistry = LocateRegistry.createRegistry(Integer.parseInt(RMIPortNum)); aRegistry.rebind("server", exportedProcess); System.out.println("Process is Up and Running..."); exportedProcess.requestResolver(); System.out.println("Press Enter when all Process are running"); Scanner sc = new Scanner(System.in); sc.nextLine(); exportedProcess.criticalSectionSeeker(); exportedProcess.criticalSectionExecutor(); exportedProcess.run(); } catch (Exception e) { e.printStackTrace(); } }
private Creator() throws RemoteException { Registry registry = LocateRegistry.createRegistry(1099); controllerImpl = new RemoteController() { @Override public void previewClosed() throws RemoteException { preview.setSelected(false); } @Override public void ready() throws RemoteException { SwingUtilities.invokeLater( new Runnable() { public void run() { initiateRemoteUIDefaults(); } }); } @Override public void setTabIndex(int index) throws RemoteException { previewIndex = index; } }; RemoteController controller = (RemoteController) UnicastRemoteObject.exportObject(controllerImpl, 0); registry.rebind(RemoteController.class.getName(), controller); }
public static void main(String args[]) { AnnuaireIF annuaire = new Annuaire(); try { UnicastRemoteObject.exportObject(annuaire, 0); } catch (RemoteException e) { System.out.println("Lancé de nain lors de l'export de l'objet !"); e.printStackTrace(); System.exit(0); } Registry registry = null; try { registry = LocateRegistry.createRegistry(5500); // registry = LocateRegistry.getRegistry("localhost", 5500); } catch (RemoteException e) { System.out.println("Lancé de nain lors de la localisation de registry !"); e.printStackTrace(); System.exit(0); } try { registry.bind("Annuaire", annuaire); } catch (RemoteException | AlreadyBoundException e) { System.out.println("Lancé de nain lors du bind !"); e.printStackTrace(); System.exit(0); } System.out.println("Serveur lancé sans lancé de nain !"); } // fin du main
public static void main(String[] args) { String groupName = "TestGroup"; MulticastStrategy tree = new TreeBaseMulticast(); Orderer causal = new CausalOrderer(); try { ComMember mbr1 = new ComMember(tree, "mbr1"); ComObserver m = new MemberImpl(causal, mbr1); mbr1.addObserver(m); mbr1.addObserver(new groupRegisteringTest()); Registry dictionary = LocateRegistry.getRegistry(NamingService.SERVER_PORT); NamingServiceRemote server = (NamingServiceRemote) dictionary.lookup(NamingService.SERVICE_NAME); LinkedList<String> groups = server.getGroups(); if (!(groups.isEmpty())) { System.out.println("Available groups : "); for (String grp : groups) System.out.println("\t- " + grp); } RemoteMember leader = server.joinGroup("TestGroup", mbr1); System.out.println(leader.toString()); leader.deliver(new ComMessage<String>(new String("Hej Hej!"))); // mbr.post( new CommMessage<String>( new String("Hej Hej!") ), server.getSharedObjects() ) ; } catch (RemoteException e) { e.printStackTrace(); } catch (NotBoundException e) { e.printStackTrace(); } }
public static void main(String[] args) { String host = (args.length < 1) ? null : args[0]; int[] big_array = new int[100000]; for (int i = 0; i < big_array.length; i++) big_array[i] = i; try { int[] first_arr = new int[big_array.length / 2]; for (int i = 0; i < first_arr.length; i++) first_arr[i] = big_array[i]; int[] second_arr = new int[big_array.length / 2]; for (int i = 0; i < second_arr.length; i++) second_arr[i] = big_array[i + big_array.length / 2]; Registry registry = LocateRegistry.getRegistry(host, 4242); Chunk stub = (Chunk) registry.lookup("Chunk1"); int a = stub.sum(first_arr); System.out.println("sub sub:" + a); Registry registry2 = LocateRegistry.getRegistry(host, 4242); Chunk stub2 = (Chunk) registry.lookup("Chunk2"); int b = stub.sum(second_arr); System.out.println("sub sub:" + b); System.out.println("Total: " + (a + b)); } catch (Exception e) { System.err.println("Client exception: " + e.toString()); e.printStackTrace(); } }
/** * This method sends a message to the process; this process also sets logical clock * * @param workMess * @param address */ private void sendMessageToProcess(Message workMess, int address) throws RemoteException, NotBoundException { // 1]locate NodeInfo object NodeInfo[] nodeInfos = this.directory.listNodes(); NodeInfo regNode = null; // System.out.println("NodeInfoLength = "+nodeInfos.length+"\n"+ // "Processing nodes:"); for (int i = 0; i < nodeInfos.length; i++) { // System.out.println("-->"+nodeInfos[i].toString()+" "+address); if (nodeInfos[i].getID() == address) { regNode = nodeInfos[i]; } } // 2]Get remote registry Registry remoteRegistry = LocateRegistry.getRegistry(regNode.getIP(), regNode.getPort()); // 3]Lookup and put data String nodeName = NODE_NAME_PREFIX + address; // set clock this.clock++; // increment clock workMess.setClock(clock); // message prepared this.log.logNode( "Sending message to processs " + address + "-->" + workMess.toString(), clock, this.nodeInfo.getID()); NodeInterface nodeDirectory = (NodeInterface) remoteRegistry.lookup(nodeName); nodeDirectory.putMessage(workMess); }
public static void main(String[] args) { /** Atenção: Esses dois parametros são de grande importancia. */ String enderecoIPLocal = "127.0.0.1"; String nomeServidor = "Servidor"; int porta = 2020; /* * ######################## */ System.out.println("Objeto remoto no endereco " + enderecoIPLocal); try { Servidor banco = new Servidor(); // cria o registry para evitar problemas. Registry registry = LocateRegistry.createRegistry(porta); ServidorRemoto stubRemoto = (ServidorRemoto) UnicastRemoteObject.exportObject(banco, 0); String uriServidorRemoto = "rmi://" + nomeServidor; registry.rebind(uriServidorRemoto, stubRemoto); System.out.println("Objeto remoto exportado com nome " + uriServidorRemoto); System.out.println("\nObjeto remoto servidor do ar!"); } catch (RemoteException e) { e.printStackTrace(); System.exit(0); } }
public static void main(String[] args) throws NoSuchAlgorithmException { KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(1024); KeyPair par = keyGen.generateKeyPair(); prk = par.getPrivate(); pbk = par.getPublic(); Registry reg = null; System.out.println("Creando conexion remota"); try { reg = LocateRegistry.createRegistry(5555); } catch (Exception e) { e.printStackTrace(); } System.out.println("Creando objeto servidor"); Servidor s = new Servidor(); try { reg.rebind("Operaciones", (InterfaceRemota) UnicastRemoteObject.exportObject(s, 0)); } catch (Exception e) { e.printStackTrace(); } while (true) { try { Thread.sleep(1000); } catch (InterruptedException ex) { Logger.getLogger(Servidor.class.getName()).log(Level.SEVERE, null, ex); } } }
public JParSolverImpl(String host, int port) throws RemoteException { if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } String serverName = "JParServer"; try { Registry registry = LocateRegistry.getRegistry(host, port); this.server = (JParServer) registry.lookup(serverName); } catch (AccessException e) { System.err.println("Solver: Java RMI AccessException: " + e.getMessage()); return; } catch (RemoteException e) { System.err.println("Solver: Java RMI Exception: " + e.getMessage()); return; } catch (NotBoundException e) { System.err.println("Solver: " + serverName + " lookup failed:" + e.getMessage()); return; } catch (Exception e) { System.err.println("Solver: JParSolver Constructor:" + e.getMessage()); e.printStackTrace(); return; } this.taskSynchObj = new Object(); this.pendingJob = JOB_WAITING_FOR; if (this.register()) { initialized = true; } }
public static void main(String[] args) throws RemoteException, MalformedURLException { if (args.length <= 1) { System.out.println("Usage:\n./papp.sh {server name} {ps}\n"); // notice System.out.println( "Execute before launching: export CLASSPATH=$(pwd)/papp.jar:inters.jar:matrix.jar:queue.jar"); System.out.println("Then: rmiregistry&"); System.exit(0); } if (System.getSecurityManager() == null) { System.setSecurityManager(new SecurityManager()); } ProcessingAppInterface pa = new ProcessingApp(args[0], Integer.parseInt(args[1])); Registry registry = LocateRegistry.getRegistry(); registry.rebind(args[0], pa); // effacage d'affichage System.out.printf("\033[H\033[2J"); System.out.flush(); // affichage de l'etat de serveru System.out.println("Server: " + pa.getName() + ", ps = " + pa.getPs()); }
private static void publicizeRmiInterface(ModuleManager m, int registry_port) throws RemoteException { ModuleManagerRemote remote = (ModuleManagerRemote) UnicastRemoteObject.exportObject(m, 0); Registry reg = LocateRegistry.createRegistry(registry_port); logger.info("java RMI registry created."); reg.rebind(RMI_SERVER_NAME, remote); }
/** Start the RMI services */ public static boolean start() { try { BufferedReader br = new BufferedReader(new FileReader(SERVER_IP)); StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line + "\n"); line = br.readLine(); } String ipServer = sb.toString().trim(); br.close(); // Set hostname and codebase System.setProperty("java.rmi.server.hostname", ipServer.split("/")[0]); System.setProperty("java.rmi.server.codebase", "http://" + ipServer + "/popt-common.jar"); // Register services Registry reg = LocateRegistry.createRegistry(1099); reg.rebind(DBReceiver.SERVICE_NAME, new DBReceiverImpl()); reg.rebind(SeatsAllocator.SERVICE_NAME, new SeatsAllocatorImpl(new ShowtimesManager())); return true; } catch (Exception e) { e.printStackTrace(); return false; } }
public static void main(String[] args) { try { Registry registro = LocateRegistry.getRegistry("", /*numPorta*/); Acesso servico = (Acesso) registro.lookup("Acesso"); int control = -1; while (control != -1) { //aqui precisamos receber o comando que o usuario selecionar= login ou novo usuario e atualizar //a variavel control com esse valor para identificar no switch abaixo switch (control) { case 1: servico.connect(nome, pswd); break; case 2: servico.newUser(nome, pswd); break; case 3: servico.disconnect(nome); } } } catch (RemoteException | NotBoundException ex) {
public static void main(String args[]) { /* * Create and install a security manager */ // if (System.getSecurityManager() == null) { // System.setSecurityManager(new SecurityManager()); // } byte pattern = (byte) 0xAC; try { /* * Create remote object and export it to use * custom socket factories. */ HelloImpl obj = new HelloImpl(); RMIClientSocketFactory csf = new XorClientSocketFactory(pattern); RMIServerSocketFactory ssf = new XorServerSocketFactory(pattern); Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0, csf, ssf); /* * Create a registry and bind stub in registry. */ LocateRegistry.createRegistry(2002); Registry registry = LocateRegistry.getRegistry(2002); registry.rebind("Hello", stub); System.out.println("HelloImpl bound in registry"); } catch (Exception e) { System.out.println("HelloImpl exception: " + e.getMessage()); e.printStackTrace(); } }
public static void main(String args[]) throws Exception { try { testPkg.Server obj = new testPkg.Server(); testPkg.Hello stub = (testPkg.Hello) UnicastRemoteObject.exportObject(obj, 0); // Bind the remote object's stub in the registry Registry registry = LocateRegistry.getRegistry(TestLibrary.READTEST_REGISTRY_PORT); registry.bind("Hello", stub); System.err.println("Server ready"); // now, let's test client testPkg.Client client = new testPkg.Client(TestLibrary.READTEST_REGISTRY_PORT); String testStubReturn = client.testStub(); if (!testStubReturn.equals(obj.hello)) { throw new RuntimeException("Test Fails : unexpected string from stub call"); } else { System.out.println("Test passed"); } registry.unbind("Hello"); } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } }
public static void main(String[] args) { try { Registry registry = LocateRegistry.getRegistry(1099); MonitorInterface monitor = (MonitorInterface) registry.lookup("//localhost/monitor"); Random random = new Random(); int id = monitor.getID(); int max = monitor.getMax(); Bank bank = new Bank(id, max, monitor, random.nextInt(100), registry); registry.bind("//localhost/bank" + id, bank); System.out.println("Bank " + id + " ready! Hit to start..."); System.in.read(); for (int j = 0; j < 1000; j++) { int d = random.nextInt(max - 1); if (d >= id) d++; int q = random.nextInt(10); bank.transfer(q, d); Thread.sleep(random.nextInt(5000)); } } catch (Exception e) { e.printStackTrace(); } }
@Before public void setUp() throws Exception { System.setProperty("java.security.policy", "polis.policy"); if (System.getSecurityManager() == null) { System.setSecurityManager(new SecurityManager()); } try { Registry registry = LocateRegistry.getRegistry("localhost"); articoloFacade = (IArticoloMenuFacade) registry.lookup("ArticoloFacade"); userFacade = (IUserFacade) registry.lookup("UserFacade"); } catch (Exception e) { System.err.println("Exception to obtain the reference to the remote object: " + e); fail("Exception"); } user = userFacade.login(Ruolo.TEST, "test"); bevanda = new Bevanda(); bevanda.setCapacita(1000F); bevanda.setNome("BEVANDA TEST"); bevanda.setTipoArticolo("Bevanda"); bevanda.setTipoPietanza(TipoPietanza.BEVANDA.ordinal()); bevanda = articoloFacade.inserisciBevandaMenu(user, bevanda); articoloFacade.inserisciBevandaMagazzino(user, bevanda.getId(), 1L, 10000); }
private void checkSslConfig() throws IOException { // Get the reference to the RMI Registry and lookup RMIServer stub // Registry registry; try { registry = LocateRegistry.getRegistry(registryHostName, registryPort, sslRMIClientSocketFactory); try { stub = (RMIServer) registry.lookup("jmxrmi"); } catch (NotBoundException nbe) { throw (IOException) new IOException(nbe.getMessage()).initCause(nbe); } sslRegistry = true; } catch (IOException e) { registry = LocateRegistry.getRegistry(registryHostName, registryPort); try { stub = (RMIServer) registry.lookup("jmxrmi"); } catch (NotBoundException nbe) { throw (IOException) new IOException(nbe.getMessage()).initCause(nbe); } sslRegistry = false; } // Perform the checks for secure stub // try { checkStub(stub, rmiServerImplStubClass); sslStub = true; } catch (SecurityException e) { sslStub = false; } }
@SuppressWarnings("deprecation") @Before public void setUp() throws Exception { System.setProperty("java.security.policy", "polis.policy"); if (System.getSecurityManager() == null) { System.setSecurityManager(new SecurityManager()); } try { Registry registry = LocateRegistry.getRegistry("localhost"); articoloFacade = (IArticoloMenuFacade) registry.lookup("ArticoloFacade"); userFacade = (IUserFacade) registry.lookup("UserFacade"); } catch (Exception e) { System.err.println("Exception to obtain the reference to the remote object: " + e); fail("Exception"); } user = userFacade.login(Ruolo.TEST, "test"); ingrediente = new Ingrediente(); ingrediente.setNome("INGREDIENTE TEST"); ingrediente.setScadenza(new Date(109, 4, 31)); ingrediente.setVariante(true); ingrediente = articoloFacade.inserisciIngrediente(user, ingrediente); }
public ServerMain() { try { PropertyConfigurator.configure(getClass().getResource(loggerPropsFile)); /* * Load server properties. */ Properties props = new Properties(); InputStream in = getClass().getResourceAsStream(serverPropsFile); props.load(in); in.close(); String rootDir = (String) props.get("server.path"); String serverName = (String) props.get("server.name"); String serverIp = (String) props.get("server.ip"); int serverPort = Integer.parseInt((String) props.get("server.port")); /* * Register factory object in registry. */ ServerFactory stub = new ServerFactory(InetAddress.getByName(serverIp), serverPort, rootDir); Registry registry = LocateRegistry.createRegistry(serverPort); registry.rebind(serverName, stub); Server.log.info("Server bound [port=" + serverPort + "]"); } catch (java.io.FileNotFoundException e) { System.err.println("Server error: " + serverPropsFile + " file not found."); } catch (java.io.IOException e) { System.err.println("Server error: IO exception."); } catch (Exception e) { Server.log.severe("Server exception:"); e.printStackTrace(); } }
@SuppressWarnings("deprecation") @Before public void setUp() throws Exception { System.setProperty("java.security.policy", "polis.policy"); if (System.getSecurityManager() == null) { System.setSecurityManager(new SecurityManager()); } try { Registry registry = LocateRegistry.getRegistry("localhost"); articoloFacade = (IArticoloMenuFacade) registry.lookup("ArticoloFacade"); // CONTROLLARE userFacade = (IUserFacade) registry.lookup("UserFacade"); } catch (Exception e) { System.err.println("Exception to obtain the reference to the remote object: " + e); fail("Exception"); } user = userFacade.login(Ruolo.TEST, "test"); ingrediente = new Ingrediente(); ingrediente.setDescrizione("Ingrediente di test"); ingrediente.setId((long) 1000000L); ingrediente.setNome("Ingrediente di Test"); ingrediente.setTipoIngrediente("IngredienteLungaConservazione"); ingrediente.setScadenza(new Date(109, 1, 21)); ingrediente.setUnitaMisura("g"); ingrediente.setVariante(true); ingrediente = articoloFacade.inserisciIngrediente(user, ingrediente); }
@Before public void setUp() throws Exception { System.setProperty("java.security.policy", "polis.policy"); if (System.getSecurityManager() == null) { System.setSecurityManager(new SecurityManager()); } try { Registry registry = LocateRegistry.getRegistry("localhost"); userFacade = (IUserFacade) registry.lookup("UserFacade"); ristoranteFacade = (IRistoranteFacade) registry.lookup("RistoranteFacade"); } catch (Exception e) { System.err.println("Exception to obtain the reference to the remote object: " + e); fail("Exception"); } user = userFacade.login(Ruolo.TEST, "test"); Indirizzo indirizzo = new Indirizzo(); indirizzo.setCap("83100"); indirizzo.setCitta("Avellino"); indirizzo.setCivico("23 A"); indirizzo.setId(1000000L); indirizzo.setProvincia("AV"); indirizzo.setVia("via Roma"); ristorante = new Ristorante(); ristorante.setIndirizzo(indirizzo); ristorante.setPartitaIva("01234567890"); ristorante.setRagioneSociale("Ristorante Test"); ristorante = ristoranteFacade.inserisciRistorante(user, ristorante); }
public static void main(String args[]) { // Figure out where server is running String server = "localhost"; try { // create a new Server object FlightRM obj = new FlightRM(); // dynamically generate the stub (client proxy) ResourceManager rm = (ResourceManager) UnicastRemoteObject.exportObject(obj, 0); // Bind the remote object's stub in the registry Registry registry = LocateRegistry.getRegistry(8778); registry.rebind("Group4FlightRM", rm); System.err.println("Flight Server ready"); } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } // Create and install a security manager /* if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } */ }
private static IRemoteManager getiRemoteManager(String registryHostname, int registryPort) throws RemoteException, NotBoundException { Registry fosRegistry = LocateRegistry.getRegistry(registryHostname, registryPort); String managerClass = IRemoteManager.class.getSimpleName(); return (IRemoteManager) fosRegistry.lookup(managerClass); }
/** * @param args the command line arguments * @throws java.rmi.RemoteException * @throws java.rmi.NotBoundException */ public static void main(String[] args) throws RemoteException, NotBoundException { Registry registro = LocateRegistry.getRegistry("127.0.0.1", 1099); OperacionesRemota op = (OperacionesRemota) registro.lookup("rmiServer"); String resultado = op.consultarTema("https://en.wikipedia.org/wiki/Java_%28programming_language%29"); System.err.println("El resultado remoto es: "); System.out.println(resultado); }
// Connessione statica al Server private static Server connectToServer() { Server server = null; try { Registry registry = LocateRegistry.getRegistry(host); server = (Server) registry.lookup("PhoenixServer"); } catch (RemoteException | NotBoundException e) { } return server; }
public static void main(String[] args) throws Exception { System.err.println("\nRegression test for bug 6261402\n"); System.setProperty( "java.rmi.activation.port", Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT)); RMID rmid = null; Callback obj = null; try { /* * Export callback object and bind in registry. */ System.err.println("export callback object and bind in registry"); obj = new CallbackImpl(); Callback proxy = (Callback) UnicastRemoteObject.exportObject(obj, 0); Registry registry = LocateRegistry.createRegistry(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT); registry.bind("Callback", proxy); /* * Start rmid. */ System.err.println("start rmid with inherited channel"); RMID.removeLog(); rmid = RMID.createRMID( System.out, System.err, true, true, TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT); rmid.addOptions( new String[] { "-Djava.nio.channels.spi.SelectorProvider=" + "InheritedChannelNotServerSocket$SP" }); rmid.start(); /* * Get activation system and wait to be notified via callback * from rmid's selector provider. */ System.err.println("get activation system"); ActivationSystem system = ActivationGroup.getSystem(); System.err.println("ActivationSystem = " + system); synchronized (lock) { while (!notified) { lock.wait(); } } System.err.println("TEST PASSED"); } finally { if (obj != null) { UnicastRemoteObject.unexportObject(obj, true); } ActivationLibrary.rmidCleanup(rmid); } }
public void deploy(URL url, boolean master, ClassLoader cL, String remoteHost) { try { FileObject filetoScan = fsManager.resolveFile("jar:" + url.toString() + "!/"); HashSet<Class<?>>[] classes = new HashSet[] {new HashSet()}; VFSClassLoader jarCL; if (cL != null) { jarCL = new VFSClassLoader(new FileObject[] {filetoScan}, fsManager, cL); } else { jarCL = new VFSClassLoader( new FileObject[] {filetoScan}, fsManager, Thread.currentThread().getContextClassLoader()); } Class[] annot = new Class[] {DeployRMI.class}; scanJar(filetoScan, classes, annot, jarCL); for (Class<?> rmiClass : classes[0]) { DeployRMI rmiAnnot = rmiClass.getAnnotation(DeployRMI.class); if (master) { rmiProxyHandler = new RMIProxyHandler(rmiAnnot.jndiBinding(), remoteObjects); rmiproxy = Proxy.newProxyInstance( rmiClass.getClassLoader(), rmiClass.getInterfaces(), rmiProxyHandler); remoteobj = UnicastRemoteObject.exportObject( (Remote) rmiproxy, Integer.parseInt(serverConfig.getRmiregistryport())); rmiproxyObjs.put(rmiAnnot.jndiBinding(), rmiproxy); rmiproxyHandler.put(rmiAnnot.jndiBinding(), rmiProxyHandler); remoteProxyObjs.put(rmiAnnot.jndiBinding(), remoteobj); ic.bind("java:/" + rmiAnnot.jndiBinding(), remoteobj); registry.bind(rmiAnnot.jndiBinding(), (Remote) remoteobj); cLMap.put(rmiAnnot.jndiBinding(), jarCL); } else { Remote remoteObj = (Remote) rmiClass.newInstance(); remoteSlaveObjs.put(rmiAnnot.jndiBinding(), remoteObj); Object remoteobj = UnicastRemoteObject.exportObject( (Remote) remoteObj, Integer.parseInt(serverConfig.getRmiregistryport())); ic.bind("java:/" + rmiAnnot.jndiBinding(), remoteobj); registry.bind(rmiAnnot.jndiBinding(), (Remote) remoteobj); if (remoteObjects.get(rmiAnnot.jndiBinding()) != null) { ConcurrentMap<String, Remote> remoteObjs = remoteObjects.get(rmiAnnot.jndiBinding()); remoteObjs.put(remoteHost, (Remote) remoteobj); } else { ConcurrentHashMap<String, Remote> remoteObjs = new ConcurrentHashMap<String, Remote>(); remoteObjs.put(remoteHost, (Remote) remoteobj); remoteObjects.put(rmiAnnot.jndiBinding(), remoteObjs); } } } } catch (Exception e) { log.error("unable to deploy the package " + url, e); } }
public static void main(String[] args) { try { TokenizationServerInterface obj = new TokenizationServer(); Registry registry = LocateRegistry.createRegistry(1300); registry.rebind("TokenizationServer", obj); System.out.println("Tokenization server " + obj + " registered"); } catch (Exception ex) { ex.printStackTrace(); } }
@Override public Config connect(int id) throws RemoteException, NotBoundException { String slaveIp = getConfig().getParticipantIps()[id]; System.out.println("Slave Connected: " + slaveIp); Registry registry = LocateRegistry.getRegistry(slaveIp, rmiPort); FacilityManager slaveManager = (FacilityManager) registry.lookup(clusterName + REGISTRY_SLAVE_KEY); managers[id] = slaveManager; return getConfig(); }