Skip to content

Commit

Permalink
log the override of a virtual table only once.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Nov 23, 2012
1 parent be20e44 commit 88b0ecc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Expand Up @@ -23,8 +23,10 @@

import java.sql.SQLException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
Expand Down Expand Up @@ -55,6 +57,8 @@ abstract public class AbstractService implements IService {
protected String tablePrefix;

private ISqlMap sqlMap;

private Set<String> logOnce = new HashSet<String>();

public AbstractService(IParameterService parameterService, ISymmetricDialect symmetricDialect) {
this.symmetricDialect = symmetricDialect;
Expand Down Expand Up @@ -200,5 +204,12 @@ protected String buildBatchWhere(List<String> nodeIds, List<String> channels,
return where.toString();
}

protected void logOnce(String message) {
if (!logOnce.contains(message)) {
logOnce.add(message);
log.info(message);
}
}


}
Expand Up @@ -282,8 +282,8 @@ protected List<Trigger> buildTriggersForSymmetricTables(String version,
List<Trigger> definedTriggers = getTriggers();
for (Trigger trigger : definedTriggers) {
if (tables.remove(trigger.getSourceTableName())) {
log.info("Not generating virtual triggers for {} because there is a user defined trigger already defined",
trigger.getSourceTableName());
logOnce(String.format("Not generating virtual triggers for %s because there is a user defined trigger already defined",
trigger.getSourceTableName()));
}
}

Expand Down

0 comments on commit 88b0ecc

Please sign in to comment.