Forum Controls
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

NetBeans 6: Matisse Updates

NetBeans 6 delivers great updates to the Matisse GUI builder. Spend a few minutes with Roman Strobl and get an expert briefing on what's new and what has changed.

Introduction to Groovy Part 3

In this, the third and final installation of Andres' Introduction to Groovy series, you learn about how Groovy handles variable numbers of arguments, named parameters, currying, and more about Groovy operators. Including, some new operators.

Easier Custom Components with Swing Fuse

Swing Fuse (actually just Fuse), is a framework designed to make it easier to create your own custom desktop components. In this article, Daniel Spiewak shows you how to get started and provides sample source code you can download.

Benchmark Analysis: Guice vs Spring

Willam Louth shows how he uses JXInsight Probes to investigate probable performance issues with code bases that he is not familiar with. He also highlights possible pitfalls in creating a benchmark, as well as in the analysis of results.
Replies: 6 - Pages: 1  
Threads: [ Previous | Next ]
  Click to reply to this thread Reply

Threads: Reuse threads with ThreadManager

At 10:31 AM on Mar 18, 2005, Andrey Kuznetsov DeveloperZone Top 100 wrote:

There are many situations when we shold make some task in a separate thread. However creating new thread for every task can be expensive. Much better to have 1 (or more) thread(s) which runs all our tasks.

ThreadManager (part of JGui http://jgui.imagero.com) has easy solution for this problem:

first we create ThreadManager:

ThreadManager tm = new ThreadManager();

this creates ThreadManager with 1 Thread.

If we need more Threads (for example 3) we can use another constructor:

ThreadManager tm = new ThreadManager(3);

Now we can add some task:

tm.addTask(new Runnable() {
public void run() {
//do heavy job here
}
});


There are also possibility to remove all tasks from queue:
tm.clearTasks()

When job is done and queue is empty our thread(s) goes to sleep.
1 . At 11:46 AM on Mar 18, 2005, Alarmnummer DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: Threads: Reuse threads with ThreadManager

Check out the java 5.0 concurrency library from Doug Lea. (It can also be downloaded seperately for older jdk`s).
http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.html
2 . At 11:57 AM on Mar 18, 2005, Kris Schneider wrote:
  Click to reply to this thread Reply

Re: Threads: Reuse threads with ThreadManager

Fortunately, no one needs to buy a product to obtain this functionality:

http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html

http://www.mathcs.emory.edu/dcl/util/backport-util-concurrent/

http://java.sun.com/j2se/1.5.0/docs/guide/concurrency/index.html

Although it's possible that your product provides more features, or better performance, or improved scalability over the options I've listed, I'd guess those options are the better bets in terms of concurrency utilities.
3 . At 12:34 PM on Mar 18, 2005, john Lee wrote:
  Click to reply to this thread Reply

Re: Threads: Reuse threads with ThreadManager

I think if you describe and explain how you built ThreadManager,then people will be more appreciated.
I think evenwith jdk1.4, Doug Lea library provides all the functionality. It is just matter of how developer put it.
4 . At 12:40 PM on Mar 18, 2005, Andrey Kuznetsov DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: Threads: Reuse threads with ThreadManager

> Fortunately, no one needs to buy a product to obtain
> this functionality:
No need to buy - it is under GPL. Furthermore I consider now to put all classes in com.imagero.util package under BSD License.
Andrey Kuznetsov http://uio.dev.java.net Unified I/O for Java http://reader.imagero.com Java image reader http://jgui.imagero.com Java GUI components and utilities
5 . At 9:03 AM on Mar 19, 2005, Kris Schneider wrote:
  Click to reply to this thread Reply

Re: Threads: Reuse threads with ThreadManager

> No need to buy - it is under GPL. Furthermore I
> consider now to put all classes in com.imagero.util
> package under BSD License.

This page:

http://jgui.imagero.com/buy.html

certainly implies it's still for sale. Regardless, depending on the JDK version, I'd suggest developers investigate the other options I listed.
6 . At 9:26 AM on Mar 19, 2005, Andrey Kuznetsov DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: Threads: Reuse threads with ThreadManager

> > No need to buy - it is under GPL. Furthermore I
> > consider now to put all classes in
> com.imagero.util
> > package under BSD License.
>
> This page:
>
> http://jgui.imagero.com/buy.html
>
> certainly implies it's still for sale. Regardless,
> depending on the JDK version, I'd suggest developers
> investigate the other options I listed.
This is known as dual licensing. People which writing free software can use JGui for free, for commercial use you have to pay.
Andrey Kuznetsov http://uio.dev.java.net Unified I/O for Java http://reader.imagero.com Java image reader http://jgui.imagero.com Java GUI components and utilities

thread.rss_message