Skip to content

Commit

Permalink
TEIID-4336 addressing early cache shutdown and better handingling
Browse files Browse the repository at this point in the history
listener exceptions
  • Loading branch information
shawkins committed Jul 14, 2016
1 parent 172be88 commit db2c7b6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
Expand Up @@ -102,12 +102,18 @@ public void removed(String name, CompositeVDB vdb) {
}

// dump the caches.
if (getResultSetCacheInjector().getValue() != null) {
getResultSetCacheInjector().getValue().clearForVDB(vdb.getVDBKey());
}
if (getPreparedPlanCacheInjector().getValue() != null) {
getPreparedPlanCacheInjector().getValue().clearForVDB(vdb.getVDBKey());
}
try {
SessionAwareCache<?> value = getResultSetCacheInjector().getValue();
if (value != null) {
value.clearForVDB(vdb.getVDBKey());
}
value = getPreparedPlanCacheInjector().getValue();
if (value != null) {
value.clearForVDB(vdb.getVDBKey());
}
} catch (IllegalStateException e) {
//already shutdown
}
}

@Override
Expand Down
Expand Up @@ -58,24 +58,36 @@ public EventDistributorImpl() {
@Override
public void removed(String name, CompositeVDB vdb) {
for(EventListener el:EventDistributorImpl.this.listeners) {
el.vdbUndeployed(name, vdb.getVDB().getVersion());
try {
el.vdbUndeployed(name, vdb.getVDB().getVersion());
} catch (Exception e) {
LogManager.logError(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40148, "undeployed", vdb.getVDBKey())); //$NON-NLS-1$
}
}
}
@Override
public void finishedDeployment(String name, CompositeVDB vdb) {
for(EventListener el:EventDistributorImpl.this.listeners) {
if (vdb.getVDB().getStatus().equals(Status.ACTIVE)) {
el.vdbLoaded(vdb.getVDB());
}
else {
el.vdbLoadFailed(vdb.getVDB());
try {
if (vdb.getVDB().getStatus().equals(Status.ACTIVE)) {
el.vdbLoaded(vdb.getVDB());
}
else {
el.vdbLoadFailed(vdb.getVDB());
}
} catch (Exception e) {
LogManager.logError(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40148, "finished deployment", vdb.getVDBKey())); //$NON-NLS-1$
}
}
}
@Override
public void added(String name, CompositeVDB vdb) {
for(EventListener el:EventDistributorImpl.this.listeners) {
el.vdbDeployed(name, vdb.getVDB().getVersion());
try {
el.vdbDeployed(name, vdb.getVDB().getVersion());
} catch (Exception e) {
LogManager.logError(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40148, "deployed", vdb.getVDBKey())); //$NON-NLS-1$
}
}
}
@Override
Expand Down
3 changes: 2 additions & 1 deletion runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
Expand Up @@ -153,6 +153,7 @@ public static enum Event implements BundleUtil.Event{
TEIID40144,
TEIID40145,
TEIID40146,
TEIID40147
TEIID40147,
TEIID40148
}
}
2 changes: 2 additions & 0 deletions runtime/src/main/resources/org/teiid/runtime/i18n.properties
Expand Up @@ -147,3 +147,5 @@ TEIID40144={0} deploy failed - imported vdb {1} is not properly specified. The
TEIID40145={0} deploy failed - the version must be fully specified

TEIID40147=Invalid integer {0}

TEIID40148=Uncaught exception calling listener on event {0} for vdb {1}

0 comments on commit db2c7b6

Please sign in to comment.