Author: shawkins
Date: 2011-12-21 20:53:47 -0500 (Wed, 21 Dec 2011)
New Revision: 3756
Modified:
branches/7.6.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/7.6.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
branches/7.6.x/runtime/src/main/java/org/teiid/deployers/VDBLifeCycleListener.java
branches/7.6.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
branches/7.6.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
Log:
TEIID-1878 fix for creating the global table metadata store too early for dynamic vdbs
Modified:
branches/7.6.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
---
branches/7.6.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-12-20
22:40:36 UTC (rev 3755)
+++
branches/7.6.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-12-22
01:53:47 UTC (rev 3756)
@@ -292,15 +292,6 @@
@Override
public void added(String name, int version, CompositeVDB vdb) {
- GlobalTableStore gts = new GlobalTableStoreImpl(dqpCore.getBufferManager(),
vdb.getVDB().getAttachment(TransformationMetadata.class));
- if (objectReplicator != null) {
- try {
- gts = objectReplicator.replicate(name + version, GlobalTableStore.class, gts,
300000);
- } catch (Exception e) {
- LogManager.logError(LogConstants.CTX_RUNTIME, e,
IntegrationPlugin.Util.getString("replication_failed", gts)); //$NON-NLS-1$
- }
- }
- vdb.getVDB().addAttchment(GlobalTableStore.class, gts);
if (!recentlyRemoved.remove(new VDBKey(name, version))) {
return;
}
@@ -319,7 +310,21 @@
// dump the caches.
dqpCore.clearCache(Cache.PREPARED_PLAN_CACHE.toString(), name, version);
dqpCore.clearCache(Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), name, version);
- }
+ }
+
+ @Override
+ public void finishedDeployment(String name, int version,
+ CompositeVDB vdb) {
+ GlobalTableStore gts = new GlobalTableStoreImpl(dqpCore.getBufferManager(),
vdb.getVDB().getAttachment(TransformationMetadata.class));
+ if (objectReplicator != null) {
+ try {
+ gts = objectReplicator.replicate(name + version, GlobalTableStore.class, gts,
300000);
+ } catch (Exception e) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, e,
IntegrationPlugin.Util.getString("replication_failed", gts)); //$NON-NLS-1$
+ }
+ }
+ vdb.getVDB().addAttchment(GlobalTableStore.class, gts);
+ }
});
}
Modified: branches/7.6.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- branches/7.6.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2011-12-20
22:40:36 UTC (rev 3755)
+++ branches/7.6.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2011-12-22
01:53:47 UTC (rev 3756)
@@ -74,7 +74,7 @@
update();
}
- public void addChild(CompositeVDB child) {
+ public synchronized void addChild(CompositeVDB child) {
if (this.children == null) {
this.children = new LinkedHashMap<VDBKey, CompositeVDB>();
}
@@ -83,14 +83,14 @@
this.mergedVDB = null;
}
- public void removeChild(VDBKey child) {
+ public synchronized void removeChild(VDBKey child) {
if (this.children != null) {
this.children.remove(child);
}
this.mergedVDB = null;
}
- void update() {
+ synchronized void update() {
TransformationMetadata metadata = buildTransformationMetaData(mergedVDB,
getVisibilityMap(), getMetadataStores(), getUDF(), systemFunctions,
this.additionalStores);
mergedVDB.addAttchment(QueryMetadataInterface.class, metadata);
mergedVDB.addAttchment(TransformationMetadata.class, metadata);
@@ -123,7 +123,7 @@
return additionalStores;
}
- public VDBMetaData getVDB() {
+ public synchronized VDBMetaData getVDB() {
if (this.mergedVDB == null) {
this.mergedVDB = buildVDB();
update();
@@ -131,7 +131,7 @@
return this.mergedVDB;
}
- public boolean hasChildVdb(VDBKey child) {
+ public synchronized boolean hasChildVdb(VDBKey child) {
if (this.children != null) {
return this.children.containsKey(child);
}
@@ -201,7 +201,7 @@
return mergedUDF;
}
- private LinkedHashMap<String, Resource> getVisibilityMap() {
+ private synchronized LinkedHashMap<String, Resource> getVisibilityMap() {
if (this.children == null || this.children.isEmpty()) {
return this.visibilityMap;
}
@@ -219,7 +219,7 @@
return mergedvisibilityMap;
}
- public MetadataStoreGroup getMetadataStores() {
+ public synchronized MetadataStoreGroup getMetadataStores() {
if (this.children == null || this.children.isEmpty()) {
return this.stores;
}
Modified:
branches/7.6.x/runtime/src/main/java/org/teiid/deployers/VDBLifeCycleListener.java
===================================================================
---
branches/7.6.x/runtime/src/main/java/org/teiid/deployers/VDBLifeCycleListener.java 2011-12-20
22:40:36 UTC (rev 3755)
+++
branches/7.6.x/runtime/src/main/java/org/teiid/deployers/VDBLifeCycleListener.java 2011-12-22
01:53:47 UTC (rev 3756)
@@ -24,4 +24,5 @@
public interface VDBLifeCycleListener {
void added(String name, int version, CompositeVDB vdb);
void removed(String name, int version, CompositeVDB vdb);
+ void finishedDeployment(String name, int version, CompositeVDB vdb);
}
Modified: branches/7.6.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/7.6.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-12-20
22:40:36 UTC (rev 3755)
+++ branches/7.6.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-12-22
01:53:47 UTC (rev 3756)
@@ -314,6 +314,7 @@
target.addChild(source);
notifyAdd(targetVDBName, targetVDBVersion, target);
+ notifyFinished(targetVDBName, targetVDBVersion, target);
}
// this is called by mc
@@ -328,8 +329,15 @@
if (v!= null) {
updateFromMetadataRepository(v);
v.update();
+ notifyFinished(name, version, v);
}
}
+
+ private void notifyFinished(String name, int version, CompositeVDB v) {
+ for(VDBLifeCycleListener l:this.listeners) {
+ l.finishedDeployment(name, version, v);
+ }
+ }
public void addListener(VDBLifeCycleListener listener) {
this.listeners.add(listener);
Modified:
branches/7.6.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
---
branches/7.6.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-12-20
22:40:36 UTC (rev 3755)
+++
branches/7.6.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-12-22
01:53:47 UTC (rev 3756)
@@ -101,12 +101,18 @@
this.repo.addListener(new VDBLifeCycleListener() {
@Override
+ public void added(String name, int version,
+ CompositeVDB vdb) {
+
+ }
+
+ @Override
public void removed(String name, int version, CompositeVDB vdb) {
}
@Override
- public void added(String name, int version, CompositeVDB vdb) {
+ public void finishedDeployment(String name, int version, CompositeVDB vdb) {
GlobalTableStore gts = new GlobalTableStoreImpl(dqp.getBufferManager(),
vdb.getVDB().getAttachment(TransformationMetadata.class));
if (replicator != null) {
try {