congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Table.forEach
Code IndexAdd Tabnine to your IDE (free)

How to use
forEach
method
in
org.jgroups.util.Table

Best Java code snippets using org.jgroups.util.Table.forEach (Showing top 10 results out of 315)

origin: wildfly/wildfly

/** Returns the number of messages that can be delivered */
public int getNumDeliverable() {
  NumDeliverable visitor=new NumDeliverable();
  lock.lock();
  try {
    forEach(hd+1, hr, visitor);
    return visitor.getResult();
  }
  finally {
    lock.unlock();
  }
}
origin: wildfly/wildfly

/** Returns the highest deliverable (= removable) seqno. This may be higher than {@link #getHighestDelivered()},
 * e.g. if elements have been added but not yet removed */
public long getHighestDeliverable() {
  HighestDeliverable visitor=new HighestDeliverable();
  lock.lock();
  try {
    forEach(hd+1, hr, visitor);
    long retval=visitor.getResult();
    return retval == -1? hd : retval;
  }
  finally {
    lock.unlock();
  }
}
origin: wildfly/wildfly

/**
 * Removes elements from the table and adds them to the result created by result_creator. Between 0 and max_results
 * elements are removed. If no elements were removed, processing will be set to true while the table lock is held.
 * @param nullify if true, the x,y location of the removed element in the matrix will be nulled
 * @param max_results the max number of results to be returned, even if more elements would be removable
 * @param filter a filter which accepts (or rejects) elements into the result. If null, all elements will be accepted
 * @param result_creator a supplier required to create the result, e.g. ArrayList::new
 * @param accumulator an accumulator accepting the result and an element, e.g. ArrayList::add
 * @param <R> the type of the result
 * @return the result
 */
public <R> R removeMany(boolean nullify, int max_results, Predicate<T> filter,
            Supplier<R> result_creator, BiConsumer<R,T> accumulator) {
  lock.lock();
  try {
    Remover<R> remover=new Remover<>(nullify, max_results, filter, result_creator, accumulator);
    forEach(hd+1, hr, remover);
    return remover.getResult();
  }
  finally {
    lock.unlock();
  }
}
origin: wildfly/wildfly

/**
 * Returns a list of missing messages
 * @param max_msgs If > 0, the max number of missing messages to be returned (oldest first), else no limit
 * @return A SeqnoList of missing messages, or null if no messages are missing
 */
public SeqnoList getMissing(int max_msgs) {
  lock.lock();
  try {
    if(size == 0)
      return null;
    long start_seqno=getHighestDeliverable() +1;
    int capacity=(int)(hr - start_seqno);
    int max_size=max_msgs > 0? Math.min(max_msgs, capacity) : capacity;
    if(max_size <= 0)
      return null;
    Missing missing=new Missing(start_seqno, max_size);
    long to=max_size > 0? Math.min(start_seqno + max_size-1, hr-1) : hr-1;
    forEach(start_seqno, to, missing);
    return missing.getMissingElements();
  }
  finally {
    lock.unlock();
  }
}
origin: wildfly/wildfly

  hr=seqno;
if(remove_filter != null && hd +1 == seqno) {
  forEach(hd + 1, hr,
      (seq, msg, r, c) -> {
        if(msg == null || !remove_filter.test(msg))
origin: org.jboss.eap/wildfly-client-all

/** Returns the number of messages that can be delivered */
public int getNumDeliverable() {
  NumDeliverable visitor=new NumDeliverable();
  lock.lock();
  try {
    forEach(hd+1, hr, visitor);
    return visitor.getResult();
  }
  finally {
    lock.unlock();
  }
}
origin: org.jboss.eap/wildfly-client-all

/** Returns the highest deliverable (= removable) seqno. This may be higher than {@link #getHighestDelivered()},
 * e.g. if elements have been added but not yet removed */
public long getHighestDeliverable() {
  HighestDeliverable visitor=new HighestDeliverable();
  lock.lock();
  try {
    forEach(hd+1, hr, visitor);
    long retval=visitor.getResult();
    return retval == -1? hd : retval;
  }
  finally {
    lock.unlock();
  }
}
origin: org.jboss.eap/wildfly-client-all

/**
 * Removes elements from the table and adds them to the result created by result_creator. Between 0 and max_results
 * elements are removed. If no elements were removed, processing will be set to true while the table lock is held.
 * @param nullify if true, the x,y location of the removed element in the matrix will be nulled
 * @param max_results the max number of results to be returned, even if more elements would be removable
 * @param filter a filter which accepts (or rejects) elements into the result. If null, all elements will be accepted
 * @param result_creator a supplier required to create the result, e.g. ArrayList::new
 * @param accumulator an accumulator accepting the result and an element, e.g. ArrayList::add
 * @param <R> the type of the result
 * @return the result
 */
public <R> R removeMany(boolean nullify, int max_results, Predicate<T> filter,
            Supplier<R> result_creator, BiConsumer<R,T> accumulator) {
  lock.lock();
  try {
    Remover<R> remover=new Remover<>(nullify, max_results, filter, result_creator, accumulator);
    forEach(hd+1, hr, remover);
    return remover.getResult();
  }
  finally {
    lock.unlock();
  }
}
origin: org.jboss.eap/wildfly-client-all

/**
 * Returns a list of missing messages
 * @param max_msgs If > 0, the max number of missing messages to be returned (oldest first), else no limit
 * @return A SeqnoList of missing messages, or null if no messages are missing
 */
public SeqnoList getMissing(int max_msgs) {
  lock.lock();
  try {
    if(size == 0)
      return null;
    long start_seqno=getHighestDeliverable() +1;
    int capacity=(int)(hr - start_seqno);
    int max_size=max_msgs > 0? Math.min(max_msgs, capacity) : capacity;
    if(max_size <= 0)
      return null;
    Missing missing=new Missing(start_seqno, max_size);
    long to=max_size > 0? Math.min(start_seqno + max_size-1, hr-1) : hr-1;
    forEach(start_seqno, to, missing);
    return missing.getMissingElements();
  }
  finally {
    lock.unlock();
  }
}
origin: org.jboss.eap/wildfly-client-all

  hr=seqno;
if(remove_filter != null && hd +1 == seqno) {
  forEach(hd + 1, hr,
      (seq, msg, r, c) -> {
        if(msg == null || !remove_filter.test(msg))
org.jgroups.utilTableforEach

Javadoc

Iterates over the matrix with range [from .. to] (including from and to), and calls Visitor#visit(long,Object,int,int). If the visit() method returns false, the iteration is terminated.

This method must be called with the lock held

Popular methods of Table

  • add
    Adds elements from the list to the table
  • <init>
  • _add
  • _compact
    Moves the contents of matrix down by the number of purged rows and resizes the matrix accordingly. T
  • capacity
    Returns the total capacity in the matrix
  • compact
  • computeIndex
    Computes and returns the index within a row for seqno
  • computeRow
    Computes and returns the row index for seqno. The caller must hold the lock.
  • computeSize
    Iterate from low to hr and add up non-null values. Caller must hold the lock.
  • findHighestSeqno
  • get
    Returns an element at seqno
  • getAdders
  • get,
  • getAdders,
  • getDigest,
  • getHighestDeliverable,
  • getHighestDelivered,
  • getHighestReceived,
  • getLow,
  • getMissing,
  • getNumCompactions

Popular in Java

  • Finding current android device location
  • notifyDataSetChanged (ArrayAdapter)
  • getSupportFragmentManager (FragmentActivity)
  • onCreateOptionsMenu (Activity)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • 21 Best IntelliJ Plugins
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