0

最近、Drools をシステムに導入しましたが、しばらくしてからサーバーが誤動作し始めました (クラッシュまたはレイテンシーの増加)。スレッド ダンプを分析し、そのスニペットを以下に示します。このプールのほとんどのスレッドは BLOCKED STATE です。

"mainProcessPool-pool-18-thread-1078--ADDADA121312" - Thread t@21148
 java.lang.Thread.State: BLOCKED
at org.apache.catalina.loader.WebappClassLoader.findResources(WebappClassLoader.java:1312)
- waiting to lock <97872c0> (a [Ljava.util.jar.JarFile;) owned by "mainProcessPool-pool-18-thread-1019--ADDADA121312" t@20949
at java.lang.ClassLoader.getResources(ClassLoader.java:1040)
at org.drools.util.CompositeClassLoader.getResources(CompositeClassLoader.java:116)
at org.drools.util.ChainedProperties.getResources(ChainedProperties.java:146)
at org.drools.util.ChainedProperties.<init>(ChainedProperties.java:92)
at org.drools.util.ChainedProperties.<init>(ChainedProperties.java:51)
at org.drools.SessionConfiguration.init(SessionConfiguration.java:140)
at org.drools.SessionConfiguration.<init>(SessionConfiguration.java:124)
at org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:155)
at com.tnp.drools.configuration.DroolsConfigManager.getStatefullSession(DroolsConfigManager.java:103)

同じことの詳細な原​​因が何であるかを知りたいだけです。このような問題を防ぐために、他にどのような構成を行う必要がありますか。

====JAVA CONFIGで更新

 public class DroolsConfigManager {

private KnowledgeAgentConfiguration knowledgeAgentConfig;
private Properties config;
private String droolCachePath;
private ResourceChangeScannerConfiguration rChangeScannerConfiguration;
private KnowledgeAgent knowledgeAgent;
    public String getDroolCachePath() {
    return this.droolCachePath;
}
public void setDroolCachePath(String droolCachePath) {
    this.droolCachePath = droolCachePath;
}
public KnowledgeAgent getKnowledgeAgent() {
    return this.knowledgeAgent;
}
public void setKnowledgeAgent(KnowledgeAgent knowledgeAgent) {
    this.knowledgeAgent = knowledgeAgent;
}
public ResourceChangeScannerConfiguration getrChangeScannerConfiguration() {
    return this.rChangeScannerConfiguration;
}
public void setrChangeScannerConfiguration(ResourceChangeScannerConfiguration rChangeScannerConfiguration) {
    this.rChangeScannerConfiguration = rChangeScannerConfiguration;
}
public Properties getConfig() {
    return this.config;
}
public void setConfig(Properties config) {
  this.config = config;
    for (Object key : config.keySet()) {
        if (this.knowledgeAgentConfig == null)
            this.knowledgeAgentConfig = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        this.knowledgeAgentConfig.setProperty((String) key, (String) config.get(key));
    }
}

public KnowledgeAgentConfiguration getKnowledgeAgentConfig() {
    return this.knowledgeAgentConfig;
}

public void setKnowledgeAgentConfig(KnowledgeAgentConfiguration knowledgeAgentConfig) {
    this.knowledgeAgentConfig = knowledgeAgentConfig;
}

public void start() {
    if(this.droolCachePath != null){
        System.setProperty("drools.resource.urlcache", this.droolCachePath);
    }
    this.rChangeScannerConfiguration = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
    this.rChangeScannerConfiguration.setProperty(ApplicationConstants.DROOLS_RESOURCE_SCANNER_INTERVAL, this.config.getProperty(ApplicationConstants.DROOLS_RESOURCE_SCANNER_INTERVAL));
    ResourceFactory.getResourceChangeScannerService().configure(this.rChangeScannerConfiguration);
    ResourceFactory.getResourceChangeNotifierService().start();
    ResourceFactory.getResourceChangeScannerService().start();
    this.knowledgeAgent = KnowledgeAgentFactory.newKnowledgeAgent(this.config.getProperty(ApplicationConstants.DROOLS_KNOWLEDGE_AGENT_NAME), this.knowledgeAgentConfig);
    Resource resource = ResourceFactory.newClassPathResource(this.config.getProperty(ApplicationConstants.DROOLS_BASE_KNOWLEDGE_AGENT_CHANGE_SET_PATH));
    this.knowledgeAgent.applyChangeSet(resource);

}

public StatelessKnowledgeSession getStatelessSession() {
    KnowledgeAgent knowledgeAgent = getKnowledgeAgent();
    return knowledgeAgent.getKnowledgeBase().newStatelessKnowledgeSession();
}

public StatefulKnowledgeSession getStatefullSession() {
    KnowledgeAgent knowledgeAgent = getKnowledgeAgent();
    return knowledgeAgent.getKnowledgeBase().newStatefulKnowledgeSession( );
}
 }

StatefulKnowledgeSessionpublic StatefulKnowledgeSession getStatefullSession()メソッドを使用しています。このクラスの Spring Bean を作成し、他のクラスに注入して drools を使用します。

4

0 に答える 0