How to parse Java source code and make sure it is thread protected

I am reading Java codes to make sure it is thread safe.

As I understand it, any local variables inside the method are thread safe, since it refers to the memory address of the stack. Any class / instance variables are not thread safe, as they relate to heap memory shared by another thread.

By rule of thumb, I can put a synchronized keyword for each method that deals with class variables.

Is there any eclipse plugin or rules that I can analyze / prevent multi-threaded problems?

+5
source share
6 answers

- . . "", .

, synchronized 5% . , , ConcurrentHashMap, = > , .

, volatile, , ; , .

( ) , ;)

. synchronized , ... , .

+5

, -, , , , findbugs, .

, , , "" .

, , , , .

Java Concurrency In Practice, " Java" .

+1

ThreadSafe (http://www.contemplateltd.com/threadsafe, ) , . . InfoQ concurrency, , Apache JMeter K9Mail. . . ThreadSafe Wikipedia entry .

( : ThreadSafe - , Contemplate, , .)

+1

, eclipse . Immutable, ThreadLocals .

0

, . . , , .

. JMX Beans , , - Java.

0

, .

, .

- , , Vector: , . , - CopyOnWriteArrayList, .

, : , synchronized . , - .

0

All Articles