Services in Tapestry IoC are always proxies(*); the proxies
encapsulate thread-safe instantiation of the service, as well as the
lifecycle of the service (singleton or perthread).

Please see the documentation of the PerthreadManager service for some
additional notes.

So, yes, it is valid for a service to start a thread and for that
thread to do work with injected services even while other threads are
invoking methods on the same services. No problems at all.

(*) The exception is services with no service interface, just an
implementation class, which can't be proxied. They will, however,
still be instantiated in a thread safe manner, just a bit earlier than
necessary.

On Wed, Sep 1, 2010 at 2:12 PM, Norman Franke <nor...@myasd.com> wrote:
> Will there be some issue with the injected services? This async service when
> created will have it's injected services created in the thread of the
> current web request. When the new thread is created to process the data, the
> services will then be accessed from a different thread.
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
>
>
> On Sep 1, 2010, at 4:03 PM, Kalle Korhonen wrote:
>
>> ParallelExecutor is a "service that allows work to occur in parallel
>> using a thread pool". I doubt it's usefulness in your case. Simply
>> create a new service, spawn threads in it as needed to do work and
>> implement a few get status operations that your page(s) can call. That
>> way, keeping the page up-to-date via AJAX is a separate concern.
>>
>> Kalle
>>
>>
>> On Wed, Sep 1, 2010 at 12:06 PM, Norman Franke <nor...@myasd.com> wrote:
>>>
>>> I need a page that will start a long-running process involving heavy use
>>> of
>>> a database. I'm trying to come up with an elegant way to integrate this
>>> into
>>> my T5.1 app. I'd like to use Tapestry's IoC to inject my Hibernate DAOs.
>>> Then I'd like to write status updates to a stack and have an AJAX process
>>> poll and update the web page with what's happening.
>>>
>>> I see there is a ParallelExecutor in Tapestry, but I don't think it does
>>> injection.
>>>
>>> Any good solutions out there?
>>>
>>> Norman Franke
>>> Answering Service for Directors, Inc.
>>> www.myasd.com
>>>
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to