I know a lot of reasons for Scala Future to be better. Are there any reasons to use Twitter Future instead? Except the fact Finagle uses it.
What are advantages of a Twitter Future over a Scala Future?
6.3k Views Asked by Sergey Alaev At
2
There are 2 best solutions below
5
Régis Jean-Gilles
On
As far as I can tell the main difference that could go in favor of using Twitter's Future is that it can be cancelled, unlike scala's Future.
Also, there used to be some support for tracing the call chains (as you probably know plain stack traces are close to being useless when using Futures). In other words, you could take a Future and tell what chain of map/flatMap produced it. But the idea has been abandoned if I understand correctly.
Related Questions in SCALA
- Mocking AmazonS3 listObjects function in scala
- Last SPARK Task taking forever to complete
- How to upload a native scala project to local repo by sbt like using "maven install"
- Folding a list of OR clauses in io.getquill
- How to get latest modified file using scala from a folder in HDFS
- Enforce type bound for inferred type parameter in pattern matching
- can't write pyspark dataframe to parquet file on windows
- spark streaming and kafka integration dependency problem
- how to generate fresh singleton literal type in scala using macros
- exception during macro expansion: type T is not a class, play json
- Is there any benefit of converting a List to a LazyList in Scala?
- Get all records within a window in spark structured streaming
- sbt publishLocal of a project with provided dependencies in build.sbt doesn't make these dependencies visible to projects using the project as library
- Scala composition of partially-applied functions
- How to read the input json using a schema file and populate default value if column not being found in scala?
Related Questions in TWITTER
- issue with Twitter API :
- Unable to use snscrape
- Unable to like a tweet with using Tweepy and Twitter/X v2 API
- automatic commenting for users on the home page of Twitter
- I have a tweet (X) download that is all code. I'm not a coder and I just want to read the message. Can someone help me do that?
- Web scraping using Selenium (not working)
- Twitter oauth2 link seems correct but not working
- Is logging via selenium blocked by twitter?
- Login with twitter using identity server is not working when using openidconnect
- Apache flume does not run hadoop 3.1.0 Flume 1.11
- How to verify Twitter oauth2.0 access token
- Twitter embedded timeline is showing "Nothing to see here"
- Twitter parsing with Selenium python
- Error in login with twitter function on React Native app
- Nothing is happening after solving FunCaptcha
Related Questions in FINAGLE
- How Can I Use a Self-Signed Certificate with a Finagle Server
- What does the warn message "failed to create Hotspot JVM interface, using NilJvm instead" mean?
- Finagle client is not refreshing dns cache properly
- Scala Design Question - Unify 3 similar endpoints to retrieve from database
- SSlconfiguration exception on finagle upgrade
- Whitelist dependency for dependencyConvergence rule in Maven Enforcer plugin
- Finagle and load balancing
- Print the JSON response from GET request in Finagle
- error: object Service is not a member of package com.twitter.finagle - Defining Bazel dependencies in Build file, Scala finagle
- Simple hello world api using finagle - Error: object twitter is not a member of package com import com.twitter.finagle.Http
- ChannelClosedException - Upstream Address: Not Available
- Return Twitter's Future within a certain duration
- Twitter Future blocking
- Finagle KetamaShardingServiceBuilder is unknown
- Scala: missing implicit generic parameter shapeless.LabelledGeneric.Aux[T,L], how to provide it?
Related Questions in TWITTER-FINAGLE
- Finagle client is not refreshing dns cache properly
- Twitter Futures - how are unused futures handled?
- Finagle and load balancing
- Could we use sleuth without spring cloud?
- Print the JSON response from GET request in Finagle
- ChannelClosedException - Upstream Address: Not Available
- configuration of twitter finagle redis client with tls enabled
- Starting two Scala Finagle ListeningServers at once
- How to make a finagle client automatic try to reconnect if the server goes down?
- How does one get all query params from within a endpoint?
- TwitterServer (Finch/Finagle) seems to block api call till it finishes its calculation
- Finagle filter sequence of futures of option
- cannot find symbol symbol: variable param location: class com.twitter.finagle.transport.Transport.Liveness
- java.lang.IllegalArgumentException: Failure parsing Toggle config resources when updating Scala version from 2.11 to 2.12
- Twitter Future & Cats Arrow
Related Questions in TWITTER-UTIL
- What does the warn message "failed to create Hotspot JVM interface, using NilJvm instead" mean?
- Twitter Futures - how are unused futures handled?
- How to compare Scala Twitter Futures?
- Return Twitter's Future within a certain duration
- Why does Finatra use flatMap and not just map?
- Best way to convert a Java Future to a Twitter Future
- Async logging using Twitter Futures in Scala
- How to specify the execution service for future callbacks in Twitter Util?
- com.twitter.util.Await doesn't raise a com.twitter.util.TimeoutException
- How do you combine multiple com.twitter.util.Awaitable's with Future.select semantics?
- How do I execute the code and see the results using twitter util-eval
- Forcing an AsyncStream[A] into a Seq[A] in scala
- Twitter's Future.collect not working concurrently (Scala)
- Storage tweets using spark in a multicore cluster
- Executing sequence of functions that return a future sequentially
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Disclaimer: I worked at Twitter on the Future implementation. A little bit of context, we started our own implementation before Scala had a "good" implementation of
Future.Here're the features of Twitter's
Future:Futurehas some new helper methods in the companion.e.g. Just one example:
Future.join(f1, f2)can work on heterogeneous Future types.oandikeep their types, they're not casted into the least common supertypeAny.A chain of onSuccess is guaranteed to be executed in order: e.g.:
#1 is guaranteed to be executed before #2
The Threading model is a little bit different. There's no notion of ExecutionContext, the Thread that set the value in a Promise (Mutable implementation of a Future) is the one executing all the computations in the future graph. e.g.:
There's a notion of interruption/cancellation. With Scala's Futures, the information only flows in one direction, with Twitter's Future, you can notify a producer of some information (not necessarily a cancellation). In practice, it's used in Finagle to propagate the cancellation of a RPC. Because Finagle also propagates the cancellation across the network and because Twitter has a huge fan out of requests, this actually saves lots of work.
Until recently, Twitter's Future were the only one to implement efficient tail recursion (i.e. you can have a recursive function that call itself without blowing up you call stack). It has been implemented in Scala 2.11+ (I believe).