Check in API or JCL to test if an object is currently in use

Discussion created by Michael_Coxson_5347 on Jun 8, 2016
Latest reply on Aug 15, 2018 by kreth02
I'm currently working on some Java applications to set the isActive or isBreakPoint values on given Jobs or Tasks within JobPlans (we want to restrict editing rights for various user groups but still require an ability to activate/deactivate otherwise essentially read-only objects), but I noticed a behavior where in the call to open an object failed if the object was already in use.  I've been looking through the API documentation and I haven't yet found the method call to test if an object is in use prior to attempting to open it.  I do note that there's a constructor to open an object read-only, so I figure if that option is available the fact that in-use objects cannot be accessed is known.  I'd wager it may be possible within the JCL (prior to calling my java code) in a Job but I haven't had the time to research that angle yet.

Short version: Does anyone know the proper method for testing if an object is in-use?

Edit: Additionally, is it possible to determine the user who has the object open so they can be notified?  It may be a rare instance, but there can occasionally be time-sensitive processes and it would be good to have the option.