Search in sources :

Example 1 with NioChannel

use of com.hazelcast.internal.networking.nio.NioChannel in project hazelcast by hazelcast.

the class OverloadedConnectionsPlugin method getOutboundQueue.

private Queue<OutboundFrame> getOutboundQueue(TcpServerConnection connection, boolean priority) {
    if (connection.getChannel() instanceof NioChannel) {
        NioChannel nioChannel = (NioChannel) connection.getChannel();
        NioOutboundPipeline outboundPipeline = nioChannel.outboundPipeline();
        return priority ? outboundPipeline.priorityWriteQueue : outboundPipeline.writeQueue;
    } else {
        return EMPTY_QUEUE;
    }
}
Also used : NioChannel(com.hazelcast.internal.networking.nio.NioChannel) NioOutboundPipeline(com.hazelcast.internal.networking.nio.NioOutboundPipeline)

Example 2 with NioChannel

use of com.hazelcast.internal.networking.nio.NioChannel in project hazelcast by hazelcast.

the class IOBalancerStressTest method debug.

private StringBuilder debug(HazelcastInstance hz) {
    TcpServer networkingService = (TcpServer) getNode(hz).getServer();
    NioNetworking networking = (NioNetworking) networkingService.getNetworking();
    ServerConnectionManager cm = getNode(hz).getServer().getConnectionManager(EndpointQualifier.MEMBER);
    StringBuilder sb = new StringBuilder();
    sb.append("in owners\n");
    for (NioThread in : networking.getInputThreads()) {
        sb.append(in).append(": ").append(in.getEventCount()).append("\n");
        for (ServerConnection connection : cm.getConnections()) {
            TcpServerConnection tcpConnection = (TcpServerConnection) connection;
            NioInboundPipeline inboundPipeline = ((NioChannel) tcpConnection.getChannel()).inboundPipeline();
            if (inboundPipeline.owner() == in) {
                sb.append("\t").append(inboundPipeline).append(" load: ").append(inboundPipeline.load()).append("\n");
            }
        }
    }
    sb.append("out owners\n");
    for (NioThread in : networking.getOutputThreads()) {
        sb.append(in).append(": ").append(in.getEventCount()).append("\n");
        for (ServerConnection connection : cm.getConnections()) {
            TcpServerConnection tcpConnection = (TcpServerConnection) connection;
            NioOutboundPipeline outboundPipeline = ((NioChannel) tcpConnection.getChannel()).outboundPipeline();
            if (outboundPipeline.owner() == in) {
                sb.append("\t").append(outboundPipeline).append(" load:").append(outboundPipeline.load()).append("\n");
            }
        }
    }
    return sb;
}
Also used : NioThread(com.hazelcast.internal.networking.nio.NioThread) ServerConnectionManager(com.hazelcast.internal.server.ServerConnectionManager) NioChannel(com.hazelcast.internal.networking.nio.NioChannel) ServerConnection(com.hazelcast.internal.server.ServerConnection) TcpServerConnection(com.hazelcast.internal.server.tcp.TcpServerConnection) NioNetworking(com.hazelcast.internal.networking.nio.NioNetworking) NioOutboundPipeline(com.hazelcast.internal.networking.nio.NioOutboundPipeline) TcpServer(com.hazelcast.internal.server.tcp.TcpServer) TcpServerConnection(com.hazelcast.internal.server.tcp.TcpServerConnection) NioInboundPipeline(com.hazelcast.internal.networking.nio.NioInboundPipeline)

Aggregations

NioChannel (com.hazelcast.internal.networking.nio.NioChannel)2 NioOutboundPipeline (com.hazelcast.internal.networking.nio.NioOutboundPipeline)2 NioInboundPipeline (com.hazelcast.internal.networking.nio.NioInboundPipeline)1 NioNetworking (com.hazelcast.internal.networking.nio.NioNetworking)1 NioThread (com.hazelcast.internal.networking.nio.NioThread)1 ServerConnection (com.hazelcast.internal.server.ServerConnection)1 ServerConnectionManager (com.hazelcast.internal.server.ServerConnectionManager)1 TcpServer (com.hazelcast.internal.server.tcp.TcpServer)1 TcpServerConnection (com.hazelcast.internal.server.tcp.TcpServerConnection)1