Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        internal IInternalAsyncObservable <T> GetConsumerInterface()
        {
            if (consumerInterface == null)
            {
                lock (initLock)
                {
                    if (consumerInterface == null)
                    {
                        if (provider == null)
                        {
                            provider = GetStreamProvider();
                        }

                        consumerInterface = provider.GetConsumerInterface <T>(this);
                    }
                }
            }
            return(consumerInterface);
        }