Thread Safety Checker

H

Hoss Spence

Does anyone know if there is a Checkstyle like program that will warn
you about unsafe concurrency practices? Something that could be run in
CruiseControl for instance.

Examples would be warnings on static public collections and other
Goetz best practice violations.
 
L

Lothar Kimmeringer

Hoss said:
Does anyone know if there is a Checkstyle like program that will warn
you about unsafe concurrency practices?

FindBugs (http://findbugs.sourceforge.net/) has a complete
section called "Multithreaded correctness". The description
of these tests start at
http://findbugs.sourceforge.net/bugDescriptions.html#DC_DOUBLECHECK
Something that could be run in
CruiseControl for instance.

I don't know CruiseControl, but you can integrate FindBugs into
Ant and Maven and it's available as Eclipse-plugin, so you can
see the messages in the "problems"-view.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 
R

Robert Klemme

FindBugs (http://findbugs.sourceforge.net/) has a complete
section called "Multithreaded correctness". The description
of these tests start at
http://findbugs.sourceforge.net/bugDescriptions.html#DC_DOUBLECHECK

There is one thing I dislike about FindBugs: I haven't found an easy way
to flag a warning as invalid on a case by case basis (for example with a
comment in source code). We have something like

lock.lock();
try {
....
}
finally {
flag = false;
lock.unlock();
}

FindBugs complains that the lock is not released for all control flows
which is nonsense since the boolean assignment cannot throw.
I don't know CruiseControl, but you can integrate FindBugs into
Ant and Maven and it's available as Eclipse-plugin, so you can
see the messages in the "problems"-view.

We have FindBugs integrated with https://hudson.dev.java.net/ so if
CruiseControl fails Hudson is an alternative.

Kind regards

robert
 
C

charlesbos73

Does anyone know if there is a Checkstyle like program that will warn
you about unsafe concurrency practices? Something that could be run in
CruiseControl for instance.

Examples would be warnings on static public collections and other
Goetz best practice violations.

Altough not perfect yet, FindBugs can be used with Goetz's JCIP
annotations (e.g. @ThreadSafe and @Immutable) and it already
detects quite a few obvious errors.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top