Search in sources :

Example 6 with MemberImpl

use of org.apache.catalina.tribes.membership.MemberImpl in project tomcat by apache.

the class SocketNioReceive method main.

public static void main(String[] args) throws Exception {
    Member mbr = new MemberImpl("localhost", 9999, 0);
    ChannelData data = new ChannelData();
    data.setAddress(mbr);
    byte[] buf = new byte[8192 * 4];
    data.setMessage(new XByteBuffer(buf, false));
    buf = XByteBuffer.createDataPackage(data);
    len = buf.length;
    NioReceiver receiver = new NioReceiver();
    receiver.setPort(9999);
    receiver.setHost("localhost");
    MyList list = new MyList();
    receiver.setMessageListener(list);
    receiver.start();
    System.out.println("Listening on 9999");
    while (true) {
        try {
            synchronized (mutex) {
                mutex.wait(5000);
                if (start != 0) {
                    System.out.println("Throughput " + df.format(mb / seconds) + " MB/seconds, messages " + count + " accepts " + accept + ", total " + mb + " MB.");
                }
            }
        } catch (Throwable x) {
            x.printStackTrace();
        }
    }
}
Also used : XByteBuffer(org.apache.catalina.tribes.io.XByteBuffer) NioReceiver(org.apache.catalina.tribes.transport.nio.NioReceiver) ChannelData(org.apache.catalina.tribes.io.ChannelData) MemberImpl(org.apache.catalina.tribes.membership.MemberImpl) Member(org.apache.catalina.tribes.Member)

Aggregations

MemberImpl (org.apache.catalina.tribes.membership.MemberImpl)6 Member (org.apache.catalina.tribes.Member)5 BigDecimal (java.math.BigDecimal)3 DecimalFormat (java.text.DecimalFormat)3 ChannelData (org.apache.catalina.tribes.io.ChannelData)3 XByteBuffer (org.apache.catalina.tribes.io.XByteBuffer)3 NioSender (org.apache.catalina.tribes.transport.nio.NioSender)3 SelectionKey (java.nio.channels.SelectionKey)2 Selector (java.nio.channels.Selector)2 OutputStream (java.io.OutputStream)1 Socket (java.net.Socket)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 ManagedChannel (org.apache.catalina.tribes.ManagedChannel)1 GroupChannel (org.apache.catalina.tribes.group.GroupChannel)1 DomainFilterInterceptor (org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor)1 FragmentationInterceptor (org.apache.catalina.tribes.group.interceptors.FragmentationInterceptor)1 GzipInterceptor (org.apache.catalina.tribes.group.interceptors.GzipInterceptor)1 MessageDispatchInterceptor (org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor)1 OrderInterceptor (org.apache.catalina.tribes.group.interceptors.OrderInterceptor)1