summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2009-04-23 04:14:36 (EDT)
committerStefan Winkler2009-04-23 04:14:36 (EDT)
commit6cdf8870b01cfb8226119a533b4975b8d89f3fc5 (patch)
treea398f1da621135350be0f200c34f6618b343b00d
parent3d096f78a916fef8b9bd28450693a199826fb4cb (diff)
downloadcdo-6cdf8870b01cfb8226119a533b4975b8d89f3fc5.zip
cdo-6cdf8870b01cfb8226119a533b4975b8d89f3fc5.tar.gz
cdo-6cdf8870b01cfb8226119a533b4975b8d89f3fc5.tar.bz2
Minor Tweaks
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java7
5 files changed, 37 insertions, 12 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
index f591140..5078fb3 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -36,6 +36,7 @@ import org.eclipse.net4j.util.om.monitor.ProgressDistributor;
import javax.sql.DataSource;
import java.sql.Connection;
+import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.Set;
@@ -176,6 +177,16 @@ public class DBStore extends LongIDStore implements IDBStore
protected Connection getConnection()
{
Connection connection = dbConnectionProvider.getConnection();
+
+ try
+ {
+ connection.setAutoCommit(false);
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+
if (connection == null)
{
throw new DBException("No connection from connection provider: " + dbConnectionProvider);
@@ -293,6 +304,7 @@ public class DBStore extends LongIDStore implements IDBStore
{
throw new DBException("No row updated in table " + CDODBSchema.REPOSITORY);
}
+
}
@Override
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 43ece40..31f09eb 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
@@ -137,17 +137,20 @@ public class DBStoreAccessor extends LongIDStoreAccessor implements IDBStoreAcce
protected EClass getObjectType(CDOID id)
{
- // TODO (taken over from old implementation:) Replace calls to getObjectType by optimized calls to
- // RevisionManager.getObjectType (cache!)
- CDOClassifierRef type = readObjectType(id);
- if (type == null)
+ EClass result = getStore().getRepository().getRevisionManager().getObjectType(id);
+ if (result == null)
{
- return null;
- }
+ CDOClassifierRef type = readObjectType(id);
+ if (type == null)
+ {
+ return null;
+ }
- IRepository repository = getStore().getRepository();
- CDOPackageRegistry packageRegistry = repository.getPackageRegistry();
- return (EClass)type.resolve(packageRegistry);
+ IRepository repository = getStore().getRepository();
+ CDOPackageRegistry packageRegistry = repository.getPackageRegistry();
+ result = (EClass)type.resolve(packageRegistry);
+ }
+ return result;
}
public InternalCDORevision readRevision(CDOID id, int listChunk, AdditionalRevisionCache cache)
@@ -429,7 +432,7 @@ public class DBStoreAccessor extends LongIDStoreAccessor implements IDBStoreAcce
@Override
protected void doActivate() throws Exception
{
- connection = getStore().getDBConnectionProvider().getConnection();
+ connection = getStore().getConnection();
connectionKeepAliveTimer = new Timer("Connection-Keep-Alive-" + toString());
connectionKeepAliveTimer.schedule(new ConnectionKeepAliveTask(), ConnectionKeepAliveTask.EXECUTION_PERIOD,
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java
index 18b7cce..75b30ec 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java
@@ -322,7 +322,10 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp
{
for (EClass eClass : eClasses)
{
- createClassMapping(eClass);
+ if (!(eClass.isInterface() || eClass.isAbstract()))
+ {
+ createClassMapping(eClass);
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
index aa11d0a..706c5d3 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
@@ -153,6 +153,8 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping
TRACER.format("Executing Query: {0}", pstmt.toString());
}
+ pstmt.setMaxRows(1); // Optimization: only 1 row
+
resultSet = pstmt.executeQuery();
if (!resultSet.next())
{
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
index 8736f9b..ccf4c91 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java
@@ -263,6 +263,11 @@ public abstract class AbstractListTableMapping implements IListMapping
TRACER.trace(pstmt.toString());
}
+ if (listChunk != CDORevision.UNCHUNKED)
+ {
+ pstmt.setMaxRows(listChunk); // optimization - don't read unneeded rows.
+ }
+
resultSet = pstmt.executeQuery();
while ((listChunk == CDORevision.UNCHUNKED || --listChunk >= 0) && resultSet.next())
@@ -341,7 +346,7 @@ public abstract class AbstractListTableMapping implements IListMapping
int result = resultSet.getInt(1);
if (TRACER.isEnabled())
{
- TRACER.trace("Read list size = " + result);
+ TRACER.trace("Read list last index = " + result);
}
return result;
}