Description of problem: When one invokes an operation on a resource using its proxy (i.e. invoke an operation on the resource returned from the ProxyFactory.getResource()), the maximum time the method waits for the operation completion is hardcoded to 10s. This is non-optimal as there are a number of operations that take more time than that. Version-Release number of selected component (if applicable): 4.4.0-SNAPSHOT How reproducible: always Steps to Reproduce: 1. Pick a long lasting operation ("update all plugins" or RHQ agent resource, start on AS5 resource, etc). 2. in the cli: var r = ProxyFactory.getResource(<ID_OF_THE_RESOURCE>) 3.r.<OPERATION_NAME>(<REQUIRED_PARAMETERS>) Actual results: In the CLI, if the operation doesn't complete in 10s, the method just returns null. There is no indication if that is the expected outcome of the operation or any other way provided to get at the status of the operation. Expected results: There should be a way of waiting on the operation to complete when using resource proxies. The proxies are about providing convenience methods to the users but in this case I think we're hiding too much detail and don't provide the user to get at the information s/he needs. Additional info: I think these changes should do it: 1) add methods on ProxyFactory: setOperationMaxWaitTime(int) - this would set the max wait time on any subsequent resource operation invocation int getOperationMaxWaitTime() - this would return the max wait time on operation invocations so that callers can get at that information should they need it for some reason. 2) The invocation of the operation through the proxy factory would throw an exception when max wait time would be exceeded: OperationMaxWaitTimeExceededException 3) The above exception would have methods to wait for the operation to complete: OperationRequestStatus getOperationStatus() - get the status of the operation void waitForOperationToComplete(int nofSeconds) - wait at most given time for the op to complete Configuration waitUntilOperationCompletes() - wait until the op completes and return its results Configuration getOperationResult() - return the op results if it completed The following methods are provided so that the catch-site of the exception can get at the information about the operation being executed: Resource getResource() - the resource that the operation is invoked upon String getOperationName() - the name of the operation Configuration getOperationParameters() - the parameters provided to the operation With this approach we make sure that no changes are needed to the scripts that don't invoke long lasting operations but provide a way for the script writers to change their scripts to use proxy factories instead of "raw" remote API interrogation to wait for long lasting operations.
setting priority to medium per BZ triage 4/23 (crouch, santos, oleary, foley)