本文整理匯總了Java中java.rmi.server.RMIServerSocketFactory類的典型用法代碼示例。如果您正苦於以下問題:Java RMIServerSocketFactory類的具體用法?Java RMIServerSocketFactory怎麽用?Java RMIServerSocketFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RMIServerSocketFactory類屬於java.rmi.server包,在下文中一共展示了RMIServerSocketFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRegistry
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
@Override
protected Registry getRegistry(
String registryHost,
int registryPort,
RMIClientSocketFactory clientSocketFactory,
RMIServerSocketFactory serverSocketFactory) throws RemoteException
{
if(enabled)
{
return super.getRegistry(registryHost, registryPort, clientSocketFactory, serverSocketFactory);
}
else
{
throw new RemoteException(ERR_MSG_NOT_ENABLED);
}
}
示例2: getRegistry
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
/**
* Locate or create the RMI registry for this exporter.
* @param registryHost the registry host to use (if this is specified,
* no implicit creation of a RMI registry will happen)
* @param registryPort the registry port to use
* @param clientSocketFactory the RMI client socket factory for the registry (if any)
* @param serverSocketFactory the RMI server socket factory for the registry (if any)
* @return the RMI registry
* @throws RemoteException if the registry couldn't be located or created
*/
protected Registry getRegistry(String registryHost, int registryPort,
RMIClientSocketFactory clientSocketFactory, RMIServerSocketFactory serverSocketFactory)
throws RemoteException {
if (registryHost != null) {
// Host explicitly specified: only lookup possible.
if (logger.isInfoEnabled()) {
logger.info("Looking for RMI registry at port '" + registryPort + "' of host [" + registryHost + "]");
}
Registry reg = LocateRegistry.getRegistry(registryHost, registryPort, clientSocketFactory);
testRegistry(reg);
return reg;
}
else {
return getRegistry(registryPort, clientSocketFactory, serverSocketFactory);
}
}
示例3: getRegistry
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
/**
* Locate or create the RMI registry.
* @param registryHost the registry host to use (if this is specified,
* no implicit creation of a RMI registry will happen)
* @param registryPort the registry port to use
* @param clientSocketFactory the RMI client socket factory for the registry (if any)
* @param serverSocketFactory the RMI server socket factory for the registry (if any)
* @return the RMI registry
* @throws java.rmi.RemoteException if the registry couldn't be located or created
*/
protected Registry getRegistry(String registryHost, int registryPort,
RMIClientSocketFactory clientSocketFactory, RMIServerSocketFactory serverSocketFactory)
throws RemoteException {
if (registryHost != null) {
// Host explicitly specified: only lookup possible.
if (logger.isInfoEnabled()) {
logger.info("Looking for RMI registry at port '" + registryPort + "' of host [" + registryHost + "]");
}
Registry reg = LocateRegistry.getRegistry(registryHost, registryPort, clientSocketFactory);
testRegistry(reg);
return reg;
}
else {
return getRegistry(registryPort, clientSocketFactory, serverSocketFactory);
}
}
示例4: newServerSocket
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
/**
* Return new server socket to listen for connections on this endpoint.
*/
ServerSocket newServerSocket() throws IOException {
if (TCPTransport.tcpLog.isLoggable(Log.VERBOSE)) {
TCPTransport.tcpLog.log(Log.VERBOSE,
"creating server socket on " + this);
}
RMIServerSocketFactory serverFactory = ssf;
if (serverFactory == null) {
serverFactory = chooseFactory();
}
ServerSocket server = serverFactory.createServerSocket(listenPort);
// if we listened on an anonymous port, set the default port
// (for this socket factory)
if (listenPort == 0)
setDefaultPort(server.getLocalPort(), csf, ssf);
return server;
}
示例5: ActivationGroupImpl
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
/**
* Creates a default activation group implementation.
*
* @param id the group's identifier
* @param data ignored
*/
public ActivationGroupImpl(ActivationGroupID id, MarshalledObject<?> data)
throws RemoteException
{
super(id);
groupID = id;
/*
* Unexport activation group impl and attempt to export it on
* an unshared anonymous port. See 4692286.
*/
unexportObject(this, true);
RMIServerSocketFactory ssf = new ServerSocketFactoryImpl();
UnicastRemoteObject.exportObject(this, 0, null, ssf);
if (System.getSecurityManager() == null) {
try {
// Provide a default security manager.
System.setSecurityManager(new SecurityManager());
} catch (Exception e) {
throw new RemoteException("unable to set security manager", e);
}
}
}
示例6: UnicastConnectionManager
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
/**
* Server UnicastConnectionManager constructor
*/
private UnicastConnectionManager(int port, RMIServerSocketFactory ssf) throws RemoteException {
try {
ssock = ssf.createServerSocket(port);
serverPort = ssock.getLocalPort();
}
catch (IOException ioex) {
ssock = null;
serverPort = 0;
throw new java.rmi.server.ExportException("can not create Server Socket on port " + port,ioex);
}
// Note that for compatibility the serverName is "localhost",
// not UnicastConnectionManager.localhost, which is the name
// of the local box. A server listening on localhost:port is
// listening on the loopback interface, 127.0.0.1, but
// UnicastConnectionManager.localhost is an externally
// accessible IP address.
serverName = "localhost";
serverFactory = ssf;
clientFactory = null;
}
示例7: afterPropertiesSet
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
@Override
public void afterPropertiesSet() throws Exception {
// Check socket factories for registry.
if (this.clientSocketFactory instanceof RMIServerSocketFactory) {
this.serverSocketFactory = (RMIServerSocketFactory) this.clientSocketFactory;
}
if ((this.clientSocketFactory != null && this.serverSocketFactory == null) ||
(this.clientSocketFactory == null && this.serverSocketFactory != null)) {
throw new IllegalArgumentException(
"Both RMIClientSocketFactory and RMIServerSocketFactory or none required");
}
// Fetch RMI registry to expose.
this.registry = getRegistry(this.host, this.port, this.clientSocketFactory, this.serverSocketFactory);
}
示例8: TCPEndpoint
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
/**
* Create a custom socket factory endpoint for a specified host and port.
* This should not be used by external classes to create endpoints
* for servers in this VM; use getLocalEndpoint instead.
*/
public TCPEndpoint(String host, int port, RMIClientSocketFactory csf,
RMIServerSocketFactory ssf)
{
if (host == null)
host = "";
this.host = host;
this.port = port;
this.csf = csf;
this.ssf = ssf;
}
示例9: getLocalEndpoint
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
public static TCPEndpoint getLocalEndpoint(int port,
RMIClientSocketFactory csf,
RMIServerSocketFactory ssf)
{
/*
* Find mapping for an endpoint key to the list of local unique
* endpoints for this client/server socket factory pair (perhaps
* null) for the specific port.
*/
TCPEndpoint ep = null;
synchronized (localEndpoints) {
TCPEndpoint endpointKey = new TCPEndpoint(null, port, csf, ssf);
LinkedList<TCPEndpoint> epList = localEndpoints.get(endpointKey);
String localHost = resampleLocalHost();
if (epList == null) {
/*
* Create new endpoint list.
*/
ep = new TCPEndpoint(localHost, port, csf, ssf);
epList = new LinkedList<TCPEndpoint>();
epList.add(ep);
ep.listenPort = port;
ep.transport = new TCPTransport(epList);
localEndpoints.put(endpointKey, epList);
if (TCPTransport.tcpLog.isLoggable(Log.BRIEF)) {
TCPTransport.tcpLog.log(Log.BRIEF,
"created local endpoint for socket factory " + ssf +
" on port " + port);
}
} else {
synchronized (epList) {
ep = epList.getLast();
String lastHost = ep.host;
int lastPort = ep.port;
TCPTransport lastTransport = ep.transport;
// assert (localHost == null ^ lastHost != null)
if (localHost != null && !localHost.equals(lastHost)) {
/*
* Hostname has been updated; add updated endpoint
* to list.
*/
if (lastPort != 0) {
/*
* Remove outdated endpoints only if the
* port has already been set on those endpoints.
*/
epList.clear();
}
ep = new TCPEndpoint(localHost, lastPort, csf, ssf);
ep.listenPort = port;
ep.transport = lastTransport;
epList.add(ep);
}
}
}
}
return ep;
}
示例10: LiveRef
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
/**
* Construct a new live reference for a server object in the local
* address space, to use sockets of the specified type.
*/
public LiveRef(int port,
RMIClientSocketFactory csf,
RMIServerSocketFactory ssf)
{
this((new ObjID()), port, csf, ssf);
}
示例11: startActivation
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
/**
* Recover activation state from the reliable log and initialize
* activation services.
*/
private static void startActivation(int port,
RMIServerSocketFactory ssf,
String logName,
String[] childArgs)
throws Exception
{
ReliableLog log = new ReliableLog(logName, new ActLogHandler());
Activation state = (Activation) log.recover();
state.init(port, ssf, log, childArgs);
}
示例12: SystemRegistryImpl
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
SystemRegistryImpl(int port,
RMIClientSocketFactory csf,
RMIServerSocketFactory ssf,
ActivationSystem systemStub)
throws RemoteException
{
super(port, csf, ssf);
this.systemStub = systemStub;
}
示例13: ActivatorImpl
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
/**
* Construct a new Activator on a specified port.
*/
ActivatorImpl(int port, RMIServerSocketFactory ssf)
throws RemoteException
{
/* Server ref must be created and assigned before remote object
* 'this' can be exported.
*/
LiveRef lref =
new LiveRef(new ObjID(ObjID.ACTIVATOR_ID), port, null, ssf);
UnicastServerRef uref = new UnicastServerRef(lref);
ref = uref;
uref.exportObject(this, null, false);
}
示例14: ActivationSystemImpl
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
ActivationSystemImpl(int port, RMIServerSocketFactory ssf)
throws RemoteException
{
/* Server ref must be created and assigned before remote object
* 'this' can be exported.
*/
LiveRef lref = new LiveRef(new ObjID(4), port, null, ssf);
UnicastServerRef uref = new UnicastServerRef(lref);
ref = uref;
uref.exportObject(this, null);
}
示例15: SingleEntryRegistry
import java.rmi.server.RMIServerSocketFactory; //導入依賴的package包/類
SingleEntryRegistry(int port,
RMIClientSocketFactory csf,
RMIServerSocketFactory ssf,
String name,
Remote object)
throws RemoteException {
super(port, csf, ssf);
this.name = name;
this.object = object;
}