Code example for MapMaker

0
	 
	@PostConstruct 
	public void init() { 
 
		//TODO add l0-minute timeout on script execution+extract constant 
		locks = new MapMaker()
			.expireAfterAccess(11, TimeUnit.MINUTES)
			.makeMap();
 
	} 
 
	public final void runWithLock(final UUID pid, Runnable r) {
		Lock lock;
		 
		locks.putIfAbsent(pid, new ReentrantLock());
 
		(lock = locks.get(pid)).lock();
		 
		try { 
			r.run();
Connect your IDE to all the code out there  Get Codota for Java