Search in sources :

Example 1 with TCP_NIO2

use of org.jgroups.protocols.TCP_NIO2 in project JGroups by belaban.

the class DiscardTest method tearDown.

@AfterMethod
protected void tearDown() throws Exception {
    TP tp_a = a.getProtocolStack().getTransport(), tp_b = b.getProtocolStack().getTransport();
    if (tp_a instanceof TCP_NIO2) {
        System.out.printf("partial writes in A: %d, partial writes in B: %d\n", ((TCP_NIO2) tp_a).numPartialWrites(), ((TCP_NIO2) tp_b).numPartialWrites());
    }
    Util.close(b, a);
}
Also used : TCP_NIO2(org.jgroups.protocols.TCP_NIO2) TP(org.jgroups.protocols.TP) AfterMethod(org.testng.annotations.AfterMethod)

Example 2 with TCP_NIO2

use of org.jgroups.protocols.TCP_NIO2 in project JGroups by belaban.

the class NioServerTest2 method testMulticasting.

public void testMulticasting() throws Exception {
    for (int i = 1; i <= NUM_MSGS; i++) {
        Message msg = new BytesMessage(null, new byte[MSG_SIZE], 0, MSG_SIZE);
        a.send(msg);
    }
    for (int i = 0; i < 20; i++) {
        if (ra.total() >= NUM_MSGS && rb.total() >= NUM_MSGS)
            break;
        System.out.printf("A.good=%d | bad=%d, B.good=%d | bad=%d\n", ra.good(), ra.bad(), rb.good(), rb.bad());
        Util.sleep(500);
    }
    TCP_NIO2 ta = (TCP_NIO2) a.getProtocolStack().getTransport(), tb = (TCP_NIO2) b.getProtocolStack().getTransport();
    System.out.printf("A.partial_writes=%d, B.partial_writes=%d\n", ta.numPartialWrites(), tb.numPartialWrites());
    NAKACK2 na = a.getProtocolStack().findProtocol(NAKACK2.class), nb = b.getProtocolStack().findProtocol(NAKACK2.class);
    System.out.printf("A.xmit_reqs_sent|received=%d|%d, B.xmit_reqs_sent|received=%d|%d\n", na.getXmitRequestsSent(), na.getXmitRequestsReceived(), nb.getXmitRequestsSent(), nb.getXmitRequestsReceived());
    System.out.printf("A.good=%d | bad=%d, B.good=%d | bad=%d\n", ra.good(), ra.bad(), rb.good(), rb.bad());
    check(ra, "A");
    check(rb, "B");
}
Also used : NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) TCP_NIO2(org.jgroups.protocols.TCP_NIO2)

Aggregations

TCP_NIO2 (org.jgroups.protocols.TCP_NIO2)2 TP (org.jgroups.protocols.TP)1 NAKACK2 (org.jgroups.protocols.pbcast.NAKACK2)1 AfterMethod (org.testng.annotations.AfterMethod)1