diff options
author | Egidijus Vaishnora | 2011-02-10 15:27:14 +0000 |
---|---|---|
committer | Egidijus Vaishnora | 2011-02-10 15:27:14 +0000 |
commit | 4cbd9354b502624943007f0d1f33dad10056a6b0 (patch) | |
tree | 6f934ac1491fed32f4d194ae17df5b899bced8bc | |
parent | f8a9428a8b95f1547c93f5eaf9823f0b51310363 (diff) | |
download | cdo-4cbd9354b502624943007f0d1f33dad10056a6b0.tar.gz cdo-4cbd9354b502624943007f0d1f33dad10056a6b0.tar.xz cdo-4cbd9354b502624943007f0d1f33dad10056a6b0.zip |
[336688] bug fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=336688
11 files changed, 83 insertions, 103 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMetaDataManager.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMetaDataManager.java index 461574cab8..11b73b9a15 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMetaDataManager.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMetaDataManager.java @@ -42,7 +42,7 @@ public interface IMetaDataManager * @return the corresponding ID * @since 4.0 */ - public CDOID getMetaID(IDBStoreAccessor accessor, EModelElement modelElement, long commitTime); + public CDOID getMetaID(EModelElement modelElement, long commitTime); /** * Returns the {@link EModelElement} referred to by the given ID. <code> getMetaInstance(getMetaID(m))</code> yields @@ -50,7 +50,7 @@ public interface IMetaDataManager * * @since 4.0 */ - public EModelElement getMetaInstance(IDBStoreAccessor accessor, CDOID id); + public EModelElement getMetaInstance(CDOID id); /** * Loads a package unit from the database. 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 c226fd1026..7114249226 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 @@ -187,6 +187,7 @@ public class ExternalReferenceManager extends Lifecycle } catch (SQLException ex) { + connection.rollback(); throw new DBException(ex); } finally diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java index 681bcc6196..558f75767d 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java @@ -20,6 +20,7 @@ import org.eclipse.emf.cdo.common.model.CDOPackageUnit; import org.eclipse.emf.cdo.common.model.EMFUtil; import org.eclipse.emf.cdo.common.protocol.CDODataInput; import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.server.StoreThreadLocal; import org.eclipse.emf.cdo.server.db.IDBStore; import org.eclipse.emf.cdo.server.db.IDBStoreAccessor; import org.eclipse.emf.cdo.server.db.IMetaDataManager; @@ -75,7 +76,7 @@ public class MetaDataManager extends Lifecycle implements IMetaDataManager this.store = store; } - public synchronized CDOID getMetaID(IDBStoreAccessor accessor, EModelElement modelElement, long commitTime) + public synchronized CDOID getMetaID(EModelElement modelElement, long commitTime) { CDOID metaID = modelElementToMetaID.get(modelElement); if (metaID != null) @@ -83,6 +84,7 @@ public class MetaDataManager extends Lifecycle implements IMetaDataManager return metaID; } + IDBStoreAccessor accessor = (IDBStoreAccessor)StoreThreadLocal.getAccessor(); String uri = EcoreUtil.getURI(modelElement).toString(); metaID = store.getIDHandler().mapURI(accessor, uri, commitTime); cacheMetaIDMapping(modelElement, metaID); @@ -90,7 +92,7 @@ public class MetaDataManager extends Lifecycle implements IMetaDataManager return metaID; } - public synchronized EModelElement getMetaInstance(IDBStoreAccessor accessor, CDOID id) + public synchronized EModelElement getMetaInstance(CDOID id) { EModelElement modelElement = metaIDToModelElement.get(id); if (modelElement != null) @@ -98,6 +100,7 @@ public class MetaDataManager extends Lifecycle implements IMetaDataManager return modelElement; } + IDBStoreAccessor accessor = (IDBStoreAccessor)StoreThreadLocal.getAccessor(); String uri = store.getIDHandler().unmapURI(accessor, id); ResourceSet resourceSet = new ResourceSetImpl(); 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 8a3c85a879..70bba32ad6 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 @@ -46,8 +46,6 @@ import org.eclipse.net4j.util.ImplementationError; import org.eclipse.net4j.util.StringUtil; import org.eclipse.net4j.util.collection.CloseableIterator; import org.eclipse.net4j.util.lifecycle.Lifecycle; -import org.eclipse.net4j.util.lifecycle.LifecycleUtil; -import org.eclipse.net4j.util.om.monitor.Monitor; import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.net4j.util.om.monitor.OMMonitor.Async; @@ -391,29 +389,11 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp private String getUniqueID(ENamedElement element) { - // TODO: replace with a better logic. For now, we fall back to the - // element IDs... + CDOID result = getMetaDataManager().getMetaID(element, getStore().getRepository().getTimeStamp()); - IDBStoreAccessor accessor = getStore().getWriter(null); - - try - { - CDOID result = getMetaDataManager().getMetaID(accessor, element, getStore().getRepository().getTimeStamp()); - accessor.commit(new Monitor()); - - StringBuilder builder = new StringBuilder(); - CDOIDUtil.write(builder, result); - return builder.toString(); - } - catch (Throwable t) - { - accessor.rollback(); - throw new DBException(t); - } - finally - { - LifecycleUtil.deactivate(accessor); // do not let the null-accessor go into the pool! - } + StringBuilder builder = new StringBuilder(); + CDOIDUtil.write(builder, result); + return builder.toString(); } // -- factories for mapping of classes, values, lists ------------------ diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java index e8857ab9de..59f634c048 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java @@ -304,14 +304,14 @@ public abstract class AbstractFeatureMapTableMapping extends BasicAbstractListTa while ((listChunk == CDORevision.UNCHUNKED || --listChunk >= 0) && resultSet.next()) { CDOID tag = idHandler.getCDOID(resultSet, 1); - Object value = getTypeMapping(accessor, tag).readValue(resultSet); + Object value = getTypeMapping(tag).readValue(resultSet); if (TRACER.isEnabled()) { TRACER.format("Read value for index {0} from result set: {1}", list.size(), value); } - list.set(currentIndex++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(accessor, tag), value)); + list.set(currentIndex++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value)); } } catch (SQLException ex) @@ -331,9 +331,9 @@ public abstract class AbstractFeatureMapTableMapping extends BasicAbstractListTa } } - private void addFeature(IDBStoreAccessor accessor, CDOID tag) + private void addFeature(CDOID tag) { - EStructuralFeature modelFeature = getFeatureByTag(accessor, tag); + EStructuralFeature modelFeature = getFeatureByTag(tag); ITypeMapping typeMapping = getMappingStrategy().createValueMapping(modelFeature); String column = CDODBSchema.FEATUREMAP_VALUE + "_" + typeMapping.getDBType(); @@ -381,7 +381,7 @@ public abstract class AbstractFeatureMapTableMapping extends BasicAbstractListTa while (resultSet.next()) { CDOID tag = idHandler.getCDOID(resultSet, 1); - Object value = getTypeMapping(chunkReader.getAccessor(), tag).readValue(resultSet); + Object value = getTypeMapping(tag).readValue(resultSet); if (chunk == null) { @@ -400,8 +400,7 @@ public abstract class AbstractFeatureMapTableMapping extends BasicAbstractListTa TRACER.format("Read value for chunk index {0} from result set: {1}", indexInChunk, value); } - chunk.add(indexInChunk++, - CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(chunkReader.getAccessor(), tag), value)); + chunk.add(indexInChunk++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value)); if (indexInChunk == chunkSize) { if (TRACER.isEnabled()) @@ -459,8 +458,8 @@ public abstract class AbstractFeatureMapTableMapping extends BasicAbstractListTa { FeatureMap.Entry entry = (FeatureMap.Entry)value; EStructuralFeature entryFeature = entry.getEStructuralFeature(); - CDOID tag = getTagByFeature(accessor, entryFeature, revision.getTimeStamp()); - String columnName = getColumnName(accessor, tag); + CDOID tag = getTagByFeature(entryFeature, revision.getTimeStamp()); + String columnName = getColumnName(tag); stmt = statementCache.getPreparedStatement(sqlInsert, ReuseProbability.HIGH); setKeyFields(stmt, revision); @@ -470,7 +469,7 @@ public abstract class AbstractFeatureMapTableMapping extends BasicAbstractListTa { if (columnNames.get(i).equals(columnName)) { - getTypeMapping(accessor, tag).setValue(stmt, column++, entry.getValue()); + getTypeMapping(tag).setValue(stmt, column++, entry.getValue()); } else { @@ -499,12 +498,12 @@ public abstract class AbstractFeatureMapTableMapping extends BasicAbstractListTa * The feature's MetaID in CDO * @return the column name where the values are stored */ - protected String getColumnName(IDBStoreAccessor accessor, CDOID tag) + protected String getColumnName(CDOID tag) { String column = tagMap.get(tag); if (column == null) { - addFeature(accessor, tag); + addFeature(tag); column = tagMap.get(tag); } @@ -518,12 +517,12 @@ public abstract class AbstractFeatureMapTableMapping extends BasicAbstractListTa * The feature's MetaID in CDO * @return the corresponding type mapping */ - protected ITypeMapping getTypeMapping(IDBStoreAccessor accessor, CDOID tag) + protected ITypeMapping getTypeMapping(CDOID tag) { ITypeMapping typeMapping = typeMappings.get(tag); if (typeMapping == null) { - addFeature(accessor, tag); + addFeature(tag); typeMapping = typeMappings.get(tag); } @@ -534,9 +533,9 @@ public abstract class AbstractFeatureMapTableMapping extends BasicAbstractListTa * @param metaID * @return the column name where the values are stored */ - private EStructuralFeature getFeatureByTag(IDBStoreAccessor accessor, CDOID tag) + private EStructuralFeature getFeatureByTag(CDOID tag) { - return (EStructuralFeature)getMappingStrategy().getStore().getMetaDataManager().getMetaInstance(accessor, tag); + return (EStructuralFeature)getMappingStrategy().getStore().getMetaDataManager().getMetaInstance(tag); } /** @@ -544,9 +543,9 @@ public abstract class AbstractFeatureMapTableMapping extends BasicAbstractListTa * The EStructuralFeature * @return The feature's MetaID in CDO */ - protected CDOID getTagByFeature(IDBStoreAccessor accessor, EStructuralFeature feature, long timeStamp) + protected CDOID getTagByFeature(EStructuralFeature feature, long timeStamp) { - return getMappingStrategy().getStore().getMetaDataManager().getMetaID(accessor, feature, timeStamp); + return getMappingStrategy().getStore().getMetaDataManager().getMetaID(feature, timeStamp); } /** diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java index 8af94be9b8..7b9373aa1b 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java @@ -425,14 +425,14 @@ public class AuditFeatureMapTableMappingWithRanges extends BasicAbstractListTabl while ((listChunk == CDORevision.UNCHUNKED || --listChunk >= 0) && resultSet.next()) { CDOID tag = idHandler.getCDOID(resultSet, 1); - Object value = getTypeMapping(accessor, tag).readValue(resultSet); + Object value = getTypeMapping(tag).readValue(resultSet); if (TRACER.isEnabled()) { TRACER.format("Read value for index {0} from result set: {1}", list.size(), value); //$NON-NLS-1$ } - list.set(currentIndex++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(accessor, tag), value)); + list.set(currentIndex++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value)); } } catch (SQLException ex) @@ -452,9 +452,9 @@ public class AuditFeatureMapTableMappingWithRanges extends BasicAbstractListTabl } } - private void addFeature(IDBStoreAccessor accessor, CDOID tag) + private void addFeature(CDOID tag) { - EStructuralFeature modelFeature = getFeatureByTag(accessor, tag); + EStructuralFeature modelFeature = getFeatureByTag(tag); ITypeMapping typeMapping = getMappingStrategy().createValueMapping(modelFeature); String column = CDODBSchema.FEATUREMAP_VALUE + "_" + typeMapping.getDBType(); //$NON-NLS-1$ @@ -504,7 +504,7 @@ public class AuditFeatureMapTableMappingWithRanges extends BasicAbstractListTabl while (resultSet.next()) { CDOID tag = idHandler.getCDOID(resultSet, 1); - Object value = getTypeMapping(chunkReader.getAccessor(), tag).readValue(resultSet); + Object value = getTypeMapping(tag).readValue(resultSet); if (chunk == null) { @@ -523,8 +523,7 @@ public class AuditFeatureMapTableMappingWithRanges extends BasicAbstractListTabl TRACER.format("Read value for chunk index {0} from result set: {1}", indexInChunk, value); //$NON-NLS-1$ } - chunk.add(indexInChunk++, - CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(chunkReader.getAccessor(), tag), value)); + chunk.add(indexInChunk++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value)); if (indexInChunk == chunkSize) { if (TRACER.isEnabled()) @@ -589,12 +588,12 @@ public class AuditFeatureMapTableMappingWithRanges extends BasicAbstractListTabl * The feature's MetaID in CDO * @return the column name where the values are stored */ - protected String getColumnName(IDBStoreAccessor accessor, CDOID tag) + protected String getColumnName(CDOID tag) { String column = tagMap.get(tag); if (column == null) { - addFeature(accessor, tag); + addFeature(tag); column = tagMap.get(tag); } @@ -608,12 +607,12 @@ public class AuditFeatureMapTableMappingWithRanges extends BasicAbstractListTabl * The feature's MetaID in CDO * @return the corresponding type mapping */ - protected ITypeMapping getTypeMapping(IDBStoreAccessor accessor, CDOID tag) + protected ITypeMapping getTypeMapping(CDOID tag) { ITypeMapping typeMapping = typeMappings.get(tag); if (typeMapping == null) { - addFeature(accessor, tag); + addFeature(tag); typeMapping = typeMappings.get(tag); } @@ -624,9 +623,9 @@ public class AuditFeatureMapTableMappingWithRanges extends BasicAbstractListTabl * @param metaID * @return the column name where the values are stored */ - private EStructuralFeature getFeatureByTag(IDBStoreAccessor accessor, CDOID tag) + private EStructuralFeature getFeatureByTag(CDOID tag) { - return (EStructuralFeature)getMappingStrategy().getStore().getMetaDataManager().getMetaInstance(accessor, tag); + return (EStructuralFeature)getMappingStrategy().getStore().getMetaDataManager().getMetaInstance(tag); } /** @@ -634,9 +633,9 @@ public class AuditFeatureMapTableMappingWithRanges extends BasicAbstractListTabl * The EStructuralFeature * @return The feature's MetaID in CDO */ - protected CDOID getTagByFeature(IDBStoreAccessor accessor, EStructuralFeature feature, long timestamp) + protected CDOID getTagByFeature(EStructuralFeature feature, long timestamp) { - return getMappingStrategy().getStore().getMetaDataManager().getMetaID(accessor, feature, timestamp); + return getMappingStrategy().getStore().getMetaDataManager().getMetaID(feature, timestamp); } /** @@ -1044,8 +1043,8 @@ public class AuditFeatureMapTableMappingWithRanges extends BasicAbstractListTabl { FeatureMap.Entry entry = (FeatureMap.Entry)value; EStructuralFeature entryFeature = entry.getEStructuralFeature(); - CDOID tag = getTagByFeature(accessor, entryFeature, timestamp); - String columnName = getColumnName(accessor, tag); + CDOID tag = getTagByFeature(entryFeature, timestamp); + String columnName = getColumnName(tag); stmt = statementCache.getPreparedStatement(sqlInsert, ReuseProbability.HIGH); @@ -1060,7 +1059,7 @@ public class AuditFeatureMapTableMappingWithRanges extends BasicAbstractListTabl { if (columnNames.get(i).equals(columnName)) { - getTypeMapping(accessor, tag).setValue(stmt, column++, entry.getValue()); + getTypeMapping(tag).setValue(stmt, column++, entry.getValue()); } else { @@ -1184,8 +1183,8 @@ public class AuditFeatureMapTableMappingWithRanges extends BasicAbstractListTabl } CDOID tag = idHandler.getCDOID(resultSet, 1); - Object value = getTypeMapping(accessor, tag).readValue(resultSet); - result = CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(accessor, tag), value); + Object value = getTypeMapping(tag).readValue(resultSet); + result = CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value); if (TRACER.isEnabled()) { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java index 584eae4c6e..a9caf0852f 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java @@ -450,13 +450,13 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList } CDOID tag = idHandler.getCDOID(resultSet, 2); - Object value = getTypeMapping(accessor, tag).readValue(resultSet); + Object value = getTypeMapping(tag).readValue(resultSet); if (TRACER.isEnabled()) { TRACER.format("Read value for index {0} from result set: {1}", currentIndex, value); //$NON-NLS-1$ } - list.set(currentIndex++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(accessor, tag), value)); + list.set(currentIndex++, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value)); valuesToRead--; } @@ -506,9 +506,9 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList } } - private void addFeature(IDBStoreAccessor accessor, CDOID tag) + private void addFeature(CDOID tag) { - EStructuralFeature modelFeature = getFeatureByTag(accessor, tag); + EStructuralFeature modelFeature = getFeatureByTag(tag); ITypeMapping typeMapping = getMappingStrategy().createValueMapping(modelFeature); String column = CDODBSchema.FEATUREMAP_VALUE + "_" + typeMapping.getDBType(); //$NON-NLS-1$ @@ -580,6 +580,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList baseReader = createBaseChunkReader(chunkReader.getAccessor(), chunkReader.getRevision().getID(), chunkReader.getRevision().getBranch().getID()); } + if (TRACER.isEnabled()) { TRACER.format( @@ -594,12 +595,13 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList // now read value and set to chunk CDOID tag = idHandler.getCDOID(resultSet, 2); - Object value = getTypeMapping(chunkReader.getAccessor(), tag).readValue(resultSet); + Object value = getTypeMapping(tag).readValue(resultSet); if (TRACER.isEnabled()) { TRACER.format("ChunkReader read value for index {0} from result set: {1}", nextDBIndex, value); //$NON-NLS-1$ } - chunk.add(i, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(chunkReader.getAccessor(), tag), value)); + + chunk.add(i, CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value)); // advance DB cursor and read next available index if (resultSet.next()) @@ -720,12 +722,12 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList * The feature's MetaID in CDO * @return the column name where the values are stored */ - protected String getColumnName(IDBStoreAccessor accessor, CDOID tag) + protected String getColumnName(CDOID tag) { String column = tagMap.get(tag); if (column == null) { - addFeature(accessor, tag); + addFeature(tag); column = tagMap.get(tag); } @@ -739,12 +741,12 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList * The feature's MetaID in CDO * @return the corresponding type mapping */ - protected ITypeMapping getTypeMapping(IDBStoreAccessor accessor, CDOID tag) + protected ITypeMapping getTypeMapping(CDOID tag) { ITypeMapping typeMapping = typeMappings.get(tag); if (typeMapping == null) { - addFeature(accessor, tag); + addFeature(tag); typeMapping = typeMappings.get(tag); } @@ -755,9 +757,9 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList * @param metaID * @return the column name where the values are stored */ - private EStructuralFeature getFeatureByTag(IDBStoreAccessor accessor, CDOID tag) + private EStructuralFeature getFeatureByTag(CDOID tag) { - return (EStructuralFeature)getMappingStrategy().getStore().getMetaDataManager().getMetaInstance(accessor, tag); + return (EStructuralFeature)getMappingStrategy().getStore().getMetaDataManager().getMetaInstance(tag); } /** @@ -765,9 +767,9 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList * The EStructuralFeature * @return The feature's MetaID in CDO */ - protected CDOID getTagByFeature(IDBStoreAccessor accessor, EStructuralFeature feature, long created) + protected CDOID getTagByFeature(EStructuralFeature feature, long created) { - return getMappingStrategy().getStore().getMetaDataManager().getMetaID(accessor, feature, created); + return getMappingStrategy().getStore().getMetaDataManager().getMetaID(feature, created); } /** @@ -1220,8 +1222,8 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList { FeatureMap.Entry entry = (FeatureMap.Entry)value; EStructuralFeature entryFeature = entry.getEStructuralFeature(); - CDOID tag = getTagByFeature(accessor, entryFeature, timestamp); - String columnName = getColumnName(accessor, tag); + CDOID tag = getTagByFeature(entryFeature, timestamp); + String columnName = getColumnName(tag); stmt = statementCache.getPreparedStatement(sqlInsert, ReuseProbability.HIGH); @@ -1237,7 +1239,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList { if (columnNames.get(i).equals(columnName)) { - getTypeMapping(accessor, tag).setValue(stmt, column++, entry.getValue()); + getTypeMapping(tag).setValue(stmt, column++, entry.getValue()); } else { @@ -1280,8 +1282,8 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList { FeatureMap.Entry entry = (FeatureMap.Entry)value; EStructuralFeature entryFeature = entry.getEStructuralFeature(); - CDOID tag = getTagByFeature(accessor, entryFeature, timestamp); - String columnName = getColumnName(accessor, tag); + CDOID tag = getTagByFeature(entryFeature, timestamp); + String columnName = getColumnName(tag); stmt = statementCache.getPreparedStatement(sqlInsert, ReuseProbability.HIGH); @@ -1297,7 +1299,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList { if (columnNames.get(i).equals(columnName)) { - getTypeMapping(accessor, tag).setValue(stmt, column++, entry.getValue()); + getTypeMapping(tag).setValue(stmt, column++, entry.getValue()); } else { @@ -1431,8 +1433,8 @@ public class BranchingFeatureMapTableMappingWithRanges extends BasicAbstractList if (resultSet.next()) { CDOID tag = idHandler.getCDOID(resultSet, 1); - Object value = getTypeMapping(accessor, tag).readValue(resultSet); - result = CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(accessor, tag), value); + Object value = getTypeMapping(tag).readValue(resultSet); + result = CDORevisionUtil.createFeatureMapEntry(getFeatureByTag(tag), value); } else { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/DelegatingObjectTypeMapper.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/DelegatingObjectTypeMapper.java index 21f867b9f0..41b90d8f88 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/DelegatingObjectTypeMapper.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/DelegatingObjectTypeMapper.java @@ -55,7 +55,7 @@ public abstract class DelegatingObjectTypeMapper extends AbstractObjectTypeMappe CDOID type = doGetObjectType(accessor, id); if (type != null) { - EClass eClass = (EClass)getMetaDataManager().getMetaInstance(accessor, type); + EClass eClass = (EClass)getMetaDataManager().getMetaInstance(type); return new CDOClassifierRef(eClass); } @@ -64,7 +64,7 @@ public abstract class DelegatingObjectTypeMapper extends AbstractObjectTypeMappe public void putObjectType(IDBStoreAccessor accessor, long timeStamp, CDOID id, EClass type) { - CDOID classID = getMetaDataManager().getMetaID(accessor, type, timeStamp); + CDOID classID = getMetaDataManager().getMetaID(type, timeStamp); doPutObjectType(accessor, id, classID); delegate.putObjectType(accessor, timeStamp, id, type); diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java index 6d1d4fa6cc..8e05ca9081 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java @@ -270,8 +270,8 @@ public class NonAuditFeatureMapTableMapping extends AbstractFeatureMapTableMappi { FeatureMap.Entry entry = (FeatureMap.Entry)value; EStructuralFeature entryFeature = entry.getEStructuralFeature(); - CDOID tag = getTagByFeature(accessor, entryFeature, timestamp); - String columnName = getColumnName(accessor, tag); + CDOID tag = getTagByFeature(entryFeature, timestamp); + String columnName = getColumnName(tag); String sql = sqlInsert; @@ -284,7 +284,7 @@ public class NonAuditFeatureMapTableMapping extends AbstractFeatureMapTableMappi { if (getColumnNames().get(i).equals(columnName)) { - getTypeMapping(accessor, tag).setValue(stmt, column++, entry.getValue()); + getTypeMapping(tag).setValue(stmt, column++, entry.getValue()); } else { @@ -495,9 +495,9 @@ public class NonAuditFeatureMapTableMapping extends AbstractFeatureMapTableMappi FeatureMap.Entry entry = (FeatureMap.Entry)value; EStructuralFeature entryFeature = entry.getEStructuralFeature(); - CDOID tag = getTagByFeature(accessor, entryFeature, timestamp); - String columnName = getColumnName(accessor, tag); - ITypeMapping mapping = getTypeMapping(accessor, tag); + CDOID tag = getTagByFeature(entryFeature, timestamp); + String columnName = getColumnName(tag); + ITypeMapping mapping = getTypeMapping(tag); try { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java index 0f3d6d3a49..26d68863d9 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java @@ -32,7 +32,6 @@ import org.eclipse.net4j.db.ddl.IDBField; import org.eclipse.net4j.db.ddl.IDBIndex; import org.eclipse.net4j.db.ddl.IDBSchema; import org.eclipse.net4j.db.ddl.IDBTable; -import org.eclipse.net4j.util.lifecycle.LifecycleUtil; import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.emf.ecore.EClass; @@ -90,7 +89,7 @@ public class ObjectTypeTable extends AbstractObjectTypeMapper } CDOID classID = idHandler.getCDOID(resultSet, 1); - EClass eClass = (EClass)getMetaDataManager().getMetaInstance(accessor, classID); + EClass eClass = (EClass)getMetaDataManager().getMetaInstance(classID); return new CDOClassifierRef(eClass); } catch (SQLException ex) @@ -113,7 +112,7 @@ public class ObjectTypeTable extends AbstractObjectTypeMapper { stmt = statementCache.getPreparedStatement(sqlInsert, ReuseProbability.MAX); idHandler.setCDOID(stmt, 1, id); - idHandler.setCDOID(stmt, 2, getMetaDataManager().getMetaID(accessor, type, timeStamp)); + idHandler.setCDOID(stmt, 2, getMetaDataManager().getMetaID(type, timeStamp)); stmt.setLong(3, timeStamp); DBUtil.trace(stmt.toString()); int result = stmt.executeUpdate(); @@ -239,7 +238,7 @@ public class ObjectTypeTable extends AbstractObjectTypeMapper finally { DBUtil.close(statement); - LifecycleUtil.deactivate(writer); // Don't let the null-context accessor go to the pool! + writer.release(); } sqlSelect = "SELECT " + typeField + " FROM " + table + " WHERE " + idField + "=?"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 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 49586bccaf..49a81fe753 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,6 @@ public class Repository extends Container<Object> implements InternalRepository } finally { - // LifecycleUtil.deactivate(writer); // Don't let the null-context accessor go to the pool! StoreThreadLocal.release(); } } @@ -1440,7 +1439,6 @@ public class Repository extends Container<Object> implements InternalRepository } finally { - LifecycleUtil.deactivate(reader); // Don't let the null-context accessor go to the pool! StoreThreadLocal.release(); } } @@ -1460,7 +1458,6 @@ public class Repository extends Container<Object> implements InternalRepository } finally { - LifecycleUtil.deactivate(reader); // Don't let the null-context accessor go to the pool! StoreThreadLocal.release(); } } |