Codota Logo
Promise.getResultWithTimeout
Code IndexAdd Codota to your IDE (free)

How to use
getResultWithTimeout
method
in
org.jgroups.util.Promise

Best Java code snippets using org.jgroups.util.Promise.getResultWithTimeout (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: wildfly/wildfly

public T getResult(long timeout, boolean reset) {
  try {
    return getResultWithTimeout(timeout, reset);
  }
  catch(TimeoutException e) {
    return null;
  }
}
origin: wildfly/wildfly

public T getResult() {
  try {
    return getResultWithTimeout(0);
  }
  catch(TimeoutException e) {
    return null;
  }
}
origin: wildfly/wildfly

public boolean waitForAllAcks(long timeout) throws TimeoutException {
  if(missing_acks.isEmpty())
    return true;
  Boolean result=all_acks_received.getResultWithTimeout(timeout);
  return result != null && result;
}
origin: wildfly/wildfly

private void waitForUnblock() {
  try {
    flush_unblock_promise.reset();
    flush_unblock_promise.getResultWithTimeout(end_flush_timeout);
  } catch (TimeoutException t) {
    if (log.isWarnEnabled())
      log.warn(localAddress + ": waiting for UNBLOCK timed out after " + end_flush_timeout + " ms");
  }
}
origin: wildfly/wildfly

public Counter getOrCreateCounter(String name, long initial_value) {
  if(local_addr == null)
    throw new IllegalArgumentException("the channel needs to be connected before creating or getting a counter");
  Owner owner=getOwner();
  GetOrCreateRequest req=new GetOrCreateRequest(owner, name, initial_value);
  Promise<long[]> promise=new Promise<>();
  pending_requests.put(owner, new Tuple<>(req, promise));
  sendRequest(coord, req);
  long[] result=new long[0];
  try {
    result=promise.getResultWithTimeout(timeout);
    long value=result[0], version=result[1];
    if(!coord.equals(local_addr))
      counters.put(name, new VersionedValue(value, version));
    return new CounterImpl(name);
  }
  catch(TimeoutException e) {
    throw new RuntimeException(e);
  }
}
origin: wildfly/wildfly

FlushStartResult r = flush_promise.getResultWithTimeout(start_flush_timeout);
if(r.failed())
  throw new RuntimeException(r.getFailureCause());
origin: wildfly/wildfly

@Override
public long addAndGet(long delta) {
  if(local_addr.equals(coord)) {
    VersionedValue val=getCounter(name);
    long retval=val.addAndGet(delta)[0];
    if(backup_coords != null)
      updateBackups(name, val.value, val.version);
    return retval;
  }
  Owner owner=getOwner();
  Request req=new AddAndGetRequest(owner, name, delta);
  Promise<long[]> promise=new Promise<>();
  pending_requests.put(owner, new Tuple<>(req, promise));
  sendRequest(coord, req);
  Object obj=null;
  try {
    obj=promise.getResultWithTimeout(timeout);
    if(obj instanceof Throwable)
      throw new IllegalStateException((Throwable)obj);
    long[] result=(long[])obj;
    long value=result[0], version=result[1];
    if(!coord.equals(local_addr))
      counters.put(name, new VersionedValue(value, version));
    return value;
  }
  catch(TimeoutException e) {
    throw new RuntimeException(e);
  }
}
origin: wildfly/wildfly

Object obj=null;
try {
  obj=promise.getResultWithTimeout(timeout);
  if(obj instanceof Throwable)
    throw new IllegalStateException((Throwable)obj);
origin: wildfly/wildfly

@Override
public void set(long new_value) {
  if(local_addr.equals(coord)) {
    VersionedValue val=getCounter(name);
    val.set(new_value);
    if(backup_coords != null)
      updateBackups(name, val.value, val.version);
    return;
  }
  Owner owner=getOwner();
  Request req=new SetRequest(owner, name, new_value);
  Promise<long[]> promise=new Promise<>();
  pending_requests.put(owner, new Tuple<>(req, promise));
  sendRequest(coord, req);
  Object obj=null;
  try {
    obj=promise.getResultWithTimeout(timeout);
    if(obj instanceof Throwable)
      throw new IllegalStateException((Throwable)obj);
    long[] result=(long[])obj;
    long value=result[0], version=result[1];
    if(!coord.equals(local_addr))
      counters.put(name, new VersionedValue(value, version));
  }
  catch(TimeoutException e) {
    throw new RuntimeException(e);
  }
}
origin: org.jgroups/com.springsource.org.jgroups

public Object getResult() {
  try {
    return getResultWithTimeout(0);
  }
  catch(TimeoutException e) {
    return null;
  }
}
origin: org.jboss.eap/wildfly-client-all

public T getResult(long timeout, boolean reset) {
  try {
    return getResultWithTimeout(timeout, reset);
  }
  catch(TimeoutException e) {
    return null;
  }
}
origin: org.jboss.eap/wildfly-client-all

public T getResult() {
  try {
    return getResultWithTimeout(0);
  }
  catch(TimeoutException e) {
    return null;
  }
}
origin: org.jgroups/com.springsource.org.jgroups

/**
 * Returns the result, but never throws a TimeoutException; returns null instead.
 * @param timeout
 * @return Object
 */
public Object getResult(long timeout) {
  try {
    return getResultWithTimeout(timeout);
  }
  catch(TimeoutException e) {
    return null;
  }
}
origin: org.jboss.eap/wildfly-client-all

public boolean waitForAllAcks(long timeout) throws TimeoutException {
  if(missing_acks.isEmpty())
    return true;
  Boolean result=all_acks_received.getResultWithTimeout(timeout);
  return result != null && result;
}
origin: org.jgroups/com.springsource.org.jgroups

public boolean waitForAllAcks(long timeout) throws TimeoutException {
  if(missing_acks.size() == 0)
    return true;
  Object result=all_acks_received.getResultWithTimeout(timeout);
  return result != null && result instanceof Boolean && ((Boolean)result).booleanValue();
}
origin: org.jgroups/com.springsource.org.jgroups

public void stopFlush() {
  if(!flush_supported) {
    throw new IllegalStateException("Flush is not supported, add pbcast.FLUSH protocol to your configuration");
  }
  
  flush_unblock_promise.reset();
  down(new Event(Event.RESUME));
  
  //do not return until UNBLOCK event is received        
  boolean shouldWaitForUnblock = receive_blocks;        
  if(shouldWaitForUnblock){
    try{              
     flush_unblock_promise.getResultWithTimeout(5000);
    }
    catch (TimeoutException te){              
    }
  }
}
origin: org.jboss.eap/wildfly-client-all

private void waitForUnblock() {
  try {
    flush_unblock_promise.reset();
    flush_unblock_promise.getResultWithTimeout(end_flush_timeout);
  } catch (TimeoutException t) {
    if (log.isWarnEnabled())
      log.warn(localAddress + ": waiting for UNBLOCK timed out after " + end_flush_timeout + " ms");
  }
}
origin: org.jboss.eap/wildfly-client-all

public Counter getOrCreateCounter(String name, long initial_value) {
  if(local_addr == null)
    throw new IllegalArgumentException("the channel needs to be connected before creating or getting a counter");
  Owner owner=getOwner();
  GetOrCreateRequest req=new GetOrCreateRequest(owner, name, initial_value);
  Promise<long[]> promise=new Promise<>();
  pending_requests.put(owner, new Tuple<>(req, promise));
  sendRequest(coord, req);
  long[] result=new long[0];
  try {
    result=promise.getResultWithTimeout(timeout);
    long value=result[0], version=result[1];
    if(!coord.equals(local_addr))
      counters.put(name, new VersionedValue(value, version));
    return new CounterImpl(name);
  }
  catch(TimeoutException e) {
    throw new RuntimeException(e);
  }
}
origin: org.jgroups/com.springsource.org.jgroups

if(shouldWaitForUnblock){
  try{
   flush_unblock_promise.getResultWithTimeout(FLUSH_UNBLOCK_TIMEOUT);
origin: org.jboss.eap/wildfly-client-all

@Override
public void set(long new_value) {
  if(local_addr.equals(coord)) {
    VersionedValue val=getCounter(name);
    val.set(new_value);
    if(backup_coords != null)
      updateBackups(name, val.value, val.version);
    return;
  }
  Owner owner=getOwner();
  Request req=new SetRequest(owner, name, new_value);
  Promise<long[]> promise=new Promise<>();
  pending_requests.put(owner, new Tuple<>(req, promise));
  sendRequest(coord, req);
  Object obj=null;
  try {
    obj=promise.getResultWithTimeout(timeout);
    if(obj instanceof Throwable)
      throw new IllegalStateException((Throwable)obj);
    long[] result=(long[])obj;
    long value=result[0], version=result[1];
    if(!coord.equals(local_addr))
      counters.put(name, new VersionedValue(value, version));
  }
  catch(TimeoutException e) {
    throw new RuntimeException(e);
  }
}
org.jgroups.utilPromisegetResultWithTimeout

Javadoc

Blocks until a result is available, or timeout milliseconds have elapsed

Popular methods of Promise

  • _getResultWithTimeout
    Blocks until a result is available, or timeout milliseconds have elapsed. Needs to be called with a
  • getResult
  • hasResult
    Checks whether result is available. Does not block.
  • reset
  • setResult
    Sets the result and notifies any threads waiting for it
  • <init>
  • doWait

Popular in Java

  • Parsing JSON documents to java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • getApplicationContext (Context)
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now