Search in sources :

Example 1 with ConnectionKey

use of org.apache.ignite.spi.communication.tcp.internal.ConnectionKey in project ignite by apache.

the class TcpCommunicationSpi method dumpNodeStatistics.

/**
 * @param nodeId Target node ID.
 * @return Future.
 */
public IgniteInternalFuture<String> dumpNodeStatistics(final UUID nodeId) {
    StringBuilder sb = new StringBuilder("Communication SPI statistics [rmtNode=").append(nodeId).append(']').append(U.nl());
    dumpInfo(sb, nodeId);
    GridNioServer<Message> nioSrvr = nioSrvWrapper.nio();
    if (nioSrvr != null) {
        sb.append("NIO sessions statistics:");
        IgnitePredicate<GridNioSession> p = (IgnitePredicate<GridNioSession>) ses -> {
            ConnectionKey connId = ses.meta(CONN_IDX_META);
            return connId != null && nodeId.equals(connId.nodeId());
        };
        return nioSrvr.dumpStats(sb.toString(), p);
    } else {
        sb.append(U.nl()).append("GridNioServer is null.");
        return new GridFinishedFuture<>(sb.toString());
    }
}
Also used : TcpConnectionIndexAwareMessage(org.apache.ignite.spi.communication.tcp.internal.TcpConnectionIndexAwareMessage) GridIoMessage(org.apache.ignite.internal.managers.communication.GridIoMessage) Message(org.apache.ignite.plugin.extensions.communication.Message) GridNioSession(org.apache.ignite.internal.util.nio.GridNioSession) IgnitePredicate(org.apache.ignite.lang.IgnitePredicate) ConnectionKey(org.apache.ignite.spi.communication.tcp.internal.ConnectionKey) GridFinishedFuture(org.apache.ignite.internal.util.future.GridFinishedFuture)

Example 2 with ConnectionKey

use of org.apache.ignite.spi.communication.tcp.internal.ConnectionKey in project ignite by apache.

the class TcpCommunicationSpi method dumpInfo.

/**
 * @param sb Message builder.
 * @param dstNodeId Target node ID.
 */
private void dumpInfo(StringBuilder sb, UUID dstNodeId) {
    sb.append("Communication SPI recovery descriptors: ").append(U.nl());
    for (Map.Entry<ConnectionKey, GridNioRecoveryDescriptor> entry : nioSrvWrapper.recoveryDescs().entrySet()) {
        GridNioRecoveryDescriptor desc = entry.getValue();
        if (dstNodeId != null && !dstNodeId.equals(entry.getKey().nodeId()))
            continue;
        sb.append("    [key=").append(entry.getKey()).append(", msgsSent=").append(desc.sent()).append(", msgsAckedByRmt=").append(desc.acked()).append(", msgsRcvd=").append(desc.received()).append(", lastAcked=").append(desc.lastAcknowledged()).append(", reserveCnt=").append(desc.reserveCount()).append(", descIdHash=").append(System.identityHashCode(desc)).append(']').append(U.nl());
    }
    for (Map.Entry<ConnectionKey, GridNioRecoveryDescriptor> entry : nioSrvWrapper.outRecDescs().entrySet()) {
        GridNioRecoveryDescriptor desc = entry.getValue();
        if (dstNodeId != null && !dstNodeId.equals(entry.getKey().nodeId()))
            continue;
        sb.append("    [key=").append(entry.getKey()).append(", msgsSent=").append(desc.sent()).append(", msgsAckedByRmt=").append(desc.acked()).append(", reserveCnt=").append(desc.reserveCount()).append(", connected=").append(desc.connected()).append(", reserved=").append(desc.reserved()).append(", descIdHash=").append(System.identityHashCode(desc)).append(']').append(U.nl());
    }
    for (Map.Entry<ConnectionKey, GridNioRecoveryDescriptor> entry : nioSrvWrapper.inRecDescs().entrySet()) {
        GridNioRecoveryDescriptor desc = entry.getValue();
        if (dstNodeId != null && !dstNodeId.equals(entry.getKey().nodeId()))
            continue;
        sb.append("    [key=").append(entry.getKey()).append(", msgsRcvd=").append(desc.received()).append(", lastAcked=").append(desc.lastAcknowledged()).append(", reserveCnt=").append(desc.reserveCount()).append(", connected=").append(desc.connected()).append(", reserved=").append(desc.reserved()).append(", handshakeIdx=").append(desc.handshakeIndex()).append(", descIdHash=").append(System.identityHashCode(desc)).append(']').append(U.nl());
    }
    sb.append("Communication SPI clients: ").append(U.nl());
    for (Map.Entry<UUID, GridCommunicationClient[]> entry : clientPool.entrySet()) {
        UUID clientNodeId = entry.getKey();
        if (dstNodeId != null && !dstNodeId.equals(clientNodeId))
            continue;
        GridCommunicationClient[] clients0 = entry.getValue();
        for (GridCommunicationClient client : clients0) {
            if (client != null) {
                sb.append("    [node=").append(clientNodeId).append(", client=").append(client).append(']').append(U.nl());
            }
        }
    }
}
Also used : GridNioRecoveryDescriptor(org.apache.ignite.internal.util.nio.GridNioRecoveryDescriptor) ConnectionKey(org.apache.ignite.spi.communication.tcp.internal.ConnectionKey) UUID(java.util.UUID) GridCommunicationClient(org.apache.ignite.internal.util.nio.GridCommunicationClient) Map(java.util.Map)

Aggregations

ConnectionKey (org.apache.ignite.spi.communication.tcp.internal.ConnectionKey)2 Map (java.util.Map)1 UUID (java.util.UUID)1 GridIoMessage (org.apache.ignite.internal.managers.communication.GridIoMessage)1 GridFinishedFuture (org.apache.ignite.internal.util.future.GridFinishedFuture)1 GridCommunicationClient (org.apache.ignite.internal.util.nio.GridCommunicationClient)1 GridNioRecoveryDescriptor (org.apache.ignite.internal.util.nio.GridNioRecoveryDescriptor)1 GridNioSession (org.apache.ignite.internal.util.nio.GridNioSession)1 IgnitePredicate (org.apache.ignite.lang.IgnitePredicate)1 Message (org.apache.ignite.plugin.extensions.communication.Message)1 TcpConnectionIndexAwareMessage (org.apache.ignite.spi.communication.tcp.internal.TcpConnectionIndexAwareMessage)1