Esempio n. 1
0
        public WspEventPublish(uint timeout)
        {
            if (pubMgr == null)
            {
                lock (lockObj)
                {
                    if (pubMgr == null)
                    {
                        pubMgr = new PublishManager(timeout);

                        expectedMaxLatency = (long)((pubMgr.RetryAttempts * pubMgr.Timeout) + (pubMgr.RetryAttempts * pubMgr.RetryPause)) * 10000L;
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Dispose for SubscriptionManager
        /// </summary>
        /// <param name="disposing">True if disposing.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                try
                {
                    lock (lockObject)
                    {
                        foreach (Dictionary <string, Subscription> subs in subscriptions.Values)
                        {
                            foreach (Subscription sub in subs.Values)
                            {
                                RemoveSubscription(sub.SubscriptionEventType, sub.LocalOnly, sub.MethodBody, sub.UsingLibraries, sub.ReferencedAssemblies);
                            }
                        }

                        eventQueue.Dispose();
                        eventQueue = null;

                        publishMgrRefCount--;

                        if (publishMgrRefCount == 0)
                        {
                            publishMgr.Dispose();
                            publishMgr = null;
                        }
                    }
                }
                catch
                {
                    // intentionally left empty
                }

                finally
                {
                    disposed = true;

                    if (disposing)
                    {
                        GC.SuppressFinalize(this);
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="timeout">Timeout for publishing an event</param>
        //[CLSCompliant(false)]
        internal SubscriptionManager(UInt32 timeout)
        {
            this.timeout = timeout;

            try
            {
                lock (lockObject)
                {
                    publishMgrRefCount++;

                    if (publishMgr == null)
                    {
                        publishMgr = new PublishManager(timeout);
                    }
                }

                subscriptions = new Dictionary <Guid, Dictionary <string, Subscription> >();

                eventQueue = new SharedQueue(eventQueueName, 100);

                if (eventQueue == null)
                {
                    throw new PubSubConnectionFailedException("Connection to the Event System failed");
                }
            }
            catch (SharedQueueDoesNotExistException e)
            {
                throw new PubSubQueueDoesNotExistException(e.Message, e.InnerException);
            }
            catch (SharedQueueInsufficientMemoryException e)
            {
                throw new PubSubInsufficientMemoryException(e.Message, e.InnerException);
            }
            catch (SharedQueueInitializationException e)
            {
                throw new PubSubInitializationException(e.Message, e.InnerException);
            }
        }