• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LiveRef类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getObject

import sun.rmi.transport.LiveRef; //导入依赖的package包/类
public Registry getObject ( final String command ) throws Exception {

        String host;
        int port;
        int sep = command.indexOf(':');
        if ( sep < 0 ) {
            port = new Random().nextInt(65535);
            host = command;
        }
        else {
            host = command.substring(0, sep);
            port = Integer.valueOf(command.substring(sep + 1));
        }
        ObjID id = new ObjID(new Random().nextInt()); // RMI registry
        TCPEndpoint te = new TCPEndpoint(host, port);
        UnicastRef ref = new UnicastRef(new LiveRef(id, te, false));
        RemoteObjectInvocationHandler obj = new RemoteObjectInvocationHandler(ref);
        Registry proxy = (Registry) Proxy.newProxyInstance(JRMPClient.class.getClassLoader(), new Class[] {
            Registry.class
        }, obj);
        return proxy;
    }
 
开发者ID:hucheat,项目名称:APacheSynapseSimplePOC,代码行数:23,代码来源:JRMPClient.java


示例2: getObject

import sun.rmi.transport.LiveRef; //导入依赖的package包/类
public Registry getObject ( String connection ) throws Exception {

        String host;
        int port;
        int sep = connection.indexOf(':');
        if ( sep < 0 ) {
            port = new Random().nextInt(65535);
            host = connection;
        }
        else {
            host = connection.substring(0, sep);
            port = Integer.valueOf(connection.substring(sep + 1));
        }
        ObjID id = new ObjID(new Random().nextInt()); // RMI registry
        TCPEndpoint te = new TCPEndpoint(host, port);
        UnicastRef ref = new UnicastRef(new LiveRef(id, te, false));
        RemoteObjectInvocationHandler obj = new RemoteObjectInvocationHandler(ref);
        Registry proxy = (Registry) Proxy.newProxyInstance(JRMPClient.class.getClassLoader(), new Class[] {
            Registry.class
        }, obj);
        return proxy;
    }
 
开发者ID:pimps,项目名称:ysoserial-modified,代码行数:23,代码来源:JRMPClient.java


示例3: getRegistryPort

import sun.rmi.transport.LiveRef; //导入依赖的package包/类
/**
 * Returns the port number the RMI {@link Registry} is running on.
 *
 * @param registry the registry to find the port of.
 * @return the port number the registry is using.
 * @throws RuntimeException if there was a problem getting the port number.
 */
public static int getRegistryPort(Registry registry) {
    int port = -1;

    try {
        RemoteRef remoteRef = ((RegistryImpl)registry).getRef();
        LiveRef liveRef = ((UnicastServerRef)remoteRef).getLiveRef();
        Endpoint endpoint = liveRef.getChannel().getEndpoint();
        TCPEndpoint tcpEndpoint = (TCPEndpoint) endpoint;
        port = tcpEndpoint.getPort();
    } catch (Exception ex) {
        throw new RuntimeException("Error getting registry port.", ex);
    }

    return port;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:TestLibrary.java


示例4: UnicastServerRef

import sun.rmi.transport.LiveRef; //导入依赖的package包/类
@Test(dataProvider = "bindData")
public void UnicastServerRef(String name, Object obj, int expectedFilterCount) throws RemoteException {
    try {
        RemoteImpl impl = RemoteImpl.create();
        UnicastServerRef ref = new UnicastServerRef(new LiveRef(0), impl.checker);

        Echo client = (Echo) ref.exportObject(impl, null, false);

        int count = client.filterCount(obj);
        System.out.printf("count: %d, obj: %s%n", count, obj);
        Assert.assertEquals(count, expectedFilterCount, "wrong number of filter calls");
    } catch (RemoteException rex) {
        if (expectedFilterCount == -1 &&
                UnmarshalException.class.equals(rex.getCause().getClass()) &&
                InvalidClassException.class.equals(rex.getCause().getCause().getClass())) {
            return; // normal expected exception
        }
        rex.printStackTrace();
        Assert.fail("unexpected remote exception", rex);
    } catch (Exception ex) {
        Assert.fail("unexpected exception", ex);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:FilterUSRTest.java


示例5: ActivatableServerRef

import sun.rmi.transport.LiveRef; //导入依赖的package包/类
/**
 * Construct a Unicast server remote reference to be exported
 * on the specified port.
 */
public ActivatableServerRef(ActivationID id, int port,
                            RMIClientSocketFactory csf,
                            RMIServerSocketFactory ssf)
{
    super(new LiveRef(port, csf, ssf));
    this.id = id;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:ActivatableServerRef.java


示例6: ActivatorImpl

import sun.rmi.transport.LiveRef; //导入依赖的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


示例7: ActivationSystemImpl

import sun.rmi.transport.LiveRef; //导入依赖的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


示例8: checkStub

import sun.rmi.transport.LiveRef; //导入依赖的package包/类
private static void checkStub(Remote stub,
                              Class<? extends Remote> stubClass) {
    // Check remote stub is from the expected class.
    //
    if (stub.getClass() != stubClass) {
        if (!Proxy.isProxyClass(stub.getClass())) {
            throw new SecurityException(
                "Expecting a " + stubClass.getName() + " stub!");
        } else {
            InvocationHandler handler = Proxy.getInvocationHandler(stub);
            if (handler.getClass() != RemoteObjectInvocationHandler.class) {
                throw new SecurityException(
                    "Expecting a dynamic proxy instance with a " +
                    RemoteObjectInvocationHandler.class.getName() +
                    " invocation handler!");
            } else {
                stub = (Remote) handler;
            }
        }
    }
    // Check RemoteRef in stub is from the expected class
    // "sun.rmi.server.UnicastRef2".
    //
    RemoteRef ref = ((RemoteObject)stub).getRef();
    if (ref.getClass() != UnicastRef2.class) {
        throw new SecurityException(
            "Expecting a " + UnicastRef2.class.getName() +
            " remote reference in stub!");
    }
    // Check RMIClientSocketFactory in stub is from the expected class
    // "javax.rmi.ssl.SslRMIClientSocketFactory".
    //
    LiveRef liveRef = ((UnicastRef2)ref).getLiveRef();
    RMIClientSocketFactory csf = liveRef.getClientSocketFactory();
    if (csf == null || csf.getClass() != SslRMIClientSocketFactory.class) {
        throw new SecurityException(
            "Expecting a " + SslRMIClientSocketFactory.class.getName() +
            " RMI client socket factory in stub!");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:ProxyClient.java


示例9: makeRegistryImpl

import sun.rmi.transport.LiveRef; //导入依赖的package包/类
private static Object makeRegistryImpl ( String codebase, String clazz ) throws IllegalArgumentException, Exception {
    Class<?> regcl = Class.forName("sun.management.jmxremote.SingleEntryRegistry");
    Object reg = Reflections.createWithoutConstructor(regcl);
    Reflections.setFieldValue(reg, "name", "exp");

    TCPEndpoint te = new TCPEndpoint("127.0.0.1", 1337);
    LiveRef liveRef = new LiveRef(new ObjID(), te, true);
    UnicastRef value = new UnicastRef(liveRef);
    Reflections.setFieldValue(reg, "ref", value);
    Reflections.setFieldValue(reg, "object", makeReference(codebase, clazz));
    return reg;
}
 
开发者ID:mbechler,项目名称:marshalsec,代码行数:13,代码来源:JDKUtil.java


示例10: UnicastServerRef2

import sun.rmi.transport.LiveRef; //导入依赖的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


示例11: ActivationSystemImpl

import sun.rmi.transport.LiveRef; //导入依赖的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 SameHostOnlyServerRef(lref,
            "ActivationSystem.nonLocalAccess");
    ref = uref;
    uref.exportObject(this, null);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:Activation.java


示例12: checkStub

import sun.rmi.transport.LiveRef; //导入依赖的package包/类
private static void checkStub(Remote stub,
        Class<?> stubClass) {

    // Check remote stub is from the expected class.
    //
    if (stub.getClass() != stubClass) {
        if (!Proxy.isProxyClass(stub.getClass())) {
            throw new SecurityException(
                    "Expecting a " + stubClass.getName() + " stub!");
        } else {
            InvocationHandler handler = Proxy.getInvocationHandler(stub);
            if (handler.getClass() != RemoteObjectInvocationHandler.class)
                throw new SecurityException(
                        "Expecting a dynamic proxy instance with a " +
                        RemoteObjectInvocationHandler.class.getName() +
                        " invocation handler!");
            else
                stub = (Remote) handler;
        }
    }

    // Check RemoteRef in stub is from the expected class
    // "sun.rmi.server.UnicastRef2".
    //
    RemoteRef ref = ((RemoteObject)stub).getRef();
    if (ref.getClass() != UnicastRef2.class)
        throw new SecurityException(
                "Expecting a " + UnicastRef2.class.getName() +
                " remote reference in stub!");

    // Check RMIClientSocketFactory in stub is from the expected class
    // "javax.rmi.ssl.SslRMIClientSocketFactory".
    //
    LiveRef liveRef = ((UnicastRef2)ref).getLiveRef();
    RMIClientSocketFactory csf = liveRef.getClientSocketFactory();
    if (csf == null || csf.getClass() != SslRMIClientSocketFactory.class)
        throw new SecurityException(
                "Expecting a " + SslRMIClientSocketFactory.class.getName() +
                " RMI client socket factory in stub!");
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:41,代码来源:RMIConnector.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Injectee类代码示例发布时间:2022-05-21
下一篇:
Java SessionOutputBuffer类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap