Fixed mem leak due to caching of object without hasCode (NettyChannelContext

This commit is contained in:
andrea
2015-06-07 17:47:50 +02:00
parent 3ceabfabdd
commit 3f4a5586de
10 changed files with 120 additions and 68 deletions
@@ -30,7 +30,7 @@ public interface IMessaging {
void stop();
void lostConnection(ServerChannel session, String clientID);
void lostConnection(String clientID);
void handleProtocolMessage(ServerChannel session, AbstractMessage msg);
}
@@ -561,12 +561,12 @@ class ProtocolProcessor implements EventHandler<ValueEvent> {
void processConnectionLost(LostConnectionEvent evt) {
String clientID = evt.clientID;
if (m_clientIDs.containsKey(clientID)) {
if (!m_clientIDs.get(clientID).getSession().equals(evt.session)) {
LOG.info("Received a lost connection with client <{}> for a not matching session", clientID);
return;
}
}
// if (m_clientIDs.containsKey(clientID)) {
// if (!m_clientIDs.get(clientID).getSession().equals(evt.session)) {
// LOG.info("Received a lost connection with client <{}> for a not matching session", clientID);
// return;
// }
// }
//If already removed a disconnect message was already processed for this clientID
if (m_clientIDs.remove(clientID) != null) {
@@ -122,8 +122,8 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
}
@Override
public void lostConnection(ServerChannel session, String clientID) {
disruptorPublish(new LostConnectionEvent(session, clientID));
public void lostConnection(String clientID) {
disruptorPublish(new LostConnectionEvent(clientID));
}
@Override
@@ -23,11 +23,11 @@ import org.eclipse.moquette.server.ServerChannel;
* @author andrea
*/
public class LostConnectionEvent extends MessagingEvent {
public final ServerChannel session;
// public final ServerChannel session;
public final String clientID;
public LostConnectionEvent(ServerChannel session, String clientID) {
this.session = session;
public LostConnectionEvent(/*ServerChannel session, */String clientID) {
// this.session = session;
this.clientID = clientID;
}
}