Package sun.rmi.log

Examples of sun.rmi.log.ReliableLog


                                        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);
    }
View Full Code Here


        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);
View Full Code Here

        }

        /*
         * Recover
         */
        log = new ReliableLog(".", new TestLogHandler(null), false);
        try {
            System.err.println("recover log");
            counter = (Counter) log.recover();
            System.err.println("recovered counter value: " + counter.value());
            if (counter.value() != expectedCount) {
View Full Code Here

                        (new File(dir,"Old_Version_Number")).delete();
                    } catch (Exception e) {
                    }

                    Recovery handler = new Recovery();
                    ReliableLog log;
                    if (size == 4 && deathpoint == 6) {
                        Runtime.getRuntime().traceMethodCalls(true);
                    }
                    log = new ReliableLog(dir, handler);
                    if (size == 4 && deathpoint == 6) {
                        Runtime.getRuntime().traceMethodCalls(false);
                    }

                    // Generate a number of updates (size - 1) until failing
                    int i;
                    StringBuffer writ = new StringBuffer();
                    char[] u = new char[1];
                    for (i = 1; i < size; i++) {
                        u[0] = (char)(64 + (i % 26));
                        String update = new String(u);
                        handler.basicUpdate(update);
                        log.update(update, true);
                        writ.append(update);
                    }

                    // Fail
                    String f = ("FALL" + deathpoint);
                    boolean failed_as_desired = false;
                    try {
                        ReliableLog.fallOverPoint = deathpoint;
                        handler.basicUpdate(f);
                        log.update(f, true);
                        log.snapshot(handler);
                    } catch (InternalError e) {
                        if (!e.getMessage().equals(f))
                            throw e; // oops, not ours
                        failed_as_desired = true;
                    } finally {
                        ReliableLog.fallOverPoint = 0;
                        try {
                            log.close();
                        } catch (IOException ign) {
                        }
                    }

                    // deathpoint == 0 means that there is no deathpoint and we are testing
                    // undisastered behaviour.
                    if (!failed_as_desired && deathpoint != 0) {
                        System.err.println ("sun.rmi.log.ReliableLog is not instrumented for" +
                                            " this test; test skipped");
                        return;
                    }

                    // Now try to recover.
                    Recovery laz = new Recovery();
                    ReliableLog carbon = new ReliableLog(dir, laz);
                    Recovery thingy;
                    thingy = (Recovery)carbon.recover();
                    try {
                        carbon.close();
                    } catch (IOException ign) {
                    }

                    // Recovered thingy must be equal to writ or to writ + f, but nothing
                    // else (or in between).
View Full Code Here

    int lastSnapshotSize = -1;

    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();
            }
        }
    }
View Full Code Here

    static private void regtest(int updatesz, String dir, PrintStream lg, PrintStream out)
        throws Exception
    {
        try {
            LogAlignmentTest handler = new LogAlignmentTest();
            ReliableLog log = new ReliableLog (dir, handler, false);

            // Write a preamble update
            String c = "[";
            handler.basicUpdate (c);
            log.update (c, true);

            // Generate the requested size update (single chars)
            char[] up = new char[updatesz];
            int i;
            for (i = 0; i < updatesz; i++) {
                up[i] = (char)(65 + (i % 26));
            }
            c = new String (up);
            handler.basicUpdate (c);
            log.update (c, true);

            // Write it again, so we can misalign
            handler.basicUpdate (c);
            log.update (c, true);

            // Write the suffix
            c = "]";
            handler.basicUpdate (c);
            log.update (c, true);

            // Read it back using a new context.
            LogAlignmentTest handler2 = new LogAlignmentTest();
            ReliableLog carbon = new ReliableLog (dir, handler2, false);
            Object thingy = carbon.recover();

            // The report bit
            String orig = handler.contents;
            String news = ((LogAlignmentTest)thingy).contents;
            lg.println ("Original as saved: " + orig);
View Full Code Here

TOP

Related Classes of sun.rmi.log.ReliableLog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.