Author: rareddy
Date: 2011-07-28 17:06:28 -0400 (Thu, 28 Jul 2011)
New Revision: 3349
Modified:
branches/7.4.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html
branches/7.4.x/documentation/caching-guide/src/main/docbook/en-US/content/matviews.xml
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
branches/7.4.x/engine/src/main/resources/org/teiid/query/i18n.properties
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/7.4.x/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
branches/7.4.x/runtime/src/main/java/org/teiid/deployers/ContainerLifeCycleListener.java
Log:
TEIID-1689: implemented the IMV sync-up with other nodes at the start up in clustered
mode. Based on the replicated CacheID keys found Jboss cache, the node issues the
"refreshMatView" calls asynchronously for each view.
Modified: branches/7.4.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
---
branches/7.4.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-07-28
20:03:06 UTC (rev 3348)
+++
branches/7.4.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-07-28
21:06:28 UTC (rev 3349)
@@ -102,6 +102,7 @@
<property name="resultsetCacheConfig"><inject
bean="ResultsetCacheConfig"/></property>
<property name="preparedPlanCacheConfig"><inject
bean="PreparedPlanCacheConfig"/></property>
<property name="authorizationValidator"><inject
bean="AuthorizationValidator"/></property>
+ <property name="containerLifeCycleListener"><inject
bean="JBossLifeCycleListener"/></property>
<!-- Process pool maximum thread count. (default 64) -->
<property name="maxThreads">64</property>
<!-- Max active plans (default 20). Increase this value on highly concurrent
systems - but ensure that the underlying pools can handle the increased load without
timeouts. -->
Modified: branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html 2011-07-28 20:03:06
UTC (rev 3348)
+++ branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html 2011-07-28 21:06:28
UTC (rev 3349)
@@ -63,6 +63,12 @@
<LI><B>Streaming XQuery</B> - in situations where document projection
applies if the XMLQUERY/XMLTABLE path expressions meet certain conditions, then the
incoming document will not only be projected, but the independent subtrees will be
processed without loading the entire document. This allows for nearly arbitrarily large
XML documents to be processed. See the Reference for more.
<LI><B>Logging Procedures</B> - added SYSADMIN.isLoggable and
SYSADMIN.logMsg to aid in debugging procedure logic.
<LI><B>ODBC Cursors</B> - Capability to use
"UseDeclareFetch" with ODBC is added. This enables user to read the results in
batches, especially useful when dealing with large row count of results.
+ <LI><B>Internal Materialized Views</B>
+ <UL>
+ <LI><B>Distributed Refresh</B> - When a internal materialized view
is refreshed at one node, an event is issued to all other nodes in the cluster to
asynchronously fetch the new contents.
+ <LI><B>Sync at Start</B> - When a node is restarted in a cluster, at
end of start cycle Teiid will asynchronously fetch the cached internal materialized view
contents from other nodes.
+ </UL>
+ </LI>
</UL>
<h2><a name="Compatibility">Compatibility
Issues</a></h2>
Modified:
branches/7.4.x/documentation/caching-guide/src/main/docbook/en-US/content/matviews.xml
===================================================================
---
branches/7.4.x/documentation/caching-guide/src/main/docbook/en-US/content/matviews.xml 2011-07-28
20:03:06 UTC (rev 3348)
+++
branches/7.4.x/documentation/caching-guide/src/main/docbook/en-US/content/matviews.xml 2011-07-28
21:06:28 UTC (rev 3349)
@@ -120,6 +120,22 @@
subsequent refreshes performed with <code>refreshMatView</code> will use
dependent materialized view tables if they exist. Only one load may occur at a time. If
a load is already in progress when
the <code>SYSADMIN.refreshMatView</code> procedure is called, it will
return -1 immediately rather than preempting the current load.
</para>
+ <para>
+ When Teiid is running clustered mode, after of loading of internal
materialized view contents, an event will be sent to all
+ the other participating nodes in the cluster to refresh the contents from the
original node in asynchronus fashion.
+ During this remote node loading process, if the node that is reading the
contents gets a request from user to serve the
+ results of that view, then the current results in cache will be served. If no
results were available at that node, then
+ request will be blocked until load process is finished.
+ </para>
+ <para>
+ When a Teiid node joins the cluster, at the end of start-up cycle, an
asynchronus job
+ will be started to fetch all the previously cached internal materialized
views at other nodes
+ for the deployed VDBs. The query request behaviour during this load process
is same as above.
+ </para>
+ <note><para>In the clustered mode, the
"invalidate=true" flag in the "SYSADMIN.refreshMatView" procedure
+ will only apply to the node that is refreshing the contents from source. All
other nodes, will still serve the
+ old contents during the refresh process.</para>
+ </note>
<section>
<title>TTL Snapshot Refresh</title>
<para>The <link linkend="cache-hint">cache hint</link>
may be used to automatically trigger a full snapshot refresh after a specified time to
live (ttl).
Modified: branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
---
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-07-28
20:03:06 UTC (rev 3348)
+++
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-07-28
21:06:28 UTC (rev 3349)
@@ -28,6 +28,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.FutureTask;
@@ -42,10 +43,11 @@
import org.teiid.adminapi.Request.ThreadState;
import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.RequestMetadata;
+import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.cache.CacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.client.DQP;
import org.teiid.client.RequestMessage;
import org.teiid.client.ResultsMessage;
@@ -57,24 +59,29 @@
import org.teiid.client.xa.XidImpl;
import org.teiid.common.buffer.BufferManager;
import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.Streamable;
+import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
import org.teiid.dqp.internal.process.ThreadReuseExecutor.PrioritizedRunnable;
import org.teiid.dqp.message.AtomicRequestMessage;
import org.teiid.dqp.message.RequestID;
import org.teiid.dqp.service.BufferService;
import org.teiid.dqp.service.TransactionContext;
+import org.teiid.dqp.service.TransactionContext.Scope;
import org.teiid.dqp.service.TransactionService;
-import org.teiid.dqp.service.TransactionContext.Scope;
import org.teiid.events.EventDistributor;
import org.teiid.logging.CommandLogMessage;
+import org.teiid.logging.CommandLogMessage.Event;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
-import org.teiid.logging.CommandLogMessage.Event;
import org.teiid.metadata.MetadataRepository;
import org.teiid.query.QueryPlugin;
+import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.optimizer.relational.RelationalPlanner;
import org.teiid.query.tempdata.TempTableDataManager;
import org.teiid.query.tempdata.TempTableStore;
@@ -173,9 +180,12 @@
requests.remove(requestID);
}
}
-
}
+ public static interface ContextProvider {
+ DQPWorkContext getContext(String vdbName, int vdbVersion);
+ }
+
private ThreadReuseExecutor processWorkerPool;
// Resources
@@ -405,7 +415,7 @@
}
}
- public void addWork(Runnable work) {
+ void addWork(Runnable work) {
this.processWorkerPool.execute(work);
}
@@ -730,10 +740,92 @@
processorDataManager.setMetadataRepository(metadataRepository);
dataTierMgr = new TempTableDataManager(processorDataManager, this.bufferManager,
this.processWorkerPool, this.rsCache, this.matTables, this.cacheFactory);
dataTierMgr.setEventDistributor(eventDistributor);
-
+
LogManager.logDetail(LogConstants.CTX_DQP, "DQPCore started
maxThreads", this.config.getMaxThreads(), "maxActivePlans",
this.maxActivePlans, "source concurrency", this.userRequestSourceConcurrency);
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+ public void synchronizeInternalMaterializedViews(final ContextProvider contextProvider)
{
+ if (!cacheFactory.isReplicated() || matTables == null) {
+ return;
+ }
+ Set<CacheID> keys = this.matTables.replicatableKeys();
+ for (final CacheID key:keys) {
+ refreshMatView(contextProvider, key.getVDBKey().getName(),
key.getVDBKey().getVersion(), key.getSql());
+ }
+ }
+
+ public void refreshMatView(final ContextProvider contextProvider, final String vdbName,
final int vdbVersion, final String viewName) {
+ if (!cacheFactory.isReplicated() || matTables == null) {
+ return;
+ }
+
+ final DQPWorkContext context = contextProvider.getContext(vdbName, vdbVersion);
+
+ final VDBMetaData vdb = context.getVDB();
+ if (vdb == null) {
+ return;
+ }
+
+ final TempTableStore globalStore = vdb.getAttachment(TempTableStore.class);
+ if (globalStore == null) {
+ return;
+ }
+ DQPWorkContext.setWorkContext(context);
+
+ Runnable work = new Runnable() {
+ @Override
+ public void run() {
+ QueryMetadataInterface metadata = vdb.getAttachment(QueryMetadataInterface.class);
+ TempTableStore tempStore = new TempTableStore("internal"); //$NON-NLS-1$
+ TempMetadataAdapter tma = new TempMetadataAdapter(metadata,
tempStore.getMetadataStore());
+ try {
+ dataTierMgr.refreshMatView(vdb.getName(), vdb.getVersion(), viewName, tma,
globalStore);
+ } catch (TeiidException e) {
+ LogManager.logError(LogConstants.CTX_DQP, e,
QueryPlugin.Util.getString("error_refresh", viewName )); //$NON-NLS-1$
+ }
+ }
+ };
+ addWork(work);
+ }
+
+ public void updateMatViewRow(final ContextProvider contextProvider, final String
vdbName, final int vdbVersion, final String schema,
+ final String viewName, final List<?> tuple, final boolean delete) {
+
+ if (!cacheFactory.isReplicated() || matTables == null) {
+ return;
+ }
+
+ final DQPWorkContext context = contextProvider.getContext(vdbName, vdbVersion);
+
+ final VDBMetaData vdb = context.getVDB();
+ if (vdb == null) {
+ return;
+ }
+
+ final TempTableStore globalStore = vdb.getAttachment(TempTableStore.class);
+ if (globalStore == null) {
+ return;
+ }
+
+ Runnable work = new Runnable() {
+ @Override
+ public void run() {
+ context.runInContext(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ dataTierMgr.updateMatViewRow(globalStore, RelationalPlanner.MAT_PREFIX + (schema +
'.' + viewName).toUpperCase(), tuple, delete);
+ } catch (TeiidException e) {
+ LogManager.logError(LogConstants.CTX_DQP, e,
QueryPlugin.Util.getString("DQPCore.unable_to_process_event")); //$NON-NLS-1$
+ }
+ }
+ });
+ }
+ };
+ addWork(work);
+
+ }
+
public void setBufferService(BufferService service) {
this.bufferService = service;
}
@@ -925,5 +1017,4 @@
SessionAwareCache<PreparedPlan> getPrepPlanCache() {
return prepPlanCache;
}
-
}
\ No newline at end of file
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
---
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-07-28
20:03:06 UTC (rev 3348)
+++
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-07-28
21:06:28 UTC (rev 3349)
@@ -24,6 +24,7 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -291,6 +292,10 @@
void setUserName(String name) {
this.userName = name;
}
+
+ public VDBKey getVDBKey() {
+ return vdbInfo;
+ }
public boolean equals(Object obj){
if(obj == this) {
@@ -328,4 +333,11 @@
public void setModTime(long modTime) {
this.modTime = modTime;
}
+
+ public Set<CacheID> replicatableKeys() {
+ if (this.distributedCache == this.localCache) {
+ return Collections.EMPTY_SET;
+ }
+ return this.distributedCache.keys();
+ }
}
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
---
branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-07-28
20:03:06 UTC (rev 3348)
+++
branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-07-28
21:06:28 UTC (rev 3349)
@@ -550,7 +550,7 @@
TupleSource ts = null;
CacheID cid = null;
if (distributedCache != null) {
- cid = new CacheID(new ParseInfo(), fullName, context.getVdbName(),
+ cid = new CacheID(new ParseInfo(), viewName, context.getVdbName(),
context.getVdbVersion(), context.getConnectionID(), context.getUserName());
if (useCache) {
CachedResults cr = this.distributedCache.get(cid);
Modified: branches/7.4.x/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/7.4.x/engine/src/main/resources/org/teiid/query/i18n.properties 2011-07-28
20:03:06 UTC (rev 3348)
+++ branches/7.4.x/engine/src/main/resources/org/teiid/query/i18n.properties 2011-07-28
21:06:28 UTC (rev 3349)
@@ -923,4 +923,5 @@
ValidationVisitor.not_a_procedure={0} is not a valid virtual procedure.
DdlPlan.event_not_exists={0} does not have an INSTEAD OF trigger defined for {1}.
-DdlPlan.event_already_exists={0} already has an INSTEAD OF trigger defined for {1}.
\ No newline at end of file
+DdlPlan.event_already_exists={0} already has an INSTEAD OF trigger defined for {1}.
+error_refresh=error occurred during refreshing the materialized view entries for view
{0}
\ No newline at end of file
Modified:
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java
===================================================================
---
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java 2011-07-28
20:03:06 UTC (rev 3348)
+++
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossLifeCycleListener.java 2011-07-28
21:06:28 UTC (rev 3349)
@@ -21,6 +21,10 @@
*/
package org.teiid.jboss;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
import javax.management.InstanceNotFoundException;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
@@ -39,6 +43,7 @@
public final String STOP_NOTIFICATION_TYPE =
"org.jboss.system.server.stopped"; //$NON-NLS-1$
private boolean shutdownInProgress = false;
+ private List<ContainerLifeCycleListener.LifeCycleEventListener> listeners =
Collections.synchronizedList(new
ArrayList<ContainerLifeCycleListener.LifeCycleEventListener>());
public JBossLifeCycleListener() {
try {
@@ -56,10 +61,16 @@
public void handleNotification(Notification msg, Object handback) {
String type = msg.getType();
if (type.equals(START_NOTIFICATION_TYPE)) {
+ for (ContainerLifeCycleListener.LifeCycleEventListener l:listeners) {
+ l.onStartupFinish();
+ }
}
if (type.equals(STOP_NOTIFICATION_TYPE)) {
shutdownInProgress = true;
+ for (ContainerLifeCycleListener.LifeCycleEventListener l:listeners) {
+ l.onShutdownStart();
+ }
}
}
@@ -67,4 +78,9 @@
public boolean isShutdownInProgress() {
return shutdownInProgress;
}
+
+ @Override
+ public void addListener(LifeCycleEventListener listener) {
+ listeners.add(listener);
+ }
}
Modified:
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
---
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-07-28
20:03:06 UTC (rev 3348)
+++
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-07-28
21:06:28 UTC (rev 3349)
@@ -60,10 +60,10 @@
import org.jboss.profileservice.spi.ProfileService;
import org.jboss.util.naming.Util;
import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.Admin.Cache;
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.Admin.Cache;
import org.teiid.adminapi.impl.CacheStatisticsMetadata;
import org.teiid.adminapi.impl.DQPManagement;
import org.teiid.adminapi.impl.RequestMetadata;
@@ -81,14 +81,15 @@
import org.teiid.client.util.ResultsFuture;
import org.teiid.core.ComponentNotFoundException;
import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.util.LRUCache;
+import org.teiid.deployers.ContainerLifeCycleListener;
import org.teiid.deployers.VDBLifeCycleListener;
import org.teiid.deployers.VDBRepository;
import org.teiid.deployers.VDBStatusChecker;
import org.teiid.dqp.internal.process.DQPConfiguration;
import org.teiid.dqp.internal.process.DQPCore;
+import org.teiid.dqp.internal.process.DQPCore.ContextProvider;
import org.teiid.dqp.internal.process.DQPWorkContext;
import org.teiid.dqp.internal.process.DataTierManagerImpl;
import org.teiid.dqp.internal.process.TransactionServerImpl;
@@ -109,16 +110,11 @@
import org.teiid.metadata.Procedure;
import org.teiid.metadata.Schema;
import org.teiid.metadata.Table;
-import org.teiid.metadata.TableStats;
import org.teiid.metadata.Table.TriggerEvent;
+import org.teiid.metadata.TableStats;
import org.teiid.net.TeiidURL;
-import org.teiid.query.QueryPlugin;
-import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.metadata.TransformationMetadata;
-import org.teiid.query.optimizer.relational.RelationalPlanner;
import org.teiid.query.processor.DdlPlan;
-import org.teiid.query.tempdata.TempTableStore;
import org.teiid.security.SecurityHelper;
import org.teiid.transport.ClientServiceRegistry;
import org.teiid.transport.ClientServiceRegistryImpl;
@@ -155,6 +151,7 @@
private String eventDistributorName;
private transient EventDistributor eventDistributor;
private transient EventDistributor eventDistributorProxy;
+ private transient ContainerLifeCycleListener lifecycleListener;
public RuntimeEngineDeployer() {
// TODO: this does not belong here
@@ -296,7 +293,9 @@
dqpCore.clearCache(Cache.PREPARED_PLAN_CACHE.toString(), name, version);
dqpCore.clearCache(Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), name, version);
}
- });
+ });
+
+ synchronizeMaterializeViews();
}
public void stop() {
@@ -682,67 +681,12 @@
@Override
public void updateMatViewRow(String vdbName, int vdbVersion, String schema,
String viewName, List<?> tuple, boolean delete) {
- VDBMetaData vdb = this.vdbRepository.getVDB(vdbName, vdbVersion);
- if (vdb == null) {
- return;
- }
- TempTableStore globalStore = vdb.getAttachment(TempTableStore.class);
- if (globalStore == null) {
- return;
- }
- try {
- this.dqpCore.getDataTierManager().updateMatViewRow(globalStore,
RelationalPlanner.MAT_PREFIX + (schema + '.' + viewName).toUpperCase(), tuple,
delete);
- } catch (TeiidException e) {
- LogManager.logError(LogConstants.CTX_DQP, e,
QueryPlugin.Util.getString("DQPCore.unable_to_process_event")); //$NON-NLS-1$
- }
+ this.dqpCore.updateMatViewRow(getcontextProvider(), vdbName, vdbVersion, schema,
viewName, tuple, delete);
}
@Override
public void refreshMatView(final String vdbName, final int vdbVersion, final String
viewName) {
- final VDBMetaData vdb = this.vdbRepository.getVDB(vdbName, vdbVersion);
- if (vdb == null) {
- return;
- }
- final TempTableStore globalStore = vdb.getAttachment(TempTableStore.class);
- if (globalStore == null) {
- return;
- }
-
- Runnable refreshWork = new Runnable() {
- @Override
- public void run() {
- SessionMetadata session = null;
- try {
- session = createTemporarySession(vdbName, vdbVersion, "internal");
//$NON-NLS-1$
-
- DQPWorkContext context = new DQPWorkContext();
- context.setSession(session);
- Runnable work = new Runnable() {
- @Override
- public void run() {
- QueryMetadataInterface metadata =
vdb.getAttachment(QueryMetadataInterface.class);
- TempTableStore tempStore = new TempTableStore("internal");
//$NON-NLS-1$
- TempMetadataAdapter tma = new TempMetadataAdapter(metadata,
tempStore.getMetadataStore());
- try {
- dqpCore.getDataTierManager().refreshMatView(vdbName, vdbVersion, viewName, tma,
globalStore);
- } catch (TeiidException e) {
- LogManager.logError(LogConstants.CTX_RUNTIME, e,
IntegrationPlugin.Util.getString("error_refresh", viewName )); //$NON-NLS-1$
- }
- }
- };
- context.runInContext(work);
- } catch (AdminProcessingException e) {
- LogManager.logError(LogConstants.CTX_RUNTIME, e,
IntegrationPlugin.Util.getString("error_refresh", viewName )); //$NON-NLS-1$
- } finally {
- try {
- sessionService.closeSession(session.getSessionId());
- } catch (InvalidSessionException e) {
- // ignore
- }
- }
- }
- };
- this.dqpCore.addWork(refreshWork);
+ this.dqpCore.refreshMatView(getcontextProvider(), vdbName, vdbVersion, viewName);
}
@Override
@@ -877,4 +821,38 @@
return this.eventDistributorProxy;
}
+ private void synchronizeMaterializeViews() {
+ this.lifecycleListener.addListener(new
ContainerLifeCycleListener.LifeCycleEventListener() {
+ @Override
+ public void onStartupFinish() {
+ dqpCore.synchronizeInternalMaterializedViews(getcontextProvider());
+ }
+ @Override
+ public void onShutdownStart() {
+ }
+ });
+ }
+
+ private ContextProvider getcontextProvider() {
+ return new DQPCore.ContextProvider() {
+ @Override
+ public DQPWorkContext getContext(final String vdbName, final int vdbVersion) {
+ return new DQPWorkContext() {
+ public VDBMetaData getVDB() {
+ return vdbRepository.getVDB(vdbName, vdbVersion);
+ }
+ public String getVdbName() {
+ return vdbName;
+ }
+ public int getVdbVersion() {
+ return vdbVersion;
+ }
+ };
+ }
+ };
+ }
+
+ public void setContainerLifeCycleListener(ContainerLifeCycleListener listener) {
+ this.lifecycleListener = listener;
+ }
}
Modified:
branches/7.4.x/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
---
branches/7.4.x/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-07-28
20:03:06 UTC (rev 3348)
+++
branches/7.4.x/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-07-28
21:06:28 UTC (rev 3349)
@@ -47,5 +47,4 @@
template_not_found=Template not found for {0}
admin_executing=JOPR admin {0} is executing command {1}
-DQPCore.unable_to_process_event=Unable to process event.
-error_refresh=error occurred during refreshing the materialized view entries for view {0}
+DQPCore.unable_to_process_event=Unable to process event.
Modified:
branches/7.4.x/runtime/src/main/java/org/teiid/deployers/ContainerLifeCycleListener.java
===================================================================
---
branches/7.4.x/runtime/src/main/java/org/teiid/deployers/ContainerLifeCycleListener.java 2011-07-28
20:03:06 UTC (rev 3348)
+++
branches/7.4.x/runtime/src/main/java/org/teiid/deployers/ContainerLifeCycleListener.java 2011-07-28
21:06:28 UTC (rev 3349)
@@ -23,4 +23,10 @@
public interface ContainerLifeCycleListener {
boolean isShutdownInProgress();
+ void addListener(LifeCycleEventListener listener);
+
+ public static interface LifeCycleEventListener{
+ void onStartupFinish();
+ void onShutdownStart();
+ }
}