Hi folks,

Please forgive a bit of a n00b question, but I'm working with the SwingWorker class and want to create a subclass of this which includes an input type, as well as the existing output and progress-message types (so basically I'd have "CTSwingWorker< I, O, M >"). Now, I'm aware that execute() gets called on a seperate thread than doInBackground(). What I want to do is provide 2 new methods to the CTSwingworker class:

public void execute( I input ) {...}
protected abstract O doInBackground( I input );

The snag is, I would need to make the input thread-safe, so my question is, how do I go about this?

Thanks, Lee.

very good choise, this one is very PowerFull methods for GUI based BackGround Tasks, I never had problems with that

SwingWorked never should be ThreadSafe(some bugs, one with Executor still in Top25 for Java <1.6.22), but you can implements/wrote bad, good or excelent workAround ...

I didn't see your code, and sure doesn't matter how is SwingWorker thread-safe or not (there are lots of non-safe Java methods too), everyting is just and only about code you can write,

the we can speak about any hepl, if not never mind google still exists

I think that never will be outDated http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.