Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Jules Ivanic
@guizmaii
ahah
Cancelable.empty == uncancelable ?
Oleg Pyzhcov
@oleg-py
Yep
Jules Ivanic
@guizmaii
so. Impossible to kill a running Runnable ?? :’(
Oleg Pyzhcov
@oleg-py
Yeah. Monix doesn't give you Thread.interrupt()esque things. Your only way is to rewrite the logic inside.
Jules Ivanic
@guizmaii
ahah
So i’m fucked :/
Oleg Pyzhcov
@oleg-py
Effective cancellation requires either:
  1. Cleanup action specified as Cancelable
  2. Logic written as a series of Tasks, not as a single monolithic one
Fabio Labella
@SystemFw
what does the logic actually do?
Jules Ivanic
@guizmaii
compute things I can’t talk about
Fabio Labella
@SystemFw
you first need to think about what it means to cancel that at all, before thinking about what it means to do it with monix, or cats-effect, or whatever
sure, I don't need to know what things you are computing
but kinda how: are these http calls (canceling means stop waiting for a response)
or cpu computation expresses as one big thing?
the latter is impossible to cancel
it's not about monix
Jules Ivanic
@guizmaii
cpu computation
:/
Fabio Labella
@SystemFw
can you express that computation has a series of flatMap
?
Piotr Gawryś
@Avasil
I assume you have no way of splitting it?
Jules Ivanic
@guizmaii

can you express that computation has a series of flatMap

No

Oleg Pyzhcov
@oleg-py
Can you modify computation code to periodically check for an AtomicBoolean?
Jules Ivanic
@guizmaii

Can you modify computation code to periodically check for an AtomicBoolean?

Maybe but it’ll require me weeks of work I don’t have. :/

Oleg Pyzhcov
@oleg-py
Then you're left with option of Thread.interrupt() and a lot of hope
Piotr Gawryś
@Avasil
Its like "guess who" game :D
Oleg Pyzhcov
@oleg-py
Now @SystemFw will probably talk you out of it :D
Fabio Labella
@SystemFw
nah
I just want to point out that this isn't a Monix (or cats-effect) design constraint or anything
on the JVM, you can't just stop an arbitrary thing
just unplug it
the model simply doesn't allow you to do that
Jules Ivanic
@guizmaii
:/
Fabio Labella
@SystemFw
there are the various Thread.stop and interrupt primitives
they might work
they are also considered unsafe (and dangerous)
Oleg Pyzhcov
@oleg-py
Oh, there's also subprocessing
Jules Ivanic
@guizmaii
If I meet some of you one day, I’ll pay you a beer or two ! You’re always here or there to help me. Thanks a lot :)
Jules Ivanic
@guizmaii
in fact the AtomicBoolean trick can maybe do the job. #excited :smile:
Damian Reeves
@DamianReeves
Hi. Does monix provide any utility for going from a Java Future to a scala Future or a monix Task?
toxicafunk
@toxicafunk
i'm pretty sure there was an fromFuture either on task or on observable
Damian Reeves
@DamianReeves
yeah that is for a scala future
Best I can think to do is top wrap the polling required with a task, but this feels like it should exist already somewhere
toxicafunk
@toxicafunk
oh sorry, I misread
need to check if this got implemented though
Damian Reeves
@DamianReeves
thanks for pointing to the issue... unfortunately I'm stuck with scala 2.11 for the time being
Aleksandr Melnikov
@amelnikov-mylivn

Hello. I wolnder if monix 3.0.0-RC1 is compatiable with cats 1.4.0 and cats-effect 1.0.0?
I got two wierd exceptions:

java.lang.AbstractMethodError: Method monix/eval/instances/CatsConcurrentForTask$.bracketCase(Ljava/lang/Object;Lscala/Function1;Lscala/Function2;)Ljava/lang/Object; is abstract
    at monix.eval.instances.CatsConcurrentForTask$.bracketCase(CatsAsyncForTask.scala)
    at cats.effect.Bracket.bracket(Bracket.scala:64)
    at cats.effect.concurrent.Semaphore$AbstractSemaphore.withPermit(Semaphore.scala:244)

and

java.lang.ClassCastException: monix.eval.Task$Eval cannot be cast to cats.effect.IO
    at monix.eval.internal.TaskEffect$.$anonfun$cancelable$1(TaskEffect.scala:59)
    at monix.eval.internal.TaskEffect$.$anonfun$cancelable$1$adapted(TaskEffect.scala:52)
    at monix.eval.internal.TaskRunLoop$.executeAsyncTask(TaskRunLoop.scala:421)
    at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:110)
    at monix.eval.internal.TaskRunLoop$RestartCallback.onSuccess(TaskRunLoop.scala:537)
    at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:117)
    at monix.eval.internal.TaskMemoize$Register.$anonfun$registerListener$1(TaskMemoize.scala:132)
    at monix.eval.internal.TaskMemoize$Register.$anonfun$registerListener$1$adapted(TaskMemoize.scala:129)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
    at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
I got this error after I added Semaphore[Task, Unit] usage in my code