summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-25 04:59:22 (EDT)
committerEike Stepper2007-08-25 04:59:22 (EDT)
commitaaeee6cd915be648a4d0c6a0befbd915fd1b9305 (patch)
treed71866fe5d0ab51e3c50d3bc3c01fa5cba700336
parent0d5e3c2b2c5b70954315b5d44fd13b12dc33a72c (diff)
downloadcdo-aaeee6cd915be648a4d0c6a0befbd915fd1b9305.zip
cdo-aaeee6cd915be648a4d0c6a0befbd915fd1b9305.tar.gz
cdo-aaeee6cd915be648a4d0c6a0befbd915fd1b9305.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java5
4 files changed, 20 insertions, 7 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
index 1ab1237..fec39e6 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
@@ -394,7 +394,7 @@ public class DBStoreAccessor implements IDBStoreAccessor
{
if (TRACER.isEnabled())
{
- TRACER.trace("Selecting object ids");
+ TRACER.trace("Selecting object IDs");
}
return store.getMappingStrategy().readObjectIDs(this, withTypes);
@@ -429,7 +429,7 @@ public class DBStoreAccessor implements IDBStoreAccessor
{
if (TRACER.isEnabled())
{
- TRACER.format("Selecting revision: {0}", id);
+ TRACER.format("Selecting revision: {0}, {1,date} {1,time}", id, timeStamp);
}
CDOClassImpl cdoClass = getObjectType(id);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
index fefb25b..0b8eefe 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.IDBTable;
+import org.eclipse.net4j.util.io.CloseableIterator;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -131,7 +132,7 @@ public abstract class MappingStrategy implements IMappingStrategy
return mapping;
}
- public Iterator<CDOID> readObjectIDs(final IDBStoreAccessor storeAccessor, final boolean withTypes)
+ public CloseableIterator<CDOID> readObjectIDs(final IDBStoreAccessor storeAccessor, final boolean withTypes)
{
List<CDOClass> classes = getObjectIDClasses();
final Iterator<CDOClass> classIt = classes.iterator();
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java
index 1e6bf69..23f238b 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java
@@ -17,15 +17,16 @@ import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.util.io.CloseableIterator;
+import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.util.Iterator;
/**
* @author Eike Stepper
*/
-public abstract class ObjectIDIterator implements Iterator<CDOID>
+public abstract class ObjectIDIterator implements CloseableIterator<CDOID>
{
private MappingStrategy mappingStrategy;
@@ -37,6 +38,11 @@ public abstract class ObjectIDIterator implements Iterator<CDOID>
private CDOID nextID;
+ /**
+ * Creates an iterator over all objects in a store. It is important to
+ * {@link #dispose()} of this iterator after usage to properly close internal
+ * result sets.
+ */
public ObjectIDIterator(MappingStrategy mappingStrategy, IDBStoreAccessor storeAccessor, boolean withTypes)
{
this.mappingStrategy = mappingStrategy;
@@ -44,6 +50,11 @@ public abstract class ObjectIDIterator implements Iterator<CDOID>
this.withTypes = withTypes;
}
+ public void close() throws IOException
+ {
+ DBUtil.close(currentResultSet);
+ }
+
public MappingStrategy getMappingStrategy()
{
return mappingStrategy;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
index 0a1c871..e9c1d55 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
@@ -17,8 +17,9 @@ import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
import org.eclipse.emf.cdo.protocol.model.CDOPackageInfo;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
+import org.eclipse.net4j.util.io.CloseableIterator;
+
import java.util.Collection;
-import java.util.Iterator;
/**
* @see StoreUtil#getReader()
@@ -41,7 +42,7 @@ public interface IStoreReader extends IStoreAccessor
* their ids available for processing. This method is supposed to be called
* very infrequently, for example during the recovery from a crash.
*/
- public Iterator<CDOID> readObjectIDs(boolean withTypes);
+ public CloseableIterator<CDOID> readObjectIDs(boolean withTypes);
/**
* Reads the type of an object from the associated store and returns a class