joafip-svn Mailing List for java data object persistence in file (Page 2)
Brought to you by:
luc_peuvrier
You can subscribe to this list here.
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
(102) |
Nov
(52) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(4) |
Feb
|
Mar
(14) |
Apr
(116) |
May
(100) |
Jun
(14) |
Jul
|
Aug
|
Sep
(30) |
Oct
|
Nov
(108) |
Dec
(2) |
From: <luc...@us...> - 2012-11-28 12:16:21
|
Revision: 3167 http://joafip.svn.sourceforge.net/joafip/?rev=3167&view=rev Author: luc_peuvrier Date: 2012-11-28 12:16:14 +0000 (Wed, 28 Nov 2012) Log Message: ----------- red black tree management changed. foreground garbage sweep changed Modified Paths: -------------- trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/record/service/HeapElementManager.java trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/AbstractHeapDataManager.java trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/IHeapDataManager.java trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/DualWrapDataManager.java Added Paths: ----------- trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/entity/NullFileStorable.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-28 12:16:04
|
Revision: 3166 http://joafip.svn.sourceforge.net/joafip/?rev=3166&view=rev Author: luc_peuvrier Date: 2012-11-28 12:15:54 +0000 (Wed, 28 Nov 2012) Log Message: ----------- red black tree management changed. foreground garbage sweep changed Modified Paths: -------------- trunk/joafip-collection/src/test/java/net/sf/joafip/java/util/TestPTreeSetOld.java Modified: trunk/joafip-collection/src/test/java/net/sf/joafip/java/util/TestPTreeSetOld.java =================================================================== --- trunk/joafip-collection/src/test/java/net/sf/joafip/java/util/TestPTreeSetOld.java 2012-11-28 12:15:42 UTC (rev 3165) +++ trunk/joafip-collection/src/test/java/net/sf/joafip/java/util/TestPTreeSetOld.java 2012-11-28 12:15:54 UTC (rev 3166) @@ -196,7 +196,7 @@ * @param shower */ private void checkTree(final RedBlackTree<String> tree) { - final TreeShower shower = TreeShower.getInstance(); + final TreeShower shower = new TreeShower(); try { shower.show(tree); final RedBlackTreeIntegrityChecker<String> checker = new RedBlackTreeIntegrityChecker<String>( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-28 12:16:00
|
Revision: 3166 http://joafip.svn.sourceforge.net/joafip/?rev=3166&view=rev Author: luc_peuvrier Date: 2012-11-28 12:15:54 +0000 (Wed, 28 Nov 2012) Log Message: ----------- red black tree management changed. foreground garbage sweep changed Modified Paths: -------------- trunk/joafip-collection/src/test/java/net/sf/joafip/java/util/TestPTreeSetOld.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-28 12:15:54
|
Revision: 3165 http://joafip.svn.sourceforge.net/joafip/?rev=3165&view=rev Author: luc_peuvrier Date: 2012-11-28 12:15:42 +0000 (Wed, 28 Nov 2012) Log Message: ----------- red black tree management changed. foreground garbage sweep changed Modified Paths: -------------- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/record/entity/AbstractHeapRBTNode.java trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/record/entity/HeapRecord.java trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/AutoSaveHeapFileDataManager.java trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/record/service/TestHeapElementManagerWithHeapRecord.java trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/record/service/TestHeapRecordStoreRestore.java trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/service/HeapFileCheckerDataManager.java Added Paths: ----------- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/DataRecordIterator.java Modified: trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/record/entity/AbstractHeapRBTNode.java =================================================================== --- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/record/entity/AbstractHeapRBTNode.java 2012-11-28 12:15:18 UTC (rev 3164) +++ trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/record/entity/AbstractHeapRBTNode.java 2012-11-28 12:15:42 UTC (rev 3165) @@ -404,7 +404,8 @@ private void checkColorSetted() throws RBTException { if (!colorSetted) { - throw new RBTException("color is not setted:\n" + this.toString()); + throw new RBTException("color is not setted:\n" + getClass() + "\n" + + this.toString()); } } @@ -516,9 +517,10 @@ @Override public String toString() { - return "color=" + color + " pos in file=" + positionInFile + " left=" - + leftPositionInFile + " right=" + rightPositionInFile - + " parent=" + parentPositionInFile; + return "attached " + isAttached() + ", color=" + color + + ", pos in file=" + positionInFile + ", left=" + + leftPositionInFile + ", right=" + rightPositionInFile + + ", parent=" + parentPositionInFile; } @Override Modified: trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/record/entity/HeapRecord.java =================================================================== --- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/record/entity/HeapRecord.java 2012-11-28 12:15:18 UTC (rev 3164) +++ trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/record/entity/HeapRecord.java 2012-11-28 12:15:42 UTC (rev 3165) @@ -419,7 +419,7 @@ writeByte((byte) 0x02); } } else { - writeByte((byte) 0x00); + throw new HeapException("data record color not set"); } writeInteger(numberOfChild); writeLong(nodeIdentifier.value); @@ -470,7 +470,7 @@ writeByte((byte) 0x02); } } else { - writeByte((byte) 0x00); + throw new HeapException("free record color not set"); } // writeInteger(freeNode.getNumberOfChild()); writeInteger(numberOfChild); @@ -539,7 +539,8 @@ colorSetted = true; color = true; } else { - colorSetted = false; + // colorSetted = false; + throw new HeapException("data record color not set"); } numberOfChild = readInteger(); final long long1 = readLong(); @@ -576,7 +577,8 @@ colorSetted = true; color = true; } else { - colorSetted = false; + // colorSetted = false; + throw new HeapException("free record color not set"); } // freeNode.setNumberOfChildUnmarshalling(readInteger()); numberOfChild = readInteger(); Modified: trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/AutoSaveHeapFileDataManager.java =================================================================== --- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/AutoSaveHeapFileDataManager.java 2012-11-28 12:15:18 UTC (rev 3164) +++ trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/AutoSaveHeapFileDataManager.java 2012-11-28 12:15:42 UTC (rev 3165) @@ -22,6 +22,7 @@ */ package net.sf.joafip.heapfile.service; +import net.sf.joafip.Fortest; import net.sf.joafip.NotStorableClass; import net.sf.joafip.kvstore.entity.HeapFileSetup; import net.sf.joafip.kvstore.record.entity.DataRecordIdentifier; @@ -95,6 +96,87 @@ return created; } + @Override + public boolean deleteDataRecordImpl( + DataRecordIdentifier dataRecordIdentifier) throws HeapException { + final boolean result = super.deleteDataRecordImpl(dataRecordIdentifier); + checkForSave(); + return result; + } + + @Override + protected boolean hasDataRecordImpl( + DataRecordIdentifier dataRecordIdentifier) throws HeapException { + final boolean result = super.hasDataRecordImpl(dataRecordIdentifier); + checkForSave(); + return result; + } + + @Override + protected DataRecordIdentifier firstDataRecordIdentifierImpl() + throws HeapException { + final DataRecordIdentifier result = super.firstDataRecordIdentifierImpl(); + checkForSave(); + return result; + } + + @Override + public DataRecordIdentifier nextDataRecordIdentifierImpl( + DataRecordIdentifier dataRecordIdentifier) throws HeapException { + final DataRecordIdentifier result = super.nextDataRecordIdentifier(dataRecordIdentifier); + checkForSave(); + return result; + } + + @Override + protected DataRecordIdentifier lastDataRecordIdentifierImpl() + throws HeapException { + final DataRecordIdentifier result = super.lastDataRecordIdentifierImpl(); + checkForSave(); + return result; + } + + @Override + protected DataRecordIdentifier lowerDataRecordIdentifierImpl( + DataRecordIdentifier identifier) throws HeapException { + final DataRecordIdentifier result = super.lowerDataRecordIdentifierImpl(identifier); + checkForSave(); + return result; + } + + @Override + protected DataRecordIdentifier floorDataRecordIdentifierImpl( + DataRecordIdentifier identifier) throws HeapException { + final DataRecordIdentifier result = super.floorDataRecordIdentifierImpl(identifier); + checkForSave(); + return result; + } + + @Override + protected DataRecordIdentifier ceilingDataRecordIdentifierImpl( + DataRecordIdentifier identifier) throws HeapException { + final DataRecordIdentifier result = super.ceilingDataRecordIdentifierImpl(identifier); + checkForSave(); + return result; + } + + @Override + protected DataRecordIdentifier higherDataRecordIdentifierImpl( + DataRecordIdentifier identifier) throws HeapException { + final DataRecordIdentifier result = super.higherDataRecordIdentifierImpl(identifier); + checkForSave(); + return result; + } + + @Override + @Fortest + public long getRecordPositionInfile(DataRecordIdentifier identifier) + throws HeapException { + final long result = super.getRecordPositionInfile(identifier); + checkForSave(); + return result; + } + private void checkForSave() throws HeapException { if (heapElementManager.getNumberOfHeaprecordInMemory() >= maxRecord) { flushImp(); Added: trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/DataRecordIterator.java =================================================================== --- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/DataRecordIterator.java (rev 0) +++ trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/DataRecordIterator.java 2012-11-28 12:15:42 UTC (rev 3165) @@ -0,0 +1,90 @@ +/* + * Copyright 2012 Luc Peuvrier + * All rights reserved. + * + * This file is a part of JOAFIP. + * + * JOAFIP is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License. + * + * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE + * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.gnu.org/licenses/lgpl.html + * + * JOAFIP is distributed in the hope that it will be useful, but + * unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package net.sf.joafip.heapfile.service; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +import net.sf.joafip.NotStorableClass; +import net.sf.joafip.kvstore.record.entity.DataRecordIdentifier; +import net.sf.joafip.kvstore.service.HeapException; +import net.sf.joafip.kvstore.service.HeapRuntimeException; + +/** + * + * @author luc peuvrier + * + */ +@NotStorableClass +public class DataRecordIterator implements Iterator<DataRecordIdentifier> { + + private final HeapFileDataManager heapFileDataManager; + + private DataRecordIdentifier next; + + private DataRecordIdentifier removable; + + public DataRecordIterator(HeapFileDataManager heapFileDataManager) { + super(); + this.heapFileDataManager=heapFileDataManager; + try { + next=heapFileDataManager.firstDataRecordIdentifier(); + } catch (HeapException exception) { + throw new HeapRuntimeException(exception); + } + } + + @Override + public boolean hasNext() { + return next!=null; + } + + @Override + public DataRecordIdentifier next() { + if( next==null){ + throw new NoSuchElementException(); + } + final DataRecordIdentifier result = next; + try { + next=heapFileDataManager.nextDataRecordIdentifier(next); + } catch (HeapException exception) { + throw new HeapRuntimeException(exception); + } + removable=result; + return result; + } + + @Override + public void remove() { + if( removable==null) { + throw new IllegalStateException(); + } + try { + heapFileDataManager.deleteDataRecord(removable); + } catch (HeapException exception) { + throw new HeapRuntimeException(exception); + } + removable=null; + } +} Property changes on: trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/DataRecordIterator.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java =================================================================== --- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java 2012-11-28 12:15:18 UTC (rev 3164) +++ trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java 2012-11-28 12:15:42 UTC (rev 3165) @@ -145,12 +145,13 @@ } @Override - protected void stopServiceImpl(final boolean removeFiles) throws HeapException { + protected void stopServiceImpl(final boolean removeFiles) + throws HeapException { if (heapElementManager.isTransactionOpened()) { heapElementManager.closeTransactionDiscardChange(); } heapElementManager.stopService(); - if( removeFiles) { + if (removeFiles) { heapElementManager.removeFiles(); } } @@ -789,6 +790,35 @@ } @Override + public DataRecordIdentifier nextDataRecordIdentifier( + final DataRecordIdentifier dataRecordIdentifier) + throws HeapException { + final HeapIdNode currentHeapIdNode; + try { + currentHeapIdNode = (HeapIdNode) idNodeSearchMayBeNotExist(dataRecordIdentifier); + } catch (HeapException exception) { + final String message = "failed get current node"; + logger.fatal(message); + throw new HeapException(message, exception); + } + final HeapIdNode nextHeapIdNode; + try { + nextHeapIdNode = (HeapIdNode) idNodeTree.next(currentHeapIdNode); + } catch (RBTException exception) { + final String message = "failed get next node"; + logger.fatal(message); + throw new HeapException(message, exception); + } + final DataRecordIdentifier element; + if (nextHeapIdNode == null) { + element = null; + } else { + element = nextHeapIdNode.getElement(); + } + return element; + } + + @Override protected DataRecordIdentifier lastDataRecordIdentifierImpl() throws HeapException { try { @@ -1057,40 +1087,9 @@ return file.getAbsolutePath(); } - @NotStorableClass - private class DataRecordIterator implements Iterator<DataRecordIdentifier> { - - private final Iterator<IRBTNode<DataRecordIdentifier>> iterator; - - public DataRecordIterator() { - super(); - iterator = idNodeTree.iterator(); - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public DataRecordIdentifier next() { - final IRBTNode<DataRecordIdentifier> nextRbtNode = iterator.next(); - try { - return nextRbtNode.getElement(); - } catch (RBTException exception) { - throw new RuntimeException(exception);// NOPMD - } - } - - @Override - public void remove() { - iterator.remove(); - } - } - @Override protected Iterator<DataRecordIdentifier> dataRecordIteratorImpl() { - return new DataRecordIterator(); + return new DataRecordIterator(this); } @Override Modified: trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/record/service/TestHeapElementManagerWithHeapRecord.java =================================================================== --- trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/record/service/TestHeapElementManagerWithHeapRecord.java 2012-11-28 12:15:18 UTC (rev 3164) +++ trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/record/service/TestHeapElementManagerWithHeapRecord.java 2012-11-28 12:15:42 UTC (rev 3165) @@ -28,6 +28,7 @@ import net.sf.joafip.kvstore.service.HeapException; import net.sf.joafip.redblacktree.entity.IRBTNode; import net.sf.joafip.redblacktree.service.RBTException; +import net.sf.joafip.redblacktree.service.RedBlackTree; @NotStorableClass @DoNotTransform @@ -136,9 +137,10 @@ * test append done correctly * * @throws HeapException + * @throws RBTException * */ - public void testAppendRecord() throws HeapException { + public void testAppendRecord() throws HeapException, RBTException { appendRecord(); heapElementManager.startService(); heapElementManager.openTransaction(); @@ -176,7 +178,7 @@ heapElementManager.stopService(); } - public void testUpdateDataRecord() throws HeapException { + public void testUpdateDataRecord() throws HeapException, RBTException { appendRecord(); final long pos = record1pos; @@ -271,7 +273,7 @@ heapElementManager.stopService(); } - public void testChangeManageDataMode() throws HeapException { + public void testChangeManageDataMode() throws HeapException, RBTException { appendRecord(); final long pos = record1pos; heapElementManager.startService(); @@ -346,8 +348,9 @@ * append two records * * @throws HeapException + * @throws RBTException */ - private void appendRecord() throws HeapException { + private void appendRecord() throws HeapException, RBTException { appendHeaderInEmptyFile(); heapElementManager.startService(); heapElementManager.openTransaction(); @@ -361,6 +364,7 @@ * area size: + * 4 for crc32 */); + // heapRecordAppened1 = heapElementManager.newHeapFileRecord(record1pos, // -1L/* prev pos */, dataRecordIdentifier/* id */, // false/* free */, dataSize, dataSize @@ -369,6 +373,10 @@ // * 4 for crc32 // */); heapElementManager.appendHeapFileRecord(heapRecordAppened1); + + IRBTNode<DataRecordIdentifier> idNode = heapRecordAppened1.getIdNode(); + idNode.setColor(RedBlackTree.BLACK); + try { assert false; } catch (AssertionError error) { @@ -405,6 +413,10 @@ // * crc32 // */); heapElementManager.appendHeapFileRecord(heapRecordAppened2); + + idNode = heapRecordAppened2.getIdNode(); + idNode.setColor(RedBlackTree.BLACK); + heapRecordAppened2.setDataAssociated(testData); heapElementManager.closeTransaction(); heapElementManager.stopService(); Modified: trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/record/service/TestHeapRecordStoreRestore.java =================================================================== --- trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/record/service/TestHeapRecordStoreRestore.java 2012-11-28 12:15:18 UTC (rev 3164) +++ trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/record/service/TestHeapRecordStoreRestore.java 2012-11-28 12:15:42 UTC (rev 3165) @@ -106,6 +106,11 @@ heapIdNode.setLeftPositionInFile(2); heapIdNode.setRightPositionInFile(3); heapIdNode.setParentPositionInFile(4); + try { + heapIdNode.setBlack(); + } catch (Exception exception) { + // ignore error + } // byte[] data = heapRecord.getDataAssociated(); final byte[] data = new byte[10]; heapRecord.setDataAssociated(data); @@ -133,6 +138,11 @@ heapFreeNode.setLeftPositionInFile(91); heapFreeNode.setRightPositionInFile(92); heapFreeNode.setParentPositionInFile(93); + try { + heapFreeNode.setBlack(); + } catch (Exception exception) { + // ignore error + } // to force write heapRecord.setValueIsChangedValueToSave(); heapRecord.writeToFile(); Modified: trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/service/HeapFileCheckerDataManager.java =================================================================== --- trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/service/HeapFileCheckerDataManager.java 2012-11-28 12:15:18 UTC (rev 3164) +++ trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/service/HeapFileCheckerDataManager.java 2012-11-28 12:15:42 UTC (rev 3165) @@ -186,6 +186,19 @@ } @Override + public DataRecordIdentifier nextDataRecordIdentifier( + final DataRecordIdentifier dataRecordIdentifier) throws HeapException { + final DataRecordIdentifier dr1 = heapFileDataManager + .nextDataRecordIdentifier(dataRecordIdentifier); + final DataRecordIdentifier dr2 = heapMultiFileDataManager + .nextDataRecordIdentifier(dataRecordIdentifier); + if (dr1.value != dr2.value) { + throw new HeapException(NOT_SAME_DATA_RECORD); + } + return dr1; + } + + @Override public DataRecordIdentifier lastDataRecordIdentifier() throws HeapException { final DataRecordIdentifier dr1 = heapFileDataManager .lastDataRecordIdentifier(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-28 12:15:53
|
Revision: 3165 http://joafip.svn.sourceforge.net/joafip/?rev=3165&view=rev Author: luc_peuvrier Date: 2012-11-28 12:15:42 +0000 (Wed, 28 Nov 2012) Log Message: ----------- red black tree management changed. foreground garbage sweep changed Modified Paths: -------------- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/record/entity/AbstractHeapRBTNode.java trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/record/entity/HeapRecord.java trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/AutoSaveHeapFileDataManager.java trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/record/service/TestHeapElementManagerWithHeapRecord.java trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/record/service/TestHeapRecordStoreRestore.java trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/service/HeapFileCheckerDataManager.java Added Paths: ----------- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/DataRecordIterator.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-28 12:15:30
|
Revision: 3164 http://joafip.svn.sourceforge.net/joafip/?rev=3164&view=rev Author: luc_peuvrier Date: 2012-11-28 12:15:18 +0000 (Wed, 28 Nov 2012) Log Message: ----------- red black tree management changed. foreground garbage sweep changed Modified Paths: -------------- trunk/joafip-pmap/src/main/java/net/sf/joafip/pmap/FileTreeMapEntrySet.java trunk/joafip-pmap/src/main/java/net/sf/joafip/pmap/FileTreeMapKeySet.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-28 12:15:28
|
Revision: 3164 http://joafip.svn.sourceforge.net/joafip/?rev=3164&view=rev Author: luc_peuvrier Date: 2012-11-28 12:15:18 +0000 (Wed, 28 Nov 2012) Log Message: ----------- red black tree management changed. foreground garbage sweep changed Modified Paths: -------------- trunk/joafip-pmap/src/main/java/net/sf/joafip/pmap/FileTreeMapEntrySet.java trunk/joafip-pmap/src/main/java/net/sf/joafip/pmap/FileTreeMapKeySet.java Modified: trunk/joafip-pmap/src/main/java/net/sf/joafip/pmap/FileTreeMapEntrySet.java =================================================================== --- trunk/joafip-pmap/src/main/java/net/sf/joafip/pmap/FileTreeMapEntrySet.java 2012-11-28 12:15:05 UTC (rev 3163) +++ trunk/joafip-pmap/src/main/java/net/sf/joafip/pmap/FileTreeMapEntrySet.java 2012-11-28 12:15:18 UTC (rev 3164) @@ -84,4 +84,37 @@ public int size() { return fileTreeMap.size(); } + + @SuppressWarnings("rawtypes") + @Override + public boolean contains(final Object object) { + final Object key; + if( object==null) { + key=null; + } else if( object instanceof Map.Entry) { + key=((Map.Entry)object).getKey(); + } else { + return false; + } + return fileTreeMap.containsKey(key); + } + + @SuppressWarnings("rawtypes") + @Override + public boolean remove(Object object) { + final Object key; + if( object==null) { + key=null; + } else if( object instanceof Map.Entry) { + key=((Map.Entry)object).getKey(); + } else { + return false; + } + return fileTreeMap.remove(key)!=null; + } + + @Override + public void clear() { + fileTreeMap.clear(); + } } Modified: trunk/joafip-pmap/src/main/java/net/sf/joafip/pmap/FileTreeMapKeySet.java =================================================================== --- trunk/joafip-pmap/src/main/java/net/sf/joafip/pmap/FileTreeMapKeySet.java 2012-11-28 12:15:05 UTC (rev 3163) +++ trunk/joafip-pmap/src/main/java/net/sf/joafip/pmap/FileTreeMapKeySet.java 2012-11-28 12:15:18 UTC (rev 3164) @@ -186,4 +186,19 @@ } return key; } + + @Override + public boolean contains(final Object object) { + return fileTreeMap.containsKey(object); + } + + @Override + public boolean remove(final Object object) { + return fileTreeMap.remove(object)!=null; + } + + @Override + public void clear() { + fileTreeMap.clear(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-28 12:15:18
|
Revision: 3163 http://joafip.svn.sourceforge.net/joafip/?rev=3163&view=rev Author: luc_peuvrier Date: 2012-11-28 12:15:05 +0000 (Wed, 28 Nov 2012) Log Message: ----------- red black tree management changed. foreground garbage sweep changed Modified Paths: -------------- trunk/joafip/pom.xml trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractStoreDelegatingToDataManager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java trunk/joafip/src/test/java/net/sf/joafip/store/service/TestLinkManagementInFile.java trunk/joafip/src/test/java/net/sf/joafip/store/service/TestObjectReferenceLinkInFile.java trunk/joafip/src/test/java/net/sf/joafip/store/service/TestStoreWithG.java trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java Added Paths: ----------- trunk/joafip/src/test/java/net/sf/joafip/util/TestPersistantDataRecordIdentifierSetIteration.java Modified: trunk/joafip/pom.xml =================================================================== --- trunk/joafip/pom.xml 2012-11-23 03:36:47 UTC (rev 3162) +++ trunk/joafip/pom.xml 2012-11-28 12:15:05 UTC (rev 3163) @@ -54,6 +54,13 @@ <dependency> <groupId>net.sf.joafip</groupId> + <artifactId>joafip-kvstore</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>net.sf.joafip</groupId> <artifactId>joafip-heapfile</artifactId> </dependency> Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractStoreDelegatingToDataManager.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractStoreDelegatingToDataManager.java 2012-11-23 03:36:47 UTC (rev 3162) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractStoreDelegatingToDataManager.java 2012-11-28 12:15:05 UTC (rev 3163) @@ -39,10 +39,10 @@ protected final JoafipLogger logger = JoafipLogger.getLogger(getClass());// NOPMD /** name of the data file in directory path */ - private static final String STORE_DATA = + public static final String STORE_DATA = /**/"store.data"; - private static final String TRACE_FILE = + public static final String TRACE_FILE = /**/"trace.txt"; /** name of the backup data file in directory path */ Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java 2012-11-23 03:36:47 UTC (rev 3162) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java 2012-11-28 12:15:05 UTC (rev 3163) @@ -97,7 +97,7 @@ private LinkRecordManager linkRecordManager;; - //private LinkManager linkManager; + // private LinkManager linkManager; public StoreGarbager(final IStoreForGarbage store) throws StoreException { super(); @@ -110,10 +110,10 @@ public void setStoreSaver(final IStoreSaverForGarbage storeSaver) { this.storeSaver = storeSaver; LinkManager linkManager = storeSaver.getLinkManager(); - if( linkManager==null) { - linkRecordManager=null; + if (linkManager == null) { + linkRecordManager = null; } else { - linkRecordManager=linkManager.getLinkRecordManager(); + linkRecordManager = linkManager.getLinkRecordManager(); } } @@ -193,7 +193,6 @@ * @throws StoreClassNotFoundException * @throws StoreDataCorruptedException */ - // FIXMELUC ____________garbageSweep public int garbageSweep(final String filePath) throws StoreException, StoreClassNotFoundException, StoreDataCorruptedException { numberOFGarbaged = 0; @@ -230,6 +229,12 @@ } final IHeapDataManager dataManager = storeSaver.getDataManager(); + if (LOGGER.isInfoEnabled()) { + final int numberOfDataRecord = dataManager + .getNumberOfDataRecord(); + LOGGER.info("total number of data record " + numberOfDataRecord + + ", " + toPreserveSet.size() + " to preserve"); + } final Iterator<DataRecordIdentifier> iterator = dataManager .dataRecordIterator(); garbageStartNotify(); @@ -240,14 +245,15 @@ if (linkRecordManager == null) { dataManager.deleteDataRecord(existing); } else { - linkRecordManager.removeLinkIfExist(existing/*referenced*/); + linkRecordManager + .removeLinkIfExist(existing/* referenced */); final ObjectLinkTreeNode objectLinkTreeNode = objectIOManager .getObjectLinkTreeNode(existing); dataManager.deleteDataRecord(existing); final DataRecordIdentifier[] referencedList = objectLinkTreeNode .getReferencedList(); for (DataRecordIdentifier referenced : referencedList) { - removeLink(existing/*referencing*/, referenced); + removeLink(existing/* referencing */, referenced); } } numberOFGarbaged++; @@ -256,6 +262,9 @@ storeSaver.performModificationDone(); } storeSaver.saveModification(); + if (LOGGER.isInfoEnabled()) { + LOGGER.info("end of garbage sweep"); + } } catch (GarbageException exception) { throw new StoreException(exception); @@ -285,9 +294,11 @@ } private void removeLink(final DataRecordIdentifier referencing, - final DataRecordIdentifier referenced) throws GarbageException, ReferenceLinkGarbageException { - final ReferenceLink referenceLink = linkRecordManager.searchByReferenced(referenced); - if( referenceLink!=null) { + final DataRecordIdentifier referenced) throws GarbageException, + ReferenceLinkGarbageException { + final ReferenceLink referenceLink = linkRecordManager + .searchByReferenced(referenced); + if (referenceLink != null) { referenceLink.decrementLinkCount(referencing); linkRecordManager.updateReferenceLink(referenceLink); } Modified: trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java 2012-11-23 03:36:47 UTC (rev 3162) +++ trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java 2012-11-28 12:15:05 UTC (rev 3163) @@ -43,7 +43,7 @@ public class PersistantDataRecordIdentifierSet extends AbstractSet<DataRecordIdentifier> { - private static final int MAX_RECORDS = 1000; + private static final int MAX_RECORDS = 10000; private static final byte[] DATA = new byte[0]; Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/TestLinkManagementInFile.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/TestLinkManagementInFile.java 2012-11-23 03:36:47 UTC (rev 3162) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/TestLinkManagementInFile.java 2012-11-28 12:15:05 UTC (rev 3163) @@ -44,6 +44,7 @@ super.setUp(); store = new StoreForTest(1, null, TestConstant.getWinRamDiskRuntimeDir(), true/* garbage */); + store.addToNotCheckMethod(net.sf.joafip.store.service.objectfortest.Bob1.class); dataManager = store.getDataManager(); linkRecordManager = store.getLinkRecordManager(); store.openAndNewAccessSession(true/* removeFiles */); Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/TestObjectReferenceLinkInFile.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/TestObjectReferenceLinkInFile.java 2012-11-23 03:36:47 UTC (rev 3162) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/TestObjectReferenceLinkInFile.java 2012-11-28 12:15:05 UTC (rev 3163) @@ -44,6 +44,7 @@ super.setUp(); store = new StoreForTest(1, null, TestConstant.getWinRamDiskRuntimeDir(), true/* garbage */); + store.addToNotCheckMethod(net.sf.joafip.store.service.objectfortest.Bob1.class); store.openAndNewAccessSession(true/* remove file */); objectIOManager = store.getObjectIOManager(); dataManager = store.getDataManager(); Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/TestStoreWithG.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/TestStoreWithG.java 2012-11-23 03:36:47 UTC (rev 3162) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/TestStoreWithG.java 2012-11-28 12:15:05 UTC (rev 3163) @@ -26,6 +26,7 @@ StoreClassNotFoundException { store = new StoreForTest(1, null, path, /**/true/* manage garbage */); + store.addToNotCheckMethod(net.sf.joafip.store.service.objectfortest.Bob1.class); store.openAndNewAccessSession(removeFiles); dataManager = store.getDataManager(); } Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java 2012-11-23 03:36:47 UTC (rev 3162) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java 2012-11-28 12:15:05 UTC (rev 3163) @@ -133,12 +133,6 @@ final DataRecordIdentifier referencingDataRecordIdentifier = referencing .getDataRecordIdentifier(); - // FIXMELUC ____________________referencing not exists - // TestCase.assertTrue(referencingDataRecordIdentifier - // + " referencing " + referencedDataRecordIdentifier - // + " not in storage", dataManager - // .hasDataRecord(referencingDataRecordIdentifier)); - final int linkCount = referencing.getLinkCount(); referenceLinkGraphFromLinkInfo.addReferencing( referencedDataRecordIdentifier, Added: trunk/joafip/src/test/java/net/sf/joafip/util/TestPersistantDataRecordIdentifierSetIteration.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/util/TestPersistantDataRecordIdentifierSetIteration.java (rev 0) +++ trunk/joafip/src/test/java/net/sf/joafip/util/TestPersistantDataRecordIdentifierSetIteration.java 2012-11-28 12:15:05 UTC (rev 3163) @@ -0,0 +1,90 @@ +/* + * Copyright 2012 Luc Peuvrier + * All rights reserved. + * + * This file is a part of JOAFIP. + * + * JOAFIP is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License. + * + * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE + * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.gnu.org/licenses/lgpl.html + * + * JOAFIP is distributed in the hope that it will be useful, but + * unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package net.sf.joafip.util; + +import java.util.Iterator; + +import net.sf.joafip.AbstractJoafipCommonTestCase; +import net.sf.joafip.NoStorableAccess; +import net.sf.joafip.NotStorableClass; +import net.sf.joafip.TestException; +import net.sf.joafip.kvstore.record.entity.DataRecordIdentifier; + +/** + * + * @author luc peuvrier + * + */ +@NotStorableClass +@NoStorableAccess +public class TestPersistantDataRecordIdentifierSetIteration extends AbstractJoafipCommonTestCase { + + private PersistantDataRecordIdentifierSet set; + + public TestPersistantDataRecordIdentifierSetIteration() + throws TestException { + super(); + } + + public TestPersistantDataRecordIdentifierSetIteration(final String name) + throws TestException { + super(name); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + set = new PersistantDataRecordIdentifierSet("runtime/set"); + set.startService(true); + } + + @Override + protected void tearDown() throws Exception { + try { + set.clear(); + } catch (Exception exception) { + // ignore error + } + try { + set.stopService(true); + } catch (Exception exception) { + // ignore error + } + super.tearDown(); + } + + public void testIteration() { + for(long value=0;value<50000;value++){ + set.add(new DataRecordIdentifier(value)); + } + final Iterator<DataRecordIdentifier> iterator = set.iterator(); + long value=0; + while(iterator.hasNext()){ + final DataRecordIdentifier dataRecordIdentifier = iterator.next(); + assertEquals("bad value",value,dataRecordIdentifier.value); + value++; + } + assertEquals("bad value",50000L,value); + } +} Property changes on: trunk/joafip/src/test/java/net/sf/joafip/util/TestPersistantDataRecordIdentifierSetIteration.java ___________________________________________________________________ Added: svn:mime-type + text/plain This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-28 12:15:14
|
Revision: 3163 http://joafip.svn.sourceforge.net/joafip/?rev=3163&view=rev Author: luc_peuvrier Date: 2012-11-28 12:15:05 +0000 (Wed, 28 Nov 2012) Log Message: ----------- red black tree management changed. foreground garbage sweep changed Modified Paths: -------------- trunk/joafip/pom.xml trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractStoreDelegatingToDataManager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java trunk/joafip/src/test/java/net/sf/joafip/store/service/TestLinkManagementInFile.java trunk/joafip/src/test/java/net/sf/joafip/store/service/TestObjectReferenceLinkInFile.java trunk/joafip/src/test/java/net/sf/joafip/store/service/TestStoreWithG.java trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java Added Paths: ----------- trunk/joafip/src/test/java/net/sf/joafip/util/TestPersistantDataRecordIdentifierSetIteration.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-23 03:36:53
|
Revision: 3162 http://joafip.svn.sourceforge.net/joafip/?rev=3162&view=rev Author: luc_peuvrier Date: 2012-11-23 03:36:47 +0000 (Fri, 23 Nov 2012) Log Message: ----------- correction Modified Paths: -------------- trunk/joafip/src/test/java/net/sf/joafip/store/entity/garbage/ReferenceLinkGraph.java Modified: trunk/joafip/src/test/java/net/sf/joafip/store/entity/garbage/ReferenceLinkGraph.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/entity/garbage/ReferenceLinkGraph.java 2012-11-22 06:54:58 UTC (rev 3161) +++ trunk/joafip/src/test/java/net/sf/joafip/store/entity/garbage/ReferenceLinkGraph.java 2012-11-23 03:36:47 UTC (rev 3162) @@ -212,7 +212,7 @@ stringBuffer.append('\n'); } Set<DataRecordIdentifier> referencingSet = refLink.getReferencingSet(); - for(DataRecordIdentifier referencing:referencedSet) { + for(DataRecordIdentifier referencing:referencingSet) { stringBuffer.append(dataRecordIdentifier); stringBuffer.append("<-"); stringBuffer.append(referencing); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-23 03:36:53
|
Revision: 3162 http://joafip.svn.sourceforge.net/joafip/?rev=3162&view=rev Author: luc_peuvrier Date: 2012-11-23 03:36:47 +0000 (Fri, 23 Nov 2012) Log Message: ----------- correction Modified Paths: -------------- trunk/joafip/src/test/java/net/sf/joafip/store/entity/garbage/ReferenceLinkGraph.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:55:05
|
Revision: 3161 http://joafip.svn.sourceforge.net/joafip/?rev=3161&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:58 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip-4test/jrat.xml trunk/joafip-4test/src/main/java/net/sf/joafip/garbage/service/AddAndGarbage.java trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/Garbage.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:55:04
|
Revision: 3161 http://joafip.svn.sourceforge.net/joafip/?rev=3161&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:58 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip-4test/jrat.xml trunk/joafip-4test/src/main/java/net/sf/joafip/garbage/service/AddAndGarbage.java trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/Garbage.java Modified: trunk/joafip-4test/jrat.xml =================================================================== --- trunk/joafip-4test/jrat.xml 2012-11-22 06:54:47 UTC (rev 3160) +++ trunk/joafip-4test/jrat.xml 2012-11-22 06:54:58 UTC (rev 3161) @@ -1,22 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> <jrat> - <settings> - <property name="httpServerEnabled" value="false"/> - </settings> + <settings> + <property name="httpServerEnabled" value="false" /> + </settings> - <profile name="my code"> + <profile name="my code"> - <criteria> - <include/> - </criteria> + <criteria> + <include /> + </criteria> - <handlers> + <handlers> - <handler factory="org.shiftone.jrat.provider.tree.TreeMethodHandlerFactory"> - <property name="outputFile" value="joafip.jrat"/> - </handler> + <handler factory="org.shiftone.jrat.provider.tree.TreeMethodHandlerFactory"> + <property name="outputFile" value="joafip.jrat" /> + </handler> - </handlers> + </handlers> - </profile> + </profile> </jrat> \ No newline at end of file Modified: trunk/joafip-4test/src/main/java/net/sf/joafip/garbage/service/AddAndGarbage.java =================================================================== --- trunk/joafip-4test/src/main/java/net/sf/joafip/garbage/service/AddAndGarbage.java 2012-11-22 06:54:47 UTC (rev 3160) +++ trunk/joafip-4test/src/main/java/net/sf/joafip/garbage/service/AddAndGarbage.java 2012-11-22 06:54:58 UTC (rev 3161) @@ -70,7 +70,7 @@ printState(filePersistence); - filePersistence.garbageSweep(); + filePersistence.garbageSweep("runtime/set"); printState(filePersistence); Modified: trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/Garbage.java =================================================================== --- trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/Garbage.java 2012-11-22 06:54:47 UTC (rev 3160) +++ trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/Garbage.java 2012-11-22 06:54:58 UTC (rev 3161) @@ -56,7 +56,7 @@ final long startTime = System.currentTimeMillis(); displayTime = startTime - 2000; filePersistence.setGarbageListener(this); - final int numberGarbaged = filePersistence.garbageSweep(); + final int numberGarbaged = filePersistence.garbageSweep("runtime/set"); final long endTime = System.currentTimeMillis(); final long duration = (endTime - startTime); LOGGER.info("garbaged=" + numberGarbaged + " duration=" + duration This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:54:53
|
Revision: 3160 http://joafip.svn.sourceforge.net/joafip/?rev=3160&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:47 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java Modified: trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java =================================================================== --- trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java 2012-11-22 06:54:40 UTC (rev 3159) +++ trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java 2012-11-22 06:54:47 UTC (rev 3160) @@ -24,8 +24,12 @@ import junit.framework.Test; import junit.framework.TestSuite; -import net.sf.joafip.service.TestCrashSafe; -import net.sf.joafip.service.TestMultipleFilePersistenceInstance; +import net.sf.joafip.service.rel400.TestRuntime310Garbage; +import net.sf.joafip.store.service.TestGarbageForegroundFile; +import net.sf.joafip.store.service.TestGarbageForegroundMemory; +import net.sf.joafip.store.service.TestNoGarbageInFile; +import net.sf.joafip.store.service.TestNoGarbageInMemory; +import net.sf.joafip.store.service.garbage.TestStoreGarbager; /** * @@ -42,8 +46,12 @@ public static Test suite() { final TestSuite suite = new TestSuite("in error Tests"); // $JUnit-BEGIN$ - suite.addTestSuite(TestCrashSafe.class); - suite.addTestSuite(TestMultipleFilePersistenceInstance.class); + suite.addTestSuite(TestGarbageForegroundMemory.class); + suite.addTestSuite(TestGarbageForegroundFile.class); + suite.addTestSuite(TestNoGarbageInMemory.class); + suite.addTestSuite(TestNoGarbageInFile.class); + suite.addTestSuite(TestStoreGarbager.class); + suite.addTestSuite(TestRuntime310Garbage.class); // suite.addTest(xxxx.suite()); // $JUnit-END$ return suite; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:54:53
|
Revision: 3160 http://joafip.svn.sourceforge.net/joafip/?rev=3160&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:47 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip-testsuite/src/main/java/net/sf/joafip/InErrorTests.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:54:46
|
Revision: 3159 http://joafip.svn.sourceforge.net/joafip/?rev=3159&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:40 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/AbstractHeapDataManager.java trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/IHeapDataManager.java trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/BlockDataManager.java trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/DualWrapDataManager.java trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/HeapMemoryDataManagerMock.java trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/HeapMultiFileDataManager.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:54:46
|
Revision: 3159 http://joafip.svn.sourceforge.net/joafip/?rev=3159&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:40 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/AbstractHeapDataManager.java trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/IHeapDataManager.java trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/BlockDataManager.java trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/DualWrapDataManager.java trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/HeapMemoryDataManagerMock.java trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/HeapMultiFileDataManager.java Modified: trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/AbstractHeapDataManager.java =================================================================== --- trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/AbstractHeapDataManager.java 2012-11-22 06:54:24 UTC (rev 3158) +++ trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/AbstractHeapDataManager.java 2012-11-22 06:54:40 UTC (rev 3159) @@ -175,12 +175,17 @@ @Override final public void stopService() throws HeapException { + stopService(false); + } + + @Override + public void stopService(final boolean removeFiles) throws HeapException { try { // ASSERTX assert assertStarted(); started = false; stopperStackTrace = new Exception("stopper stack trace");// NOPMD - stopServiceImpl(); + stopServiceImpl(removeFiles); } catch (HeapException exception) { logger.fatal(STOP_SERVICE_FAILED, exception); closeHeapManagerAfterException(); @@ -197,7 +202,7 @@ * * @throws HeapException */ - protected abstract void stopServiceImpl() throws HeapException; + protected abstract void stopServiceImpl(boolean removeFiles) throws HeapException; @Override public boolean isServiceStarted() { Modified: trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/IHeapDataManager.java =================================================================== --- trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/IHeapDataManager.java 2012-11-22 06:54:24 UTC (rev 3158) +++ trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/service/IHeapDataManager.java 2012-11-22 06:54:40 UTC (rev 3159) @@ -57,16 +57,18 @@ * read/write error, file restored from stable backup, file * management is not opened, no file in stable state */ - void startService(final boolean removeFiles) throws HeapException; + void startService(boolean removeFiles) throws HeapException; /** * stop heap data manager service, do not flush in file any modification. - * modification are lost + * modification are lost, files not removed. * * @throws HeapException */ void stopService() throws HeapException; + void stopService(boolean removeFiles) throws HeapException; + /** * * @return true if service started Modified: trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/BlockDataManager.java =================================================================== --- trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/BlockDataManager.java 2012-11-22 06:54:24 UTC (rev 3158) +++ trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/BlockDataManager.java 2012-11-22 06:54:40 UTC (rev 3159) @@ -125,10 +125,13 @@ } @Override - protected void stopServiceImpl() throws HeapException { + protected void stopServiceImpl(final boolean removeFles) throws HeapException { try { writeHeader(); randomAccessFile.close(); + if( removeFles) { + removeFiles(); + } } catch (FileIOException exception) { throw new HeapException(exception); } Modified: trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/DualWrapDataManager.java =================================================================== --- trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/DualWrapDataManager.java 2012-11-22 06:54:24 UTC (rev 3158) +++ trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/DualWrapDataManager.java 2012-11-22 06:54:40 UTC (rev 3159) @@ -68,6 +68,12 @@ } @Override + public void stopService(final boolean removeFiles) throws HeapException { + firstDataManager.stopService(removeFiles); + secondDataManager.stopService(removeFiles); + } + + @Override public boolean isServiceStarted() { final boolean started1 = firstDataManager.isServiceStarted(); final boolean started2 = secondDataManager.isServiceStarted(); Modified: trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/HeapMemoryDataManagerMock.java =================================================================== --- trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/HeapMemoryDataManagerMock.java 2012-11-22 06:54:24 UTC (rev 3158) +++ trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/HeapMemoryDataManagerMock.java 2012-11-22 06:54:40 UTC (rev 3159) @@ -73,9 +73,12 @@ } @Override - protected void stopServiceImpl() throws HeapException { + protected void stopServiceImpl(final boolean removeFiles) throws HeapException { toWritePendigRecordMap.clear(); toDeletePending.clear(); + if( removeFiles) { + removeFiles(); + } } @Override Modified: trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/HeapMultiFileDataManager.java =================================================================== --- trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/HeapMultiFileDataManager.java 2012-11-22 06:54:24 UTC (rev 3158) +++ trunk/joafip-kvstore/src/test/java/net/sf/joafip/kvstore/service/HeapMultiFileDataManager.java 2012-11-22 06:54:40 UTC (rev 3159) @@ -68,7 +68,7 @@ } @Override - protected void stopServiceImpl() throws HeapException { + protected void stopServiceImpl(final boolean removeFiles) throws HeapException { // no implementation } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:54:30
|
Revision: 3158 http://joafip.svn.sourceforge.net/joafip/?rev=3158&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:24 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/service/HeapFileCheckerDataManager.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:54:30
|
Revision: 3158 http://joafip.svn.sourceforge.net/joafip/?rev=3158&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:24 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/service/HeapFileCheckerDataManager.java Modified: trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java =================================================================== --- trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java 2012-11-22 06:54:14 UTC (rev 3157) +++ trunk/joafip-heapfile/src/main/java/net/sf/joafip/heapfile/service/HeapFileDataManager.java 2012-11-22 06:54:24 UTC (rev 3158) @@ -145,11 +145,14 @@ } @Override - protected void stopServiceImpl() throws HeapException { + protected void stopServiceImpl(final boolean removeFiles) throws HeapException { if (heapElementManager.isTransactionOpened()) { heapElementManager.closeTransactionDiscardChange(); } heapElementManager.stopService(); + if( removeFiles) { + heapElementManager.removeFiles(); + } } @Override Modified: trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/service/HeapFileCheckerDataManager.java =================================================================== --- trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/service/HeapFileCheckerDataManager.java 2012-11-22 06:54:14 UTC (rev 3157) +++ trunk/joafip-heapfile/src/test/java/net/sf/joafip/heapfile/service/HeapFileCheckerDataManager.java 2012-11-22 06:54:24 UTC (rev 3158) @@ -61,6 +61,12 @@ } @Override + public void stopService(final boolean removeFiles) throws HeapException { + heapFileDataManager.stopService(removeFiles); + heapMultiFileDataManager.stopService(removeFiles); + } + + @Override public void clear() throws HeapException { heapFileDataManager.clear(); heapMultiFileDataManager.clear(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:54:20
|
Revision: 3157 http://joafip.svn.sourceforge.net/joafip/?rev=3157&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:14 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip-btreeplus/src/main/java/net/sf/joafip/btreeplus/service/BtreePlusDataManager.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:54:20
|
Revision: 3157 http://joafip.svn.sourceforge.net/joafip/?rev=3157&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:14 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip-btreeplus/src/main/java/net/sf/joafip/btreeplus/service/BtreePlusDataManager.java Modified: trunk/joafip-btreeplus/src/main/java/net/sf/joafip/btreeplus/service/BtreePlusDataManager.java =================================================================== --- trunk/joafip-btreeplus/src/main/java/net/sf/joafip/btreeplus/service/BtreePlusDataManager.java 2012-11-22 06:54:06 UTC (rev 3156) +++ trunk/joafip-btreeplus/src/main/java/net/sf/joafip/btreeplus/service/BtreePlusDataManager.java 2012-11-22 06:54:14 UTC (rev 3157) @@ -113,11 +113,14 @@ } @Override - protected void stopServiceImpl() throws HeapException { + protected void stopServiceImpl(final boolean removeFiles) throws HeapException { if (btreePlusElementMgr.isTransactionOpened()) { btreePlusElementMgr.closeTransactionDiscardChange(); } btreePlusElementMgr.stopService(); + if( removeFiles ) { + btreePlusElementMgr.removeFiles(); + } } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:54:14
|
Revision: 3156 http://joafip.svn.sourceforge.net/joafip/?rev=3156&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:06 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfo.java trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java trunk/joafip/src/main/java/net/sf/joafip/store/service/IStoreForGarbage.java trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/IGarbageManagerForCollect.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/LinkManager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java trunk/joafip/src/main/java/net/sf/joafip/store/service/saver/IStoreSaverForGarbage.java trunk/joafip/src/main/java/net/sf/joafip/store/service/saver/StoreSaver3.java trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestRuntime310Garbage.java trunk/joafip/src/test/java/net/sf/joafip/store/entity/garbage/ReferenceLinkGraph.java trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestGarbage.java trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestNoGarbage.java trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java trunk/joafip/src/test/java/net/sf/joafip/store/service/TestGarbageForegroundFile.java trunk/joafip/src/test/java/net/sf/joafip/store/service/TestGarbageForegroundMemory.java trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/TestStoreGarbager.java Modified: trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -810,11 +810,19 @@ } @Override - public int garbageSweep() throws FilePersistenceException { + public int garbageSweep(final String filePath) + throws FilePersistenceException, + FilePersistenceClassNotFoundException, + FilePersistenceDataCorruptedException { + assertSessionClosed(); try { - return store.garbageSweep(); + return store.garbageSweep(filePath); } catch (final StoreException exception) { throw new FilePersistenceException(exception); + } catch (StoreClassNotFoundException exception) { + throw new FilePersistenceClassNotFoundException(exception); + } catch (StoreDataCorruptedException exception) { + throw new FilePersistenceDataCorruptedException(exception); } } Modified: trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -779,10 +779,16 @@ * garbage sweep, remove data record for object not attached to root<br> * should be call only when session closed<br> * + * @param filePath + * temporary file for data record identifier set * @return number of garbage data record seeped * @throws FilePersistenceException + * @throws FilePersistenceClassNotFoundException + * @throws FilePersistenceDataCorruptedException */ - int garbageSweep() throws FilePersistenceException; + int garbageSweep(final String filePath) throws FilePersistenceException, + FilePersistenceClassNotFoundException, + FilePersistenceDataCorruptedException; /** * enable background garbage sweep operation<br> Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfo.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfo.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfo.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -125,7 +125,7 @@ assertNotNull = field.isAnnotationPresent(AssertNotNull.class); } - // FIXMELUC _______known field: called ? + // FIXMELUC ______known field: called ? public FieldInfo(final ClassInfo declaringClass, final String fieldName, final ClassInfo fieldType, final Boolean staticField, final Boolean transientField) throws ClassInfoException { Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -507,10 +507,15 @@ * garbage sweep, remove data record for object not attached to root<br> * should be call only when all object detached, at startup or after commit<br> * + * @param filePath + * temporary file for data record identifier set * @return number of garbage data record swept * @throws StoreException + * @throws StoreDataCorruptedException + * @throws StoreClassNotFoundException */ - int garbageSweep() throws StoreException; + int garbageSweep(final String filePath) throws StoreException, + StoreClassNotFoundException, StoreDataCorruptedException; /** * enable background garbage sweep operation @@ -585,6 +590,7 @@ IHeapDataManager getDataManager() throws StoreException; + @Override IClassNameManager getClassNameManager(); int getClassIdentifier(Class<?> clazz) throws StoreException, Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/IStoreForGarbage.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/IStoreForGarbage.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/IStoreForGarbage.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -24,6 +24,8 @@ import net.sf.joafip.service.JoafipMutex; import net.sf.joafip.store.service.garbage.GarbageManager; +import net.sf.joafip.store.service.objectio.manager.IClassNameManager; +import net.sf.joafip.store.service.objectio.manager.IObjectIoManagerForGarbage; /** * @@ -36,5 +38,9 @@ GarbageManager getGarbageManager(); + IClassNameManager getClassNameManager(); + + IObjectIoManagerForGarbage getObjectIOManager() throws StoreException; + JoafipMutex getMutex(); } Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -1316,10 +1316,10 @@ } @Override - public int garbageSweep() throws StoreException { + public int garbageSweep(final String filePath) throws StoreException, + StoreClassNotFoundException, StoreDataCorruptedException { synchronized (mutex) { - assertManageGarbage(); - return storeGarbager.garbageSweep(); + return storeGarbager.garbageSweep(filePath); } } Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/IGarbageManagerForCollect.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/IGarbageManagerForCollect.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/IGarbageManagerForCollect.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -81,4 +81,8 @@ void getCandidateRecordAllDataRecordIdentifiers(Set<DataRecordIdentifier> setToUpdate) throws GarbageException; + + boolean removeFromCandidateAndOrFromToGarbage( + final DataRecordIdentifier dataRecordIdentifier) + throws GarbageException; } Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/LinkManager.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/LinkManager.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/LinkManager.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -104,7 +104,7 @@ } /** - * remove a link from reference to referenced<br> + * remove a link from referencing to referenced<br> * {@link #initializeLinkUpdate()} must be called before first call to this * method<br> * @@ -132,6 +132,12 @@ } } + public void removeLinkIfExist( + DataRecordIdentifier referencedDataRecordIdentifier) + throws GarbageException, ReferenceLinkGarbageException { + linkRecordManager.removeLinkIfExist(referencedDataRecordIdentifier); + } + /** * update link between object on database according to * {@link #addLink(long, long)} and {@link #removeLink(long)} call<br> @@ -274,4 +280,8 @@ throws GarbageException, ReferenceLinkGarbageException { return linkRecordManager.isReferenced(dataRecordIdentifier); } + + public LinkRecordManager getLinkRecordManager() { + return linkRecordManager; + } } Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -16,22 +16,37 @@ */ package net.sf.joafip.store.service.garbage; +import java.util.Deque; +import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Set; import net.sf.joafip.Fortest; import net.sf.joafip.NotStorableClass; import net.sf.joafip.kvstore.record.entity.DataRecordIdentifier; +import net.sf.joafip.kvstore.service.HeapException; +import net.sf.joafip.kvstore.service.IHeapDataManager; import net.sf.joafip.logger.JoafipLogger; import net.sf.joafip.service.JoafipMutex; import net.sf.joafip.store.entity.garbage.DataRecordIdentifierRBTNode; import net.sf.joafip.store.entity.garbage.ReferenceLink; import net.sf.joafip.store.entity.garbage.ReferenceLinkGarbageException; +import net.sf.joafip.store.entity.objectio.ObjectLinkTreeNode; import net.sf.joafip.store.service.IGarbageListener; import net.sf.joafip.store.service.IStoreForGarbage; import net.sf.joafip.store.service.Store; +import net.sf.joafip.store.service.StoreClassNotFoundException; +import net.sf.joafip.store.service.StoreDataCorruptedException; import net.sf.joafip.store.service.StoreException; +import net.sf.joafip.store.service.garbage.recordmgr.LinkRecordManager; +import net.sf.joafip.store.service.objectio.ObjectIOClassNotFoundException; +import net.sf.joafip.store.service.objectio.ObjectIODataCorruptedException; +import net.sf.joafip.store.service.objectio.ObjectIODataRecordNotFoundException; +import net.sf.joafip.store.service.objectio.ObjectIOException; +import net.sf.joafip.store.service.objectio.manager.IObjectIoManagerForGarbage; import net.sf.joafip.store.service.saver.IStoreSaverForGarbage; +import net.sf.joafip.util.PersistantDataRecordIdentifierSet; /** * garbage operation for {@link Store}<br> @@ -55,6 +70,8 @@ /** manage saving of object */ private IStoreSaverForGarbage storeSaver; + private final IObjectIoManagerForGarbage objectIOManager; + private final JoafipMutex storeMutex; /** sleep time between garbage collect operation */ @@ -78,15 +95,26 @@ private int numberOFGarbaged; + private LinkRecordManager linkRecordManager;; + + //private LinkManager linkManager; + public StoreGarbager(final IStoreForGarbage store) throws StoreException { super(); this.store = store; garbageManager = store.getGarbageManager(); + objectIOManager = store.getObjectIOManager(); this.storeMutex = store.getMutex(); } public void setStoreSaver(final IStoreSaverForGarbage storeSaver) { this.storeSaver = storeSaver; + LinkManager linkManager = storeSaver.getLinkManager(); + if( linkManager==null) { + linkRecordManager=null; + } else { + linkRecordManager=linkManager.getLinkRecordManager(); + } } public void setGarbageListener(final IGarbageListener listener) { @@ -158,34 +186,113 @@ /** * garbage sweep, remove data record for object not attached to root<br> * + * @param filePath + * temporary file for data record identifier set * @return number of garbage data record sweep * @throws StoreException + * @throws StoreClassNotFoundException + * @throws StoreDataCorruptedException */ - public int garbageSweep() throws StoreException { + // FIXMELUC ____________garbageSweep + public int garbageSweep(final String filePath) throws StoreException, + StoreClassNotFoundException, StoreDataCorruptedException { numberOFGarbaged = 0; + PersistantDataRecordIdentifierSet toPreserveSet = null; try { + toPreserveSet = new PersistantDataRecordIdentifierSet(filePath); + toPreserveSet.startService(true); + store.getClassNameManager().getAllDataRecordIdentifiers( + toPreserveSet); + store.getGarbageManager() + .getCandidateRecordAllDataRecordIdentifiers(toPreserveSet); + store.getGarbageManager().getLinkRecordAllDataRecordIdentifiers( + toPreserveSet); + store.getGarbageManager() + .getToGarbageRecordAllDataRecordIdentifiers(toPreserveSet); + + toPreserveSet.add(Store.IDENTIFIER_FOR_STORE_HEADER); + final Deque<DataRecordIdentifier> que = new LinkedList<DataRecordIdentifier>(); + DataRecordIdentifier dataRecordIdentifier = Store.IDENTIFIER_FOR_ROOT; + que.add(dataRecordIdentifier); + toPreserveSet.add(dataRecordIdentifier); storeSaver.resetModificationCount(); + while ((dataRecordIdentifier = que.pollFirst()) != null) { + final ObjectLinkTreeNode objectLinkTreeNode = objectIOManager + .getObjectLinkTreeNode(dataRecordIdentifier); + final DataRecordIdentifier[] referencedList = objectLinkTreeNode + .getReferencedList(); + for (DataRecordIdentifier referenced : referencedList) { + if (toPreserveSet.add(referenced)) { + que.add(referenced); + storeSaver.performModificationDone(); + } + } + } + + final IHeapDataManager dataManager = storeSaver.getDataManager(); + final Iterator<DataRecordIdentifier> iterator = dataManager + .dataRecordIterator(); garbageStartNotify(); - boolean operationDone; - do { - operationDone = garbageManager.garbagePass(); - if (garbageManager.isOneGarbaged()) { + while (iterator.hasNext()) { + final DataRecordIdentifier existing = iterator.next(); + garbageManager.removeFromCandidateAndOrFromToGarbage(existing); + if (!toPreserveSet.contains(existing)) { + if (linkRecordManager == null) { + dataManager.deleteDataRecord(existing); + } else { + linkRecordManager.removeLinkIfExist(existing/*referenced*/); + final ObjectLinkTreeNode objectLinkTreeNode = objectIOManager + .getObjectLinkTreeNode(existing); + dataManager.deleteDataRecord(existing); + final DataRecordIdentifier[] referencedList = objectLinkTreeNode + .getReferencedList(); + for (DataRecordIdentifier referenced : referencedList) { + removeLink(existing/*referencing*/, referenced); + } + } numberOFGarbaged++; + notifyGarbaged(); } - notifyGarbaged(); - if (operationDone) { - storeSaver.performModificationDone(); - } - } while (operationDone); + storeSaver.performModificationDone(); + } storeSaver.saveModification(); + } catch (GarbageException exception) { throw new StoreException(exception); } catch (ReferenceLinkGarbageException exception) { throw new StoreException(exception); + } catch (HeapException exception) { + throw new StoreException(exception); + } catch (ObjectIOException exception) { + throw new StoreException(exception); + } catch (ObjectIOClassNotFoundException exception) { + throw new StoreClassNotFoundException(exception); + } catch (ObjectIODataRecordNotFoundException exception) { + throw new StoreException(exception); + } catch (ObjectIODataCorruptedException exception) { + throw new StoreDataCorruptedException(exception); + } finally { + if (toPreserveSet != null) { + try { + toPreserveSet.stopService(true); + } catch (Exception exception) { + // ignore error + LOGGER.error("closing set", exception); + } + } } return numberOFGarbaged; } + private void removeLink(final DataRecordIdentifier referencing, + final DataRecordIdentifier referenced) throws GarbageException, ReferenceLinkGarbageException { + final ReferenceLink referenceLink = linkRecordManager.searchByReferenced(referenced); + if( referenceLink!=null) { + referenceLink.decrementLinkCount(referencing); + linkRecordManager.updateReferenceLink(referenceLink); + } + } + private void garbageStartNotify() throws GarbageException { if (garbageListener != null) { final int leftToGarbage = garbageManager.getNumberOfToGarbage(); Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -972,7 +972,7 @@ return bodyData; } - @Fortest + @Override public ObjectLinkTreeNode getObjectLinkTreeNode( final DataRecordIdentifier dataRecordIdentifier) throws ObjectIOException, ObjectIODataRecordNotFoundException, Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/saver/IStoreSaverForGarbage.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/saver/IStoreSaverForGarbage.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/saver/IStoreSaverForGarbage.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -16,7 +16,9 @@ */ package net.sf.joafip.store.service.saver; +import net.sf.joafip.kvstore.service.IHeapDataManager; import net.sf.joafip.store.service.StoreException; +import net.sf.joafip.store.service.garbage.LinkManager; public interface IStoreSaverForGarbage { @@ -35,4 +37,10 @@ * @throws StoreException */ boolean saveModification() throws StoreException; + + void flush() throws StoreException; + + IHeapDataManager getDataManager(); + + LinkManager getLinkManager(); } Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/saver/StoreSaver3.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/saver/StoreSaver3.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/saver/StoreSaver3.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -899,7 +899,8 @@ * * @throws StoreException */ - private void flush() throws StoreException { + @Override + public void flush() throws StoreException { /* now can save the record for class name and garbage */ try { heapRecordableManager.save(); @@ -961,4 +962,13 @@ public void setStoreOnlyMarkedStorable(final boolean storeOnlyMarkedStorable) { this.storeOnlyMarkedStorable = storeOnlyMarkedStorable; } + + @Override + public IHeapDataManager getDataManager() { + return dataManager; + } + + public LinkManager getLinkManager() { + return linkManager; + } } Modified: trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -73,6 +73,10 @@ heapDataManagerForSet.stopService(); } + public void stopService(final boolean removeFiles) throws HeapException { + heapDataManagerForSet.stopService(removeFiles); + } + @Override public Iterator<DataRecordIdentifier> iterator() { try { Modified: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestRuntime310Garbage.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestRuntime310Garbage.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestRuntime310Garbage.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -7,6 +7,7 @@ import net.sf.joafip.NotStorableClass; import net.sf.joafip.StorableAccess; import net.sf.joafip.TestException; +import net.sf.joafip.entity.EnumFilePersistenceCloseAction; import net.sf.joafip.kvstore.entity.EnumFileAccessMode; import net.sf.joafip.kvstore.record.entity.DataRecordIdentifier; import net.sf.joafip.kvstore.service.HeapException; @@ -138,11 +139,14 @@ assertFalse("bob1 #" + dataRecordIdentifier + "must not be to garbage", garbageDataIntegrityChecker .isKnownToGarbage(dataRecordIdentifier)); - - filePersistence.garbageSweep(); - + session.setObject("bob1",bob1); + + session.close(EnumFilePersistenceCloseAction.SAVE); + filePersistence.garbageSweep("runtime/set"); + session.open(); + garbageDataIntegrityChecker.check(filePersistence); - assertAttachedState(dataRecordIdentifier, false); + assertAttachedState(dataRecordIdentifier, true); assertFalse("bob1 #" + dataRecordIdentifier + " must not be a garbage candidate", garbageDataIntegrityChecker @@ -155,18 +159,16 @@ bob1 = (Bob1) filePersistence .createObjectReadingInStoreOrGetExisting(dataRecordIdentifier); assertEquals("bad value", 10, bob1.getVal()); + session.close(); garbageDataIntegrityChecker.check(filePersistence); - assertAttachedState(dataRecordIdentifier, false); - filePersistence.garbageSweep(); + assertAttachedState(dataRecordIdentifier, true); + filePersistence.garbageSweep("runtime/set"); garbageDataIntegrityChecker.check(filePersistence); // bad test below because data record is deleted // assertAttachedState(dataRecordIdentifier, false); - session.open(); - - assertDeleted(dataRecordIdentifier); } public void testGarbageInBackground() throws FilePersistenceException, @@ -265,23 +267,25 @@ garbageDataIntegrityChecker.check(filePersistence); assertAttachedState(dataRecordIdentifier, false); - filePersistence.garbageSweep(); + session.close(EnumFilePersistenceCloseAction.SAVE); + filePersistence.garbageSweep("runtime/set"); +// session.open(); - // check if kept in file - assertTrue("must be unloaded", ProxyManager2.isUnloaded(bob1)); - assertEquals("bad value", 10, bob1.getVal()); +// // check if kept in file +// assertTrue("must be unloaded", ProxyManager2.isUnloaded(bob1)); +// assertEquals("bad value", 10, bob1.getVal()); +// +// bob1 = null;// NOPMD release object - bob1 = null;// NOPMD release object +// _LOG.debug("session close"); +// session.close(); - _LOG.debug("session close"); - session.close(); - garbageDataIntegrityChecker.check(filePersistence); assertAttachedState(dataRecordIdentifier, false); garbageDataIntegrityChecker.check(filePersistence); _LOG.debug("garbage sweep"); - filePersistence.garbageSweep(); + filePersistence.garbageSweep("runtime/set"); session.open(); Modified: trunk/joafip/src/test/java/net/sf/joafip/store/entity/garbage/ReferenceLinkGraph.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/entity/garbage/ReferenceLinkGraph.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/test/java/net/sf/joafip/store/entity/garbage/ReferenceLinkGraph.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -26,6 +26,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; @@ -114,6 +115,10 @@ } } + public boolean hasDataRecordIdentifier(final DataRecordIdentifier identifier) { + return map.containsKey(identifier); + } + public Set<DataRecordIdentifier> getAllDataRecordIdentifier() { return map.keySet(); } @@ -193,4 +198,27 @@ builder.append("\n]"); return builder.toString(); } + + public String refMapToString() { + final StringBuffer stringBuffer=new StringBuffer(); + for(Entry<DataRecordIdentifier, ReferenceLinkEntry> entry:map.entrySet()) { + DataRecordIdentifier dataRecordIdentifier = entry.getKey(); + ReferenceLinkEntry refLink = entry.getValue(); + Set<DataRecordIdentifier> referencedSet = refLink.getReferencedSet(); + for(DataRecordIdentifier referenced:referencedSet) { + stringBuffer.append(dataRecordIdentifier); + stringBuffer.append("->"); + stringBuffer.append(referenced); + stringBuffer.append('\n'); + } + Set<DataRecordIdentifier> referencingSet = refLink.getReferencingSet(); + for(DataRecordIdentifier referencing:referencedSet) { + stringBuffer.append(dataRecordIdentifier); + stringBuffer.append("<-"); + stringBuffer.append(referencing); + stringBuffer.append('\n'); + } + } + return stringBuffer.toString(); + } } Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestGarbage.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestGarbage.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestGarbage.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -810,6 +810,7 @@ }); } - protected abstract void garbageSweep() throws StoreException; + protected abstract void garbageSweep() throws StoreException, + StoreClassNotFoundException, StoreDataCorruptedException; } Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestNoGarbage.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestNoGarbage.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestNoGarbage.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -164,7 +164,7 @@ /* * do garbage collection even if garbage management disable */ - tryGarbageSweep(); + store.garbageSweep("runtime/set"); /* * assert no garbage information after detaching object @@ -185,24 +185,15 @@ logAllDataIdentifier(); numberOfDataRecord = dataManager.getNumberOfDataRecord(); assertEquals("number of data record must not change", - initialNumberOfDataRecord, numberOfDataRecord); + initialNumberOfDataRecord - 2, numberOfDataRecord); assertDataRecord(new DataRecordIdentifier[] { /**/Store.IDENTIFIER_FOR_STORE_HEADER,/* store header */ /**/Store.IDENTIFIER_FOR_ROOT,/* root record */ - /**/idBobContainer,/**/ - /**/idBob1,/**/ - /**/idBob2 /**/ - }, new DataRecordIdentifier[] {}); + /**/idBobContainer // ,/**/ + // /**/idBob1,/**/ + // /**/idBob2 /**/ + }, new DataRecordIdentifier[] {}); } - private void tryGarbageSweep() { - try { - logger.debug("try garbage collection"); - store.garbageSweep(); - fail("garbage collector invocation must failed");// NOPMD - } catch (final StoreException exception) {// NOPMD - // expected exception - } - } } \ No newline at end of file Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -356,8 +356,9 @@ return store.freeSize(); } - public int garbageSweep() throws StoreException { - return store.garbageSweep(); + public int garbageSweep(final String filePath) throws StoreException, + StoreClassNotFoundException, StoreDataCorruptedException { + return store.garbageSweep(filePath); } public ReferenceLink[] getAllReferenceLink() throws StoreException { Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/TestGarbageForegroundFile.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/TestGarbageForegroundFile.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/TestGarbageForegroundFile.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -54,7 +54,8 @@ } @Override - protected void garbageSweep() throws StoreException { - store.garbageSweep(); + protected void garbageSweep() throws StoreException, + StoreClassNotFoundException, StoreDataCorruptedException { + store.garbageSweep("runtime/set"); } } Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/TestGarbageForegroundMemory.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/TestGarbageForegroundMemory.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/TestGarbageForegroundMemory.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -56,7 +56,8 @@ } @Override - protected void garbageSweep() throws StoreException { - store.garbageSweep(); + protected void garbageSweep() throws StoreException, + StoreClassNotFoundException, StoreDataCorruptedException { + store.garbageSweep("runtime/set"); } } Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -99,12 +99,12 @@ .getDataRecordIdentifierSet(); forObjectDatarecordIdentifierSet .remove(new DataRecordIdentifier(0)); - - Set<DataRecordIdentifier> setToUpdate=new TreeSet<DataRecordIdentifier>(); + + Set<DataRecordIdentifier> setToUpdate = new TreeSet<DataRecordIdentifier>(); filePersistence.usedForGarbageManagement(setToUpdate); filePersistence.usedForClassNameManagement(setToUpdate); forObjectDatarecordIdentifierSet.removeAll(setToUpdate); - + for (DataRecordIdentifier referencingDataRecordIdentifier : forObjectDatarecordIdentifierSet) { final ObjectLinkTreeNode objectLinkTreeNode = objectIOManager .getObjectLinkTreeNode(referencingDataRecordIdentifier); @@ -115,7 +115,6 @@ } /* graph from storage content */ - referenceLinkGraphFromStorage .compute(StoreForTest.IDENTIFIER_FOR_ROOT); @@ -133,10 +132,13 @@ for (Referencing referencing : referencings) { final DataRecordIdentifier referencingDataRecordIdentifier = referencing .getDataRecordIdentifier(); - TestCase.assertTrue( - "referencing not in storage", - dataManager - .hasDataRecord(referencingDataRecordIdentifier)); + + // FIXMELUC ____________________referencing not exists + // TestCase.assertTrue(referencingDataRecordIdentifier + // + " referencing " + referencedDataRecordIdentifier + // + " not in storage", dataManager + // .hasDataRecord(referencingDataRecordIdentifier)); + final int linkCount = referencing.getLinkCount(); referenceLinkGraphFromLinkInfo.addReferencing( referencedDataRecordIdentifier, @@ -147,6 +149,12 @@ referenceLinkGraphFromLinkInfo .compute(StoreForTest.IDENTIFIER_FOR_ROOT); + TestCase.assertEquals( + referenceLinkGraphFromStorage.refMapToString(), + referenceLinkGraphFromLinkInfo.refMapToString()); + + // + for (DataRecordIdentifierRBTNode candidateNode : knownCandidate) { final DataRecordIdentifier candidateDataRecordIdentifier = candidateNode .getElement(); @@ -278,8 +286,10 @@ public boolean isDetachedAccordingToLinkInfo( final DataRecordIdentifier dataRecordIdentifier) { - return referenceLinkGraphFromLinkInfo - .getDetachedToRootSet(dataRecordIdentifier) != null; + return !referenceLinkGraphFromLinkInfo + .hasDataRecordIdentifier(dataRecordIdentifier) + || referenceLinkGraphFromLinkInfo + .getDetachedToRootSet(dataRecordIdentifier) != null; } public boolean isAttachedAccordingToLinkInfo( @@ -290,8 +300,10 @@ public boolean isDetachedAccordingToStorage( final DataRecordIdentifier dataRecordIdentifier) { - return referenceLinkGraphFromStorage - .getDetachedToRootSet(dataRecordIdentifier) != null; + return !referenceLinkGraphFromStorage + .hasDataRecordIdentifier(dataRecordIdentifier) + || referenceLinkGraphFromStorage + .getDetachedToRootSet(dataRecordIdentifier) != null; } public boolean isAttachedAccordingToStorage( Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/TestStoreGarbager.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/TestStoreGarbager.java 2012-11-18 15:32:11 UTC (rev 3155) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/TestStoreGarbager.java 2012-11-22 06:54:06 UTC (rev 3156) @@ -48,9 +48,12 @@ import net.sf.joafip.store.entity.objectio.ObjectAndPersistInfo; import net.sf.joafip.store.entity.objectio.ObjectLinkTreeNode; import net.sf.joafip.store.service.IStoreForGarbage; +import net.sf.joafip.store.service.StoreClassNotFoundException; +import net.sf.joafip.store.service.StoreDataCorruptedException; import net.sf.joafip.store.service.StoreException; import net.sf.joafip.store.service.StoreForTest; import net.sf.joafip.store.service.binary.HelperBinaryConversion; +import net.sf.joafip.store.service.classinfo.ClassInfoFactory; import net.sf.joafip.store.service.garbage.recordmgr.ToVisitRecordManager; import net.sf.joafip.store.service.garbage.recordmgr.VisitedRecordManager; import net.sf.joafip.store.service.heaprecordable.HeapRecordableManager; @@ -58,6 +61,8 @@ import net.sf.joafip.store.service.objectio.ObjectIODataCorruptedException; import net.sf.joafip.store.service.objectio.ObjectIODataRecordNotFoundException; import net.sf.joafip.store.service.objectio.ObjectIOException; +import net.sf.joafip.store.service.objectio.manager.ClassNameManager; +import net.sf.joafip.store.service.objectio.manager.IClassNameManager; import net.sf.joafip.store.service.objectio.manager.IObjectIoManagerForGarbage; import net.sf.joafip.store.service.saver.IStoreSaverForGarbage; @@ -75,6 +80,8 @@ private GarbageManager garbageManager; + private IClassNameManager classNameManager; + private JoafipMutex joafipMutex; private IHeapDataManager dataManager; @@ -124,8 +131,11 @@ toVisitRecordManager, visitedRecordManager, storeHeader, joafipMutex); garbager = new StoreGarbager(this); + linkManager = new LinkManager(garbageManager); garbager.setStoreSaver(this); - linkManager = new LinkManager(garbageManager); + final ClassInfoFactory classInfoFactory = new ClassInfoFactory(0/* currentDataModelIdentifier */); + classNameManager = new ClassNameManager(heapRecordableManager, + storeHeader, classInfoFactory, helperBinaryConversion); backgroundException = null;// NOPMD attachedToRoot = new TreeSet<DataRecordIdentifier>(); @@ -153,6 +163,36 @@ } @Override + public IClassNameManager getClassNameManager() { + return classNameManager; + } + + @Override + public IHeapDataManager getDataManager() { + return dataManager; + } + + @Override + public LinkManager getLinkManager() { + return linkManager; + } + + @Override + public void flush() throws StoreException { + try { + dataManager.flush(); + } catch (HeapException exception) { + throw new StoreException(exception); + } + } + + @Override + public IObjectIoManagerForGarbage getObjectIOManager() + throws StoreException { + return this; + } + + @Override public JoafipMutex getMutex() { return joafipMutex; } @@ -349,7 +389,8 @@ public void testBasicCase() throws HeapException, ObjectIODataRecordNotFoundException, IOException, ClassNotFoundException, GarbageException, - ReferenceLinkGarbageException, RBTException, StoreException { + ReferenceLinkGarbageException, RBTException, StoreException, + StoreClassNotFoundException, StoreDataCorruptedException { synchronized (joafipMutex) { attachedToRoot.clear(); linkManager.initializeLinkUpdate(attachedToRoot); @@ -372,7 +413,7 @@ assertTrue("data record #2 must exists", hasDataRecord(2)); assertCandidate(new long[] {}); assertToGarbage(new long[] { 2 }); - final int numberOfGarbaged = garbager.garbageSweep(); + final int numberOfGarbaged = garbager.garbageSweep("runtime/set"); assertNull("garbage failure", backgroundException);// NOPMD assertEquals("bad number of garbaged", 1, numberOfGarbaged);// NOPMD assertCandidate(new long[] {}); @@ -385,7 +426,8 @@ public void testForDetached() throws HeapException, ObjectIODataRecordNotFoundException, IOException, ClassNotFoundException, GarbageException, - ReferenceLinkGarbageException, RBTException, StoreException { + ReferenceLinkGarbageException, RBTException, StoreException, + StoreClassNotFoundException, StoreDataCorruptedException { synchronized (joafipMutex) { attachedToRoot.clear(); linkManager.initializeLinkUpdate(attachedToRoot); @@ -412,7 +454,7 @@ dataManager.flush(); assertCandidate(new long[] { 192 }); assertToGarbage(new long[] {}); - final int numberOfGarbaged = garbager.garbageSweep(); + final int numberOfGarbaged = garbager.garbageSweep("runtime/set"); assertNull("garbage failure", backgroundException); assertEquals("bad number of garbaged", 4, numberOfGarbaged); assertCandidate(new long[] {}); @@ -433,7 +475,8 @@ public void testForDetached2() throws HeapException, ObjectIODataRecordNotFoundException, IOException, ClassNotFoundException, GarbageException, - ReferenceLinkGarbageException, RBTException, StoreException { + ReferenceLinkGarbageException, RBTException, StoreException, + StoreClassNotFoundException, StoreDataCorruptedException { synchronized (joafipMutex) { // 1R -> 168R -> 170R -> 173R -> 175R // .......................... -> 176R -> 175R @@ -493,7 +536,7 @@ assertToGarbage(new long[] {}); assertTrue("data record #163 must exists", hasDataRecord(163)); assertTrue("data record #162 must exists", hasDataRecord(162)); - int numberOfGarbaged = garbager.garbageSweep(); + int numberOfGarbaged = garbager.garbageSweep("runtime/set"); assertNull("garbage failure", backgroundException); assertEquals("bad number of garbaged", 2, numberOfGarbaged); assertCandidate(new long[] {}); @@ -581,7 +624,7 @@ assertTrue("data record #191 must exists", hasDataRecord(191)); assertTrue("data record #283 must exists", hasDataRecord(283)); assertTrue("data record #1281 must exists", hasDataRecord(281)); - numberOfGarbaged = garbager.garbageSweep(); + numberOfGarbaged = garbager.garbageSweep("runtime/set"); assertNull("garbage failure", backgroundException); assertEquals("bad number of garbaged", 10, numberOfGarbaged); assertCandidate(new long[] {}); @@ -612,7 +655,8 @@ public void testForCycle() throws HeapException, ObjectIODataRecordNotFoundException, IOException, ClassNotFoundException, GarbageException, - ReferenceLinkGarbageException, RBTException, StoreException { + ReferenceLinkGarbageException, RBTException, StoreException, + StoreClassNotFoundException, StoreDataCorruptedException { synchronized (joafipMutex) { attachedToRoot.clear(); linkManager.initializeLinkUpdate(attachedToRoot); @@ -640,7 +684,7 @@ assertCandidate(new long[] {}); assertToGarbage(new long[] { 2 }); - final int numberOfGarbaged = garbager.garbageSweep(); + final int numberOfGarbaged = garbager.garbageSweep("runtime/set"); assertNull("garbage failure", backgroundException); assertEquals("bad number of garbaged", 4, numberOfGarbaged); assertCandidate(new long[] {}); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-22 06:54:13
|
Revision: 3156 http://joafip.svn.sourceforge.net/joafip/?rev=3156&view=rev Author: luc_peuvrier Date: 2012-11-22 06:54:06 +0000 (Thu, 22 Nov 2012) Log Message: ----------- foreground garbage changed Modified Paths: -------------- trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfo.java trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java trunk/joafip/src/main/java/net/sf/joafip/store/service/IStoreForGarbage.java trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/IGarbageManagerForCollect.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/LinkManager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java trunk/joafip/src/main/java/net/sf/joafip/store/service/saver/IStoreSaverForGarbage.java trunk/joafip/src/main/java/net/sf/joafip/store/service/saver/StoreSaver3.java trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestRuntime310Garbage.java trunk/joafip/src/test/java/net/sf/joafip/store/entity/garbage/ReferenceLinkGraph.java trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestGarbage.java trunk/joafip/src/test/java/net/sf/joafip/store/service/AbstractTestNoGarbage.java trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java trunk/joafip/src/test/java/net/sf/joafip/store/service/TestGarbageForegroundFile.java trunk/joafip/src/test/java/net/sf/joafip/store/service/TestGarbageForegroundMemory.java trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/TestStoreGarbager.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-18 15:32:20
|
Revision: 3155 http://joafip.svn.sourceforge.net/joafip/?rev=3155&view=rev Author: luc_peuvrier Date: 2012-11-18 15:32:11 +0000 (Sun, 18 Nov 2012) Log Message: ----------- new ay to obtains data record identifier set of data record for garbage management Modified Paths: -------------- trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/GarbageManager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/IGarbageManagerForCollect.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/GarbageCandidateRecordManager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/LinkRecordManager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/ToGarbageRecordManager.java trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java Modified: trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -24,7 +24,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.TreeSet; import net.sf.joafip.Fortest; import net.sf.joafip.NoStorableAccess; @@ -853,11 +852,11 @@ } } - @Fortest - public List<DataRecordIdentifier> usedForGarbageManagement() + public void usedForGarbageManagement( + final Set<DataRecordIdentifier> setToUpdate) throws FilePersistenceException { try { - return store.usedForGarbageManagement(); + store.usedForGarbageManagement(setToUpdate); } catch (final StoreException exception) { throw new FilePersistenceException(exception); } @@ -1358,14 +1357,12 @@ } } - @Fortest @Override - public Set<DataRecordIdentifier> usedForClassNameManagement() + public void usedForClassNameManagement( + final Set<DataRecordIdentifier> setToUpdate) throws FilePersistenceException { try { - final Set<DataRecordIdentifier> setToUpdate = new TreeSet<DataRecordIdentifier>(); store.usedForClassNameManagement(setToUpdate); - return setToUpdate; } catch (final StoreException exception) { throw new FilePersistenceException(exception); } Modified: trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -25,7 +25,6 @@ import java.util.Map; import java.util.Set; -import net.sf.joafip.Fortest; import net.sf.joafip.StorableClass; import net.sf.joafip.StoreSerializeAndZippedInOneRecord; import net.sf.joafip.entity.MutableInteger; @@ -1334,8 +1333,7 @@ ClassInfo classInfoOfObject(Object object) throws FilePersistenceException; - @Fortest - Set<DataRecordIdentifier> usedForClassNameManagement() + void usedForClassNameManagement(Set<DataRecordIdentifier> setToUpdate) throws FilePersistenceException; /** Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -537,8 +537,8 @@ */ boolean isBackgroundGarbageSweepWorking() throws StoreException; - @Fortest - List<DataRecordIdentifier> usedForGarbageManagement() throws StoreException; + void usedForGarbageManagement(Set<DataRecordIdentifier> setToUpdate) + throws StoreException; /** * Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -30,6 +30,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; import java.util.Vector; @@ -1350,12 +1351,11 @@ } } - @Fortest @Override - public List<DataRecordIdentifier> usedForGarbageManagement() + public void usedForGarbageManagement(Set<DataRecordIdentifier> setToUpdate) throws StoreException { assertManageGarbage(); - return storeGarbager.usedForGarbageManagement(); + storeGarbager.usedForGarbageManagement(setToUpdate); } private void assertManageGarbage() throws StoreException { Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/GarbageManager.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/GarbageManager.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/GarbageManager.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -17,6 +17,7 @@ package net.sf.joafip.store.service.garbage; import java.util.List; +import java.util.Set; import net.sf.joafip.Fortest; import net.sf.joafip.NotStorableClass; @@ -633,21 +634,22 @@ return garbageCandidateRecordManager; } - @Fortest - public List<DataRecordIdentifier> getLinkRecordAllDataRecordIdentifiers() - throws GarbageException, ReferenceLinkGarbageException { - return linkRecordManager.getAllDataRecordIdentifiers(); + @Override + public void getLinkRecordAllDataRecordIdentifiers( + final Set<DataRecordIdentifier> setToUpdate) throws GarbageException, + ReferenceLinkGarbageException { + linkRecordManager.getAllDataRecordIdentifiers(setToUpdate); } - @Fortest - public List<DataRecordIdentifier> getToGarbageRecordAllDataRecordIdentifiers() - throws GarbageException { - return toGarbageRecordManager.getAllDataRecordIdentifiers(); + @Override + public void getToGarbageRecordAllDataRecordIdentifiers( + final Set<DataRecordIdentifier> setToUpdate) throws GarbageException { + toGarbageRecordManager.getAllDataRecordIdentifiers(setToUpdate); } - @Fortest - public List<DataRecordIdentifier> getCandidateRecordAllDataRecordIdentifiers() - throws GarbageException { - return garbageCandidateRecordManager.getAllDataRecordIdentifiers(); + @Override + public void getCandidateRecordAllDataRecordIdentifiers( + final Set<DataRecordIdentifier> setToUpdate) throws GarbageException { + garbageCandidateRecordManager.getAllDataRecordIdentifiers(setToUpdate); } } Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/IGarbageManagerForCollect.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/IGarbageManagerForCollect.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/IGarbageManagerForCollect.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -17,6 +17,7 @@ package net.sf.joafip.store.service.garbage; import java.util.List; +import java.util.Set; import net.sf.joafip.Fortest; import net.sf.joafip.kvstore.record.entity.DataRecordIdentifier; @@ -72,14 +73,12 @@ boolean isOneGarbaged(); - List<DataRecordIdentifier> getLinkRecordAllDataRecordIdentifiers() + void getLinkRecordAllDataRecordIdentifiers(Set<DataRecordIdentifier> setToUpdate) throws GarbageException, ReferenceLinkGarbageException; - @Fortest - List<DataRecordIdentifier> getToGarbageRecordAllDataRecordIdentifiers() + void getToGarbageRecordAllDataRecordIdentifiers(Set<DataRecordIdentifier> setToUpdate) throws GarbageException; - @Fortest - List<DataRecordIdentifier> getCandidateRecordAllDataRecordIdentifiers() + void getCandidateRecordAllDataRecordIdentifiers(Set<DataRecordIdentifier> setToUpdate) throws GarbageException; } Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -17,6 +17,7 @@ package net.sf.joafip.store.service.garbage; import java.util.List; +import java.util.Set; import net.sf.joafip.Fortest; import net.sf.joafip.NotStorableClass; @@ -390,17 +391,14 @@ } } - @Fortest - public List<DataRecordIdentifier> usedForGarbageManagement() - throws StoreException { + public void usedForGarbageManagement( + final Set<DataRecordIdentifier> setToUpdate) throws StoreException { try { - final List<DataRecordIdentifier> allUseDataRecordIdentifier = garbageManager - .getLinkRecordAllDataRecordIdentifiers(); - allUseDataRecordIdentifier.addAll(garbageManager - .getToGarbageRecordAllDataRecordIdentifiers()); - allUseDataRecordIdentifier.addAll(garbageManager - .getCandidateRecordAllDataRecordIdentifiers()); - return allUseDataRecordIdentifier; + garbageManager.getLinkRecordAllDataRecordIdentifiers(setToUpdate); + garbageManager + .getToGarbageRecordAllDataRecordIdentifiers(setToUpdate); + garbageManager + .getCandidateRecordAllDataRecordIdentifiers(setToUpdate); } catch (GarbageException exception) { throw new StoreException(exception); } catch (ReferenceLinkGarbageException exception) { Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/GarbageCandidateRecordManager.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/GarbageCandidateRecordManager.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/GarbageCandidateRecordManager.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -18,6 +18,7 @@ import java.util.LinkedList; import java.util.List; +import java.util.Set; import net.sf.joafip.Fortest; import net.sf.joafip.NotStorableClass; @@ -247,20 +248,18 @@ return list; } - @Fortest - public List<DataRecordIdentifier> getAllDataRecordIdentifiers() + public void getAllDataRecordIdentifiers( + final Set<DataRecordIdentifier> setToUpdate) throws GarbageException { - final List<DataRecordIdentifier> list = new LinkedList<DataRecordIdentifier>(); try { for (IRBTNode<DataRecordIdentifier> node : garbageCandidateTree) { final DataRecordIdentifier dataRecordIdentifier = ((DataRecordIdentifierRBTNode) node) .getDataRecordIdentifier(); - list.add(dataRecordIdentifier); + setToUpdate.add(dataRecordIdentifier); } } catch (Exception exception) { throw new GarbageException(exception); } - return list; } } Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/LinkRecordManager.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/LinkRecordManager.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/LinkRecordManager.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -18,6 +18,7 @@ import java.util.LinkedList; import java.util.List; +import java.util.Set; import net.sf.joafip.Fortest; import net.sf.joafip.NotStorableClass; @@ -347,15 +348,14 @@ } } - @Fortest - public List<DataRecordIdentifier> getAllDataRecordIdentifiers() + public void getAllDataRecordIdentifiers( + final Set<DataRecordIdentifier> setToUpdate) throws GarbageException, ReferenceLinkGarbageException { - final List<DataRecordIdentifier> list = new LinkedList<DataRecordIdentifier>(); try { for (IRBTNode<ReferenceLink> node : garbageReferenceLinkTree) { final DataRecordIdentifier dataRecordIdentifier = node .getElement().getNode().getDataRecordIdentifier(); - list.add(dataRecordIdentifier); + setToUpdate.add(dataRecordIdentifier); } } catch (RBTException exception) { rbtExceptionCause(exception); @@ -363,6 +363,5 @@ // rbtExceptionCause always throw // exception } - return list; } } Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/ToGarbageRecordManager.java =================================================================== --- trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/ToGarbageRecordManager.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/ToGarbageRecordManager.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -18,6 +18,7 @@ import java.util.LinkedList; import java.util.List; +import java.util.Set; import net.sf.joafip.Fortest; import net.sf.joafip.NotStorableClass; @@ -239,20 +240,18 @@ return list; } - @Fortest - public List<DataRecordIdentifier> getAllDataRecordIdentifiers() + public void getAllDataRecordIdentifiers( + final Set<DataRecordIdentifier> setToUpdate) throws GarbageException { - final List<DataRecordIdentifier> list = new LinkedList<DataRecordIdentifier>(); try { for (IRBTNode<DataRecordIdentifier> node : toGarbageTree) { final DataRecordIdentifier dataRecordIdentifier = ((DataRecordIdentifierRBTNode) node) .getDataRecordIdentifier(); - list.add(dataRecordIdentifier); + setToUpdate.add(dataRecordIdentifier); } } catch (Exception exception) { throw new GarbageException(exception); } - return list; } } Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -975,9 +975,9 @@ store.usedForClassNameManagement(setToUpdate); } - public List<DataRecordIdentifier> usedForGarbageManagement() + public void usedForGarbageManagement(Set<DataRecordIdentifier> setToUpdate) throws StoreException { - return store.usedForGarbageManagement(); + store.usedForGarbageManagement(setToUpdate); } public long usedSize() throws StoreException { Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java =================================================================== --- trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java 2012-11-18 15:02:22 UTC (rev 3154) +++ trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java 2012-11-18 15:32:11 UTC (rev 3155) @@ -25,6 +25,7 @@ import java.util.Collection; import java.util.List; import java.util.Set; +import java.util.TreeSet; import junit.framework.TestCase; import net.sf.joafip.NotStorableClass; @@ -98,10 +99,12 @@ .getDataRecordIdentifierSet(); forObjectDatarecordIdentifierSet .remove(new DataRecordIdentifier(0)); - forObjectDatarecordIdentifierSet.removeAll(filePersistence - .usedForGarbageManagement()); - forObjectDatarecordIdentifierSet.removeAll(filePersistence - .usedForClassNameManagement()); + + Set<DataRecordIdentifier> setToUpdate=new TreeSet<DataRecordIdentifier>(); + filePersistence.usedForGarbageManagement(setToUpdate); + filePersistence.usedForClassNameManagement(setToUpdate); + forObjectDatarecordIdentifierSet.removeAll(setToUpdate); + for (DataRecordIdentifier referencingDataRecordIdentifier : forObjectDatarecordIdentifierSet) { final ObjectLinkTreeNode objectLinkTreeNode = objectIOManager .getObjectLinkTreeNode(referencingDataRecordIdentifier); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luc...@us...> - 2012-11-18 15:32:20
|
Revision: 3155 http://joafip.svn.sourceforge.net/joafip/?rev=3155&view=rev Author: luc_peuvrier Date: 2012-11-18 15:32:11 +0000 (Sun, 18 Nov 2012) Log Message: ----------- new ay to obtains data record identifier set of data record for garbage management Modified Paths: -------------- trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/GarbageManager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/IGarbageManagerForCollect.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/GarbageCandidateRecordManager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/LinkRecordManager.java trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/recordmgr/ToGarbageRecordManager.java trunk/joafip/src/test/java/net/sf/joafip/store/service/StoreForTest.java trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |