static DBOperation alloc(int type, String name, byte[] value) { DBOperation op = null; try { op = (DBOperation) pool.allocElement(); } catch (Exception exc) { return new DBOperation(type, name, value); } op.type = type; op.name = name; op.value = value; return op; }
static DBOperation alloc(int type, String name) { return alloc(type, name, null); }
public void delete(String dirName, String name) { String fname = fname(dirName, name); if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, "DBTransaction, delete(" + fname + ")"); Hashtable<String, DBOperation> log = perThreadContext.get().getLog(); DBOperation op = DBOperation.alloc(DBOperation.DELETE, fname); op = log.put(fname, op); if (op != null) op.free(); }
public void delete(String dirName, String name) { String fname = fname(dirName, name); if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, "DBTransaction, delete(" + fname + ")"); Hashtable log = ((Context) perThreadContext.get()).getLog(); DBOperation op = DBOperation.alloc(DBOperation.DELETE, fname); op = (DBOperation) log.put(fname, op); if (op != null) op.free(); }
protected final void saveInLog(byte[] buf, String dirName, String name, Hashtable log, boolean copy, boolean first) throws IOException { String fname = fname(dirName, name); if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, "DBTransaction, saveInLog(" + fname + ", " + copy + ", " + first + ")"); DBOperation op = DBOperation.alloc(DBOperation.SAVE, fname, buf); DBOperation old = (DBOperation) log.put(fname, op); if (copy) { if ((old != null) && (old.type == DBOperation.SAVE) && (old.value.length == buf.length)) { // reuse old buffer op.value = old.value; } else { // alloc a new one op.value = new byte[buf.length]; } System.arraycopy(buf, 0, op.value, 0, buf.length); } if (old != null) old.free(); }
static DBOperation alloc(int type, String name, byte[] value) { DBOperation op = null; try { op = (DBOperation) pool.allocElement(); } catch (Exception exc) { return new DBOperation(type, name, value); } op.type = type; op.name = name; op.value = value; return op; }
static DBOperation alloc(int type, String name) { return alloc(type, name, null); }
protected final void saveInLog(byte[] buf, String dirName, String name, Hashtable log, boolean copy, boolean first) throws IOException { String fname = fname(dirName, name); if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, "DBTransaction, saveInLog(" + fname + ", " + copy + ", " + first + ")"); DBOperation op = DBOperation.alloc(DBOperation.SAVE, fname, buf); DBOperation old = (DBOperation) log.put(fname, op); if (copy) { if ((old != null) && (old.type == DBOperation.SAVE) && (old.value.length == buf.length)) { // reuse old buffer op.value = old.value; } else { // alloc a new one op.value = new byte[buf.length]; } System.arraycopy(buf, 0, op.value, 0, buf.length); } if (old != null) old.free(); }