Package org.jgroups

Examples of org.jgroups.Event


        int num_received=0;
        Receiver r=new Receiver();
        s.setReceiver(r);
        for(int i=1; i <= NUM_MSGS; i++) {
            Message msg=new Message(null, null, createPayload(SIZE));
            Event evt=new Event(Event.MSG, msg);
            s.send(evt);
            if(i % 1000 == 0)
                System.out.println("==> " + i);
        }
        int num_tries=10;
View Full Code Here


             if(log.isErrorEnabled()) log.error("timed out or was suspected");
            return;
        }
        if(new_view == null) {
             if(warn) log.warn("received a Merge Denied");
            gms.passDown(new Event(Event.MERGE_DENIED));
            return; //Merge denied
        }

        //Flushing my old view
        gms.flush(gms.mbrs.getMembers(), null);
View Full Code Here

            if(log.isInfoEnabled()) log.info("other_vid=" + other_vid + " , other_mbrs=" + other_mbrs);

        //Check that the views are disjoint otherwire return null (means MERGE_DENIED)
        for(Iterator i=other_mbrs.iterator(); i.hasNext();) {
            if(gms.mbrs.contains((Address)i.next())) {
                gms.passDown(new Event(Event.MERGE_DENIED));
                return null;
            }
        }

        //Compute new View
View Full Code Here

                if(log.isDebugEnabled()) log.debug("initial_mbrs=" + initial_mbrs);
                coords=detectMultipleCoordinators(initial_mbrs);
                if(coords != null && coords.size() > 1) {
                    if(log.isDebugEnabled())
                        log.debug("found multiple coordinators: " + coords + "; sending up MERGE event");
                    final Event evt=new Event(Event.MERGE, coords);
                    if(use_separate_thread) {
                        Thread merge_notifier=new Thread() {
                            public void run() {
                                passUp(evt);
                            }
View Full Code Here

                            break;

                        case PbcastHeader.NOT_MEMBER:  // we are shunned
                            if(shun) {
                                if(log.isInfoEnabled()) log.info("I am being shunned. Will leave and re-join");
                                passUp(new Event(Event.EXIT));
                            }
                            break;

                        default:
                            if(log.isErrorEnabled()) log.error("type (" + hdr.type +
View Full Code Here

                data=packet.getData();
                inp_stream=new ByteArrayInputStream(data, 0, data.length);
                inp=new DataInputStream(inp_stream);
                msg=new Message();
                msg.readFrom(inp);
                up(new Event(Event.MSG, msg));
            }
            catch(SocketException socketEx) {
                break;
            }
            catch(Exception ex) {
View Full Code Here

                mbr=(Address)e.nextElement();
                timestamp=((Entry)members.get(mbr)).timestamp;
                diff=System.currentTimeMillis() - timestamp;
                if(diff >= timeout) {
                    if(log.isInfoEnabled()) log.info("suspecting " + mbr);
                    passUp(new Event(Event.SUSPECT, mbr));
                    if(!suspected_mbrs.contains(mbr))
                        suspected_mbrs.addElement(mbr);
                }
            }
            Util.sleep(timeout);
View Full Code Here

            if(log.isDebugEnabled()) log.debug("member " + mbr + " not found");
            return;
        }

        if(suspected_mbrs.size() > 0 && suspected_mbrs.contains(mbr)) {
            passUp(new Event(Event.UNSUSPECT, mbr));
            suspected_mbrs.remove(mbr);
        }

        if(mbr.equals(local_addr))
            return;
View Full Code Here

        if(log.isDebugEnabled()) log.debug("configuration is\n" + config);
    }

    public void start() throws Exception {
        if(config != null && config.size() > 0) {
            Event config_evt=new Event(Event.CONFIG, config);
            passDown(config_evt);
            passUp(config_evt);
        }
    }
View Full Code Here

            // }
            msg=new Message(addr, null, null);
            msg.putHeader(name, new PingHeader(PingHeader.GET_MBRS_REQ, null));

            if(trace) log.trace("[FIND_INITIAL_MBRS] sending PING request to " + msg.getDest());
            passDown(new Event(Event.MSG, msg));
        }
    }
View Full Code Here

TOP

Related Classes of org.jgroups.Event

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.