diff --git a/.editorconfig b/.editorconfig
index 962eb505..c612eb61 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -10,3 +10,4 @@ insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
+max_line_length=120
diff --git a/broker/src/main/java/io/moquette/BrokerConstants.java b/broker/src/main/java/io/moquette/BrokerConstants.java
index f693de53..47edb890 100644
--- a/broker/src/main/java/io/moquette/BrokerConstants.java
+++ b/broker/src/main/java/io/moquette/BrokerConstants.java
@@ -18,10 +18,7 @@ package io.moquette;
import java.io.File;
-/**
- * Created by andrea on 08/12/15.
- */
-public class BrokerConstants {
+public final class BrokerConstants {
public static final String INTERCEPT_HANDLER_PROPERTY_NAME = "intercept.handler";
public static final String BROKER_INTERCEPTOR_THREAD_POOL_SIZE = "intercept.thread_pool.size";
@@ -60,4 +57,7 @@ public class BrokerConstants {
public static final String NETTY_SO_KEEPALIVE_PROPERTY_NAME = "netty.so_keepalive";
public static final String NETTY_CHANNEL_TIMEOUT_SECONDS_PROPERTY_NAME = "netty.channel_timeout.seconds";
public static final String STORAGE_CLASS_NAME = "storage_class";
+
+ private BrokerConstants() {
+ }
}
diff --git a/broker/src/main/java/io/moquette/connections/IConnectionsManager.java b/broker/src/main/java/io/moquette/connections/IConnectionsManager.java
index 14818d54..a19587e8 100644
--- a/broker/src/main/java/io/moquette/connections/IConnectionsManager.java
+++ b/broker/src/main/java/io/moquette/connections/IConnectionsManager.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.connections;
@@ -5,9 +20,6 @@ import java.util.Collection;
/**
* This interface will be used by an external codebase to retrieve and close physical connections.
- *
- * @author lbarrios
- *
*/
public interface IConnectionsManager {
@@ -16,7 +28,7 @@ public interface IConnectionsManager {
*
* @return
*/
- public int getActiveConnectionsNo();
+ int getActiveConnectionsNo();
/**
* Determines wether a MQTT client is connected to the broker.
@@ -24,14 +36,14 @@ public interface IConnectionsManager {
* @param clientID
* @return
*/
- public boolean isConnected(String clientID);
+ boolean isConnected(String clientID);
/**
* Returns the identifiers of the MQTT clients that are connected to the broker.
*
* @return
*/
- public Collection getConnectedClientIds();
+ Collection getConnectedClientIds();
/**
* Closes a physical connection.
@@ -41,7 +53,7 @@ public interface IConnectionsManager {
* If false, the connection will be flushed before it is closed.
* @return
*/
- public boolean closeConnection(String clientID, boolean closeImmediately);
+ boolean closeConnection(String clientID, boolean closeImmediately);
/**
* Returns the state of the session of a given client.
@@ -49,12 +61,12 @@ public interface IConnectionsManager {
* @param clientID
* @return
*/
- public MqttSession getSessionStatus(String clientID);
+ MqttSession getSessionStatus(String clientID);
/**
* Returns the state of all the sessions
*
* @return
*/
- public Collection getSessions();
+ Collection getSessions();
}
diff --git a/broker/src/main/java/io/moquette/connections/MqttConnectionMetrics.java b/broker/src/main/java/io/moquette/connections/MqttConnectionMetrics.java
index f3daf7c0..317495d6 100644
--- a/broker/src/main/java/io/moquette/connections/MqttConnectionMetrics.java
+++ b/broker/src/main/java/io/moquette/connections/MqttConnectionMetrics.java
@@ -1,11 +1,23 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.connections;
/**
* A class that represents the metrics of a given MQTT connection.
- *
- * @author lbarrios
- *
*/
public class MqttConnectionMetrics {
diff --git a/broker/src/main/java/io/moquette/connections/MqttSession.java b/broker/src/main/java/io/moquette/connections/MqttSession.java
index 5eee1c67..654d2ef3 100644
--- a/broker/src/main/java/io/moquette/connections/MqttSession.java
+++ b/broker/src/main/java/io/moquette/connections/MqttSession.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.connections;
@@ -6,9 +21,6 @@ import java.util.Collection;
/**
* A class that represents the overall connection status of a MQTT session. Its instances will be
* used by an external codebase when the broker is configured in embedded mode.
- *
- * @author lbarrios
- *
*/
public class MqttSession {
diff --git a/broker/src/main/java/io/moquette/connections/MqttSubscription.java b/broker/src/main/java/io/moquette/connections/MqttSubscription.java
index ac2790e2..12f63d30 100644
--- a/broker/src/main/java/io/moquette/connections/MqttSubscription.java
+++ b/broker/src/main/java/io/moquette/connections/MqttSubscription.java
@@ -1,11 +1,23 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.connections;
/**
* A class that represents a MQTT subscription.
- *
- * @author lbarrios
- *
*/
public class MqttSubscription {
diff --git a/broker/src/main/java/io/moquette/interception/AbstractInterceptHandler.java b/broker/src/main/java/io/moquette/interception/AbstractInterceptHandler.java
index 2d80a4fa..48687f67 100644
--- a/broker/src/main/java/io/moquette/interception/AbstractInterceptHandler.java
+++ b/broker/src/main/java/io/moquette/interception/AbstractInterceptHandler.java
@@ -26,8 +26,6 @@ import io.moquette.interception.messages.InterceptUnsubscribeMessage;
/**
* Basic abstract class usefull to avoid empty methods creation in subclasses.
- *
- * Created by andrea on 08/12/15.
*/
public abstract class AbstractInterceptHandler implements InterceptHandler {
diff --git a/broker/src/main/java/io/moquette/interception/HazelcastInterceptHandler.java b/broker/src/main/java/io/moquette/interception/HazelcastInterceptHandler.java
index 5f5bff9f..b5f9155e 100644
--- a/broker/src/main/java/io/moquette/interception/HazelcastInterceptHandler.java
+++ b/broker/src/main/java/io/moquette/interception/HazelcastInterceptHandler.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.interception;
@@ -10,9 +25,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static io.moquette.spi.impl.Utils.readBytesAndRewind;
-/**
- * Created by mackristof on 28/05/2016.
- */
public class HazelcastInterceptHandler extends AbstractInterceptHandler {
private static final Logger LOG = LoggerFactory.getLogger(HazelcastInterceptHandler.class);
diff --git a/broker/src/main/java/io/moquette/interception/HazelcastMsg.java b/broker/src/main/java/io/moquette/interception/HazelcastMsg.java
index 044d9b81..00ec3a66 100644
--- a/broker/src/main/java/io/moquette/interception/HazelcastMsg.java
+++ b/broker/src/main/java/io/moquette/interception/HazelcastMsg.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.interception;
@@ -5,9 +20,6 @@ import io.moquette.interception.messages.InterceptPublishMessage;
import java.io.Serializable;
import static io.moquette.spi.impl.Utils.readBytesAndRewind;
-/**
- * Created by mackristof on 28/05/2016.
- */
public class HazelcastMsg implements Serializable {
private static final long serialVersionUID = -1431584750134928273L;
diff --git a/broker/src/main/java/io/moquette/interception/InterceptHandler.java b/broker/src/main/java/io/moquette/interception/InterceptHandler.java
index db43d7ea..8f3f6626 100644
--- a/broker/src/main/java/io/moquette/interception/InterceptHandler.java
+++ b/broker/src/main/java/io/moquette/interception/InterceptHandler.java
@@ -28,8 +28,6 @@ import io.netty.handler.codec.mqtt.MqttMessage;
* Almost every method receives a subclass of {@link MqttMessage}, except onDisconnect
* that receives the client id string and onSubscribe and onUnsubscribe
* that receive a {@link Subscription} object.
- *
- * @author Wagner Macedo
*/
public interface InterceptHandler {
diff --git a/broker/src/main/java/io/moquette/interception/Interceptor.java b/broker/src/main/java/io/moquette/interception/Interceptor.java
index df1f8873..99989af1 100644
--- a/broker/src/main/java/io/moquette/interception/Interceptor.java
+++ b/broker/src/main/java/io/moquette/interception/Interceptor.java
@@ -30,7 +30,6 @@ import io.netty.handler.codec.mqtt.MqttPublishMessage;
* normally a field. So, the implementations should act as a proxy to a custom intercept handler.
*
* @see InterceptHandler
- * @author Wagner Macedo
*/
public interface Interceptor {
@@ -40,11 +39,11 @@ public interface Interceptor {
void notifyClientConnectionLost(String clientID, String username);
- void notifyTopicPublished(MqttPublishMessage msg, String clientID, final String username);
+ void notifyTopicPublished(MqttPublishMessage msg, String clientID, String username);
- void notifyTopicSubscribed(Subscription sub, final String username);
+ void notifyTopicSubscribed(Subscription sub, String username);
- void notifyTopicUnsubscribed(String topic, String clientID, final String username);
+ void notifyTopicUnsubscribed(String topic, String clientID, String username);
void notifyMessageAcknowledged(InterceptAcknowledgedMessage msg);
diff --git a/broker/src/main/java/io/moquette/interception/messages/InterceptAbstractMessage.java b/broker/src/main/java/io/moquette/interception/messages/InterceptAbstractMessage.java
index 4878e655..5f7f7da0 100644
--- a/broker/src/main/java/io/moquette/interception/messages/InterceptAbstractMessage.java
+++ b/broker/src/main/java/io/moquette/interception/messages/InterceptAbstractMessage.java
@@ -19,9 +19,6 @@ package io.moquette.interception.messages;
import io.netty.handler.codec.mqtt.MqttMessage;
import io.netty.handler.codec.mqtt.MqttQoS;
-/**
- * @author Wagner Macedo
- */
public abstract class InterceptAbstractMessage implements InterceptMessage {
private final MqttMessage msg;
diff --git a/broker/src/main/java/io/moquette/interception/messages/InterceptAcknowledgedMessage.java b/broker/src/main/java/io/moquette/interception/messages/InterceptAcknowledgedMessage.java
index 9da0f251..0485ffc7 100644
--- a/broker/src/main/java/io/moquette/interception/messages/InterceptAcknowledgedMessage.java
+++ b/broker/src/main/java/io/moquette/interception/messages/InterceptAcknowledgedMessage.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.interception.messages;
@@ -5,7 +20,7 @@ import static io.moquette.spi.IMessagesStore.StoredMessage;
public class InterceptAcknowledgedMessage implements InterceptMessage {
- final private StoredMessage msg;
+ private final StoredMessage msg;
private final String username;
private final String topic;
private final int packetID;
diff --git a/broker/src/main/java/io/moquette/interception/messages/InterceptConnectMessage.java b/broker/src/main/java/io/moquette/interception/messages/InterceptConnectMessage.java
index 776572cf..07041b1c 100644
--- a/broker/src/main/java/io/moquette/interception/messages/InterceptConnectMessage.java
+++ b/broker/src/main/java/io/moquette/interception/messages/InterceptConnectMessage.java
@@ -1,11 +1,23 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.interception.messages;
import io.netty.handler.codec.mqtt.MqttConnectMessage;
-/**
- * @author Wagner Macedo
- */
public class InterceptConnectMessage extends InterceptAbstractMessage {
private final MqttConnectMessage msg;
diff --git a/broker/src/main/java/io/moquette/interception/messages/InterceptConnectionLostMessage.java b/broker/src/main/java/io/moquette/interception/messages/InterceptConnectionLostMessage.java
index 133fa1a8..3b32e2a9 100644
--- a/broker/src/main/java/io/moquette/interception/messages/InterceptConnectionLostMessage.java
+++ b/broker/src/main/java/io/moquette/interception/messages/InterceptConnectionLostMessage.java
@@ -1,9 +1,21 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.interception.messages;
-/**
- * @author Wagner Macedo
- */
public class InterceptConnectionLostMessage implements InterceptMessage {
private final String clientID;
diff --git a/broker/src/main/java/io/moquette/interception/messages/InterceptDisconnectMessage.java b/broker/src/main/java/io/moquette/interception/messages/InterceptDisconnectMessage.java
index d7067c90..50f70564 100644
--- a/broker/src/main/java/io/moquette/interception/messages/InterceptDisconnectMessage.java
+++ b/broker/src/main/java/io/moquette/interception/messages/InterceptDisconnectMessage.java
@@ -1,9 +1,21 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.interception.messages;
-/**
- * @author Wagner Macedo
- */
public class InterceptDisconnectMessage implements InterceptMessage {
private final String clientID;
diff --git a/broker/src/main/java/io/moquette/interception/messages/InterceptMessage.java b/broker/src/main/java/io/moquette/interception/messages/InterceptMessage.java
index b4317409..dd7a2084 100644
--- a/broker/src/main/java/io/moquette/interception/messages/InterceptMessage.java
+++ b/broker/src/main/java/io/moquette/interception/messages/InterceptMessage.java
@@ -1,11 +1,23 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.interception.messages;
/**
* An interface that sets the root of the interceptor messages type hierarchy.
- *
- * @author lbarrios
- *
*/
public interface InterceptMessage {
diff --git a/broker/src/main/java/io/moquette/interception/messages/InterceptPublishMessage.java b/broker/src/main/java/io/moquette/interception/messages/InterceptPublishMessage.java
index 1235ab97..20c40e5e 100644
--- a/broker/src/main/java/io/moquette/interception/messages/InterceptPublishMessage.java
+++ b/broker/src/main/java/io/moquette/interception/messages/InterceptPublishMessage.java
@@ -1,12 +1,24 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.interception.messages;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.mqtt.MqttPublishMessage;
-/**
- * @author Wagner Macedo
- */
public class InterceptPublishMessage extends InterceptAbstractMessage {
private final MqttPublishMessage msg;
diff --git a/broker/src/main/java/io/moquette/interception/messages/InterceptSubscribeMessage.java b/broker/src/main/java/io/moquette/interception/messages/InterceptSubscribeMessage.java
index 71d9bd6f..042b4cd8 100644
--- a/broker/src/main/java/io/moquette/interception/messages/InterceptSubscribeMessage.java
+++ b/broker/src/main/java/io/moquette/interception/messages/InterceptSubscribeMessage.java
@@ -1,12 +1,24 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.interception.messages;
import io.moquette.spi.impl.subscriptions.Subscription;
import io.netty.handler.codec.mqtt.MqttQoS;
-/**
- * @author Wagner Macedo
- */
public class InterceptSubscribeMessage implements InterceptMessage {
private final Subscription subscription;
diff --git a/broker/src/main/java/io/moquette/interception/messages/InterceptUnsubscribeMessage.java b/broker/src/main/java/io/moquette/interception/messages/InterceptUnsubscribeMessage.java
index 7968fdb4..ec390534 100644
--- a/broker/src/main/java/io/moquette/interception/messages/InterceptUnsubscribeMessage.java
+++ b/broker/src/main/java/io/moquette/interception/messages/InterceptUnsubscribeMessage.java
@@ -1,9 +1,21 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.interception.messages;
-/**
- * @author Wagner Macedo
- */
public class InterceptUnsubscribeMessage implements InterceptMessage {
private final String topicFilter;
diff --git a/broker/src/main/java/io/moquette/logging/LoggingUtils.java b/broker/src/main/java/io/moquette/logging/LoggingUtils.java
index 1de7d55e..eb2aed87 100644
--- a/broker/src/main/java/io/moquette/logging/LoggingUtils.java
+++ b/broker/src/main/java/io/moquette/logging/LoggingUtils.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.logging;
@@ -5,7 +20,7 @@ import java.util.ArrayList;
import java.util.Collection;
import io.moquette.interception.InterceptHandler;
-public class LoggingUtils {
+public final class LoggingUtils {
public static Collection getInterceptorIds(Collection handlers) {
Collection result = new ArrayList<>(handlers.size());
@@ -14,4 +29,7 @@ public class LoggingUtils {
}
return result;
}
+
+ private LoggingUtils() {
+ }
}
diff --git a/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java b/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java
index ad0f7e25..cfde2918 100644
--- a/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java
+++ b/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java
@@ -19,16 +19,11 @@ package io.moquette.persistence;
import io.moquette.spi.IMessagesStore;
import io.moquette.spi.IMatchingCondition;
import io.moquette.spi.MessageGUID;
-import io.moquette.spi.impl.Utils;
import io.moquette.spi.impl.subscriptions.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
-import static io.moquette.spi.impl.Utils.defaultGet;
-/**
- * @author andrea
- */
public class MemoryMessagesStore implements IMessagesStore {
private static final Logger LOG = LoggerFactory.getLogger(MemoryMessagesStore.class);
diff --git a/broker/src/main/java/io/moquette/persistence/MemorySessionStore.java b/broker/src/main/java/io/moquette/persistence/MemorySessionStore.java
index f59a8e9f..bba39dc2 100644
--- a/broker/src/main/java/io/moquette/persistence/MemorySessionStore.java
+++ b/broker/src/main/java/io/moquette/persistence/MemorySessionStore.java
@@ -33,10 +33,6 @@ import java.util.concurrent.BlockingQueue;
import static io.moquette.spi.impl.Utils.defaultGet;
-/**
- *
- * @author andrea
- */
public class MemorySessionStore implements ISessionsStore {
private static final Logger LOG = LoggerFactory.getLogger(MemorySessionStore.class);
@@ -74,7 +70,6 @@ public class MemorySessionStore implements ISessionsStore {
@Override
public void initStore() {
-
}
@Override
diff --git a/broker/src/main/java/io/moquette/server/ConnectionDescriptor.java b/broker/src/main/java/io/moquette/server/ConnectionDescriptor.java
index 47e9b2a3..e18a6d8b 100644
--- a/broker/src/main/java/io/moquette/server/ConnectionDescriptor.java
+++ b/broker/src/main/java/io/moquette/server/ConnectionDescriptor.java
@@ -32,9 +32,6 @@ import io.netty.channel.Channel;
/**
* Value object to maintain the information of single connection, like ClientID, Channel, and clean
* session flag.
- *
- *
- * @author andrea
*/
public class ConnectionDescriptor {
diff --git a/broker/src/main/java/io/moquette/server/ConnectionDescriptorStore.java b/broker/src/main/java/io/moquette/server/ConnectionDescriptorStore.java
index 0a75cca4..7f0f4dea 100644
--- a/broker/src/main/java/io/moquette/server/ConnectionDescriptorStore.java
+++ b/broker/src/main/java/io/moquette/server/ConnectionDescriptorStore.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.server;
diff --git a/broker/src/main/java/io/moquette/server/Constants.java b/broker/src/main/java/io/moquette/server/Constants.java
index 44a64d9f..e2b2cd15 100644
--- a/broker/src/main/java/io/moquette/server/Constants.java
+++ b/broker/src/main/java/io/moquette/server/Constants.java
@@ -19,10 +19,13 @@ package io.moquette.server;
/**
* Server constants keeper
*/
-public class Constants {
+public final class Constants {
public static final String ATTR_CLIENTID = "ClientID";
public static final String CLEAN_SESSION = "cleanSession";
public static final String KEEP_ALIVE = "keepAlive";
public static final int MAX_MESSAGE_QUEUE = 1024; // number of messages
+
+ private Constants() {
+ }
}
diff --git a/broker/src/main/java/io/moquette/server/DefaultMoquetteSslContextCreator.java b/broker/src/main/java/io/moquette/server/DefaultMoquetteSslContextCreator.java
index d8c2d27c..5ac5446e 100644
--- a/broker/src/main/java/io/moquette/server/DefaultMoquetteSslContextCreator.java
+++ b/broker/src/main/java/io/moquette/server/DefaultMoquetteSslContextCreator.java
@@ -33,8 +33,6 @@ import java.security.cert.CertificateException;
/**
* Moquette server implementation to load SSL certificate from local filesystem path configured in
* config file.
- *
- * Created by andrea on 13/12/15.
*/
class DefaultMoquetteSslContextCreator implements ISslContextCreator {
@@ -42,7 +40,7 @@ class DefaultMoquetteSslContextCreator implements ISslContextCreator {
private IConfig props;
- public DefaultMoquetteSslContextCreator(IConfig props) {
+ DefaultMoquetteSslContextCreator(IConfig props) {
this.props = props;
}
diff --git a/broker/src/main/java/io/moquette/server/HazelcastListener.java b/broker/src/main/java/io/moquette/server/HazelcastListener.java
index 03dff1b9..1399e147 100644
--- a/broker/src/main/java/io/moquette/server/HazelcastListener.java
+++ b/broker/src/main/java/io/moquette/server/HazelcastListener.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.server;
@@ -10,9 +25,6 @@ import io.netty.handler.codec.mqtt.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/**
- * Created by mackristof on 28/05/2016.
- */
public class HazelcastListener implements MessageListener {
private static final Logger LOG = LoggerFactory.getLogger(HazelcastListener.class);
diff --git a/broker/src/main/java/io/moquette/server/Server.java b/broker/src/main/java/io/moquette/server/Server.java
index 5dce61dd..b4a690c8 100644
--- a/broker/src/main/java/io/moquette/server/Server.java
+++ b/broker/src/main/java/io/moquette/server/Server.java
@@ -52,8 +52,6 @@ import static io.moquette.logging.LoggingUtils.getInterceptorIds;
/**
* Launch a configured version of the server.
- *
- * @author andrea
*/
public class Server {
@@ -336,7 +334,7 @@ public class Server {
public ProtocolProcessor getProcessor() {
return m_processor;
}
-
+
public ScheduledExecutorService getScheduler() {
return scheduler;
}
diff --git a/broker/src/main/java/io/moquette/server/ServerAcceptor.java b/broker/src/main/java/io/moquette/server/ServerAcceptor.java
index ec3a63a5..615fb216 100644
--- a/broker/src/main/java/io/moquette/server/ServerAcceptor.java
+++ b/broker/src/main/java/io/moquette/server/ServerAcceptor.java
@@ -21,10 +21,6 @@ import io.moquette.server.config.IConfig;
import io.moquette.spi.impl.ProtocolProcessor;
import io.moquette.spi.security.ISslContextCreator;
-/**
- *
- * @author andrea
- */
public interface ServerAcceptor {
void initialize(ProtocolProcessor processor, IConfig props, ISslContextCreator sslCtxCreator) throws IOException;
diff --git a/broker/src/main/java/io/moquette/server/config/ClasspathResourceLoader.java b/broker/src/main/java/io/moquette/server/config/ClasspathResourceLoader.java
index 29e37bf2..b8582c4f 100644
--- a/broker/src/main/java/io/moquette/server/config/ClasspathResourceLoader.java
+++ b/broker/src/main/java/io/moquette/server/config/ClasspathResourceLoader.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.server.config;
diff --git a/broker/src/main/java/io/moquette/server/config/ConfigurationParser.java b/broker/src/main/java/io/moquette/server/config/ConfigurationParser.java
index d7429e18..a91802c3 100644
--- a/broker/src/main/java/io/moquette/server/config/ConfigurationParser.java
+++ b/broker/src/main/java/io/moquette/server/config/ConfigurationParser.java
@@ -32,8 +32,6 @@ import java.util.Properties;
*
* A line that at the very first has # is a comment Each line has key value format, where the
* separator used it the space.
- *
- * @author andrea
*/
class ConfigurationParser {
diff --git a/broker/src/main/java/io/moquette/server/config/FileResourceLoader.java b/broker/src/main/java/io/moquette/server/config/FileResourceLoader.java
index 563c87e9..4c27dada 100644
--- a/broker/src/main/java/io/moquette/server/config/FileResourceLoader.java
+++ b/broker/src/main/java/io/moquette/server/config/FileResourceLoader.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.server.config;
diff --git a/broker/src/main/java/io/moquette/server/config/IConfig.java b/broker/src/main/java/io/moquette/server/config/IConfig.java
index 50096a94..1d2e89d5 100644
--- a/broker/src/main/java/io/moquette/server/config/IConfig.java
+++ b/broker/src/main/java/io/moquette/server/config/IConfig.java
@@ -20,8 +20,6 @@ import io.moquette.BrokerConstants;
/**
* Base interface for all configuration implementations (filesystem, memory or classpath)
- *
- * @author andrea
*/
public abstract class IConfig {
diff --git a/broker/src/main/java/io/moquette/server/config/IResourceLoader.java b/broker/src/main/java/io/moquette/server/config/IResourceLoader.java
index e18ec28c..31e86f1f 100644
--- a/broker/src/main/java/io/moquette/server/config/IResourceLoader.java
+++ b/broker/src/main/java/io/moquette/server/config/IResourceLoader.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.server.config;
diff --git a/broker/src/main/java/io/moquette/server/config/MemoryConfig.java b/broker/src/main/java/io/moquette/server/config/MemoryConfig.java
index 41affe75..8917761c 100644
--- a/broker/src/main/java/io/moquette/server/config/MemoryConfig.java
+++ b/broker/src/main/java/io/moquette/server/config/MemoryConfig.java
@@ -21,8 +21,6 @@ import java.util.Properties;
/**
* Configuration backed by memory.
- *
- * @author andrea
*/
public class MemoryConfig extends IConfig {
diff --git a/broker/src/main/java/io/moquette/server/netty/MessageBuilder.java b/broker/src/main/java/io/moquette/server/netty/MessageBuilder.java
index dc1dc758..a1746556 100644
--- a/broker/src/main/java/io/moquette/server/netty/MessageBuilder.java
+++ b/broker/src/main/java/io/moquette/server/netty/MessageBuilder.java
@@ -21,15 +21,15 @@ import io.netty.handler.codec.mqtt.*;
import java.util.ArrayList;
import java.util.List;
-public class MessageBuilder {
+public final class MessageBuilder {
public static class PublishBuilder {
- private String topic = null;
- private boolean retained = false;
+ private String topic;
+ private boolean retained;
private MqttQoS qos;
private byte[] payload;
- private int messageId = 0;
+ private int messageId;
public PublishBuilder topicName(String topic) {
this.topic = topic;
@@ -67,16 +67,16 @@ public class MessageBuilder {
private MqttVersion version = MqttVersion.MQTT_3_1_1;
private String clientId;
- private boolean cleanSession = false;
- private boolean hasUser = false;
- private boolean hasPassword = false;
+ private boolean cleanSession;
+ private boolean hasUser;
+ private boolean hasPassword;
private int keepAliveSecs;
- private boolean willFlag = false;
+ private boolean willFlag;
private MqttQoS willQos = MqttQoS.AT_MOST_ONCE;
- private String willTopic = null;
- private String willMessage = null;
- private String username = null;
- private String password = null;
+ private String willTopic;
+ private String willMessage;
+ private String username;
+ private String password;
public ConnectBuilder protocolVersion(MqttVersion version) {
this.version = version;
@@ -196,7 +196,7 @@ public class MessageBuilder {
public static class UnsubscribeBuilder {
private List topicFilters = new ArrayList<>();
- private int messageId = 0;
+ private int messageId;
public UnsubscribeBuilder addTopicFilter(String topic) {
topicFilters.add(topic);
@@ -236,4 +236,7 @@ public class MessageBuilder {
public static UnsubscribeBuilder unsubscribe() {
return new UnsubscribeBuilder();
}
+
+ private MessageBuilder() {
+ }
}
diff --git a/broker/src/main/java/io/moquette/server/netty/NettyAcceptor.java b/broker/src/main/java/io/moquette/server/netty/NettyAcceptor.java
index 06d29d41..c438c1b7 100644
--- a/broker/src/main/java/io/moquette/server/netty/NettyAcceptor.java
+++ b/broker/src/main/java/io/moquette/server/netty/NettyAcceptor.java
@@ -50,10 +50,6 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
import static io.moquette.BrokerConstants.*;
-/**
- *
- * @author andrea
- */
public class NettyAcceptor implements ServerAcceptor {
private static final String MQTT_SUBPROTOCOL_CSV_LIST = "mqtt, mqttv3.1, mqttv3.1.1";
diff --git a/broker/src/main/java/io/moquette/server/netty/NettyMQTTHandler.java b/broker/src/main/java/io/moquette/server/netty/NettyMQTTHandler.java
index c81bfcc9..c251ecff 100644
--- a/broker/src/main/java/io/moquette/server/netty/NettyMQTTHandler.java
+++ b/broker/src/main/java/io/moquette/server/netty/NettyMQTTHandler.java
@@ -25,10 +25,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static io.netty.handler.codec.mqtt.MqttQoS.AT_MOST_ONCE;
-/**
- *
- * @author andrea
- */
@Sharable
public class NettyMQTTHandler extends ChannelInboundHandlerAdapter {
@@ -83,6 +79,9 @@ public class NettyMQTTHandler extends ChannelInboundHandlerAdapter {
MqttMessage pingResp = new MqttMessage(pingHeader);
ctx.writeAndFlush(pingResp);
break;
+ default:
+ LOG.error("Unkonwn MessageType:{}", messageType);
+ break;
}
} catch (Throwable ex) {
LOG.error("Exception was caught while processing MQTT message, " + ex.getCause(), ex);
diff --git a/broker/src/main/java/io/moquette/server/netty/NettyUtils.java b/broker/src/main/java/io/moquette/server/netty/NettyUtils.java
index 471ffd19..5a619c3d 100644
--- a/broker/src/main/java/io/moquette/server/netty/NettyUtils.java
+++ b/broker/src/main/java/io/moquette/server/netty/NettyUtils.java
@@ -24,10 +24,8 @@ import io.netty.util.AttributeKey;
/**
* Some Netty's channels utilities.
- *
- * @author andrea
*/
-public class NettyUtils {
+public final class NettyUtils {
public static final String ATTR_USERNAME = "username";
public static final String ATTR_SESSION_STOLEN = "sessionStolen";
@@ -70,4 +68,7 @@ public class NettyUtils {
public static String userName(Channel channel) {
return (String) channel.attr(NettyUtils.ATTR_KEY_USERNAME).get();
}
+
+ private NettyUtils() {
+ }
}
diff --git a/broker/src/main/java/io/moquette/server/netty/metrics/BytesMetrics.java b/broker/src/main/java/io/moquette/server/netty/metrics/BytesMetrics.java
index 43f3ac16..4c703de1 100644
--- a/broker/src/main/java/io/moquette/server/netty/metrics/BytesMetrics.java
+++ b/broker/src/main/java/io/moquette/server/netty/metrics/BytesMetrics.java
@@ -18,8 +18,8 @@ package io.moquette.server.netty.metrics;
public class BytesMetrics {
- private long m_readBytes = 0;
- private long m_wroteBytes = 0;
+ private long m_readBytes;
+ private long m_wroteBytes;
void incrementRead(long numBytes) {
m_readBytes += numBytes;
diff --git a/broker/src/main/java/io/moquette/server/netty/metrics/MQTTMessageLogger.java b/broker/src/main/java/io/moquette/server/netty/metrics/MQTTMessageLogger.java
index bf9707b1..9fc7a9e0 100644
--- a/broker/src/main/java/io/moquette/server/netty/metrics/MQTTMessageLogger.java
+++ b/broker/src/main/java/io/moquette/server/netty/metrics/MQTTMessageLogger.java
@@ -26,10 +26,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static io.moquette.spi.impl.Utils.messageId;
-/**
- *
- * @author andrea
- */
@Sharable
public class MQTTMessageLogger extends ChannelDuplexHandler {
@@ -80,6 +76,9 @@ public class MQTTMessageLogger extends ChannelDuplexHandler {
case PUBACK:
LOG.info("{} PUBACK <{}> packetID <{}>", direction, clientID, messageId(msg));
break;
+ default:
+ LOG.error("Unkonwn MessageType:{}", messageType);
+ break;
}
}
diff --git a/broker/src/main/java/io/moquette/server/netty/metrics/MessageMetrics.java b/broker/src/main/java/io/moquette/server/netty/metrics/MessageMetrics.java
index 44f8b5fd..076045af 100644
--- a/broker/src/main/java/io/moquette/server/netty/metrics/MessageMetrics.java
+++ b/broker/src/main/java/io/moquette/server/netty/metrics/MessageMetrics.java
@@ -18,8 +18,8 @@ package io.moquette.server.netty.metrics;
public class MessageMetrics {
- private long m_messagesRead = 0;
- private long m_messageWrote = 0;
+ private long m_messagesRead;
+ private long m_messageWrote;
void incrementRead(long numMessages) {
m_messagesRead += numMessages;
diff --git a/broker/src/main/java/io/moquette/spi/ClientSession.java b/broker/src/main/java/io/moquette/spi/ClientSession.java
index f817e7af..483123fe 100644
--- a/broker/src/main/java/io/moquette/spi/ClientSession.java
+++ b/broker/src/main/java/io/moquette/spi/ClientSession.java
@@ -38,8 +38,6 @@ import java.util.concurrent.BlockingQueue;
* completely acknowledged.
* Optionally, QoS 0 messages pending transmission to the Client.
*
- *
- * @author andrea
*/
public class ClientSession {
@@ -76,7 +74,7 @@ public class ClientSession {
}
}
- private final static Logger LOG = LoggerFactory.getLogger(ClientSession.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ClientSession.class);
public final String clientID;
diff --git a/broker/src/main/java/io/moquette/spi/IMatchingCondition.java b/broker/src/main/java/io/moquette/spi/IMatchingCondition.java
index a8edf2a6..2d376297 100644
--- a/broker/src/main/java/io/moquette/spi/IMatchingCondition.java
+++ b/broker/src/main/java/io/moquette/spi/IMatchingCondition.java
@@ -18,8 +18,6 @@ package io.moquette.spi;
import io.moquette.spi.impl.subscriptions.Topic;
-/**
- */
public interface IMatchingCondition {
boolean match(Topic key);
diff --git a/broker/src/main/java/io/moquette/spi/IMessaging.java b/broker/src/main/java/io/moquette/spi/IMessaging.java
index 713a0381..a0fb86d2 100644
--- a/broker/src/main/java/io/moquette/spi/IMessaging.java
+++ b/broker/src/main/java/io/moquette/spi/IMessaging.java
@@ -20,8 +20,6 @@ package io.moquette.spi;
* Callback interface used to be notified of some events from the input event queue.
*
* It's the abstraction of the messaging stuff attached in after the front protocol parsing stuff.
- *
- * @author andrea
*/
public interface IMessaging {
}
diff --git a/broker/src/main/java/io/moquette/spi/ISessionsStore.java b/broker/src/main/java/io/moquette/spi/ISessionsStore.java
index 008daf28..61c98d61 100644
--- a/broker/src/main/java/io/moquette/spi/ISessionsStore.java
+++ b/broker/src/main/java/io/moquette/spi/ISessionsStore.java
@@ -26,8 +26,6 @@ import java.util.concurrent.BlockingQueue;
/**
* Store used to handle the persistence of the subscriptions tree.
- *
- * @author andrea
*/
public interface ISessionsStore {
@@ -66,7 +64,6 @@ public interface ISessionsStore {
public String toString() {
return "ClientTopicCouple{" + "topicFilter='" + topicFilter + '\'' + ", clientID='" + clientID + '\'' + '}';
}
-
}
void initStore();
diff --git a/broker/src/main/java/io/moquette/spi/IStore.java b/broker/src/main/java/io/moquette/spi/IStore.java
index 21a69376..9623d9f0 100644
--- a/broker/src/main/java/io/moquette/spi/IStore.java
+++ b/broker/src/main/java/io/moquette/spi/IStore.java
@@ -1,5 +1,20 @@
-package io.moquette.spi;
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
+package io.moquette.spi;
public interface IStore {
@@ -8,5 +23,4 @@ public interface IStore {
ISessionsStore sessionsStore();
void close();
-
}
diff --git a/broker/src/main/java/io/moquette/spi/impl/BrokerInterceptor.java b/broker/src/main/java/io/moquette/spi/impl/BrokerInterceptor.java
index e2a3d71e..2acd3ede 100644
--- a/broker/src/main/java/io/moquette/spi/impl/BrokerInterceptor.java
+++ b/broker/src/main/java/io/moquette/spi/impl/BrokerInterceptor.java
@@ -37,8 +37,6 @@ import static io.moquette.logging.LoggingUtils.getInterceptorIds;
/**
* An interceptor that execute the interception tasks asynchronously.
- *
- * @author Wagner Macedo
*/
final class BrokerInterceptor implements Interceptor {
@@ -63,14 +61,14 @@ final class BrokerInterceptor implements Interceptor {
*
* @param handlers
*/
- public BrokerInterceptor(List handlers) {
+ BrokerInterceptor(List handlers) {
this(1, handlers);
}
/**
* Configures a broker interceptor using the pool size specified in the IConfig argument.
*/
- public BrokerInterceptor(IConfig props, List handlers) {
+ BrokerInterceptor(IConfig props, List handlers) {
this(Integer.parseInt(props.getProperty(BrokerConstants.BROKER_INTERCEPTOR_THREAD_POOL_SIZE, "1")), handlers);
}
@@ -201,7 +199,7 @@ final class BrokerInterceptor implements Interceptor {
@Override
public void addInterceptHandler(InterceptHandler interceptHandler) {
Class>[] interceptedMessageTypes = getInterceptedMessageTypes(interceptHandler);
- LOG.info( "Adding MQTT message interceptor. InterceptorId={}, handledMessageTypes={}",
+ LOG.info("Adding MQTT message interceptor. InterceptorId={}, handledMessageTypes={}",
interceptHandler.getID(), interceptedMessageTypes);
for (Class> interceptMessageType : interceptedMessageTypes) {
this.handlers.get(interceptMessageType).add(interceptHandler);
diff --git a/broker/src/main/java/io/moquette/spi/impl/DebugUtils.java b/broker/src/main/java/io/moquette/spi/impl/DebugUtils.java
index 41a1009a..25d07214 100644
--- a/broker/src/main/java/io/moquette/spi/impl/DebugUtils.java
+++ b/broker/src/main/java/io/moquette/spi/impl/DebugUtils.java
@@ -17,15 +17,13 @@
package io.moquette.spi.impl;
import io.netty.buffer.ByteBuf;
-import java.nio.ByteBuffer;
-/**
- *
- * @author andrea
- */
-class DebugUtils {
+final class DebugUtils {
static String payload2Str(ByteBuf content) {
- return new String(content.copy ().array());
+ return new String(content.copy().array());
+ }
+
+ private DebugUtils() {
}
}
diff --git a/broker/src/main/java/io/moquette/spi/impl/InternalRepublisher.java b/broker/src/main/java/io/moquette/spi/impl/InternalRepublisher.java
index 1f48cefe..77e3552d 100644
--- a/broker/src/main/java/io/moquette/spi/impl/InternalRepublisher.java
+++ b/broker/src/main/java/io/moquette/spi/impl/InternalRepublisher.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl;
diff --git a/broker/src/main/java/io/moquette/spi/impl/MessagesPublisher.java b/broker/src/main/java/io/moquette/spi/impl/MessagesPublisher.java
index 486d4508..9fd9e518 100644
--- a/broker/src/main/java/io/moquette/spi/impl/MessagesPublisher.java
+++ b/broker/src/main/java/io/moquette/spi/impl/MessagesPublisher.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl;
@@ -22,7 +37,7 @@ class MessagesPublisher {
private final IMessagesStore m_messagesStore;
private final PersistentQueueMessageSender messageSender;
- public MessagesPublisher(ConnectionDescriptorStore connectionDescriptors, ISessionsStore sessionsStore,
+ MessagesPublisher(ConnectionDescriptorStore connectionDescriptors, ISessionsStore sessionsStore,
IMessagesStore messagesStore, PersistentQueueMessageSender messageSender) {
this.connectionDescriptors = connectionDescriptors;
this.m_sessionsStore = sessionsStore;
diff --git a/broker/src/main/java/io/moquette/spi/impl/PersistentQueueMessageSender.java b/broker/src/main/java/io/moquette/spi/impl/PersistentQueueMessageSender.java
index 9afaa3f8..65963ab8 100644
--- a/broker/src/main/java/io/moquette/spi/impl/PersistentQueueMessageSender.java
+++ b/broker/src/main/java/io/moquette/spi/impl/PersistentQueueMessageSender.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl;
@@ -15,7 +30,7 @@ class PersistentQueueMessageSender {
private static final Logger LOG = LoggerFactory.getLogger(PersistentQueueMessageSender.class);
private final ConnectionDescriptorStore connectionDescriptorStore;
- public PersistentQueueMessageSender(ConnectionDescriptorStore connectionDescriptorStore) {
+ PersistentQueueMessageSender(ConnectionDescriptorStore connectionDescriptorStore) {
this.connectionDescriptorStore = connectionDescriptorStore;
}
@@ -24,7 +39,7 @@ class PersistentQueueMessageSender {
final int messageId = pubMessage.variableHeader().messageId();
final String topicName = pubMessage.variableHeader().topicName();
if (LOG.isDebugEnabled()) {
- LOG.debug("Sending PUBLISH message. MessageId={}, CId={}, topic={}, qos={}, payload={}", messageId,
+ LOG.debug("Sending PUBLISH message. MessageId={}, CId={}, topic={}, qos={}, payload={}", messageId,
clientId, topicName, DebugUtils.payload2Str(pubMessage.payload()));
} else {
LOG.info("Sending PUBLISH message. MessageId={}, CId={}, topic={}", messageId, clientId, topicName);
@@ -34,8 +49,8 @@ class PersistentQueueMessageSender {
MqttQoS qos = pubMessage.fixedHeader().qosLevel();
if (!messageDelivered && qos != AT_MOST_ONCE && !clientsession.isCleanSession()) {
- LOG.warn("PUBLISH message could not be delivered. It will be stored. MessageId={}, CId={}, topic={}, qos={}, " +
- "cleanSession={}", messageId, clientId, topicName, qos, false);
+ LOG.warn("PUBLISH message could not be delivered. It will be stored. MessageId={}, CId={}, topic={}, "
+ + "qos={}, cleanSession={}", messageId, clientId, topicName, qos, false);
clientsession.enqueue(asStoredMessage(pubMessage));
} else {
LOG.warn("PUBLISH message could not be delivered. It will be discarded. MessageId={}, CId={}, topic={}, " +
diff --git a/broker/src/main/java/io/moquette/spi/impl/ProtocolProcessor.java b/broker/src/main/java/io/moquette/spi/impl/ProtocolProcessor.java
index b30e159e..96791fce 100644
--- a/broker/src/main/java/io/moquette/spi/impl/ProtocolProcessor.java
+++ b/broker/src/main/java/io/moquette/spi/impl/ProtocolProcessor.java
@@ -56,8 +56,6 @@ import static io.moquette.server.ConnectionDescriptor.ConnectionState.*;
* execution.
*
* Used by the front facing class ProtocolProcessorBootstrapper.
- *
- * @author andrea
*/
public class ProtocolProcessor {
@@ -68,7 +66,7 @@ public class ProtocolProcessor {
private final boolean retained;
private final MqttQoS qos;
- public WillMessage(String topic, ByteBuffer payload, boolean retained, MqttQoS qos) {
+ WillMessage(String topic, ByteBuffer payload, boolean retained, MqttQoS qos) {
this.topic = topic;
this.payload = payload;
this.retained = retained;
@@ -474,7 +472,8 @@ public class ProtocolProcessor {
targetSession.inFlightAcknowledged(messageID);
String topic = inflightMsg.getTopic();
- m_interceptor.notifyMessageAcknowledged(new InterceptAcknowledgedMessage(inflightMsg, topic, username, messageID));
+ m_interceptor
+ .notifyMessageAcknowledged(new InterceptAcknowledgedMessage(inflightMsg, topic, username, messageID));
}
public static IMessagesStore.StoredMessage asStoredMessage(MqttPublishMessage msg) {
@@ -511,6 +510,7 @@ public class ProtocolProcessor {
this.qos2PublishHandler.receivedPublishQos2(channel, msg);
break;
default:
+ LOG.error("Unkonwn QoS-Type:{}", qos);
break;
}
}
@@ -618,7 +618,8 @@ public class ProtocolProcessor {
StoredMessage inflightMsg = targetSession.secondPhaseAcknowledged(messageID);
String username = NettyUtils.userName(channel);
String topic = inflightMsg.getTopic();
- m_interceptor.notifyMessageAcknowledged(new InterceptAcknowledgedMessage(inflightMsg, topic, username, messageID));
+ m_interceptor
+ .notifyMessageAcknowledged(new InterceptAcknowledgedMessage(inflightMsg, topic, username, messageID));
}
public void processDisconnect(Channel channel) throws InterruptedException {
@@ -921,7 +922,7 @@ public class ProtocolProcessor {
} else {
// recreate a publish from stored publish in queue
boolean retained = m_messagesStore.getMessageByGuid(msg.getGuid()) != null;
- MqttPublishMessage pubMsg = createPublishForQos( msg.getTopic(), msg.getQos(), msg.getMessage(),
+ MqttPublishMessage pubMsg = createPublishForQos(msg.getTopic(), msg.getQos(), msg.getMessage(),
retained, 0);
channel.write(pubMsg);
}
@@ -936,11 +937,11 @@ public class ProtocolProcessor {
public void removeInterceptHandler(InterceptHandler interceptHandler) {
this.m_interceptor.removeInterceptHandler(interceptHandler);
}
-
+
public IMessagesStore getMessagesStore() {
return m_messagesStore;
}
-
+
public ISessionsStore getSessionsStore() {
return m_sessionsStore;
}
diff --git a/broker/src/main/java/io/moquette/spi/impl/ProtocolProcessorBootstrapper.java b/broker/src/main/java/io/moquette/spi/impl/ProtocolProcessorBootstrapper.java
index 309de6c2..72159b5f 100644
--- a/broker/src/main/java/io/moquette/spi/impl/ProtocolProcessorBootstrapper.java
+++ b/broker/src/main/java/io/moquette/spi/impl/ProtocolProcessorBootstrapper.java
@@ -44,8 +44,6 @@ import java.util.List;
/**
* It's main responsibility is bootstrap the ProtocolProcessor.
- *
- * @author andrea
*/
public class ProtocolProcessorBootstrapper {
@@ -56,7 +54,7 @@ public class ProtocolProcessorBootstrapper {
private ISessionsStore m_sessionsStore;
- private Runnable storeShutdown = null;
+ private Runnable storeShutdown;
private BrokerInterceptor m_interceptor;
@@ -155,7 +153,7 @@ public class ProtocolProcessorBootstrapper {
LOG.info("Parsing ACL file. Path = {}", aclFilePath);
authorizator = ACLFileParser.parse(resourceLoader.loadResource(aclFilePath));
} catch (ParseException pex) {
- LOG.error("Unable to parse ACL file. path="+ aclFilePath, pex);
+ LOG.error("Unable to parse ACL file. path=" + aclFilePath, pex);
}
} else {
authorizator = new PermitAllAuthorizator();
@@ -167,8 +165,10 @@ public class ProtocolProcessorBootstrapper {
connectionDescriptors = new ConnectionDescriptorStore(m_sessionsStore);
LOG.info("Initializing MQTT protocol processor...");
- boolean allowAnonymous = Boolean.parseBoolean(props.getProperty(BrokerConstants.ALLOW_ANONYMOUS_PROPERTY_NAME, "true"));
- boolean allowZeroByteClientId = Boolean.parseBoolean(props.getProperty(BrokerConstants.ALLOW_ZERO_BYTE_CLIENT_ID_PROPERTY_NAME, "false"));
+ boolean allowAnonymous = Boolean
+ .parseBoolean(props.getProperty(BrokerConstants.ALLOW_ANONYMOUS_PROPERTY_NAME, "true"));
+ boolean allowZeroByteClientId = Boolean
+ .parseBoolean(props.getProperty(BrokerConstants.ALLOW_ZERO_BYTE_CLIENT_ID_PROPERTY_NAME, "false"));
m_processor.init(connectionDescriptors, subscriptions, messagesStore, m_sessionsStore, authenticator,
allowAnonymous, allowZeroByteClientId, authorizator, m_interceptor,
props.getProperty(BrokerConstants.PORT_PROPERTY_NAME));
@@ -185,11 +185,19 @@ public class ProtocolProcessorBootstrapper {
// check if method getInstance exists
Method method = clazz.getMethod("getInstance", new Class[]{});
try {
- LOG.info("Invoking getInstance() method. ClassName = {}, interfaceName = {}.", className, intrface.getName());
+ LOG.info(
+ "Invoking getInstance() method. ClassName = {}, interfaceName = {}.",
+ className,
+ intrface.getName());
instance = (T) method.invoke(null, new Object[]{});
} catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException ex) {
- LOG.error("Unable to invoke getInstance() method. ClassName = {}, interfaceName = {}, cause = {}, errorMessage = {}.",
- className, intrface.getName(), ex.getCause(), ex.getMessage());
+ LOG.error(
+ "Unable to invoke getInstance() method. ClassName = {}, interfaceName = {}, cause = {}, "
+ + "errorMessage = {}.",
+ className,
+ intrface.getName(),
+ ex.getCause(),
+ ex.getMessage());
return null;
}
} catch (NoSuchMethodException nsmex) {
@@ -204,17 +212,31 @@ public class ProtocolProcessorBootstrapper {
.getConstructor(constructorArgClass)
.newInstance(props);
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException ex) {
- LOG.warn("Unable to invoke constructor with {} argument. ClassName = {}, interfaceName = {}, cause = {}, errorMessage = {}.",
- constructorArgClass.getName(), className, intrface.getName(), ex.getCause(), ex.getMessage());
+ LOG.warn(
+ "Unable to invoke constructor with {} argument. ClassName = {}, interfaceName = {}, cause = {}"
+ + ", errorMessage = {}.",
+ constructorArgClass.getName(),
+ className,
+ intrface.getName(),
+ ex.getCause(),
+ ex.getMessage());
return null;
} catch (NoSuchMethodException | InvocationTargetException e) {
try {
- LOG.info("Invoking default constructor. ClassName = {}, interfaceName = {}.", className, intrface.getName());
+ LOG.info(
+ "Invoking default constructor. ClassName = {}, interfaceName = {}.",
+ className,
+ intrface.getName());
// fallback to default constructor
instance = this.getClass().getClassLoader().loadClass(className).asSubclass(intrface).newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException ex) {
- LOG.error("Unable to invoke default constructor. ClassName = {}, interfaceName = {}, cause = {}, errorMessage = {}.",
- className, intrface.getName(), ex.getCause(), ex.getMessage());
+ LOG.error(
+ "Unable to invoke default constructor. ClassName = {}, interfaceName = {}, cause = {}, "
+ + "errorMessage = {}.",
+ className,
+ intrface.getName(),
+ ex.getCause(),
+ ex.getMessage());
return null;
}
}
@@ -222,8 +244,13 @@ public class ProtocolProcessorBootstrapper {
LOG.error("The class does not exist. ClassName = {}, interfaceName = {}.", className, intrface.getName());
return null;
} catch (SecurityException ex) {
- LOG.error("Unable to load class due to a security violation. ClassName = {}, interfaceName = {}, cause = {}, errorMessage = {}.",
- className, intrface.getName(), ex.getCause(), ex.getMessage());
+ LOG.error(
+ "Unable to load class due to a security violation. ClassName = {}, interfaceName = {}, cause = {}, "
+ + "errorMessage = {}.",
+ className,
+ intrface.getName(),
+ ex.getCause(),
+ ex.getMessage());
return null;
}
diff --git a/broker/src/main/java/io/moquette/spi/impl/Qos0PublishHandler.java b/broker/src/main/java/io/moquette/spi/impl/Qos0PublishHandler.java
index c8bb0411..9f730511 100644
--- a/broker/src/main/java/io/moquette/spi/impl/Qos0PublishHandler.java
+++ b/broker/src/main/java/io/moquette/spi/impl/Qos0PublishHandler.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl;
@@ -23,8 +38,8 @@ class Qos0PublishHandler extends QosPublishHandler {
private final BrokerInterceptor m_interceptor;
private final MessagesPublisher publisher;
- public Qos0PublishHandler(IAuthorizator authorizator, SubscriptionsStore subscriptions,
- IMessagesStore messagesStore, BrokerInterceptor interceptor, MessagesPublisher messagesPublisher) {
+ Qos0PublishHandler(IAuthorizator authorizator, SubscriptionsStore subscriptions, IMessagesStore messagesStore,
+ BrokerInterceptor interceptor, MessagesPublisher messagesPublisher) {
super(authorizator);
this.subscriptions = subscriptions;
this.m_messagesStore = messagesStore;
diff --git a/broker/src/main/java/io/moquette/spi/impl/Qos1PublishHandler.java b/broker/src/main/java/io/moquette/spi/impl/Qos1PublishHandler.java
index 21d22d76..378046ee 100644
--- a/broker/src/main/java/io/moquette/spi/impl/Qos1PublishHandler.java
+++ b/broker/src/main/java/io/moquette/spi/impl/Qos1PublishHandler.java
@@ -1,10 +1,24 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl;
import io.moquette.server.ConnectionDescriptorStore;
import io.moquette.server.netty.NettyUtils;
import io.moquette.spi.IMessagesStore;
-import io.moquette.spi.MessageGUID;
import io.moquette.spi.impl.subscriptions.Subscription;
import io.moquette.spi.impl.subscriptions.SubscriptionsStore;
import io.moquette.spi.impl.subscriptions.Topic;
@@ -31,9 +45,9 @@ class Qos1PublishHandler extends QosPublishHandler {
private final ConnectionDescriptorStore connectionDescriptors;
private final MessagesPublisher publisher;
- public Qos1PublishHandler(IAuthorizator authorizator, SubscriptionsStore subscriptions,
- IMessagesStore messagesStore, BrokerInterceptor interceptor,
- ConnectionDescriptorStore connectionDescriptors, String brokerPort, MessagesPublisher messagesPublisher) {
+ Qos1PublishHandler(IAuthorizator authorizator, SubscriptionsStore subscriptions, IMessagesStore messagesStore,
+ BrokerInterceptor interceptor, ConnectionDescriptorStore connectionDescriptors, String brokerPort,
+ MessagesPublisher messagesPublisher) {
super(authorizator);
this.subscriptions = subscriptions;
this.m_messagesStore = messagesStore;
@@ -97,7 +111,7 @@ class Qos1PublishHandler extends QosPublishHandler {
LOG.debug("clientIDs are {}", connectionDescriptors);
if (!connectionDescriptors.isConnected(clientId)) {
throw new RuntimeException(String.format("Can't find a ConnectionDescriptor for client %s in cache %s",
- clientId,connectionDescriptors));
+ clientId, connectionDescriptors));
}
connectionDescriptors.sendMessage(pubAckMessage, messageID, clientId);
} catch (Throwable t) {
diff --git a/broker/src/main/java/io/moquette/spi/impl/Qos2PublishHandler.java b/broker/src/main/java/io/moquette/spi/impl/Qos2PublishHandler.java
index 4464447e..447adfab 100644
--- a/broker/src/main/java/io/moquette/spi/impl/Qos2PublishHandler.java
+++ b/broker/src/main/java/io/moquette/spi/impl/Qos2PublishHandler.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl;
@@ -34,7 +49,7 @@ class Qos2PublishHandler extends QosPublishHandler {
private final ISessionsStore m_sessionsStore;
private final MessagesPublisher publisher;
- public Qos2PublishHandler(IAuthorizator authorizator, SubscriptionsStore subscriptions,
+ Qos2PublishHandler(IAuthorizator authorizator, SubscriptionsStore subscriptions,
IMessagesStore messagesStore, BrokerInterceptor interceptor,
ConnectionDescriptorStore connectionDescriptors, ISessionsStore sessionsStore, String brokerPort,
MessagesPublisher messagesPublisher) {
diff --git a/broker/src/main/java/io/moquette/spi/impl/QosPublishHandler.java b/broker/src/main/java/io/moquette/spi/impl/QosPublishHandler.java
index 89e9f024..e318aecf 100644
--- a/broker/src/main/java/io/moquette/spi/impl/QosPublishHandler.java
+++ b/broker/src/main/java/io/moquette/spi/impl/QosPublishHandler.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl;
diff --git a/broker/src/main/java/io/moquette/spi/impl/Utils.java b/broker/src/main/java/io/moquette/spi/impl/Utils.java
index 12922d0e..0230d067 100644
--- a/broker/src/main/java/io/moquette/spi/impl/Utils.java
+++ b/broker/src/main/java/io/moquette/spi/impl/Utils.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl;
@@ -9,7 +24,7 @@ import java.util.Map;
/**
* Utility static methods, like Map get with default value, or elvis operator.
*/
-public class Utils {
+public final class Utils {
public static T defaultGet(Map map, K key, T defaultValue) {
T value = map.get(key);
@@ -30,4 +45,7 @@ public class Utils {
payload.readerIndex(mark);
return payloadContent;
}
+
+ private Utils() {
+ }
}
diff --git a/broker/src/main/java/io/moquette/spi/impl/security/ACLFileParser.java b/broker/src/main/java/io/moquette/spi/impl/security/ACLFileParser.java
index 839577d0..2121dbb3 100644
--- a/broker/src/main/java/io/moquette/spi/impl/security/ACLFileParser.java
+++ b/broker/src/main/java/io/moquette/spi/impl/security/ACLFileParser.java
@@ -24,10 +24,8 @@ import java.text.ParseException;
/**
* Parses the acl configuration file. If a line starts with # it's comment. Blank lines are skipped.
* The format is "topic [read|write|readwrite] {topic name}"
- *
- * @author andrea
*/
-public class ACLFileParser {
+public final class ACLFileParser {
private static final Logger LOG = LoggerFactory.getLogger(ACLFileParser.class);
@@ -110,4 +108,7 @@ public class ACLFileParser {
}
return collector;
}
+
+ private ACLFileParser() {
+ }
}
diff --git a/broker/src/main/java/io/moquette/spi/impl/security/AcceptAllAuthenticator.java b/broker/src/main/java/io/moquette/spi/impl/security/AcceptAllAuthenticator.java
index 01bc91ca..3bc0195a 100644
--- a/broker/src/main/java/io/moquette/spi/impl/security/AcceptAllAuthenticator.java
+++ b/broker/src/main/java/io/moquette/spi/impl/security/AcceptAllAuthenticator.java
@@ -1,11 +1,23 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl.security;
import io.moquette.spi.security.IAuthenticator;
-/**
- * Created by andrea on 8/23/14.
- */
public class AcceptAllAuthenticator implements IAuthenticator {
public boolean checkValid(String clientId, String username, byte[] password) {
diff --git a/broker/src/main/java/io/moquette/spi/impl/security/Authorization.java b/broker/src/main/java/io/moquette/spi/impl/security/Authorization.java
index 688aa7ef..4c0c4f3e 100644
--- a/broker/src/main/java/io/moquette/spi/impl/security/Authorization.java
+++ b/broker/src/main/java/io/moquette/spi/impl/security/Authorization.java
@@ -21,8 +21,6 @@ import io.moquette.spi.impl.subscriptions.Topic;
/**
* Carries the read/write authorization to topics for the users.
- *
- * @author andrea
*/
public class Authorization {
diff --git a/broker/src/main/java/io/moquette/spi/impl/security/AuthorizationsCollector.java b/broker/src/main/java/io/moquette/spi/impl/security/AuthorizationsCollector.java
index 82e75dcb..762c4551 100644
--- a/broker/src/main/java/io/moquette/spi/impl/security/AuthorizationsCollector.java
+++ b/broker/src/main/java/io/moquette/spi/impl/security/AuthorizationsCollector.java
@@ -18,8 +18,6 @@ package io.moquette.spi.impl.security;
import io.moquette.spi.impl.subscriptions.Topic;
import io.moquette.spi.security.IAuthorizator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.text.ParseException;
import java.util.*;
@@ -28,18 +26,14 @@ import java.util.*;
* mode to check it topics matches the ACLs.
*
* Not thread safe.
- *
- * @author andrea
*/
class AuthorizationsCollector implements IAuthorizator {
- private static final Logger LOG = LoggerFactory.getLogger(AuthorizationsCollector.class);
-
private List m_globalAuthorizations = new ArrayList<>();
private List m_patternAuthorizations = new ArrayList<>();
private Map> m_userAuthorizations = new HashMap<>();
- private boolean m_parsingUsersSpecificSection = false;
- private boolean m_parsingPatternSpecificSection = false;
+ private boolean m_parsingUsersSpecificSection;
+ private boolean m_parsingPatternSpecificSection;
private String m_currentUser = "";
static final AuthorizationsCollector emptyImmutableCollector() {
diff --git a/broker/src/main/java/io/moquette/spi/impl/security/DBAuthenticator.java b/broker/src/main/java/io/moquette/spi/impl/security/DBAuthenticator.java
index 4e92b68d..5fcf30f5 100644
--- a/broker/src/main/java/io/moquette/spi/impl/security/DBAuthenticator.java
+++ b/broker/src/main/java/io/moquette/spi/impl/security/DBAuthenticator.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl.security;
@@ -13,10 +28,7 @@ import java.sql.*;
/**
* Load user credentials from a SQL database. sql driver must be provided at runtime
- *
- * @author mackristof
*/
-
public class DBAuthenticator implements IAuthenticator {
private static final Logger LOG = LoggerFactory.getLogger(DBAuthenticator.class);
diff --git a/broker/src/main/java/io/moquette/spi/impl/security/DenyAllAuthorizator.java b/broker/src/main/java/io/moquette/spi/impl/security/DenyAllAuthorizator.java
index e7c2a4e9..ced29c28 100644
--- a/broker/src/main/java/io/moquette/spi/impl/security/DenyAllAuthorizator.java
+++ b/broker/src/main/java/io/moquette/spi/impl/security/DenyAllAuthorizator.java
@@ -19,9 +19,6 @@ package io.moquette.spi.impl.security;
import io.moquette.spi.impl.subscriptions.Topic;
import io.moquette.spi.security.IAuthorizator;
-/**
- * @author andrea
- */
public class DenyAllAuthorizator implements IAuthorizator {
@Override
diff --git a/broker/src/main/java/io/moquette/spi/impl/security/FileAuthenticator.java b/broker/src/main/java/io/moquette/spi/impl/security/FileAuthenticator.java
index 3e5eb938..dc3371ba 100644
--- a/broker/src/main/java/io/moquette/spi/impl/security/FileAuthenticator.java
+++ b/broker/src/main/java/io/moquette/spi/impl/security/FileAuthenticator.java
@@ -31,7 +31,6 @@ import io.moquette.server.config.FileResourceLoader;
* NB -n is important because echo append a newline by default at the of string. -n avoid this
* behaviour.
*
- * @author andrea
* @deprecated user {@link ResourceAuthenticator} instead
*/
public class FileAuthenticator extends ResourceAuthenticator {
diff --git a/broker/src/main/java/io/moquette/spi/impl/security/PermitAllAuthorizator.java b/broker/src/main/java/io/moquette/spi/impl/security/PermitAllAuthorizator.java
index fda989d5..f55530eb 100644
--- a/broker/src/main/java/io/moquette/spi/impl/security/PermitAllAuthorizator.java
+++ b/broker/src/main/java/io/moquette/spi/impl/security/PermitAllAuthorizator.java
@@ -19,9 +19,6 @@ package io.moquette.spi.impl.security;
import io.moquette.spi.impl.subscriptions.Topic;
import io.moquette.spi.security.IAuthorizator;
-/**
- * @author andrea
- */
public class PermitAllAuthorizator implements IAuthorizator {
@Override
diff --git a/broker/src/main/java/io/moquette/spi/impl/security/ResourceAuthenticator.java b/broker/src/main/java/io/moquette/spi/impl/security/ResourceAuthenticator.java
index 4291f10b..ea7bfd61 100644
--- a/broker/src/main/java/io/moquette/spi/impl/security/ResourceAuthenticator.java
+++ b/broker/src/main/java/io/moquette/spi/impl/security/ResourceAuthenticator.java
@@ -42,19 +42,16 @@ import java.util.Map;
*
* NB -n is important because echo append a newline by default at the of string. -n avoid this
* behaviour.
- *
- * @author andrea
*/
public class ResourceAuthenticator implements IAuthenticator {
protected static final Logger LOG = LoggerFactory.getLogger(ResourceAuthenticator.class);
private Map m_identities = new HashMap<>();
- private MessageDigest m_digest;
public ResourceAuthenticator(IResourceLoader resourceLoader, String resourceName) {
try {
- this.m_digest = MessageDigest.getInstance("SHA-256");
+ MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException nsaex) {
LOG.error("Can't find SHA-256 for password encoding", nsaex);
throw new RuntimeException(nsaex);
diff --git a/broker/src/main/java/io/moquette/spi/impl/subscriptions/Subscription.java b/broker/src/main/java/io/moquette/spi/impl/subscriptions/Subscription.java
index 05837e50..606b13a0 100644
--- a/broker/src/main/java/io/moquette/spi/impl/subscriptions/Subscription.java
+++ b/broker/src/main/java/io/moquette/spi/impl/subscriptions/Subscription.java
@@ -22,9 +22,6 @@ import java.io.Serializable;
/**
* Maintain the information about which Topic a certain ClientID is subscribed and at which QoS
- *
- *
- * @author andrea
*/
public final class Subscription implements Serializable {
diff --git a/broker/src/main/java/io/moquette/spi/impl/subscriptions/SubscriptionsStore.java b/broker/src/main/java/io/moquette/spi/impl/subscriptions/SubscriptionsStore.java
index ffb0690a..813d9a2e 100644
--- a/broker/src/main/java/io/moquette/spi/impl/subscriptions/SubscriptionsStore.java
+++ b/broker/src/main/java/io/moquette/spi/impl/subscriptions/SubscriptionsStore.java
@@ -26,8 +26,6 @@ import java.util.concurrent.atomic.AtomicReference;
/**
* Represents a tree of topics subscriptions.
- *
- * @author andrea
*/
public class SubscriptionsStore {
@@ -125,7 +123,7 @@ public class SubscriptionsStore {
couple.createdNode.addSubscription(newSubscription); //createdNode could be null?
couple.root.recalculateSubscriptionsSize();
//spin lock repeating till we can, swap root, if can't swap just re-do the operation
- } while(!subscriptions.compareAndSet(oldRoot, couple.root));
+ } while (!subscriptions.compareAndSet(oldRoot, couple.root));
LOG.debug("A subscription has been added. Root = {}, oldRoot = {}.", couple.root, oldRoot);
}
@@ -168,7 +166,7 @@ public class SubscriptionsStore {
couple.createdNode.remove(new ClientTopicCouple(clientID, topic));
couple.root.recalculateSubscriptionsSize();
//spin lock repeating till we can, swap root, if can't swap just re-do the operation
- } while(!subscriptions.compareAndSet(oldRoot, couple.root));
+ } while (!subscriptions.compareAndSet(oldRoot, couple.root));
}
/**
diff --git a/broker/src/main/java/io/moquette/spi/impl/subscriptions/TreeNode.java b/broker/src/main/java/io/moquette/spi/impl/subscriptions/TreeNode.java
index 2e105987..c956ab42 100644
--- a/broker/src/main/java/io/moquette/spi/impl/subscriptions/TreeNode.java
+++ b/broker/src/main/java/io/moquette/spi/impl/subscriptions/TreeNode.java
@@ -26,7 +26,7 @@ class TreeNode {
List m_children = new ArrayList<>();
Set m_subscriptions = new HashSet<>();
- private int subtreeSubscriptions = 0;
+ private int subtreeSubscriptions;
TreeNode() {
}
diff --git a/broker/src/main/java/io/moquette/spi/security/IAuthenticator.java b/broker/src/main/java/io/moquette/spi/security/IAuthenticator.java
index 99a73e2a..042fe134 100644
--- a/broker/src/main/java/io/moquette/spi/security/IAuthenticator.java
+++ b/broker/src/main/java/io/moquette/spi/security/IAuthenticator.java
@@ -18,8 +18,6 @@ package io.moquette.spi.security;
/**
* username and password checker
- *
- * @author andrea
*/
public interface IAuthenticator {
diff --git a/broker/src/main/java/io/moquette/spi/security/IAuthorizator.java b/broker/src/main/java/io/moquette/spi/security/IAuthorizator.java
index 1aaaf5ad..cc45fa86 100644
--- a/broker/src/main/java/io/moquette/spi/security/IAuthorizator.java
+++ b/broker/src/main/java/io/moquette/spi/security/IAuthorizator.java
@@ -23,8 +23,6 @@ import io.moquette.spi.impl.subscriptions.Topic;
*
* Create an authorizator that matches topic names with same grammar of subscriptions. The # is
* always a terminator and its the multilevel matcher. The + sign is the single level matcher.
- *
- * @author andrea
*/
public interface IAuthorizator {
diff --git a/broker/src/main/java/io/moquette/spi/security/ISslContextCreator.java b/broker/src/main/java/io/moquette/spi/security/ISslContextCreator.java
index 7efcde73..0d86b348 100644
--- a/broker/src/main/java/io/moquette/spi/security/ISslContextCreator.java
+++ b/broker/src/main/java/io/moquette/spi/security/ISslContextCreator.java
@@ -20,8 +20,6 @@ import javax.net.ssl.SSLContext;
/**
* SSL certificate loader used to open SSL connections (websocket and MQTT-S).
- *
- * Created by andrea on 13/12/15.
*/
public interface ISslContextCreator {
diff --git a/broker/src/test/java/io/moquette/Utils.java b/broker/src/test/java/io/moquette/Utils.java
index cce6d78b..24ca0886 100644
--- a/broker/src/test/java/io/moquette/Utils.java
+++ b/broker/src/test/java/io/moquette/Utils.java
@@ -20,17 +20,10 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.CorruptedFrameException;
import io.netty.handler.codec.mqtt.MqttMessage;
-import io.netty.util.Attribute;
-import io.netty.util.AttributeKey;
-import io.netty.util.AttributeMap;
import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
-/**
- *
- * @author andrea
- */
-public class Utils {
+public final class Utils {
public static final int MAX_LENGTH_LIMIT = 268435455;
@@ -188,7 +181,7 @@ public class Utils {
flags |= 0x01;
}
- flags |= ((message.fixedHeader().qosLevel().value() & 0x03) << 1);
+ flags |= (message.fixedHeader().qosLevel().value() & 0x03) << 1;
return flags;
}
@@ -203,4 +196,7 @@ public class Utils {
// }
// return protocolVersion == VERSION_3_1_1;
// }
+
+ private Utils() {
+ }
}
diff --git a/broker/src/test/java/io/moquette/server/ConfigurationClassLoaderTest.java b/broker/src/test/java/io/moquette/server/ConfigurationClassLoaderTest.java
index 41dda657..90f9204a 100644
--- a/broker/src/test/java/io/moquette/server/ConfigurationClassLoaderTest.java
+++ b/broker/src/test/java/io/moquette/server/ConfigurationClassLoaderTest.java
@@ -31,10 +31,6 @@ import java.io.IOException;
import java.util.Properties;
import static org.junit.Assert.*;
-/**
- *
- * @author luca
- */
public class ConfigurationClassLoaderTest implements IAuthenticator, IAuthorizator {
Server m_server;
diff --git a/broker/src/test/java/io/moquette/server/IntegrationUtils.java b/broker/src/test/java/io/moquette/server/IntegrationUtils.java
index 9349e0b2..89cd920d 100644
--- a/broker/src/test/java/io/moquette/server/IntegrationUtils.java
+++ b/broker/src/test/java/io/moquette/server/IntegrationUtils.java
@@ -16,20 +16,16 @@
package io.moquette.server;
-import io.moquette.server.config.IConfig;
import java.io.File;
import java.util.Properties;
import static io.moquette.BrokerConstants.DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME;
import static io.moquette.BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME;
import static io.moquette.BrokerConstants.PORT_PROPERTY_NAME;
-import static org.junit.Assert.assertFalse;
/**
* Used to carry integration configurations.
- *
- * Created by andrea on 4/7/15.
*/
-public class IntegrationUtils {
+public final class IntegrationUtils {
static String localMapDBPath() {
String currentDir = System.getProperty("user.dir");
@@ -69,4 +65,7 @@ public class IntegrationUtils {
}
assertFalse(dbFile.exists());
}*/
+
+ private IntegrationUtils() {
+ }
}
diff --git a/broker/src/test/java/io/moquette/server/MQTTWebSocket.java b/broker/src/test/java/io/moquette/server/MQTTWebSocket.java
index 2866aa25..d7a5d8d1 100644
--- a/broker/src/test/java/io/moquette/server/MQTTWebSocket.java
+++ b/broker/src/test/java/io/moquette/server/MQTTWebSocket.java
@@ -30,17 +30,11 @@ import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/**
- *
- * @author andrea
- */
@WebSocket
public class MQTTWebSocket {
private static final Logger LOG = LoggerFactory.getLogger(MQTTWebSocket.class);
- private Session session;
-
private final CountDownLatch connectSentLatch;
public MQTTWebSocket() {
@@ -50,14 +44,12 @@ public class MQTTWebSocket {
@OnWebSocketClose
public void onClose(int statusCode, String reason) {
System.out.printf("Connection closed: %d - %s%n", statusCode, reason);
- this.session = null;
}
@OnWebSocketConnect
public void onConnect(Session session) throws IOException {
System.out.printf("Got connect: %s%n", session);
LOG.info("Got connect: %s%n", session);
- this.session = session;
// Trivial MQTT Connect message
// assertEquals(12, out.readByte()); //remaining length
diff --git a/broker/src/test/java/io/moquette/server/MessageCollector.java b/broker/src/test/java/io/moquette/server/MessageCollector.java
index 07cf40be..d8103634 100644
--- a/broker/src/test/java/io/moquette/server/MessageCollector.java
+++ b/broker/src/test/java/io/moquette/server/MessageCollector.java
@@ -26,7 +26,7 @@ import java.util.concurrent.*;
*/
public class MessageCollector implements MqttCallback {
- private class ReceivedMessage {
+ private final class ReceivedMessage {
private final MqttMessage message;
private final String topic;
@@ -38,7 +38,7 @@ public class MessageCollector implements MqttCallback {
}
private BlockingQueue m_messages = new LinkedBlockingQueue<>();
- private boolean m_connectionLost = false;
+ private boolean m_connectionLost;
/**
* Return the message from the queue if not empty, else return null with wait period.
diff --git a/broker/src/test/java/io/moquette/server/ServerIntegrationDBAuthenticatorTest.java b/broker/src/test/java/io/moquette/server/ServerIntegrationDBAuthenticatorTest.java
index 81c7cb83..044c3568 100644
--- a/broker/src/test/java/io/moquette/server/ServerIntegrationDBAuthenticatorTest.java
+++ b/broker/src/test/java/io/moquette/server/ServerIntegrationDBAuthenticatorTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.server;
@@ -18,9 +33,6 @@ import java.sql.SQLException;
import java.util.Properties;
import static org.junit.Assert.assertTrue;
-/**
- * Created by mackristof on 13/05/2016.
- */
public class ServerIntegrationDBAuthenticatorTest {
private static final Logger LOG = LoggerFactory.getLogger(ServerIntegrationDBAuthenticatorTest.class);
diff --git a/broker/src/test/java/io/moquette/server/ServerIntegrationFuseTest.java b/broker/src/test/java/io/moquette/server/ServerIntegrationFuseTest.java
index 3a4f4e36..a791d989 100644
--- a/broker/src/test/java/io/moquette/server/ServerIntegrationFuseTest.java
+++ b/broker/src/test/java/io/moquette/server/ServerIntegrationFuseTest.java
@@ -29,10 +29,6 @@ import java.util.Properties;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.*;
-/**
- *
- * @author andrea
- */
public class ServerIntegrationFuseTest {
private static final Logger LOG = LoggerFactory.getLogger(ServerIntegrationPahoTest.class);
diff --git a/broker/src/test/java/io/moquette/server/ServerIntegrationHazelcastHandlerInterceptorTest.java b/broker/src/test/java/io/moquette/server/ServerIntegrationHazelcastHandlerInterceptorTest.java
index f250b8f2..753794c3 100644
--- a/broker/src/test/java/io/moquette/server/ServerIntegrationHazelcastHandlerInterceptorTest.java
+++ b/broker/src/test/java/io/moquette/server/ServerIntegrationHazelcastHandlerInterceptorTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.server;
diff --git a/broker/src/test/java/io/moquette/server/ServerIntegrationQoSValidationTest.java b/broker/src/test/java/io/moquette/server/ServerIntegrationQoSValidationTest.java
index 7643460c..ed81b441 100644
--- a/broker/src/test/java/io/moquette/server/ServerIntegrationQoSValidationTest.java
+++ b/broker/src/test/java/io/moquette/server/ServerIntegrationQoSValidationTest.java
@@ -34,10 +34,6 @@ import java.io.IOException;
import java.util.Properties;
import static org.junit.Assert.assertEquals;
-/**
- *
- * @author andrea
- */
public class ServerIntegrationQoSValidationTest {
private static final Logger LOG = LoggerFactory.getLogger(ServerIntegrationPahoTest.class);
diff --git a/broker/src/test/java/io/moquette/server/ServerIntegrationSSLClientAuthTest.java b/broker/src/test/java/io/moquette/server/ServerIntegrationSSLClientAuthTest.java
index 735e61dc..6314fc6d 100644
--- a/broker/src/test/java/io/moquette/server/ServerIntegrationSSLClientAuthTest.java
+++ b/broker/src/test/java/io/moquette/server/ServerIntegrationSSLClientAuthTest.java
@@ -54,40 +54,55 @@ import org.slf4j.LoggerFactory;
*
*
* # generate server certificate chain (valid for 10000 days)
- * keytool -genkeypair -alias signedtestserver -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv -validity 10000
- * keytool -genkeypair -alias signedtestserver_sub -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv
+ * keytool -genkeypair -alias signedtestserver -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 \
+ * -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv -validity 10000
+ * keytool -genkeypair -alias signedtestserver_sub -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 \
+ * -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv
*
* # sign server subcertificate with server certificate (valid for 10000 days)
- * keytool -certreq -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv | \
- * keytool -gencert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv -validity 10000 | \
- * keytool -importcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv
+ * keytool -certreq -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv \
+ * -storepass passw0rdsrv | \
+ * keytool -gencert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv \
+ * -storepass passw0rdsrv -validity 10000 | \
+ * keytool -importcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv \
+ * -storepass passw0rdsrv
*
* # generate client keypair
- * keytool -genkeypair -alias signedtestclient -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd
+ * keytool -genkeypair -alias signedtestclient -dname cn=moquette.eclipse.org -keyalg RSA -keysize 2048 \
+ * -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd
*
* # create signed client certificate with server subcertificate and import to client keystore (valid for 10000 days)
* keytool -certreq -alias signedtestclient -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd | \
- * keytool -gencert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv -validity 10000 | \
- * keytool -importcert -alias signedtestclient -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd -noprompt
+ * keytool -gencert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv \
+ * -storepass passw0rdsrv -validity 10000 | \
+ * keytool -importcert -alias signedtestclient -keystore signedclientkeystore.jks -keypass passw0rd \
+ * -storepass passw0rd -noprompt
*
* # import server certificates into signed truststore
- * keytool -exportcert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv | \
- * keytool -importcert -trustcacerts -noprompt -alias signedtestserver -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd
- * keytool -exportcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv | \
- * keytool -importcert -trustcacerts -noprompt -alias signedtestserver_sub -keystore signedclientkeystore.jks -keypass passw0rd -storepass passw0rd
+ * keytool -exportcert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv \
+ * -storepass passw0rdsrv | \
+ * keytool -importcert -trustcacerts -noprompt -alias signedtestserver -keystore signedclientkeystore.jks \
+ * -keypass passw0rd -storepass passw0rd
+ * keytool -exportcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv \
+ * -storepass passw0rdsrv | \
+ * keytool -importcert -trustcacerts -noprompt -alias signedtestserver_sub -keystore signedclientkeystore.jks \
+ * -keypass passw0rd -storepass passw0rd
*
* # create unsigned client certificate (valid for 10000 days)
- * keytool -genkeypair -alias unsignedtestclient -dname cn=moquette.eclipse.org -validity 10000 -keyalg RSA -keysize 2048 -keystore unsignedclientkeystore.jks -keypass passw0rd -storepass passw0rd
+ * keytool -genkeypair -alias unsignedtestclient -dname cn=moquette.eclipse.org -validity 10000 -keyalg RSA \
+ * -keysize 2048 -keystore unsignedclientkeystore.jks -keypass passw0rd -storepass passw0rd
*
* # import server certificates into unsigned truststore
- * keytool -exportcert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv | \
- * keytool -importcert -trustcacerts -noprompt -alias signedtestserver -keystore unsignedclientkeystore.jks -keypass passw0rd -storepass passw0rd
- * keytool -exportcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv -storepass passw0rdsrv | \
- * keytool -importcert -trustcacerts -noprompt -alias signedtestserver_sub -keystore unsignedclientkeystore.jks -keypass passw0rd -storepass passw0rd
+ * keytool -exportcert -alias signedtestserver -keystore signedserverkeystore.jks -keypass passw0rdsrv \
+ * -storepass passw0rdsrv | \
+ * keytool -importcert -trustcacerts -noprompt -alias signedtestserver -keystore unsignedclientkeystore.jks \
+ * -keypass passw0rd -storepass passw0rd
+ * keytool -exportcert -alias signedtestserver_sub -keystore signedserverkeystore.jks -keypass passw0rdsrv \
+ * -storepass passw0rdsrv | \
+ * keytool -importcert -trustcacerts -noprompt -alias signedtestserver_sub -keystore unsignedclientkeystore.jks \
+ * -keypass passw0rd -storepass passw0rd
*
*
- *
- * @author andrea / konradm
*/
public class ServerIntegrationSSLClientAuthTest {
diff --git a/broker/src/test/java/io/moquette/server/ServerIntegrationSSLTest.java b/broker/src/test/java/io/moquette/server/ServerIntegrationSSLTest.java
index 6ef4303f..4b81c2fd 100644
--- a/broker/src/test/java/io/moquette/server/ServerIntegrationSSLTest.java
+++ b/broker/src/test/java/io/moquette/server/ServerIntegrationSSLTest.java
@@ -49,8 +49,6 @@ import org.slf4j.LoggerFactory;
/**
* Check that Moquette could also handle SSL.
- *
- * @author andrea
*/
public class ServerIntegrationSSLTest {
diff --git a/broker/src/test/java/io/moquette/server/ServerIntegrationWebSocketTest.java b/broker/src/test/java/io/moquette/server/ServerIntegrationWebSocketTest.java
index 4d073ead..29461264 100644
--- a/broker/src/test/java/io/moquette/server/ServerIntegrationWebSocketTest.java
+++ b/broker/src/test/java/io/moquette/server/ServerIntegrationWebSocketTest.java
@@ -34,8 +34,6 @@ import static org.junit.Assert.assertTrue;
/**
* Integration test to check the function of Moquette with a WebSocket channel.
- *
- * @author andrea
*/
public class ServerIntegrationWebSocketTest {
diff --git a/broker/src/test/java/io/moquette/server/ServerLowlevelMessagesIntegrationTests.java b/broker/src/test/java/io/moquette/server/ServerLowlevelMessagesIntegrationTests.java
index b095cac7..95b164db 100644
--- a/broker/src/test/java/io/moquette/server/ServerLowlevelMessagesIntegrationTests.java
+++ b/broker/src/test/java/io/moquette/server/ServerLowlevelMessagesIntegrationTests.java
@@ -32,10 +32,6 @@ import java.util.Properties;
import static io.netty.handler.codec.mqtt.MqttConnectReturnCode.*;
import static org.junit.Assert.*;
-/**
- *
- * @author andrea
- */
public class ServerLowlevelMessagesIntegrationTests {
private static final Logger LOG = LoggerFactory.getLogger(ServerLowlevelMessagesIntegrationTests.class);
diff --git a/broker/src/test/java/io/moquette/server/ServerRestartIntegrationTest.java b/broker/src/test/java/io/moquette/server/ServerRestartIntegrationTest.java
index 65614015..0abdd2bf 100644
--- a/broker/src/test/java/io/moquette/server/ServerRestartIntegrationTest.java
+++ b/broker/src/test/java/io/moquette/server/ServerRestartIntegrationTest.java
@@ -30,10 +30,6 @@ import java.util.Properties;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-/**
- *
- * @author andrea
- */
public class ServerRestartIntegrationTest {
static MqttClientPersistence s_dataStore;
@@ -63,7 +59,6 @@ public class ServerRestartIntegrationTest {
@Before
public void setUp() throws Exception {
- String dbPath = IntegrationUtils.localMapDBPath();
startServer();
m_subscriber = new MqttClient("tcp://localhost:1883", "Subscriber", s_dataStore);
diff --git a/broker/src/test/java/io/moquette/server/config/ClasspathResourceLoaderTest.java b/broker/src/test/java/io/moquette/server/config/ClasspathResourceLoaderTest.java
index 860d7c16..835d2dd9 100644
--- a/broker/src/test/java/io/moquette/server/config/ClasspathResourceLoaderTest.java
+++ b/broker/src/test/java/io/moquette/server/config/ClasspathResourceLoaderTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.server.config;
diff --git a/broker/src/test/java/io/moquette/server/config/ConfigurationParserTest.java b/broker/src/test/java/io/moquette/server/config/ConfigurationParserTest.java
index 03f87066..d13f0cf1 100644
--- a/broker/src/test/java/io/moquette/server/config/ConfigurationParserTest.java
+++ b/broker/src/test/java/io/moquette/server/config/ConfigurationParserTest.java
@@ -16,7 +16,6 @@
package io.moquette.server.config;
-import io.moquette.BrokerConstants;
import org.junit.Before;
import org.junit.Test;
import java.io.Reader;
@@ -24,13 +23,8 @@ import java.io.StringReader;
import java.text.ParseException;
import java.util.Properties;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-/**
- *
- * @author andrea
- */
public class ConfigurationParserTest {
ConfigurationParser m_parser;
@@ -96,13 +90,4 @@ public class ConfigurationParserTest {
assertEquals("localhost", props.getProperty("host"));
assertEquals("multi word string property", props.getProperty("fake"));
}
-
- /**
- * Helper method to verify default options.
- */
- private void verifyDefaults(Properties props) {
- assertEquals(BrokerConstants.PORT, Integer.parseInt(props.getProperty(BrokerConstants.PORT_PROPERTY_NAME)));
- assertEquals(BrokerConstants.HOST, props.getProperty(BrokerConstants.HOST_PROPERTY_NAME));
- assertNull(props.getProperty(BrokerConstants.WEB_SOCKET_PORT_PROPERTY_NAME));
- }
}
diff --git a/broker/src/test/java/io/moquette/spec/v3_1_1/connection/ConnectionIT.java b/broker/src/test/java/io/moquette/spec/v3_1_1/connection/ConnectionIT.java
index dd7896d2..13fe5047 100644
--- a/broker/src/test/java/io/moquette/spec/v3_1_1/connection/ConnectionIT.java
+++ b/broker/src/test/java/io/moquette/spec/v3_1_1/connection/ConnectionIT.java
@@ -28,11 +28,6 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
-/**
- *
- * @author pkhanal
- *
- */
public class ConnectionIT {
Server m_server;
diff --git a/broker/src/test/java/io/moquette/spi/ClientSessionTest.java b/broker/src/test/java/io/moquette/spi/ClientSessionTest.java
index 69d1e568..2cf8a2eb 100644
--- a/broker/src/test/java/io/moquette/spi/ClientSessionTest.java
+++ b/broker/src/test/java/io/moquette/spi/ClientSessionTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi;
diff --git a/broker/src/test/java/io/moquette/spi/impl/BrokerInterceptorTest.java b/broker/src/test/java/io/moquette/spi/impl/BrokerInterceptorTest.java
index fcd29fcb..ffade441 100644
--- a/broker/src/test/java/io/moquette/spi/impl/BrokerInterceptorTest.java
+++ b/broker/src/test/java/io/moquette/spi/impl/BrokerInterceptorTest.java
@@ -32,9 +32,6 @@ import static org.mockito.Matchers.refEq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
-/**
- * @author Wagner Macedo
- */
public class BrokerInterceptorTest {
// value to check for changes after every notification
diff --git a/broker/src/test/java/io/moquette/spi/impl/MockAuthenticator.java b/broker/src/test/java/io/moquette/spi/impl/MockAuthenticator.java
index f186c9fb..cc03205c 100644
--- a/broker/src/test/java/io/moquette/spi/impl/MockAuthenticator.java
+++ b/broker/src/test/java/io/moquette/spi/impl/MockAuthenticator.java
@@ -22,8 +22,6 @@ import io.moquette.spi.security.IAuthenticator;
/**
* Test utility to implements authenticator instance.
- *
- * @author andrea
*/
class MockAuthenticator implements IAuthenticator {
diff --git a/broker/src/test/java/io/moquette/spi/impl/NettyChannelAssertions.java b/broker/src/test/java/io/moquette/spi/impl/NettyChannelAssertions.java
index 67ae68e9..ab691ae8 100644
--- a/broker/src/test/java/io/moquette/spi/impl/NettyChannelAssertions.java
+++ b/broker/src/test/java/io/moquette/spi/impl/NettyChannelAssertions.java
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertTrue;
/**
* Some useful assertions used by Netty's EmbeddedChannel in tests.
*/
-class NettyChannelAssertions {
+final class NettyChannelAssertions {
static void assertEqualsConnAck(MqttConnectReturnCode expectedCode, Object connAck) {
assertEqualsConnAck(null, expectedCode, connAck);
@@ -54,4 +54,6 @@ class NettyChannelAssertions {
// assertEquals(expectedCode, connAckMsg.getReturnCode());
}
+ private NettyChannelAssertions() {
+ }
}
diff --git a/broker/src/test/java/io/moquette/spi/impl/ProtocolProcessorTest.java b/broker/src/test/java/io/moquette/spi/impl/ProtocolProcessorTest.java
index d64a2e62..478feada 100644
--- a/broker/src/test/java/io/moquette/spi/impl/ProtocolProcessorTest.java
+++ b/broker/src/test/java/io/moquette/spi/impl/ProtocolProcessorTest.java
@@ -40,10 +40,6 @@ import static io.moquette.spi.impl.ProtocolProcessor.lowerQosToTheSubscriptionDe
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
-/**
- *
- * @author andrea
- */
public class ProtocolProcessorTest {
static final String FAKE_CLIENT_ID = "FAKE_123";
@@ -263,7 +259,7 @@ public class ProtocolProcessorTest {
m_processor.processSubscribe(m_channel, msg);
assertEquals(1, subscriptions.size());
-
+
//Exercise
m_processor.processSubscribe(m_channel, msg);
@@ -311,7 +307,8 @@ public class ProtocolProcessorTest {
@Test
public void testPublishOfRetainedMessage_afterNewSubscription() throws Exception {
// simulate a connect that register a clientID to an IoSession
- final Subscription subscription = new Subscription(FAKE_PUBLISHER_ID, new Topic(FAKE_TOPIC), MqttQoS.AT_MOST_ONCE);
+ final Subscription subscription =
+ new Subscription(FAKE_PUBLISHER_ID, new Topic(FAKE_TOPIC), MqttQoS.AT_MOST_ONCE);
// subscriptions.matches(topic) redefine the method to return true
SubscriptionsStore subs = new SubscriptionsStore() {
diff --git a/broker/src/test/java/io/moquette/spi/impl/ProtocolProcessor_CONNECT_Test.java b/broker/src/test/java/io/moquette/spi/impl/ProtocolProcessor_CONNECT_Test.java
index b13be265..c5826ed0 100644
--- a/broker/src/test/java/io/moquette/spi/impl/ProtocolProcessor_CONNECT_Test.java
+++ b/broker/src/test/java/io/moquette/spi/impl/ProtocolProcessor_CONNECT_Test.java
@@ -43,10 +43,6 @@ import static io.netty.handler.codec.mqtt.MqttConnectReturnCode.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-/**
- *
- * @author andrea
- */
public class ProtocolProcessor_CONNECT_Test {
EmbeddedChannel m_session;
diff --git a/broker/src/test/java/io/moquette/spi/impl/security/ACLFileParserTest.java b/broker/src/test/java/io/moquette/spi/impl/security/ACLFileParserTest.java
index 7914916d..b677f744 100644
--- a/broker/src/test/java/io/moquette/spi/impl/security/ACLFileParserTest.java
+++ b/broker/src/test/java/io/moquette/spi/impl/security/ACLFileParserTest.java
@@ -23,9 +23,6 @@ import java.io.StringReader;
import java.text.ParseException;
import static org.junit.Assert.*;
-/**
- * @author andrea
- */
public class ACLFileParserTest {
@Test
diff --git a/broker/src/test/java/io/moquette/spi/impl/security/AuthorizationsCollectorTest.java b/broker/src/test/java/io/moquette/spi/impl/security/AuthorizationsCollectorTest.java
index 082b00a1..d98f87a2 100644
--- a/broker/src/test/java/io/moquette/spi/impl/security/AuthorizationsCollectorTest.java
+++ b/broker/src/test/java/io/moquette/spi/impl/security/AuthorizationsCollectorTest.java
@@ -22,9 +22,6 @@ import io.moquette.spi.impl.subscriptions.Topic;
import java.text.ParseException;
import static org.junit.Assert.*;
-/**
- * @author andrea
- */
public class AuthorizationsCollectorTest {
private static final Authorization RW_ANEMOMETER = new Authorization(new Topic("/weather/italy/anemometer"));
diff --git a/broker/src/test/java/io/moquette/spi/impl/security/DBAuthenticatorTest.java b/broker/src/test/java/io/moquette/spi/impl/security/DBAuthenticatorTest.java
index 35767684..3ed70cc0 100644
--- a/broker/src/test/java/io/moquette/spi/impl/security/DBAuthenticatorTest.java
+++ b/broker/src/test/java/io/moquette/spi/impl/security/DBAuthenticatorTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl.security;
@@ -12,9 +27,6 @@ import java.sql.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-/**
- * Created by mackristof on 12/05/2016.
- */
public class DBAuthenticatorTest {
private static final Logger LOG = LoggerFactory.getLogger(DBAuthenticatorTest.class);
diff --git a/broker/src/test/java/io/moquette/spi/impl/security/FileAuthenticatorTest.java b/broker/src/test/java/io/moquette/spi/impl/security/FileAuthenticatorTest.java
index 63bd2b74..7b344653 100644
--- a/broker/src/test/java/io/moquette/spi/impl/security/FileAuthenticatorTest.java
+++ b/broker/src/test/java/io/moquette/spi/impl/security/FileAuthenticatorTest.java
@@ -21,10 +21,7 @@ import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-/**
- *
- * @author andrea
- */
+@SuppressWarnings("deprecation")
public class FileAuthenticatorTest {
@Test
diff --git a/broker/src/test/java/io/moquette/spi/impl/subscriptions/SubscriptionsStoreTest.java b/broker/src/test/java/io/moquette/spi/impl/subscriptions/SubscriptionsStoreTest.java
index e7651f03..c2352f27 100644
--- a/broker/src/test/java/io/moquette/spi/impl/subscriptions/SubscriptionsStoreTest.java
+++ b/broker/src/test/java/io/moquette/spi/impl/subscriptions/SubscriptionsStoreTest.java
@@ -27,10 +27,6 @@ import java.io.IOException;
import java.util.List;
import static org.assertj.core.api.Assertions.*;
-/**
- *
- * @author andrea
- */
public class SubscriptionsStoreTest {
private SubscriptionsStore store;
diff --git a/broker/src/test/java/io/moquette/spi/impl/subscriptions/TreeNodeTest.java b/broker/src/test/java/io/moquette/spi/impl/subscriptions/TreeNodeTest.java
index 1a5109cf..431997ba 100644
--- a/broker/src/test/java/io/moquette/spi/impl/subscriptions/TreeNodeTest.java
+++ b/broker/src/test/java/io/moquette/spi/impl/subscriptions/TreeNodeTest.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
+
package io.moquette.spi.impl.subscriptions;
import io.moquette.spi.ISessionsStore;
@@ -5,9 +21,6 @@ import org.junit.Test;
import static org.junit.Assert.*;
-/**
- * Created by andrea on 03/03/17.
- */
public class TreeNodeTest {
@Test
@@ -54,7 +67,8 @@ public class TreeNodeTest {
TreeNode updatedRoot = root.removeClientSubscriptions("Client1");
- assertFalse("Remove a subscription shouldn't remove intermediate empty nodes", updatedRoot.m_children.isEmpty());
+ assertFalse("Remove a subscription shouldn't remove intermediate empty nodes",
+ updatedRoot.m_children.isEmpty());
}
}
diff --git a/broker/src/test/java/io/moquette/testclient/Client.java b/broker/src/test/java/io/moquette/testclient/Client.java
index e7115de3..a98b4d39 100644
--- a/broker/src/test/java/io/moquette/testclient/Client.java
+++ b/broker/src/test/java/io/moquette/testclient/Client.java
@@ -32,8 +32,6 @@ import java.util.concurrent.TimeUnit;
/**
* Class used just to send and receive MQTT messages without any protocol login in action, just use
* the encoder/decoder part.
- *
- * @author andrea
*/
public class Client {
@@ -46,7 +44,7 @@ public class Client {
final ClientNettyMQTTHandler handler = new ClientNettyMQTTHandler();
EventLoopGroup workerGroup;
Channel m_channel;
- private boolean m_connectionLost = false;
+ private boolean m_connectionLost;
private ICallback callback;
private String clientId;
private MqttMessage receivedMsg;
diff --git a/broker/src/test/java/io/moquette/testclient/ClientNettyMQTTHandler.java b/broker/src/test/java/io/moquette/testclient/ClientNettyMQTTHandler.java
index 2a58ce07..76d28424 100644
--- a/broker/src/test/java/io/moquette/testclient/ClientNettyMQTTHandler.java
+++ b/broker/src/test/java/io/moquette/testclient/ClientNettyMQTTHandler.java
@@ -24,10 +24,6 @@ import io.netty.handler.codec.mqtt.MqttMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/**
- *
- * @author andrea
- */
@ChannelHandler.Sharable
class ClientNettyMQTTHandler extends ChannelInboundHandlerAdapter {
diff --git a/broker/src/test/java/io/moquette/testclient/RawClient.java b/broker/src/test/java/io/moquette/testclient/RawClient.java
index 96a54ce3..81ad8348 100644
--- a/broker/src/test/java/io/moquette/testclient/RawClient.java
+++ b/broker/src/test/java/io/moquette/testclient/RawClient.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.testclient;
@@ -21,7 +36,7 @@ import java.util.concurrent.TimeUnit;
* This class is used to have a fluent interface to interact with a server. Inspired by
* org.kaazing.robot
*/
-public class RawClient {
+public final class RawClient {
@ChannelHandler.Sharable
class RawMessageHandler extends ChannelInboundHandlerAdapter {
@@ -52,7 +67,7 @@ public class RawClient {
EventLoopGroup workerGroup;
Channel m_channel;
- private boolean connected = false;
+ private boolean connected;
private ByteBuf heapBuffer;
private CountDownLatch disconnectLatch;
private final Semaphore readableBytesSem;
diff --git a/embedding_moquette/src/main/java/io/moquette/testembedded/EmbeddedLauncher.java b/embedding_moquette/src/main/java/io/moquette/testembedded/EmbeddedLauncher.java
index dcbba09c..719da782 100644
--- a/embedding_moquette/src/main/java/io/moquette/testembedded/EmbeddedLauncher.java
+++ b/embedding_moquette/src/main/java/io/moquette/testembedded/EmbeddedLauncher.java
@@ -15,34 +15,36 @@
*/
package io.moquette.testembedded;
- import io.moquette.interception.AbstractInterceptHandler;
- import io.moquette.interception.InterceptHandler;
- import io.moquette.interception.messages.InterceptPublishMessage;
- import io.moquette.server.Server;
- import io.moquette.server.config.ClasspathResourceLoader;
- import io.moquette.server.config.IConfig;
- import io.moquette.server.config.IResourceLoader;
- import io.moquette.server.config.ResourceLoaderConfig;
- import io.moquette.server.netty.MessageBuilder;
- import io.netty.handler.codec.mqtt.MqttPublishMessage;
- import io.netty.handler.codec.mqtt.MqttQoS;
+import io.moquette.interception.AbstractInterceptHandler;
+import io.moquette.interception.InterceptHandler;
+import io.moquette.interception.messages.InterceptPublishMessage;
+import io.moquette.server.Server;
+import io.moquette.server.config.ClasspathResourceLoader;
+import io.moquette.server.config.IConfig;
+import io.moquette.server.config.IResourceLoader;
+import io.moquette.server.config.ResourceLoaderConfig;
+import io.moquette.server.netty.MessageBuilder;
+import io.netty.handler.codec.mqtt.MqttPublishMessage;
+import io.netty.handler.codec.mqtt.MqttQoS;
- import java.io.IOException;
- import java.util.List;
+import java.io.IOException;
+import java.util.List;
- import static java.util.Arrays.asList;
+import static java.util.Arrays.asList;
+
+final class EmbeddedLauncher {
- public class EmbeddedLauncher {
static class PublisherListener extends AbstractInterceptHandler {
-
- @Override
- public String getID() {
- return "EmbeddedLauncherPublishListener";
- }
+
+ @Override
+ public String getID() {
+ return "EmbeddedLauncherPublishListener";
+ }
@Override
public void onPublish(InterceptPublishMessage msg) {
- System.out.println("Received on topic: " + msg.getTopicName() + " content: " + new String(msg.getPayload().array()));
+ System.out.println(
+ "Received on topic: " + msg.getTopicName() + " content: " + new String(msg.getPayload().array()));
}
}
@@ -78,4 +80,7 @@ package io.moquette.testembedded;
mqttBroker.internalPublish(message, "INTRLPUB");
System.out.println("After self publish");
}
+
+ private EmbeddedLauncher() {
+ }
}
diff --git a/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBMessagesStore.java b/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBMessagesStore.java
index b4ea2e90..82375454 100644
--- a/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBMessagesStore.java
+++ b/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBMessagesStore.java
@@ -28,8 +28,6 @@ import java.util.concurrent.ConcurrentMap;
/**
* IMessagesStore implementation backed by MapDB.
- *
- * @author andrea
*/
class MapDBMessagesStore implements IMessagesStore {
diff --git a/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBPersistentStore.java b/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBPersistentStore.java
index 6e42657d..0a421998 100644
--- a/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBPersistentStore.java
+++ b/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBPersistentStore.java
@@ -27,7 +27,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
-import java.io.Serializable;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -48,7 +47,8 @@ public class MapDBPersistentStore implements IStore {
public MapDBPersistentStore(IConfig props, ScheduledExecutorService scheduler) {
this.m_storePath = props.getProperty(BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME, "");
- this.m_autosaveInterval = Integer.parseInt(props.getProperty(BrokerConstants.AUTOSAVE_INTERVAL_PROPERTY_NAME, "30"));
+ this.m_autosaveInterval = Integer
+ .parseInt(props.getProperty(BrokerConstants.AUTOSAVE_INTERVAL_PROPERTY_NAME, "30"));
this.m_scheduler = scheduler;
}
diff --git a/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBSessionsStore.java b/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBSessionsStore.java
index 7e8f9e2b..f97922f7 100644
--- a/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBSessionsStore.java
+++ b/mapdb_storage/src/main/java/io/moquette/persistence/mapdb/MapDBSessionsStore.java
@@ -36,8 +36,6 @@ import java.util.concurrent.ConcurrentMap;
/**
* ISessionsStore implementation backed by MapDB.
- *
- * @author andrea
*/
class MapDBSessionsStore implements ISessionsStore {
diff --git a/osgi_test/src/test/java/io/moquette/test/osgi/MoquetteOsgiTest.java b/osgi_test/src/test/java/io/moquette/test/osgi/MoquetteOsgiTest.java
index 491cdf25..48b01fb6 100644
--- a/osgi_test/src/test/java/io/moquette/test/osgi/MoquetteOsgiTest.java
+++ b/osgi_test/src/test/java/io/moquette/test/osgi/MoquetteOsgiTest.java
@@ -26,7 +26,6 @@ import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
import javax.inject.Inject;
@@ -38,7 +37,7 @@ import javax.inject.Inject;
public class MoquetteOsgiTest {
@Inject
private BundleContext bundleContext;
-
+
@Configuration
public Option[] config() {
diff --git a/perf/src/main/java/io/moquette/parser/netty/performance/BenchmarkPublisher.java b/perf/src/main/java/io/moquette/parser/netty/performance/BenchmarkPublisher.java
index c974d4ff..e1bf7ba7 100644
--- a/perf/src/main/java/io/moquette/parser/netty/performance/BenchmarkPublisher.java
+++ b/perf/src/main/java/io/moquette/parser/netty/performance/BenchmarkPublisher.java
@@ -1,5 +1,20 @@
-package io.moquette.parser.netty.performance;
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
+package io.moquette.parser.netty.performance;
import org.eclipse.jetty.toolchain.perf.PlatformTimer;
import org.eclipse.paho.client.mqttv3.*;
@@ -27,13 +42,11 @@ class BenchmarkPublisher {
private final long startedTime;
private final long numToSend;
- private final IMqttAsyncClient connection;
private final CountDownLatch stopLatch;
ExitTopicCallback(long startedTime, long numToSend, IMqttAsyncClient connection, CountDownLatch stopLatch) {
this.startedTime = startedTime;
this.numToSend = numToSend;
- this.connection = connection;
this.stopLatch = stopLatch;
}
@@ -48,7 +61,7 @@ class BenchmarkPublisher {
// LOG.error("Disconnect error", mex);
// }
double msgPerSec = (numToSend / spentTime) * 1000;
- LOG.info( "PUB: speed {} msg/sec", msgPerSec);
+ LOG.info("PUB: speed {} msg/sec", msgPerSec);
this.stopLatch.countDown();
}
@@ -58,15 +71,15 @@ class BenchmarkPublisher {
}
}
- private int qos = 0;
- private boolean retain = false;
+ private int qos;
+ private boolean retain;
private final int numToSend;
private final int messagesPerSecond;
private final String dialog_id;
private final IMqttAsyncClient client;
private CountDownLatch m_latch;
- public BenchmarkPublisher(MqttAsyncClient client, int numToSend, int messagesPerSecond, String dialog_id) {
+ BenchmarkPublisher(MqttAsyncClient client, int numToSend, int messagesPerSecond, String dialog_id) {
this.client = client;
this.numToSend = numToSend;
this.messagesPerSecond = messagesPerSecond;
@@ -91,7 +104,7 @@ class BenchmarkPublisher {
}
public void firePublishes() throws MqttException {
- long pauseMicroseconds = (int)((1.0 / messagesPerSecond) * 1000 * 1000);
+ long pauseMicroseconds = (int) ((1.0 / messagesPerSecond) * 1000 * 1000);
LOG.info("PUB: Pause over the each message sent {} microsecs", pauseMicroseconds);
LOG.info("PUB: publishing..");
@@ -101,7 +114,7 @@ class BenchmarkPublisher {
//initialize the timer
PlatformTimer timer = PlatformTimer.detect();
IMqttActionListener pubCallback = new PublishCallback();
- for (int i=0; i < numToSend; i++) {
+ for (int i = 0; i < numToSend; i++) {
long nanos = System.nanoTime();
byte[] message = ("Hello world!!-" + nanos).getBytes();
this.client.publish("/topic" + dialog_id, message, qos, retain, null, pubCallback);
@@ -114,7 +127,6 @@ class BenchmarkPublisher {
this.client.publish("/exit" + dialog_id, exitMessage, qos, retain, null, exitCallback);
}
-
public void waitFinish() throws InterruptedException {
m_latch.await();
try {
diff --git a/perf/src/main/java/io/moquette/parser/netty/performance/BenchmarkSubscriber.java b/perf/src/main/java/io/moquette/parser/netty/performance/BenchmarkSubscriber.java
index 8b9eb14c..25e35e41 100644
--- a/perf/src/main/java/io/moquette/parser/netty/performance/BenchmarkSubscriber.java
+++ b/perf/src/main/java/io/moquette/parser/netty/performance/BenchmarkSubscriber.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
+
package io.moquette.parser.netty.performance;
import org.HdrHistogram.Histogram;
@@ -23,7 +39,6 @@ class BenchmarkSubscriber {
//println "Received a publish on topic ${topic}"
if (topic.startsWith("/exit")) {
LOG.info("SUB: ok Exit!");
- exit = true;
LOG.debug("Before disconnect");
// client.disconnect(1000) //wait max 1 sec
//client.disconnectForcibly()
@@ -31,11 +46,11 @@ class BenchmarkSubscriber {
LOG.debug("After disconnect");
long stopTime = System.currentTimeMillis();
long spentTime = stopTime - startTime;
- LOG.info( "SUB: {} received", topic);
- LOG.info( "SUB: subscriber disconnected, received {} messages in {} ms", numReceived, spentTime);
+ LOG.info("SUB: {} received", topic);
+ LOG.info("SUB: subscriber disconnected, received {} messages in {} ms", numReceived, spentTime);
double msgPerSec = (numReceived / spentTime) * 1000;
- LOG.info( "SUB: Speed: {} msg/sec", msgPerSec);
- LOG.info( "SUB: Latency diagram [microsecs]");
+ LOG.info("SUB: Speed: {} msg/sec", msgPerSec);
+ LOG.info("SUB: Latency diagram [microsecs]");
histogram.outputPercentileDistribution(System.out, 1000.0); //nanos/1000
m_latch.countDown();
} else {
@@ -50,7 +65,6 @@ class BenchmarkSubscriber {
// print '.'
// }
}
-
}
public void connectionLost(Throwable cause) {
@@ -65,22 +79,19 @@ class BenchmarkSubscriber {
}
public void deliveryComplete(IMqttDeliveryToken token) {
-
}
-
}
- private int numReceived = 0;
+ private int numReceived;
private long startTime = System.currentTimeMillis();
- private boolean exit = false;
private CountDownLatch m_latch = new CountDownLatch(1);
- private boolean alreadyStarted = false;
+ private boolean alreadyStarted;
private Histogram histogram = new Histogram(5);
private final IMqttAsyncClient client;
private final String dialog_id;
- public BenchmarkSubscriber(MqttAsyncClient client, String dialog_id) {
+ BenchmarkSubscriber(MqttAsyncClient client, String dialog_id) {
this.client = client;
this.dialog_id = dialog_id;
}
@@ -92,7 +103,7 @@ class BenchmarkSubscriber {
this.client.connect(connectOptions, null, new IMqttActionListener() {
public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
- LOG.error( "SUB: connect fail", exception);
+ LOG.error("SUB: connect fail", exception);
System.exit(2);
}
@@ -137,10 +148,9 @@ class BenchmarkSubscriber {
});
}
-
public void waitFinish() throws InterruptedException, MqttException {
this.m_latch.await();
this.client.disconnect(1000);
}
-}
\ No newline at end of file
+}
diff --git a/perf/src/main/java/io/moquette/parser/netty/performance/LoopMQTTHandler.java b/perf/src/main/java/io/moquette/parser/netty/performance/LoopMQTTHandler.java
index e80c1f50..9896c79f 100644
--- a/perf/src/main/java/io/moquette/parser/netty/performance/LoopMQTTHandler.java
+++ b/perf/src/main/java/io/moquette/parser/netty/performance/LoopMQTTHandler.java
@@ -1,6 +1,21 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
+
package io.moquette.parser.netty.performance;
-import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
@@ -24,7 +39,7 @@ class LoopMQTTHandler extends ChannelInboundHandlerAdapter {
Histogram processingTime = new Histogram(5);
Histogram forthNetworkTime = new Histogram(5);
- public LoopMQTTHandler(ProtocolDecodingServer.SharedState state) {
+ LoopMQTTHandler(ProtocolDecodingServer.SharedState state) {
this.m_state = state;
}
@@ -63,7 +78,12 @@ class LoopMQTTHandler extends ChannelInboundHandlerAdapter {
// m_messaging.handleProtocolMessage(channel, msg);
break;
case PINGREQ:
- MqttFixedHeader pingHeader = new MqttFixedHeader(MqttMessageType.PINGRESP, false, AT_MOST_ONCE, false, 0);
+ MqttFixedHeader pingHeader = new MqttFixedHeader(
+ MqttMessageType.PINGRESP,
+ false,
+ AT_MOST_ONCE,
+ false,
+ 0);
MqttMessage pingResp = new MqttMessage(pingHeader);
ctx.writeAndFlush(pingResp);
break;
@@ -111,7 +131,10 @@ class LoopMQTTHandler extends ChannelInboundHandlerAdapter {
LOG.debug(" new value of flag {}, LoopHandler instance is {}", m_state.isForwardable(), this);
MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.SUBACK, false, AT_LEAST_ONCE, false, 0);
MqttSubAckPayload payload = new MqttSubAckPayload(AT_MOST_ONCE.value());
- MqttSubAckMessage ackMessage = new MqttSubAckMessage(fixedHeader, from(msg.variableHeader().messageId()), payload);
+ MqttSubAckMessage ackMessage = new MqttSubAckMessage(
+ fixedHeader,
+ from(msg.variableHeader().messageId()),
+ payload);
ctx.writeAndFlush(ackMessage);
LOG.debug("subscribed client to {}", msg.payload().topicSubscriptions());
}
@@ -183,4 +206,4 @@ class LoopMQTTHandler extends ChannelInboundHandlerAdapter {
private static String clientID(Channel channel) {
return (String) channel.attr(ATTR_KEY_CLIENTID).get();
}
-}
\ No newline at end of file
+}
diff --git a/perf/src/main/java/io/moquette/parser/netty/performance/NettyPublishReceiverHandler.java b/perf/src/main/java/io/moquette/parser/netty/performance/NettyPublishReceiverHandler.java
index 25389e29..9424074e 100644
--- a/perf/src/main/java/io/moquette/parser/netty/performance/NettyPublishReceiverHandler.java
+++ b/perf/src/main/java/io/moquette/parser/netty/performance/NettyPublishReceiverHandler.java
@@ -1,7 +1,22 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
+
package io.moquette.parser.netty.performance;
import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
@@ -12,14 +27,13 @@ import org.HdrHistogram.Histogram;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
@ChannelHandler.Sharable
class NettyPublishReceiverHandler extends ChannelInboundHandlerAdapter {
private static final Logger LOG = LoggerFactory.getLogger(NettyPublishReceiverHandler.class);
Histogram forthNetworkTime = new Histogram(5);
- public NettyPublishReceiverHandler() {
+ NettyPublishReceiverHandler() {
}
@Override
@@ -34,7 +48,7 @@ class NettyPublishReceiverHandler extends ChannelInboundHandlerAdapter {
handlePublish((MqttPublishMessage) msg);
return;
default:
- LOG.info("Received a message of type {}",type);
+ LOG.info("Received a message of type {}", type);
}
} catch (Exception ex) {
LOG.error("Bad error in processing the message", ex);
@@ -65,7 +79,6 @@ class NettyPublishReceiverHandler extends ChannelInboundHandlerAdapter {
return new String(rawBytes);
}
-
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
LOG.info("Received channel inactive");
@@ -75,4 +88,4 @@ class NettyPublishReceiverHandler extends ChannelInboundHandlerAdapter {
this.forthNetworkTime.outputPercentileDistribution(System.out, 1000.0);
}
-}
\ No newline at end of file
+}
diff --git a/perf/src/main/java/io/moquette/parser/netty/performance/ProtocolDecodingServer.java b/perf/src/main/java/io/moquette/parser/netty/performance/ProtocolDecodingServer.java
index 7981c810..c2dbbdf3 100644
--- a/perf/src/main/java/io/moquette/parser/netty/performance/ProtocolDecodingServer.java
+++ b/perf/src/main/java/io/moquette/parser/netty/performance/ProtocolDecodingServer.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
+
package io.moquette.parser.netty.performance;
import io.netty.bootstrap.ServerBootstrap;
@@ -47,7 +63,7 @@ public class ProtocolDecodingServer {
static final class SharedState {
private volatile Channel subscriberCh;
private volatile Channel publisherCh;
- private volatile boolean forwardPublish = false;
+ private volatile boolean forwardPublish;
public boolean isForwardable() {
return forwardPublish;
@@ -68,6 +84,10 @@ public class ProtocolDecodingServer {
public void setPublisherCh(Channel publisherCh) {
this.publisherCh = publisherCh;
}
+
+ public Channel getPublisherCh() {
+ return publisherCh;
+ }
}
final SharedState state = new SharedState();
@@ -111,7 +131,6 @@ public class ProtocolDecodingServer {
}
}
-
public void stop() {
if (m_workerGroup == null) {
throw new IllegalStateException("Invoked close on an Acceptor that wasn't initialized");
@@ -149,9 +168,10 @@ public class ProtocolDecodingServer {
String tmpDir = System.getProperty("java.io.tmpdir");
MqttDefaultFilePersistence dataStore = new MqttDefaultFilePersistence(tmpDir);
- MqttAsyncClient pub = new MqttAsyncClient("tcp://" + host +":1883", "PublisherClient"+dialog_id, dataStore);
+ MqttAsyncClient pub = new MqttAsyncClient("tcp://" + host + ":1883", "PublisherClient" + dialog_id, dataStore);
MqttDefaultFilePersistence dataStoreSub = new MqttDefaultFilePersistence(tmpDir);
- MqttAsyncClient sub = new MqttAsyncClient("tcp://" + host +":1883", "SubscriberClient"+dialog_id, dataStoreSub);
+ MqttAsyncClient sub = new MqttAsyncClient("tcp://" + host + ":1883", "SubscriberClient" + dialog_id,
+ dataStoreSub);
BenchmarkSubscriber suscriberBench = new BenchmarkSubscriber(sub, dialog_id);
suscriberBench.connect();
diff --git a/perf/src/main/java/io/moquette/parser/netty/performance/ProtocolPublishDecodingServer.java b/perf/src/main/java/io/moquette/parser/netty/performance/ProtocolPublishDecodingServer.java
index ad4dc775..2804545a 100644
--- a/perf/src/main/java/io/moquette/parser/netty/performance/ProtocolPublishDecodingServer.java
+++ b/perf/src/main/java/io/moquette/parser/netty/performance/ProtocolPublishDecodingServer.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
+
package io.moquette.parser.netty.performance;
import io.netty.bootstrap.ServerBootstrap;
@@ -63,7 +79,6 @@ public class ProtocolPublishDecodingServer {
}
}
-
public void stop() {
if (m_workerGroup == null) {
throw new IllegalStateException("Invoked close on an Acceptor that wasn't initialized");
diff --git a/perf/src/main/java/io/moquette/parser/netty/performance/PublishBomber.java b/perf/src/main/java/io/moquette/parser/netty/performance/PublishBomber.java
index 4b57dbfa..d703e0bd 100644
--- a/perf/src/main/java/io/moquette/parser/netty/performance/PublishBomber.java
+++ b/perf/src/main/java/io/moquette/parser/netty/performance/PublishBomber.java
@@ -1,5 +1,20 @@
-package io.moquette.parser.netty.performance;
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
+package io.moquette.parser.netty.performance;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.ByteBuf;
@@ -52,9 +67,8 @@ class PublishBomber {
}
}
-
public void publishLoop(int messagesPerSecond, int numToSend) {
- long pauseMicroseconds = (int)((1.0 / messagesPerSecond) * 1000 * 1000);
+ long pauseMicroseconds = (int) ((1.0 / messagesPerSecond) * 1000 * 1000);
LOG.warn("PUB: Pause over the each message sent {} microsecs", pauseMicroseconds);
LOG.info("PUB: publishing..");
@@ -62,7 +76,7 @@ class PublishBomber {
//initialize the timer
PlatformTimer timer = PlatformTimer.detect();
- for (int i=0; i < numToSend; i++) {
+ for (int i = 0; i < numToSend; i++) {
long nanos = System.nanoTime();
byte[] rawContent = ("Hello world!!-" + nanos).getBytes();
ByteBuf payload = Unpooled.copiedBuffer(rawContent);
diff --git a/perf/src/main/java/io/moquette/parser/netty/performance/PublishReceiverHandler.java b/perf/src/main/java/io/moquette/parser/netty/performance/PublishReceiverHandler.java
index 5ab5234f..c5feca3b 100644
--- a/perf/src/main/java/io/moquette/parser/netty/performance/PublishReceiverHandler.java
+++ b/perf/src/main/java/io/moquette/parser/netty/performance/PublishReceiverHandler.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
+
package io.moquette.parser.netty.performance;
import io.netty.channel.ChannelHandler;
@@ -18,7 +34,7 @@ class PublishReceiverHandler extends ChannelInboundHandlerAdapter {
private static final Logger LOG = LoggerFactory.getLogger(PublishReceiverHandler.class);
Histogram forthNetworkTime = new Histogram(5);
- public PublishReceiverHandler() {
+ PublishReceiverHandler() {
}
@Override
@@ -61,4 +77,4 @@ class PublishReceiverHandler extends ChannelInboundHandlerAdapter {
this.forthNetworkTime.outputPercentileDistribution(System.out, 1000.0);
}
-}
\ No newline at end of file
+}
diff --git a/perf/src/main/java/io/moquette/spi/impl/subscriptions/PerformanceTest.java b/perf/src/main/java/io/moquette/spi/impl/subscriptions/PerformanceTest.java
index 9db77fcd..08e58b7d 100644
--- a/perf/src/main/java/io/moquette/spi/impl/subscriptions/PerformanceTest.java
+++ b/perf/src/main/java/io/moquette/spi/impl/subscriptions/PerformanceTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2012-2017 The original author or authors
+ * ------------------------------------------------------
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * The Apache License v2.0 is available at
+ * http://www.opensource.org/licenses/apache2.0.php
+ *
+ * You may elect to redistribute this code under either of these licenses.
+ */
package io.moquette.spi.impl.subscriptions;
@@ -9,7 +24,7 @@ import io.moquette.persistence.MemoryStorageService;
import io.moquette.spi.ISessionsStore;
import io.netty.handler.codec.mqtt.MqttQoS;
-public class PerformanceTest {
+public final class PerformanceTest {
// Set CPU governor and max frequency to lowest value for this test
/* debian:
@@ -75,11 +90,12 @@ public class PerformanceTest {
min = Math.min(min, time2);
// min.updateAndGet(c -> Math.min(c, time2));
System.out.println(".." + j + ": " + time2 + " min:" + min);
-
}
// });
System.out.println("min:" + min);
+ }
+ private PerformanceTest() {
}
}
diff --git a/pom.xml b/pom.xml
index 41308562..6b5b9c91 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,36 +65,40 @@
Luis Barrios
https://github.com/lbarriosh
-
Christophe Mourette
https://github.com/mackristof
-
Victor Kazakov
https://github.com/kazvictor
-
Neeme Praks
https://github.com/nemecec
-
Kevin Berendsen
https://github.com/kevto
-
Chris Schaefer
https://github.com/windbender
-
Keith Hughes
http://www.inhabitech.com/blog/author/keith/
+
+ Luca Capra
+ luca.capra@create-net.org
+
+
+ konradm
+
+
+ pkhanal
+
@@ -142,6 +146,7 @@
+ true
true