Skip to content

Commit

Permalink
MONDRIAN
Browse files Browse the repository at this point in the history
       When a RolapSchema goes away, its JdbcSchema stays around.
       When a RolapSchema goes away, its AggTableManager also
       goes away, but the MondrianProperties triggers that were
       registered are not removed.

[git-p4: depot-paths = "//open/mondrian/": change = 5676]
  • Loading branch information
Richard Emberson committed Mar 2, 2006
1 parent 0106f75 commit 511ed76
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
28 changes: 26 additions & 2 deletions src/main/mondrian/rolap/RolapSchema.java
Expand Up @@ -202,6 +202,16 @@ private RolapSchema(final String key,
load(catalogName, null);
}

protected void finalCleanUp() {
if (aggTableManager != null) {
aggTableManager.finalCleanUp();
aggTableManager = null;
}
}
protected void finalize() throws Throwable {
finalCleanUp();
}

public boolean equals(Object o) {
if (!(o instanceof RolapSchema)) {
return false;
Expand Down Expand Up @@ -802,8 +812,11 @@ private void remove(String key) {
SoftReference ref = (SoftReference) mapUrlToSchema.get(key);
if (ref != null) {
RolapSchema schema = (RolapSchema) ref.get();
if ((schema != null) && (schema.md5Bytes != null)) {
mapUrlToSchema.remove(schema.md5Bytes);
if (schema != null) {
if (schema.md5Bytes != null) {
mapUrlToSchema.remove(schema.md5Bytes);
}
schema.finalCleanUp();
}
}
mapUrlToSchema.remove(key);
Expand All @@ -815,6 +828,17 @@ synchronized void clear() {
LOGGER.debug(msg);
}

Iterator it = mapUrlToSchema.values().iterator();
while (it.hasNext()) {
SoftReference ref = (SoftReference) it.next();
if (ref != null) {
RolapSchema schema = (RolapSchema) ref.get();
if (schema != null) {
schema.finalCleanUp();
}
}

}
mapUrlToSchema.clear();
}

Expand Down
16 changes: 13 additions & 3 deletions src/main/mondrian/rolap/aggmatcher/AggTableManager.java
Expand Up @@ -58,6 +58,16 @@ public class AggTableManager {
public AggTableManager(final RolapSchema schema) {
this.schema = schema;
}

/**
* This should ONLY be called if the AggTableManager is no longer going
* to be used. In fact, it should only be called indirectly by its
* associated RolapSchema object.
*/
public void finalCleanUp() {
clearJdbcSchema();
deregisterTriggers(MondrianProperties.instance());
}

/**
* Get the Logger.
Expand Down Expand Up @@ -371,9 +381,9 @@ public void execute(Property property, String value) {

private void deregisterTriggers(final MondrianProperties properties) {
properties.ChooseAggregateByVolume.removeTrigger(triggers[0]);
properties.AggregateRules.addTrigger(triggers[1]);
properties.AggregateRuleTag.addTrigger(triggers[1]);
properties.ReadAggregates.addTrigger(triggers[2]);
properties.AggregateRules.removeTrigger(triggers[1]);
properties.AggregateRuleTag.removeTrigger(triggers[1]);
properties.ReadAggregates.removeTrigger(triggers[2]);
}

private Iterator getStars() {
Expand Down

0 comments on commit 511ed76

Please sign in to comment.