Search in sources :

Example 1 with TcpIpConnection

use of com.hazelcast.nio.tcp.TcpIpConnection in project hazelcast by hazelcast.

the class IOBalancerStressTest method getHandlersPerSelector.

private Map<NonBlockingIOThread, Set<MigratableHandler>> getHandlersPerSelector(TcpIpConnectionManager connectionManager) {
    Map<NonBlockingIOThread, Set<MigratableHandler>> handlersPerSelector = new HashMap<NonBlockingIOThread, Set<MigratableHandler>>();
    for (TcpIpConnection connection : connectionManager.getActiveConnections()) {
        add(handlersPerSelector, (MigratableHandler) connection.getSocketReader());
        add(handlersPerSelector, (MigratableHandler) connection.getSocketWriter());
    }
    return handlersPerSelector;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) NonBlockingIOThread(com.hazelcast.internal.networking.nonblocking.NonBlockingIOThread) HashMap(java.util.HashMap) TcpIpConnection(com.hazelcast.nio.tcp.TcpIpConnection) MigratableHandler(com.hazelcast.internal.networking.nonblocking.MigratableHandler)

Example 2 with TcpIpConnection

use of com.hazelcast.nio.tcp.TcpIpConnection in project hazelcast by hazelcast.

the class IOBalancerStressTest method debug.

public String debug(TcpIpConnectionManager connectionManager) {
    NonBlockingIOThreadingModel threadingModel = (NonBlockingIOThreadingModel) connectionManager.getIoThreadingModel();
    StringBuffer sb = new StringBuffer();
    sb.append("in selectors\n");
    for (NonBlockingIOThread in : threadingModel.getInputThreads()) {
        sb.append(in + ": " + in.getEventCount() + "\n");
        for (TcpIpConnection connection : connectionManager.getActiveConnections()) {
            NonBlockingSocketReader socketReader = (NonBlockingSocketReader) connection.getSocketReader();
            if (socketReader.getOwner() == in) {
                sb.append("\t" + socketReader + " eventCount:" + socketReader.getEventCount() + "\n");
            }
        }
    }
    sb.append("out selectors\n");
    for (NonBlockingIOThread in : threadingModel.getOutputThreads()) {
        sb.append(in + ": " + in.getEventCount() + "\n");
        for (TcpIpConnection connection : connectionManager.getActiveConnections()) {
            NonBlockingSocketWriter socketWriter = (NonBlockingSocketWriter) connection.getSocketWriter();
            if (socketWriter.getOwner() == in) {
                sb.append("\t" + socketWriter + " eventCount:" + socketWriter.getEventCount() + "\n");
            }
        }
    }
    return sb.toString();
}
Also used : NonBlockingIOThread(com.hazelcast.internal.networking.nonblocking.NonBlockingIOThread) TcpIpConnection(com.hazelcast.nio.tcp.TcpIpConnection) NonBlockingSocketReader(com.hazelcast.internal.networking.nonblocking.NonBlockingSocketReader) NonBlockingSocketWriter(com.hazelcast.internal.networking.nonblocking.NonBlockingSocketWriter) NonBlockingIOThreadingModel(com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel)

Aggregations

NonBlockingIOThread (com.hazelcast.internal.networking.nonblocking.NonBlockingIOThread)2 TcpIpConnection (com.hazelcast.nio.tcp.TcpIpConnection)2 MigratableHandler (com.hazelcast.internal.networking.nonblocking.MigratableHandler)1 NonBlockingIOThreadingModel (com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel)1 NonBlockingSocketReader (com.hazelcast.internal.networking.nonblocking.NonBlockingSocketReader)1 NonBlockingSocketWriter (com.hazelcast.internal.networking.nonblocking.NonBlockingSocketWriter)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1