Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-97569

Remove CallbackHandle-returning TaskExecutor methods

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Server Programmability

      TaskExecutor predates the introduction of Future in the server codebase, so it provides a (what is now) nonstandard API that accepts callbacks as arguments and returns CallbackHandle, which allows the caller to join on the task's completion or cancel it. Today, this functionality is provided through Futures and CancellationToken, so there is no need to maintain the older API. TaskExecutor does currently offers a Future-returning API which is based on the CallbackHandle-returning one, but has a bit of overhead which could be avoided once the Future-based API was the only one. Standardizing on Future also helps promote uniformity in async programming across the server.

      Furthermore, the internals of ThreadPoolTaskExecutor, the main non-proxying TaskExecutor implementation, and its subcomponent NetworkInterfaceTL were rewritten to use Futures and CancellationTokens as part of SPM-3750, so dropping the non-Future based API would simplify ThreadPoolTaskExecutor's implementation.

            Assignee:
            Unassigned Unassigned
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: