/** * Returns the number of slots available for "root" rowids. These slots * can be used to store special rowids, like rowids that point to * other rowids. Root rowids are useful for bootstrapping access to * a set of data. */ public synchronized int getRootCount() { checkIfClosed(); return recMgr.getRootCount(); }
/** * Commit (make persistent) all changes since beginning of transaction. */ public synchronized void commit() throws IOException { checkIfClosed(); updateCacheEntries(); recordManager.commit(); }
/** * Fetches a record using standard Java serialization. * * @param recid the recid for the record that must be fetched. * @return the object contained in the record. * @throws IOException when one of the underlying I/O operations fails. */ public Object fetch( long recid ) throws IOException { return fetch( recid, DefaultSerializer.INSTANCE ); }
recman = new CacheRecordManager( recman,cacheSize,false); recman = new CacheRecordManager(recman, cacheSize, true); }else if ("none".equals(cacheType)) {
public synchronized <A> void update( long recid, A obj, Serializer<A> serializer ) throws IOException { checkIfClosed(); if(_softCache) synchronized(_softHash) { //soft cache can not contain dirty objects SoftCacheEntry e = _softHash.remove(recid); if(e != null){ e.clear(); e._serializer = null; } } if(disableUpdateCache){ //this code was triggered from 'purgeEntry' method, //so dont put anything into cache _recman.update(recid,obj,serializer); }else{ CacheEntry entry = cacheGet(recid); if ( entry != null ) { // reuse existing cache entry entry._obj = obj; entry._serializer = serializer; entry._isDirty = true; } else { cachePut( recid, obj, serializer, true ); } } }
public synchronized void delete( long recid ) throws IOException { checkIfClosed(); _recman.delete( recid ); CacheEntry entry = _hash.get(recid); if (entry != null) { removeEntry(entry); _hash.remove(entry._recid); } if(_softCache) synchronized(_softHash) { SoftCacheEntry e = _softHash.remove(recid); if(e!=null){ e.clear(); e._serializer = null; } } }
/** * Updates a record using standard Java serialization. * * @param recid the recid for the record that is to be updated. * @param obj the new object for the record. * @throws IOException when one of the underlying I/O operations fails. */ public void update( long recid, Object obj ) throws IOException { update( recid, obj, DefaultSerializer.INSTANCE ); }
/** * Inserts a new record using a custom serializer. * * @param obj the object for the new record. * @return the rowid for the new record. * @throws IOException when one of the underlying I/O operations fails. */ public long insert( Object obj ) throws IOException { return insert( obj, DefaultSerializer.INSTANCE ); }
recman = new CacheRecordManager( recman, cache );
public synchronized <A> A fetch( long recid, Serializer<A> serializer ) throws IOException { checkIfClosed(); if(_softCache) synchronized(_softHash){ SoftCacheEntry e = _softHash.get(recid); if(e!=null){ Object a = e.get(); if(a!=null){ return (A) a; } } } CacheEntry entry = (CacheEntry) cacheGet( recid ); if ( entry == null ) { A value = _recman.fetch( recid, serializer ); if(!_softCache) cachePut(recid,value, serializer,false); else{ //put record into soft cache synchronized(_softHash){ _softHash.put(recid,new SoftCacheEntry(recid, value, serializer, _refQueue)); } } return value; }else{ return (A) entry._obj; } }
/** * Updates a record using standard Java serialization. * * @param recid the recid for the record that is to be updated. * @param obj the new object for the record. * @throws IOException when one of the underlying I/O operations fails. */ public void update( long recid, Object obj ) throws IOException { update( recid, obj, DefaultSerializer.INSTANCE ); }
/** * Inserts a new record using a custom serializer. * * @param obj the object for the new record. * @return the rowid for the new record. * @throws IOException when one of the underlying I/O operations fails. */ public long insert( Object obj ) throws IOException { return insert( obj, DefaultSerializer.INSTANCE ); }
recman = new CacheRecordManager( recman, cache );
/** * Returns the indicated root rowid. * * @see #getRootCount */ public synchronized long getRoot( int id ) throws IOException { checkIfClosed(); return recMgr.getRoot( id ); }
/** * Commit (make persistent) all changes since beginning of transaction. */ public synchronized void commit() throws IOException { checkIfClosed(); updateCacheEntries(); recordManager.commit(); }
/** * Fetches a record using standard Java serialization. * * @param recid the recid for the record that must be fetched. * @return the object contained in the record. * @throws IOException when one of the underlying I/O operations fails. */ public Object fetch( long recid ) throws IOException { return fetch( recid, DefaultSerializer.INSTANCE ); }
/** * Updates a record using standard Java serialization. * * @param recid the recid for the record that is to be updated. * @param obj the new object for the record. * @throws IOException when one of the underlying I/O operations fails. */ public void update( long recid, Object obj ) throws IOException { update( recid, obj, DefaultSerializer.INSTANCE ); }
/** * Inserts a new record using a custom serializer. * * @param obj the object for the new record. * @return the rowid for the new record. * @throws IOException when one of the underlying I/O operations fails. */ public long insert( Object obj ) throws IOException { return insert( obj, DefaultSerializer.INSTANCE ); }
recman = new CacheRecordManager( recman, cache );
/** * Returns the number of slots available for "root" rowids. These slots * can be used to store special rowids, like rowids that point to * other rowids. Root rowids are useful for bootstrapping access to * a set of data. */ public synchronized int getRootCount() { checkIfClosed(); return recordManager.getRootCount(); }