Tabnine Logo
Promise.setResult
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: wildfly/wildfly

public void handleJoinResponse(JoinRsp join_rsp) {
  join_promise.setResult(join_rsp); // will wake up join() method
}
origin: wildfly/wildfly

public void handleLeaveResponse() {
  leave_promise.setResult(true);  // unblocks thread waiting in leave()
}
origin: wildfly/wildfly

public void ack(long id) {
  forward_table.remove(id);
  ack_promise.setResult(id);  // lock acquition, but most of the times it is uncontended, so this is not a cost
}
origin: wildfly/wildfly

public synchronized void ack(Collection<Address> members) {
  for(Address member: members) {
    if(member != null && missing_acks.remove(member) && missing_acks.isEmpty())
      all_acks_received.setResult(Boolean.TRUE);
  }
}
origin: wildfly/wildfly

public synchronized void ack(Address ... members) {
  for(Address member: members) {
    if(member != null && missing_acks.remove(member) && missing_acks.isEmpty())
      all_acks_received.setResult(Boolean.TRUE);
  }
}
origin: wildfly/wildfly

public synchronized void destroy() {
  suspected_mbrs.clear();
  missing_acks.clear();
  expected_acks=0;
  all_acks_received.setResult(null);
}
origin: wildfly/wildfly

public synchronized void ack(Address member) {
  if(member != null && missing_acks.remove(member) &&  missing_acks.isEmpty())
    all_acks_received.setResult(Boolean.TRUE);
}
origin: wildfly/wildfly

public boolean retainAll(Collection<Address> members) {
  if(members == null) return false;
  boolean retval=false;
  synchronized(this) {
    suspected_mbrs.retainAll(members);
    if((retval=missing_acks.retainAll(members)) && missing_acks.isEmpty())
      all_acks_received.setResult(Boolean.TRUE);
  }
  return retval;
}
origin: wildfly/wildfly

protected void unblockAll() {
  flushing=false;
  send_lock.lock();
  try {
    send_cond.signalAll();
    ack_promise.setResult(null);
  }
  finally {
    send_lock.unlock();
  }
}
origin: wildfly/wildfly

protected void unblockAll() {
  flushing=false;
  send_lock.lock();
  try {
    send_cond.signalAll();
    ack_promise.setResult(null);
  }
  finally {
    send_lock.unlock();
  }
}
origin: wildfly/wildfly

protected void stopFlusher() {
  flushing=false;
  Thread tmp=flusher;
  while(tmp != null && tmp.isAlive()) {
    tmp.interrupt();
    ack_promise.setResult(null);
    try {
      tmp.join();
    }
    catch(InterruptedException e) {
    }
  }
}
origin: wildfly/wildfly

protected void stopFlusher() {
  flushing=false;
  Thread tmp=flusher;
  while(tmp != null && tmp.isAlive()) {
    tmp.interrupt();
    ack_promise.setResult(null);
    try {
      tmp.join();
    }
    catch(InterruptedException e) {
    }
  }
}
origin: wildfly/wildfly

protected synchronized void stopPingerThread() {
  ping_addr_promise.setResult(null);
  get_cache_promise.setResult(null);
  interruptPingerThread(true);
  if(pinger_thread != null) {
    try {
      pinger_thread.join(Global.THREAD_SHUTDOWN_WAIT_TIME);
    }
    catch(InterruptedException ignored) {
      Thread.currentThread().interrupt();
    }
    pinger_thread=null;
  }
}
origin: wildfly/wildfly

@Override
public void members(List<PingData> mbrs) {
  int cnt=1;
  for(PingData data: mbrs)
    System.out.printf("%d: %s\n", cnt++, data);
  if(stub != null)
    stub.destroy();
  promise.setResult(null);
}
origin: wildfly/wildfly

  ValueResponse tmp=(ValueResponse)rsp;
  if(tmp.result == -1 && tmp.version == -1)
    promise.setResult(null);
  else {
    long[] result={tmp.result,tmp.version};
    promise.setResult(result);
  promise.setResult(((BooleanResponse)rsp).result);
else if(rsp instanceof ExceptionResponse) {
  promise.setResult(new Throwable(((ExceptionResponse)rsp).error_message));
  promise.setResult(null);
origin: wildfly/wildfly

private void blockMessageDuringFlush() {
  boolean shouldSuspendByItself = false;
  blockMutex.lock();
  try {
    while (isBlockingFlushDown) {
      if (log.isDebugEnabled())
        log.debug(localAddress + ": blocking for " + (timeout <= 0 ? "ever" : timeout + "ms"));
      if(timeout <= 0) {
        notBlockedDown.await();
      }
      else { 
        shouldSuspendByItself = !notBlockedDown.await(timeout, TimeUnit.MILLISECONDS);
      }
      
      if (shouldSuspendByItself) {
        isBlockingFlushDown = false;      
        log.warn(localAddress + ": unblocking after " + timeout + "ms");
        flush_promise.setResult(new FlushStartResult(Boolean.TRUE,null));
        notBlockedDown.signalAll();
      }
    }                        
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
  } finally {
    blockMutex.unlock();
  }        
}
origin: wildfly/wildfly

private void onFlushReconcileOK(Message msg) {
  if (log.isDebugEnabled())
    log.debug(localAddress + ": received reconcile ok from " + msg.getSrc());
  synchronized (sharedLock) {
    reconcileOks.add(msg.getSrc());
    if (reconcileOks.size() >= flushMembers.size()) {
      flush_promise.setResult(SUCCESS_START_FLUSH);
      if (log.isDebugEnabled())
        log.debug(localAddress + ": all FLUSH_RECONCILE_OK received");
    }
  }
}
origin: wildfly/wildfly

/**
 * Starts the flush protocol
 * @param members List of participants in the flush protocol. Guaranteed to be non-null
 */
private void onSuspend(final List<Address> members) {
  Message msg = null;
  Collection<Address> participantsInFlush = null;
 synchronized (sharedLock) {
   flushCoordinator = localAddress;         
   // start FLUSH only on group members that we need to flush
   participantsInFlush = members;
   participantsInFlush.retainAll(currentView.getMembers());
   flushMembers.clear();
   flushMembers.addAll(participantsInFlush);
   flushMembers.removeAll(suspected);
      msg = new Message(null).src(localAddress).setBuffer(marshal(participantsInFlush, null))
    .putHeader(this.id, new FlushHeader(FlushHeader.START_FLUSH, currentViewId()));
 }
  if (participantsInFlush.isEmpty()) {
    flush_promise.setResult(SUCCESS_START_FLUSH);
  } else {
    down_prot.down(msg);
    if (log.isDebugEnabled())
      log.debug(localAddress + ": flush coordinator "
          + " is starting FLUSH with participants " + participantsInFlush);
  }
}
origin: wildfly/wildfly

protected void deliver(Message msg, SequencerHeader hdr) {
  Address sender=msg.getSrc();
  if(sender == null) {
    log.error("%s: sender is null, cannot deliver ::%d", local_addr, hdr.getSeqno());
    return;
  }
  long msg_seqno=hdr.getSeqno();
  if(sender.equals(local_addr)) {
    forward_table.remove(msg_seqno);
    if(hdr.flush_ack) {
      ack_promise.setResult(msg_seqno);
      if(ack_mode && !flushing && threshold > 0 && ++num_acks >= threshold) {
        ack_mode=false;
        num_acks=0;
      }
    }
  }
  if(!canDeliver(sender, msg_seqno)) {
    log.warn("%s: dropped duplicate message %s::%d", local_addr, sender, msg_seqno);
    return;
  }
  if(log.isTraceEnabled())
    log.trace(local_addr + ": delivering " + sender + "::" + msg_seqno);
  up_prot.up(msg);
  delivered_bcasts++;
}
origin: wildfly/wildfly

id=Bits.readShort(req_buf, 1);
time=time(use_ms) - Bits.readLong(req_buf, 3);
senders[id].promise.setResult(true); // notify the sender of the response
synchronized(rsp_latency) {
  rsp_latency.add(time);
org.jgroups.utilPromisesetResult

Javadoc

Sets the result and notifies any threads waiting for it

Popular methods of Promise

  • _getResultWithTimeout
    Blocks until a result is available, or timeout milliseconds have elapsed. Needs to be called with a
  • getResult
  • getResultWithTimeout
  • hasResult
    Checks whether result is available. Does not block.
  • reset
  • <init>
  • doWait

Popular in Java

  • Reading from database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSupportFragmentManager (FragmentActivity)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Path (java.nio.file)
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Collectors (java.util.stream)
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Top PhpStorm 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