internal StreamImpl(InternalStreamId streamId, IInternalStreamProvider provider, bool isRewindable, IRuntimeClient runtimeClient) { this.streamId = streamId; this.provider = provider ?? throw new ArgumentNullException(nameof(provider)); this.runtimeClient = runtimeClient ?? throw new ArgumentNullException(nameof(runtimeClient)); producerInterface = null; consumerInterface = null; initLock = new object(); this.isRewindable = isRewindable; }
public async Task Cleanup(bool cleanupProducers, bool cleanupConsumers) { // Cleanup producers if (cleanupProducers && producerInterface != null) { await producerInterface.Cleanup(); producerInterface = null; } // Cleanup consumers if (cleanupConsumers && consumerInterface != null) { await consumerInterface.Cleanup(); consumerInterface = null; } }
internal StreamImpl(StreamId streamId, IInternalStreamProvider provider, bool isRewindable) { if (null == streamId) { throw new ArgumentNullException("streamId"); } if (null == provider) { throw new ArgumentNullException("provider"); } this.streamId = streamId; this.provider = provider; producerInterface = null; consumerInterface = null; initLock = new object(); this.isRewindable = isRewindable; }
internal IInternalAsyncObservable <T> GetConsumerInterface() { if (consumerInterface == null) { lock (initLock) { if (consumerInterface == null) { if (provider == null) { provider = GetStreamProvider(); } consumerInterface = provider.GetConsumerInterface <T>(this); } } } return(consumerInterface); }