Captive Imagination
July 31, 2010, 11:51:42 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Check out the teaser site for the first official game by Captive Imagination: http://www.galaxiesbeyond.com
 
   Home   Help Search Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: org.xjava.work  (Read 975 times)
0 Members and 1 Guest are viewing this topic.
Tumaini
JGN Developer
Jr. Member
*****
Offline Offline

Posts: 51


View Profile
« on: May 15, 2009, 01:53:52 PM »

I've been trying to implement the classes in org.xjava.work in commonj/jcommon and normal runnable work is fine with RunnableWorkUnit, but work that needs to return an object has proved tougher. I thought perhaps DelegateWorkUnit would do it, but I can't seem to find where to get a return value.
How would one go about this?

Thank you very much for some very useful classes!
EDIT: I'm using the xjava-src that I found somewhere on these forums.
« Last Edit: May 15, 2009, 02:00:00 PM by Tumaini » Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #1 on: May 15, 2009, 03:21:49 PM »

You can download the latest code for xjava from http://xjava.googlecode.com in the SVN repository.

Though it might be a good idea to add the functionality to have return values be used in WorkUnits, by default there is no return value expected from them. If you need something returned the unit itself should call off to set it, and if you want to wait for the work to complete or check on its status you can get the return from addWork that is a Future to let you know when it's finished.

Most of the intent behind ThreadManager is to handle asynchronous tasks that have no necessary response of their own but simply need to do something.  This is sort of like the SwingUtilities.invokeLater concept.
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #2 on: May 15, 2009, 03:24:29 PM »

Your post made me realize that there wasn't a forum for xjava, so I've added it. Smiley
Logged
Tumaini
JGN Developer
Jr. Member
*****
Offline Offline

Posts: 51


View Profile
« Reply #3 on: May 15, 2009, 03:56:55 PM »

Alright, I'll let the Runnable set a variable instead, that works well.
Thank you for the svn address!
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.166 seconds with 20 queries.