Code example for ReentrantLock

0
import java.util.concurrent.locks.ReentrantLock; 
 
public class MapsforgeCacheOverlay extends ItemizedOverlay<MapsforgeCacheOverlayItem> implements ItemizedOverlayImpl { 
 
    private CachesOverlay base;
    private Lock lock = new ReentrantLock();
 
    public MapsforgeCacheOverlay(Context contextIn, Drawable markerIn) {
        super(boundCenterBottom(markerIn));
        base = new CachesOverlay(this, contextIn);
    } 
 
    @Override 
    public CachesOverlay getBase() { 
        return base;
    } 
 
    @Override 
    protected MapsforgeCacheOverlayItem createItem(int i) {
        if (base == null) {
            return null;