5/13/2011

The ImagingJobobject provides the core functionality for the device imaging process and implements the thread that manages all of the operations of the device imaging request. When the BeginDeploymentmethod is called, the device imaging deployment thread is created. The worker method of the device imaging deployment thread is called DoDeploymentWorkand it consists of several code loops. In the first loop, the deployment information for each device is passed to the device imaging solution simulator using the StartDeploymentmethod of the SimulatorClientclass. If some of the deployments fail to start, the device status is reported as Failedto the Device Imaging service.

After all the deployments start, the thread goes to the polling loop to check the progress of deployments. The polling loop queries all deployments for their status using the GetDeploymentStatusmethod of the SimulatorClientclass. If the deployment status changes, the new status is immediately reported to the Device Imaging service. The polling loop runs every two seconds until all deployments have reached one of two states ( Succeededor Failed), until the device imaging request is canceled, or until the request times out. The polling loop times out after 15 minutes.

Note:
A 15-minute time-out is for demonstration only. You should not have such a short time-out in a real device imaging scenario. The length of the time-out interval should be based on the number of device imaging deployments, number of devices, and the time that is required to image each device. When the polling loop times out, the thread sets all unfinished devices to the Failedstate and reports this status to the Device Imaging service.

In addition to the BeginDeploymentmethod, this sample uses a SuspendDeploymentand TerminateDeploymentmethods. These methods remove all unfinished deployments from the device imaging solution simulator by calling the CancelDeploymentmethod of the SimulatorClientclass.

See Also