本文整理汇总了Java中sun.rmi.log.ReliableLog类的典型用法代码示例。如果您正苦于以下问题:Java ReliableLog类的具体用法?Java ReliableLog怎么用?Java ReliableLog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReliableLog类属于sun.rmi.log包,在下文中一共展示了ReliableLog类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import sun.rmi.log.ReliableLog; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
System.err.println("\nRegression test for bug 4652922\n");
System.setProperty("sun.rmi.log.class", MyLogFile.class.getName());
//System.setProperty("sun.rmi.log.debug", "true");
log = new ReliableLog(".", new TestLogHandler(counter), false);
writeUpdatesCrashAndRecover(10, 1, false, 10);
writeUpdatesCrashAndRecover(10, 1, true, 20);
writeUpdatesCrashAndRecover(10, 2, true, 30);
writeUpdatesCrashAndRecover(9, 2, false, 40);
writeUpdatesCrashAndRecover(9, 3, true, 50);
log.close();
}
示例2: startActivation
import sun.rmi.log.ReliableLog; //导入依赖的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);
}
示例3: main
import sun.rmi.log.ReliableLog; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
SnapshotSize handler = new SnapshotSize();
ReliableLog log = new ReliableLog(".", handler);
if (log.snapshotSize() != handler.lastSnapshotSize) {
throw new Error();
}
String[] snapshots = { "some", "sample", "objects", "to", "snapshot" };
for (int i = 0; i < snapshots.length; i++) {
log.snapshot(snapshots[i]);
if (log.snapshotSize() != handler.lastSnapshotSize) {
throw new Error();
}
}
}
示例4: init
import sun.rmi.log.ReliableLog; //导入依赖的package包/类
/**
* Initialize the Activation instantiation; start activation
* services.
*/
private void init(int port,
RMIServerSocketFactory ssf,
ReliableLog log,
String[] childArgs)
throws Exception
{
// initialize
this.log = log;
numUpdates = 0;
shutdownHook = new ShutdownHook();
groupSemaphore = getInt("sun.rmi.activation.groupThrottle", 3);
groupCounter = 0;
Runtime.getRuntime().addShutdownHook(shutdownHook);
// Use array size of 0, since the value from calling size()
// may be out of date by the time toArray() is called.
ActivationGroupID[] gids =
groupTable.keySet().toArray(new ActivationGroupID[0]);
synchronized (startupLock = new Object()) {
// all the remote methods briefly synchronize on startupLock
// (via checkShutdown) to make sure they don't happen in the
// middle of this block. This block must not cause any such
// incoming remote calls to happen, or deadlock would result!
activator = new ActivatorImpl(port, ssf);
activatorStub = (Activator) RemoteObject.toStub(activator);
system = new ActivationSystemImpl(port, ssf);
systemStub = (ActivationSystem) RemoteObject.toStub(system);
monitor = new ActivationMonitorImpl(port, ssf);
initCommand(childArgs);
registry = new SystemRegistryImpl(port, null, ssf, systemStub);
if (ssf != null) {
synchronized (initLock) {
initDone = true;
initLock.notifyAll();
}
}
}
startupLock = null;
// restart services
for (int i = gids.length; --i >= 0; ) {
try {
getGroupEntry(gids[i]).restartServices();
} catch (UnknownGroupException e) {
System.err.println(
getTextResource("rmid.restart.group.warning"));
e.printStackTrace();
}
}
}