-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate SendChannel.isFull and ReceiveChannel.isEmpty properties #1053
Comments
I am currently using isFull for one simple case. |
@Tolriq the proper solution is not to do it. Could you please elaborate on why you have to do that? Channel is an implementation detail of how actor processes queued messages, not something that is exposed to the public. This is actually one of the reasons why current actors are obsolete and new ones (#87) will hide the channel as an implementation detail in the future. The answer to the question "how to do it anyway when
|
The need is not a "real" need, but an easy way to workaround an Android 8 issue with foreground services. My actor is really simple actually
Due to racy conditions in Android 8 I have a case where I just check if the actor is running or not to call one more stopForeground in case the previous stopForeground was not working due to the startForeground not processed fast enough by the OS. (Love Android ;)) I suppose I can just do the following to achieve the same result, but was hoping for something native without AtomicBoolean.
|
I have a use case, though I could imagine workarounds. I'm using (rendezvous) channels in a "fan-out" mode to distribute tasks to a variably-sized pool of actors (little-a, I'm not using the built-in actor abstraction). Each actor is doing something like:
the code sending tasks is using isFull as a hint to add another actor to the party (subject to a max omitted for clarity):
I'm open to suggestions and alternatives. Simply launching a coro for each task would be an option if there were a way to constrain the number simultaneously active (to bound resource use) with queueing semantics when the bound is hit. If it's not obvious, this is a server-side use case. |
…iveChannel.isEmpty` properties See "Deprecate SendChannel.isFull and ReceiveChannel.isEmpty properties #1053"
…iveChannel.isEmpty` properties See "Deprecate SendChannel.isFull and ReceiveChannel.isEmpty properties #1053"
I think that possibility to monitor the buffer remaining size is very useful for performance tuning when you need to found a problematic place in the processing chain for example. I'm currently using isFull also for logging purposes. |
It is weird that
In my app I'm using |
@tprochazka |
We are working on a better, faster algorithms for channel implementation and
isFull
andisEmpty
experimental properties are hard to support there. Since we were not able to find any compelling use-cases to support those properties, we are removing them in advance (in upcoming release).The text was updated successfully, but these errors were encountered: