Questions tagged [disposable]

Disposable is a ruby gem, which provides decorators on top of ORM layer.

61 questions
1
vote
1 answer

Memory management mechanism in RxSwift

I've been studying Rxswift for a while, so far I'm able to apply Rxswift to my projects. However I still don't understand how RxSwift manages the memory resources, especially the Disposable objects. For example: func foo() { let s =…
hoang Cap
  • 704
  • 6
  • 18
1
vote
1 answer

RxJava - Can I Bypass onSuccess and only have an onError option?

I am creating a Disposable: myDisposable = myObservableMethod().subscribe(this::mySuccess, this::myError); In this case, if myObservableMethod() returns a success, there is nothing more that I need to do, so mySuccess() is and empty method and…
Chris
  • 5,485
  • 15
  • 68
  • 130
1
vote
1 answer

Custom MedaTypeFormatter Causes ObjectDisposedException

I have a custom formatter to support my web calls, but a bug report shed some light on an issue. I was overriding the WriteToStreamAsync() method as such: public override Task WriteToStreamAsync(Type type, …
gregsdennis
  • 7,218
  • 3
  • 38
  • 71
1
vote
1 answer

Implementing IDisposable (the Disposable Pattern) as a service (class member)

The Disposable pattern is one that is re-implemented on a per class basis. So, I was looking for a way to generalize it. The problem I ran into a few years ago is that, even if you implement it as class itself, you can't have an object derive from…
Michael Yanni
  • 1,476
  • 4
  • 17
  • 29
1
vote
3 answers

How to implement explicit marking some reference as "unneeded" in Java?

It seems to me, that I found a situation, when the standard garbage collection algorithm can't be used well. Suppose I have some object A, which adds itself as event listener for events from object B upon construction. Since object has all required…
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
1
vote
3 answers

Finding disposable email addresses

I've been using undisposable.net's API to find disposable email addresses but noticed that the site no longer appears to be functional. Anybody know what happened to them? Are there any other sites that provide an API to disposable email address…
Guy
  • 65,082
  • 97
  • 254
  • 325
1
vote
2 answers

Returning an object that is linked to a disposable one

In the code below, does the disposal of principalCtx affect userPrin? Is principalCtx just used to find the user or does it somehow stay linked to the userPrin object? UserPrincipal userPrin= null; using(PrincipalContext principalCtx as new…
eych
  • 1,262
  • 2
  • 16
  • 37
1
vote
3 answers

Dispose or not dispose injectable instance using Ninject

I have the following code block for configuring Ninject in my solution: public class NinjectDependencyScope : IDependencyScope { private IResolutionRoot resolver; internal NinjectDependencyScope(IResolutionRoot resolver) …
Patrick Peters
  • 9,456
  • 7
  • 57
  • 106
1
vote
2 answers

How to check for disposed objects and throw ObjectDisposedException in methods if already disposed

I have a disposable class which implements IDisposalbe interface with disposable pattern. To maintain the constrains, I need to make sure that when the object has been disposed, any subsequent call to any public method throws…
1
vote
2 answers

.NET - Why is disposing of standard output only allowed during unit tests?

First of all, I want to point out that I do not really want to dispose of the standard output...I just want to know why I'm seeing the described behavior. I didn't write the bad code described. I'm using .NET 4 for the unit tests and .NET 3.5 for…
bsara
  • 7,940
  • 3
  • 29
  • 47
0
votes
2 answers

creating and terminating a thread contained in a collection

I have a custom collection (a thread-safe ObservableQueue). I implemented the business logic inside the collection class (i.e. dequeue the items one by one and expose them to the outside). This is working fine. To prevent the collection from…
Sascha Hennig
  • 2,556
  • 1
  • 19
  • 22
0
votes
1 answer

Disposing CancellationTokenSource and its Register

Does the following line have to be disposed? If so, how? var resetSignal = new CancellationTokenSource(sleepDuration.Add(TimeSpan.FromSeconds(-1))); Code internal static class Retry { private const string SleepDurationKey = "Broken"; …
nop
  • 4,711
  • 6
  • 32
  • 93
0
votes
1 answer

Disposable.Create async overload

I'm working on a message bus class library for Redis (StackExchange.Redis) and NATS (AlterNats). The SubscribeAsync method uses observers from System.Reactive for the callbacks. The problem is _connection in NatsSubscriber has only DisposeAsync…
nop
  • 4,711
  • 6
  • 32
  • 93
0
votes
1 answer

RxJava im Android & operations that shouldn't be cancelled

https://developer.android.com/topic/architecture/data-layer#in-memory-cache While browsing through these documentation, I saw that Coroutines have super easy control over the fact that Internet connections are made from the AppCoroutineContext and…
Jacek
  • 73
  • 6
0
votes
1 answer

When is an object disposed if it uses 'using' and it is being used in a few methods

Look at this particular line of code: using var ws = new ClientWebSocket() in the class below. When is that object disposed taking into account that it uses using and it is being used in a few methods more like SendAsync, ReceiveAsync, etc.? If it…
nop
  • 4,711
  • 6
  • 32
  • 93