public final void initRepository() throws IOException { Operation.initPool(CLEANUP_THRESHOLD_OPERATION); // Search for log files: plog then clog, reads it, then apply all // committed operation, finally deletes it. lockFile = new File(dir, LOCK); if (! lockFile.createNewFile()) { logmon.log(BasicLevel.FATAL, "ATransaction.init(): Either the server is already running, " + "either you have to remove lock file: " + lockFile.getAbsolutePath()); throw new IOException("Transaction already running."); } lockFile.deleteOnExit(); logFilePN = new File(dir, LOG); plogFilePN = new File(dir, PLOG); Hashtable tempLog = new Hashtable(); restart(tempLog, logFilePN); restart(tempLog, plogFilePN); commit(tempLog); plogFilePN.delete(); logFilePN.delete(); clog = new Hashtable(CLEANUP_THRESHOLD_OPERATION / 2); plog = new Hashtable(CLEANUP_THRESHOLD_OPERATION / 2); baos = new ByteArrayOutputStream(10 * Kb); dos = new DataOutputStream(baos); newLogFile(); lock = new Object(); garbage = false; gThread = new Thread(this, "TGarbage"); gThread.start(); }
public final void initRepository() throws IOException { Operation.initPool(CLEANUP_THRESHOLD_OPERATION); // Search for log files: plog then clog, reads it, then apply all // committed operation, finally deletes it. lockFile = new File(dir, LOCK); if (! lockFile.createNewFile()) { logmon.log(BasicLevel.FATAL, "ATransaction.init(): Either the server is already running, " + "either you have to remove lock file: " + lockFile.getAbsolutePath()); throw new IOException("Transaction already running."); } lockFile.deleteOnExit(); logFilePN = new File(dir, LOG); plogFilePN = new File(dir, PLOG); Hashtable tempLog = new Hashtable(); restart(tempLog, logFilePN); restart(tempLog, plogFilePN); commit(tempLog); plogFilePN.delete(); logFilePN.delete(); clog = new Hashtable(CLEANUP_THRESHOLD_OPERATION / 2); plog = new Hashtable(CLEANUP_THRESHOLD_OPERATION / 2); baos = new ByteArrayOutputStream(10 * Kb); dos = new DataOutputStream(baos); newLogFile(); lock = new Object(); garbage = false; gThread = new Thread(this, "TGarbage"); gThread.start(); }
Operation.initPool(LogThresholdOperation); saveProperties(dir);
Operation.initPool(LogThresholdOperation); saveProperties(dir);
Operation.initPool(LogThresholdOperation);
public final void initRepository() throws IOException { LogMemoryCapacity = getInteger("Transaction.LogMemoryCapacity", LogMemoryCapacity).intValue(); MaxLogFileSize = getInteger("Transaction.MaxLogFileSize", MaxLogFileSize / Mb).intValue() * Mb; nbLogFile = getInteger("Transaction.NbLogFile", nbLogFile).intValue(); minObjInLog = getInteger("Transaction.minObjInLog", minObjInLog).intValue(); LogThresholdOperation = getInteger("Transaction.LogThresholdOperation", LogThresholdOperation).intValue(); Operation.initPool(LogThresholdOperation); try { repositoryImpl = getProperty("Transaction.RepositoryImpl", repositoryImpl); repository = (Repository) Class.forName(repositoryImpl).newInstance(); repository.init(this, dir); } catch (ClassNotFoundException exc) { logmon.log(BasicLevel.FATAL, "NTransaction, cannot initializes the repository ", exc); throw new IOException(exc.getMessage()); } catch (InstantiationException exc) { logmon.log(BasicLevel.FATAL, "NTransaction, cannot initializes the repository ", exc); throw new IOException(exc.getMessage()); } catch (IllegalAccessException exc) { logmon.log(BasicLevel.FATAL, "NTransaction, cannot initializes the repository ", exc); throw new IOException(exc.getMessage()); } syncOnWrite = getBoolean("Transaction.SyncOnWrite"); useLockFile = getBoolean("Transaction.UseLockFile"); logManager = new LogManager(dir, repository, useLockFile, syncOnWrite); }
Operation.initPool(LogThresholdOperation);
Operation.initPool(LogThresholdOperation);