Codota Logo
Promise.setResult
Code IndexAdd Codota 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)

  • 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 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

  • Start an intent from android
  • findViewById (Activity)
  • getContentResolver (Context)
  • onRequestPermissionsResult (Fragment)
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Table (org.hibernate.mapping)
    A relational table
  • 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