Remove unused imports, raw types and some deprecated method calls..

This commit is contained in:
Luis Barrios
2017-01-11 10:16:58 +01:00
parent 933763486c
commit 8481fada93
16 changed files with 21 additions and 25 deletions
@@ -9,7 +9,8 @@ import java.io.Serializable;
*/
public class HazelcastMsg implements Serializable {
private final String clientId;
private static final long serialVersionUID = 1L;
private final String clientId;
private final byte qos;
private final byte[] payload;
private final String topic;
@@ -11,7 +11,9 @@ public interface IResourceLoader {
String getName();
class ResourceIsDirectoryException extends RuntimeException {
public ResourceIsDirectoryException(String message) {
private static final long serialVersionUID = 1L;
public ResourceIsDirectoryException(String message) {
super(message);
}
}
@@ -17,7 +17,6 @@ package io.moquette.server.netty;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.timeout.IdleStateEvent;
import io.netty.util.concurrent.EventExecutor;
import java.util.concurrent.ScheduledFuture;
@@ -38,7 +38,6 @@ import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.codec.http.HttpResponseEncoder;
import io.netty.handler.codec.http.HttpServerCodec;
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
import io.netty.handler.codec.http.websocketx.Utf8FrameValidator;
import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
import io.netty.handler.ssl.SslHandler;
import io.netty.handler.timeout.IdleStateHandler;
@@ -16,7 +16,6 @@
package io.moquette.server.netty;
import io.moquette.server.Constants;
import io.moquette.spi.impl.ProtocolProcessor;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.util.Attribute;
@@ -34,7 +34,7 @@ public class BytesMetricsHandler extends ChannelDuplexHandler {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
Attribute<BytesMetrics> attr = ctx.attr(ATTR_KEY_METRICS);
Attribute<BytesMetrics> attr = ctx.channel().attr(ATTR_KEY_METRICS);
attr.set(new BytesMetrics());
super.channelActive(ctx);
@@ -42,14 +42,14 @@ public class BytesMetricsHandler extends ChannelDuplexHandler {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
BytesMetrics metrics = ctx.attr(ATTR_KEY_METRICS).get();
BytesMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get();
metrics.incrementRead(((ByteBuf)msg).readableBytes());
ctx.fireChannelRead(msg);
}
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
BytesMetrics metrics = ctx.attr(ATTR_KEY_METRICS).get();
BytesMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get();
metrics.incrementWrote(((ByteBuf)msg).writableBytes());
ctx.write(msg, promise);
}
@@ -58,7 +58,7 @@ public class BytesMetricsHandler extends ChannelDuplexHandler {
@Override
public void close(ChannelHandlerContext ctx,
ChannelPromise promise) throws Exception {
BytesMetrics metrics = ctx.attr(ATTR_KEY_METRICS).get();
BytesMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get();
m_collector.sumReadBytes(metrics.readBytes());
m_collector.sumWroteBytes(metrics.wroteBytes());
super.close(ctx, promise);
@@ -33,7 +33,7 @@ public class MessageMetricsHandler extends ChannelDuplexHandler {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
Attribute<MessageMetrics> attr = ctx.attr(ATTR_KEY_METRICS);
Attribute<MessageMetrics> attr = ctx.channel().attr(ATTR_KEY_METRICS);
attr.set(new MessageMetrics());
super.channelActive(ctx);
@@ -41,14 +41,14 @@ public class MessageMetricsHandler extends ChannelDuplexHandler {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
MessageMetrics metrics = ctx.attr(ATTR_KEY_METRICS).get();
MessageMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get();
metrics.incrementRead(1);
ctx.fireChannelRead(msg);
}
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
MessageMetrics metrics = ctx.attr(ATTR_KEY_METRICS).get();
MessageMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get();
metrics.incrementWrote(1);
ctx.write(msg, promise);
}
@@ -57,7 +57,7 @@ public class MessageMetricsHandler extends ChannelDuplexHandler {
@Override
public void close(ChannelHandlerContext ctx,
ChannelPromise promise) throws Exception {
MessageMetrics metrics = ctx.attr(ATTR_KEY_METRICS).get();
MessageMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get();
m_collector.sumReadMessages(metrics.messagesRead());
m_collector.sumWroteMessages(metrics.messagesWrote());
super.close(ctx, promise);
@@ -20,8 +20,6 @@ import java.nio.ByteBuffer;
import io.moquette.parser.proto.messages.AbstractMessage;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Defines the SPI to be implemented by a StorageService that handle persistence of messages
@@ -29,7 +27,8 @@ import java.util.concurrent.atomic.AtomicInteger;
public interface IMessagesStore {
class StoredMessage implements Serializable {
final AbstractMessage.QOSType m_qos;
private static final long serialVersionUID = 1L;
final AbstractMessage.QOSType m_qos;
final byte[] m_payload;
final String m_topic;
private boolean m_retained;
@@ -21,7 +21,8 @@ import java.io.Serializable;
* Value object for GUIDs of messages.
* */
public class MessageGUID implements Serializable {
private final String guid;
private static final long serialVersionUID = 1L;
private final String guid;
public MessageGUID(String guid) {
this.guid = guid;
@@ -12,7 +12,6 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.BlockingQueue;
class InternalRepublisher {
@@ -106,7 +106,6 @@ public class ProtocolProcessorBootstrapper {
subscriptions.init(m_sessionsStore);
String configPath = System.getProperty("moquette.path", null);
String authenticatorClassName = props.getProperty(BrokerConstants.AUTHENTICATOR_CLASS_NAME, "");
if (!authenticatorClassName.isEmpty()) {
@@ -22,7 +22,6 @@ public class DBAuthenticator implements IAuthenticator {
private static final Logger LOG = LoggerFactory.getLogger(DBAuthenticator.class);
private final String sqlQuery;
private final MessageDigest messageDigest;
private final PreparedStatement preparedStatement;
@@ -44,7 +43,6 @@ public class DBAuthenticator implements IAuthenticator {
*/
public DBAuthenticator(String driver, String jdbcUrl, String sqlQuery, String digestMethod){
this.sqlQuery = sqlQuery;
try {
Class.forName(driver);
final Connection connection = DriverManager.getConnection(jdbcUrl);
@@ -17,7 +17,6 @@ package io.moquette.spi.impl.security;
import io.moquette.server.config.IResourceLoader;
import io.moquette.spi.security.IAuthenticator;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -28,7 +28,8 @@ import io.moquette.spi.ISessionsStore.ClientTopicCouple;
*/
public final class Subscription implements Serializable {
final QOSType requestedQos; //max QoS acceptable
private static final long serialVersionUID = 1L;
final QOSType requestedQos; //max QoS acceptable
final String clientId;
final String topicFilter;
final boolean active;
@@ -45,7 +45,8 @@ public class MapDBPersistentStore {
* a session.
* */
public static class PersistentSession implements Serializable {
public final boolean cleanSession;
private static final long serialVersionUID = 1L;
public final boolean cleanSession;
public PersistentSession(boolean cleanSession) {
this.cleanSession = cleanSession;
@@ -16,7 +16,6 @@
package io.moquette.spi.persistence;
import io.moquette.spi.ClientSession;
import io.moquette.spi.IMessagesStore;
import io.moquette.spi.IMessagesStore.StoredMessage;
import io.moquette.spi.ISessionsStore;
import io.moquette.spi.MessageGUID;