Tabnine Logo
Queue.offer
Code IndexAdd Tabnine to your IDE (free)

How to use
offer
method
in
com.oath.cyclops.async.adapters.Queue

Best Java code snippets using com.oath.cyclops.async.adapters.Queue.offer (Showing top 20 results out of 315)

origin: aol/cyclops

@Override
public boolean offer(T t) {
  return host.offer(t);
}
origin: aol/cyclops

@Override
public boolean addAll(final Collection<? extends T> c) {
  subscribers.forEach(it -> c.forEach(next -> it.offer(next)));
  return true;
}
origin: aol/cyclops

@Override
public boolean add(final T e) {
  subscribers.forEach(it -> it.offer(e));
  return true;
}
origin: com.oath.cyclops/cyclops

@Override
public boolean offer(T t) {
  return host.offer(t);
}
origin: aol/cyclops

  return Continuation.empty();
} else {
  queue.offer(local.next());
origin: aol/cyclops

} else {
  queue.offer(local.next());
origin: com.oath.cyclops/cyclops

@Override
public boolean add(final T e) {
  subscribers.forEach(it -> it.offer(e));
  return true;
}
origin: com.oath.cyclops/cyclops

@Override
public boolean addAll(final Collection<? extends T> c) {
  subscribers.forEach(it -> c.forEach(next -> it.offer(next)));
  return true;
}
origin: Nextdoor/bender

 @Override
 public void run() {
  while (events.hasNext()) {
   try {
    eventQueue.offer(events.next());
   } catch (Queue.ClosedQueueException e) {
    break;
   }
  }
  try {
   eventQueue.close();
  } catch (Queue.ClosedQueueException e) {
  }
 }
}).start();
origin: Nextdoor/bender

 @Override
 public void run() {
  this.input.forEach(ievent -> {
   this.output.offer(ievent);
  });
  this.input.close();
  /*
   * When all consumers are done have the last one close the queue.
   */
  if (countdown.decrementAndGet() <= 0) {
   this.output.close();
  }
 }
}
origin: Nextdoor/bender

 @Override
 public void run() {
  this.input.forEach(ievent -> {
   this.output.offer(ievent);
  });
  this.input.close();
  /*
   * When all consumers are done have the last one close the queue.
   */
  if (countdown.decrementAndGet() <= 0) {
   this.output.close();
  }
 }
}
origin: com.oath.cyclops/cyclops-futurestream

  @Override
  default <K> void toQueue(final Map<K, Queue<U>> shards, final Function<? super U, ? extends K> sharder) {

    thenSync(it -> shards.get(sharder.apply(it))
               .offer(it)).allOf(data -> {
                 shards.values()
                    .forEach(it -> it.close());
                 return true;
               });

  }
}
origin: Nextdoor/bender

 @Override
 public void run() {
  input.forEach(ievent -> {
   queues.forEach(queue -> {
    /*
     * The original event is NOT sent to each fork. Rather a copy of the event is sent to
     * each fork. This ensures that there is no contention between the operations performed
     * on each event. Caveat is that when the forks join there will be two events produced.
     */
    queue.offer(ievent.copy());
   });
  });
  for (Queue<InternalEvent> queue : queues) {
   queue.close();
  }
 }
}).start();
origin: com.oath.cyclops/cyclops-futurestream

@Override
default <K> void toQueue(final Map<K, Queue<U>> shards, final Function<? super U, ? extends K> sharder) {
  //in this case all the items have to be pushed to the shards,
  //we can't rely on the client pulling them all to getValue them in to the right shards
  final LazyReact service = getPopulator();
  then(it -> shards.get(sharder.apply(it))
           .offer(it),
     service.getExecutor()).runThread(() -> {
       shards.values()
          .forEach(it -> it.close());
       returnPopulator(service);
     });
}
origin: com.oath.cyclops/cyclops-futurestream

@Override
default void addToQueue(final Queue queue) {
  thenSync(it -> queue.offer(it)).allOf(it -> queue.close());
}
origin: com.oath.cyclops/cyclops-futurestream

@Override
default Queue<U> toQueue(final Function<Queue, Queue> modifier) {
  final Queue<U> queue = modifier.apply(this.getQueueFactory()
                       .build());
  thenSync(it -> queue.offer(it)).allOf(it -> queue.close());
  return queue;
}
origin: Nextdoor/bender

 @Override
 public void run() {
  for (int i = 0; i < 1000; i++) {
   if (i % 500 == 0) {
    try {
     Thread.sleep(1000);
    } catch (InterruptedException e) {
    }
   }
   q.offer(new DummyEvent("" + i, 0));
  }
  q.close();
 }
}).start();
origin: Nextdoor/bender

 @Override
 public void run() {
  for (int i = 0; i < 1000; i++) {
   if (i % 500 == 0) {
    try {
     Thread.sleep(1000);
    } catch (InterruptedException e) {
    }
   }
   q.offer(new DummyEvent("" + i, 0));
  }
  q.close();
 }
}).start();
origin: com.oath.cyclops/cyclops-futurestream

/**
 * Convert the current Stream to a SimpleReact Queue
 *
 * @return Queue populated asynchrnously by this Stream
 */
@Override
default Queue<U> toQueue() {
  final Queue<U> queue = this.getQueueFactory()
                .build();
  thenSync(it -> queue.offer(it)).allOf(it -> queue.close());
  return queue;
}
origin: com.oath.cyclops/cyclops-futurestream

/**
 * flatten nested SimpleReactStreams
 *
 * @param stream Stream to flatten
 * @return flattened Stream
 */
static <U, R> SimpleReactStream<R> join(final SimpleReactStream<BaseSimpleReactStream<U>> stream) {
  final Queue queue = stream.getQueueFactory()
               .build();
  stream.then(it -> it.sync()
            .then(in->queue.offer(in)))
     .allOf(it -> queue.close());
  return stream.fromStream(queue.stream(stream.getSubscription()));
}
com.oath.cyclops.async.adaptersQueueoffer

Javadoc

Offer a single datapoint to this Queue If the queue is a bounded queue and is full it will block until space comes available or until offer time out is reached (default is Integer.MAX_VALUE DAYS).

Popular methods of Queue

  • close
    Close this Queue Poison Pills are used to communicate closure to connected Streams A Poison Pill is
  • <init>
  • jdkStream
  • closeAndClear
  • stream
  • add
    Add a single data point to the queue If the queue is a bounded queue and is full, will return false
  • size
  • addContinuation
  • get
  • streamCompletableFutures
  • withTimeout
  • checkTime
  • withTimeout,
  • checkTime,
  • closingStream,
  • closingStreamBatch,
  • closingStreamFutures,
  • ensureClear,
  • ensureNotPoisonPill,
  • ensureOpen,
  • getSizeSignal

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSystemService (Context)
  • setScale (BigDecimal)
  • getSharedPreferences (Context)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top plugins for Android Studio
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