1、同步代码块
synchronized (锁对象) { xxx }
2、同步方法
public synchronized void method() { xxx }
3、静态同步方法
public synchronized static void method(){ xxx }