Eric van der Vlist wrote:

>>On the other hand, if "synchronized" is set to true, the task simply
>>doesn't run, which is not quite what I would call synchronization.
>
>
> No ;-) ...

This would probably require creating a queue, or maybe, just
leveraging the Java synchronization mechanism.

> If the task has been scheduled for repeated executions, would that
> completely stop the task or just the current execution?

Just the current execution.

> OK. So this is more "no more repetitions" than "stop the task".

Yes. BTW in Java, you actually cannot stop (kill) another thread (you
used to be able to on some OSes, but that was deprecated), so this is
difficult to do anyway. You would have to put some polling code all
over the place, try to interrupt the thread if it is waiting, and
maybe more. Kind of doable, but also not 100% reliable (the delay is
never bound).

> I have yet another question :-) ...
>
> Is there a way to automatically start a task when the server starts
> (other than sleeping for a while and sending a HTTP request through
> wget or lynx)?

Absolutely, you can put in place context listeners and configure them
in your web.xml:

<context-param>
    <param-name>oxf.context-initialized-processor.name</param-name>

<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
</context-param>
<context-param>
    <param-name>oxf.context-initialized-processor.input.config</param-name>
    <param-value>oxf:/context/context-initialized.xpl</param-value>
</context-param>
<context-param>
    <param-name>oxf.context-destroyed-processor.name</param-name>

<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
</context-param>
<context-param>
    <param-name>oxf.context-destroyed-processor.input.config</param-name>
    <param-value>oxf:/context/context-destroyed.xpl</param-value>
</context-param

<listener>

<listener-class>org.orbeon.oxf.webapp.OXFServletContextListener</listener-class>
</listener>

You can also BTW put in place session listeners.

See web.xml and the "context" directory (at the same level as the
"config" directory in the resources) for all the code, which happens
to do what you are trying to do: run a scheduler, which periodically
runs a task which in this case just logs some messages.

> Eric (wondering if he'd better use a cron and/or the scheduler to
> periodically retrieve information from external sources such as
> Wikipedia).

The OPS scheduler should allow you to do this, except the exception
handling part!

-Erik



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
orbeon-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/orbeon-user

Reply via email to