It's all about the answers!

Ask a question

getting IllegalStateException on IInteropManager


Atul Kumar (1872329) | asked Jul 14 '11, 8:42 a.m.
Hi,

I'm invoking a method through IInteropManager, which checks for the presence of sync rule. I used the method findSyncRulesByExternalTypeNameAndProjectArea() on IInteropManager...I'm getting IllegalStateException on its call.

(The reason is because of a check in ThreadCheck class' checkLongOpsAllowed() method).

Although it works fine, and returns the array of sync rule handle correctly, so that I can check for the presence of sync rule, it does log the above mentioned exception on the console.

I checked with jazz.net forum (https://jazz.net/forums/viewtopic.php?t=649&sid=df6d35b5d3505e01ae822b4b62810756), applied the suggested solution of creating a separate job and calling such methods from within the scheduled job, but the problem with this approach is that the new job created is scheduled alongwith the synchronizer, thus we do not get its result while synchronizer is running.

Have gone through following jazz links:
https://jazz.net/forums/viewtopic.php?t=1339
https://jazz.net/forums/viewtopic.php?t=2297
https://jazz.net/forums/viewtopic.php?t=649

Also, tried to creating a separate thread and calling the method, it too didn't work.

Any pointers?

Accepted answer


permanent link
John Vasta (2.6k15) | answered Jul 14 '11, 2:17 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
You can just call the Job.join() method to wait for the job to finish. In other words, doing


Job job = new Job(name) {...};
job.schedule();
job.join();


will run the code in the job in a non-UI thread, but block until it completes. You can arrange for the return value of the method you want to call to be passed back as an attribute of the Job object you create.
Atul Kumar selected this answer as the correct answer

One other answer



permanent link
Atul Kumar (1872329) | answered Jul 15 '11, 2:21 a.m.
thanks a lot John, it works!

You can just call the Job.join() method to wait for the job to finish. In other words, doing


Job job = new Job(name) {...};
job.schedule();
job.join();


will run the code in the job in a non-UI thread, but block until it completes. You can arrange for the return value of the method you want to call to be passed back as an attribute of the Job object you create.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.