Fix conflict
diff --git a/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/Properties.java b/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/Properties.java
index 2a3140c..9e9cce2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/Properties.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/Properties.java
@@ -14,10 +14,12 @@
package com.googlesource.gerrit.plugins.rabbitmq;
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
+import com.google.gerrit.common.Version;
+import com.google.gerrit.server.config.GerritServerConfig;
+import com.google.gerrit.server.config.SitePaths;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.rabbitmq.client.AMQP;
import org.apache.commons.codec.CharEncoding;
import org.apache.commons.lang.StringUtils;
@@ -28,12 +30,12 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.gerrit.common.Version;
-import com.google.gerrit.server.config.GerritServerConfig;
-import com.google.gerrit.server.config.SitePaths;
-import com.google.inject.Inject;
-import com.rabbitmq.client.AMQP;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+@Singleton
public class Properties {
// TODO: Value will be replaced to "gerrit.event".
@@ -54,6 +56,7 @@
public Properties(final SitePaths site, @GerritServerConfig final Config config) {
this.config = config;
this.pluginConfig = getPluginConfig(new File(site.etc_dir, CONFIG_FILENAME));
+ this.properties = generateBasicProperties();
}
public Config getPluginConfig(File cfgPath) {
@@ -120,26 +123,27 @@
return interval;
}
+ private AMQP.BasicProperties generateBasicProperties() {
+ Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put(Keys.GERRIT_NAME.key, getString(Keys.GERRIT_NAME));
+ headers.put(Keys.GERRIT_HOSTNAME.key, getString(Keys.GERRIT_HOSTNAME));
+ headers.put(Keys.GERRIT_SCHEME.key, getString(Keys.GERRIT_SCHEME));
+ headers.put(Keys.GERRIT_PORT.key, String.valueOf(getInt(Keys.GERRIT_PORT)));
+ headers.put(Keys.GERRIT_FRONT_URL.key, getGerritFrontUrl());
+ headers.put(Keys.GERRIT_VERSION.key, getGerritVersion());
+
+ AMQP.BasicProperties.Builder builder = new AMQP.BasicProperties.Builder();
+ builder.appId(EVENT_APPID);
+ builder.contentEncoding(CharEncoding.UTF_8);
+ builder.contentType(CONTENT_TYPE_JSON);
+ builder.deliveryMode(getInt(Keys.MESSAGE_DELIVERY_MODE));
+ builder.priority(getInt(Keys.MESSAGE_PRIORITY));
+ builder.headers(headers);
+
+ return builder.build();
+ }
+
public AMQP.BasicProperties getBasicProperties() {
- if (properties == null) {
- Map<String, Object> headers = new HashMap<String, Object>();
- headers.put(Keys.GERRIT_NAME.key, getString(Keys.GERRIT_NAME));
- headers.put(Keys.GERRIT_HOSTNAME.key, getString(Keys.GERRIT_HOSTNAME));
- headers.put(Keys.GERRIT_SCHEME.key, getString(Keys.GERRIT_SCHEME));
- headers.put(Keys.GERRIT_PORT.key, String.valueOf(getInt(Keys.GERRIT_PORT)));
- headers.put(Keys.GERRIT_FRONT_URL.key, getGerritFrontUrl());
- headers.put(Keys.GERRIT_VERSION.key, getGerritVersion());
-
- AMQP.BasicProperties.Builder builder = new AMQP.BasicProperties.Builder();
- builder.appId(EVENT_APPID);
- builder.contentEncoding(CharEncoding.UTF_8);
- builder.contentType(CONTENT_TYPE_JSON);
- builder.deliveryMode(getInt(Keys.MESSAGE_DELIVERY_MODE));
- builder.priority(getInt(Keys.MESSAGE_PRIORITY));
- builder.headers(headers);
-
- properties = builder.build();
- }
return properties;
}
}
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index 8f5eb96..067d075 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -18,7 +18,7 @@
name = foobar-gerrit
hostname = www.foobar.com
scheme = ssh
- port = 24918
+ port = 29418
[monitor]
interval = 15000
failureCount = 15