[teiid-commits] teiid SVN: r2963 - in trunk: engine/src/main/java/org/teiid/dqp/internal/process and 3 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Thu Mar 3 21:34:27 EST 2011
Author: shawkins
Date: 2011-03-03 21:34:26 -0500 (Thu, 03 Mar 2011)
New Revision: 2963
Modified:
trunk/documentation/admin-guide/src/main/docbook/en-US/content/vdb-deployment.xml
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
Log:
TEIID-1493 changing the listener logic to prevent unnecessary cache clearing and updating docs
Modified: trunk/documentation/admin-guide/src/main/docbook/en-US/content/vdb-deployment.xml
===================================================================
--- trunk/documentation/admin-guide/src/main/docbook/en-US/content/vdb-deployment.xml 2011-03-03 21:36:25 UTC (rev 2962)
+++ trunk/documentation/admin-guide/src/main/docbook/en-US/content/vdb-deployment.xml 2011-03-04 02:34:26 UTC (rev 2963)
@@ -330,8 +330,8 @@
<para>
Setting the version can either be done in the vdb.xml, which is useful for dynamic vdbs, or through a naming convention of the deployment file - vdbname.version.vdb, e.g. marketdata.2.vdb.
- The deployer is responsible for choosing an appropriate version number. If the version number is same as an existing VDB existing connections to the
- previous VDB will remain valid and any new connections will be made to the new VDB - note that the new VDB may be able to use cache entries of the previous VDB.
+ The deployer is responsible for choosing an appropriate version number. If there is alreay a VDB name/version that matches the current deployment, then connections to the
+ previous VDB will be terminated and its cache entries will be flushed. Any new connections will then be made to the new VDB.
</para>
<para>
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-03-03 21:36:25 UTC (rev 2962)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-03-04 02:34:26 UTC (rev 2963)
@@ -550,7 +550,7 @@
}
private void clearPlanCache(String vdbName, int version){
- LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache")); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache_for_vdb", vdbName, version)); //$NON-NLS-1$
this.prepPlanCache.clearForVDB(vdbName, version);
}
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2011-03-03 21:36:25 UTC (rev 2962)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2011-03-04 02:34:26 UTC (rev 2963)
@@ -834,6 +834,7 @@
DQPCore.Unable_to_load_metadata_for_VDB_name__{0},_version__{1}=Unable to load metadata for VDB name= {0}, version= {1}
DQPCore.Unknown_query_metadata_exception_while_registering_query__{0}.=Unknown query metadata exception while registering query: {0}.
DQPCore.Clearing_prepared_plan_cache=Clearing prepared plan cache
+DQPCore.Clearing_prepared_plan_cache_for_vdb=Clearing prepared plan cache for vdb {0}.{1}
DQPCore.clearing_resultset_cache=Clearing the resultset cache for vdb {0}.{1}
DQPCore.The_request_has_been_closed.=The request {0} has been closed.
DQPCore.The_atomic_request_has_been_cancelled=The atomic request {0} has been canceled.
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-03-03 21:36:25 UTC (rev 2962)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-03-04 02:34:26 UTC (rev 2963)
@@ -32,9 +32,11 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Properties;
+import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -78,6 +80,7 @@
import org.teiid.core.ComponentNotFoundException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.util.LRUCache;
import org.teiid.deployers.VDBLifeCycleListener;
import org.teiid.deployers.VDBRepository;
import org.teiid.deployers.VDBStatusChecker;
@@ -102,6 +105,7 @@
import org.teiid.transport.ODBCSocketListener;
import org.teiid.transport.SocketConfiguration;
import org.teiid.transport.SocketListener;
+import org.teiid.vdb.runtime.VDBKey;
@ManagementObject(name="RuntimeEngineDeployer", isRuntime=true, componentType=@ManagementComponent(type="teiid",subtype="dqp"), properties=ManagementProperties.EXPLICIT)
@@ -214,14 +218,19 @@
// add vdb life cycle listeners
this.vdbRepository.addListener(new VDBLifeCycleListener() {
-
+
+ private Set<VDBKey> recentlyRemoved = Collections.newSetFromMap(new LRUCache<VDBKey, Boolean>(10000));
+
@Override
public void removed(String name, int version) {
-
+ recentlyRemoved.add(new VDBKey(name, version));
}
@Override
public void added(String name, int version) {
+ if (!recentlyRemoved.remove(new VDBKey(name, version))) {
+ return;
+ }
// terminate all the previous sessions
try {
Collection<SessionMetadata> sessions = sessionService.getActiveSessions();
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-03-03 21:36:25 UTC (rev 2962)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-03-04 02:34:26 UTC (rev 2963)
@@ -31,6 +31,7 @@
import java.util.NavigableMap;
import java.util.Properties;
import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.concurrent.CopyOnWriteArrayList;
import org.jboss.deployers.spi.DeploymentException;
import org.teiid.adminapi.AdminException;
@@ -60,7 +61,7 @@
private MetadataStore systemStore;
private MetadataStore odbcStore;
private boolean odbcEnabled = false;
- private List<VDBLifeCycleListener> listeners = new ArrayList<VDBLifeCycleListener>();
+ private List<VDBLifeCycleListener> listeners = new CopyOnWriteArrayList<VDBLifeCycleListener>();
private SystemFunctionManager systemFunctionManager;
public void addVDB(VDBMetaData vdb, MetadataStoreGroup stores, LinkedHashMap<String, Resource> visibilityMap, UDFMetaData udf, ConnectorManagerRepository cmr) throws DeploymentException {
@@ -157,7 +158,7 @@
this.odbcEnabled = true;
}
- public synchronized boolean removeVDB(String vdbName, int vdbVersion) {
+ public boolean removeVDB(String vdbName, int vdbVersion) {
VDBKey key = new VDBKey(vdbName, vdbVersion);
CompositeVDB removed = this.vdbRepo.remove(key);
if (removed != null) {
@@ -214,11 +215,11 @@
}
}
- public synchronized void addListener(VDBLifeCycleListener listener) {
+ public void addListener(VDBLifeCycleListener listener) {
this.listeners.add(listener);
}
- public synchronized void removeListener(VDBLifeCycleListener listener) {
+ public void removeListener(VDBLifeCycleListener listener) {
this.listeners.remove(listener);
}
More information about the teiid-commits
mailing list