View Javadoc

1   /***
2    *  Copyright 2003-2010 Terracotta, Inc.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package net.sf.ehcache.constructs.nonstop.concurrency;
18  
19  /***
20   * Package protected interface to maintain explicit locking state
21   *
22   * @author Abhishek Sanoujam
23   *
24   */
25  interface ExplicitLockingContext {
26  
27      /***
28       * Returns true if the current thread has acquired any locks previously and not released yet
29       *
30       * @return true if the current thread has acquired any locks previously and not released yet
31       */
32      public boolean areAnyExplicitLocksAcquired();
33  
34      /***
35       * Mark a lock acquire
36       *
37       * @param currentNonstopThreadUniqueId
38       */
39      public void lockAcquired(long currentNonstopThreadUniqueId);
40  
41      /***
42       * Mark a lock release
43       */
44      public void lockReleased();
45  
46      /***
47       * Returns true if some other thread than the thread whose unique id is passed in the parameter has acquired any locks previously and
48       * not released yet
49       *
50       * @param currentNonstopThreadUniqueId
51       * @return true if some other thread than the thread whose unique id is passed in the parameter has acquired any locks previously and
52       *         not released yet
53       */
54      public boolean areLocksAcquiredByOtherThreads(long currentNonstopThreadUniqueId);
55  }