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

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

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

Registry.bind介绍

[英]Binds a remote reference to the specified name in this registry.
[中]将远程引用绑定到此注册表中指定的name

代码示例

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

Remote server =
   UnicastRemoteObject.exportObject(new EchoServerImpl(),
                    0, fac, fac);
 System.err.println("server: " + server);
 Registry registry =
   LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
 registry.bind("echo", server);

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

@Override
 public synchronized void start() throws IOException {
  try {
   registry.bind("jmxrmi", stub);
  } catch (AlreadyBoundException x) {
   throw new IOException(x.getMessage(), x);
  }
  super.start();
 }
};

代码示例来源:origin: konsoletyper/teavm

BuildDaemon(boolean incremental) throws RemoteException {
  super();
  this.incremental = incremental;
  Random random = new Random();
  for (int i = 0; i < 20; ++i) {
    port = random.nextInt(MAX_PORT - MIN_PORT) + MIN_PORT;
    try {
      registry = LocateRegistry.createRegistry(port);
    } catch (RemoteException e) {
      continue;
    }
    try {
      registry.bind(RemoteBuildService.ID, this);
    } catch (RemoteException | AlreadyBoundException e) {
      throw new IllegalStateException("Could not bind remote build assistant service", e);
    }
    setupIncrementalCache();
    return;
  }
  throw new IllegalStateException("Could not create RMI registry");
}

代码示例来源:origin: frohoff/ysoserial

new ExecCheckingSecurityManager().callWrapped(new Callable<Void>(){public Void call() throws Exception {
    ObjectPayload payloadObj = payloadClass.newInstance();
    Object payload = payloadObj.getObject(command);
    String name = "pwned" + System.nanoTime();
    Remote remote = Gadgets.createMemoitizedProxy(Gadgets.createMap(name, payload), Remote.class);
    try {
      registry.bind(name, remote);
    } catch (Throwable e) {
      e.printStackTrace();
    }
    Utils.releasePayload(payloadObj, payload);
    return null;
  }});
}

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

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

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

final Remote remote = UnicastRemoteObject.exportObject(toBeStubbed, 0);
final Registry registry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
registry.bind(REMOTE_NAME, remote);

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

registry.bind(MASTER_PARAM, master);

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

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

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

package com.example.remote.server;

import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class Server {

  public static void main(String[] args) throws MalformedURLException, RemoteException, AlreadyBoundException {
    Registry registry = LocateRegistry.createRegistry(1234);
    registry.bind("remoteControl", new RemoteControl());
  }

}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-coref-ace

/** Bind this object to the value of <code>BINDING_NAME</code> in the local RMI
 * registry.
 * @exception AlreadyBoundException If <code>BINDING_NAME</code> is already bound.
 * @exception RemoteException If remote operation failed.
 */
public void bind() throws RemoteException, AlreadyBoundException {
  Registry registry = LocateRegistry.getRegistry();
  registry.bind(BINDING_NAME, this);
}

代码示例来源:origin: org.jwall/stream-runtime

public static boolean bind(String name, Service service) throws Exception {
  ServiceProxy proxy = new ServiceProxy(service);
  registry.bind(name, proxy);
  return true;
}

代码示例来源:origin: edu.illinois.cs.cogcomp/LBJCoref

/** Bind this object to the value of <code>BINDING_NAME</code> in the local RMI
 * registry.
 * @exception AlreadyBoundException If <code>BINDING_NAME</code> is already bound.
 * @exception RemoteException If remote operation failed.
 */
public void bind() throws RemoteException, AlreadyBoundException {
  Registry registry = LocateRegistry.getRegistry();
  registry.bind(BINDING_NAME, this);
}

代码示例来源:origin: de.sfb876/streams-runtime

public static boolean bind(String name, Service service) throws Exception {
  ServiceProxy proxy = new ServiceProxy(service);
  registry.bind(name, proxy);
  return true;
}

代码示例来源:origin: net.sbbi/sbbi-upnplib

public static void main ( String[] args ) {
 try {
  Registry reg = LocateRegistry.createRegistry( 1099 );
  System.out.println ( "Registry created" );
  HelloWorld hello = new HelloWorld();
  System.out.println ( "Object created" );
  reg.bind( "HelloWorld", hello );
  System.out.println ( "Object bound HelloWorld server is ready." );
 } catch ( Exception e ) {
  System.out.println( "Hello Server failed: " + e );
 }
}

代码示例来源:origin: com.google.code.narcissus-webtests/narcissus-core

private static void start() throws RemoteException, AlreadyBoundException, InterruptedException {
    Integer serverPort = Integer.valueOf(System.getProperty("NARCISSUS_SERVER_PORT_KEY", "2004"));
    Registry localreg = LocateRegistry.createRegistry(serverPort);
    RemoteRobot service = new RemoteRobot(serverPort);
    localreg.bind(System.getProperty("NARCISSUS_SERVICE_NAME_KEY", "ScreenShooter"), service);
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm");
    LOGGER.info("Narcissus server started on " + format.format(new Date()));
  }
}

代码示例来源:origin: io.snappydata/gemfire-core

@Override
 public synchronized void start() throws IOException {
  try {
   registry.bind("jmxrmi", stub);
  } catch (AlreadyBoundException x) {
   final IOException io = new IOException(x.getMessage());
   io.initCause(x);
   throw io;
  }
  super.start();
 }
};

代码示例来源:origin: org.apache.geode/gemfire-core

@Override
 public synchronized void start() throws IOException {
  try {
   registry.bind("jmxrmi", stub);
  } catch (AlreadyBoundException x) {
   final IOException io = new IOException(x.getMessage());
   io.initCause(x);
   throw io;
  }
  super.start();
 }
};

代码示例来源:origin: net.sf.jwordnet/jwnl

/**
 * Bind this object to the value of <code>BINDING_NAME</code> in the local RMI
 * registry.
 * @exception AlreadyBoundException If <code>BINDING_NAME</code> is already bound.
 * @exception RemoteException If remote operation failed.
 */
public void bind() throws RemoteException, AlreadyBoundException {
  _log.log(MessageLogLevel.INFO, "DICTIONARY_INFO_001", BINDING_NAME);
  Registry registry = LocateRegistry.getRegistry();
  registry.bind(BINDING_NAME, this);
}

代码示例来源:origin: edu.stanford.protege/org.protege.owl.server

private void loadRMITransport(RMITransport transport) throws RemoteException, AlreadyBoundException {
  int serverPort = transport.getServerPort();
  Remote remote = UnicastRemoteObject.exportObject(loginService, serverPort);
  transport.getRegistry().bind(LoginService.SERVICE, remote);
  logger.info("Authentication service started");
}

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

public void bind(String name, Object obj) throws NamingException {
  checkName(name);
  Registry registry = getRegistry();
  try {
    registry.bind(toRMIName(name), (Remote) obj);
  } catch (AlreadyBoundException ex) {
    throw new NameAlreadyBoundException(name + " already bound in RMI registry " + registry);
  } catch (RemoteException ex) {
    throw new NamingException("Remote exception: " + ex.getMessage());
  }
}

相关文章

微信公众号

最新文章

更多