sessionManager notify cleanup
This commit is contained in:
parent
1af118f468
commit
b4a05689f0
@ -365,7 +365,7 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements ICryptoConn
|
|||||||
if (logger2.isTraceEnabled()) {
|
if (logger2.isTraceEnabled()) {
|
||||||
logger2.trace("Sending LOCAL {}", message);
|
logger2.trace("Sending LOCAL {}", message);
|
||||||
}
|
}
|
||||||
this.sessionManager.notifyOnMessage(this, message);
|
this.sessionManager.onMessage(this, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -511,7 +511,7 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements ICryptoConn
|
|||||||
// } else
|
// } else
|
||||||
if (event instanceof IdleStateEvent) {
|
if (event instanceof IdleStateEvent) {
|
||||||
if (((IdleStateEvent) event).state() == IdleState.ALL_IDLE) {
|
if (((IdleStateEvent) event).state() == IdleState.ALL_IDLE) {
|
||||||
this.sessionManager.notifyOnIdle(this);
|
this.sessionManager.onIdle(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,7 +532,7 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements ICryptoConn
|
|||||||
// delay close until it's finished.
|
// delay close until it's finished.
|
||||||
this.messageInProgress.set(true);
|
this.messageInProgress.set(true);
|
||||||
|
|
||||||
this.sessionManager.notifyOnMessage(this, object);
|
this.sessionManager.onMessage(this, object);
|
||||||
|
|
||||||
this.messageInProgress.set(false);
|
this.messageInProgress.set(false);
|
||||||
|
|
||||||
@ -594,7 +594,7 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements ICryptoConn
|
|||||||
if (isTCP || channelClass == LocalChannel.class) {
|
if (isTCP || channelClass == LocalChannel.class) {
|
||||||
// this is because channelInactive can ONLY happen when netty shuts down the channel.
|
// this is because channelInactive can ONLY happen when netty shuts down the channel.
|
||||||
// and connection.close() can be called by the user.
|
// and connection.close() can be called by the user.
|
||||||
this.sessionManager.connectionDisconnected(this);
|
this.sessionManager.onDisconnected(this);
|
||||||
|
|
||||||
// close TCP/UDP together!
|
// close TCP/UDP together!
|
||||||
close();
|
close();
|
||||||
|
@ -300,7 +300,7 @@ class ConnectionManager<C extends Connection> implements Listeners, ISessionMana
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final
|
public final
|
||||||
void notifyOnMessage(final C connection, final Object message) {
|
void onMessage(final C connection, final Object message) {
|
||||||
notifyOnMessage0(connection, message, false);
|
notifyOnMessage0(connection, message, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ class ConnectionManager<C extends Connection> implements Listeners, ISessionMana
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final
|
public final
|
||||||
void notifyOnIdle(final C connection) {
|
void onIdle(final C connection) {
|
||||||
boolean foundListener = onIdleManager.notifyIdle(connection, shutdown);
|
boolean foundListener = onIdleManager.notifyIdle(connection, shutdown);
|
||||||
|
|
||||||
if (foundListener) {
|
if (foundListener) {
|
||||||
@ -355,7 +355,7 @@ class ConnectionManager<C extends Connection> implements Listeners, ISessionMana
|
|||||||
final IdentityMap<Connection, ConnectionManager<C>> localManagers = localManagersREF.get(this);
|
final IdentityMap<Connection, ConnectionManager<C>> localManagers = localManagersREF.get(this);
|
||||||
ConnectionManager<C> localManager = localManagers.get(connection);
|
ConnectionManager<C> localManager = localManagers.get(connection);
|
||||||
if (localManager != null) {
|
if (localManager != null) {
|
||||||
localManager.notifyOnIdle(connection);
|
localManager.onIdle(connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ class ConnectionManager<C extends Connection> implements Listeners, ISessionMana
|
|||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void connectionConnected(final C connection) {
|
void onConnected(final C connection) {
|
||||||
addConnection(connection);
|
addConnection(connection);
|
||||||
|
|
||||||
boolean foundListener = onConnectedManager.notifyConnected(connection, shutdown);
|
boolean foundListener = onConnectedManager.notifyConnected(connection, shutdown);
|
||||||
@ -382,7 +382,7 @@ class ConnectionManager<C extends Connection> implements Listeners, ISessionMana
|
|||||||
final IdentityMap<Connection, ConnectionManager<C>> localManagers = localManagersREF.get(this);
|
final IdentityMap<Connection, ConnectionManager<C>> localManagers = localManagersREF.get(this);
|
||||||
ConnectionManager<C> localManager = localManagers.get(connection);
|
ConnectionManager<C> localManager = localManagers.get(connection);
|
||||||
if (localManager != null) {
|
if (localManager != null) {
|
||||||
localManager.connectionConnected(connection);
|
localManager.onConnected(connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ class ConnectionManager<C extends Connection> implements Listeners, ISessionMana
|
|||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void connectionDisconnected(final C connection) {
|
void onDisconnected(final C connection) {
|
||||||
boolean foundListener = onDisconnectedManager.notifyDisconnected(connection, shutdown);
|
boolean foundListener = onDisconnectedManager.notifyDisconnected(connection, shutdown);
|
||||||
|
|
||||||
if (foundListener) {
|
if (foundListener) {
|
||||||
@ -408,7 +408,7 @@ class ConnectionManager<C extends Connection> implements Listeners, ISessionMana
|
|||||||
final IdentityMap<Connection, ConnectionManager<C>> localManagers = localManagersREF.get(this);
|
final IdentityMap<Connection, ConnectionManager<C>> localManagers = localManagersREF.get(this);
|
||||||
ConnectionManager<C> localManager = localManagers.get(connection);
|
ConnectionManager<C> localManager = localManagers.get(connection);
|
||||||
if (localManager != null) {
|
if (localManager != null) {
|
||||||
localManager.connectionDisconnected(connection);
|
localManager.onDisconnected(connection);
|
||||||
|
|
||||||
// remove myself from the "global" listeners so we can have our memory cleaned up.
|
// remove myself from the "global" listeners so we can have our memory cleaned up.
|
||||||
removeListenerManager(connection);
|
removeListenerManager(connection);
|
||||||
@ -725,7 +725,7 @@ class ConnectionManager<C extends Connection> implements Listeners, ISessionMana
|
|||||||
c = current.getValue();
|
c = current.getValue();
|
||||||
current = current.next();
|
current = current.next();
|
||||||
|
|
||||||
notifyOnMessage(c, message);
|
onMessage(c, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ class EndPoint<C extends Connection> {
|
|||||||
// prep the channel wrapper
|
// prep the channel wrapper
|
||||||
connection.prep();
|
connection.prep();
|
||||||
|
|
||||||
this.connectionManager.connectionConnected((C) connection);
|
this.connectionManager.onConnected((C) connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,17 +22,17 @@ interface ISessionManager<C extends Connection> {
|
|||||||
/**
|
/**
|
||||||
* Called when a message is received
|
* Called when a message is received
|
||||||
*/
|
*/
|
||||||
void notifyOnMessage(C connection, Object message);
|
void onMessage(C connection, Object message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the connection has been idle (read & write) for 2 seconds
|
* Called when the connection has been idle (read & write) for 2 seconds
|
||||||
*/
|
*/
|
||||||
void notifyOnIdle(C connection);
|
void onIdle(C connection);
|
||||||
|
|
||||||
|
|
||||||
void connectionConnected(C connection);
|
void onConnected(C connection);
|
||||||
|
|
||||||
void connectionDisconnected(C connection);
|
void onDisconnected(C connection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a non-modifiable list of active connections. This is extremely slow, and not recommended!
|
* Returns a non-modifiable list of active connections. This is extremely slow, and not recommended!
|
||||||
|
Loading…
Reference in New Issue
Block a user