1 /**
2 * Copyright The Apache Software Foundation
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 package org.apache.hadoop.hbase;
21
22 import org.apache.hadoop.classification.InterfaceAudience;
23
24 /**
25 * An interface for a distributed reader-writer lock.
26 */
27 @InterfaceAudience.Private
28 public interface InterProcessReadWriteLock {
29
30 /**
31 * Obtain a read lock containing given metadata.
32 * @param metadata Serialized lock metadata (this may contain information
33 * such as the process owning the lock or the purpose for
34 * which the lock was acquired).
35 * @return An instantiated InterProcessLock instance
36 */
37 InterProcessLock readLock(byte[] metadata);
38
39 /**
40 * Obtain a write lock containing given metadata.
41 * @param metadata Serialized lock metadata (this may contain information
42 * such as the process owning the lock or the purpose for
43 * which the lock was acquired).
44 * @return An instantiated InterProcessLock instance
45 */
46 InterProcessLock writeLock(byte[] metadata);
47 }