summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgidijus Vaishnora2011-02-10 09:51:02 (EST)
committerEgidijus Vaishnora2011-02-10 09:51:02 (EST)
commitfde3ee18168b51031ee4767cc0321a0fb6f58cd9 (patch)
tree35b79cbf6740dd13ea4f5035908b34e12b1c5851
parentdac94ceeb5afbedded4265dd4cb81b8d03283636 (diff)
downloadcdo-fde3ee18168b51031ee4767cc0321a0fb6f58cd9.zip
cdo-fde3ee18168b51031ee4767cc0321a0fb6f58cd9.tar.gz
cdo-fde3ee18168b51031ee4767cc0321a0fb6f58cd9.tar.bz2
[336708] bug fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=336708
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ExternalReferenceManager.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java2
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java20
3 files changed, 26 insertions, 12 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ExternalReferenceManager.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ExternalReferenceManager.java
index 5b80247..c226fd1 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ExternalReferenceManager.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ExternalReferenceManager.java
@@ -34,7 +34,6 @@ import org.eclipse.net4j.db.ddl.IDBIndex;
import org.eclipse.net4j.db.ddl.IDBTable;
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
import java.io.IOException;
@@ -164,21 +163,23 @@ public class ExternalReferenceManager extends Lifecycle
table.addIndex(IDBIndex.Type.PRIMARY_KEY, idField);
table.addIndex(IDBIndex.Type.NON_UNIQUE, uriField);
- IDBStoreAccessor reader = store.getReader(null);
- Connection connection = reader.getConnection();
+ IDBStoreAccessor writer = store.getWriter(null);
+ Connection connection = writer.getConnection();
Statement statement = null;
+ ResultSet resultSet = null;
try
{
statement = connection.createStatement();
store.getDBAdapter().createTable(table, statement);
+ connection.commit();
String sql = "SELECT MIN(" + idField + ") FROM " + table;
- ResultSet result = statement.executeQuery(sql);
+ resultSet = statement.executeQuery(sql);
- if (result.next())
+ if (resultSet.next())
{
- lastMappedID.set(result.getLong(1));
+ lastMappedID.set(resultSet.getLong(1));
}
// else: resultSet is empty => table is empty
@@ -190,8 +191,9 @@ public class ExternalReferenceManager extends Lifecycle
}
finally
{
+ DBUtil.close(resultSet);
DBUtil.close(statement);
- LifecycleUtil.deactivate(reader); // Don't let the null-context accessor go to the pool!
+ writer.release();
}
StringBuilder builder = new StringBuilder();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
index af249a8..49586bc 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
@@ -1353,7 +1353,7 @@ public class Repository extends Container<Object> implements InternalRepository
}
finally
{
- LifecycleUtil.deactivate(writer); // Don't let the null-context accessor go to the pool!
+ // LifecycleUtil.deactivate(writer); // Don't let the null-context accessor go to the pool!
StoreThreadLocal.release();
}
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
index abc6104..62e4fc3 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
@@ -184,6 +184,11 @@ public final class DBUtil
}
catch (Exception ex)
{
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(ex);
+ }
+
return ex;
}
}
@@ -201,7 +206,11 @@ public final class DBUtil
}
catch (Exception ex)
{
- OM.LOG.error(ex);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(ex);
+ }
+
return ex;
}
}
@@ -221,9 +230,8 @@ public final class DBUtil
statement.setMaxRows(0);
}
}
- catch (Exception ex)
+ catch (Exception ignore)
{
- // OM.LOG.error(ex);
}
try
@@ -232,7 +240,11 @@ public final class DBUtil
}
catch (Exception ex)
{
- OM.LOG.error(ex);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(ex);
+ }
+
return ex;
}
}