Job2 Job2 Job2 Class

Definition

New base class for a job that provides extended state management functionality on the job. Since the existing Job class is an abstract class and there are existing implementations of the same, it is required to have a new class that will have the extended functionality. This is to ensure that backwards compatibility is maintained

However, this class will derive from the existing Job class. The option of deprecating the existing class was considered as well. In order to maintain backwards compatibility of PowerShell job cmdlets they will have to work with the old interface and hence deprecating the Job class did not add any benefit rather than deriving from the same

public abstract class Job2 : System.Management.Automation.Job
type Job2 = class
    inherit Job
Public MustInherit Class Job2
Inherits Job
Inheritance
Derived

Remarks

The following are some of the notes about
             why the asynchronous operations are provided this way
             in this class. There are two possible options in which
             asynchronous support can be provided:
                 1. Classical pattern (Begin and End)
                 2. Event based pattern

             Although the PowerShell API uses the classical pattern
             and we would like the Job API and PowerShell API to be
             as close as possible, the classical pattern is inherently
             complex to use.

Constructors

Job2() Job2() Job2()

Default no argument constructor

Job2(String) Job2(String) Job2(String)

Constructor which will initialize the job with the associated command string

Job2(String, String) Job2(String, String) Job2(String, String)

Creates an instance of this class

Job2(String, String, Guid) Job2(String, String, Guid) Job2(String, String, Guid)

Creates an instance of this class

Job2(String, String, IList<Job>) Job2(String, String, IList<Job>) Job2(String, String, IList<Job>)

Creates an instance of this class

Job2(String, String, JobIdentifier) Job2(String, String, JobIdentifier) Job2(String, String, JobIdentifier)

Creates an instance of this class

Properties

ChildJobs ChildJobs ChildJobs Inherited from Job
Command Command Command Inherited from Job
Debug Debug Debug Inherited from Job
Error Error Error Inherited from Job
Finished Finished Finished Inherited from Job
HasMoreData HasMoreData HasMoreData Inherited from Job
Id Id Id Inherited from Job
Information Information Information Inherited from Job
InstanceId InstanceId InstanceId Inherited from Job
JobStateInfo JobStateInfo JobStateInfo Inherited from Job
Location Location Location Inherited from Job
Name Name Name Inherited from Job
Output Output Output Inherited from Job
PSBeginTime PSBeginTime PSBeginTime Inherited from Job
PSEndTime PSEndTime PSEndTime Inherited from Job
PSJobTypeName PSJobTypeName PSJobTypeName Inherited from Job
Progress Progress Progress Inherited from Job
StartParameters StartParameters StartParameters

Parameters to be used to start a job. This is a property because CommandParameterCollection does not have a public constructor. Hence the infrastructure creates an instance and provides it for the implementations to use

StatusMessage StatusMessage StatusMessage Inherited from Job
SyncRoot SyncRoot SyncRoot
Verbose Verbose Verbose Inherited from Job
Warning Warning Warning Inherited from Job

Methods

AutoGenerateJobName() AutoGenerateJobName() AutoGenerateJobName() Inherited from Job
Dispose() Dispose() Dispose() Inherited from Job
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Inherited from Job
DoLoadJobStreams() DoLoadJobStreams() DoLoadJobStreams() Inherited from Job
DoUnloadJobStreams() DoUnloadJobStreams() DoUnloadJobStreams() Inherited from Job
LoadJobStreams() LoadJobStreams() LoadJobStreams() Inherited from Job
OnResumeJobCompleted(AsyncCompletedEventArgs) OnResumeJobCompleted(AsyncCompletedEventArgs) OnResumeJobCompleted(AsyncCompletedEventArgs)

Method which can be extended or called by derived classes to raise the event when resuming a suspended job is completed

OnStartJobCompleted(AsyncCompletedEventArgs) OnStartJobCompleted(AsyncCompletedEventArgs) OnStartJobCompleted(AsyncCompletedEventArgs)

Method which can be extended or called by derived classes to raise the event when start of the job is completed

OnStopJobCompleted(AsyncCompletedEventArgs) OnStopJobCompleted(AsyncCompletedEventArgs) OnStopJobCompleted(AsyncCompletedEventArgs)

Method which can be extended or called by derived classes to raise the event when stopping a job is completed

OnSuspendJobCompleted(AsyncCompletedEventArgs) OnSuspendJobCompleted(AsyncCompletedEventArgs) OnSuspendJobCompleted(AsyncCompletedEventArgs)

Method which can be extended or called by derived classes to raise the event when suspending a job is completed

OnUnblockJobCompleted(AsyncCompletedEventArgs) OnUnblockJobCompleted(AsyncCompletedEventArgs) OnUnblockJobCompleted(AsyncCompletedEventArgs)

Method which can be extended or called by derived classes to raise the event when unblocking a blocked job is completed

ResumeJob() ResumeJob() ResumeJob()

Resume a suspended job

ResumeJobAsync() ResumeJobAsync() ResumeJobAsync()

Resume a suspended job asynchronously.

SetJobState(JobState) SetJobState(JobState) SetJobState(JobState) Inherited from Job
SetJobState(JobState, Exception) SetJobState(JobState, Exception) SetJobState(JobState, Exception)

There is an internal method in Job which is not made public. In order to make this available to someone implementing a job it has to be added here. If the original method is made public it has changes of colliding with some implementation which may have added that method

StartJob() StartJob() StartJob()

start a job. The job will be started with the parameters specified in StartParameters

StartJobAsync() StartJobAsync() StartJobAsync()

Start a job asynchronously

StopJob() StopJob() StopJob() Inherited from Job
StopJob(Boolean, String) StopJob(Boolean, String) StopJob(Boolean, String)

StopJob

StopJobAsync() StopJobAsync() StopJobAsync()

Stop a job asynchronously

StopJobAsync(Boolean, String) StopJobAsync(Boolean, String) StopJobAsync(Boolean, String)

StopJobAsync

SuspendJob() SuspendJob() SuspendJob()

Suspend a job

SuspendJob(Boolean, String) SuspendJob(Boolean, String) SuspendJob(Boolean, String)

SuspendJob

SuspendJobAsync() SuspendJobAsync() SuspendJobAsync()

Asynchronously suspend a job

SuspendJobAsync(Boolean, String) SuspendJobAsync(Boolean, String) SuspendJobAsync(Boolean, String)

SuspendJobAsync

UnblockJob() UnblockJob() UnblockJob()

Unblock a blocked job

UnblockJobAsync() UnblockJobAsync() UnblockJobAsync()

Unblock a blocked job asynchronously

UnloadJobStreams() UnloadJobStreams() UnloadJobStreams() Inherited from Job

Events

ResumeJobCompleted ResumeJobCompleted ResumeJobCompleted

This event should be raised whenever the asynchronous resume of a suspended job is completed. This event should not be raised for synchronous operation

StartJobCompleted StartJobCompleted StartJobCompleted

Event to be raise when the start job activity is completed. This event should not be raised for synchronous operation

StateChanged StateChanged StateChanged Inherited from Job
StopJobCompleted StopJobCompleted StopJobCompleted

Event to be raised when the asynchronous stopping of a job is completed.This event should not be raised for synchronous operation

SuspendJobCompleted SuspendJobCompleted SuspendJobCompleted

This event should be raised whenever the asynchronous suspend of a job is completed. This event should not be raised for synchronous operation

UnblockJobCompleted UnblockJobCompleted UnblockJobCompleted

This event should be raised whenever the asynchronous unblock of a blocked job is completed. This event should not be raised for synchronous operation

Applies to