Re: Re: Swing Threading in SimpleORM

Franck Routier <[email protected]> Thu, 16 Jun 2011 11:30:12 +0200
Newsgroups gmane.comp.java.orm.simpleorm
Message-ID <1308216612.2376.42.camel@franck-VPCCW2S1E>
Hi,

am I wrong, or is it the same kind of problems that were once worked
around by SConnectionEJB ?

Maybe we could have a pluggable way of checking thread (or transaction
or wathever) safety ?
In fact right now, SSessionJdbc is in fact two-sided. It has a static
part (to open a session and manage thread safety) that acts as a
manager, and a non static part that is the real session.

Maybe they should be separated ?


Franck




Le lundi 13 juin 2011 à 14:20 +0200, Noel Grandin a écrit :
>   
> 
> If I created a patch to turn the only-one-thread-checking off, would
> that be acceptable?
> 
> Or maybe I could create a patch that has two checking modes
> (mode a) the normal only-one-thread checking
> (mode b) create a per-session lock and throw an exception if anyone
> tries to access an session while the lock is held.
> 
> Regards, Noel Grandin.
> 
> anthony berglas wrote: 
> > 
> >   
> > 
> > 
> > On Mon, Jun 13, 2011 at 3:45 PM, anthony berglas
> > <[email protected]> wrote:
> >         I have never liked Swing's over complex threading.
> >         
> >         
> >         Your solution sounds OK (maybe we should use protected
> >         rather than package) but I would be concerned that if you
> >         end up with more than one swing thread active at a time bad
> >         things will happen. 
> >         
> >         
> >         One option is to open and close the session on each thread.
> >          The overhead is small, and it would be cleaner.
> >         
> >         
> >         Regards,
> >         
> >         
> >         Anthony
> >         
> >         
> >         On Wed, Jun 8, 2011 at 6:05 PM, James Pickering
> >         <[email protected]> wrote:
> >                 Hi,
> >                 
> >                 I'm having some difficulty getting Swing and
> >                 SimpleORM to play nice. I've got a workaround, but
> >                 I'm sure there's a better way.
> >                 
> >                 My app uses Swing, and only ever calls SimpleORM
> >                 from the Swing Event Dispatch Thread. The difficulty
> >                 is, there's no such thing as "the" Event Dispatch
> >                 Thread; under some circumstances, Swing recycles it
> >                 and creates a new one (they're not common
> >                 circumstances, but I hit them in unit testing). This
> >                 doesn't sit well with SimpleORM's thread affinity.
> >                 
> >                 I've worked around it by creating a subclass of
> >                 SSessionJdbc, where checkThread() checks it's being
> >                 run from the EDT, rather than worrying about its
> >                 preferred thread. With checkThread() being
> >                 package-private though, it's not an ideal solution.
> >                 
> >                 Any thought?
> >                 
> >                 Thanks, James
> >         
> >         
> >         
> >         
> >         -- 
> >         
> >         
> >         Dr Anthony Berglas, [email protected]       Mobile: +61 4
> >         4838 8874
> >         Just because it is possible to push twigs along the ground
> >         with ones nose
> >         does not necessarily mean that that is the best way to
> >         collect firewood.
> >         
> >         
> > 
> > 
> > 
> > -- 
> > 
> > 
> > Dr Anthony Berglas, [email protected]       Mobile: +61 4 4838
> > 8874
> > Just because it is possible to push twigs along the ground with ones
> > nose
> > does not necessarily mean that that is the best way to collect
> > firewood.
> > 
> > 
> > 
> 
> 
> 
> 
> ______________________________________________________________________
> Disclaimer: http://www.peralex.com/disclaimer.html
> 
> 
> 
> 
> 




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/SimpleORM/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/