Skip to content

Commit

Permalink
Added connectionType probe
Browse files Browse the repository at this point in the history
Added the connection type probe to TcpIpConnection

fixes hazelcast#8540
  • Loading branch information
pveentjer committed Jul 18, 2016
1 parent c0ea17d commit 01b2972
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.hazelcast.nio.tcp;

import com.hazelcast.internal.metrics.Probe;
import com.hazelcast.logging.ILogger;
import com.hazelcast.nio.Address;
import com.hazelcast.nio.Connection;
Expand Down Expand Up @@ -100,6 +101,12 @@ public void setType(ConnectionType type) {
}
}

@Probe
private int getConnectionType() {
ConnectionType t = type;
return t == null ? -1 : t.ordinal();
}

public TcpIpConnectionManager getConnectionManager() {
return connectionManager;
}
Expand Down Expand Up @@ -163,7 +170,7 @@ public Object getMetricsId() {
Socket socket = socketChannel.socket();
SocketAddress localSocketAddress = socket != null ? socket.getLocalSocketAddress() : null;
SocketAddress remoteSocketAddress = socket != null ? socket.getRemoteSocketAddress() : null;
return getType() + "#" + localSocketAddress + "->" + remoteSocketAddress;
return localSocketAddress + "->" + remoteSocketAddress;
}

public void setSendBufferSize(int size) throws SocketException {
Expand All @@ -180,6 +187,7 @@ public boolean isClient() {
return (t != null) && t != ConnectionType.NONE && t.isClient();
}


/**
* Starts this connection.
*
Expand Down

0 comments on commit 01b2972

Please sign in to comment.