The Artima Developer Community
Sponsored Link

Agile Buzz Forum
PushToTest - Free open-source software test automation solutions - Writing Threaded Applications...

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Joe Walnes

Posts: 151
Nickname: jwalnes1
Registered: Aug, 2003

Joe Walnes, "The Developers' Coach" from ThoughtWorks
PushToTest - Free open-source software test automation solutions - Writing Threaded Applications... Posted: Oct 20, 2005 12:10 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Joe Walnes.
Original Post: PushToTest - Free open-source software test automation solutions - Writing Threaded Applications...
Feed Title: Joe's New Jelly
Feed URL: http://joe.truemesh.com/blog/index.rdf
Feed Description: The musings of a ThoughtWorker obsessed with Agile, XP, maintainability, Java, .NET, Ruby and OpenSource. Mmm'kay?
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Joe Walnes
Latest Posts From Joe's New Jelly

Advertisement
Here is a quick tutorial on writing thread safe jython scripts. The author implements thread safe examples using both Python and Java methods. Here is the article's conclusion

Based on my experience writing threaded applications in Jython, using Java Threads and the Runnable interface is the best practice. The following Jython script implements the best practice for building threaded applications in Jython:

from java.lang import Thread, Runnable
import synchronize

  class myclass( Runnable ):
    def __init__( self, myparam ):
      self.storeit = myparam

    def setMyparam( self, myparam ):
      self.storeit = myparam
    setMyparam=synchronize.make_synchronized( setMyparam )

    def printMyparam( self ):
      print "myclass: myparam =",self.storeit
    printMyparam=synchronize.make_synchronized( printMyparam )

    def run( self ):
      for self.i in range(5):
        self.printMyparam()

  count = 2

  a = myclass()
  a.setMyparam( "frank" )

  t = Thread( a, "MyThread %d" % count )
  t.start()

Read: PushToTest - Free open-source software test automation solutions - Writing Threaded Applications...

Topic: PDF: ObjectiveView Agile Development Special issue Previous Topic   Next Topic Topic: What's your UI?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use