MATLAB: Does the Java code hang after the last statement when I try to deploy it using Parallel Computing Toolbox 4.2 (R2009b) and Builder JA 2.0.4 (R2009b)

computingdeployedhangjavaparallelParallel Computing Toolboxtoolbox

I am trying to deploy a MATLAB code that uses a jobmanager to submit a job to 2 workers. I am using MATLAB distributed Computing Server to accomplish this. When I compile this code using Builder JA and run it using my driver program, the program hangs after executing the last statement. The main function in Java code does not exit and waits indefinitely.

Best Answer

In order for deployed applications that use Parallel Computing Toolbox functions to terminate, the following function needs to be called after all the PCT functionality use is over or at the end of the MATLAB code.
pctRunDeployedCleanup
This function performs the necessary cleanup so that the client JVM can properly terminate when the deployed application exits.
For more information on this function, refer to the following link from the documentation: