[Swift-commit] r4803 - in trunk/src/org/griphyn/vdl/mapping: . file
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Thu Jul 7 18:35:39 CDT 2011
Author: hategan
Date: 2011-07-07 18:35:39 -0500 (Thu, 07 Jul 2011)
New Revision: 4803
Modified:
trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java
trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java
trunk/src/org/griphyn/vdl/mapping/Mapper.java
trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java
trunk/src/org/griphyn/vdl/mapping/file/TestMapper.java
Log:
revert the use of getFringePaths when closing and use the actual handles instead
Modified: trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java 2011-07-07 23:34:42 UTC (rev 4802)
+++ trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java 2011-07-07 23:35:39 UTC (rev 4803)
@@ -631,13 +631,15 @@
}
public synchronized void clean() {
- Mapper mapper = getMapper();
- if (mapper != null) {
- try {
- mapper.clean(getFringePaths());
+ if (!handles.isEmpty()) {
+ for (DSHandle h : handles.values()) {
+ ((AbstractDataNode) h).clean();
}
- catch (HandleOpenException e) {
- logger.warn("Unexpected exception", e);
+ }
+ else {
+ Mapper mapper = getRoot().getMapper();
+ if (mapper != null) {
+ mapper.clean(getPathFromRoot());
}
}
field = null;
Modified: trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java 2011-07-07 23:34:42 UTC (rev 4802)
+++ trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java 2011-07-07 23:35:39 UTC (rev 4803)
@@ -1,6 +1,5 @@
package org.griphyn.vdl.mapping;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -62,7 +61,7 @@
}
@Override
- public void clean(Collection<Path> path) {
+ public void clean(Path path) {
// no cleaning by default
}
Modified: trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java 2011-07-07 23:34:42 UTC (rev 4802)
+++ trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java 2011-07-07 23:35:39 UTC (rev 4803)
@@ -28,10 +28,10 @@
for (Map.Entry<Comparable<?>, DSHandle> e : handles.entrySet()) {
AbstractDataNode mapper = (AbstractDataNode) e.getValue();
Path fullPath = parentPath.addLast(e.getKey().toString(), getType().isArray());
- if (!mapper.isHandlesEmpty()) {
+ if (mapper.getType().isComposite()) {
mapper.getFringePaths(list, fullPath);
}
- else if (!mapper.getField().getType().isPrimitive()) {
+ else if (!mapper.getType().isPrimitive()) {
list.add(fullPath);
}
}
Modified: trunk/src/org/griphyn/vdl/mapping/Mapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/Mapper.java 2011-07-07 23:34:42 UTC (rev 4802)
+++ trunk/src/org/griphyn/vdl/mapping/Mapper.java 2011-07-07 23:35:39 UTC (rev 4803)
@@ -60,7 +60,7 @@
* Clean the specified path. A temporary mapper may remove the
* corresponding file after this call.
*/
- void clean(Collection<Path> paths);
+ void clean(Path paths);
boolean isPersistent(Path path);
Modified: trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootDataNode.java 2011-07-07 23:34:42 UTC (rev 4802)
+++ trunk/src/org/griphyn/vdl/mapping/RootDataNode.java 2011-07-07 23:35:39 UTC (rev 4803)
@@ -110,7 +110,7 @@
"incompatible with the mapped variable type: " + e.getMessage());
}
}
- root.closeDeep();
+ root.closeDeep();
checkConsistency(root);
}
else if (mapper.isStatic()) {
@@ -184,7 +184,6 @@
+ ". Missing required field: " + fieldName);
}
}
-
}
}
Modified: trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java 2011-07-07 23:34:42 UTC (rev 4802)
+++ trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java 2011-07-07 23:35:39 UTC (rev 4803)
@@ -71,12 +71,10 @@
}
@Override
- public void clean(Collection<Path> paths) {
- for (Path path : paths) {
- PhysicalFormat pf = map(path);
- logger.info("Cleaning file " + pf);
- FileGarbageCollector.getDefault().decreaseUsageCount(pf);
- }
+ public void clean(Path path) {
+ PhysicalFormat pf = map(path);
+ logger.info("Cleaning file " + pf);
+ FileGarbageCollector.getDefault().decreaseUsageCount(pf);
}
@Override
Modified: trunk/src/org/griphyn/vdl/mapping/file/TestMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/TestMapper.java 2011-07-07 23:34:42 UTC (rev 4802)
+++ trunk/src/org/griphyn/vdl/mapping/file/TestMapper.java 2011-07-07 23:35:39 UTC (rev 4803)
@@ -46,17 +46,15 @@
}
@Override
- public void clean(Collection<Path> paths) {
- for (Path path : paths) {
- PhysicalFormat pf = map(path);
- if (PARAM_TEMP.getBooleanValue(this)) {
- System.out.println("Cleaning file " + pf);
- FileGarbageCollector.getDefault().decreaseUsageCount(pf);
- }
- else {
- System.out.println("Not cleaning " + pf + " (not temporary)");
- }
+ public void clean(Path path) {
+ PhysicalFormat pf = map(path);
+ if (PARAM_TEMP.getBooleanValue(this)) {
+ System.out.println("Cleaning file " + pf);
+ FileGarbageCollector.getDefault().decreaseUsageCount(pf);
}
+ else {
+ System.out.println("Not cleaning " + pf + " (not temporary)");
+ }
}
@Override
More information about the Swift-commit
mailing list