Created
May 18, 2015 12:34
-
-
Save smaldini/577718a9c71571b4b364 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return PublisherFactory.create( | |
(n, s) -> { | |
long i = 0l; | |
while (i < n && s.context().get() < elements) { | |
if(s.isCancelled()) return; | |
s.onNext(s.context().getAndIncrement()); | |
i++; | |
} | |
if(s.context().get() == elements){ | |
s.onComplete(); | |
} | |
}, | |
s -> new AtomicLong(0L) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment