01: /**
02: * $RCSfile: $
03: * $Revision: $
04: * $Date: $
05: *
06: * Copyright (C) 2007 Jive Software. All rights reserved.
07: *
08: * This software is published under the terms of the GNU Public License (GPL),
09: * a copy of which is included in this distribution.
10: */package org.jivesoftware.util.lock;
11:
12: import java.util.concurrent.locks.Lock;
13:
14: /**
15: * Factory that creates new Locks for specified keys and keeps them in memory until they
16: * are no longer needed.
17: *
18: * @author Gaston Dombiak
19: */
20: public interface LockFactory {
21:
22: /**
23: * Returns an existing lock on the specified key or creates a new one if none was found. This
24: * operation should be thread safe.
25: *
26: * @param key the object that defines the visibility or scope of the lock.
27: * @return an existing lock on the specified key or creates a new one if none was found.
28: */
29: Lock getLock(Object key);
30: }
|