public static void main(String[] args) throws Exception { if ("garbage".equals(args[0])) { NTransaction transaction = new NTransaction(); transaction.init(args[1]); transaction.stop(); } else if ("list".equals(args[0])) { } else { System.err.println("unknown command: " + args[0]); } } }
/** Method called when the timer expires. */ public void run() { if (logFile.garbageTimeOut > 0) { if (System.currentTimeMillis() > (logFile.lastGarbageTime + logFile.garbageTimeOut)) { garbage(); } } } }
/** * Returns a string representation for this object. * * @return A string representation of this object. */ public String toString() { StringBuffer strbuf = new StringBuffer(); strbuf.append('(').append(super.toString()); strbuf.append(",LogMemorySize=").append(getLogMemorySize()); strbuf.append(",LogFileSize=").append(getLogFileSize()); strbuf.append(",CommitCount=").append(getCommitCount()); strbuf.append(",GarbageCount=").append(getGarbageCount()); strbuf.append(",GarbageRatio=").append(getGarbageRatio()); strbuf.append(",NbSavedObjects=").append(getNbSavedObjects()); strbuf.append(",NbDeletedObjects=").append(getNbDeletedObjects()); strbuf.append(",NbBadDeletedObjects=").append(getNbBadDeletedObjects()); strbuf.append(",NbLoadedObjects=").append(getNbLoadedObjects()); strbuf.append(')'); return strbuf.toString(); }
public final void initRepository() throws IOException { LogMemoryCapacity = getInteger("NTLogMemoryCapacity", LogMemoryCapacity).intValue(); MaxLogFileSize = getInteger("NTLogFileSize", MaxLogFileSize / Mb).intValue() * Mb; MaxLogMemorySize = getInteger("NTLogMemorySize", MaxLogMemorySize / Kb).intValue() * Kb; LogThresholdOperation = getInteger("NTLogThresholdOperation", LogThresholdOperation).intValue(); Operation.initPool(LogThresholdOperation); syncOnWrite = getBoolean("NTSyncOnWrite"); useLockFile = getBoolean("NTNoLockFile"); logFile = new LogFile(dir, repository, useLockFile, syncOnWrite); setGarbageDelay(getInteger("NTGarbageDelay", getGarbageDelay()).intValue()); garbageAsync(getBoolean("NTAsyncGarbage"));
private final byte[] getFromLog(String dirName, String name) throws IOException { // First searches in the logs a new value for the object. Object key = OperationKey.newKey(dirName, name); byte[] buf = getFromLog(perThreadContext.get().getLog(), key); if (buf != null) return buf; if ((buf = getFromLog(logFile.log, key)) != null) { return buf; } return null; }
public final void initRepository() throws IOException { LogMemoryCapacity = getInteger("NTLogMemoryCapacity", LogMemoryCapacity).intValue(); MaxLogFileSize = getInteger("NTLogFileSize", MaxLogFileSize / Mb).intValue() * Mb; MaxLogMemorySize = getInteger("NTLogMemorySize", MaxLogMemorySize / Kb).intValue() * Kb; LogThresholdOperation = getInteger("NTLogThresholdOperation", LogThresholdOperation).intValue(); Operation.initPool(LogThresholdOperation); syncOnWrite = getBoolean("Transaction.SyncOnWrite"); if (getBoolean("NTNoLockFile")) logmon.log(BasicLevel.ERROR, "NTransaction, no longer use NTNoLockFile property, use Transaction.UseLockFile."); useLockFile = getBoolean("Transaction.UseLockFile"); setGarbageDelay(getInteger("NTGarbageDelay", getGarbageDelay()).intValue()); garbageAsync(getBoolean("NTAsyncGarbage"));
private final byte[] getFromLog(String dirName, String name) throws IOException { // First searches in the logs a new value for the object. Object key = OperationKey.newKey(dirName, name); byte[] buf = getFromLog(((Context) perThreadContext.get()).getLog(), key); if (buf != null) return buf; if ((buf = getFromLog(logFile.log, key)) != null) { return buf; } return null; }
/** * Returns a string representation for this object. * * @return A string representation of this object. */ public String toString() { StringBuffer strbuf = new StringBuffer(); strbuf.append('(').append(super.toString()); strbuf.append(",LogMemorySize=").append(getLogMemorySize()); strbuf.append(",LogFileSize=").append(getLogFileSize()); strbuf.append(",CommitCount=").append(getCommitCount()); strbuf.append(",GarbageCount=").append(getGarbageCount()); strbuf.append(",GarbageRatio=").append(getGarbageRatio()); strbuf.append(",NbSavedObjects=").append(getNbSavedObjects()); strbuf.append(",NbDeletedObjects=").append(getNbDeletedObjects()); strbuf.append(",NbBadDeletedObjects=").append(getNbBadDeletedObjects()); strbuf.append(",NbLoadedObjects=").append(getNbLoadedObjects()); strbuf.append(')'); return strbuf.toString(); }
public static void main(String[] args) throws Exception { if ("garbage".equals(args[0])) { NTransaction transaction = new NTransaction(); transaction.init(args[1]); transaction.stop(); } else if ("list".equals(args[0])) { } else { System.err.println("unknown command: " + args[0]); } } }
public byte[] loadByteArray(String dirName, String name) throws IOException { if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, "NTransaction, loadByteArray(" + dirName + '/' + name + ")"); // First searches in the logs a new value for the object. try { byte[] buf = getFromLog(dirName, name); if (buf != null) return buf; // Gets it from disk. return repository.load(dirName, name); } catch (FileNotFoundException exc) { if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, "NTransaction, loadByteArray(" + dirName + '/' + name + ") not found"); return null; } }
/** Method called when the timer expires. */ public void run() { if (logFile.garbageTimeOut > 0) { if (System.currentTimeMillis() > (logFile.lastGarbageTime + logFile.garbageTimeOut)) { garbage(); } } } }
public byte[] loadByteArray(String dirName, String name) throws IOException { if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, "NTransaction, loadByteArray(" + dirName + '/' + name + ")"); // First searches in the logs a new value for the object. try { byte[] buf = getFromLog(dirName, name); if (buf != null) return buf; // Gets it from disk. return repository.load(dirName, name); } catch (FileNotFoundException exc) { if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, "NTransaction, loadByteArray(" + dirName + '/' + name + ") not found"); return null; } }