@Override
    public Set<String> checkConflict(String resource, String transaction,
            LockType requestType) {

        ResourceLock thisLock = locksOfR.get(resource);

        // There is no lock on this resource.
        if (thisLock == null || thisLock.getType() == null)
            return new HashSet<String>();

        LockType thisType = thisLock.getType();

        // This resource in under recovery
        if (thisType == LockType.RECOVERY) {
            System.err.println("error: site.ImpLockManager.chechConflict\n  ["
                    + resource + "] is under recovery");
            return null;
        }

        // If the current lock or the requesting lock contains WRITE
        if (thisType == LockType.WRITE || requestType == LockType.WRITE) {
            // If the are from the same transaction, then OK
            // else conflict.
            Set<String> temp = thisLock.getTransactions();
            if (temp.size() == 1 && temp.contains(transaction))
                return new HashSet<String>();
            else
                return thisLock.getTransactions();
        }

        if (thisType == LockType.READ && requestType == LockType.READ)
            return new HashSet<String>();

        System.err
                .println("error: site.ImpLockManager.chechConflict\n  when thislock is "
                        + thisLock
                        + "\nComing request is [Resource: "
                        + resource
                        + ", Lock Type: "
                        + requestType
                        + ", Transaction: " + transaction + "]");

        return null;
    }