Package org.jgroups.stack

Examples of org.jgroups.stack.GossipData


         data=new PingData(self, Util.createView(self, 1, self), true, "logical-name", null);
        _testSize(data);
    }

    public static void testGossipData() throws Exception {
        GossipData data;
        final Address own=org.jgroups.util.UUID.randomUUID();
        final Address coord=org.jgroups.util.UUID.randomUUID();
        UUID.add((UUID)own, "own");
        UUID.add((UUID)coord, "coord");

        final PhysicalAddress physical_addr_1=new IpAddress("127.0.0.1", 7500);
        final PhysicalAddress physical_addr_2=new IpAddress("192.168.1.5", 6000);
        final PhysicalAddress physical_addr_3=new IpAddress("192.134.2.1", 6655);

        _testSize(new GossipData());

        data=new GossipData((byte)1);
        _testSize(data);

        data=new GossipData((byte)1, "DemoCluster", own, (List<Address>)null, null);
        _testSize(data);

        data=new GossipData((byte)1, "DemoCluster", own, Arrays.asList(own, coord), null);
        _testSize(data);

        data=new GossipData((byte)1, "DemoCluster", own, Arrays.asList(own, coord),
                            Arrays.asList(physical_addr_1, physical_addr_2, physical_addr_3));
        _testSize(data);

        List<PhysicalAddress> list=new ArrayList<PhysicalAddress>();
        list.add(physical_addr_1);
        list.add(physical_addr_2);
        list.add(physical_addr_3);
        data=new GossipData((byte)1, "DemoCluster", own, Arrays.asList(own, coord), list);
        _testSize(data);

        data=new GossipData((byte)1, "demo", own, "logical_name", null);
        _testSize(data);

        data=new GossipData((byte)1, "demo", own, new byte[]{'b', 'e', 'l', 'a'});
        _testSize(data);

        byte[] buffer=new byte[10];
        buffer[2]='B';
        buffer[3]='e';
        buffer[4]='l';
        buffer[5]='a';
        data=new GossipData((byte)1, "demo", own, buffer, 2, 4);
        _testSize(data);
    }
View Full Code Here


        public void run() {
            final DataInputStream input = stub.getInputStream();
            mainloop:
            while (!Thread.currentThread().isInterrupted()) {
                try {                                       
                    GossipData msg = new GossipData();
                    msg.readFrom(input);
                    switch (msg.getType()) {
                        case GossipRouter.DISCONNECT_OK:                           
                            break mainloop;
                        case GossipRouter.MESSAGE:
                            byte[] data = msg.getBuffer();
                            receive(null/* src will be read from data */, data, 0, data.length);
                            break;
                        case GossipRouter.SUSPECT:
                            final Address suspect = Util.readAddress(input);
                            log.debug("Firing suspect event " + suspect + " at " + local_addr);
View Full Code Here

        public void run() {
            final DataInputStream input = stub.getInputStream();
            mainloop:
            while (!Thread.currentThread().isInterrupted()) {
                try {                                       
                    GossipData msg = new GossipData();
                    msg.readFrom(input);
                    switch (msg.getType()) {
                        case GossipRouter.DISCONNECT_OK:                           
                            break mainloop;
                        case GossipRouter.MESSAGE:
                            byte[] data = msg.getBuffer();
                            receive(null/* src will be read from data */, data, 0, data.length);
                            break;
                        case GossipRouter.SUSPECT:
                            final Address suspect = Util.readAddress(input);
                            log.debug("Firing suspect event " + suspect + " at " + local_addr);
View Full Code Here

        public void run() {
            final DataInputStream input = stub.getInputStream();
            mainloop:
            while (!Thread.currentThread().isInterrupted()) {
                try {                                       
                    GossipData msg = new GossipData();
                    msg.readFrom(input);
                    switch (msg.getType()) {
                        case GossipRouter.DISCONNECT_OK:                           
                            break mainloop;
                        case GossipRouter.MESSAGE:
                            byte[] data = msg.getBuffer();
                            receive(null/* src will be read from data */, data, 0, data.length);
                            break;
                        case GossipRouter.SUSPECT:
                            final Address suspect = Util.readAddress(input);
                            log.debug("Firing suspect event " + suspect + " at " + local_addr);
View Full Code Here

        X509Token tok=new X509Token().encryptedToken(new byte[]{'b', 'e', 'l', 'a'});
        _testSize(new AuthHeader(tok));
    }

    public static void testGossipData() throws Exception {
        GossipData data;
        final Address own=org.jgroups.util.UUID.randomUUID();
        final Address coord=org.jgroups.util.UUID.randomUUID();
        UUID.add(own, "own");
        UUID.add(coord, "coord");

        final PhysicalAddress physical_addr_1=new IpAddress("127.0.0.1", 7500);

        _testSize(new GossipData());

        data=new GossipData((byte)1);
        _testSize(data);

        data=new GossipData((byte)1, "DemoCluster", own, (List<Address>)null, (PhysicalAddress)null);
        _testSize(data);

        data=new GossipData((byte)1, "DemoCluster", own, Arrays.asList(own, coord), (PhysicalAddress)null);
        _testSize(data);

        data=new GossipData((byte)1, "DemoCluster", own, Arrays.asList(own, coord), physical_addr_1);
        _testSize(data);

        data=new GossipData((byte)1, "demo", own, "logical_name", (PhysicalAddress)null);
        _testSize(data);

        data=new GossipData((byte)1, "demo", own, new byte[]{'b', 'e', 'l', 'a'});
        _testSize(data);

        byte[] buffer=new byte[10];
        buffer[2]='B';
        buffer[3]='e';
        buffer[4]='l';
        buffer[5]='a';
        data=new GossipData((byte)1, "demo", own, buffer, 2, 4);
        _testSize(data);
    }
View Full Code Here

TOP

Related Classes of org.jgroups.stack.GossipData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.