Original commit: elastic/x-pack-elasticsearch@d91926ebdf
This commit is contained in:
Brian Murphy 2014-11-05 17:50:54 +00:00
commit 5d52c374b3
4 changed files with 74 additions and 53 deletions

116
pom.xml
View File

@ -14,12 +14,57 @@
<packaging>jar</packaging>
<properties>
<elasticsearch.version>1.4.0.Beta1</elasticsearch.version>
<lucene.version>4.10.1</lucene.version>
<elasticsearch.version>1.4.0</elasticsearch.version>
<lucene.version>4.10.2</lucene.version>
</properties>
<dependencies>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<!-- Otherwise we can't see quartz logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.4</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-test-framework</artifactId>
@ -33,6 +78,7 @@
<version>1.3.RC2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
@ -41,16 +87,10 @@
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>${lucene.version}</version>
<scope>provided</scope>
<groupId>com.carrotsearch.randomizedtesting</groupId>
<artifactId>randomizedtesting-runner</artifactId>
<version>2.1.10</version>
<scope>test</scope>
</dependency>
<dependency>
@ -61,6 +101,22 @@
<scope>test</scope>
</dependency>
<!-- Provided dependencies -->
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>${lucene.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
@ -68,42 +124,6 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<!-- Otherwise we can't see quartz logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.4</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<repositories>
<repository>

View File

@ -138,7 +138,7 @@ public class AlertManager extends AbstractComponent {
}
public void stop() {
if (started.compareAndSet(false, true)) {
if (started.compareAndSet(true, false)) {
scheduler.stop();
alertsStore.stop();
actionManager.stop();

View File

@ -16,6 +16,7 @@ import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.alerts.Alert;
import org.elasticsearch.alerts.AlertsStore;
import org.elasticsearch.alerts.LoadingListener;
import org.elasticsearch.alerts.plugin.AlertsPlugin;
import org.elasticsearch.alerts.triggers.TriggerManager;
import org.elasticsearch.alerts.triggers.TriggerResult;
import org.elasticsearch.client.Client;
@ -123,7 +124,7 @@ public class AlertActionManager extends AbstractComponent {
logger.debug("Stopping thread to read from the job queue");
return;
}
threadPool.executor(ThreadPool.Names.MANAGEMENT).execute(new AlertHistoryRunnable(entry));
threadPool.executor(AlertsPlugin.THREAD_POOL_NAME).execute(new AlertHistoryRunnable(entry));
}
} catch (Throwable t) {
logger.error("Error during reader thread", t);

View File

@ -17,10 +17,10 @@ import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilde
public class AlertsPlugin extends AbstractPlugin {
public static final String NAME = "alerts";
public static final String THREAD_POOL_NAME = "alerts";
@Override public String name() {
return NAME;
return THREAD_POOL_NAME;
}
@Override public String description() {
@ -37,7 +37,7 @@ public class AlertsPlugin extends AbstractPlugin {
@Override
public Settings additionalSettings() {
return settingsBuilder()
.put("threadpool."+ NAME + ".type","cached")
.put("threadpool."+ THREAD_POOL_NAME + ".type","cached")
.build();
}