//建立一个非公平锁,默认是非公平锁 Lock nonFairLock= new ReentrantLock(); Lock nonFairLock= new ReentrantLock(false); //建立一个公平锁,构造传参true Lock fairLock= new ReentrantLock(true);