Hi Vinh
You can try the following code that uses heavily internal unsupported API (non public):
import ch.ivyteam.ivy.deployment.restricted.configuration.JavaConfigurationSynchronizer;
import ch.ivyteam.ivy.application.ActivityOperationState;
import ch.ivyteam.ivy.java.JavaConfigurationNavigationUtil;
import ch.ivyteam.ivy.application.IProcessModelVersion;
IProcessModelVersion pmv = ivy.wf.getApplication().findProcessModelVersion("Test$1");
pmv.deactivate();
while (pmv.getActivityOperationState() != ActivityOperationState.INACTIVE)
{
Thread.sleep(200);
}
JavaConfigurationNavigationUtil.getJavaConfiguration(pmv).getClassLoaderHolder().updateRepositories();
pmv.activate();
while (pmv.getActivityOperationState() != ActivityOperationState.ACTIVE)
{
Thread.sleep(200);
}
Also you have to timeout if pmv cannot be deactivated or activated.
Regards
Reto Weiss, Axon.ivy Support