From 08949370e662c2590fe1fdbb114174510dff896f Mon Sep 17 00:00:00 2001 From: andsel Date: Fri, 27 Apr 2018 12:43:11 +0200 Subject: [PATCH] Minor added slf4j-api deps to re-enable logging --- broker/build.gradle | 2 + .../main/java/io/moquette/server/Server.java | 54 +++++++------------ 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/broker/build.gradle b/broker/build.gradle index 2451c447..f51dfe96 100644 --- a/broker/build.gradle +++ b/broker/build.gradle @@ -26,6 +26,8 @@ dependencies { // compile group: 'org.hdrhistogram', name: 'HdrHistogram', version:'2.1.4' compile group: 'com.hazelcast', name: 'hazelcast', version:'3.5.4' + compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.5' + testCompile group: 'org.fusesource.mqtt-client', name: 'mqtt-client', version:'1.12' testCompile group: 'org.eclipse.paho', name: 'org.eclipse.paho.client.mqttv3', version:'1.0.2' testCompile group: 'org.eclipse.jetty.websocket', name: 'websocket-client', version:'9.2.0.M1' diff --git a/broker/src/main/java/io/moquette/server/Server.java b/broker/src/main/java/io/moquette/server/Server.java index 49204048..5ecb4bf8 100644 --- a/broker/src/main/java/io/moquette/server/Server.java +++ b/broker/src/main/java/io/moquette/server/Server.java @@ -39,6 +39,7 @@ import io.moquette.spi.security.ISslContextCreator; import io.netty.handler.codec.mqtt.MqttPublishMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -82,8 +83,7 @@ public class Server { /** * Starts Moquette bringing the configuration from the file located at m_config/moquette.conf * - * @throws IOException - * in case of any IO error. + * @throws IOException in case of any IO error. */ public void startServer() throws IOException { File defaultConfigurationFile = defaultConfigFile(); @@ -101,10 +101,8 @@ public class Server { /** * Starts Moquette bringing the configuration from the given file * - * @param configFile - * text file that contains the configuration. - * @throws IOException - * in case of any IO Error. + * @param configFile text file that contains the configuration. + * @throws IOException in case of any IO Error. */ public void startServer(File configFile) throws IOException { LOG.info("Starting Moquette server. Configuration file path={}", configFile.getAbsolutePath()); @@ -115,17 +113,15 @@ public class Server { /** * Starts the server with the given properties. - * + *

* Its suggested to at least have the following properties: *

* - * @param configProps - * the properties map to use as configuration. - * @throws IOException - * in case of any IO Error. + * @param configProps the properties map to use as configuration. + * @throws IOException in case of any IO Error. */ public void startServer(Properties configProps) throws IOException { LOG.info("Starting Moquette server using properties object"); @@ -136,10 +132,8 @@ public class Server { /** * Starts Moquette bringing the configuration files from the given Config implementation. * - * @param config - * the configuration to use to start the broker. - * @throws IOException - * in case of any IO Error. + * @param config the configuration to use to start the broker. + * @throws IOException in case of any IO Error. */ public void startServer(IConfig config) throws IOException { LOG.info("Starting Moquette server using IConfig instance..."); @@ -150,12 +144,9 @@ public class Server { * Starts Moquette with config provided by an implementation of IConfig class and with the set * of InterceptHandler. * - * @param config - * the configuration to use to start the broker. - * @param handlers - * the handlers to install in the broker. - * @throws IOException - * in case of any IO Error. + * @param config the configuration to use to start the broker. + * @param handlers the handlers to install in the broker. + * @throws IOException in case of any IO Error. */ public void startServer(IConfig config, List handlers) throws IOException { LOG.info("Starting moquette server using IConfig instance and intercept handlers"); @@ -163,7 +154,7 @@ public class Server { } public void startServer(IConfig config, List handlers, ISslContextCreator sslCtxCreator, - IAuthenticator authenticator, IAuthorizator authorizator) throws IOException { + IAuthenticator authenticator, IAuthorizator authorizator) throws IOException { if (handlers == null) { handlers = Collections.emptyList(); } @@ -207,8 +198,8 @@ public class Server { if (hzConfigPath != null) { boolean isHzConfigOnClasspath = this.getClass().getClassLoader().getResource(hzConfigPath) != null; Config hzconfig = isHzConfigOnClasspath - ? new ClasspathXmlConfig(hzConfigPath) - : new FileSystemXmlConfig(hzConfigPath); + ? new ClasspathXmlConfig(hzConfigPath) + : new FileSystemXmlConfig(hzConfigPath); LOG.info("Starting Hazelcast instance. ConfigurationFile={}", hzconfig); hazelcastInstance = Hazelcast.newHazelcastInstance(hzconfig); } else { @@ -233,12 +224,9 @@ public class Server { * Use the broker to publish a message. It's intended for embedding applications. It can be used * only after the server is correctly started with startServer. * - * @param msg - * the message to forward. - * @param clientId - * the id of the sending server. - * @throws IllegalStateException - * if the server is not yet started + * @param msg the message to forward. + * @param clientId the id of the sending server. + * @throws IllegalStateException if the server is not yet started */ public void internalPublish(MqttPublishMessage msg, final String clientId) { final int messageID = msg.variableHeader().messageId(); @@ -287,8 +275,7 @@ public class Server { /** * SPI method used by Broker embedded applications to add intercept handlers. * - * @param interceptHandler - * the handler to add. + * @param interceptHandler the handler to add. */ public void addInterceptHandler(InterceptHandler interceptHandler) { if (!m_initialized) { @@ -303,8 +290,7 @@ public class Server { /** * SPI method used by Broker embedded applications to remove intercept handlers. * - * @param interceptHandler - * the handler to remove. + * @param interceptHandler the handler to remove. */ public void removeInterceptHandler(InterceptHandler interceptHandler) { if (!m_initialized) {