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


Java IIOPHelper.isStub方法代码示例

本文整理汇总了Java中com.sun.jmx.remote.internal.IIOPHelper.isStub方法的典型用法代码示例。如果您正苦于以下问题:Java IIOPHelper.isStub方法的具体用法?Java IIOPHelper.isStub怎么用?Java IIOPHelper.isStub使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.jmx.remote.internal.IIOPHelper的用法示例。


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

示例1: encodeStubInAddress

import com.sun.jmx.remote.internal.IIOPHelper; //导入方法依赖的package包/类
/**
 * Encode a stub into the JMXServiceURL.
 * @param rmiServer The stub object to encode in the URL
 * @param attributes A Map containing environment parameters,
 *        built from the Map specified at this object creation.
 **/
private void encodeStubInAddress(
        RMIServer rmiServer, Map<String, ?> attributes)
        throws IOException {

    final String protocol, host;
    final int port;

    if (address == null) {
        if (IIOPHelper.isStub(rmiServer))
            protocol = "iiop";
        else
            protocol = "rmi";
        host = null; // will default to local host name
        port = 0;
    } else {
        protocol = address.getProtocol();
        host = (address.getHost().equals("")) ? null : address.getHost();
        port = address.getPort();
    }

    final String urlPath = encodeStub(rmiServer, attributes);

    address = new JMXServiceURL(protocol, host, port, urlPath);
}
 
开发者ID:Java8-CNAPI-Team,项目名称:Java8CN,代码行数:31,代码来源:RMIConnectorServer.java

示例2: encodeStub

import com.sun.jmx.remote.internal.IIOPHelper; //导入方法依赖的package包/类
/**
 * Returns the IOR of the given rmiServer.
 **/
static String encodeStub(
        RMIServer rmiServer, Map<String, ?> env) throws IOException {
    if (IIOPHelper.isStub(rmiServer))
        return "/ior/" + encodeIIOPStub(rmiServer, env);
    else
        return "/stub/" + encodeJRMPStub(rmiServer, env);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:RMIConnectorServer.java

示例3: connectStub

import com.sun.jmx.remote.internal.IIOPHelper; //导入方法依赖的package包/类
/**
 * <p>In order to be usable, an IIOP stub must be connected to an ORB.
 * The stub is automatically connected to the ORB if:
 * <ul>
 *     <li> It was returned by the COS naming</li>
 *     <li> Its server counterpart has been registered in COS naming
 *          through JNDI.</li>
 * </ul>
 * Otherwise, it is not connected. A stub which is deserialized
 * from Jini is not connected. A stub which is obtained from a
 * non registered RMIIIOPServerImpl is not a connected.<br>
 * A stub which is not connected can't be serialized, and thus
 * can't be registered in Jini. A stub which is not connected can't
 * be used to invoke methods on the server.
 * <p>
 * In order to palliate this, this method will connect the
 * given stub if it is not yet connected. If the given
 * <var>RMIServer</var> is not an instance of
 * {@link javax.rmi.CORBA.Stub javax.rmi.CORBA.Stub}, then the
 * method do nothing and simply returns that stub. Otherwise,
 * this method will attempt to connect the stub to an ORB as
 * follows:
 * <ul>
 * <li>This method looks in the provided <var>environment</var> for
 * the "java.naming.corba.orb" property. If it is found, the
 * referenced object (an {@link org.omg.CORBA.ORB ORB}) is used to
 * connect the stub. Otherwise, a new org.omg.CORBA.ORB is created
 * by calling {@link
 * org.omg.CORBA.ORB#init(String[], Properties)
 * org.omg.CORBA.ORB.init((String[])null,(Properties)null)}</li>
 * <li>The new created ORB is kept in a static
 * {@link WeakReference} and can be reused for connecting other
 * stubs. However, no reference is ever kept on the ORB provided
 * in the <var>environment</var> map, if any.</li>
 * </ul>
 * @param rmiServer A RMI Server Stub.
 * @param environment An environment map, possibly containing an ORB.
 * @return the given stub.
 * @exception IllegalArgumentException if the
 *      <tt>java.naming.corba.orb</tt> property is specified and
 *      does not point to an {@link org.omg.CORBA.ORB ORB}.
 * @exception IOException if the connection to the ORB failed.
 **/
static RMIServer connectStub(RMIServer rmiServer,
                             Map<String, ?> environment)
    throws IOException {
    if (IIOPHelper.isStub(rmiServer)) {
        try {
            IIOPHelper.getOrb(rmiServer);
        } catch (UnsupportedOperationException x) {
            // BAD_OPERATION
            IIOPHelper.connect(rmiServer, resolveOrb(environment));
        }
    }
    return rmiServer;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:57,代码来源:RMIConnector.java

示例4: connectStub

import com.sun.jmx.remote.internal.IIOPHelper; //导入方法依赖的package包/类
/**
 * <p>In order to be usable, an IIOP stub must be connected to an ORB.
 * The stub is automatically connected to the ORB if:
 * <ul>
 *     <li> It was returned by the COS naming</li>
 *     <li> Its server counterpart has been registered in COS naming
 *          through JNDI.</li>
 * </ul>
 * Otherwise, it is not connected. A stub which is deserialized
 * from Jini is not connected. A stub which is obtained from a
 * non registered RMIIIOPServerImpl is not a connected.<br>
 * A stub which is not connected can't be serialized, and thus
 * can't be registered in Jini. A stub which is not connected can't
 * be used to invoke methods on the server.
 * <p>
 * In order to palliate this, this method will connect the
 * given stub if it is not yet connected. If the given
 * <var>RMIServer</var> is not an instance of
 * {@link javax.rmi.CORBA.Stub javax.rmi.CORBA.Stub}, then the
 * method do nothing and simply returns that stub. Otherwise,
 * this method will attempt to connect the stub to an ORB as
 * follows:
 * <ul>
 * <p>This method looks in the provided <var>environment</var> for
 * the "java.naming.corba.orb" property. If it is found, the
 * referenced object (an {@link org.omg.CORBA.ORB ORB}) is used to
 * connect the stub. Otherwise, a new org.omg.CORBA.ORB is created
 * by calling {@link
 * org.omg.CORBA.ORB#init(String[], Properties)
 * org.omg.CORBA.ORB.init((String[])null,(Properties)null)}
 * <p>The new created ORB is kept in a static
 * {@link WeakReference} and can be reused for connecting other
 * stubs. However, no reference is ever kept on the ORB provided
 * in the <var>environment</var> map, if any.
 * </ul>
 * @param rmiServer A RMI Server Stub.
 * @param environment An environment map, possibly containing an ORB.
 * @return the given stub.
 * @exception IllegalArgumentException if the
 *      <tt>java.naming.corba.orb</tt> property is specified and
 *      does not point to an {@link org.omg.CORBA.ORB ORB}.
 * @exception IOException if the connection to the ORB failed.
 **/
static RMIServer connectStub(RMIServer rmiServer,
                             Map<String, ?> environment)
    throws IOException {
    if (IIOPHelper.isStub(rmiServer)) {
        try {
            IIOPHelper.getOrb(rmiServer);
        } catch (UnsupportedOperationException x) {
            // BAD_OPERATION
            IIOPHelper.connect(rmiServer, resolveOrb(environment));
        }
    }
    return rmiServer;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:57,代码来源:RMIConnector.java


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