editorconfig: max line length set
max line length warnings removed missing Copyright added useless publics removed unmaintainable Javadoc tags: @author removed helper class warnings removed field default value initialization removed Multiple warnings removed pref: checkstyle warnings removed Checkstyle will fail the build process if it detects violations switch default cases error logger added
This commit is contained in:
@@ -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 {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<HazelcastMsg> {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(HazelcastListener.class);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ import io.moquette.BrokerConstants;
|
||||
|
||||
/**
|
||||
* Base interface for all configuration implementations (filesystem, memory or classpath)
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public abstract class IConfig {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@ import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Configuration backed by memory.
|
||||
*
|
||||
* @author andrea
|
||||
*/
|
||||
public class MemoryConfig extends IConfig {
|
||||
|
||||
|
||||
@@ -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<String> 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() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user