Here you can find the source of getLock()
public static Object getLock()
//package com.java2s; //License from project: Apache License import java.util.concurrent.atomic.AtomicInteger; public class Main { private static Object[] LOCK = { new Object(), new Object() }; private static AtomicInteger lockIndex = new AtomicInteger(0); public static Object getLock() { int index = lockIndex.incrementAndGet(); if (index >= LOCK.length) { index = 0;/* www.ja va 2 s . c om*/ lockIndex.set(index); } return LOCK[index]; } }