/** * Returns the number of save operation to repository. * * @return The number of save operation to repository. */ public int getNbSavedObjects() { return repository.getNbSavedObjects(); }
/** * Close the transaction module. * It waits all transactions termination, the module will be initialized * anew before reusing it. */ public void close() { stop(); }
/** * Returns the number of load operation from repository. * * @return The number of load operation from repository. */ public int getNbLoadedObjects() { return repository.getNbLoadedObjects(); }
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; }
private final byte[] getFromLog(String dirName, String name) throws IOException { // First searchs 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(clog, key)) != null) || ((buf = getFromLog(plog, key)) != null)) { return buf; } return null; }
/** * Initializes the repository. * Nothing to do. */ public void init(Transaction transaction, File dir) throws IOException { this.dir = dir; useFileOutputStream = transaction.getBoolean("FileRepository.useRandomAccessFile"); }
/** * Creates a new key for the specified object. * * @param dirName relative path of the object. * @param name name of the object. * @return A new key for the specified object. */ public static Object newKey(String dirName, String name) { if (dirName == null) return name; return new OperationKey(dirName, name); }
/** * Register the state of a newly created object in the current transaction. * * @param obj the object to store. * @param name the name of the object. * * @see fr.dyade.aaa.util.Transaction#create(java.io.Serializable, java.lang.String) */ public final void create(Serializable obj, String name) throws IOException { save(obj, null, name, true); }
/** * Load the specified byte array. * * @param name the name of the object. * @return the loaded byte array. * * @see fr.dyade.aaa.util.Transaction#loadByteArray(java.lang.String) */ public final byte[] loadByteArray(String name) throws IOException { return loadByteArray(null, name); }
/** * Returns the number of useless delete operation on repository. * * @return The number of useless delete operation on repository. */ public int getNbBadDeletedObjects() { return repository.getNbBadDeletedObjects(); }
/** * Register a modified byte array in the current transaction. * * @param buf the byte array to store. * @param name the name of the object. * * @see fr.dyade.aaa.util.Transaction#saveByteArray(byte[], java.lang.String) */ public final void saveByteArray(byte[] buf, String name) throws IOException { saveByteArray(buf, null, name, true, false); }
/** * Load the specified object. * * @param name the name of the object. * @return the loaded object. * * @see fr.dyade.aaa.util.Transaction#load(java.lang.String) */ public final Object load(String name) throws IOException, ClassNotFoundException { return load(null, name); }
/** * Returns the number of delete operation on repository. * * @return The number of delete operation on repository. */ public int getNbDeletedObjects() { return repository.getNbDeletedObjects(); }
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; }
private final byte[] getFromLog(String dirName, String name) throws IOException { // First searchs 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(clog, key)) != null) || ((buf = getFromLog(plog, key)) != null)) { return buf; } return null; }
/** * Returns the number of save operation to repository. * * @return The number of save operation to repository. */ public int getNbSavedObjects() { return repository.getNbSavedObjects(); }
/** * Close the transaction module. * It waits all transactions termination, the module will be initialized * anew before reusing it. */ public void close() { stop(); }
/** * Returns the number of load operation from repository. * * @return The number of load operation from repository. */ public int getNbLoadedObjects() { return repository.getNbLoadedObjects(); }
/** * Initializes the repository. * Nothing to do. */ public void init(Transaction transaction, File dir) throws IOException { this.dir = dir; useFileOutputStream = transaction.getBoolean("FileRepository.useRandomAccessFile"); syncOnWrite = transaction.getBoolean("Transaction.SyncOnWrite"); if (syncOnWrite) mode = "rwd"; }
/** * Returns the number of save operation to repository. * * @return The number of save operation to repository. */ public int getNbSavedObjects() { return repository.getNbSavedObjects(); }