Beispiel #1
0
        private void _InitResume(IRegionManager regionmgr)
        {
            this.rootblockstream = regionmgr.readRegionAddr(0).getNewAccessStream();
            root = Util.readStruct<RootBlockHeader>(rootblockstream);
            if (!root.IsValid()) {
                throw new Exception("invalid root block");
            }
            RootBlockLogSegment[] log_segments = new RootBlockLogSegment[root.num_logsegments];
            for (int i=0;i<root.num_logsegments;i++) {
                log_segments[i] = Util.readStruct<RootBlockLogSegment>(rootblockstream);
            }

            // setup the log segment handler
            this.log_handler = new LogSegmentsHandler(this,regionmgr, log_segments);

            foreach (LogCmd cmd in log_handler.recoverLogCmds()) {
                 receiver.handleCommand(cmd.cmd, cmd.cmddata);
            }
        }
Beispiel #2
0
        public void Dispose()
        {
            System.Console.WriteLine("LogWriter Dispose");

            if (this.commitThread != null) {
                commitThread_should_die = true;
                groupCommitWorkerHndl.Set();
                if (!this.commitThread.Join(2)) {
                    System.Console.WriteLine("commitThread join Timeout");
                    this.commitThread.Abort();
                } else {
                    System.Console.WriteLine("commitThread rejoined");
                }
            } else {
                System.Console.WriteLine("no committhread to dispose of");
            }
            if (this.log_handler != null) { this.log_handler.Dispose(); this.log_handler = null; }
            if (this.rootblockstream != null) { this.rootblockstream.Close(); this.rootblockstream = null; }
        }