public Set<String> terminateTransaction(String transaction) {
        Set<String> result = new HashSet<String>();
        if (writeLog.containsKey(transaction)) {
            result.addAll(writeLog.get(transaction).keySet());
            writeLog.remove(transaction);
        }
        if (readLog.containsKey(transaction)) {
            result.addAll(readLog.get(transaction));
            readLog.remove(transaction);
        }
        return result;
    }