question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Introduce a "sending side" (settable) for Deferred

See original GitHub issue

As reported by @vaskir at public Slack:

What if I want to pass it as a channel somewhere, then wait until it’s ready? I do it with a channel like this:

    val reply = Channel<Long>()
    getAndResetCh.send(reply)
    return reply.receive()
}

so I send a message to an actor “do the job, then send the result to this channel when ready”, then I wait on receive asynchronously.

So, the use-case is basically to send some object to remote actor to receive a single answer from it. How to we name such and object and what would its “sending” (setting) function be named?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:21 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
elizarovcommented, Jun 19, 2017

I’m inclining to introduce a class named Completable<T> that implements Deferred<T> and has the following two functions:

fun complete(value: T): Boolean
fun completeWithException(exception: Throwable): Boolean

Both functions return false when invoked on an already completed instance.

0reactions
elizarovcommented, Jul 24, 2017

Released in version 0.17

Read more comments on GitHub >

github_iconTop Results From Across the Web

message deferral - Azure Service Bus | Microsoft Learn
This article explains how to defer delivery of Azure Service Bus messages. The message remains in the queue or subscription, but it's set...
Read more >
Queries - Apollo GraphQL Docs
This article shows how to fetch GraphQL data in React with the useQuery hook and attach the result to your UI. You'll also...
Read more >
Understanding TCP internals step by step for Software ...
During TCP connection 3-Way handshake, both sides initialize their rwnd size with ... The sender sends only 1 TCP segment to the receiver....
Read more >
The Script element - HTML: HyperText Markup Language
defer. This Boolean attribute is set to indicate to a browser that ... the <script> element to embed data in HTML with server-side...
Read more >
Chapter 12 Transmission Control Protocol (TCP)
Solution: send a segment with URG bit set. ▫ Sender creates a segment, insert the urgent data at the beginning of the segment...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found