Package org.jgroups

Examples of org.jgroups.ReceiverAdapter


            if(line.startsWith("subscribe")) {
                final String topic=line.substring("subscribe".length()).trim();
                if(!topics.containsKey(topic)) {
                    // we need to make sure "singleton_name" is set in the transport
                    JChannel ch=createSharedChannel("pubsub", props);
                    ch.setReceiver(new ReceiverAdapter() {
                        public void receive(Message msg) {
                            System.out.println("[" + topic + "] << " + msg.getObject());
                        }
                    });
                    ch.connect(topic);
View Full Code Here


    protected JChannel ch;

    void start(String props, String channel_name) throws Exception {
        ch=new JChannel(props);
        ch.setName(channel_name);
        ch.setReceiver(new ReceiverAdapter() {
            public void viewAccepted(View view) {
                System.out.println("-- view: " + view);
            }
        });
        loop();
View Full Code Here

        loop();
    }

    public void start(JChannel ch) throws Exception {
        this.ch=ch;
        ch.setReceiver(new ReceiverAdapter() {
            public void viewAccepted(View view) {
                System.out.println("-- view: " + view);
            }
        });
        loop();
View Full Code Here

                                 new GMS(),
                                 new UFC(),
                                 new MFC(),
                                 new FRAG2());

        ch.setReceiver(new ReceiverAdapter() {
            public void viewAccepted(View new_view) {
                System.out.println("view: " + new_view);
            }

            public void receive(Message msg) {
View Full Code Here

         }

         public synchronized void connect() throws Exception
         {
            if (channel.isConnected()) return;
            channel.setReceiver(new ReceiverAdapter() {

               @Override
               public void receive(Message msg)
               {
                  synchronized(receivers)
View Full Code Here

                .addProtocol(new UFC())
                .addProtocol(new MFC())
                .addProtocol(new FRAG2());
        stack.init();

        ch.setReceiver(new ReceiverAdapter() {
            public void viewAccepted(View new_view) {
                System.out.println("view: " + new_view);
            }

            public void receive(Message msg) {
View Full Code Here

                .addProtocol(new UFC())
                .addProtocol(new MFC())
                .addProtocol(new FRAG2());
        stack.init();

        ch.setReceiver(new ReceiverAdapter() {
            public void viewAccepted(View new_view) {
                System.out.println("view: " + new_view);
            }

            public void receive(Message msg) {
View Full Code Here

         }

         public synchronized void connect() throws Exception
         {
            if (channel.isConnected()) return;
            channel.setReceiver(new ReceiverAdapter() {

               @Override
               public void receive(Message msg)
               {
                  synchronized(receivers)
View Full Code Here

    @Override
    protected void doPreSetup() throws Exception {
        super.doPreSetup();
        channel = new JChannel();
        channel.setReceiver(new ReceiverAdapter() {
            @Override
            public void receive(Message msg) {
                messageReceived = msg.getObject();
            }
        });
View Full Code Here

        Message message = new Message(null, null, data);
        this.channel.send(message);
    }

    public void addReceiver(final Recipient recipient) {
        ReceiverAdapter adapter = new ReceiverAdapter() {
            @Override
            public void receive(Message message) {
                if (message.getSrc().equals(channel.getAddress())) {
                    // Ignore my own messages
                    return;
View Full Code Here

TOP

Related Classes of org.jgroups.ReceiverAdapter

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.