/// <summary>
		/// This private method reset the Completion job.
		/// </summary>
		public override void Reset()
		{
			base.Reset();
			if (mJobCollection!=null)
				mJobCollection.Clear();
			mParentJob = null;
			jobRequests = 0;
		}
		/// <summary>
		/// This method identifies whether the job is contained in the queue.
		/// </summary>
		/// <param name="value">The job.</param>
		/// <returns>Returns true if the job exists in the queue.</returns>
		public bool Contains(SecurityManagerJob value)
		{
            if (value == null)
                return false;

            lock (syncObject)
			{
				return JobList.ContainsValue(value);
			}
		}
		/// <summary>
		/// This method pushes a job on to the priority queue.
		/// </summary>
		/// <param name="job">The job.</param>
		/// <param name="priority">The job priority.</param>
		/// <returns>The current position on the queue.</returns>
		public void Push(SecurityManagerJob job, JobPriority priority)
		{
            lock (syncObject)
			{
                if (job == null)
                    throw new ArgumentNullException("job", "job cannot be null.");

                if (!job.ID.HasValue)
                    throw new ArgumentNullException("job.ID", "job.ID cannot be null.");

                if (JobList.ContainsKey(job.ID.Value))
					throw new ArgumentException("The job is already queued.","job");

				//Add the job to the job pending queue. This is a seperate object
				//in order to increase the productivity of the Queue.
				JobList.Add(job.ID.Value,job);

				//Push the job to the list. We do this first in case the queue
				//is full and it throws an error.
				QueueList.Push(job.ID.Value,priority,JobTTL);
			}
		}
		/// <summary>
		/// This method pushes a job on to the priority queue with the 
		/// normal priority.
		/// </summary>
		/// <param name="job">The new job</param>
		/// <returns>The current position on the queue.</returns>
		public void Push(SecurityManagerJob job)
		{
			Push(job, JobPriority.Normal);
		}
Exemplo n.º 5
0
        /// <summary>
        /// This private method initializes the completion job.
        /// </summary>
        /// <param name="job">The parent job.</param>
        /// <param name="callback">The completion callback.</param>
        /// <param name="state">The object state.</param>
        /// <param name="AutoExecute">This method identifies whether the jobs will execute automatically and only signal after the complete method has been set.</param>
        /// <param name="throttleThreshold">The throttle threshold is the amount of queued jobs that 
        /// will trigger the throttle flag to be set.</param>
        /// <param name="trace">The trace flag determines whether the completion job should submit trace
        /// data during the job processing.</param>
        protected void Initialize(SecurityManagerJob job, CompletionJobCallBack callback, 
            object state, bool AutoExecute, int throttleThreshold, bool trace)
        {
			mParentJob = job;
			CompletionJobComplete = callback;
			mState = state;
			autoExecute=AutoExecute;
			if (autoExecute)
				mStatus = CompletionJobStatus.Submitting;

            mJobShouldTrace = trace;

            if (mDependencyList != null)
                mDependencyList.Clear();
            errorList.Clear();

            errorCount = 0;
            this.throttleThreshold = throttleThreshold;
            if (throttleThreshold > 0)
            {
                if (mThrottlingQueue == null)
                    mThrottlingQueue = new Queue<JobHolder>();
                else
                    mThrottlingQueue.Clear();
            }

            ThrottleSet();

            executingJobs = 0;
		}
Exemplo n.º 6
0
		/// <summary>
		/// This private method initializes the completion job.
		/// </summary>
		/// <param name="job">The parent job.</param>
		/// <param name="callback">The completion callback.</param>
		/// <param name="state">The object state.</param>
		/// <param name="AutoExecute">This method identifies whether the jobs will execute automatically and only signal after the complete method has been set.</param>
        /// <param name="throttleThreshold">The throttle threshold is the amount of queued jobs that 
        /// will trigger the throttle flag to be set.</param>
        protected void Initialize(SecurityManagerJob job, CompletionJobCallBack callback, 
            object state, bool AutoExecute, int throttleThreshold)
		{
            Initialize(job, callback, state, AutoExecute, throttleThreshold, false);
        }
Exemplo n.º 7
0
		/// <summary>
		/// This private method initializes the completion job.
		/// </summary>
		/// <param name="job">The parent job.</param>
		/// <param name="callback">The completion callback.</param>
		/// <param name="state">The object state.</param>
		protected void Initialize(SecurityManagerJob job, CompletionJobCallBack callback, object state)
		{
			Initialize(job, callback, state, false, 0, false);
		}
Exemplo n.º 8
0
 public void JobComplete(SecurityManagerJob job, bool signal)
 {
     dJobComplete(job, signal);
 }
Exemplo n.º 9
0
		/// <summary>
		/// This method is used to signal that a child job is complete.
		/// </summary>
		/// <param name="childJob"></param>
		internal void ChildJobComplete(SecurityManagerJob childJob)
		{
			if(!RemoveJob(childJob.ID.Value,null, new CommandRSEventArgs(childJob)))
				return;

			//SecurityManagerJob.SecurityManagerJobReturn(childJob);
		}
Exemplo n.º 10
0
		/// <summary>
		/// This method initializes the session.
		/// </summary>
		/// <param name="secMan">The security manager.</param>
		/// <param name="jobRQ">The job request.</param>
		/// <param name="token">The session token.</param>
		/// <param name="parentJob">The parent job. This should be left null if this is not a child job.</param>
		internal void Initialize(JobBase jobRQ, 
            SessionToken token, SecurityManagerJob parentJob, 
			CommandRSCallback RSCallback, CommandProgressCallback ProgressCallback)
		{
			try
			{
                //mSecMan = secMan;
				mParentJob=parentJob;
				if (parentJob!=null)
					mChildJobDepth = parentJob.ChildJobDepth+1;
				mRSCallback=RSCallback;
				mProgressCallback=ProgressCallback;
				mBaseJob = jobRQ;
				this.token=token;
			}
			catch(Exception ex)
			{
				Reset();
				throw ex;
			}
		}