mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
fixed issue with
This commit is contained in:
@@ -359,8 +359,7 @@ public final class TcpReplicator<K, V> extends AbstractChannelReplicator impleme
|
||||
|
||||
final Attached attached = (Attached) key.attachment();
|
||||
|
||||
// we wont attempt to reconnect the server socket
|
||||
if (attached.isServer || !attached.isHandShakingComplete())
|
||||
if (attached.isServer && !attached.isHandShakingComplete())
|
||||
return;
|
||||
|
||||
final SocketChannel channel = (SocketChannel) key.channel();
|
||||
@@ -371,6 +370,8 @@ public final class TcpReplicator<K, V> extends AbstractChannelReplicator impleme
|
||||
LOG.debug("lost connection, attempting to reconnect. " +
|
||||
"missed heartbeat from identifier=" + attached.remoteIdentifier);
|
||||
activeKeys.clear(attached.remoteIdentifier);
|
||||
quietClose(key, null);
|
||||
|
||||
closeables.closeQuietly(channel.socket());
|
||||
|
||||
// when node discovery is used ( by nodes broadcasting out their host:port over UDP ),
|
||||
@@ -390,8 +391,8 @@ public final class TcpReplicator<K, V> extends AbstractChannelReplicator impleme
|
||||
* @param key the SelectionKey
|
||||
* @param e the Exception that caused the issue
|
||||
*/
|
||||
private void quietClose(@NotNull final SelectionKey key, @NotNull final Exception e) {
|
||||
if (LOG.isDebugEnabled())
|
||||
private void quietClose(@NotNull final SelectionKey key, @Nullable final Exception e) {
|
||||
if (LOG.isDebugEnabled() && e != null)
|
||||
LOG.debug("", e);
|
||||
|
||||
if (key.channel() != null && key.attachment() != null && connectionListener != null)
|
||||
@@ -589,8 +590,10 @@ public final class TcpReplicator<K, V> extends AbstractChannelReplicator impleme
|
||||
|
||||
final SocketChannel channel = (SocketChannel) key.channel();
|
||||
if (channel != null && channel.socket() != null && connectionListener != null) {
|
||||
connectionListener.onConnect(channel.socket().getInetAddress(),
|
||||
attached.remoteIdentifier, attached.isServer);
|
||||
connectionListener.onConnect(
|
||||
channel.socket().getInetAddress(),
|
||||
attached.remoteIdentifier,
|
||||
attached.isServer);
|
||||
}
|
||||
|
||||
// we use the as iterating the activeKeys via the bitset wont create and Objects
|
||||
@@ -786,7 +789,7 @@ public final class TcpReplicator<K, V> extends AbstractChannelReplicator impleme
|
||||
|
||||
int len = attached.entryReader.readSocketToBuffer(socketChannel);
|
||||
if (len == -1) {
|
||||
socketChannel.register(selector, 0);
|
||||
socketChannel.register(selector, 0, attached);
|
||||
if (replicationConfig.autoReconnectedUponDroppedConnection()) {
|
||||
AbstractConnector connector = attached.connector;
|
||||
if (connector != null)
|
||||
|
||||
Reference in New Issue
Block a user