Thank you for helping out.
I'll go the way Jay recommends. I cannot use
ComponentInvocationContext#isInterrupted because without setting
ProcessExecution#setWaitForCompletion to positive number, I don't get
process exit code, so I woulnd't have nothing to wait for. And If I set
ProcessExecution#setWaitForCompletion to positive number, it blocks. Also
OperationManager#getOperationTimeout logic is not usable in operation
handling code, because getOperationTimeout intentionally removes
"rhq.timeout" from operation parameters, so I wouln't find it when
operation code runs.
so I added waitTime (default=1h) and killOnTimeout (defalut=false).
Libor
use OperationManager#getOperationTimeout
Dne Fri, 21 Feb 2014 15:38:05 +0100 Jay Shaughnessy <jshaughn(a)redhat.com>
napsal(a):
Thomas, thanks for that note, I hadn't noticed
ComponentInvocationContext#isInterrupted. Still, I think the best
solution now is probably to emulate the script plugin's "execute"
operation, so that we have some consistency. Instead of worrying about
the interaction between operationTimeout and
ProcessExecution#setWaitForCompletion, just ignore the former and defer
to the latter.
On 2/21/2014 5:14 AM, Thomas Segismont wrote:
> Hi Libor,
>
> The thread became quite long so forgive me I'll sum up instead of
> replying to each point:
>
> * don't try to stop the script execution after timeout (in the thread
> Larry gave the reasons not to do this)
> * read OperationFacet Javadoc: since RHQ 4.9, you can rely on
> ComponentInvocationContext#isInterrupted [1] to detect timeout and
> cancellation
>
> If you're curious, OperationManager#getOperationTimeout has the logic
> to determine the operation timeout (taking into account default or
> overridden value). But again, in your case, you don't need to know what
> the value is, you need to know *when* the invocation is interrupted
> (ComponentInvocationContext#isInterrupted)
>
> Regards,
> Thomas
>
> [1] more on this in this thread
>
https://lists.fedorahosted.org/pipermail/rhq-devel/2013-July/thread.html#...
>
Libor Zoubek