Thanks (as always) Guido and Chuck, for pointing me in the right direction.
 I'd be lost (and hairy-palmed and blind) without the support of this
community! :)

Joe

CyberApps, Inc.
[email protected]

On Mon, Dec 7, 2009 at 2:07 PM, Chuck Hill <[email protected]> wrote:

>
> On Dec 7, 2009, at 2:03 PM, Guido Neitzer wrote:
>
>  On 7. Dec. 2009, at 13:39 , Joe Kramer wrote:
>>
>>  I was hoping someone could give me some pointers on how to access a
>>> session from concurrent threads.
>>>
>>
>> You don't. This is asking for trouble.
>>
>
> Specifically, you will grow hair on your palms and then go blind.  Listen
> carefully to Guido's advice.  You don't want to do what you think you want
> to do.
>
> Also see WOLongResponsePage and ERXWOLongResponsePage and  ERXLongResponse
> (the last two in Wonder).
>
> Chuck
>
>
>>  I am very new to concurrency, so please forgive me for being naive.  I
>>> have a thread that runs some shell scripts and I wanted the user to still
>>> have a responsive UI while the processing is happening in the background.
>>>  But in the processing I need access to the session object.
>>>
>>
>> Why would you need that? You can pass all information at the beginning of
>> the thread. And don't pass EOs, pass global ids. Never share EOs,
>> editingContexts, or sessions around! Never pass mutable objects without
>> copying them for thread usage. Don't use static variables in utilities. Work
>> with instances or make your code either synchronized or re-entrant.
>>
>> This is a quite painful subject and it can bite you pretty badly if you
>> get it wrong (which you most certainly will, as everybody who started out on
>> that). So keep it as simple as possible and follow the basic rules:
>>
>> - no EO crosses thread boundaries
>> - no session access outside request-response loop (meaning, from multiple
>> threads)
>> - pass in information, don't reach out for it
>> - work on copies of the data or immutable objects (remember a container
>> might be immutable but the objects inside might not be)
>>
>>  Any help on this would be greatly appreciated.
>>>
>>
>> Really, you don't want to get into that! Pass to the thread all
>> information it needs to know and use the thread hooks for state information.
>> Use concurrent request handling to keep the UI response if you want, but if
>> you're forking a thread, that isn't even absolutely necessary (though
>> recommended).
>>
>> cug
>>
>> --
>> http://www.event-s.net
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>>
>> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
>>
>> This email sent to [email protected]
>>
>
> --
> Chuck Hill             Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their overall
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
>
>
>
>
>
>
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to