Tabnine Logo
VERIFY_SUSPECT
Code IndexAdd Tabnine to your IDE (free)

How to use
VERIFY_SUSPECT
in
org.jgroups.protocols

Best Java code snippets using org.jgroups.protocols.VERIFY_SUSPECT (Showing top 19 results out of 315)

origin: wildfly/wildfly

/**
 * Sends ARE_YOU_DEAD message to suspected_mbr, wait for return or timeout
 */
protected void verifySuspect(Collection<Address> mbrs) {
  if(mbrs == null || mbrs.isEmpty())
    return;
  if(addSuspects(mbrs)) {
    startTimer(); // start timer before we send out are you dead messages
    log.trace("verifying that %s %s dead", mbrs, mbrs.size() == 1? "is" : "are");
  }
  for(Address mbr: mbrs) {
    for(int i=0; i < num_msgs; i++) {
      Message msg=new Message(mbr).setFlag(Message.Flag.INTERNAL)
       .putHeader(this.id, new VerifyHeader(VerifyHeader.ARE_YOU_DEAD, local_addr));
      down_prot.down(msg);
    }
  }
}
origin: wildfly/wildfly

public Object up(Event evt) {
  switch(evt.getType()) {
    case Event.SUSPECT:  // it all starts here ...
      // todo: change to collections in 4.1
      Collection<Address> s=evt.arg() instanceof Address? Collections.singletonList(evt.arg()) : evt.arg();
      if(s == null)
        return null;
      s.remove(local_addr); // ignoring suspect of self
      if(use_icmp)
        s.forEach(this::verifySuspectWithICMP);
      else
        verifySuspect(s);
      return null;  // don't pass up; we will decide later (after verification) whether to pass it up
    case Event.CONFIG:
      if(bind_addr == null) {
        Map<String,Object> config=evt.getArg();
        bind_addr=(InetAddress)config.get("bind_addr");
      }
  }
  return up_prot.up(evt);
}
origin: wildfly/wildfly

public Object down(Event evt) {
  switch(evt.getType()) {
    case Event.SET_LOCAL_ADDRESS:
      local_addr=evt.getArg();
      break;
    case Event.VIEW_CHANGE:
      View v=evt.getArg();
      adjustSuspectedMembers(v.getMembers());
      break;
  }
  return down_prot.down(evt);
}
origin: wildfly/wildfly

protected void verifySuspectWithICMP(Address suspected_mbr) {
  InetAddress host=suspected_mbr instanceof IpAddress? ((IpAddress)suspected_mbr).getIpAddress() : null;
  if(host == null)
    throw new IllegalArgumentException("suspected_mbr is not of type IpAddress - FD_ICMP only works with these");
  try {
    if(log.isTraceEnabled())
      log.trace("pinging host " + suspected_mbr + " using interface " + intf);
    long start=getCurrentTimeMillis(), stop;
    boolean rc=host.isReachable(intf, 0, (int)timeout);
    stop=getCurrentTimeMillis();
    if(rc) // success
      log.trace("successfully received response from " + host + " (after " + (stop-start) + "ms)");
    else { // failure
      log.debug("failed pinging " + suspected_mbr + " after " + (stop-start) + "ms; passing up SUSPECT event");
      removeSuspect(suspected_mbr);
      up_prot.up(new Event(Event.SUSPECT, Collections.singletonList(suspected_mbr)));
    }
  }
  catch(Exception ex) {
    log.error(Util.getMessage("FailedPinging"),suspected_mbr, ex);
  }
}
origin: org.jgroups/com.springsource.org.jgroups

  verifySuspect(suspected_mbr);
else
  verifySuspectWithICMP(suspected_mbr);
return null;  // don't pass up; we will decide later (after verification) whether to pass it up
      return null;
    unsuspect(hdr.from);
    return null;
origin: wildfly/wildfly

public Object up(Message msg) {
  VerifyHeader hdr=msg.getHeader(this.id);
  if(hdr == null)
    return up_prot.up(msg);
  switch(hdr.type) {
    case VerifyHeader.ARE_YOU_DEAD:
      if(hdr.from == null) {
        log.error(Util.getMessage("AREYOUDEADHdrFromIsNull"));
        return null;
      }
      Address target=use_mcast_rsps? null : hdr.from;
      for(int i=0; i < num_msgs; i++) {
        Message rsp=new Message(target).setFlag(Message.Flag.INTERNAL)
         .putHeader(this.id, new VerifyHeader(VerifyHeader.I_AM_NOT_DEAD, local_addr));
        down_prot.down(rsp);
      }
      return null;
    case VerifyHeader.I_AM_NOT_DEAD:
      if(hdr.from == null) {
        log.error(Util.getMessage("IAMNOTDEADHdrFromIsNull"));
        return null;
      }
      unsuspect(hdr.from);
      return null;
  }
  return null;
}
origin: wildfly/wildfly

public void unsuspect(Address mbr) {
  boolean removed=mbr != null && removeSuspect(mbr);
  if(removed) {
    log.trace("member " + mbr + " was unsuspected");
    down_prot.down(new Event(Event.UNSUSPECT, mbr));
    up_prot.up(new Event(Event.UNSUSPECT, mbr));
  }
}
origin: org.jgroups/com.springsource.org.jgroups

/**
 * Sends ARE_YOU_DEAD message to suspected_mbr, wait for return or timeout
 */
void verifySuspect(Address mbr) {
  Message msg;
  if(mbr == null) return;
  synchronized(suspects) {
    if(suspects.containsKey(mbr))
      return;
    suspects.put(mbr, new Long(System.currentTimeMillis()));
  }
  // moved out of synchronized statement (bela): http://jira.jboss.com/jira/browse/JGRP-302
  if(log.isTraceEnabled()) log.trace("verifying that " + mbr + " is dead");
  for(int i=0; i < num_msgs; i++) {
    msg=new Message(mbr, null, null);
    msg.setFlag(Message.OOB);
    msg.putHeader(name, new VerifyHeader(VerifyHeader.ARE_YOU_DEAD, local_addr));
    down_prot.down(new Event(Event.MSG, msg));
  }
  if(timer == null)
    startTimer();
}
origin: wildfly/wildfly

protected synchronized void startTimer() {
  timer=getThreadFactory().newThread(this,"VERIFY_SUSPECT.TimerThread");
  timer.setDaemon(true);
  timer.start();
}
origin: wildfly/wildfly

new FD_SOCK(),
new FD_ALL(),
new VERIFY_SUSPECT(),
new BARRIER(),
new NAKACK2(),
origin: wildfly/wildfly

public synchronized void stop() {
  clearSuspects();
  running=false;
  if(timer != null && timer.isAlive()) {
    Thread tmp=timer;
    timer=null;
    tmp.interrupt();
  }
  timer=null;
}
origin: org.jboss.eap/wildfly-client-all

public Object up(Message msg) {
  VerifyHeader hdr=msg.getHeader(this.id);
  if(hdr == null)
    return up_prot.up(msg);
  switch(hdr.type) {
    case VerifyHeader.ARE_YOU_DEAD:
      if(hdr.from == null) {
        log.error(Util.getMessage("AREYOUDEADHdrFromIsNull"));
        return null;
      }
      Address target=use_mcast_rsps? null : hdr.from;
      for(int i=0; i < num_msgs; i++) {
        Message rsp=new Message(target).setFlag(Message.Flag.INTERNAL)
         .putHeader(this.id, new VerifyHeader(VerifyHeader.I_AM_NOT_DEAD, local_addr));
        down_prot.down(rsp);
      }
      return null;
    case VerifyHeader.I_AM_NOT_DEAD:
      if(hdr.from == null) {
        log.error(Util.getMessage("IAMNOTDEADHdrFromIsNull"));
        return null;
      }
      unsuspect(hdr.from);
      return null;
  }
  return null;
}
origin: org.jboss.eap/wildfly-client-all

public void unsuspect(Address mbr) {
  boolean removed=mbr != null && removeSuspect(mbr);
  if(removed) {
    log.trace("member " + mbr + " was unsuspected");
    down_prot.down(new Event(Event.UNSUSPECT, mbr));
    up_prot.up(new Event(Event.UNSUSPECT, mbr));
  }
}
origin: org.jboss.eap/wildfly-client-all

protected synchronized void startTimer() {
  if(timer == null || !timer.isAlive()) {            
    timer=getThreadFactory().newThread(this,"VERIFY_SUSPECT.TimerThread");
    timer.setDaemon(true);
    timer.start();
  }
}
origin: org.jboss.eap/wildfly-client-all

new FD_SOCK(),
new FD_ALL(),
new VERIFY_SUSPECT(),
new BARRIER(),
new NAKACK2(),
origin: org.jboss.eap/wildfly-client-all

/**
 * Sends ARE_YOU_DEAD message to suspected_mbr, wait for return or timeout
 */
void verifySuspect(Collection<Address> mbrs) {
  if(mbrs == null || mbrs.isEmpty())
    return;
  boolean added=addSuspects(mbrs);
  if(added) {
    startTimer(); // start timer before we send out are you dead messages
    log.trace("verifying that %s %s dead", mbrs, mbrs.size() == 1? "is" : "are");
  }
  for(Address mbr: mbrs) {
    for(int i=0; i < num_msgs; i++) {
      Message msg=new Message(mbr).setFlag(Message.Flag.INTERNAL)
       .putHeader(this.id, new VerifyHeader(VerifyHeader.ARE_YOU_DEAD, local_addr));
      down_prot.down(msg);
    }
  }
}
origin: org.jboss.eap/wildfly-client-all

public Object up(Event evt) {
  switch(evt.getType()) {
    case Event.SUSPECT:  // it all starts here ...
      // todo: change to collections in 4.1
      Collection<Address> s=evt.arg() instanceof Address? Collections.singletonList(evt.arg()) : evt.arg();
      if(s == null)
        return null;
      s.remove(local_addr); // ignoring suspect of self
      if(!use_icmp)
        verifySuspect(s);
      else
        s.forEach(this::verifySuspectWithICMP);
      return null;  // don't pass up; we will decide later (after verification) whether to pass it up
    case Event.CONFIG:
      if(bind_addr == null) {
        Map<String,Object> config=evt.getArg();
        bind_addr=(InetAddress)config.get("bind_addr");
      }
  }
  return up_prot.up(evt);
}
origin: org.jboss.eap/wildfly-client-all

void verifySuspectWithICMP(Address suspected_mbr) {
  InetAddress host=suspected_mbr instanceof IpAddress? ((IpAddress)suspected_mbr).getIpAddress() : null;
  if(host == null)
    throw new IllegalArgumentException("suspected_mbr is not of type IpAddress - FD_ICMP only works with these");
  try {
    if(log.isTraceEnabled())
      log.trace("pinging host " + suspected_mbr + " using interface " + intf);
    long start=System.currentTimeMillis(), stop;
    boolean rc=host.isReachable(intf, 0, (int)timeout);
    stop=System.currentTimeMillis();
    if(rc) // success
      log.trace("successfully received response from " + host + " (after " + (stop-start) + "ms)");
    else { // failure
      log.debug("failed pinging " + suspected_mbr + " after " + (stop-start) + "ms; passing up SUSPECT event");
      removeSuspect(suspected_mbr);
      up_prot.up(new Event(Event.SUSPECT, Collections.singletonList(suspected_mbr)));
    }
  }
  catch(Exception ex) {
    log.error(Util.getMessage("FailedPinging"),suspected_mbr, ex);
  }
}
origin: org.jboss.eap/wildfly-client-all

public Object down(Event evt) {
  switch(evt.getType()) {
    case Event.SET_LOCAL_ADDRESS:
      local_addr=evt.getArg();
      break;
    case Event.VIEW_CHANGE:
      View v=evt.getArg();
      adjustSuspectedMembers(v.getMembers());
      break;
  }
  return down_prot.down(evt);
}
org.jgroups.protocolsVERIFY_SUSPECT

Javadoc

Catches SUSPECT events traveling up the stack. Verifies that the suspected member is really dead. If yes, passes SUSPECT event up the stack, otherwise discards it. Has to be placed somewhere above the FD layer and below the GMS layer (receiver of the SUSPECT event). Note that SUSPECT events may be reordered by this protocol.

Most used methods

  • startTimer
  • unsuspect
  • verifySuspect
    Sends ARE_YOU_DEAD message to suspected_mbr, wait for return or timeout
  • <init>
  • addSuspects
  • adjustSuspectedMembers
    Removes all elements from suspects that are not in the new membership
  • getThreadFactory
  • removeSuspect
  • clearSuspects
  • getCurrentTimeMillis
  • verifySuspectWithICMP
  • verifySuspectWithICMP

Popular in Java

  • Reactive rest calls using spring rest template
  • getContentResolver (Context)
  • onRequestPermissionsResult (Fragment)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Menu (java.awt)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now