findbugs 下多线程提示错误

来源:互联网 发布:网络配线架价格 编辑:程序博客网 时间:2024/05/29 12:43

1.AtomicityProblem(原子性操作问题)

Finds sequences of operations (e.g., get/put) on a concurrent abstraction that will not be executed atomically.

在同时抽象操作顺序是非原子性的,主要是对资源的获取和释放。

http://en.wikipedia.org/wiki/Linearizability


2.DontIgnoreResultOfPutIfAbsent

Checks that if the result of putIfAbsent is ignored, the value passed as the second argument is not reused.

检查pufIfAbsent方法的值被忽略,第二个参数值没有被销毁。

http://www.blogjava.net/xylz/archive/2010/07/19/326527.html

http://blog.csdn.net/escaflone/article/details/10418651


3.edu.umd.cs.findbugs.detect.FindDoubleCheck

This detector looks for instances of double checked locking.

 //两次锁定资源


4.edu.umd.cs.findbugs.detect.FindEmptySynchronizedBlock

This detector looks for empty synchronized blocks.

//空的同步块


5.edu.umd.cs.findbugs.detect.FindInconsistentSync2

This detector looks for fields that are accessed in an inconsistent manner with respect to locking.  It is a slow detector.

//同步的不一致


6.edu.umd.cs.findbugs.detect.FindJSR166LockMonitorenter

This detector looks for ordinary synchronization performed on JSR166 locks.  It is a moderately fast detector.

lock锁定没有释放


7.edu.umd.cs.findbugs.detect.FindMismatchedWaitOrNotify

This detector looks for calls to wait(), notify(), or notifyAll() which do not appear to be made on an object which is currently locked. It is a moderately fast detector. This detector is disabled because it is still under development, and produces too many false positives.

发现为匹配的等待和通知

8.edu.umd.cs.findbugs.detect.FindNakedNotify

This detector looks for calls to notify() that don't seem to modify mutable object state.

调用notify(),但是并没有改变可变对象的状态

9.edu.umd.cs.findbugs.detect.FindRunInvocations

This detector looks for calls to Thread.run().  It is a fast detector.

//线程run方法被调用

实现runnable接口后,不要再调用run()方法调用


10.edu.umd.cs.findbugs.detect.FindSleepWithLockHeld

This detector looks for calls to Thread.sleep() made with a lock held.  It is a slow detector.

 synchronized (this) {

    try {

      Thread.sleep(10000);

    } catch (InterruptedException e) {

      // TODO Auto-generated catch block

      e.printStackTrace();

    }

  }

11.edu.umd.cs.findbugs.detect.FindSpinLoop

This detector looks for loops that spin reading from a field.

发现子旋锁


12.edu.umd.cs.findbugs.detect.FindTwoLockWait

This detector looks for calls to wait() with two (or more) locks held. It is a slow detector.

资源相互等待,无法释放

13,edu.umd.cs.findbugs.detect.FindUnconditionalWait

This detector looks for calls to wait() not in a conditional or loop.

再不是条件或循环中调用wait()


14,edu.umd.cs.findbugs.detect.FindUnreleasedLock

This detector looks for JSR-166 (java.util.concurrent) locks which are acquired, but not released on all paths out of the method. It is a moderately fast detector. Note that in order to use this detector, you need to have the java.util.concurrent package in the auxiliary classpath (or be analyzing the package itself).

//没有释放的锁


15,edu.umd.cs.findbugs.detect.FindUnsyncGet

This detector looks for get and set methods where the get is unsynchronized while the set is synchronized.

//非同步取资源

16,edu.umd.cs.findbugs.detect.LazyInit

This detector looks for lazy field initialization where the field is not volatile.  It is a moderately fast detector.

//懒初始化

17,edu.umd.cs.findbugs.detect.MutableLock

This detector looks for synchronization on objects read from modified fields.

//可变锁


18,edu.umd.cs.findbugs.detect.StartInConstructor

This detector looks for constructors that start threads.

//构造方法开启线程


19,edu.umd.cs.findbugs.detect.StaticCalendarDetector

This detector warns about static fields of type java.util.Calendar or java.text.DateFormat (and subclasses) because Calendars are inherently unsafe for multithreaded use.


//多线程处理日期格式






20,edu.umd.cs.findbugs.detect.SynchronizationOnSharedBuiltinConstant

This detector looks for synchronization on a shared builtin constant (such as a String).

//同步分享常量


21,edu.umd.cs.findbugs.detect.SynchronizeAndNullCheckField

This detector looks for a field that is synchronized on and then null checked.

//同步检测空字段

22,edu.umd.cs.findbugs.detect.SynchronizeOnClassLiteralNotGetClass

Looks for code that synchronizes on the results of getClass rather than on class literals.

//


23,edu.umd.cs.findbugs.detect.SynchronizingOnContentsOfFieldToProtectField

This detector looks for code that seems to be synchronizing on a field in order to guard updates of that field.



24,edu.umd.cs.findbugs.detect.VolatileUsage

Looks for bug patterns in the usage of volatile fields.

//检测使用volatile字段


25,edu.umd.cs.findbugs.detect.WaitInLoop

This detector looks for calls to wait() that are not in a loop.

循环等待









0 0
原创粉丝点击