congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Promise.getResultWithTimeout
Code IndexAdd Tabnine 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)

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() {
  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.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

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • runOnUiThread (Activity)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JCheckBox (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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