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


Java RemoteServer.setLog方法代码示例

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


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

示例1: testLog

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
public void testLog() {
    SecurityManager sm = new SecurityManager() {
        @Override
        public void checkPermission(Permission perm) {
            return;
        }
    };
    SecurityManager previous = System.getSecurityManager();
    System.setSecurityManager(sm);
    try {
        RemoteServer.setLog(null);
        assertNull(RemoteServer.getLog());
    } finally {
        System.setSecurityManager(previous);
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:17,代码来源:RemoteServerTest.java

示例2: checkPermissions

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
private static void checkPermissions() {
    SecurityException ex = null;
    try {
        // should fail for lack of LoggingPermission "control"
        RemoteServer.setLog(System.err);
    } catch (SecurityException e) {
        System.err.println("security excepton caught correctly");
        ex = e;
    }
    if (ex == null) {
        TestLibrary.bomb("able to set log without permission");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:CheckLogging.java

示例3: main

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
static public void main(String[] args) throws RemoteException{
        System.out.println("hello i am the server");

        LocateRegistry.createRegistry(Registry.REGISTRY_PORT);

        DiceRMI diceRMI = new DiceRMIImpl();
        //DiceRMI stub = (DiceRMI) UnicastRemoteObject.exportObject(diceRMI, 0);
        RemoteServer.setLog(System.out);

        Registry registry = LocateRegistry.getRegistry();
        registry.rebind( "DiceRMI", diceRMI );
//        registry.rebind( "192.168.99.101:1234/DiceRMI", stub );
        System.out.println( "DiceRMI angemeldet" );
    }
 
开发者ID:TorbenHaug,项目名称:VS,代码行数:15,代码来源:Main.java

示例4: testSetLog001

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
public void testSetLog001() {
    try {
        RemoteServer.setLog(null);
        assertNull("Not logger is set", RemoteServer.getLog());
    } catch (Throwable e) {
        fail("Failed with:" + e);
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:9,代码来源:TestRemoteServer.java

示例5: testSetLog002

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
public void testSetLog002() {
    try {
        RemoteServer.setLog(new ByteArrayOutputStream());
        assertNotNull("One logger is set", RemoteServer.getLog());
    } catch (Throwable e) {
        fail("Failed with:" + e);
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:9,代码来源:TestRemoteServer.java

示例6: testSetLog004

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
public void testSetLog004() {
    try {
        OutputStream outS = RemoteServer.getLog();
        RemoteServer.setLog(new PrintStream(new ByteArrayOutputStream()));
        RemoteServer.setLog(outS);
        assertSame(outS, RemoteServer.getLog());
    } catch (Throwable e) {
        fail("Failed with:" + e);
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:11,代码来源:TestRemoteServer.java

示例7: main

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
public static void main(String[] args) {
    RemoteServer.setLog(null);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:4,代码来源:SetLogNull.java

示例8: checkServerCallLog

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
/**
 * Check serverCallLog output
 */
private static void checkServerCallLog() throws Exception {
    ByteArrayOutputStream serverCallLog = new ByteArrayOutputStream();
    RemoteServer.setLog(serverCallLog);
    Naming.list(LOCATION);
    verifyLog(serverCallLog, "list");

    serverCallLog.reset();
    RemoteServer.setLog(null);
    PrintStream callStream = RemoteServer.getLog();
    if (callStream != null) {
        TestLibrary.bomb("call stream not null after calling " +
                         "setLog(null)");
    } else {
        System.err.println("call stream should be null and it is");
    }
    Naming.list(LOCATION);

    if (usingOld) {
        if (serverCallLog.toString().indexOf("UnicastServerRef") >= 0) {
            TestLibrary.bomb("server call logging not turned off");
        }
    } else if (serverCallLog.toByteArray().length != 0) {
        TestLibrary.bomb("call log contains output but it " +
                         "should be empty");
    }

    serverCallLog.reset();
    RemoteServer.setLog(serverCallLog);
    try {
        // generates a notbound exception
        Naming.lookup(LOCATION + "notthere");
    } catch (Exception e) {
    }
    verifyLog(serverCallLog, "exception");

    serverCallLog.reset();
    RemoteServer.setLog(serverCallLog);
    callStream = RemoteServer.getLog();
    callStream.println("bingo, this is a getLog test");
    verifyLog(serverCallLog, "bingo");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:45,代码来源:CheckLogging.java


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