package com.tandbergtv.watchpoint.pmm.util.lock;

/**
 * Provides functionalites for locking and unlocking on a given object.
 * 
 * @author Raj Prakash
 */
public interface ILockService {
	/**
	 * Attempt to acquire lock on the given object.
	 * If lock is not obtainable, the thread will not be suspended
	 *  until lock is obtained.
	 * 
	 * @param holder	the object on which to obtain the lock on
	 * @return			true, if the lock is acquired; false, otherwise
	 */
	boolean lock(Object holder);
	
	/**
	 * Releases lock on the given object.
	 * 
	 * @param holder	the object that is locked
	 * @return			true, if the lock is released;
	 * 					false, if no lock was found to release
	 */
	boolean unlock(Object holder);
}
