Top.Mail.Ru
January 30th, 2006 - Java developers — LiveJournal
? ?

Java developers

January 30th, 2006
Image

02:00 pm - Imageska_o - Atomic integer demonstration

For those who are curious...

Here is a class that compares the behavior of a unary ++ operation on a primitive integer and the corresponding method in java.util.concurrent.atomic.AtomicInteger when they are accessed by concurrent threads.

java -classpath atom.jar Atom 10 1000

This will start 10 threads, let them run for approximately 1000 milliseconds and print the shared primitive and atomic counters, the sum of individual counters for all threads, and the differences.

Requires Java 5.

On a 2GHz Windows 2000 workstation, the primitive integer is off about half of the time, and on a multiprocessor Linux server, every time I tried, even with 2 threads and 100 ms.

Read more...Collapse )
Image

02:21 pm - Imagetheycallmesir - References

What are some of your favorite Java sites? One you use either for reference, news, education, information, whatever.

I live in Java Docs my self.
Powered by LiveJournal.com
Image