Skip to content

Commit

Permalink
remove unused codes and imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ctlove0523 committed Feb 18, 2022
1 parent 15d5494 commit 9e9015f
Show file tree
Hide file tree
Showing 10 changed files with 5 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.mqtt.*;
import io.netty.handler.timeout.IdleStateHandler;
import io.netty.util.ReferenceCountUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

import static io.netty.channel.ChannelFutureListener.CLOSE_ON_FAILURE;

@Sharable
Expand Down Expand Up @@ -97,9 +95,6 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {

@Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) {
// if (ctx.channel().isWritable()) {
// m_processor.notifyChannelWritable(ctx.channel());
// }
final MQTTConnection mqttConnection = mqttConnection(ctx.channel());
mqttConnection.writabilityChanged();
ctx.fireChannelWritabilityChanged();
Expand Down
2 changes: 1 addition & 1 deletion broker/src/main/java/io/moquette/broker/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

public class Server {

private static final Logger LOG = LoggerFactory.getLogger(io.moquette.broker.Server.class);
private static final Logger LOG = LoggerFactory.getLogger(Server.class);

private ScheduledExecutorService scheduler;
private NewNettyAcceptor acceptor;
Expand Down
4 changes: 0 additions & 4 deletions broker/src/main/java/io/moquette/broker/config/IConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ public abstract class IConfig {
void assignDefaults() {
setProperty(BrokerConstants.PORT_PROPERTY_NAME, Integer.toString(BrokerConstants.PORT));
setProperty(BrokerConstants.HOST_PROPERTY_NAME, BrokerConstants.HOST);
// setProperty(BrokerConstants.WEB_SOCKET_PORT_PROPERTY_NAME,
// Integer.toString(BrokerConstants.WEBSOCKET_PORT));
setProperty(BrokerConstants.PASSWORD_FILE_PROPERTY_NAME, "");
// setProperty(BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME,
// BrokerConstants.DEFAULT_PERSISTENT_PATH);
setProperty(BrokerConstants.ALLOW_ANONYMOUS_PROPERTY_NAME, Boolean.TRUE.toString());
setProperty(BrokerConstants.AUTHENTICATOR_CLASS_NAME, "");
setProperty(BrokerConstants.AUTHORIZATOR_CLASS_NAME, "");
Expand Down
13 changes: 0 additions & 13 deletions broker/src/main/java/io/moquette/broker/config/MemoryConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,6 @@ public MemoryConfig(Properties properties) {
}
}

// private void createDefaults() {
// m_properties.put(BrokerConstants.PORT_PROPERTY_NAME, Integer.toString(BrokerConstants.PORT));
// m_properties.put(BrokerConstants.HOST_PROPERTY_NAME, BrokerConstants.HOST);
// m_properties.put(BrokerConstants.WEB_SOCKET_PORT_PROPERTY_NAME,
// Integer.toString(BrokerConstants.WEBSOCKET_PORT));
// m_properties.put(BrokerConstants.PASSWORD_FILE_PROPERTY_NAME, "");
// m_properties.put(BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME,
// BrokerConstants.DEFAULT_PERSISTENT_PATH);
// m_properties.put(BrokerConstants.ALLOW_ANONYMOUS_PROPERTY_NAME, true);
// m_properties.put(BrokerConstants.AUTHENTICATOR_CLASS_NAME, "");
// m_properties.put(BrokerConstants.AUTHORIZATOR_CLASS_NAME, "");
// }

@Override
public void setProperty(String name, String value) {
m_properties.setProperty(name, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ public void init(IConfig props) {
this.publishesMetrics = metrics.meter("publish.requests");
this.subscribeMetrics = metrics.meter("subscribe.requests");
this.connectedClientsMetrics = metrics.counter("connect.num_clients");
// ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics)
// .convertRatesTo(TimeUnit.SECONDS)
// .convertDurationsTo(TimeUnit.MILLISECONDS)
// .build();
// reporter.start(1, TimeUnit.MINUTES);
final String email = props.getProperty(METRICS_LIBRATO_EMAIL_PROPERTY_NAME);
final String token = props.getProperty(METRICS_LIBRATO_TOKEN_PROPERTY_NAME);
final String source = props.getProperty(METRICS_LIBRATO_SOURCE_PROPERTY_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public synchronized boolean checkValid(String clientId, String username, byte[]
conn.close();
}
} catch (SQLException e) {
LOG.error("Error releasing connection to the datasource", username, e);
LOG.error("Error releasing connection to the datasource, username = {},exception = {}", username, e);
}
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package io.moquette.broker.subscriptions;

import java.util.Objects;

/**
* Internal use only class.
*/
Expand Down Expand Up @@ -62,10 +64,7 @@ public boolean equals(Object obj) {
return false;
}
final Token other = (Token) obj;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
return Objects.equals(this.name, other.name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.h2.mvstore.DataUtils;
import org.h2.mvstore.WriteBuffer;

import java.nio.ByteBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public Set<Subscription> listAllSubscriptions() {
Set<Subscription> results = new HashSet<>();
Cursor<String, Subscription> mapCursor = subscriptions.cursor(null);
while (mapCursor.hasNext()) {
String subscriptionStr = mapCursor.next();
results.add(mapCursor.getValue());
}
LOG.debug("Loaded {} subscriptions", results.size());
Expand Down

0 comments on commit 9e9015f

Please sign in to comment.