protected override bool Initialize()
        {
            if (_theProcessor == null)
            {
                // Force a read context to be opened.  When developing the retry mechanism
                // for startup when the DB was down, there were problems when the type
                // initializer for enumerated values were failng first.  For some reason,
                // when the database went back online, they would still give exceptions.
                // changed to force the processor to open a dummy DB connect and cause an
                // exception here, instead of getting to the enumerated value initializer.
                using (IReadContext readContext = PersistentStoreRegistry.GetDefaultStore().OpenReadContext())
                {
                    readContext.Dispose();
                }

                var xp = new WorkQueueManagerExtensionPoint();
                IWorkQueueManagerExtensionPoint[] extensions = CollectionUtils.Cast <IWorkQueueManagerExtensionPoint>(xp.CreateExtensions()).ToArray();
                foreach (IWorkQueueManagerExtensionPoint extension in extensions)
                {
                    try
                    {
                        extension.OnInitializing(this);
                    }
                    catch (Exception)
                    {
                        ThreadRetryDelay = (int)_retryDelay.TotalMilliseconds;
                        return(false);
                    }
                }

                _theProcessor = new WorkQueueProcessor(_threadCount, ThreadStop, Name);
            }

            return(true);
        }
 protected override void Stop()
 {
     if (_theProcessor != null)
     {
         _theProcessor.Stop();
         _theProcessor = null;
     }
 }
Esempio n. 3
0
        protected override void Stop()
        {
            //TODO CR (Jan 2014): Move this into the base if it applies to all subclasses?
            PersistentStoreRegistry.GetDefaultStore().ShutdownRequested = true;

            if (_theProcessor != null)
            {
                _theProcessor.Stop();
                _theProcessor = null;
            }
        }
		protected override void Stop()
		{
			//TODO CR (Jan 2014): Move this into the base if it applies to all subclasses?
			PersistentStoreRegistry.GetDefaultStore().ShutdownRequested = true;

			if (_theProcessor != null)
			{
				_theProcessor.Stop();
				_theProcessor = null;
			}
		}
		protected override bool Initialize()
		{
			if (_theProcessor == null)
			{
				// Force a read context to be opened.  When developing the retry mechanism 
				// for startup when the DB was down, there were problems when the type
				// initializer for enumerated values were failng first.  For some reason,
				// when the database went back online, they would still give exceptions.
				// changed to force the processor to open a dummy DB connect and cause an 
				// exception here, instead of getting to the enumerated value initializer.
				using (IReadContext readContext = PersistentStoreRegistry.GetDefaultStore().OpenReadContext())
				{
					readContext.Dispose();
				}

                var xp = new WorkQueueManagerExtensionPoint();
                IWorkQueueManagerExtensionPoint[] extensions = CollectionUtils.Cast<IWorkQueueManagerExtensionPoint>(xp.CreateExtensions()).ToArray();
                foreach (IWorkQueueManagerExtensionPoint extension in extensions)
                {
                    try
                    {
                        extension.OnInitializing(this);
                    }
                    catch (Exception)
                    {
                        ThreadRetryDelay = (int) _retryDelay.TotalMilliseconds;
                        return false;
                    }
                }

                _theProcessor = new WorkQueueProcessor(_threadCount, ThreadStop, Name);

			}

            return true;
        }
Esempio n. 6
0
		protected override void Stop()
		{
			if (_theProcessor != null)
			{
				_theProcessor.Stop();
				_theProcessor = null;
			}
		}