当前位置: 首页>>代码示例>>Java>>正文


Java RMIServerSocketFactory类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:AlfrescoRmiRegistryFactoryBean.java

示例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);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:RmiServiceExporter.java

示例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);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:RmiRegistryFactoryBean.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:TCPEndpoint.java

示例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);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:ActivationGroupImpl.java

示例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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:UnicastConnectionManager.java

示例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);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:RmiRegistryFactoryBean.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:TCPEndpoint.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:63,代码来源:TCPEndpoint.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:LiveRef.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:Activation.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:Activation.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:Activation.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:Activation.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:SingleEntryRegistry.java


注:本文中的java.rmi.server.RMIServerSocketFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。