java.rmi.registry.Registry.rebind()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中java.rmi.registry.Registry.rebind方法的一些代码示例,展示了Registry.rebind的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Registry.rebind方法的具体详情如下:
包路径:java.rmi.registry.Registry
类名称:Registry
方法名:rebind

Registry.rebind介绍

[英]Replaces the binding for the specified name in this registry with the supplied remote reference. If there is an existing binding for the specified name, it is discarded.
[中]用提供的远程引用替换此注册表中指定的name的绑定。如果指定的name存在绑定,则该绑定将被丢弃。

代码示例

代码示例来源:origin: spring-projects/spring-framework

this.registry.rebind(this.serviceName, this.exportedObject);

代码示例来源:origin: org.springframework/spring-context

this.registry.rebind(this.serviceName, this.exportedObject);

代码示例来源:origin: quartz-scheduler/quartz

registry.rebind(bindName, exportable);

代码示例来源:origin: quartz-scheduler/quartz

registry.rebind(bindName, exportable);

代码示例来源:origin: stackoverflow.com

Controle obj = new Controle(4);
Controle stub = (Controle) UnicastRemoteObject.exportObject(obj, 0);
Registry reg = LocateRegistry.createRegistry(1099);
System.out.println("Server is ready");
reg.rebind("CtrlServ", stub);

代码示例来源:origin: stackoverflow.com

Controle obj = new Controle(4);
Registry reg = LocateRegistry.createRegistry(1099);
System.out.println("Server is ready");
reg.rebind("CtrlServ", obj);

代码示例来源:origin: stackoverflow.com

public static void rebind(String name, Remote obj)
throws RemoteException, java.net.MalformedURLException {
  ParsedNamingURL parsed = parseURL(name);
  Registry registry = getRegistry(parsed);

  if (obj == null)
    throw new NullPointerException("cannot bind to null");

  registry.rebind(parsed.name, obj);
}

代码示例来源:origin: stackoverflow.com

try {
  /*here create the registry*/
  Registry reg = LocateRegistry.createRegistry(30);
  ImbCal  c = new ImbCal();
  reg.rebind("MSA", c);
  reg.rebind("Work", c);
  System.out.println("Server is ready ....");
  System.in.read();
}catch(Exception ex){
 ex.printStackTrace();
 System.out.print(ex.getMessage());
}

代码示例来源:origin: stackoverflow.com

public static void rebind(String name, Remote obj) throws RemoteException, MalformedURLException 
  ParsedNamingURL parsed = parseURL(name);
  Registry registry = getRegistry(parsed);
  if (obj == null)
    throw new NullPointerException("cannot bind to null");
  registry.rebind(parsed.name, obj);
}
...

private static Registry getRegistry(ParsedNamingURL parsed) throws RemoteException {
  return LocateRegistry.getRegistry(parsed.host, parsed.port);
}

代码示例来源:origin: groupon/odo

private void startServer() {
  try {
    // create on port 1298
    registry = LocateRegistry.createRegistry(port);
    // create a new service named hostsService
    registry.rebind(SERVICE_NAME, new MessageImpl());
  } catch (Exception e) {
    e.printStackTrace();
  }
  System.out.println("system is ready on port " + port);
}

代码示例来源:origin: stackoverflow.com

System.getProperties().put("java.rmi.server.hostname", IP 80.80.80.10);
MyService rmiserver = new MyService();
MyService stub = (MyService) UnicastRemoteObject.exportObject(rmiserver, 6620);
LocateRegistry.createRegistry(1099);
Registry registry = LocateRegistry.getRegistry();
registry.rebind("FAManagerService", stub);

代码示例来源:origin: stackoverflow.com

class Service extends UnicastRemoteObject  implements MyInterface {
  public Service() {
  }
  public MyClass f(MyClass v) throws RemoteException {
    return new MyClass(v.getValue() + 1)
  }

  public static void main(Strint arg[]) {
   Registry r = LocateRegistry.createRegistry(1099);
   r.rebind("service", new Service());
  }
}

代码示例来源:origin: stackoverflow.com

import java.rmi.*;
import java.rmi.registry.*;
import java.io.*;

public class RMIServer{

 public static void main(String[] argv) throws Exception{

  StackImp s = new StackImp(10);
  Registry reg = LocateRegistry.createRegistry(2000);
  reg.rebind("xyz", s);
  System.out.println("RMI Server ready....");
  System.out.println("Waiting for Request...");   

 }
}

代码示例来源:origin: root-wyj/springboot_im

public static void registry() {
  Registry registry = null;
  try {
    // 指定服务端口
    registry = LocateRegistry.createRegistry(8687);
    RMIServiceImp server = new RMIServiceImp();
    // 绑定服务
    registry.rebind("test", server);
    
  } catch (RemoteException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: io.github.cloudiator.axe/axe-aggregator-common

public boolean addToRegistry(T object, String key) {
  try {
    Registry reg = getAndCreateRegistry();
    removeExisting(reg, key);
    reg.rebind(key, object);
    return true;
  } catch (RemoteException e) { // includes AccessException //
    LOGGER
      .error("got exception at startup: could not add object to registry. aborting.", e);
  }
  return false;
}

代码示例来源:origin: EvoSuite/evosuite

public void registerServices() throws RemoteException{
  masterNode = new MasterNodeImpl(registry);
  MasterNodeRemote stub = (MasterNodeRemote) UtilsRMI.exportObject(masterNode);
  registry.rebind(MasterNodeRemote.RMI_SERVICE_NAME, stub);
}

代码示例来源:origin: stackoverflow.com

...
private static ServiceImpl serviceImpl = null;

public static void register (int port) {
  serviceImpl = new ServiceImpl();
  Registry registry = LocateRegistry.createRegistry(port);
  registry.rebind ("serviceImpl", serviceImpl);
}

public static void main(String[] args) throws RemoteException, NotBoundException {
  register(1099);    
  ...the rest of your code...
}

代码示例来源:origin: io.github.dheid/wings

public ConnectionSet() {
    try {
      LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
      RemoteConnectionSet stub = (RemoteConnectionSet) UnicastRemoteObject.exportObject(this, 0);
      Registry registry = LocateRegistry.getRegistry();
      registry.rebind(CometConnectionManager.NAME, stub);
    }
    catch (RemoteException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: org.apache.oodt/oodt-commons

public void rebind(String name, Object obj) throws NamingException {
  checkName(name);
  try {
    Registry registry = getRegistry();
    registry.rebind(toRMIName(name), (Remote) obj);
  } catch (RemoteException ex) {
    ex.printStackTrace();
    throw new NamingException("Remote exception: " + ex.getMessage());
  }
}

代码示例来源:origin: apache/oodt

public void rebind(String name, Object obj) throws NamingException {
  checkName(name);
  try {
    Registry registry = getRegistry();
    registry.rebind(toRMIName(name), (Remote) obj);
  } catch (RemoteException ex) {
    ex.printStackTrace();
    throw new NamingException("Remote exception: " + ex.getMessage());
  }
}

相关文章