When off‑loading logic in Salesforce, decide between @future and Queueable Apex. This guide outlines constraints, compares features in a table, explains trade‑offs, and shows concrete code examples with validation steps.
If you’ve hit the @future limits or need to pass complex data, Apex Queueable offers a supported, flexible alternative. This post walks through why, how, and when to use Queueable jobs, with a concrete example and trade‑offs.
Goal The goal is to determine whether an @future method can see changes made to a record in the transaction that invoked it, such as those performed by a trigger or a DML operation. Constraints & Uncertainty @future methods run in a separate transaction, which means they do not inherit the data context of the calling transaction. Governor limits (e.g., 5
Goal Determine whether a Clojure future can be cancelled when its deref operation times out, given that core.async timeout channels support cancellation by closing the channel while futures lack a built‑in cancellation API. Constraints and uncertainty The clojure.core/future macro starts a thread that cannot be stopped via a library function; deref with a ti
When applying a timeout to a ceylon.concurrent.Future using orElseAfter in Ceylon 1.3.3, the implementation cancels the underlying task with cancel(true) . The language tour notes that the actual stopping of the computation depends on the executor and may differ between the JVM and JavaScript backends, leaving the cancellation behavior unspecified. Developer
Goal Determine whether the Dart `Future.wait` API with `eagerError:true` should automatically cancel remaining pending futures to prevent resource retention. Constraints and Uncertainty The current implementation does not guarantee cancellation of the other futures, and the language specification leaves the cancellation semantics undefined, meaning behavior
When using parfeval to run long computations asynchronously, a common pattern is to enforce a wall-clock limit by polling the State property of the returned Future object and calling cancel once a timeout threshold is exceeded. The cancel function is documented to terminate execution on the worker and transition the future to the cancelled state, but the exa
Goal Implement a background service that polls a REST endpoint every minute and processes the response in a Flutter app. Constraints The service runs for hours, so memory consumption and subscription lifecycle must be managed carefully. The implementation should be easy to debug and maintain. Unresolved Decision Should the polling logic use a single Future p