You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2017/01/20 00:51:54 UTC
[1/3] hbase git commit: HBASE-16831 Procedure V2 - Remove
org.apache.hadoop.hbase.zookeeper.lock (Appy)
Repository: hbase
Updated Branches:
refs/heads/master 558a6bb9d -> 4fdd6ff9a
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/lock/TestZKInterProcessReadWriteLock.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/lock/TestZKInterProcessReadWriteLock.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/lock/TestZKInterProcessReadWriteLock.java
deleted file mode 100644
index 675afc0..0000000
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/lock/TestZKInterProcessReadWriteLock.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/**
- * Copyright The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.zookeeper.lock;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.DaemonThreadFactory;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.InterProcessLock;
-import org.apache.hadoop.hbase.InterProcessLock.MetadataHandler;
-import org.apache.hadoop.hbase.MultithreadedTestUtil;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.apache.hadoop.hbase.testclassification.MiscTests;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.zookeeper.ZKUtil;
-import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.google.common.collect.Lists;
-
-@Category({MiscTests.class, MediumTests.class})
-public class TestZKInterProcessReadWriteLock {
-
- private static final Log LOG =
- LogFactory.getLog(TestZKInterProcessReadWriteLock.class);
-
- private static final HBaseTestingUtility TEST_UTIL =
- new HBaseTestingUtility();
-
- private static final int NUM_THREADS = 10;
-
- private static Configuration conf;
-
- private final AtomicBoolean isLockHeld = new AtomicBoolean(false);
- private final ExecutorService executor =
- Executors.newFixedThreadPool(NUM_THREADS,
- new DaemonThreadFactory("TestZKInterProcessReadWriteLock-"));
-
- @BeforeClass
- public static void beforeAllTests() throws Exception {
- conf = TEST_UTIL.getConfiguration();
- TEST_UTIL.startMiniZKCluster();
- conf.setInt(HConstants.ZK_SESSION_TIMEOUT, 1000);
- ZooKeeperWatcher zkw = getZooKeeperWatcher("setup");
- ZKUtil.createWithParents(zkw, zkw.znodePaths.tableLockZNode);
- }
-
- @AfterClass
- public static void afterAllTests() throws Exception {
- TEST_UTIL.shutdownMiniZKCluster();
- }
-
- @After
- public void tearDown() {
- executor.shutdown();
- }
-
- private static ZooKeeperWatcher getZooKeeperWatcher(String desc)
- throws IOException {
- return TEST_UTIL.getZooKeeperWatcher();
- }
-
-
- @Test(timeout = 30000)
- public void testWriteLockExcludesWriters() throws Exception {
- final String testName = "testWriteLockExcludesWriters";
- final ZKInterProcessReadWriteLock readWriteLock =
- getReadWriteLock(testName);
- List<Future<Void>> results = Lists.newArrayList();
- for (int i = 0; i < NUM_THREADS; ++i) {
- final String threadDesc = testName + i;
- results.add(executor.submit(new Callable<Void>() {
- @Override
- public Void call() throws IOException {
- ZKInterProcessWriteLock writeLock =
- readWriteLock.writeLock(Bytes.toBytes(threadDesc));
- try {
- writeLock.acquire();
- try {
- // No one else should hold the lock
- assertTrue(isLockHeld.compareAndSet(false, true));
- Thread.sleep(1000);
- // No one else should have released the lock
- assertTrue(isLockHeld.compareAndSet(true, false));
- } finally {
- isLockHeld.set(false);
- writeLock.release();
- }
- } catch (InterruptedException e) {
- LOG.warn(threadDesc + " interrupted", e);
- Thread.currentThread().interrupt();
- throw new InterruptedIOException();
- }
- return null;
- }
- }));
-
- }
- MultithreadedTestUtil.assertOnFutures(results);
- }
-
- @Test(timeout = 30000)
- public void testReadLockDoesNotExcludeReaders() throws Exception {
- final String testName = "testReadLockDoesNotExcludeReaders";
- final ZKInterProcessReadWriteLock readWriteLock =
- getReadWriteLock(testName);
- final CountDownLatch locksAcquiredLatch = new CountDownLatch(NUM_THREADS);
- final AtomicInteger locksHeld = new AtomicInteger(0);
- List<Future<Void>> results = Lists.newArrayList();
- for (int i = 0; i < NUM_THREADS; ++i) {
- final String threadDesc = testName + i;
- results.add(executor.submit(new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- ZKInterProcessReadLock readLock =
- readWriteLock.readLock(Bytes.toBytes(threadDesc));
- readLock.acquire();
- try {
- locksHeld.incrementAndGet();
- locksAcquiredLatch.countDown();
- Thread.sleep(1000);
- } finally {
- readLock.release();
- locksHeld.decrementAndGet();
- }
- return null;
- }
- }));
- }
- locksAcquiredLatch.await();
- assertEquals(locksHeld.get(), NUM_THREADS);
- MultithreadedTestUtil.assertOnFutures(results);
- }
-
- @Test(timeout = 30000)
- public void testReadLockExcludesWriters() throws Exception {
- // Submit a read lock request first
- // Submit a write lock request second
- final String testName = "testReadLockExcludesWriters";
- List<Future<Void>> results = Lists.newArrayList();
- final CountDownLatch readLockAcquiredLatch = new CountDownLatch(1);
- Callable<Void> acquireReadLock = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- final String threadDesc = testName + "-acquireReadLock";
- ZKInterProcessReadLock readLock =
- getReadWriteLock(testName).readLock(Bytes.toBytes(threadDesc));
- readLock.acquire();
- try {
- assertTrue(isLockHeld.compareAndSet(false, true));
- readLockAcquiredLatch.countDown();
- Thread.sleep(1000);
- } finally {
- isLockHeld.set(false);
- readLock.release();
- }
- return null;
- }
- };
- Callable<Void> acquireWriteLock = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- final String threadDesc = testName + "-acquireWriteLock";
- ZKInterProcessWriteLock writeLock =
- getReadWriteLock(testName).writeLock(Bytes.toBytes(threadDesc));
- readLockAcquiredLatch.await();
- assertTrue(isLockHeld.get());
- writeLock.acquire();
- try {
- assertFalse(isLockHeld.get());
- } finally {
- writeLock.release();
- }
- return null;
- }
- };
- results.add(executor.submit(acquireReadLock));
- results.add(executor.submit(acquireWriteLock));
- MultithreadedTestUtil.assertOnFutures(results);
- }
-
- private static ZKInterProcessReadWriteLock getReadWriteLock(String testName)
- throws IOException {
- MetadataHandler handler = new MetadataHandler() {
- @Override
- public void handleMetadata(byte[] ownerMetadata) {
- LOG.info("Lock info: " + Bytes.toString(ownerMetadata));
- }
- };
- ZooKeeperWatcher zkWatcher = getZooKeeperWatcher(testName);
- String znode = ZKUtil.joinZNode(zkWatcher.znodePaths.tableLockZNode, testName);
-
- return new ZKInterProcessReadWriteLock(zkWatcher, znode, handler);
- }
-
- @Test(timeout = 30000)
- public void testWriteLockExcludesReaders() throws Exception {
- // Submit a read lock request first
- // Submit a write lock request second
- final String testName = "testReadLockExcludesWriters";
- List<Future<Void>> results = Lists.newArrayList();
- final CountDownLatch writeLockAcquiredLatch = new CountDownLatch(1);
- Callable<Void> acquireWriteLock = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- final String threadDesc = testName + "-acquireWriteLock";
- ZKInterProcessWriteLock writeLock =
- getReadWriteLock(testName).writeLock(Bytes.toBytes(threadDesc));
- writeLock.acquire();
- try {
- writeLockAcquiredLatch.countDown();
- assertTrue(isLockHeld.compareAndSet(false, true));
- Thread.sleep(1000);
- } finally {
- isLockHeld.set(false);
- writeLock.release();
- }
- return null;
- }
- };
- Callable<Void> acquireReadLock = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- final String threadDesc = testName + "-acquireReadLock";
- ZKInterProcessReadLock readLock =
- getReadWriteLock(testName).readLock(Bytes.toBytes(threadDesc));
- writeLockAcquiredLatch.await();
- readLock.acquire();
- try {
- assertFalse(isLockHeld.get());
- } finally {
- readLock.release();
- }
- return null;
- }
- };
- results.add(executor.submit(acquireWriteLock));
- results.add(executor.submit(acquireReadLock));
- MultithreadedTestUtil.assertOnFutures(results);
- }
-
- @Test(timeout = 60000)
- public void testTimeout() throws Exception {
- final String testName = "testTimeout";
- final CountDownLatch lockAcquiredLatch = new CountDownLatch(1);
- Callable<Void> shouldHog = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- final String threadDesc = testName + "-shouldHog";
- ZKInterProcessWriteLock lock =
- getReadWriteLock(testName).writeLock(Bytes.toBytes(threadDesc));
- lock.acquire();
- lockAcquiredLatch.countDown();
- Thread.sleep(10000);
- lock.release();
- return null;
- }
- };
- Callable<Void> shouldTimeout = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- final String threadDesc = testName + "-shouldTimeout";
- ZKInterProcessWriteLock lock =
- getReadWriteLock(testName).writeLock(Bytes.toBytes(threadDesc));
- lockAcquiredLatch.await();
- assertFalse(lock.tryAcquire(5000));
- return null;
- }
- };
- Callable<Void> shouldAcquireLock = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- final String threadDesc = testName + "-shouldAcquireLock";
- ZKInterProcessWriteLock lock =
- getReadWriteLock(testName).writeLock(Bytes.toBytes(threadDesc));
- lockAcquiredLatch.await();
- assertTrue(lock.tryAcquire(30000));
- lock.release();
- return null;
- }
- };
- List<Future<Void>> results = Lists.newArrayList();
- results.add(executor.submit(shouldHog));
- results.add(executor.submit(shouldTimeout));
- results.add(executor.submit(shouldAcquireLock));
- MultithreadedTestUtil.assertOnFutures(results);
- }
-
- @Test(timeout = 60000)
- public void testMultipleClients() throws Exception {
- //tests lock usage from multiple zookeeper clients with different sessions.
- //acquire one read lock, then one write lock
- final String testName = "testMultipleClients";
-
- //different zookeeper sessions with separate identifiers
- ZooKeeperWatcher zkWatcher1 = new ZooKeeperWatcher(conf, "testMultipleClients-1", null);
- ZooKeeperWatcher zkWatcher2 = new ZooKeeperWatcher(conf, "testMultipleClients-2", null);
-
- String znode = ZKUtil.joinZNode(zkWatcher1.znodePaths.tableLockZNode, testName);
-
- ZKInterProcessReadWriteLock clientLock1
- = new ZKInterProcessReadWriteLock(zkWatcher1, znode, null);
- ZKInterProcessReadWriteLock clientLock2
- = new ZKInterProcessReadWriteLock(zkWatcher2, znode, null);
-
- InterProcessLock lock1 = clientLock1.readLock(Bytes.toBytes("client1"));
- lock1.acquire();
-
- //try to acquire, but it will timeout. We are testing whether this will cause any problems
- //due to the read lock being from another client
- InterProcessLock lock2 = clientLock2.writeLock(Bytes.toBytes("client2"));
- assertFalse(lock2.tryAcquire(1000));
-
- lock1.release();
-
- //this time it will acquire
- assertTrue(lock2.tryAcquire(5000));
- lock2.release();
- zkWatcher1.close();
- zkWatcher2.close();
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 285e358..084629e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3076,7 +3076,7 @@
<name>User API</name>
<description>The HBase Application Programmer's API</description>
<excludePackageNames>
- org.apache.hadoop.hbase.backup*:org.apache.hadoop.hbase.catalog:org.apache.hadoop.hbase.client.coprocessor:org.apache.hadoop.hbase.client.metrics:org.apache.hadoop.hbase.codec*:org.apache.hadoop.hbase.constraint:org.apache.hadoop.hbase.coprocessor.*:org.apache.hadoop.hbase.executor:org.apache.hadoop.hbase.fs:*.generated.*:org.apache.hadoop.hbase.io.hfile.*:org.apache.hadoop.hbase.mapreduce.hadoopbackport:org.apache.hadoop.hbase.mapreduce.replication:org.apache.hadoop.hbase.master.*:org.apache.hadoop.hbase.metrics*:org.apache.hadoop.hbase.migration:org.apache.hadoop.hbase.monitoring:org.apache.hadoop.hbase.p*:org.apache.hadoop.hbase.regionserver.compactions:org.apache.hadoop.hbase.regionserver.handler:org.apache.hadoop.hbase.regionserver.snapshot:org.apache.hadoop.hbase.replication.*:org.apache.hadoop.hbase.rest.filter:org.apache.hadoop.hbase.rest.model:org.apache.hadoop.hbase.rest.p*:org.apache.hadoop.hbase.security.*:org.apache.hadoop.hbase.thrift*:org.apache.hadoop
.hbase.tmpl.*:org.apache.hadoop.hbase.tool:org.apache.hadoop.hbase.trace:org.apache.hadoop.hbase.util.byterange*:org.apache.hadoop.hbase.util.test:org.apache.hadoop.hbase.util.vint:org.apache.hadoop.hbase.zookeeper.lock:org.apache.hadoop.metrics2*:org.apache.hadoop.hbase.io.compress*
+ org.apache.hadoop.hbase.backup*:org.apache.hadoop.hbase.catalog:org.apache.hadoop.hbase.client.coprocessor:org.apache.hadoop.hbase.client.metrics:org.apache.hadoop.hbase.codec*:org.apache.hadoop.hbase.constraint:org.apache.hadoop.hbase.coprocessor.*:org.apache.hadoop.hbase.executor:org.apache.hadoop.hbase.fs:*.generated.*:org.apache.hadoop.hbase.io.hfile.*:org.apache.hadoop.hbase.mapreduce.hadoopbackport:org.apache.hadoop.hbase.mapreduce.replication:org.apache.hadoop.hbase.master.*:org.apache.hadoop.hbase.metrics*:org.apache.hadoop.hbase.migration:org.apache.hadoop.hbase.monitoring:org.apache.hadoop.hbase.p*:org.apache.hadoop.hbase.regionserver.compactions:org.apache.hadoop.hbase.regionserver.handler:org.apache.hadoop.hbase.regionserver.snapshot:org.apache.hadoop.hbase.replication.*:org.apache.hadoop.hbase.rest.filter:org.apache.hadoop.hbase.rest.model:org.apache.hadoop.hbase.rest.p*:org.apache.hadoop.hbase.security.*:org.apache.hadoop.hbase.thrift*:org.apache.hadoop
.hbase.tmpl.*:org.apache.hadoop.hbase.tool:org.apache.hadoop.hbase.trace:org.apache.hadoop.hbase.util.byterange*:org.apache.hadoop.hbase.util.test:org.apache.hadoop.hbase.util.vint:org.apache.hadoop.metrics2*:org.apache.hadoop.hbase.io.compress*
</excludePackageNames>
<!-- switch on dependency-driven aggregation -->
<includeDependencySources>false</includeDependencySources>
@@ -3133,7 +3133,7 @@
<name>User API</name>
<description>The HBase Application Programmer's API</description>
<excludePackageNames>
- org.apache.hadoop.hbase.backup*:org.apache.hadoop.hbase.catalog:org.apache.hadoop.hbase.client.coprocessor:org.apache.hadoop.hbase.client.metrics:org.apache.hadoop.hbase.codec*:org.apache.hadoop.hbase.constraint:org.apache.hadoop.hbase.coprocessor.*:org.apache.hadoop.hbase.executor:org.apache.hadoop.hbase.fs:*.generated.*:org.apache.hadoop.hbase.io.hfile.*:org.apache.hadoop.hbase.mapreduce.hadoopbackport:org.apache.hadoop.hbase.mapreduce.replication:org.apache.hadoop.hbase.master.*:org.apache.hadoop.hbase.metrics*:org.apache.hadoop.hbase.migration:org.apache.hadoop.hbase.monitoring:org.apache.hadoop.hbase.p*:org.apache.hadoop.hbase.regionserver.compactions:org.apache.hadoop.hbase.regionserver.handler:org.apache.hadoop.hbase.regionserver.snapshot:org.apache.hadoop.hbase.replication.*:org.apache.hadoop.hbase.rest.filter:org.apache.hadoop.hbase.rest.model:org.apache.hadoop.hbase.rest.p*:org.apache.hadoop.hbase.security.*:org.apache.hadoop.hbase.thrift*:org.apache.hadoop
.hbase.tmpl.*:org.apache.hadoop.hbase.tool:org.apache.hadoop.hbase.trace:org.apache.hadoop.hbase.util.byterange*:org.apache.hadoop.hbase.util.test:org.apache.hadoop.hbase.util.vint:org.apache.hadoop.hbase.zookeeper.lock:org.apache.hadoop.metrics2*:org.apache.hadoop.hbase.io.compress*
+ org.apache.hadoop.hbase.backup*:org.apache.hadoop.hbase.catalog:org.apache.hadoop.hbase.client.coprocessor:org.apache.hadoop.hbase.client.metrics:org.apache.hadoop.hbase.codec*:org.apache.hadoop.hbase.constraint:org.apache.hadoop.hbase.coprocessor.*:org.apache.hadoop.hbase.executor:org.apache.hadoop.hbase.fs:*.generated.*:org.apache.hadoop.hbase.io.hfile.*:org.apache.hadoop.hbase.mapreduce.hadoopbackport:org.apache.hadoop.hbase.mapreduce.replication:org.apache.hadoop.hbase.master.*:org.apache.hadoop.hbase.metrics*:org.apache.hadoop.hbase.migration:org.apache.hadoop.hbase.monitoring:org.apache.hadoop.hbase.p*:org.apache.hadoop.hbase.regionserver.compactions:org.apache.hadoop.hbase.regionserver.handler:org.apache.hadoop.hbase.regionserver.snapshot:org.apache.hadoop.hbase.replication.*:org.apache.hadoop.hbase.rest.filter:org.apache.hadoop.hbase.rest.model:org.apache.hadoop.hbase.rest.p*:org.apache.hadoop.hbase.security.*:org.apache.hadoop.hbase.thrift*:org.apache.hadoop
.hbase.tmpl.*:org.apache.hadoop.hbase.tool:org.apache.hadoop.hbase.trace:org.apache.hadoop.hbase.util.byterange*:org.apache.hadoop.hbase.util.test:org.apache.hadoop.hbase.util.vint:org.apache.hadoop.metrics2*:org.apache.hadoop.hbase.io.compress*
</excludePackageNames>
<!-- switch on dependency-driven aggregation -->
<includeDependencySources>false</includeDependencySources>
[2/3] hbase git commit: HBASE-16831 Procedure V2 - Remove
org.apache.hadoop.hbase.zookeeper.lock (Appy)
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ZooKeeperProtos.java
----------------------------------------------------------------------
diff --git a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ZooKeeperProtos.java b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ZooKeeperProtos.java
index 0095043..81cc69b 100644
--- a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ZooKeeperProtos.java
+++ b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ZooKeeperProtos.java
@@ -7793,1221 +7793,6 @@ public final class ZooKeeperProtos {
// @@protoc_insertion_point(class_scope:hbase.pb.ReplicationHLogPosition)
}
- public interface TableLockOrBuilder
- extends com.google.protobuf.MessageOrBuilder {
-
- // optional .hbase.pb.TableName table_name = 1;
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- boolean hasTableName();
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName getTableName();
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableNameOrBuilder getTableNameOrBuilder();
-
- // optional .hbase.pb.ServerName lock_owner = 2;
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- boolean hasLockOwner();
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName getLockOwner();
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerNameOrBuilder getLockOwnerOrBuilder();
-
- // optional int64 thread_id = 3;
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- boolean hasThreadId();
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- long getThreadId();
-
- // optional bool is_shared = 4;
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- boolean hasIsShared();
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- boolean getIsShared();
-
- // optional string purpose = 5;
- /**
- * <code>optional string purpose = 5;</code>
- */
- boolean hasPurpose();
- /**
- * <code>optional string purpose = 5;</code>
- */
- java.lang.String getPurpose();
- /**
- * <code>optional string purpose = 5;</code>
- */
- com.google.protobuf.ByteString
- getPurposeBytes();
-
- // optional int64 create_time = 6;
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- boolean hasCreateTime();
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- long getCreateTime();
- }
- /**
- * Protobuf type {@code hbase.pb.TableLock}
- *
- * <pre>
- **
- * Metadata associated with a table lock in zookeeper
- * </pre>
- */
- public static final class TableLock extends
- com.google.protobuf.GeneratedMessage
- implements TableLockOrBuilder {
- // Use TableLock.newBuilder() to construct.
- private TableLock(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
- super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private TableLock(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final TableLock defaultInstance;
- public static TableLock getDefaultInstance() {
- return defaultInstance;
- }
-
- public TableLock getDefaultInstanceForType() {
- return defaultInstance;
- }
-
- private final com.google.protobuf.UnknownFieldSet unknownFields;
- @java.lang.Override
- public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
- return this.unknownFields;
- }
- private TableLock(
- com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- initFields();
- int mutable_bitField0_ = 0;
- com.google.protobuf.UnknownFieldSet.Builder unknownFields =
- com.google.protobuf.UnknownFieldSet.newBuilder();
- try {
- boolean done = false;
- while (!done) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- done = true;
- break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
- case 10: {
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.Builder subBuilder = null;
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- subBuilder = tableName_.toBuilder();
- }
- tableName_ = input.readMessage(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.PARSER, extensionRegistry);
- if (subBuilder != null) {
- subBuilder.mergeFrom(tableName_);
- tableName_ = subBuilder.buildPartial();
- }
- bitField0_ |= 0x00000001;
- break;
- }
- case 18: {
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.Builder subBuilder = null;
- if (((bitField0_ & 0x00000002) == 0x00000002)) {
- subBuilder = lockOwner_.toBuilder();
- }
- lockOwner_ = input.readMessage(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.PARSER, extensionRegistry);
- if (subBuilder != null) {
- subBuilder.mergeFrom(lockOwner_);
- lockOwner_ = subBuilder.buildPartial();
- }
- bitField0_ |= 0x00000002;
- break;
- }
- case 24: {
- bitField0_ |= 0x00000004;
- threadId_ = input.readInt64();
- break;
- }
- case 32: {
- bitField0_ |= 0x00000008;
- isShared_ = input.readBool();
- break;
- }
- case 42: {
- bitField0_ |= 0x00000010;
- purpose_ = input.readBytes();
- break;
- }
- case 48: {
- bitField0_ |= 0x00000020;
- createTime_ = input.readInt64();
- break;
- }
- }
- }
- } catch (com.google.protobuf.InvalidProtocolBufferException e) {
- throw e.setUnfinishedMessage(this);
- } catch (java.io.IOException e) {
- throw new com.google.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
- } finally {
- this.unknownFields = unknownFields.build();
- makeExtensionsImmutable();
- }
- }
- public static final com.google.protobuf.Descriptors.Descriptor
- getDescriptor() {
- return org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.internal_static_hbase_pb_TableLock_descriptor;
- }
-
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
- internalGetFieldAccessorTable() {
- return org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.internal_static_hbase_pb_TableLock_fieldAccessorTable
- .ensureFieldAccessorsInitialized(
- org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock.class, org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock.Builder.class);
- }
-
- public static com.google.protobuf.Parser<TableLock> PARSER =
- new com.google.protobuf.AbstractParser<TableLock>() {
- public TableLock parsePartialFrom(
- com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return new TableLock(input, extensionRegistry);
- }
- };
-
- @java.lang.Override
- public com.google.protobuf.Parser<TableLock> getParserForType() {
- return PARSER;
- }
-
- private int bitField0_;
- // optional .hbase.pb.TableName table_name = 1;
- public static final int TABLE_NAME_FIELD_NUMBER = 1;
- private org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName tableName_;
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public boolean hasTableName() {
- return ((bitField0_ & 0x00000001) == 0x00000001);
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName getTableName() {
- return tableName_;
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableNameOrBuilder getTableNameOrBuilder() {
- return tableName_;
- }
-
- // optional .hbase.pb.ServerName lock_owner = 2;
- public static final int LOCK_OWNER_FIELD_NUMBER = 2;
- private org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName lockOwner_;
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public boolean hasLockOwner() {
- return ((bitField0_ & 0x00000002) == 0x00000002);
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName getLockOwner() {
- return lockOwner_;
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerNameOrBuilder getLockOwnerOrBuilder() {
- return lockOwner_;
- }
-
- // optional int64 thread_id = 3;
- public static final int THREAD_ID_FIELD_NUMBER = 3;
- private long threadId_;
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public boolean hasThreadId() {
- return ((bitField0_ & 0x00000004) == 0x00000004);
- }
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public long getThreadId() {
- return threadId_;
- }
-
- // optional bool is_shared = 4;
- public static final int IS_SHARED_FIELD_NUMBER = 4;
- private boolean isShared_;
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public boolean hasIsShared() {
- return ((bitField0_ & 0x00000008) == 0x00000008);
- }
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public boolean getIsShared() {
- return isShared_;
- }
-
- // optional string purpose = 5;
- public static final int PURPOSE_FIELD_NUMBER = 5;
- private java.lang.Object purpose_;
- /**
- * <code>optional string purpose = 5;</code>
- */
- public boolean hasPurpose() {
- return ((bitField0_ & 0x00000010) == 0x00000010);
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public java.lang.String getPurpose() {
- java.lang.Object ref = purpose_;
- if (ref instanceof java.lang.String) {
- return (java.lang.String) ref;
- } else {
- com.google.protobuf.ByteString bs =
- (com.google.protobuf.ByteString) ref;
- java.lang.String s = bs.toStringUtf8();
- if (bs.isValidUtf8()) {
- purpose_ = s;
- }
- return s;
- }
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public com.google.protobuf.ByteString
- getPurposeBytes() {
- java.lang.Object ref = purpose_;
- if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
- com.google.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- purpose_ = b;
- return b;
- } else {
- return (com.google.protobuf.ByteString) ref;
- }
- }
-
- // optional int64 create_time = 6;
- public static final int CREATE_TIME_FIELD_NUMBER = 6;
- private long createTime_;
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public boolean hasCreateTime() {
- return ((bitField0_ & 0x00000020) == 0x00000020);
- }
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public long getCreateTime() {
- return createTime_;
- }
-
- private void initFields() {
- tableName_ = org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.getDefaultInstance();
- lockOwner_ = org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.getDefaultInstance();
- threadId_ = 0L;
- isShared_ = false;
- purpose_ = "";
- createTime_ = 0L;
- }
- private byte memoizedIsInitialized = -1;
- public final boolean isInitialized() {
- byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
-
- if (hasTableName()) {
- if (!getTableName().isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
- }
- }
- if (hasLockOwner()) {
- if (!getLockOwner().isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
- }
- }
- memoizedIsInitialized = 1;
- return true;
- }
-
- public void writeTo(com.google.protobuf.CodedOutputStream output)
- throws java.io.IOException {
- getSerializedSize();
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- output.writeMessage(1, tableName_);
- }
- if (((bitField0_ & 0x00000002) == 0x00000002)) {
- output.writeMessage(2, lockOwner_);
- }
- if (((bitField0_ & 0x00000004) == 0x00000004)) {
- output.writeInt64(3, threadId_);
- }
- if (((bitField0_ & 0x00000008) == 0x00000008)) {
- output.writeBool(4, isShared_);
- }
- if (((bitField0_ & 0x00000010) == 0x00000010)) {
- output.writeBytes(5, getPurposeBytes());
- }
- if (((bitField0_ & 0x00000020) == 0x00000020)) {
- output.writeInt64(6, createTime_);
- }
- getUnknownFields().writeTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public int getSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(1, tableName_);
- }
- if (((bitField0_ & 0x00000002) == 0x00000002)) {
- size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(2, lockOwner_);
- }
- if (((bitField0_ & 0x00000004) == 0x00000004)) {
- size += com.google.protobuf.CodedOutputStream
- .computeInt64Size(3, threadId_);
- }
- if (((bitField0_ & 0x00000008) == 0x00000008)) {
- size += com.google.protobuf.CodedOutputStream
- .computeBoolSize(4, isShared_);
- }
- if (((bitField0_ & 0x00000010) == 0x00000010)) {
- size += com.google.protobuf.CodedOutputStream
- .computeBytesSize(5, getPurposeBytes());
- }
- if (((bitField0_ & 0x00000020) == 0x00000020)) {
- size += com.google.protobuf.CodedOutputStream
- .computeInt64Size(6, createTime_);
- }
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
- return size;
- }
-
- private static final long serialVersionUID = 0L;
- @java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
- }
-
- @java.lang.Override
- public boolean equals(final java.lang.Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock)) {
- return super.equals(obj);
- }
- org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock other = (org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock) obj;
-
- boolean result = true;
- result = result && (hasTableName() == other.hasTableName());
- if (hasTableName()) {
- result = result && getTableName()
- .equals(other.getTableName());
- }
- result = result && (hasLockOwner() == other.hasLockOwner());
- if (hasLockOwner()) {
- result = result && getLockOwner()
- .equals(other.getLockOwner());
- }
- result = result && (hasThreadId() == other.hasThreadId());
- if (hasThreadId()) {
- result = result && (getThreadId()
- == other.getThreadId());
- }
- result = result && (hasIsShared() == other.hasIsShared());
- if (hasIsShared()) {
- result = result && (getIsShared()
- == other.getIsShared());
- }
- result = result && (hasPurpose() == other.hasPurpose());
- if (hasPurpose()) {
- result = result && getPurpose()
- .equals(other.getPurpose());
- }
- result = result && (hasCreateTime() == other.hasCreateTime());
- if (hasCreateTime()) {
- result = result && (getCreateTime()
- == other.getCreateTime());
- }
- result = result &&
- getUnknownFields().equals(other.getUnknownFields());
- return result;
- }
-
- private int memoizedHashCode = 0;
- @java.lang.Override
- public int hashCode() {
- if (memoizedHashCode != 0) {
- return memoizedHashCode;
- }
- int hash = 41;
- hash = (19 * hash) + getDescriptorForType().hashCode();
- if (hasTableName()) {
- hash = (37 * hash) + TABLE_NAME_FIELD_NUMBER;
- hash = (53 * hash) + getTableName().hashCode();
- }
- if (hasLockOwner()) {
- hash = (37 * hash) + LOCK_OWNER_FIELD_NUMBER;
- hash = (53 * hash) + getLockOwner().hashCode();
- }
- if (hasThreadId()) {
- hash = (37 * hash) + THREAD_ID_FIELD_NUMBER;
- hash = (53 * hash) + hashLong(getThreadId());
- }
- if (hasIsShared()) {
- hash = (37 * hash) + IS_SHARED_FIELD_NUMBER;
- hash = (53 * hash) + hashBoolean(getIsShared());
- }
- if (hasPurpose()) {
- hash = (37 * hash) + PURPOSE_FIELD_NUMBER;
- hash = (53 * hash) + getPurpose().hashCode();
- }
- if (hasCreateTime()) {
- hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER;
- hash = (53 * hash) + hashLong(getCreateTime());
- }
- hash = (29 * hash) + getUnknownFields().hashCode();
- memoizedHashCode = hash;
- return hash;
- }
-
- public static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- com.google.protobuf.ByteString data)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data);
- }
- public static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- com.google.protobuf.ByteString data,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data, extensionRegistry);
- }
- public static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(byte[] data)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data);
- }
- public static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- byte[] data,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data, extensionRegistry);
- }
- public static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(java.io.InputStream input)
- throws java.io.IOException {
- return PARSER.parseFrom(input);
- }
- public static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- java.io.InputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
- }
- public static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock parseDelimitedFrom(java.io.InputStream input)
- throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
- }
- public static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock parseDelimitedFrom(
- java.io.InputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
- }
- public static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- com.google.protobuf.CodedInputStream input)
- throws java.io.IOException {
- return PARSER.parseFrom(input);
- }
- public static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
- }
-
- public static Builder newBuilder() { return Builder.create(); }
- public Builder newBuilderForType() { return newBuilder(); }
- public static Builder newBuilder(org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock prototype) {
- return newBuilder().mergeFrom(prototype);
- }
- public Builder toBuilder() { return newBuilder(this); }
-
- @java.lang.Override
- protected Builder newBuilderForType(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
- Builder builder = new Builder(parent);
- return builder;
- }
- /**
- * Protobuf type {@code hbase.pb.TableLock}
- *
- * <pre>
- **
- * Metadata associated with a table lock in zookeeper
- * </pre>
- */
- public static final class Builder extends
- com.google.protobuf.GeneratedMessage.Builder<Builder>
- implements org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLockOrBuilder {
- public static final com.google.protobuf.Descriptors.Descriptor
- getDescriptor() {
- return org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.internal_static_hbase_pb_TableLock_descriptor;
- }
-
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
- internalGetFieldAccessorTable() {
- return org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.internal_static_hbase_pb_TableLock_fieldAccessorTable
- .ensureFieldAccessorsInitialized(
- org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock.class, org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock.Builder.class);
- }
-
- // Construct using org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock.newBuilder()
- private Builder() {
- maybeForceBuilderInitialization();
- }
-
- private Builder(
- com.google.protobuf.GeneratedMessage.BuilderParent parent) {
- super(parent);
- maybeForceBuilderInitialization();
- }
- private void maybeForceBuilderInitialization() {
- if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
- getTableNameFieldBuilder();
- getLockOwnerFieldBuilder();
- }
- }
- private static Builder create() {
- return new Builder();
- }
-
- public Builder clear() {
- super.clear();
- if (tableNameBuilder_ == null) {
- tableName_ = org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.getDefaultInstance();
- } else {
- tableNameBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000001);
- if (lockOwnerBuilder_ == null) {
- lockOwner_ = org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.getDefaultInstance();
- } else {
- lockOwnerBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000002);
- threadId_ = 0L;
- bitField0_ = (bitField0_ & ~0x00000004);
- isShared_ = false;
- bitField0_ = (bitField0_ & ~0x00000008);
- purpose_ = "";
- bitField0_ = (bitField0_ & ~0x00000010);
- createTime_ = 0L;
- bitField0_ = (bitField0_ & ~0x00000020);
- return this;
- }
-
- public Builder clone() {
- return create().mergeFrom(buildPartial());
- }
-
- public com.google.protobuf.Descriptors.Descriptor
- getDescriptorForType() {
- return org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.internal_static_hbase_pb_TableLock_descriptor;
- }
-
- public org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock getDefaultInstanceForType() {
- return org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock.getDefaultInstance();
- }
-
- public org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock build() {
- org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock result = buildPartial();
- if (!result.isInitialized()) {
- throw newUninitializedMessageException(result);
- }
- return result;
- }
-
- public org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock buildPartial() {
- org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock result = new org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock(this);
- int from_bitField0_ = bitField0_;
- int to_bitField0_ = 0;
- if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
- to_bitField0_ |= 0x00000001;
- }
- if (tableNameBuilder_ == null) {
- result.tableName_ = tableName_;
- } else {
- result.tableName_ = tableNameBuilder_.build();
- }
- if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
- to_bitField0_ |= 0x00000002;
- }
- if (lockOwnerBuilder_ == null) {
- result.lockOwner_ = lockOwner_;
- } else {
- result.lockOwner_ = lockOwnerBuilder_.build();
- }
- if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
- to_bitField0_ |= 0x00000004;
- }
- result.threadId_ = threadId_;
- if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
- to_bitField0_ |= 0x00000008;
- }
- result.isShared_ = isShared_;
- if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
- to_bitField0_ |= 0x00000010;
- }
- result.purpose_ = purpose_;
- if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
- to_bitField0_ |= 0x00000020;
- }
- result.createTime_ = createTime_;
- result.bitField0_ = to_bitField0_;
- onBuilt();
- return result;
- }
-
- public Builder mergeFrom(com.google.protobuf.Message other) {
- if (other instanceof org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock) {
- return mergeFrom((org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock)other);
- } else {
- super.mergeFrom(other);
- return this;
- }
- }
-
- public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock other) {
- if (other == org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock.getDefaultInstance()) return this;
- if (other.hasTableName()) {
- mergeTableName(other.getTableName());
- }
- if (other.hasLockOwner()) {
- mergeLockOwner(other.getLockOwner());
- }
- if (other.hasThreadId()) {
- setThreadId(other.getThreadId());
- }
- if (other.hasIsShared()) {
- setIsShared(other.getIsShared());
- }
- if (other.hasPurpose()) {
- bitField0_ |= 0x00000010;
- purpose_ = other.purpose_;
- onChanged();
- }
- if (other.hasCreateTime()) {
- setCreateTime(other.getCreateTime());
- }
- this.mergeUnknownFields(other.getUnknownFields());
- return this;
- }
-
- public final boolean isInitialized() {
- if (hasTableName()) {
- if (!getTableName().isInitialized()) {
-
- return false;
- }
- }
- if (hasLockOwner()) {
- if (!getLockOwner().isInitialized()) {
-
- return false;
- }
- }
- return true;
- }
-
- public Builder mergeFrom(
- com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock parsedMessage = null;
- try {
- parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
- } catch (com.google.protobuf.InvalidProtocolBufferException e) {
- parsedMessage = (org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock) e.getUnfinishedMessage();
- throw e;
- } finally {
- if (parsedMessage != null) {
- mergeFrom(parsedMessage);
- }
- }
- return this;
- }
- private int bitField0_;
-
- // optional .hbase.pb.TableName table_name = 1;
- private org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName tableName_ = org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.Builder, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableNameOrBuilder> tableNameBuilder_;
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public boolean hasTableName() {
- return ((bitField0_ & 0x00000001) == 0x00000001);
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName getTableName() {
- if (tableNameBuilder_ == null) {
- return tableName_;
- } else {
- return tableNameBuilder_.getMessage();
- }
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public Builder setTableName(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName value) {
- if (tableNameBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- tableName_ = value;
- onChanged();
- } else {
- tableNameBuilder_.setMessage(value);
- }
- bitField0_ |= 0x00000001;
- return this;
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public Builder setTableName(
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.Builder builderForValue) {
- if (tableNameBuilder_ == null) {
- tableName_ = builderForValue.build();
- onChanged();
- } else {
- tableNameBuilder_.setMessage(builderForValue.build());
- }
- bitField0_ |= 0x00000001;
- return this;
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public Builder mergeTableName(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName value) {
- if (tableNameBuilder_ == null) {
- if (((bitField0_ & 0x00000001) == 0x00000001) &&
- tableName_ != org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.getDefaultInstance()) {
- tableName_ =
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.newBuilder(tableName_).mergeFrom(value).buildPartial();
- } else {
- tableName_ = value;
- }
- onChanged();
- } else {
- tableNameBuilder_.mergeFrom(value);
- }
- bitField0_ |= 0x00000001;
- return this;
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public Builder clearTableName() {
- if (tableNameBuilder_ == null) {
- tableName_ = org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.getDefaultInstance();
- onChanged();
- } else {
- tableNameBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000001);
- return this;
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.Builder getTableNameBuilder() {
- bitField0_ |= 0x00000001;
- onChanged();
- return getTableNameFieldBuilder().getBuilder();
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableNameOrBuilder getTableNameOrBuilder() {
- if (tableNameBuilder_ != null) {
- return tableNameBuilder_.getMessageOrBuilder();
- } else {
- return tableName_;
- }
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- private com.google.protobuf.SingleFieldBuilder<
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.Builder, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableNameOrBuilder>
- getTableNameFieldBuilder() {
- if (tableNameBuilder_ == null) {
- tableNameBuilder_ = new com.google.protobuf.SingleFieldBuilder<
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableName.Builder, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableNameOrBuilder>(
- tableName_,
- getParentForChildren(),
- isClean());
- tableName_ = null;
- }
- return tableNameBuilder_;
- }
-
- // optional .hbase.pb.ServerName lock_owner = 2;
- private org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName lockOwner_ = org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.getDefaultInstance();
- private com.google.protobuf.SingleFieldBuilder<
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.Builder, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerNameOrBuilder> lockOwnerBuilder_;
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public boolean hasLockOwner() {
- return ((bitField0_ & 0x00000002) == 0x00000002);
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName getLockOwner() {
- if (lockOwnerBuilder_ == null) {
- return lockOwner_;
- } else {
- return lockOwnerBuilder_.getMessage();
- }
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public Builder setLockOwner(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName value) {
- if (lockOwnerBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- lockOwner_ = value;
- onChanged();
- } else {
- lockOwnerBuilder_.setMessage(value);
- }
- bitField0_ |= 0x00000002;
- return this;
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public Builder setLockOwner(
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.Builder builderForValue) {
- if (lockOwnerBuilder_ == null) {
- lockOwner_ = builderForValue.build();
- onChanged();
- } else {
- lockOwnerBuilder_.setMessage(builderForValue.build());
- }
- bitField0_ |= 0x00000002;
- return this;
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public Builder mergeLockOwner(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName value) {
- if (lockOwnerBuilder_ == null) {
- if (((bitField0_ & 0x00000002) == 0x00000002) &&
- lockOwner_ != org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.getDefaultInstance()) {
- lockOwner_ =
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.newBuilder(lockOwner_).mergeFrom(value).buildPartial();
- } else {
- lockOwner_ = value;
- }
- onChanged();
- } else {
- lockOwnerBuilder_.mergeFrom(value);
- }
- bitField0_ |= 0x00000002;
- return this;
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public Builder clearLockOwner() {
- if (lockOwnerBuilder_ == null) {
- lockOwner_ = org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.getDefaultInstance();
- onChanged();
- } else {
- lockOwnerBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000002);
- return this;
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.Builder getLockOwnerBuilder() {
- bitField0_ |= 0x00000002;
- onChanged();
- return getLockOwnerFieldBuilder().getBuilder();
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerNameOrBuilder getLockOwnerOrBuilder() {
- if (lockOwnerBuilder_ != null) {
- return lockOwnerBuilder_.getMessageOrBuilder();
- } else {
- return lockOwner_;
- }
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- private com.google.protobuf.SingleFieldBuilder<
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.Builder, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerNameOrBuilder>
- getLockOwnerFieldBuilder() {
- if (lockOwnerBuilder_ == null) {
- lockOwnerBuilder_ = new com.google.protobuf.SingleFieldBuilder<
- org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.Builder, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerNameOrBuilder>(
- lockOwner_,
- getParentForChildren(),
- isClean());
- lockOwner_ = null;
- }
- return lockOwnerBuilder_;
- }
-
- // optional int64 thread_id = 3;
- private long threadId_ ;
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public boolean hasThreadId() {
- return ((bitField0_ & 0x00000004) == 0x00000004);
- }
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public long getThreadId() {
- return threadId_;
- }
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public Builder setThreadId(long value) {
- bitField0_ |= 0x00000004;
- threadId_ = value;
- onChanged();
- return this;
- }
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public Builder clearThreadId() {
- bitField0_ = (bitField0_ & ~0x00000004);
- threadId_ = 0L;
- onChanged();
- return this;
- }
-
- // optional bool is_shared = 4;
- private boolean isShared_ ;
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public boolean hasIsShared() {
- return ((bitField0_ & 0x00000008) == 0x00000008);
- }
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public boolean getIsShared() {
- return isShared_;
- }
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public Builder setIsShared(boolean value) {
- bitField0_ |= 0x00000008;
- isShared_ = value;
- onChanged();
- return this;
- }
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public Builder clearIsShared() {
- bitField0_ = (bitField0_ & ~0x00000008);
- isShared_ = false;
- onChanged();
- return this;
- }
-
- // optional string purpose = 5;
- private java.lang.Object purpose_ = "";
- /**
- * <code>optional string purpose = 5;</code>
- */
- public boolean hasPurpose() {
- return ((bitField0_ & 0x00000010) == 0x00000010);
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public java.lang.String getPurpose() {
- java.lang.Object ref = purpose_;
- if (!(ref instanceof java.lang.String)) {
- java.lang.String s = ((com.google.protobuf.ByteString) ref)
- .toStringUtf8();
- purpose_ = s;
- return s;
- } else {
- return (java.lang.String) ref;
- }
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public com.google.protobuf.ByteString
- getPurposeBytes() {
- java.lang.Object ref = purpose_;
- if (ref instanceof String) {
- com.google.protobuf.ByteString b =
- com.google.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- purpose_ = b;
- return b;
- } else {
- return (com.google.protobuf.ByteString) ref;
- }
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public Builder setPurpose(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000010;
- purpose_ = value;
- onChanged();
- return this;
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public Builder clearPurpose() {
- bitField0_ = (bitField0_ & ~0x00000010);
- purpose_ = getDefaultInstance().getPurpose();
- onChanged();
- return this;
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public Builder setPurposeBytes(
- com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000010;
- purpose_ = value;
- onChanged();
- return this;
- }
-
- // optional int64 create_time = 6;
- private long createTime_ ;
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public boolean hasCreateTime() {
- return ((bitField0_ & 0x00000020) == 0x00000020);
- }
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public long getCreateTime() {
- return createTime_;
- }
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public Builder setCreateTime(long value) {
- bitField0_ |= 0x00000020;
- createTime_ = value;
- onChanged();
- return this;
- }
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public Builder clearCreateTime() {
- bitField0_ = (bitField0_ & ~0x00000020);
- createTime_ = 0L;
- onChanged();
- return this;
- }
-
- // @@protoc_insertion_point(builder_scope:hbase.pb.TableLock)
- }
-
- static {
- defaultInstance = new TableLock(true);
- defaultInstance.initFields();
- }
-
- // @@protoc_insertion_point(class_scope:hbase.pb.TableLock)
- }
-
public interface SwitchStateOrBuilder
extends com.google.protobuf.MessageOrBuilder {
@@ -9498,11 +8283,6 @@ public final class ZooKeeperProtos {
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_hbase_pb_ReplicationHLogPosition_fieldAccessorTable;
private static com.google.protobuf.Descriptors.Descriptor
- internal_static_hbase_pb_TableLock_descriptor;
- private static
- com.google.protobuf.GeneratedMessage.FieldAccessorTable
- internal_static_hbase_pb_TableLock_fieldAccessorTable;
- private static com.google.protobuf.Descriptors.Descriptor
internal_static_hbase_pb_SwitchState_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
@@ -9546,14 +8326,9 @@ public final class ZooKeeperProtos {
"tate\022/\n\005state\030\001 \002(\0162 .hbase.pb.Replicati" +
"onState.State\"\"\n\005State\022\013\n\007ENABLED\020\000\022\014\n\010D" +
"ISABLED\020\001\"+\n\027ReplicationHLogPosition\022\020\n\010",
- "position\030\001 \002(\003\"\252\001\n\tTableLock\022\'\n\ntable_na" +
- "me\030\001 \001(\0132\023.hbase.pb.TableName\022(\n\nlock_ow" +
- "ner\030\002 \001(\0132\024.hbase.pb.ServerName\022\021\n\tthrea" +
- "d_id\030\003 \001(\003\022\021\n\tis_shared\030\004 \001(\010\022\017\n\007purpose" +
- "\030\005 \001(\t\022\023\n\013create_time\030\006 \001(\003\"\036\n\013SwitchSta" +
- "te\022\017\n\007enabled\030\001 \001(\010BE\n*org.apache.hadoop" +
- ".hbase.protobuf.generatedB\017ZooKeeperProt" +
- "osH\001\210\001\001\240\001\001"
+ "position\030\001 \002(\003\"\036\n\013SwitchState\022\017\n\007enabled" +
+ "\030\001 \001(\010BE\n*org.apache.hadoop.hbase.protob" +
+ "uf.generatedB\017ZooKeeperProtosH\001\210\001\001\240\001\001"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -9614,14 +8389,8 @@ public final class ZooKeeperProtos {
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_hbase_pb_ReplicationHLogPosition_descriptor,
new java.lang.String[] { "Position", });
- internal_static_hbase_pb_TableLock_descriptor =
- getDescriptor().getMessageTypes().get(9);
- internal_static_hbase_pb_TableLock_fieldAccessorTable = new
- com.google.protobuf.GeneratedMessage.FieldAccessorTable(
- internal_static_hbase_pb_TableLock_descriptor,
- new java.lang.String[] { "TableName", "LockOwner", "ThreadId", "IsShared", "Purpose", "CreateTime", });
internal_static_hbase_pb_SwitchState_descriptor =
- getDescriptor().getMessageTypes().get(10);
+ getDescriptor().getMessageTypes().get(9);
internal_static_hbase_pb_SwitchState_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_hbase_pb_SwitchState_descriptor,
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/hbase-protocol/src/main/protobuf/ZooKeeper.proto
----------------------------------------------------------------------
diff --git a/hbase-protocol/src/main/protobuf/ZooKeeper.proto b/hbase-protocol/src/main/protobuf/ZooKeeper.proto
index 6f13e4a..ee73c84 100644
--- a/hbase-protocol/src/main/protobuf/ZooKeeper.proto
+++ b/hbase-protocol/src/main/protobuf/ZooKeeper.proto
@@ -144,18 +144,6 @@ message ReplicationHLogPosition {
}
/**
- * Metadata associated with a table lock in zookeeper
- */
-message TableLock {
- optional TableName table_name = 1;
- optional ServerName lock_owner = 2;
- optional int64 thread_id = 3;
- optional bool is_shared = 4;
- optional string purpose = 5;
- optional int64 create_time = 6;
-}
-
-/**
* State of the switch.
*/
message SwitchState {
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/hbase-server/src/main/java/org/apache/hadoop/hbase/InterProcessLock.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/InterProcessLock.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/InterProcessLock.java
deleted file mode 100644
index d1216f1..0000000
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/InterProcessLock.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Copyright The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import java.io.IOException;
-
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
-
-/**
- * An interface for an application-specific lock.
- */
-@InterfaceAudience.Private
-public interface InterProcessLock {
-
- /**
- * Acquire the lock, waiting indefinitely until the lock is released or
- * the thread is interrupted.
- * @throws IOException If there is an unrecoverable error releasing the lock
- * @throws InterruptedException If current thread is interrupted while
- * waiting for the lock
- */
- void acquire() throws IOException, InterruptedException;
-
- /**
- * Acquire the lock within a wait time.
- * @param timeoutMs The maximum time (in milliseconds) to wait for the lock,
- * -1 to wait indefinitely
- * @return True if the lock was acquired, false if waiting time elapsed
- * before the lock was acquired
- * @throws IOException If there is an unrecoverable error talking talking
- * (e.g., when talking to a lock service) when acquiring
- * the lock
- * @throws InterruptedException If the thread is interrupted while waiting to
- * acquire the lock
- */
- boolean tryAcquire(long timeoutMs)
- throws IOException, InterruptedException;
-
- /**
- * Release the lock.
- * @throws IOException If there is an unrecoverable error releasing the lock
- * @throws InterruptedException If the thread is interrupted while releasing
- * the lock
- */
- void release() throws IOException, InterruptedException;
-
- /**
- * If supported, attempts to reap all the locks of this type by forcefully
- * deleting the locks (both held and attempted) that have expired according
- * to the given timeout. Lock reaping is different than coordinated lock revocation
- * in that, there is no coordination, and the behavior is undefined if the
- * lock holder is still alive.
- * @throws IOException If there is an unrecoverable error reaping the locks
- */
- void reapExpiredLocks(long expireTimeoutMs) throws IOException;
-
- /**
- * If supported, attempts to reap all the locks of this type by forcefully
- * deleting the locks (both held and attempted). Lock reaping is different
- * than coordinated lock revocation in that, there is no coordination, and
- * the behavior is undefined if the lock holder is still alive.
- * Calling this should have the same affect as calling {@link #reapExpiredLocks(long)}
- * with timeout=0.
- * @throws IOException If there is an unrecoverable error reaping the locks
- */
- void reapAllLocks() throws IOException;
-
- /**
- * An interface for objects that process lock metadata.
- */
- interface MetadataHandler {
-
- /**
- * Called after lock metadata is successfully read from a distributed
- * lock service. This method may contain any procedures for, e.g.,
- * printing the metadata in a humanly-readable format.
- * @param metadata The metadata
- */
- void handleMetadata(byte[] metadata);
- }
-
- /**
- * Visits the locks (both held and attempted) of this type with the given
- * {@link MetadataHandler}.
- * @throws IOException If there is an unrecoverable error
- */
- void visitLocks(MetadataHandler handler) throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/hbase-server/src/main/java/org/apache/hadoop/hbase/InterProcessReadWriteLock.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/InterProcessReadWriteLock.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/InterProcessReadWriteLock.java
deleted file mode 100644
index 0f7ddbe..0000000
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/InterProcessReadWriteLock.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
-
-/**
- * An interface for a distributed reader-writer lock.
- */
-@InterfaceAudience.Private
-public interface InterProcessReadWriteLock {
-
- /**
- * Obtain a read lock containing given metadata.
- * @param metadata Serialized lock metadata (this may contain information
- * such as the process owning the lock or the purpose for
- * which the lock was acquired).
- * @return An instantiated InterProcessLock instance
- */
- InterProcessLock readLock(byte[] metadata);
-
- /**
- * Obtain a write lock containing given metadata.
- * @param metadata Serialized lock metadata (this may contain information
- * such as the process owning the lock or the purpose for
- * which the lock was acquired).
- * @return An instantiated InterProcessLock instance
- */
- InterProcessLock writeLock(byte[] metadata);
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessLockBase.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessLockBase.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessLockBase.java
deleted file mode 100644
index 090acf7..0000000
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessLockBase.java
+++ /dev/null
@@ -1,459 +0,0 @@
-/**
- * Copyright The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.zookeeper.lock;
-
-import java.io.IOException;
-import java.util.Comparator;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
-import org.apache.hadoop.hbase.InterProcessLock;
-import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
-import org.apache.hadoop.hbase.zookeeper.DeletionListener;
-import org.apache.hadoop.hbase.zookeeper.ZKUtil;
-import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.KeeperException.BadVersionException;
-import org.apache.zookeeper.data.Stat;
-
-import com.google.common.base.Preconditions;
-
-/**
- * ZooKeeper based HLock implementation. Based on the Shared Locks recipe.
- * (see:
- * <a href="http://zookeeper.apache.org/doc/trunk/recipes.html">
- * ZooKeeper Recipes and Solutions
- * </a>)
- */
-@InterfaceAudience.Private
-public abstract class ZKInterProcessLockBase implements InterProcessLock {
-
- private static final Log LOG = LogFactory.getLog(ZKInterProcessLockBase.class);
-
- /** ZNode prefix used by processes acquiring reader locks */
- protected static final String READ_LOCK_CHILD_NODE_PREFIX = "read-";
-
- /** ZNode prefix used by processes acquiring writer locks */
- protected static final String WRITE_LOCK_CHILD_NODE_PREFIX = "write-";
-
- protected final ZooKeeperWatcher zkWatcher;
- protected final String parentLockNode;
- protected final String fullyQualifiedZNode;
- protected final String childZNode;
- protected final byte[] metadata;
- protected final MetadataHandler handler;
-
- // If we acquire a lock, update this field
- protected final AtomicReference<AcquiredLock> acquiredLock =
- new AtomicReference<AcquiredLock>(null);
-
- /**
- * Represents information about a lock held by this thread.
- */
- protected static class AcquiredLock {
- private final String path;
- private final int version;
-
- /**
- * Store information about a lock.
- * @param path The path to a lock's ZNode
- * @param version The current version of the lock's ZNode
- */
- public AcquiredLock(String path, int version) {
- this.path = path;
- this.version = version;
- }
-
- public String getPath() {
- return path;
- }
-
- public int getVersion() {
- return version;
- }
-
- @Override
- public String toString() {
- return "AcquiredLockInfo{" +
- "path='" + path + '\'' +
- ", version=" + version +
- '}';
- }
- }
-
- protected static class ZNodeComparator implements Comparator<String> {
-
- public static final ZNodeComparator COMPARATOR = new ZNodeComparator();
-
- private ZNodeComparator() {
- }
-
- /** Parses sequenceId from the znode name. ZooKeeper documentation
- * states: The sequence number is always fixed length of 10 digits, 0 padded
- */
- public static long getChildSequenceId(String childZNode) {
- Preconditions.checkNotNull(childZNode);
- assert childZNode.length() >= 10;
- String sequenceIdStr = childZNode.substring(childZNode.length() - 10);
- return Long.parseLong(sequenceIdStr);
- }
-
- @Override
- public int compare(String zNode1, String zNode2) {
- long seq1 = getChildSequenceId(zNode1);
- long seq2 = getChildSequenceId(zNode2);
- if (seq1 == seq2) {
- return 0;
- } else {
- return seq1 < seq2 ? -1 : 1;
- }
- }
- }
-
- /**
- * Called by implementing classes.
- * @param zkWatcher
- * @param parentLockNode The lock ZNode path
- * @param metadata
- * @param handler
- * @param childNode The prefix for child nodes created under the parent
- */
- protected ZKInterProcessLockBase(ZooKeeperWatcher zkWatcher,
- String parentLockNode, byte[] metadata, MetadataHandler handler, String childNode) {
- this.zkWatcher = zkWatcher;
- this.parentLockNode = parentLockNode;
- this.fullyQualifiedZNode = ZKUtil.joinZNode(parentLockNode, childNode);
- this.metadata = metadata;
- this.handler = handler;
- this.childZNode = childNode;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void acquire() throws IOException, InterruptedException {
- tryAcquire(-1);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean tryAcquire(long timeoutMs)
- throws IOException, InterruptedException {
- boolean hasTimeout = timeoutMs != -1;
- long waitUntilMs =
- hasTimeout ?EnvironmentEdgeManager.currentTime() + timeoutMs : -1;
- String createdZNode;
- try {
- createdZNode = createLockZNode();
- } catch (KeeperException ex) {
- throw new IOException("Failed to create znode: " + fullyQualifiedZNode, ex);
- }
- while (true) {
- List<String> children;
- try {
- children = ZKUtil.listChildrenNoWatch(zkWatcher, parentLockNode);
- } catch (KeeperException e) {
- LOG.error("Unexpected ZooKeeper error when listing children", e);
- throw new IOException("Unexpected ZooKeeper exception", e);
- }
- String pathToWatch;
- if ((pathToWatch = getLockPath(createdZNode, children)) == null) {
- break;
- }
- CountDownLatch deletedLatch = new CountDownLatch(1);
- String zkPathToWatch =
- ZKUtil.joinZNode(parentLockNode, pathToWatch);
- DeletionListener deletionListener =
- new DeletionListener(zkWatcher, zkPathToWatch, deletedLatch);
- zkWatcher.registerListener(deletionListener);
- try {
- if (ZKUtil.setWatchIfNodeExists(zkWatcher, zkPathToWatch)) {
- // Wait for the watcher to fire
- if (hasTimeout) {
- long remainingMs = waitUntilMs - EnvironmentEdgeManager.currentTime();
- if (remainingMs < 0 ||
- !deletedLatch.await(remainingMs, TimeUnit.MILLISECONDS)) {
- LOG.warn("Unable to acquire the lock in " + timeoutMs +
- " milliseconds.");
- try {
- ZKUtil.deleteNode(zkWatcher, createdZNode);
- } catch (KeeperException e) {
- LOG.warn("Unable to remove ZNode " + createdZNode);
- }
- return false;
- }
- } else {
- deletedLatch.await();
- }
- if (deletionListener.hasException()) {
- Throwable t = deletionListener.getException();
- throw new IOException("Exception in the watcher", t);
- }
- }
- } catch (KeeperException e) {
- throw new IOException("Unexpected ZooKeeper exception", e);
- } finally {
- zkWatcher.unregisterListener(deletionListener);
- }
- }
- updateAcquiredLock(createdZNode);
- LOG.debug("Acquired a lock for " + createdZNode);
- return true;
- }
-
- private String createLockZNode() throws KeeperException {
- try {
- return ZKUtil.createNodeIfNotExistsNoWatch(zkWatcher, fullyQualifiedZNode,
- metadata, CreateMode.EPHEMERAL_SEQUENTIAL);
- } catch (KeeperException.NoNodeException nne) {
- //create parents, retry
- ZKUtil.createWithParents(zkWatcher, parentLockNode);
- return createLockZNode();
- }
- }
-
- /**
- * Check if a child znode represents a read lock.
- * @param child The child znode we want to check.
- * @return whether the child znode represents a read lock
- */
- protected static boolean isChildReadLock(String child) {
- int idx = child.lastIndexOf(ZKUtil.ZNODE_PATH_SEPARATOR);
- String suffix = child.substring(idx + 1);
- return suffix.startsWith(READ_LOCK_CHILD_NODE_PREFIX);
- }
-
- /**
- * Check if a child znode represents a write lock.
- * @param child The child znode we want to check.
- * @return whether the child znode represents a write lock
- */
- protected static boolean isChildWriteLock(String child) {
- int idx = child.lastIndexOf(ZKUtil.ZNODE_PATH_SEPARATOR);
- String suffix = child.substring(idx + 1);
- return suffix.startsWith(WRITE_LOCK_CHILD_NODE_PREFIX);
- }
-
- /**
- * Check if a child znode represents the same type(read or write) of lock
- * @param child The child znode we want to check.
- * @return whether the child znode represents the same type(read or write) of lock
- */
- protected boolean isChildOfSameType(String child) {
- int idx = child.lastIndexOf(ZKUtil.ZNODE_PATH_SEPARATOR);
- String suffix = child.substring(idx + 1);
- return suffix.startsWith(this.childZNode);
- }
-
- /**
- * Update state as to indicate that a lock is held
- * @param createdZNode The lock znode
- * @throws IOException If an unrecoverable ZooKeeper error occurs
- */
- protected void updateAcquiredLock(String createdZNode) throws IOException {
- Stat stat = new Stat();
- byte[] data = null;
- Exception ex = null;
- try {
- data = ZKUtil.getDataNoWatch(zkWatcher, createdZNode, stat);
- } catch (KeeperException e) {
- LOG.warn("Cannot getData for znode:" + createdZNode, e);
- ex = e;
- }
- if (data == null) {
- LOG.error("Can't acquire a lock on a non-existent node " + createdZNode);
- throw new IllegalStateException("ZNode " + createdZNode +
- "no longer exists!", ex);
- }
- AcquiredLock newLock = new AcquiredLock(createdZNode, stat.getVersion());
- if (!acquiredLock.compareAndSet(null, newLock)) {
- LOG.error("The lock " + fullyQualifiedZNode +
- " has already been acquired by another process!");
- throw new IllegalStateException(fullyQualifiedZNode +
- " is held by another process");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void release() throws IOException, InterruptedException {
- AcquiredLock lock = acquiredLock.get();
- if (lock == null) {
- LOG.error("Cannot release lock" +
- ", process does not have a lock for " + fullyQualifiedZNode);
- throw new IllegalStateException("No lock held for " + fullyQualifiedZNode);
- }
- try {
- if (ZKUtil.checkExists(zkWatcher, lock.getPath()) != -1) {
- boolean ret = ZKUtil.deleteNode(zkWatcher, lock.getPath(), lock.getVersion());
- if (!ret && ZKUtil.checkExists(zkWatcher, lock.getPath()) != -1) {
- throw new IllegalStateException("Couldn't delete " + lock.getPath());
- }
- if (!acquiredLock.compareAndSet(lock, null)) {
- LOG.debug("Current process no longer holds " + lock + " for " +
- fullyQualifiedZNode);
- throw new IllegalStateException("Not holding a lock for " +
- fullyQualifiedZNode +"!");
- }
- }
- if (LOG.isDebugEnabled()) {
- LOG.debug("Released " + lock.getPath());
- }
- } catch (BadVersionException e) {
- throw new IllegalStateException(e);
- } catch (KeeperException e) {
- throw new IOException(e);
- }
- }
-
- /**
- * Process metadata stored in a ZNode using a callback
- * <p>
- * @param lockZNode The node holding the metadata
- * @return True if metadata was ready and processed, false otherwise.
- */
- protected boolean handleLockMetadata(String lockZNode) {
- return handleLockMetadata(lockZNode, handler);
- }
-
- /**
- * Process metadata stored in a ZNode using a callback object passed to
- * this instance.
- * <p>
- * @param lockZNode The node holding the metadata
- * @param handler the metadata handler
- * @return True if metadata was ready and processed, false on exception.
- */
- protected boolean handleLockMetadata(String lockZNode, MetadataHandler handler) {
- if (handler == null) {
- return false;
- }
- try {
- byte[] metadata = ZKUtil.getData(zkWatcher, lockZNode);
- handler.handleMetadata(metadata);
- } catch (KeeperException ex) {
- LOG.warn("Error processing lock metadata in " + lockZNode);
- return false;
- } catch (InterruptedException e) {
- LOG.warn("InterruptedException processing lock metadata in " + lockZNode);
- Thread.currentThread().interrupt();
- return false;
- }
- return true;
- }
-
- @Override
- public void reapAllLocks() throws IOException {
- reapExpiredLocks(0);
- }
-
- /**
- * Will delete all lock znodes of this type (either read or write) which are "expired"
- * according to timeout. Assumption is that the clock skew between zookeeper and this servers
- * is negligible.
- * Referred in zk recipe as "Revocable Shared Locks with Freaking Laser Beams".
- * (http://zookeeper.apache.org/doc/trunk/recipes.html).
- */
- public void reapExpiredLocks(long timeout) throws IOException {
- List<String> children;
- try {
- children = ZKUtil.listChildrenNoWatch(zkWatcher, parentLockNode);
- } catch (KeeperException e) {
- LOG.error("Unexpected ZooKeeper error when listing children", e);
- throw new IOException("Unexpected ZooKeeper exception", e);
- }
- if (children == null) return;
-
- KeeperException deferred = null;
- Stat stat = new Stat();
- long expireDate = System.currentTimeMillis() - timeout; //we are using cTime in zookeeper
- for (String child : children) {
- if (isChildOfSameType(child)) {
- String znode = ZKUtil.joinZNode(parentLockNode, child);
- try {
- ZKUtil.getDataNoWatch(zkWatcher, znode, stat);
- if (stat.getCtime() < expireDate) {
- LOG.info("Reaping lock for znode:" + znode);
- ZKUtil.deleteNodeFailSilent(zkWatcher, znode);
- }
- } catch (KeeperException ex) {
- LOG.warn("Error reaping the znode for write lock :" + znode);
- deferred = ex;
- }
- }
- }
- if (deferred != null) {
- throw new IOException("ZK exception while reaping locks:", deferred);
- }
- }
-
- /**
- * Visits the locks (both held and attempted) with the given MetadataHandler.
- * @throws IOException If there is an unrecoverable error
- */
- public void visitLocks(MetadataHandler handler) throws IOException {
- List<String> children;
- try {
- children = ZKUtil.listChildrenNoWatch(zkWatcher, parentLockNode);
- } catch (KeeperException e) {
- LOG.error("Unexpected ZooKeeper error when listing children", e);
- throw new IOException("Unexpected ZooKeeper exception", e);
- }
- if (children != null && children.size() > 0) {
- for (String child : children) {
- if (isChildOfSameType(child)) {
- String znode = ZKUtil.joinZNode(parentLockNode, child);
- String childWatchesZNode = getLockPath(child, children);
- if (childWatchesZNode == null) {
- LOG.info("Lock is held by: " + child);
- }
- handleLockMetadata(znode, handler);
- }
- }
- }
- }
-
- /**
- * Determine based on a list of children under a ZNode, whether or not a
- * process which created a specified ZNode has obtained a lock. If a lock is
- * not obtained, return the path that we should watch awaiting its deletion.
- * Otherwise, return null.
- * This method is abstract as the logic for determining whether or not a
- * lock is obtained depends on the type of lock being implemented.
- * @param myZNode The ZNode created by the process attempting to acquire
- * a lock
- * @param children List of all child ZNodes under the lock's parent ZNode
- * @return The path to watch, or null if myZNode can represent a correctly
- * acquired lock.
- */
- protected abstract String getLockPath(String myZNode, List<String> children)
- throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessReadLock.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessReadLock.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessReadLock.java
deleted file mode 100644
index 8d20001..0000000
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessReadLock.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Copyright The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.zookeeper.lock;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
-import org.apache.hadoop.hbase.zookeeper.ZKUtil;
-import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
-
-/**
- * ZooKeeper based read lock: does not exclude other read locks, but excludes
- * and is excluded by write locks.
- */
-@InterfaceAudience.Private
-public class ZKInterProcessReadLock extends ZKInterProcessLockBase {
-
- private static final Log LOG = LogFactory.getLog(ZKInterProcessReadLock.class);
-
- public ZKInterProcessReadLock(ZooKeeperWatcher zooKeeperWatcher,
- String znode, byte[] metadata, MetadataHandler handler) {
- super(zooKeeperWatcher, znode, metadata, handler, READ_LOCK_CHILD_NODE_PREFIX);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getLockPath(String createdZNode, List<String> children) throws IOException {
- TreeSet<String> writeChildren =
- new TreeSet<String>(ZNodeComparator.COMPARATOR);
- for (String child : children) {
- if (isChildWriteLock(child)) {
- writeChildren.add(child);
- }
- }
- if (writeChildren.isEmpty()) {
- return null;
- }
- SortedSet<String> lowerChildren = writeChildren.headSet(createdZNode);
- if (lowerChildren.isEmpty()) {
- return null;
- }
- String pathToWatch = lowerChildren.last();
- String nodeHoldingLock = lowerChildren.first();
- String znode = ZKUtil.joinZNode(parentLockNode, nodeHoldingLock);
- handleLockMetadata(znode);
-
- return pathToWatch;
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessReadWriteLock.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessReadWriteLock.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessReadWriteLock.java
deleted file mode 100644
index caa0f64..0000000
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessReadWriteLock.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Copyright The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.zookeeper.lock;
-
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
-import org.apache.hadoop.hbase.InterProcessLock.MetadataHandler;
-import org.apache.hadoop.hbase.InterProcessReadWriteLock;
-import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
-
-/**
- * ZooKeeper based implementation of {@link InterProcessReadWriteLock}. This lock is fair,
- * not reentrant, and not revocable.
- */
-@InterfaceAudience.Private
-public class ZKInterProcessReadWriteLock implements InterProcessReadWriteLock {
-
- private final ZooKeeperWatcher zkWatcher;
- private final String znode;
- private final MetadataHandler handler;
-
- /**
- * Creates a DistributedReadWriteLock instance.
- * @param zkWatcher
- * @param znode ZNode path for the lock
- * @param handler An object that will handle de-serializing and processing
- * the metadata associated with reader or writer locks
- * created by this object or null if none desired.
- */
- public ZKInterProcessReadWriteLock(ZooKeeperWatcher zkWatcher, String znode,
- MetadataHandler handler) {
- this.zkWatcher = zkWatcher;
- this.znode = znode;
- this.handler = handler;
- }
-
- /**
- * {@inheritDoc}
- */
- public ZKInterProcessReadLock readLock(byte[] metadata) {
- return new ZKInterProcessReadLock(zkWatcher, znode, metadata, handler);
- }
-
- /**
- * {@inheritDoc}
- */
- public ZKInterProcessWriteLock writeLock(byte[] metadata) {
- return new ZKInterProcessWriteLock(zkWatcher, znode, metadata, handler);
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessWriteLock.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessWriteLock.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessWriteLock.java
deleted file mode 100644
index 6663539..0000000
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessWriteLock.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.zookeeper.lock;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.TreeSet;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
-import org.apache.hadoop.hbase.zookeeper.ZKUtil;
-import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
-
-/**
- * ZooKeeper based write lock:
- */
-@InterfaceAudience.Private
-public class ZKInterProcessWriteLock extends ZKInterProcessLockBase {
-
- private static final Log LOG = LogFactory.getLog(ZKInterProcessWriteLock.class);
-
- public ZKInterProcessWriteLock(ZooKeeperWatcher zooKeeperWatcher,
- String znode, byte[] metadata, MetadataHandler handler) {
- super(zooKeeperWatcher, znode, metadata, handler, WRITE_LOCK_CHILD_NODE_PREFIX);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getLockPath(String createdZNode, List<String> children) throws IOException {
- TreeSet<String> sortedChildren =
- new TreeSet<String>(ZNodeComparator.COMPARATOR);
- sortedChildren.addAll(children);
- String pathToWatch = sortedChildren.lower(createdZNode);
- if (pathToWatch != null) {
- String nodeHoldingLock = sortedChildren.first();
- String znode = ZKUtil.joinZNode(parentLockNode, nodeHoldingLock);
- handleLockMetadata(znode);
- }
- return pathToWatch;
- }
-}
[3/3] hbase git commit: HBASE-16831 Procedure V2 - Remove
org.apache.hadoop.hbase.zookeeper.lock (Appy)
Posted by st...@apache.org.
HBASE-16831 Procedure V2 - Remove org.apache.hadoop.hbase.zookeeper.lock
(Appy)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4fdd6ff9
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4fdd6ff9
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4fdd6ff9
Branch: refs/heads/master
Commit: 4fdd6ff9aef0979d7b4f07abe159dbe4c755ccff
Parents: 558a6bb
Author: Michael Stack <st...@apache.org>
Authored: Thu Jan 19 10:24:24 2017 -0800
Committer: Michael Stack <st...@apache.org>
Committed: Thu Jan 19 16:51:44 2017 -0800
----------------------------------------------------------------------
.../protobuf/generated/ZooKeeperProtos.java | 1263 +-----------------
.../src/main/protobuf/ZooKeeper.proto | 12 -
.../protobuf/generated/ZooKeeperProtos.java | 1239 +----------------
.../src/main/protobuf/ZooKeeper.proto | 12 -
.../apache/hadoop/hbase/InterProcessLock.java | 105 --
.../hadoop/hbase/InterProcessReadWriteLock.java | 47 -
.../zookeeper/lock/ZKInterProcessLockBase.java | 459 -------
.../zookeeper/lock/ZKInterProcessReadLock.java | 73 -
.../lock/ZKInterProcessReadWriteLock.java | 66 -
.../zookeeper/lock/ZKInterProcessWriteLock.java | 61 -
.../lock/TestZKInterProcessReadWriteLock.java | 360 -----
pom.xml | 4 +-
12 files changed, 11 insertions(+), 3690 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/generated/ZooKeeperProtos.java
----------------------------------------------------------------------
diff --git a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/generated/ZooKeeperProtos.java b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/generated/ZooKeeperProtos.java
index de5827e..caafc01 100644
--- a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/generated/ZooKeeperProtos.java
+++ b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/generated/ZooKeeperProtos.java
@@ -4120,1244 +4120,6 @@ public final class ZooKeeperProtos {
}
- public interface TableLockOrBuilder extends
- // @@protoc_insertion_point(interface_extends:hbase.pb.TableLock)
- org.apache.hadoop.hbase.shaded.com.google.protobuf.MessageOrBuilder {
-
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- boolean hasTableName();
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName getTableName();
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableNameOrBuilder getTableNameOrBuilder();
-
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- boolean hasLockOwner();
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName getLockOwner();
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerNameOrBuilder getLockOwnerOrBuilder();
-
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- boolean hasThreadId();
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- long getThreadId();
-
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- boolean hasIsShared();
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- boolean getIsShared();
-
- /**
- * <code>optional string purpose = 5;</code>
- */
- boolean hasPurpose();
- /**
- * <code>optional string purpose = 5;</code>
- */
- java.lang.String getPurpose();
- /**
- * <code>optional string purpose = 5;</code>
- */
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString
- getPurposeBytes();
-
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- boolean hasCreateTime();
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- long getCreateTime();
- }
- /**
- * <pre>
- **
- * Metadata associated with a table lock in zookeeper
- * </pre>
- *
- * Protobuf type {@code hbase.pb.TableLock}
- */
- public static final class TableLock extends
- org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3 implements
- // @@protoc_insertion_point(message_implements:hbase.pb.TableLock)
- TableLockOrBuilder {
- // Use TableLock.newBuilder() to construct.
- private TableLock(org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
- super(builder);
- }
- private TableLock() {
- threadId_ = 0L;
- isShared_ = false;
- purpose_ = "";
- createTime_ = 0L;
- }
-
- @java.lang.Override
- public final org.apache.hadoop.hbase.shaded.com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
- return this.unknownFields;
- }
- private TableLock(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream input,
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException {
- this();
- int mutable_bitField0_ = 0;
- org.apache.hadoop.hbase.shaded.com.google.protobuf.UnknownFieldSet.Builder unknownFields =
- org.apache.hadoop.hbase.shaded.com.google.protobuf.UnknownFieldSet.newBuilder();
- try {
- boolean done = false;
- while (!done) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- done = true;
- break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
- case 10: {
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.Builder subBuilder = null;
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- subBuilder = tableName_.toBuilder();
- }
- tableName_ = input.readMessage(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.PARSER, extensionRegistry);
- if (subBuilder != null) {
- subBuilder.mergeFrom(tableName_);
- tableName_ = subBuilder.buildPartial();
- }
- bitField0_ |= 0x00000001;
- break;
- }
- case 18: {
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.Builder subBuilder = null;
- if (((bitField0_ & 0x00000002) == 0x00000002)) {
- subBuilder = lockOwner_.toBuilder();
- }
- lockOwner_ = input.readMessage(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.PARSER, extensionRegistry);
- if (subBuilder != null) {
- subBuilder.mergeFrom(lockOwner_);
- lockOwner_ = subBuilder.buildPartial();
- }
- bitField0_ |= 0x00000002;
- break;
- }
- case 24: {
- bitField0_ |= 0x00000004;
- threadId_ = input.readInt64();
- break;
- }
- case 32: {
- bitField0_ |= 0x00000008;
- isShared_ = input.readBool();
- break;
- }
- case 42: {
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString bs = input.readBytes();
- bitField0_ |= 0x00000010;
- purpose_ = bs;
- break;
- }
- case 48: {
- bitField0_ |= 0x00000020;
- createTime_ = input.readInt64();
- break;
- }
- }
- }
- } catch (org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException e) {
- throw e.setUnfinishedMessage(this);
- } catch (java.io.IOException e) {
- throw new org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException(
- e).setUnfinishedMessage(this);
- } finally {
- this.unknownFields = unknownFields.build();
- makeExtensionsImmutable();
- }
- }
- public static final org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.Descriptor
- getDescriptor() {
- return org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.internal_static_hbase_pb_TableLock_descriptor;
- }
-
- protected org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
- internalGetFieldAccessorTable() {
- return org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.internal_static_hbase_pb_TableLock_fieldAccessorTable
- .ensureFieldAccessorsInitialized(
- org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock.class, org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock.Builder.class);
- }
-
- private int bitField0_;
- public static final int TABLE_NAME_FIELD_NUMBER = 1;
- private org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName tableName_;
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public boolean hasTableName() {
- return ((bitField0_ & 0x00000001) == 0x00000001);
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName getTableName() {
- return tableName_ == null ? org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.getDefaultInstance() : tableName_;
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableNameOrBuilder getTableNameOrBuilder() {
- return tableName_ == null ? org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.getDefaultInstance() : tableName_;
- }
-
- public static final int LOCK_OWNER_FIELD_NUMBER = 2;
- private org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName lockOwner_;
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public boolean hasLockOwner() {
- return ((bitField0_ & 0x00000002) == 0x00000002);
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName getLockOwner() {
- return lockOwner_ == null ? org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.getDefaultInstance() : lockOwner_;
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerNameOrBuilder getLockOwnerOrBuilder() {
- return lockOwner_ == null ? org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.getDefaultInstance() : lockOwner_;
- }
-
- public static final int THREAD_ID_FIELD_NUMBER = 3;
- private long threadId_;
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public boolean hasThreadId() {
- return ((bitField0_ & 0x00000004) == 0x00000004);
- }
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public long getThreadId() {
- return threadId_;
- }
-
- public static final int IS_SHARED_FIELD_NUMBER = 4;
- private boolean isShared_;
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public boolean hasIsShared() {
- return ((bitField0_ & 0x00000008) == 0x00000008);
- }
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public boolean getIsShared() {
- return isShared_;
- }
-
- public static final int PURPOSE_FIELD_NUMBER = 5;
- private volatile java.lang.Object purpose_;
- /**
- * <code>optional string purpose = 5;</code>
- */
- public boolean hasPurpose() {
- return ((bitField0_ & 0x00000010) == 0x00000010);
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public java.lang.String getPurpose() {
- java.lang.Object ref = purpose_;
- if (ref instanceof java.lang.String) {
- return (java.lang.String) ref;
- } else {
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString bs =
- (org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString) ref;
- java.lang.String s = bs.toStringUtf8();
- if (bs.isValidUtf8()) {
- purpose_ = s;
- }
- return s;
- }
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString
- getPurposeBytes() {
- java.lang.Object ref = purpose_;
- if (ref instanceof java.lang.String) {
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString b =
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- purpose_ = b;
- return b;
- } else {
- return (org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString) ref;
- }
- }
-
- public static final int CREATE_TIME_FIELD_NUMBER = 6;
- private long createTime_;
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public boolean hasCreateTime() {
- return ((bitField0_ & 0x00000020) == 0x00000020);
- }
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public long getCreateTime() {
- return createTime_;
- }
-
- private byte memoizedIsInitialized = -1;
- public final boolean isInitialized() {
- byte isInitialized = memoizedIsInitialized;
- if (isInitialized == 1) return true;
- if (isInitialized == 0) return false;
-
- if (hasTableName()) {
- if (!getTableName().isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
- }
- }
- if (hasLockOwner()) {
- if (!getLockOwner().isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
- }
- }
- memoizedIsInitialized = 1;
- return true;
- }
-
- public void writeTo(org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedOutputStream output)
- throws java.io.IOException {
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- output.writeMessage(1, getTableName());
- }
- if (((bitField0_ & 0x00000002) == 0x00000002)) {
- output.writeMessage(2, getLockOwner());
- }
- if (((bitField0_ & 0x00000004) == 0x00000004)) {
- output.writeInt64(3, threadId_);
- }
- if (((bitField0_ & 0x00000008) == 0x00000008)) {
- output.writeBool(4, isShared_);
- }
- if (((bitField0_ & 0x00000010) == 0x00000010)) {
- org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.writeString(output, 5, purpose_);
- }
- if (((bitField0_ & 0x00000020) == 0x00000020)) {
- output.writeInt64(6, createTime_);
- }
- unknownFields.writeTo(output);
- }
-
- public int getSerializedSize() {
- int size = memoizedSize;
- if (size != -1) return size;
-
- size = 0;
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- size += org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedOutputStream
- .computeMessageSize(1, getTableName());
- }
- if (((bitField0_ & 0x00000002) == 0x00000002)) {
- size += org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedOutputStream
- .computeMessageSize(2, getLockOwner());
- }
- if (((bitField0_ & 0x00000004) == 0x00000004)) {
- size += org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedOutputStream
- .computeInt64Size(3, threadId_);
- }
- if (((bitField0_ & 0x00000008) == 0x00000008)) {
- size += org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedOutputStream
- .computeBoolSize(4, isShared_);
- }
- if (((bitField0_ & 0x00000010) == 0x00000010)) {
- size += org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.computeStringSize(5, purpose_);
- }
- if (((bitField0_ & 0x00000020) == 0x00000020)) {
- size += org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedOutputStream
- .computeInt64Size(6, createTime_);
- }
- size += unknownFields.getSerializedSize();
- memoizedSize = size;
- return size;
- }
-
- private static final long serialVersionUID = 0L;
- @java.lang.Override
- public boolean equals(final java.lang.Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock)) {
- return super.equals(obj);
- }
- org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock other = (org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock) obj;
-
- boolean result = true;
- result = result && (hasTableName() == other.hasTableName());
- if (hasTableName()) {
- result = result && getTableName()
- .equals(other.getTableName());
- }
- result = result && (hasLockOwner() == other.hasLockOwner());
- if (hasLockOwner()) {
- result = result && getLockOwner()
- .equals(other.getLockOwner());
- }
- result = result && (hasThreadId() == other.hasThreadId());
- if (hasThreadId()) {
- result = result && (getThreadId()
- == other.getThreadId());
- }
- result = result && (hasIsShared() == other.hasIsShared());
- if (hasIsShared()) {
- result = result && (getIsShared()
- == other.getIsShared());
- }
- result = result && (hasPurpose() == other.hasPurpose());
- if (hasPurpose()) {
- result = result && getPurpose()
- .equals(other.getPurpose());
- }
- result = result && (hasCreateTime() == other.hasCreateTime());
- if (hasCreateTime()) {
- result = result && (getCreateTime()
- == other.getCreateTime());
- }
- result = result && unknownFields.equals(other.unknownFields);
- return result;
- }
-
- @java.lang.Override
- public int hashCode() {
- if (memoizedHashCode != 0) {
- return memoizedHashCode;
- }
- int hash = 41;
- hash = (19 * hash) + getDescriptorForType().hashCode();
- if (hasTableName()) {
- hash = (37 * hash) + TABLE_NAME_FIELD_NUMBER;
- hash = (53 * hash) + getTableName().hashCode();
- }
- if (hasLockOwner()) {
- hash = (37 * hash) + LOCK_OWNER_FIELD_NUMBER;
- hash = (53 * hash) + getLockOwner().hashCode();
- }
- if (hasThreadId()) {
- hash = (37 * hash) + THREAD_ID_FIELD_NUMBER;
- hash = (53 * hash) + org.apache.hadoop.hbase.shaded.com.google.protobuf.Internal.hashLong(
- getThreadId());
- }
- if (hasIsShared()) {
- hash = (37 * hash) + IS_SHARED_FIELD_NUMBER;
- hash = (53 * hash) + org.apache.hadoop.hbase.shaded.com.google.protobuf.Internal.hashBoolean(
- getIsShared());
- }
- if (hasPurpose()) {
- hash = (37 * hash) + PURPOSE_FIELD_NUMBER;
- hash = (53 * hash) + getPurpose().hashCode();
- }
- if (hasCreateTime()) {
- hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER;
- hash = (53 * hash) + org.apache.hadoop.hbase.shaded.com.google.protobuf.Internal.hashLong(
- getCreateTime());
- }
- hash = (29 * hash) + unknownFields.hashCode();
- memoizedHashCode = hash;
- return hash;
- }
-
- public static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString data)
- throws org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data);
- }
- public static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString data,
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data, extensionRegistry);
- }
- public static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(byte[] data)
- throws org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data);
- }
- public static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- byte[] data,
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data, extensionRegistry);
- }
- public static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(java.io.InputStream input)
- throws java.io.IOException {
- return org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3
- .parseWithIOException(PARSER, input);
- }
- public static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- java.io.InputStream input,
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3
- .parseWithIOException(PARSER, input, extensionRegistry);
- }
- public static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock parseDelimitedFrom(java.io.InputStream input)
- throws java.io.IOException {
- return org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3
- .parseDelimitedWithIOException(PARSER, input);
- }
- public static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock parseDelimitedFrom(
- java.io.InputStream input,
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3
- .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
- }
- public static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream input)
- throws java.io.IOException {
- return org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3
- .parseWithIOException(PARSER, input);
- }
- public static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock parseFrom(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream input,
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3
- .parseWithIOException(PARSER, input, extensionRegistry);
- }
-
- public Builder newBuilderForType() { return newBuilder(); }
- public static Builder newBuilder() {
- return DEFAULT_INSTANCE.toBuilder();
- }
- public static Builder newBuilder(org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock prototype) {
- return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
- }
- public Builder toBuilder() {
- return this == DEFAULT_INSTANCE
- ? new Builder() : new Builder().mergeFrom(this);
- }
-
- @java.lang.Override
- protected Builder newBuilderForType(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
- Builder builder = new Builder(parent);
- return builder;
- }
- /**
- * <pre>
- **
- * Metadata associated with a table lock in zookeeper
- * </pre>
- *
- * Protobuf type {@code hbase.pb.TableLock}
- */
- public static final class Builder extends
- org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
- // @@protoc_insertion_point(builder_implements:hbase.pb.TableLock)
- org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLockOrBuilder {
- public static final org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.Descriptor
- getDescriptor() {
- return org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.internal_static_hbase_pb_TableLock_descriptor;
- }
-
- protected org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
- internalGetFieldAccessorTable() {
- return org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.internal_static_hbase_pb_TableLock_fieldAccessorTable
- .ensureFieldAccessorsInitialized(
- org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock.class, org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock.Builder.class);
- }
-
- // Construct using org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock.newBuilder()
- private Builder() {
- maybeForceBuilderInitialization();
- }
-
- private Builder(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
- super(parent);
- maybeForceBuilderInitialization();
- }
- private void maybeForceBuilderInitialization() {
- if (org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3
- .alwaysUseFieldBuilders) {
- getTableNameFieldBuilder();
- getLockOwnerFieldBuilder();
- }
- }
- public Builder clear() {
- super.clear();
- if (tableNameBuilder_ == null) {
- tableName_ = null;
- } else {
- tableNameBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000001);
- if (lockOwnerBuilder_ == null) {
- lockOwner_ = null;
- } else {
- lockOwnerBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000002);
- threadId_ = 0L;
- bitField0_ = (bitField0_ & ~0x00000004);
- isShared_ = false;
- bitField0_ = (bitField0_ & ~0x00000008);
- purpose_ = "";
- bitField0_ = (bitField0_ & ~0x00000010);
- createTime_ = 0L;
- bitField0_ = (bitField0_ & ~0x00000020);
- return this;
- }
-
- public org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.Descriptor
- getDescriptorForType() {
- return org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.internal_static_hbase_pb_TableLock_descriptor;
- }
-
- public org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock getDefaultInstanceForType() {
- return org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock.getDefaultInstance();
- }
-
- public org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock build() {
- org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock result = buildPartial();
- if (!result.isInitialized()) {
- throw newUninitializedMessageException(result);
- }
- return result;
- }
-
- public org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock buildPartial() {
- org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock result = new org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock(this);
- int from_bitField0_ = bitField0_;
- int to_bitField0_ = 0;
- if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
- to_bitField0_ |= 0x00000001;
- }
- if (tableNameBuilder_ == null) {
- result.tableName_ = tableName_;
- } else {
- result.tableName_ = tableNameBuilder_.build();
- }
- if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
- to_bitField0_ |= 0x00000002;
- }
- if (lockOwnerBuilder_ == null) {
- result.lockOwner_ = lockOwner_;
- } else {
- result.lockOwner_ = lockOwnerBuilder_.build();
- }
- if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
- to_bitField0_ |= 0x00000004;
- }
- result.threadId_ = threadId_;
- if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
- to_bitField0_ |= 0x00000008;
- }
- result.isShared_ = isShared_;
- if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
- to_bitField0_ |= 0x00000010;
- }
- result.purpose_ = purpose_;
- if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
- to_bitField0_ |= 0x00000020;
- }
- result.createTime_ = createTime_;
- result.bitField0_ = to_bitField0_;
- onBuilt();
- return result;
- }
-
- public Builder clone() {
- return (Builder) super.clone();
- }
- public Builder setField(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.FieldDescriptor field,
- Object value) {
- return (Builder) super.setField(field, value);
- }
- public Builder clearField(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.FieldDescriptor field) {
- return (Builder) super.clearField(field);
- }
- public Builder clearOneof(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.OneofDescriptor oneof) {
- return (Builder) super.clearOneof(oneof);
- }
- public Builder setRepeatedField(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.FieldDescriptor field,
- int index, Object value) {
- return (Builder) super.setRepeatedField(field, index, value);
- }
- public Builder addRepeatedField(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.FieldDescriptor field,
- Object value) {
- return (Builder) super.addRepeatedField(field, value);
- }
- public Builder mergeFrom(org.apache.hadoop.hbase.shaded.com.google.protobuf.Message other) {
- if (other instanceof org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock) {
- return mergeFrom((org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock)other);
- } else {
- super.mergeFrom(other);
- return this;
- }
- }
-
- public Builder mergeFrom(org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock other) {
- if (other == org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock.getDefaultInstance()) return this;
- if (other.hasTableName()) {
- mergeTableName(other.getTableName());
- }
- if (other.hasLockOwner()) {
- mergeLockOwner(other.getLockOwner());
- }
- if (other.hasThreadId()) {
- setThreadId(other.getThreadId());
- }
- if (other.hasIsShared()) {
- setIsShared(other.getIsShared());
- }
- if (other.hasPurpose()) {
- bitField0_ |= 0x00000010;
- purpose_ = other.purpose_;
- onChanged();
- }
- if (other.hasCreateTime()) {
- setCreateTime(other.getCreateTime());
- }
- this.mergeUnknownFields(other.unknownFields);
- onChanged();
- return this;
- }
-
- public final boolean isInitialized() {
- if (hasTableName()) {
- if (!getTableName().isInitialized()) {
- return false;
- }
- }
- if (hasLockOwner()) {
- if (!getLockOwner().isInitialized()) {
- return false;
- }
- }
- return true;
- }
-
- public Builder mergeFrom(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream input,
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock parsedMessage = null;
- try {
- parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
- } catch (org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException e) {
- parsedMessage = (org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock) e.getUnfinishedMessage();
- throw e.unwrapIOException();
- } finally {
- if (parsedMessage != null) {
- mergeFrom(parsedMessage);
- }
- }
- return this;
- }
- private int bitField0_;
-
- private org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName tableName_ = null;
- private org.apache.hadoop.hbase.shaded.com.google.protobuf.SingleFieldBuilderV3<
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.Builder, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableNameOrBuilder> tableNameBuilder_;
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public boolean hasTableName() {
- return ((bitField0_ & 0x00000001) == 0x00000001);
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName getTableName() {
- if (tableNameBuilder_ == null) {
- return tableName_ == null ? org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.getDefaultInstance() : tableName_;
- } else {
- return tableNameBuilder_.getMessage();
- }
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public Builder setTableName(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName value) {
- if (tableNameBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- tableName_ = value;
- onChanged();
- } else {
- tableNameBuilder_.setMessage(value);
- }
- bitField0_ |= 0x00000001;
- return this;
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public Builder setTableName(
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.Builder builderForValue) {
- if (tableNameBuilder_ == null) {
- tableName_ = builderForValue.build();
- onChanged();
- } else {
- tableNameBuilder_.setMessage(builderForValue.build());
- }
- bitField0_ |= 0x00000001;
- return this;
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public Builder mergeTableName(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName value) {
- if (tableNameBuilder_ == null) {
- if (((bitField0_ & 0x00000001) == 0x00000001) &&
- tableName_ != null &&
- tableName_ != org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.getDefaultInstance()) {
- tableName_ =
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.newBuilder(tableName_).mergeFrom(value).buildPartial();
- } else {
- tableName_ = value;
- }
- onChanged();
- } else {
- tableNameBuilder_.mergeFrom(value);
- }
- bitField0_ |= 0x00000001;
- return this;
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public Builder clearTableName() {
- if (tableNameBuilder_ == null) {
- tableName_ = null;
- onChanged();
- } else {
- tableNameBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000001);
- return this;
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.Builder getTableNameBuilder() {
- bitField0_ |= 0x00000001;
- onChanged();
- return getTableNameFieldBuilder().getBuilder();
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableNameOrBuilder getTableNameOrBuilder() {
- if (tableNameBuilder_ != null) {
- return tableNameBuilder_.getMessageOrBuilder();
- } else {
- return tableName_ == null ?
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.getDefaultInstance() : tableName_;
- }
- }
- /**
- * <code>optional .hbase.pb.TableName table_name = 1;</code>
- */
- private org.apache.hadoop.hbase.shaded.com.google.protobuf.SingleFieldBuilderV3<
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.Builder, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableNameOrBuilder>
- getTableNameFieldBuilder() {
- if (tableNameBuilder_ == null) {
- tableNameBuilder_ = new org.apache.hadoop.hbase.shaded.com.google.protobuf.SingleFieldBuilderV3<
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName.Builder, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableNameOrBuilder>(
- getTableName(),
- getParentForChildren(),
- isClean());
- tableName_ = null;
- }
- return tableNameBuilder_;
- }
-
- private org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName lockOwner_ = null;
- private org.apache.hadoop.hbase.shaded.com.google.protobuf.SingleFieldBuilderV3<
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.Builder, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerNameOrBuilder> lockOwnerBuilder_;
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public boolean hasLockOwner() {
- return ((bitField0_ & 0x00000002) == 0x00000002);
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName getLockOwner() {
- if (lockOwnerBuilder_ == null) {
- return lockOwner_ == null ? org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.getDefaultInstance() : lockOwner_;
- } else {
- return lockOwnerBuilder_.getMessage();
- }
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public Builder setLockOwner(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName value) {
- if (lockOwnerBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- lockOwner_ = value;
- onChanged();
- } else {
- lockOwnerBuilder_.setMessage(value);
- }
- bitField0_ |= 0x00000002;
- return this;
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public Builder setLockOwner(
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.Builder builderForValue) {
- if (lockOwnerBuilder_ == null) {
- lockOwner_ = builderForValue.build();
- onChanged();
- } else {
- lockOwnerBuilder_.setMessage(builderForValue.build());
- }
- bitField0_ |= 0x00000002;
- return this;
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public Builder mergeLockOwner(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName value) {
- if (lockOwnerBuilder_ == null) {
- if (((bitField0_ & 0x00000002) == 0x00000002) &&
- lockOwner_ != null &&
- lockOwner_ != org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.getDefaultInstance()) {
- lockOwner_ =
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.newBuilder(lockOwner_).mergeFrom(value).buildPartial();
- } else {
- lockOwner_ = value;
- }
- onChanged();
- } else {
- lockOwnerBuilder_.mergeFrom(value);
- }
- bitField0_ |= 0x00000002;
- return this;
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public Builder clearLockOwner() {
- if (lockOwnerBuilder_ == null) {
- lockOwner_ = null;
- onChanged();
- } else {
- lockOwnerBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000002);
- return this;
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.Builder getLockOwnerBuilder() {
- bitField0_ |= 0x00000002;
- onChanged();
- return getLockOwnerFieldBuilder().getBuilder();
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerNameOrBuilder getLockOwnerOrBuilder() {
- if (lockOwnerBuilder_ != null) {
- return lockOwnerBuilder_.getMessageOrBuilder();
- } else {
- return lockOwner_ == null ?
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.getDefaultInstance() : lockOwner_;
- }
- }
- /**
- * <code>optional .hbase.pb.ServerName lock_owner = 2;</code>
- */
- private org.apache.hadoop.hbase.shaded.com.google.protobuf.SingleFieldBuilderV3<
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.Builder, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerNameOrBuilder>
- getLockOwnerFieldBuilder() {
- if (lockOwnerBuilder_ == null) {
- lockOwnerBuilder_ = new org.apache.hadoop.hbase.shaded.com.google.protobuf.SingleFieldBuilderV3<
- org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName.Builder, org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerNameOrBuilder>(
- getLockOwner(),
- getParentForChildren(),
- isClean());
- lockOwner_ = null;
- }
- return lockOwnerBuilder_;
- }
-
- private long threadId_ ;
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public boolean hasThreadId() {
- return ((bitField0_ & 0x00000004) == 0x00000004);
- }
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public long getThreadId() {
- return threadId_;
- }
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public Builder setThreadId(long value) {
- bitField0_ |= 0x00000004;
- threadId_ = value;
- onChanged();
- return this;
- }
- /**
- * <code>optional int64 thread_id = 3;</code>
- */
- public Builder clearThreadId() {
- bitField0_ = (bitField0_ & ~0x00000004);
- threadId_ = 0L;
- onChanged();
- return this;
- }
-
- private boolean isShared_ ;
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public boolean hasIsShared() {
- return ((bitField0_ & 0x00000008) == 0x00000008);
- }
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public boolean getIsShared() {
- return isShared_;
- }
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public Builder setIsShared(boolean value) {
- bitField0_ |= 0x00000008;
- isShared_ = value;
- onChanged();
- return this;
- }
- /**
- * <code>optional bool is_shared = 4;</code>
- */
- public Builder clearIsShared() {
- bitField0_ = (bitField0_ & ~0x00000008);
- isShared_ = false;
- onChanged();
- return this;
- }
-
- private java.lang.Object purpose_ = "";
- /**
- * <code>optional string purpose = 5;</code>
- */
- public boolean hasPurpose() {
- return ((bitField0_ & 0x00000010) == 0x00000010);
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public java.lang.String getPurpose() {
- java.lang.Object ref = purpose_;
- if (!(ref instanceof java.lang.String)) {
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString bs =
- (org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString) ref;
- java.lang.String s = bs.toStringUtf8();
- if (bs.isValidUtf8()) {
- purpose_ = s;
- }
- return s;
- } else {
- return (java.lang.String) ref;
- }
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString
- getPurposeBytes() {
- java.lang.Object ref = purpose_;
- if (ref instanceof String) {
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString b =
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- purpose_ = b;
- return b;
- } else {
- return (org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString) ref;
- }
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public Builder setPurpose(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000010;
- purpose_ = value;
- onChanged();
- return this;
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public Builder clearPurpose() {
- bitField0_ = (bitField0_ & ~0x00000010);
- purpose_ = getDefaultInstance().getPurpose();
- onChanged();
- return this;
- }
- /**
- * <code>optional string purpose = 5;</code>
- */
- public Builder setPurposeBytes(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000010;
- purpose_ = value;
- onChanged();
- return this;
- }
-
- private long createTime_ ;
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public boolean hasCreateTime() {
- return ((bitField0_ & 0x00000020) == 0x00000020);
- }
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public long getCreateTime() {
- return createTime_;
- }
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public Builder setCreateTime(long value) {
- bitField0_ |= 0x00000020;
- createTime_ = value;
- onChanged();
- return this;
- }
- /**
- * <code>optional int64 create_time = 6;</code>
- */
- public Builder clearCreateTime() {
- bitField0_ = (bitField0_ & ~0x00000020);
- createTime_ = 0L;
- onChanged();
- return this;
- }
- public final Builder setUnknownFields(
- final org.apache.hadoop.hbase.shaded.com.google.protobuf.UnknownFieldSet unknownFields) {
- return super.setUnknownFields(unknownFields);
- }
-
- public final Builder mergeUnknownFields(
- final org.apache.hadoop.hbase.shaded.com.google.protobuf.UnknownFieldSet unknownFields) {
- return super.mergeUnknownFields(unknownFields);
- }
-
-
- // @@protoc_insertion_point(builder_scope:hbase.pb.TableLock)
- }
-
- // @@protoc_insertion_point(class_scope:hbase.pb.TableLock)
- private static final org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock DEFAULT_INSTANCE;
- static {
- DEFAULT_INSTANCE = new org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock();
- }
-
- public static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock getDefaultInstance() {
- return DEFAULT_INSTANCE;
- }
-
- @java.lang.Deprecated public static final org.apache.hadoop.hbase.shaded.com.google.protobuf.Parser<TableLock>
- PARSER = new org.apache.hadoop.hbase.shaded.com.google.protobuf.AbstractParser<TableLock>() {
- public TableLock parsePartialFrom(
- org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedInputStream input,
- org.apache.hadoop.hbase.shaded.com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException {
- return new TableLock(input, extensionRegistry);
- }
- };
-
- public static org.apache.hadoop.hbase.shaded.com.google.protobuf.Parser<TableLock> parser() {
- return PARSER;
- }
-
- @java.lang.Override
- public org.apache.hadoop.hbase.shaded.com.google.protobuf.Parser<TableLock> getParserForType() {
- return PARSER;
- }
-
- public org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.TableLock getDefaultInstanceForType() {
- return DEFAULT_INSTANCE;
- }
-
- }
-
public interface SwitchStateOrBuilder extends
// @@protoc_insertion_point(interface_extends:hbase.pb.SwitchState)
org.apache.hadoop.hbase.shaded.com.google.protobuf.MessageOrBuilder {
@@ -5861,11 +4623,6 @@ public final class ZooKeeperProtos {
org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_hbase_pb_DeprecatedTableState_fieldAccessorTable;
private static final org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.Descriptor
- internal_static_hbase_pb_TableLock_descriptor;
- private static final
- org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
- internal_static_hbase_pb_TableLock_fieldAccessorTable;
- private static final org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.Descriptor
internal_static_hbase_pb_SwitchState_descriptor;
private static final
org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
@@ -5897,14 +4654,10 @@ public final class ZooKeeperProtos {
"Y\020\002\"\225\001\n\024DeprecatedTableState\022<\n\005state\030\001 " +
"\002(\0162$.hbase.pb.DeprecatedTableState.Stat" +
"e:\007ENABLED\"?\n\005State\022\013\n\007ENABLED\020\000\022\014\n\010DISA" +
- "BLED\020\001\022\r\n\tDISABLING\020\002\022\014\n\010ENABLING\020\003\"\252\001\n\t" +
- "TableLock\022\'\n\ntable_name\030\001 \001(\0132\023.hbase.pb",
- ".TableName\022(\n\nlock_owner\030\002 \001(\0132\024.hbase.p" +
- "b.ServerName\022\021\n\tthread_id\030\003 \001(\003\022\021\n\tis_sh" +
- "ared\030\004 \001(\010\022\017\n\007purpose\030\005 \001(\t\022\023\n\013create_ti" +
- "me\030\006 \001(\003\"\036\n\013SwitchState\022\017\n\007enabled\030\001 \001(\010" +
- "BL\n1org.apache.hadoop.hbase.shaded.proto" +
- "buf.generatedB\017ZooKeeperProtosH\001\210\001\001\240\001\001"
+ "BLED\020\001\022\r\n\tDISABLING\020\002\022\014\n\010ENABLING\020\003\"\036\n\013S" +
+ "witchState\022\017\n\007enabled\030\001 \001(\010BL\n1org.apach",
+ "e.hadoop.hbase.shaded.protobuf.generated" +
+ "B\017ZooKeeperProtosH\001\210\001\001\240\001\001"
};
org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -5950,14 +4703,8 @@ public final class ZooKeeperProtos {
org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_hbase_pb_DeprecatedTableState_descriptor,
new java.lang.String[] { "State", });
- internal_static_hbase_pb_TableLock_descriptor =
- getDescriptor().getMessageTypes().get(5);
- internal_static_hbase_pb_TableLock_fieldAccessorTable = new
- org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
- internal_static_hbase_pb_TableLock_descriptor,
- new java.lang.String[] { "TableName", "LockOwner", "ThreadId", "IsShared", "Purpose", "CreateTime", });
internal_static_hbase_pb_SwitchState_descriptor =
- getDescriptor().getMessageTypes().get(6);
+ getDescriptor().getMessageTypes().get(5);
internal_static_hbase_pb_SwitchState_fieldAccessorTable = new
org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_hbase_pb_SwitchState_descriptor,
http://git-wip-us.apache.org/repos/asf/hbase/blob/4fdd6ff9/hbase-protocol-shaded/src/main/protobuf/ZooKeeper.proto
----------------------------------------------------------------------
diff --git a/hbase-protocol-shaded/src/main/protobuf/ZooKeeper.proto b/hbase-protocol-shaded/src/main/protobuf/ZooKeeper.proto
index b3bd2ec..fcf9bf5 100644
--- a/hbase-protocol-shaded/src/main/protobuf/ZooKeeper.proto
+++ b/hbase-protocol-shaded/src/main/protobuf/ZooKeeper.proto
@@ -106,18 +106,6 @@ message DeprecatedTableState {
}
/**
- * Metadata associated with a table lock in zookeeper
- */
-message TableLock {
- optional TableName table_name = 1;
- optional ServerName lock_owner = 2;
- optional int64 thread_id = 3;
- optional bool is_shared = 4;
- optional string purpose = 5;
- optional int64 create_time = 6;
-}
-
-/**
* State of the switch.
*/
message SwitchState {