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


Java RMIClientSocketFactory类代码示例

本文整理汇总了Java中java.rmi.server.RMIClientSocketFactory的典型用法代码示例。如果您正苦于以下问题:Java RMIClientSocketFactory类的具体用法?Java RMIClientSocketFactory怎么用?Java RMIClientSocketFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RMIClientSocketFactory类属于java.rmi.server包,在下文中一共展示了RMIClientSocketFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRegistry

import java.rmi.server.RMIClientSocketFactory; //导入依赖的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.RMIClientSocketFactory; //导入依赖的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.RMIClientSocketFactory; //导入依赖的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: TCPEndpoint

import java.rmi.server.RMIClientSocketFactory; //导入依赖的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

示例5: getLocalEndpoint

import java.rmi.server.RMIClientSocketFactory; //导入依赖的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

示例6: LiveRef

import java.rmi.server.RMIClientSocketFactory; //导入依赖的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

示例7: remoteEquals

import java.rmi.server.RMIClientSocketFactory; //导入依赖的package包/类
public boolean remoteEquals(Object obj) {
    if (obj != null && obj instanceof LiveRef) {
        LiveRef ref = (LiveRef) obj;

        TCPEndpoint thisEp = ((TCPEndpoint) ep);
        TCPEndpoint refEp = ((TCPEndpoint) ref.ep);

        RMIClientSocketFactory thisClientFactory =
            thisEp.getClientSocketFactory();
        RMIClientSocketFactory refClientFactory =
            refEp.getClientSocketFactory();

        /**
         * Fix for 4254103: LiveRef.remoteEquals should not fail
         * if one of the objects in the comparison has a null
         * server socket.  Comparison should only consider the
         * following criteria:
         *
         * hosts, ports, client socket factories and object IDs.
         */
        if (thisEp.getPort() != refEp.getPort() ||
            !thisEp.getHost().equals(refEp.getHost()))
        {
            return false;
        }
        if ((thisClientFactory == null) ^ (refClientFactory == null)) {
            return false;
        }
        if ((thisClientFactory != null) &&
            !((thisClientFactory.getClass() ==
               refClientFactory.getClass()) &&
              (thisClientFactory.equals(refClientFactory))))
        {
            return false;
        }
        return (id.equals(ref.id));
    } else {
        return false;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:LiveRef.java

示例8: SystemRegistryImpl

import java.rmi.server.RMIClientSocketFactory; //导入依赖的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

示例9: SingleEntryRegistry

import java.rmi.server.RMIClientSocketFactory; //导入依赖的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

示例10: newJRMPServer

import java.rmi.server.RMIClientSocketFactory; //导入依赖的package包/类
private static RMIServerImpl newJRMPServer(Map<String, ?> env, int port)
        throws IOException {
    RMIClientSocketFactory csf = (RMIClientSocketFactory)
        env.get(RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE);
    RMIServerSocketFactory ssf = (RMIServerSocketFactory)
        env.get(RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE);
    return new RMIJRMPServerImpl(port, csf, ssf, env);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:RMIConnectorServer.java

示例11: UnicastServerRef2

import java.rmi.server.RMIClientSocketFactory; //导入依赖的package包/类
/**
 * Construct a Unicast server remote reference to be exported
 * on the specified port.
 */
public UnicastServerRef2(int port,
                         RMIClientSocketFactory csf,
                         RMIServerSocketFactory ssf)
{
    super(new LiveRef(port, csf, ssf));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:UnicastServerRef2.java

示例12: RMIJRMPServerImpl

import java.rmi.server.RMIClientSocketFactory; //导入依赖的package包/类
/**
 * <p>Creates a new {@link RMIServer} object that will be exported
 * on the given port using the given socket factories.</p>
 *
 * @param port the port on which this object and the {@link
 * RMIConnectionImpl} objects it creates will be exported.  Can be
 * zero, to indicate any available port.
 *
 * @param csf the client socket factory for the created RMI
 * objects.  Can be null.
 *
 * @param ssf the server socket factory for the created RMI
 * objects.  Can be null.
 *
 * @param env the environment map.  Can be null.
 *
 * @exception IOException if the {@link RMIServer} object
 * cannot be created.
 *
 * @exception IllegalArgumentException if <code>port</code> is
 * negative.
 */
public RMIJRMPServerImpl(int port,
                         RMIClientSocketFactory csf,
                         RMIServerSocketFactory ssf,
                         Map<String,?> env)
        throws IOException {

    super(env);

    if (port < 0)
        throw new IllegalArgumentException("Negative port: " + port);

    this.port = port;
    this.csf = csf;
    this.ssf = ssf;
    this.env = (env == null) ? Collections.<String, Object>emptyMap() : env;

    String[] credentialsTypes
            = (String[]) this.env.get(EnvHelp.CREDENTIAL_TYPES);
    List<String> types = null;
    if (credentialsTypes != null) {
        types = new ArrayList<>();
        for (String type : credentialsTypes) {
            if (type == null) {
                throw new IllegalArgumentException("A credential type is null.");
            }
            ReflectUtil.checkPackageAccess(type);
            types.add(type);
        }
    }
    exportedWrapper = types != null ?
            new ExportedWrapper(this, types) :
            null;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:56,代码来源:RMIJRMPServerImpl.java

示例13: exportObject

import java.rmi.server.RMIClientSocketFactory; //导入依赖的package包/类
public Remote exportObject(Remote obj,
                           int port,
                           RMIClientSocketFactory csf,
                           RMIServerSocketFactory ssf)
    throws RemoteException {
    System.out.println("CustomRMIExporter::exportObject():: " +
                       "Remote = " + obj);
    if (obj.toString().startsWith(
            "javax.management.remote.rmi.RMIJRMPServerImpl"))
        rmiServerExported = true;
    if (obj.toString().startsWith(
            "javax.management.remote.rmi.RMIConnectionImpl"))
        rmiConnectionExported = true;
    return UnicastRemoteObject.exportObject(obj, port, csf, ssf);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:RMIExporterTest.java

示例14: SingleEntryRegistry

import java.rmi.server.RMIClientSocketFactory; //导入依赖的package包/类
SingleEntryRegistry(int port,
                    RMIClientSocketFactory csf,
                    RMIServerSocketFactory ssf,
                    String name,
                    Remote object)
        throws RemoteException {
    super(port, csf, ssf, SingleEntryRegistry::singleRegistryFilter);
    this.name = name;
    this.object = object;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:SingleEntryRegistry.java

示例15: setDefaultPort

import java.rmi.server.RMIClientSocketFactory; //导入依赖的package包/类
/**
 * Set the port of the (shared) default endpoint object.
 * When first created, it contains port 0 because the transport
 * hasn't tried to listen to get assigned a port, or if listening
 * failed, a port hasn't been assigned from the server.
 */
static void setDefaultPort(int port, RMIClientSocketFactory csf,
                           RMIServerSocketFactory ssf)
{
    TCPEndpoint endpointKey = new TCPEndpoint(null, 0, csf, ssf);

    synchronized (localEndpoints) {
        LinkedList<TCPEndpoint> epList = localEndpoints.get(endpointKey);

        synchronized (epList) {
            int size = epList.size();
            TCPEndpoint lastEp = epList.getLast();

            for (TCPEndpoint ep : epList) {
                ep.port = port;
            }
            if (size > 1) {
                /*
                 * Remove all but the last element of the list
                 * (which contains the most recent hostname).
                 */
                epList.clear();
                epList.add(lastEp);
            }
        }

        /*
         * Allow future exports to use the actual bound port
         * explicitly (see 6269166).
         */
        TCPEndpoint newEndpointKey = new TCPEndpoint(null, port, csf, ssf);
        localEndpoints.put(newEndpointKey, epList);

        if (TCPTransport.tcpLog.isLoggable(Log.BRIEF)) {
            TCPTransport.tcpLog.log(Log.BRIEF,
                "default port for server socket factory " + ssf +
                " and client socket factory " + csf +
                " set to " + port);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:47,代码来源:TCPEndpoint.java


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