├── .gitignore ├── .mvn-compat └── src │ ├── main │ └── java │ │ └── org │ │ └── hbase │ │ └── async │ └── test │ └── java │ └── org │ └── hbase │ └── async ├── .travis.yml ├── AUTHORS ├── COPYING ├── HACKING ├── INSTALL ├── Makefile ├── NEWS ├── README.md ├── THANKS ├── asynchbase.conf ├── build-aux └── fetchdep.sh ├── logback.xml ├── pom.xml.in ├── protobuf ├── Cell.proto ├── Client.proto ├── ClusterId.proto ├── ClusterStatus.proto ├── Comparator.proto ├── ErrorHandling.proto ├── FS.proto ├── Filter.proto ├── HBase.proto ├── LICENSE.txt ├── MapReduce.proto ├── MultiRowMutation.proto ├── README.txt ├── RPC.proto ├── Tracing.proto └── ZooKeeper.proto ├── screwdriver.yaml ├── src ├── AppendRequest.java ├── AtomicIncrementRequest.java ├── BatchGet.java ├── BatchableRpc.java ├── BinaryComparator.java ├── BinaryPrefixComparator.java ├── BitComparator.java ├── BrokenMetaException.java ├── BufferedIncrement.java ├── BufferedMultiColumnIncrement.java ├── Bytes.java ├── CallQueueTooBigException.java ├── ClientStats.java ├── ColumnPaginationFilter.java ├── ColumnPrefixFilter.java ├── ColumnRangeFilter.java ├── CompareAndSetRequest.java ├── CompareFilter.java ├── Config.java ├── ConnectionResetException.java ├── Counter.java ├── DeleteRequest.java ├── DependentColumnFilter.java ├── FamilyFilter.java ├── FilterComparator.java ├── FilterList.java ├── FirstKeyOnlyFilter.java ├── FuzzyRowFilter.java ├── GetRequest.java ├── GetResultOrException.java ├── HBaseClient.java ├── HBaseException.java ├── HBaseRpc.java ├── HasFailedRpcException.java ├── InvalidResponseException.java ├── KeyOnlyFilter.java ├── KeyRegexpFilter.java ├── KeyValue.java ├── MultiAction.java ├── MultiColumnAtomicIncrementRequest.java ├── MultipleColumnPrefixFilter.java ├── NoSuchColumnFamilyException.java ├── NonRecoverableException.java ├── NotServingRegionException.java ├── PleaseThrottleException.java ├── PutRequest.java ├── QualifierFilter.java ├── RecoverableException.java ├── RegexStringComparator.java ├── RegionClient.java ├── RegionClientStats.java ├── RegionInfo.java ├── RegionLocation.java ├── RegionMovedException.java ├── RegionOfflineException.java ├── RegionOpeningException.java ├── RegionServerAbortedException.java ├── RegionServerStoppedException.java ├── RegionTooBusyException.java ├── RemoteException.java ├── RowFilter.java ├── RowLock.java ├── RowLockRequest.java ├── RpcTimedOutException.java ├── ScanFilter.java ├── Scanner.java ├── SecureRpcHelper.java ├── SecureRpcHelper94.java ├── SecureRpcHelper96.java ├── ServerNotRunningYetException.java ├── SingletonList.java ├── SubstringComparator.java ├── TableNotFoundException.java ├── TimestampsFilter.java ├── UnknownProtocolException.java ├── UnknownRowLockException.java ├── UnknownScannerException.java ├── ValueFilter.java ├── VersionMismatchException.java ├── auth │ ├── ClientAuthProvider.java │ ├── KerberosClientAuthProvider.java │ ├── Login.java │ └── SimpleClientAuthProvider.java ├── jsr166e │ ├── LongAdder.java │ ├── README │ ├── Striped64.java │ └── package-info.java └── protobuf │ └── ZeroCopyLiteralByteString.java ├── test ├── BaseTestHBaseClient.java ├── BaseTestRegionClient.java ├── BaseTestSecureRpcHelper.java ├── Common.java ├── PBufResponses.java ├── Test.java ├── TestConfig.java ├── TestDeleteRequest.java ├── TestGetRequest.java ├── TestHBaseClient.java ├── TestHBaseClientLocateRegion.java ├── TestHBaseRpc.java ├── TestIncrementCoalescing.java ├── TestIntegration.java ├── TestMETALookup.java ├── TestMultiAction.java ├── TestMultiColumnIncrementCoalescing.java ├── TestNSREs.java ├── TestPutRequest.java ├── TestRegionClient.java ├── TestRegionClientDecode.java ├── TestRegionClientSendRpc.java ├── TestScanner.java ├── TestSecureRpcHelper.java ├── TestSecureRpcHelper94.java ├── TestSecureRpcHelper96.java ├── TestZKClient.java └── auth │ ├── MockProvider.java │ ├── TestKerberosClientAuthProvider.java │ ├── TestLogin.java │ └── TestSimpleClientAuthProvider.java └── third_party ├── .gitignore ├── guava ├── guava-13.0.1.jar.md5 ├── guava-18.0.jar.md5 └── include.mk ├── hamcrest ├── hamcrest-core-1.3.jar.md5 └── include.mk ├── include.mk ├── javassist ├── include.mk ├── javassist-3.15.0-GA.jar.md5 ├── javassist-3.17.1-GA.jar.md5 └── javassist-3.18.1-GA.jar.md5 ├── junit ├── include.mk ├── junit-4.10.jar.md5 └── junit-4.11.jar.md5 ├── logback ├── include.mk ├── logback-classic-1.0.13.jar.md5 ├── logback-classic-1.2.9.jar.md5 ├── logback-core-1.0.13.jar.md5 └── logback-core-1.2.9.jar.md5 ├── mockito ├── include.mk ├── mockito-1.9.0.jar.md5 └── mockito-core-1.9.5.jar.md5 ├── netty ├── include.mk ├── netty-3.8.0.Final.jar.md5 └── netty-3.9.4.Final.jar.md5 ├── objenesis ├── include.mk ├── objenesis-1.3.jar.md5 └── objenesis-2.1.jar.md5 ├── powermock ├── include.mk ├── powermock-mockito-1.5.jar.md5 └── powermock-mockito-release-full-1.5.4-full.jar.md5 ├── protobuf ├── include.mk └── protobuf-java-2.5.0.jar.md5 ├── slf4j ├── include.mk ├── log4j-over-slf4j-1.7.5.jar.md5 ├── log4j-over-slf4j-1.7.7.jar.md5 ├── slf4j-api-1.7.5.jar.md5 └── slf4j-api-1.7.7.jar.md5 ├── suasync ├── async-1.4.0.jar.md5 ├── include.mk └── suasync-1.3.2.jar.md5 └── zookeeper ├── include.mk ├── zookeeper-3.3.6.jar.md5 └── zookeeper-3.4.5.jar.md5 /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | pom.xml 3 | target/ 4 | /bin/ 5 | .idea 6 | -------------------------------------------------------------------------------- /.mvn-compat/src/main/java/org/hbase/async: -------------------------------------------------------------------------------- 1 | ../../../../../../src -------------------------------------------------------------------------------- /.mvn-compat/src/test/java/org/hbase/async: -------------------------------------------------------------------------------- 1 | ../../../../../../test -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | before_install: 3 | - cat /etc/hosts # optionally check the content *before* 4 | - sudo hostname "$(hostname | cut -c1-63)" 5 | - sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts 6 | - cat /etc/hosts # optionally check the content *after* 7 | - wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz -O /tmp/protobuf-2.5.0.tar.gz 8 | - tar -C /tmp -xvf /tmp/protobuf-2.5.0.tar.gz 9 | - cd /tmp/protobuf-2.5.0 && ./configure --prefix=/usr && make --quiet && sudo make install 10 | before_script: 11 | - cd ~/build/*/asynchbase 12 | - make pom.xml 13 | script: export MAVEN_OPTS="-Xmx1024m" && mvn test --quiet 14 | jdk: 15 | - openjdk7 16 | - oraclejdk8 17 | notifications: 18 | email: false 19 | addons: 20 | hostname: short-hostname 21 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | The AsyncHBase Authors 2 | ---------------------- 3 | 4 | AsyncHBase ("asynchbase") was originally written by Benoit Sigoure. 5 | 6 | All contributors are required to sign a "Contributor License Agreement" at 7 | http://opentsdb.net/contributing.html 8 | 9 | The following organizations and people have contributed at least 0.5% of the 10 | current code of AsyncHBase. 11 | (Please keep both lists sorted alphabetically.) 12 | 13 | 14 | Arista Networks, Inc. 15 | StumbleUpon, Inc. 16 | 17 | 18 | Andrey Stepachev 19 | Benoit Sigoure 20 | Brandon Forehand 21 | Chris Larsen 22 | Viral Bajaria 23 | 24 | 25 | 26 | This list can be obtained at any time with the following script: 27 | 28 | find src test -type f \ 29 | | while read i; do \ 30 | git blame -t $i 2>/dev/null; \ 31 | done \ 32 | | sed 's/^[0-9a-f]\{8\} [^(]*(\([^)]*\) [-+0-9 ]\{14,\}).*/\1/;s/ *$//' \ 33 | | awk '{a[$0]++; t++} END{for(n in a) if (a[n]*100.0/t > 0.5) print n}' \ 34 | | sort 35 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | - Redistributions of source code must retain the above copyright notice, 6 | this list of conditions and the following disclaimer. 7 | - Redistributions in binary form must reproduce the above copyright notice, 8 | this list of conditions and the following disclaimer in the documentation 9 | and/or other materials provided with the distribution. 10 | - Neither the name of the StumbleUpon nor the names of its contributors 11 | may be used to endorse or promote products derived from this software 12 | without specific prior written permission. 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 17 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 23 | POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /HACKING: -------------------------------------------------------------------------------- 1 | Want to contribute? Great! This file will guide you through some of 2 | design decision / ideology you should try to adhere to. 3 | 4 | Getting started: 5 | 6 | # You need this & javac on $PATH. The first run will download dependencies. 7 | $ make 8 | 9 | # Run the unit tests 10 | $ make check 11 | 12 | # Run the integration tests. See also "Testing" below. 13 | $ HBASE_HOME=~/src/hbase make integration ARGS='test f' 14 | 15 | The basics: 16 | - Know the complexity of your algorithms. When you're calling a 17 | method in another library, make sure you're aware of the its 18 | complexity. Is it O(n2) or O(n log n)? How much memory will it 19 | allocate? For instance, Collections.sort() works in O(n log n) 20 | as expected but it does 3 array copies! So it's O(3n) = O(n) in 21 | space instead of O(1). 22 | - Avoid allocating objects whenever you can. If you can, re-use the 23 | same objects in a loop in order to avoid generating too much garbage 24 | for the GC to collect. Objects that are expected to be used very 25 | frequently should be create once and stored in an attribute. 26 | 27 | The build system: 28 | - No Ant / Ivy / Maven madness. Using XML to specify a build system 29 | is a dumb idea and those tools are way too slow and don't even do 30 | proper dependency tracking out of the box. They don't come with a 31 | set of standard rules that make packaging easy. 32 | - Don't add new dependencies unless you have a compelling reason to do 33 | so. The code of any dependency will be audited before we can allow 34 | this new dependency. 35 | 36 | Code: 37 | - The #1 rule is to write readable code. How much time will it take 38 | for someone else to understand that method? If something is not 39 | obvious, it should be commented. 40 | - Stick to the coding style in the files you're editing. 41 | - Avoid lines longer than 80 characters. There are a few cases where 42 | Java is so verbose that trying to wrap things around to avoid long 43 | lines makes the code unnecessarily hard to read. 44 | - Everything should be properly Javadoc'ed. Everything. Including 45 | private stuff (except maybe 1-line private helper functions). 46 | Document the RuntimeExceptions one should expect to handle. 47 | All javadoc comments are to be written in proper English. 48 | - The javadoc (internal and user-facing) must document the 49 | synchronization requirements. What is thread-safe? Which monitor 50 | needs to be acquired before accessing this attribute? 51 | - No checked exceptions. People should RTFM and handle whatever 52 | exceptions they want to handle. There's a disagreement in the 53 | community about the usefulness and effectiveness of checked 54 | exceptions. I haven't been convinced about the pros so I chose 55 | to not use them. 56 | - Use fine-grained exception types. Everything must derive from 57 | HBaseException. Exceptions should contain all the data required to 58 | help the user code recover from them. HBase's own code is a very 59 | good example of how to not (ab)use IOException. 60 | - Local variables are named_like_this, I think it's more readable 61 | compared to somethingLikeThis. I think there's a reason why latin 62 | languages put a space between words. 63 | 64 | Testing: 65 | - Write unit tests whenever possible, especially regression tests. 66 | - Integration tests need to exercise the functionality against a real 67 | HBase instance. You can run them with this command: 68 | $ HBASE_HOME=~/src/hbase make integration ARGS='test f' 69 | This will run the tests against a set of tables that all have names 70 | starting with `test' and families starting with `f'. The tables will 71 | be created / dropped when needed. 72 | - Tip: After you've run the integration tests once, you can speed up 73 | subsequent runs by passing TEST_NO_TRUNCATE=1 before HBASE_HOME on 74 | the command above. This will skip truncating the table in between 75 | tests, which makes them run much faster. 76 | - Tip: You can also specify only one integration test to run, by adding 77 | the following before HBASE_HOME on the command above: TEST_NAME=XXX. 78 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ************************* 3 | 4 | Copyright (C) 2010-2012 The Async HBase Authors. 5 | 6 | This file is free documentation; StumbleUpon, Inc gives 7 | unlimited permission to copy, distribute and modify it. 8 | 9 | Basic Installation 10 | ================== 11 | 12 | Just type `make', and everything should work as long as you have Java 13 | and GNU make installed in your PATH. On some BSD systems, you may have 14 | to type `gmake' instead. 15 | 16 | Maven Users 17 | ================== 18 | If you would use Maven, ensure protoc is on your path (2.5.0) and then 19 | type 'make pom.xml' to generate a pom.xml file. Thereafter run 20 | 'mvn install' to generate the asynchbase jar file. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Asynchronous HBase 2 | 3 | This is an alternative Java library to use HBase in applications that require 4 | a fully asynchronous, non-blocking, thread-safe, high-performance HBase API. 5 | 6 | This HBase client differs significantly from HBase's client (HTable). 7 | Switching to it is not easy as it requires to rewrite all the code that was 8 | interacting with any HBase API. This pays off in applications that are 9 | asynchronous by nature or that want to use several threads to interact 10 | efficiently with HBase. 11 | 12 | Documentation can be found under http://opentsdb.github.io/asynchbase/ 13 | 14 | Please read the Javadoc starting from the HBaseClient class. This class 15 | replaces all your HTable instances. Unlike HTable, you should have only 16 | one instance of HBaseClient in your application, regardless of the number 17 | of tables or threads you want to use. The Javadoc also spells out rules 18 | you have to follow in order to use the API properly in a multi-threaded 19 | application. 20 | 21 | The [GitHub repo branches](https://github.com/OpenTSDB/asynchbase) are laid 22 | out as follows: 23 | 24 | * [`maintenance`](https://github.com/OpenTSDB/opentsdb/tree/maintenance): This 25 | was the last stable version of AsyncHBase and should only have bug fix PRs 26 | created against it. Bugs should also be patched in master and next. 27 | 28 | * [`master`](https://github.com/OpenTSDB/opentsdb/tree/master): This is the 29 | current stable version of AsyncHBase and should only have bug fix PRs created 30 | against it. Bug should also be patched in the next branch. 31 | 32 | * [`next`](https://github.com/OpenTSDB/opentsdb/tree/next): This is the 33 | development version of AsyncHBase and all new features or API changes should 34 | be written against this. 35 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | AsyncHBase THANKS File 2 | ---------------------- 3 | 4 | The following persons contributed to the library by reporting problems, 5 | suggesting improvements, submitting patches or proofreading the code. 6 | 7 | Abhay Bothra 8 | Andrey Stepachev 9 | Arthur van Hoff 10 | Berk D. Demir 11 | Bizhu Qiu 12 | Brandon Forehand 13 | Charles Antoine 14 | cm-cnnxty 15 | Francis Christopher Liu 16 | Gabe Benjamin 17 | Garry Helmling 18 | Guo Sijie 19 | Ishan Chhabra 20 | Ivan Zhivkov 21 | Jake Maloney 22 | James Baldassari 23 | Jason Culverhouse 24 | Jesse Chang 25 | Jiayun Fang 26 | Jonathan Payne 27 | Junegunn Choi 28 | Jungtaek Lim 29 | Karan Mehta 30 | Martin Boyanov 31 | Michael Rose 32 | Michael Stack 33 | Mikhail Antonov 34 | Misha Brukman 35 | Nicolas Thiébaud 36 | Phil Smith 37 | Philip K. Warren 38 | Quanlong Huang 39 | Rajesh G 40 | Shrijeet Paliwal 41 | Siddartha Guthikonda 42 | Stephane Bagneris 43 | Svyatoslav Markeyev 44 | Tian-Ying Chang 45 | Viral Bajaria 46 | Xun Liu 47 | Yao Shengzhe 48 | 49 | This list can be obtained at any time with the following one-liner: 50 | git log --pretty=format:'%an' | sort -u 51 | -------------------------------------------------------------------------------- /asynchbase.conf: -------------------------------------------------------------------------------- 1 | # This is an example AsyncHBase client configuration file. 2 | # To use it, instantiate a config object with the path and then 3 | # instantiate an HBaseClient with the config. 4 | # final org.hbase.async.Config config = 5 | # new org.hbase.async.Config("path"); 6 | # final org.hbase.async.HBaseClient client = 7 | # new org.hbase.async.HBaseClient(config); 8 | # 9 | # You can also copy and paste these properties in another config 10 | # file that is shared with your application. 11 | # All parameters have defaults except for the 12 | # hbase.zookeeper.quorum parameter that must have a list of 13 | # zookeeper hosts to connect to. 14 | 15 | # A comma separated list of zookeeper servers. Ports are optional. 16 | # E.g. zk1.mysite.com:2181,zk2.mysite.com:2181,zk3.mysite.com:2181 17 | hbase.zookeeper.quorum=localhost 18 | 19 | # The root node for HBase in Zookeeper 20 | #hbase.zookeeper.znode.parent=/hbase 21 | 22 | # How often the timer should wake up to check for tasks to run 23 | # such as kerberos ticket renewals or flushing buffered increments. 24 | # The value is in milliseconds 25 | #hbase.timer.tick=20 26 | 27 | # How often to retry an individual RPC against HBase. After this 28 | # many tries the RPC will return an exception. 29 | #hbase.rpcs.max_retry_attempts=10 30 | 31 | # How often, in milliseconds, to flush buffered RPCs (such as puts 32 | # or appends) to the region servers. 33 | #hbase.rpcs.buffered_flush_interval=1000 34 | 35 | # The maximum number of RPCs to queue per region when said region 36 | # is marked as offline due to a split or migration. Writes to any 37 | # region with a full NSRE queue will return a PleaseThrottleException. 38 | #hbase.nsre.high_watermark=10000 39 | 40 | # How many individual atomic increment counters should be buffered 41 | # in memory. When this limit is reached, new counters are flushed 42 | # immediately and may result in higher RPC counts. 43 | #hbase.increments.buffer_size=65535 44 | 45 | # -------------- SECURITY ------------------ 46 | # A flag to determine if security should be used or not. 47 | #hbase.security.auth.enable=false 48 | 49 | # A flag that must be set when using HBase version 0.94 for security 50 | # to function properly. 51 | #hbase.security.auth.94=false 52 | 53 | # The mechanism to use for authentication. AsyncHBase supports 54 | # keberose or simple. When using keberos, you should create a 55 | # keytab file for your user and you must set the JAAS config file 56 | # by passing -Djava.security.login.auth.config= to your JVM. 57 | #hbase.security.authentication=kerberos 58 | 59 | # Whether or not RPCs should be encrypted in flight. Possible values 60 | # include: 61 | # authentication - no encryption 62 | # integrity - encrypted 63 | # privacy - encrypted 64 | #hbase.rpc.protection=authentication 65 | 66 | # When using simple authentication, supply the username here. 67 | #hbase.security.simple.username= 68 | 69 | # The principal to use when authenticating with Kerberos against 70 | # a region server. You can specify an explicit host name or use 71 | # the _HOST token that will be replaced by the hostname. 72 | #hbase.kerberos.regionserver.principal=hbase/_HOST@EXAMPLE.COM 73 | 74 | # NOTE: Use keytabs instead! 75 | # A password to use for keberos authentication 76 | #hbase.regionserver.kerberos.password= 77 | 78 | # The context name to use in the jaas.conf file you supplied to 79 | # java.security.login.auth.config when starting the JVM 80 | #hbase.sasl.clientconfig=Client -------------------------------------------------------------------------------- /build-aux/fetchdep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2011-2012 The Async HBase Authors. All rights reserved. 3 | # This file is part of Async HBase. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # - Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # - Redistributions in binary form must reproduce the above copyright notice, 10 | # this list of conditions and the following disclaimer in the documentation 11 | # and/or other materials provided with the distribution. 12 | # - Neither the name of the StumbleUpon nor the names of its contributors 13 | # may be used to endorse or promote products derived from this software 14 | # without specific prior written permission. 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | # POSSIBILITY OF SUCH DAMAGE. 26 | 27 | set -e 28 | MKDIR_P="mkdir -p" 29 | for i in md5sum md5 "$MD5"; do 30 | sum=`echo a | $i 2>/dev/null` || continue 31 | case $sum in 32 | (*60b725f10c9c85c70d97880dfe8191b3*) MD5=$i; break;; 33 | (*) :;; # continue 34 | esac 35 | done 36 | test -n "$MD5" || { 37 | echo >&2 "couldn't find a working md5sum command" 38 | exit 1 39 | } 40 | if wget --version >/dev/null 2>&1; then 41 | WGET=wget 42 | elif curl --version >/dev/null 2>&1; then 43 | CURL=curl 44 | else 45 | echo >&2 "couldn't find either curl or wget" 46 | exit 1 47 | fi 48 | srcdir=`dirname "$0"` 49 | # The ".." is because we need to go out of the build-aux directory. 50 | srcdir=`cd "$srcdir"; cd ..; pwd -P` 51 | 52 | f=`basename "$2"` 53 | d=`dirname "$2"` 54 | 55 | validate_checksum() { 56 | cksum=`$MD5 "$1" | sed 's/.*\([0-9a-fA-F]\{32\}\).*/\1/'` 57 | valid=`< "$srcdir/${1%-t}.md5"` 58 | test "x$cksum" = "x$valid" 59 | } 60 | 61 | # Don't re-download if we happen to have the right file already. 62 | test -f "$2" && validate_checksum "$2" && touch "$2" && rm -f "$2-t" && exit 63 | 64 | rm -f "$2" 65 | $MKDIR_P "$d" 66 | 67 | if test -n "$WGET"; then 68 | $WGET "$1/$f" -O "$2-t" 69 | elif test -n "$CURL"; then 70 | $CURL "$1/$f" -o "$2-t" 71 | else 72 | echo >&2 "cannot find a tool to download $1/$f" 73 | exit 1 74 | fi 75 | 76 | if validate_checksum "$2-t"; then 77 | mv "$2-t" "$2" 78 | # wget sets the timestamp to whatever is the Last-Modified header, so 79 | # make sure we have a recent mtime on the file to keep `make' happy. 80 | touch "$2" 81 | else 82 | echo >&2 "error: invalid checksum for $2" 83 | echo >&2 "error: expected: $valid" 84 | echo >&2 "error: found: $cksum" 85 | rm -f "$2-t" 86 | exit 1 87 | fi 88 | -------------------------------------------------------------------------------- /logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %d{ISO8601} %-5level [%thread] %logger{0}: %msg%n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /protobuf/Cell.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | // Cell and KeyValue protos 20 | 21 | option java_package = "org.hbase.async.generated"; 22 | option java_outer_classname = "CellPB"; 23 | option java_generate_equals_and_hash = false; 24 | option optimize_for = LITE_RUNTIME; 25 | 26 | /** 27 | * The type of the key in a Cell 28 | */ 29 | enum CellType { 30 | MINIMUM = 0; 31 | PUT = 4; 32 | 33 | DELETE = 8; 34 | DELETE_COLUMN = 12; 35 | DELETE_FAMILY = 14; 36 | 37 | // MAXIMUM is used when searching; you look from maximum on down. 38 | MAXIMUM = 255; 39 | } 40 | 41 | /** 42 | * Protocol buffer version of Cell. 43 | */ 44 | message Cell { 45 | optional bytes row = 1; 46 | optional bytes family = 2; 47 | optional bytes qualifier = 3; 48 | optional uint64 timestamp = 4; 49 | optional CellType cell_type = 5; 50 | optional bytes value = 6; 51 | optional bytes tags = 7; 52 | } 53 | 54 | /** 55 | * Protocol buffer version of KeyValue. 56 | * It doesn't have those transient parameters 57 | */ 58 | message KeyValue { 59 | required bytes row = 1; 60 | required bytes family = 2; 61 | required bytes qualifier = 3; 62 | optional uint64 timestamp = 4; 63 | optional CellType key_type = 5; 64 | optional bytes value = 6; 65 | optional bytes tags = 7; 66 | } 67 | -------------------------------------------------------------------------------- /protobuf/ClusterId.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | // This file contains protocol buffers that are shared throughout HBase 20 | 21 | option java_package = "org.hbase.async.generated"; 22 | option java_outer_classname = "ClusterIdPB"; 23 | option java_generate_equals_and_hash = false; 24 | option optimize_for = LITE_RUNTIME; 25 | 26 | /** 27 | * Content of the '/hbase/hbaseid', cluster id, znode. 28 | * Also cluster of the ${HBASE_ROOTDIR}/hbase.id file. 29 | */ 30 | message ClusterId { 31 | // This is the cluster id, a uuid as a String 32 | required string cluster_id = 1; 33 | } 34 | -------------------------------------------------------------------------------- /protobuf/Comparator.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | // This file contains protocol buffers that are used for filters 20 | 21 | option java_package = "org.hbase.async.generated"; 22 | option java_outer_classname = "ComparatorPB"; 23 | option java_generic_services = false; 24 | option java_generate_equals_and_hash = false; 25 | option optimize_for = LITE_RUNTIME; 26 | 27 | // This file contains protocol buffers that are used for comparators (e.g. in filters) 28 | 29 | message Comparator { 30 | required string name = 1; 31 | optional bytes serialized_comparator = 2; 32 | } 33 | 34 | message ByteArrayComparable { 35 | optional bytes value = 1; 36 | } 37 | 38 | message BinaryComparator { 39 | required ByteArrayComparable comparable = 1; 40 | } 41 | 42 | message LongComparator { 43 | required ByteArrayComparable comparable = 1; 44 | } 45 | 46 | message BinaryPrefixComparator { 47 | required ByteArrayComparable comparable = 1; 48 | } 49 | 50 | message BitComparator { 51 | required ByteArrayComparable comparable = 1; 52 | required BitwiseOp bitwise_op = 2; 53 | 54 | enum BitwiseOp { 55 | AND = 1; 56 | OR = 2; 57 | XOR = 3; 58 | } 59 | } 60 | 61 | message NullComparator { 62 | } 63 | 64 | message RegexStringComparator { 65 | required string pattern = 1; 66 | required int32 pattern_flags = 2; 67 | required string charset = 3; 68 | optional string engine = 4; 69 | } 70 | 71 | message SubstringComparator { 72 | required string substr = 1; 73 | } 74 | -------------------------------------------------------------------------------- /protobuf/ErrorHandling.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | // This file contains protocol buffers that are used for error handling 20 | 21 | option java_package = "org.hbase.async.generated"; 22 | option java_outer_classname = "ErrorHandlingPB"; 23 | option java_generate_equals_and_hash = false; 24 | option optimize_for = LITE_RUNTIME; 25 | 26 | /** 27 | * Protobuf version of a java.lang.StackTraceElement 28 | * so we can serialize exceptions. 29 | */ 30 | message StackTraceElementMessage { 31 | optional string declaring_class = 1; 32 | optional string method_name = 2; 33 | optional string file_name = 3; 34 | optional int32 line_number = 4; 35 | } 36 | 37 | /** 38 | * Cause of a remote failure for a generic exception. Contains 39 | * all the information for a generic exception as well as 40 | * optional info about the error for generic info passing 41 | * (which should be another protobuffed class). 42 | */ 43 | message GenericExceptionMessage { 44 | optional string class_name = 1; 45 | optional string message = 2; 46 | optional bytes error_info = 3; 47 | repeated StackTraceElementMessage trace = 4; 48 | } 49 | 50 | /** 51 | * Exception sent across the wire when a remote task needs 52 | * to notify other tasks that it failed and why 53 | */ 54 | message ForeignExceptionMessage { 55 | optional string source = 1; 56 | optional GenericExceptionMessage generic_exception = 2; 57 | } 58 | -------------------------------------------------------------------------------- /protobuf/FS.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | // This file contains protocol buffers that are written into the filesystem 20 | 21 | option java_package = "org.hbase.async.generated"; 22 | option java_outer_classname = "FSPB"; 23 | option java_generate_equals_and_hash = false; 24 | option optimize_for = LITE_RUNTIME; 25 | 26 | /** 27 | * The ${HBASE_ROOTDIR}/hbase.version file content 28 | */ 29 | message HBaseVersionFileContent { 30 | required string version = 1; 31 | } 32 | 33 | /** 34 | * Reference file content used when we split an hfile under a region. 35 | */ 36 | message Reference { 37 | required bytes splitkey = 1; 38 | enum Range { 39 | TOP = 0; 40 | BOTTOM = 1; 41 | } 42 | required Range range = 2; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /protobuf/MapReduce.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | //This file includes protocol buffers used in MapReduce only. 20 | 21 | option java_package = "org.hbase.async.generated"; 22 | option java_outer_classname = "MapReducePB"; 23 | option java_generate_equals_and_hash = false; 24 | option optimize_for = LITE_RUNTIME; 25 | 26 | import "HBase.proto"; 27 | 28 | message ScanMetrics { 29 | repeated NameInt64Pair metrics = 1; 30 | } 31 | 32 | message TableSnapshotRegionSplit { 33 | repeated string locations = 2; 34 | optional TableSchema table = 3; 35 | optional RegionInfo region = 4; 36 | } 37 | -------------------------------------------------------------------------------- /protobuf/MultiRowMutation.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import "Client.proto"; 19 | option java_package = "org.hbase.async.generated"; 20 | option java_outer_classname = "MultiRowMutationPB"; 21 | option java_generate_equals_and_hash = false; 22 | option java_generic_services = false; 23 | option optimize_for = LITE_RUNTIME; 24 | 25 | message MultiRowMutationProcessorRequest{ 26 | } 27 | 28 | message MultiRowMutationProcessorResponse{ 29 | } 30 | 31 | message MutateRowsRequest { 32 | repeated MutationProto mutation_request = 1; 33 | optional uint64 nonce_group = 2; 34 | optional uint64 nonce = 3; 35 | } 36 | 37 | message MutateRowsResponse { 38 | } 39 | 40 | service MultiRowMutationService { 41 | rpc MutateRows(MutateRowsRequest) 42 | returns(MutateRowsResponse); 43 | } 44 | -------------------------------------------------------------------------------- /protobuf/README.txt: -------------------------------------------------------------------------------- 1 | These are the protobuf definition files used by AsyncHBase. 2 | They were copied from HBase (see under hbase-protocol/src/main/protobuf). 3 | 4 | The following changes were made to those files: 5 | - the package name was changed to "org.hbase.async.protobuf.generated" 6 | - the `java_outer_classname' were normalized so that things would be 7 | consistently named (file Foo.proto generates FooPB.java). 8 | - code is optimize_for LITE_RUNTIME instead of SPEED to reduce code bloat. 9 | - java_generate_equals_and_hash and java_generic_services were switched 10 | to false. The former isn't useful and the latter is incompatible with 11 | the LITE_RUNTIME. 12 | 13 | The files in this directory are subject to the license in LICENSE.txt. 14 | -------------------------------------------------------------------------------- /protobuf/Tracing.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | option java_package = "org.hbase.async.generated"; 19 | option java_outer_classname = "TracingPB"; 20 | option java_generate_equals_and_hash = false; 21 | option optimize_for = LITE_RUNTIME; 22 | 23 | //Used to pass through the information necessary to continue 24 | //a trace after an RPC is made. All we need is the traceid 25 | //(so we know the overarching trace this message is a part of), and 26 | //the id of the current span when this message was sent, so we know 27 | //what span caused the new span we will create when this message is received. 28 | message RPCTInfo { 29 | optional int64 trace_id = 1; 30 | optional int64 parent_id = 2; 31 | } 32 | -------------------------------------------------------------------------------- /screwdriver.yaml: -------------------------------------------------------------------------------- 1 | shared: 2 | image: maven:3-adoptopenjdk-8 3 | 4 | jobs: 5 | pr: 6 | steps: 7 | - run_arbitrary_script: apt-get update && apt-get install autoconf make wget g++ -y && wget https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz && tar xfvz protobuf-2.5.0.tar.gz && cd protobuf-2.5.0 && ./configure && make && make install && ldconfig && cd .. && make pom.xml && mvn clean test --quiet 8 | main: 9 | requires: [~pr, ~commit] 10 | steps: 11 | - run_arbitrary_script: apt-get update && apt-get install autoconf make wget g++ -y && wget https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz && tar xfvz protobuf-2.5.0.tar.gz && cd protobuf-2.5.0 && ./configure && make && make install && ldconfig && cd .. && make pom.xml && mvn clean test --quiet 12 | -------------------------------------------------------------------------------- /src/BinaryComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import com.google.protobuf.ByteString; 30 | import org.jboss.netty.buffer.ChannelBuffer; 31 | 32 | import org.hbase.async.generated.ComparatorPB; 33 | 34 | /** 35 | * A binary comparator used in comparison filters. Compares byte arrays 36 | * lexicographically. 37 | * @since 1.6 38 | */ 39 | public final class BinaryComparator extends FilterComparator { 40 | 41 | private static final byte[] NAME = 42 | Bytes.UTF8("org.apache.hadoop.hbase.filter.BinaryComparator"); 43 | private static final byte CODE = 47; 44 | 45 | private final byte[] value; 46 | 47 | public BinaryComparator(byte[] value) { 48 | this.value = value; 49 | } 50 | 51 | public byte[] value() { 52 | return value.clone(); 53 | } 54 | 55 | @Override 56 | byte[] name() { 57 | return NAME; 58 | } 59 | 60 | @Override 61 | ComparatorPB.Comparator toProtobuf() { 62 | ByteString byte_string = ComparatorPB 63 | .BinaryComparator 64 | .newBuilder() 65 | .setComparable( 66 | ComparatorPB 67 | .ByteArrayComparable 68 | .newBuilder() 69 | .setValue(Bytes.wrap(value))) 70 | .build() 71 | .toByteString(); 72 | return super.toProtobuf(byte_string); 73 | } 74 | 75 | @Override 76 | void serializeOld(ChannelBuffer buf) { 77 | super.serializeOld(buf); // super.predictSerializedSize() 78 | // Write class code 79 | buf.writeByte(CODE); // 1 80 | // Write value 81 | HBaseRpc.writeByteArray(buf, value); // 3 + value.length 82 | } 83 | 84 | @Override 85 | int predictSerializedSize() { 86 | return 1 + 3 + value.length; 87 | } 88 | 89 | @Override 90 | public String toString() { 91 | return String.format("%s(%s)", 92 | getClass().getSimpleName(), 93 | Bytes.pretty(value)); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/BinaryPrefixComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import com.google.protobuf.ByteString; 30 | import org.jboss.netty.buffer.ChannelBuffer; 31 | 32 | import org.hbase.async.generated.ComparatorPB; 33 | 34 | /** 35 | * A binary comparator used in comparison filters. Compares byte arrays 36 | * lexicographically up to the length of the provided byte array. 37 | * @since 1.6 38 | */ 39 | public final class BinaryPrefixComparator extends FilterComparator { 40 | 41 | private static final byte[] NAME = 42 | Bytes.UTF8("org.apache.hadoop.hbase.filter.BinaryPrefixComparator"); 43 | private static final byte CODE = 47; 44 | 45 | private final byte[] value; 46 | 47 | public BinaryPrefixComparator(byte[] value) { 48 | this.value = value; 49 | } 50 | 51 | public byte[] value() { 52 | return value.clone(); 53 | } 54 | 55 | @Override 56 | byte[] name() { 57 | return NAME; 58 | } 59 | 60 | @Override 61 | ComparatorPB.Comparator toProtobuf() { 62 | ByteString byte_string = ComparatorPB 63 | .BinaryPrefixComparator 64 | .newBuilder() 65 | .setComparable( 66 | ComparatorPB 67 | .ByteArrayComparable 68 | .newBuilder() 69 | .setValue(Bytes.wrap(value))) 70 | .build() 71 | .toByteString(); 72 | return super.toProtobuf(byte_string); 73 | } 74 | 75 | @Override 76 | void serializeOld(ChannelBuffer buf) { 77 | super.serializeOld(buf); // super.predictSerializedSize() 78 | // Write class code 79 | buf.writeByte(CODE); // 1 80 | // Write value 81 | HBaseRpc.writeByteArray(buf, value); // 3 + value.length 82 | } 83 | 84 | @Override 85 | int predictSerializedSize() { 86 | return super.predictSerializedSize() + 1 + 3 + value.length; 87 | } 88 | 89 | @Override 90 | public String toString() { 91 | return String.format("%s(%s)", 92 | getClass().getSimpleName(), 93 | Bytes.pretty(value)); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/BrokenMetaException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Indicates that the {@code .META.} or {@code -ROOT-} table is corrupted. 31 | */ 32 | public final class BrokenMetaException extends NonRecoverableException { 33 | 34 | private final byte[] table; 35 | 36 | /** 37 | * Constructor. 38 | * @param region The region we were looking up 39 | * (if known, can be {@code null} if not known). 40 | * @param msg A message describing as precisely as possible what's wrong 41 | * with the META table. 42 | */ 43 | BrokenMetaException(final RegionInfo region, final String msg) { 44 | super("Your .META. table seems broken for " 45 | + (region == null ? "(unknown table)" : region) 46 | + ". " + msg); 47 | this.table = region.table(); 48 | } 49 | 50 | /** 51 | * Constructor. 52 | * @param msg A message describing as precisely as possible what's wrong 53 | * with the META table. 54 | * @param cause The exception that occurred while we were trying to 55 | * de-serialize an entry of the META table (e.g. a protobuf exception). 56 | */ 57 | BrokenMetaException(final String msg, final Exception cause) { 58 | super("Your .META. table seems broken. " + msg, cause); 59 | this.table = null; 60 | } 61 | 62 | /** 63 | * Constructor. 64 | * @param msg A message describing as precisely as possible what's wrong 65 | * with the META table. 66 | */ 67 | BrokenMetaException(final String msg) { 68 | super("Your .META. table seems broken. " + msg, null); 69 | this.table = null; 70 | } 71 | 72 | /** 73 | * Returns the name of the table for which we were trying to lookup a region. 74 | * @return A possibly {@code null} byte array. 75 | */ 76 | public byte[] table() { 77 | return table; 78 | } 79 | 80 | /** 81 | * Helper to complain about a particular {@link KeyValue} found. 82 | * @param region The region we were looking up 83 | * (if known, can be {@code null} if not known). 84 | * @param msg A message describing as precisely as possible what's wrong 85 | * with the META table. 86 | * @param kv The {@link KeyValue} in which the problem was found. 87 | */ 88 | static BrokenMetaException badKV(final RegionInfo region, 89 | final String msg, 90 | final KeyValue kv) { 91 | return new BrokenMetaException(region, "I found a row where " + msg 92 | + ". KeyValue=" + kv); 93 | } 94 | 95 | private static final long serialVersionUID = 1280222742; 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/CallQueueTooBigException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Exception thrown when the RPC queue on the region server is full and cannot 31 | * accept new RPCs. In that case we should retry with a backoff and give 32 | * HBase time to recover. 33 | */ 34 | public final class CallQueueTooBigException extends RecoverableException 35 | implements HasFailedRpcException { 36 | 37 | static final String REMOTE_CLASS = 38 | "org.apache.hadoop.hbase.CallQueueTooBigException"; 39 | 40 | final HBaseRpc failed_rpc; 41 | 42 | /** 43 | * Constructor. 44 | * @param msg The message of the exception, potentially with a stack trace. 45 | * @param failed_rpc The RPC that caused this exception, if known, or null. 46 | */ 47 | CallQueueTooBigException(final String msg, final HBaseRpc failed_rpc) { 48 | super(msg + "\nCaused by RPC: " + failed_rpc); 49 | this.failed_rpc = failed_rpc; 50 | } 51 | 52 | public HBaseRpc getFailedRpc() { 53 | return failed_rpc; 54 | } 55 | 56 | @Override 57 | CallQueueTooBigException make(final Object msg, final HBaseRpc rpc) { 58 | if (msg == this || msg instanceof CallQueueTooBigException) { 59 | final CallQueueTooBigException e = (CallQueueTooBigException) msg; 60 | return new CallQueueTooBigException(e.getMessage(), rpc); 61 | } 62 | return new CallQueueTooBigException(msg.toString(), rpc); 63 | } 64 | 65 | private static final long serialVersionUID = -8367228239893289543L; 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/ColumnPrefixFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import org.jboss.netty.buffer.ChannelBuffer; 30 | 31 | import org.hbase.async.generated.FilterPB; 32 | 33 | /** 34 | * Sets a binary prefix to filter results based on the column qualifier. 35 | *

36 | * Efficiently compares the column qualifier bytes up to the length of the 37 | * prefix to see if it matches. 38 | *

39 | * Only setting this filter will return all rows that match the criteria 40 | * but at the same will cost a full table scan. 41 | * @since 1.5 42 | */ 43 | public final class ColumnPrefixFilter extends ScanFilter { 44 | 45 | private static final byte[] NAME = Bytes.ISO88591("org.apache.hadoop" 46 | + ".hbase.filter.ColumnPrefixFilter"); 47 | 48 | private final byte[] prefix; 49 | 50 | /** 51 | * Constructor for a UTF-8 prefix string. 52 | */ 53 | public ColumnPrefixFilter(final String prefix) { 54 | this(Bytes.UTF8(prefix)); 55 | } 56 | 57 | /** 58 | * Constructor. 59 | * @throws IllegalArgumentException if the prefix is an empty byte array. 60 | */ 61 | public ColumnPrefixFilter(final byte[] prefix) { 62 | if (prefix.length == 0) { 63 | throw new IllegalArgumentException("Empty prefix"); 64 | } 65 | this.prefix = prefix; 66 | } 67 | 68 | @Override 69 | byte[] serialize() { 70 | return FilterPB.ColumnPrefixFilter.newBuilder() 71 | .setPrefix(Bytes.wrap(prefix)) 72 | .build() 73 | .toByteArray(); 74 | } 75 | 76 | @Override 77 | byte[] name() { 78 | return NAME; 79 | } 80 | 81 | @Override 82 | int predictSerializedSize() { 83 | return 1 + NAME.length + 3 + prefix.length; 84 | } 85 | 86 | @Override 87 | void serializeOld(final ChannelBuffer buf) { 88 | buf.writeByte((byte) NAME.length); // 1 89 | buf.writeBytes(NAME); // 49 90 | HBaseRpc.writeByteArray(buf, prefix); // 3 + prefix.length 91 | } 92 | 93 | public String toString() { 94 | return "ColumnPrefixFilter(" + Bytes.pretty(prefix) + ")"; 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/ConnectionResetException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2018 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import org.jboss.netty.channel.Channel; 30 | 31 | /** 32 | * Exception thrown when an RPC was in flight while we got disconnected. 33 | */ 34 | public final class ConnectionResetException extends RecoverableException { 35 | 36 | private final Channel chan; 37 | 38 | /** 39 | * Constructor. 40 | * @param table The table that wasn't found. 41 | */ 42 | ConnectionResetException(final Channel chan) { 43 | super(chan + " got disconnected"); 44 | this.chan = chan; 45 | } 46 | 47 | /** 48 | * Returns the name of the region that's offline. 49 | */ 50 | public Channel getChannel() { 51 | return chan; 52 | } 53 | 54 | @Override 55 | ConnectionResetException make(final Object msg, final HBaseRpc rpc) { 56 | return new ConnectionResetException(chan); 57 | } 58 | 59 | private static final long serialVersionUID = 1280644142; 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/Counter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import org.hbase.async.jsr166e.LongAdder; 30 | 31 | /** 32 | * An atomic counter to replace {@link java.util.concurrent.atomic.AtomicLong}. 33 | *

34 | * This is based on JSR 166e's sharded counter, which is slated for JDK8. 35 | * This class is part of the public interface of asynchbase, and code 36 | * depending on asynchbase is encouraged to use it for their concurrent 37 | * counter needs. 38 | * @since 1.3 39 | */ 40 | public final class Counter extends LongAdder { 41 | 42 | /** 43 | * Returns the current value of the counter. 44 | */ 45 | public final long get() { 46 | return super.sum(); 47 | } 48 | 49 | private static final long serialVersionUID = 1333661542; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/FamilyFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import org.hbase.async.generated.FilterPB; 30 | 31 | /** 32 | * Filter columns based on the column family. Takes an operator (equal, greater, 33 | * not equal, etc). and a filter comparator. 34 | * @since 1.6 35 | */ 36 | public final class FamilyFilter extends CompareFilter { 37 | 38 | private static final byte[] NAME = 39 | Bytes.UTF8("org.apache.hadoop.hbase.filter.FamilyFilter"); 40 | 41 | public FamilyFilter(final CompareOp family_compare_op, 42 | final FilterComparator family_comparator) { 43 | super(family_compare_op, family_comparator); 44 | } 45 | 46 | @Override 47 | byte[] name() { 48 | return NAME; 49 | } 50 | 51 | @Override 52 | byte[] serialize() { 53 | return FilterPB 54 | .FamilyFilter 55 | .newBuilder() 56 | .setCompareFilter(toProtobuf()) 57 | .build() 58 | .toByteArray(); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/FilterComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import com.google.protobuf.ByteString; 30 | import org.jboss.netty.buffer.ChannelBuffer; 31 | 32 | import org.hbase.async.generated.ComparatorPB; 33 | 34 | /** 35 | * Abstract base class for {@link ScanFilter} comparators. 36 | *

37 | * These comparators are used by scan filters. 38 | *

39 | * Subclasses are guaranteed to be immutable and are thus 40 | * thread-safe as well as usable concurrently on multiple 41 | * {@link Scanner} instances. 42 | * @since 1.6 43 | */ 44 | public abstract class FilterComparator { 45 | 46 | // This class is the equivalent of HBase's WritableByteArrayComparable. 47 | // We don't need this class to be Writable or Comparable, so 48 | // FilterComparator is a more appropriate name. 49 | 50 | final static byte CODE = 54; 51 | 52 | /** 53 | * Returns the name of this scanner on the wire. 54 | *

55 | * This method is only used with HBase 0.95 and newer. 56 | * The contents of the array returned MUST NOT be modified. 57 | */ 58 | abstract byte[] name(); 59 | 60 | /** 61 | * Serializes the byte representation to a protobuf in a byte array. 62 | *

63 | * This method is only used with HBase 0.95 and newer. 64 | */ 65 | abstract ComparatorPB.Comparator toProtobuf(); 66 | 67 | /** 68 | * Wraps the passed in serialized FilterComparator in a protobuf Comparator. 69 | * 70 | * @param comparator serialized FilterComparator. 71 | * @return a serialized protobuf Comparator 72 | */ 73 | protected final ComparatorPB.Comparator toProtobuf(ByteString comparator) { 74 | return ComparatorPB 75 | .Comparator 76 | .newBuilder() 77 | .setNameBytes(Bytes.wrap(name())) 78 | .setSerializedComparator(comparator) 79 | .build(); 80 | } 81 | 82 | /** 83 | * Serializes the byte representation to the RPC channel buffer. 84 | *

85 | * This method is only used with HBase 0.94 and before. 86 | * @param buf The RPC channel buffer to which the byte array is serialized 87 | */ 88 | void serializeOld(ChannelBuffer buf) { 89 | buf.writeByte(CODE); // 1 90 | } 91 | 92 | /** 93 | * Returns the number of bytes that it will write to the RPC channel buffer 94 | * when {@code serialize} is called. This method helps predict the initial 95 | * size of the byte array 96 | *

97 | * This method is only used with HBase 0.94 and before. 98 | * @return A strictly positive integer 99 | */ 100 | int predictSerializedSize() { 101 | return 1; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/FirstKeyOnlyFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import org.jboss.netty.buffer.ChannelBuffer; 30 | 31 | import org.hbase.async.generated.FilterPB; 32 | import org.hbase.async.generated.HBasePB; 33 | 34 | /** 35 | * A filter that will only return the first KV from each row. 36 | * This filter can be used to more efficiently perform row count operations. 37 | */ 38 | public class FirstKeyOnlyFilter extends ScanFilter { 39 | 40 | private static final byte[] NAME = 41 | Bytes.UTF8("org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter"); 42 | 43 | public FirstKeyOnlyFilter() { } 44 | 45 | 46 | @Override 47 | byte[] name() { 48 | return NAME; 49 | } 50 | 51 | @Override 52 | byte[] serialize() { 53 | return FilterPB 54 | .FirstKeyOnlyFilter 55 | .newBuilder() 56 | .build() 57 | .toByteArray(); 58 | } 59 | 60 | @Override 61 | void serializeOld(ChannelBuffer buf) { 62 | // Write the filter name 63 | buf.writeByte((byte) name().length); // 1 64 | buf.writeBytes(name()); // name().length 65 | } 66 | 67 | @Override 68 | int predictSerializedSize() { 69 | return 1 + name().length; 70 | } 71 | 72 | @Override 73 | public String toString() { 74 | return getClass().getSimpleName(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/GetResultOrException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import java.util.ArrayList; 30 | 31 | public class GetResultOrException { 32 | final private ArrayList cells; 33 | final private Exception exception; 34 | 35 | public GetResultOrException(final ArrayList cells) { 36 | this.cells = cells; 37 | this.exception = null; 38 | } 39 | 40 | public GetResultOrException(final Exception exp) { 41 | this.exception = exp; 42 | this.cells = null; 43 | } 44 | 45 | public ArrayList getCells() { 46 | return this.cells; 47 | } 48 | 49 | public Exception getException() { 50 | return this.exception; 51 | } 52 | 53 | public String toString() { 54 | StringBuilder sb = new StringBuilder(); 55 | sb.append("{"); 56 | sb.append("cells : ").append(this.cells == null ? "null" : this.cells); 57 | sb.append("; exception: ").append(this.exception == null ? "null" : this.exception); 58 | sb.append("}"); 59 | return sb.toString(); 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/HBaseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * The parent class of all {@link RuntimeException} created by this package. 31 | */ 32 | public abstract class HBaseException extends RuntimeException { 33 | 34 | /** 35 | * Constructor. 36 | * @param msg The message of the exception, potentially including a stack 37 | * trace. 38 | */ 39 | HBaseException(final String msg) { 40 | super(msg); 41 | } 42 | 43 | /** 44 | * Constructor. 45 | * @param msg The message of the exception, potentially including a stack 46 | * trace. 47 | * @param cause The exception that caused this one to be thrown. 48 | */ 49 | HBaseException(final String msg, final Throwable cause) { 50 | super(msg, cause); 51 | } 52 | 53 | /** 54 | * Factory method to make it possible to create an exception from another 55 | * one without having to resort to reflection, which is annoying to use. 56 | * Sub-classes that want to provide this internal functionality should 57 | * implement this method. 58 | * @param msg Some arbitrary parameter to help build the new instance. 59 | * @param rpc The RPC that failed, if any. Can be {@code null}. 60 | */ 61 | abstract HBaseException make(final Object msg, final HBaseRpc rpc); 62 | 63 | private static final long serialVersionUID = 1280638842; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/HasFailedRpcException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Interface implemented by {@link HBaseException}s that can tell you which 31 | * RPC failed. 32 | */ 33 | public interface HasFailedRpcException { 34 | 35 | /** 36 | * Returns the RPC that caused this exception. 37 | */ 38 | HBaseRpc getFailedRpc(); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/InvalidResponseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Exception used when the server sends an invalid response to an RPC. 31 | */ 32 | public final class InvalidResponseException extends NonRecoverableException { 33 | 34 | private final Object response; 35 | 36 | /** 37 | * Constructor. 38 | * @param msg The message of the exception, potentially including a stack 39 | * trace. 40 | * @param response The response that was received from the server. 41 | */ 42 | InvalidResponseException(final String msg, final Object response) { 43 | super(msg); 44 | this.response = response; 45 | } 46 | 47 | /** 48 | * Constructor. 49 | * @param msg The message of the exception. 50 | * @param cause The exception explaining why the response is invalid. 51 | */ 52 | InvalidResponseException(final String msg, final Exception cause) { 53 | super(msg, cause); 54 | this.response = null; 55 | } 56 | 57 | /** 58 | * Constructor for unexpected response types. 59 | * @param expected The type of the response that was expected. 60 | * @param response The response that was received from the server. 61 | */ 62 | InvalidResponseException(final Class expected, final Object response) { 63 | super("Unexpected response type. Expected: " + expected.getName() 64 | + ", got: " + (response == null ? "null" 65 | : response.getClass() + ", value=" + response)); 66 | this.response = response; 67 | } 68 | 69 | /** 70 | * Returns the possibly {@code null} response received from the server. 71 | */ 72 | public Object getResponse() { 73 | return response; 74 | } 75 | 76 | private static final long serialVersionUID = 1280883942; 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/KeyOnlyFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import java.lang.UnsupportedOperationException; 30 | 31 | import org.jboss.netty.buffer.ChannelBuffer; 32 | import org.hbase.async.generated.FilterPB; 33 | 34 | /** 35 | * A filter that will only return the key component of each KV (the value will 36 | * be rewritten as empty). 37 | *

38 | * This filter can be used to grab all of the keys without having to also grab 39 | * the values. 40 | */ 41 | public final class KeyOnlyFilter extends ScanFilter { 42 | private static final byte[] NAME = Bytes.UTF8("org.apache.hadoop" 43 | + ".hbase.filter.KeyOnlyFilter"); 44 | 45 | private boolean lenAsVal; 46 | 47 | public KeyOnlyFilter() { 48 | this(false); 49 | } 50 | 51 | public KeyOnlyFilter(boolean lenAsVal) { 52 | this.lenAsVal = lenAsVal; 53 | } 54 | 55 | @Override 56 | byte[] serialize() { 57 | final FilterPB.KeyOnlyFilter.Builder builder = 58 | FilterPB.KeyOnlyFilter.newBuilder(); 59 | builder.setLenAsVal(this.lenAsVal); 60 | return builder.build().toByteArray(); 61 | } 62 | 63 | @Override 64 | byte[] name() { 65 | return NAME; 66 | } 67 | 68 | @Override 69 | int predictSerializedSize() { 70 | int size = 1 + NAME.length 71 | + 1; //lenAsVal 72 | return size; 73 | } 74 | 75 | @Override 76 | void serializeOld(final ChannelBuffer buf) { 77 | buf.writeByte((byte) NAME.length); // 1 78 | buf.writeBytes(NAME); // 44 79 | buf.writeByte(lenAsVal ? 1 : 0); // 1 80 | } 81 | 82 | @Override 83 | public String toString() { 84 | return this.getClass().getSimpleName() + " " 85 | + "lenAsVal: " + (lenAsVal ? "true" : "false"); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/NoSuchColumnFamilyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Exception thrown when attempting to use a nonexistent column family. 31 | */ 32 | public final class NoSuchColumnFamilyException extends NonRecoverableException 33 | implements HasFailedRpcException { 34 | 35 | static final String REMOTE_CLASS = 36 | "org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException"; 37 | 38 | final HBaseRpc failed_rpc; 39 | 40 | /** 41 | * Constructor. 42 | * @param msg The message of the exception, potentially with a stack trace. 43 | * @param failed_rpc The RPC that caused this exception, if known, or null. 44 | */ 45 | NoSuchColumnFamilyException(final String msg, final HBaseRpc failed_rpc) { 46 | super(msg + "\nCaused by RPC: " + failed_rpc); 47 | this.failed_rpc = failed_rpc; 48 | } 49 | 50 | public HBaseRpc getFailedRpc() { 51 | return failed_rpc; 52 | } 53 | 54 | @Override 55 | NoSuchColumnFamilyException make(final Object msg, final HBaseRpc rpc) { 56 | if (msg == this || msg instanceof NoSuchColumnFamilyException) { 57 | final NoSuchColumnFamilyException e = (NoSuchColumnFamilyException) msg; 58 | return new NoSuchColumnFamilyException(e.getMessage(), rpc); 59 | } 60 | return new NoSuchColumnFamilyException(msg.toString(), rpc); 61 | } 62 | 63 | private static final long serialVersionUID = 1280993542; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/NonRecoverableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2018 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * An exception for which it's typically pointless to retry 31 | * (such as {@link TableNotFoundException}). 32 | */ 33 | public class NonRecoverableException extends HBaseException { 34 | 35 | /** 36 | * Constructor. 37 | * @param msg The message of the exception, potentially including a stack 38 | * trace. 39 | */ 40 | NonRecoverableException(final String msg) { 41 | super(msg); 42 | } 43 | 44 | /** 45 | * Constructor. 46 | * @param msg The message of the exception, potentially including a stack 47 | * trace. 48 | * @param cause The exception that caused this one to be thrown. 49 | */ 50 | NonRecoverableException(final String msg, final Throwable cause) { 51 | super(msg, cause); 52 | } 53 | 54 | @Override 55 | NonRecoverableException make(final Object msg, final HBaseRpc rpc) { 56 | // Don't need to keep the RPC here. 57 | if (msg == this || msg instanceof NonRecoverableException) { 58 | final NonRecoverableException e = (NonRecoverableException) msg; 59 | if (e.getCause() != null) { 60 | return new NonRecoverableException(e.getMessage(), e.getCause()); 61 | } else { 62 | return new NonRecoverableException(e.getMessage()); 63 | } 64 | } 65 | return new NonRecoverableException(msg.toString()); 66 | } 67 | 68 | private static final long serialVersionUID = 1280638547; 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/NotServingRegionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Exception thrown when we attempted to use a region that wasn't serving from 31 | * that particular RegionServer. It probably moved somewhere else. 32 | */ 33 | public class NotServingRegionException extends RecoverableException 34 | implements HasFailedRpcException { 35 | 36 | static final String REMOTE_CLASS = 37 | "org.apache.hadoop.hbase.NotServingRegionException"; 38 | 39 | final HBaseRpc failed_rpc; 40 | 41 | /** 42 | * Constructor. 43 | * @param msg The message of the exception, potentially with a stack trace. 44 | * @param failed_rpc The RPC that caused this exception, if known, or null. 45 | */ 46 | NotServingRegionException(final String msg, final HBaseRpc failed_rpc) { 47 | super(msg); 48 | this.failed_rpc = failed_rpc; 49 | } 50 | 51 | @Override 52 | public String getMessage() { 53 | // In many cases this exception never makes it to the outside world, thus 54 | // its toString / getMessage methods are never called. When it's called, 55 | // it's typically called only once. So it makes sense to lazily generate 56 | // the message instead of always concatenating the toString representation 57 | // of the RPC, which is easily large because it tends to contain long byte 58 | // arrays. 59 | return super.getMessage() + "\nCaused by RPC: " + failed_rpc; 60 | } 61 | 62 | public HBaseRpc getFailedRpc() { 63 | return failed_rpc; 64 | } 65 | 66 | @Override 67 | NotServingRegionException make(final Object msg, final HBaseRpc rpc) { 68 | if (msg == this || msg instanceof NotServingRegionException) { 69 | final NotServingRegionException e = (NotServingRegionException) msg; 70 | return new NotServingRegionException(e.getMessage(), rpc); 71 | } 72 | return new NotServingRegionException(msg.toString(), rpc); 73 | } 74 | 75 | private static final long serialVersionUID = 1281000942; 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/QualifierFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import org.hbase.async.generated.FilterPB; 30 | 31 | /** 32 | * Filter columns based on the qualifier. Takes an operator (equal, greater, 33 | * not equal, etc). and a filter comparator. 34 | * @since 1.6 35 | */ 36 | public final class QualifierFilter extends CompareFilter { 37 | 38 | private static final byte[] NAME = 39 | Bytes.UTF8("org.apache.hadoop.hbase.filter.QualifierFilter"); 40 | 41 | public QualifierFilter(final CompareOp op, 42 | final FilterComparator qualifierComparator) { 43 | super(op, qualifierComparator); 44 | } 45 | 46 | @Override 47 | byte[] name() { 48 | return NAME; 49 | } 50 | 51 | @Override 52 | byte[] serialize() { 53 | return FilterPB 54 | .QualifierFilter 55 | .newBuilder() 56 | .setCompareFilter(toProtobuf()) 57 | .build() 58 | .toByteArray(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/RecoverableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * An exception for which it's typically useful to retry 31 | * (such as {@link RegionOfflineException}). 32 | *

33 | * The retry strategy is up to you, but it's typically recommended to put an 34 | * upper bound on the number of retries and to use some kind of an exponential 35 | * backoff. 36 | */ 37 | public abstract class RecoverableException extends HBaseException { 38 | 39 | /** 40 | * Constructor. 41 | * @param msg The message of the exception, potentially including a stack 42 | * trace. 43 | */ 44 | RecoverableException(final String msg) { 45 | super(msg); 46 | } 47 | 48 | /** 49 | * Constructor. 50 | * @param msg The message of the exception, potentially including a stack 51 | * trace. 52 | * @param cause The exception that caused this one to be thrown. 53 | */ 54 | RecoverableException(final String msg, final Exception cause) { 55 | super(msg, cause); 56 | } 57 | 58 | private static final long serialVersionUID = 1280641142; 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/RegionMovedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Exception thrown when we attempted to use a region that was moved from 31 | * that particular RegionServer to a new one. 32 | * @since 1.6 33 | */ 34 | public final class RegionMovedException extends NotServingRegionException 35 | implements HasFailedRpcException { 36 | 37 | static final String REMOTE_CLASS = 38 | "org.apache.hadoop.hbase.exceptions.RegionMovedException"; 39 | 40 | final HBaseRpc failed_rpc; 41 | 42 | /** 43 | * Constructor. 44 | * @param msg The message of the exception, potentially with a stack trace. 45 | * @param failed_rpc The RPC that caused this exception, if known, or null. 46 | */ 47 | RegionMovedException(final String msg, final HBaseRpc failed_rpc) { 48 | super(msg, failed_rpc); 49 | this.failed_rpc = failed_rpc; 50 | } 51 | 52 | @Override 53 | public String getMessage() { 54 | // In many cases this exception never makes it to the outside world, thus 55 | // its toString / getMessage methods are never called. When it's called, 56 | // it's typically called only once. So it makes sense to lazily generate 57 | // the message instead of always concatenating the toString representation 58 | // of the RPC, which is easily large because it tends to contain long byte 59 | // arrays. 60 | return super.getMessage() + "\nCaused by RPC: " + failed_rpc; 61 | } 62 | 63 | public HBaseRpc getFailedRpc() { 64 | return failed_rpc; 65 | } 66 | 67 | @Override 68 | RegionMovedException make(final Object msg, final HBaseRpc rpc) { 69 | return new RegionMovedException(msg.toString(), rpc); 70 | } 71 | 72 | private static final long serialVersionUID = -5340447708638974493L; 73 | } 74 | -------------------------------------------------------------------------------- /src/RegionOfflineException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2018 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Exception thrown when we attempted to find a region, but it wasn't being 31 | * served by any RegionServer (it's "offline" in HBase speak). 32 | * XXX verify those claims... Is "offline" = "disabled"? Or the region is in 33 | * transition? Or what? 34 | */ 35 | public final class RegionOfflineException extends RecoverableException { 36 | 37 | private final byte[] region; 38 | 39 | /** 40 | * Constructor. 41 | * @param region The region that was found to be offline. 42 | */ 43 | RegionOfflineException(final byte[] region) { 44 | super(Bytes.pretty(region)); 45 | this.region = region; 46 | } 47 | 48 | /** 49 | * Returns the name of the region that's offline. 50 | */ 51 | public byte[] getRegion() { 52 | return region; 53 | } 54 | 55 | @Override 56 | HBaseException make(final Object msg, final HBaseRpc rpc) { 57 | return new RegionOfflineException(region); 58 | } 59 | 60 | private static final long serialVersionUID = 1280641842; 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/RegionOpeningException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Exception thrown when we attempted to use a region that was is still being 31 | * opened or altered. 32 | * @since 1.7 33 | */ 34 | public final class RegionOpeningException extends RecoverableException 35 | implements HasFailedRpcException { 36 | 37 | static final String REMOTE_CLASS = 38 | "org.apache.hadoop.hbase.exceptions.RegionOpeningException"; 39 | 40 | final HBaseRpc failed_rpc; 41 | 42 | /** 43 | * Constructor. 44 | * @param msg The message of the exception, potentially with a stack trace. 45 | * @param failed_rpc The RPC that caused this exception, if known, or null. 46 | */ 47 | RegionOpeningException(final String msg, final HBaseRpc failed_rpc) { 48 | super(msg); 49 | this.failed_rpc = failed_rpc; 50 | } 51 | 52 | @Override 53 | public String getMessage() { 54 | // In many cases this exception never makes it to the outside world, thus 55 | // its toString / getMessage methods are never called. When it's called, 56 | // it's typically called only once. So it makes sense to lazily generate 57 | // the message instead of always concatenating the toString representation 58 | // of the RPC, which is easily large because it tends to contain long byte 59 | // arrays. 60 | return super.getMessage() + "\nCaused by RPC: " + failed_rpc; 61 | } 62 | 63 | public HBaseRpc getFailedRpc() { 64 | return failed_rpc; 65 | } 66 | 67 | @Override 68 | RegionOpeningException make(final Object msg, final HBaseRpc rpc) { 69 | if (msg == this || msg instanceof RegionOpeningException) { 70 | final RegionOpeningException e = (RegionOpeningException) msg; 71 | return new RegionOpeningException(e.getMessage(), rpc); 72 | } 73 | return new RegionOpeningException(msg.toString(), rpc); 74 | } 75 | 76 | private static final long serialVersionUID = 3535495091647558710L; 77 | } 78 | -------------------------------------------------------------------------------- /src/RegionServerAbortedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Thrown by the region server when it is aborting. 31 | * @since 1.7.2 32 | */ 33 | public final class RegionServerAbortedException extends NotServingRegionException { 34 | 35 | static final String REMOTE_CLASS = 36 | "org.apache.hadoop.hbase.regionserver.RegionServerAbortedException"; 37 | 38 | /** 39 | * Constructor. 40 | * @param msg The message of the exception, potentially with a stack trace. 41 | * @param failed_rpc The RPC that caused this exception, if known, or null. 42 | */ 43 | RegionServerAbortedException(final String msg, final HBaseRpc failed_rpc) { 44 | super(msg, failed_rpc); 45 | } 46 | 47 | @Override 48 | RegionServerAbortedException make(final Object msg, final HBaseRpc rpc) { 49 | if (msg == this || msg instanceof RegionServerAbortedException) { 50 | final RegionServerAbortedException e = (RegionServerAbortedException) msg; 51 | return new RegionServerAbortedException(e.getMessage(), rpc); 52 | } 53 | return new RegionServerAbortedException(msg.toString(), rpc); 54 | } 55 | 56 | private static final long serialVersionUID = 5271730245586408289L; 57 | } 58 | -------------------------------------------------------------------------------- /src/RegionServerStoppedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Thrown by the region server when it is in shutting down state. 31 | * @since 1.7.2 32 | */ 33 | public final class RegionServerStoppedException extends NotServingRegionException { 34 | 35 | static final String REMOTE_CLASS = 36 | "org.apache.hadoop.hbase.regionserver.RegionServerStoppedException"; 37 | 38 | /** 39 | * Constructor. 40 | * @param msg The message of the exception, potentially with a stack trace. 41 | * @param failed_rpc The RPC that caused this exception, if known, or null. 42 | */ 43 | RegionServerStoppedException(final String msg, final HBaseRpc failed_rpc) { 44 | super(msg, failed_rpc); 45 | } 46 | 47 | @Override 48 | RegionServerStoppedException make(final Object msg, final HBaseRpc rpc) { 49 | if (msg == this || msg instanceof RegionServerStoppedException) { 50 | final RegionServerStoppedException e = (RegionServerStoppedException) msg; 51 | return new RegionServerStoppedException(e.getMessage(), rpc); 52 | } 53 | return new RegionServerStoppedException(msg.toString(), rpc); 54 | } 55 | 56 | private static final long serialVersionUID = 8471936396398620419L; 57 | } -------------------------------------------------------------------------------- /src/RegionTooBusyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Thrown by the region server if it will block and wait to serve a request. 31 | * @since 1.8.1 32 | */ 33 | public final class RegionTooBusyException extends NotServingRegionException { 34 | 35 | static final String REMOTE_CLASS = 36 | "org.apache.hadoop.hbase.RegionTooBusyException"; 37 | 38 | /** 39 | * Constructor. 40 | * @param msg The message of the exception, potentially with a stack trace. 41 | * @param failed_rpc The RPC that caused this exception, if known, or null. 42 | */ 43 | RegionTooBusyException(final String msg, final HBaseRpc failed_rpc) { 44 | super(msg, failed_rpc); 45 | } 46 | 47 | @Override 48 | RegionTooBusyException make(final Object msg, final HBaseRpc rpc) { 49 | if (msg == this || msg instanceof RegionTooBusyException) { 50 | final RegionTooBusyException e = (RegionTooBusyException) msg; 51 | return new RegionTooBusyException(e.getMessage(), rpc); 52 | } 53 | return new RegionTooBusyException(msg.toString(), rpc); 54 | } 55 | 56 | private static final long serialVersionUID = 314159265319912017L; 57 | } 58 | -------------------------------------------------------------------------------- /src/RemoteException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * An unclassified exception that occurred on the server side. 31 | */ 32 | public final class RemoteException extends NonRecoverableException { 33 | 34 | private final String type; 35 | 36 | /** 37 | * Constructor. 38 | * @param type The name of the class of the remote exception. 39 | * @param msg The message of the exception, potentially including a stack 40 | * trace. 41 | */ 42 | RemoteException(final String type, final String msg) { 43 | super(msg); 44 | this.type = type; 45 | } 46 | 47 | /** 48 | * Returns the name of the class of the remote exception. 49 | */ 50 | public String getType() { 51 | return type; 52 | } 53 | 54 | @Override 55 | RemoteException make(final Object msg, final HBaseRpc rpc) { 56 | if (msg == this || msg instanceof RemoteException) { 57 | final RemoteException e = (RemoteException) msg; 58 | return new RemoteException(e.getType(), e.getMessage()); 59 | } 60 | return new RemoteException(msg.getClass().getName(), msg.toString()); 61 | } 62 | 63 | private static final long serialVersionUID = 1279775242; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/RowFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import org.hbase.async.generated.FilterPB; 30 | 31 | /** 32 | * Filter rows based on the rowkey. Takes an operator (equal, greater, 33 | * not equal, etc). and a filter comparator. 34 | * @since 1.6 35 | */ 36 | public final class RowFilter extends CompareFilter { 37 | 38 | private static final byte[] NAME = 39 | Bytes.UTF8("org.apache.hadoop.hbase.filter.RowFilter"); 40 | 41 | public RowFilter(final CompareOp rowCompareOp, 42 | final FilterComparator rowComparator) { 43 | super(rowCompareOp, rowComparator); 44 | } 45 | 46 | @Override 47 | byte[] name() { 48 | return NAME; 49 | } 50 | 51 | @Override 52 | byte[] serialize() { 53 | return FilterPB 54 | .RowFilter 55 | .newBuilder() 56 | .setCompareFilter(toProtobuf()) 57 | .build() 58 | .toByteArray(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/RpcTimedOutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2018 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * An exception where we haven't received a response for an in-flight RPC 31 | * @since 1.7 32 | */ 33 | public class RpcTimedOutException extends HBaseException { 34 | 35 | /** The RPC that failed */ 36 | final HBaseRpc failed_rpc; 37 | 38 | /** 39 | * Constructor. 40 | * @param msg The message of the exception, potentially including a stack 41 | * trace. 42 | * @param rpc The RPC that timed out. 43 | */ 44 | RpcTimedOutException(final String msg, final HBaseRpc rpc) { 45 | super(msg); 46 | failed_rpc = rpc; 47 | } 48 | 49 | /** 50 | * Constructor. 51 | * @param msg The message of the exception, potentially including a stack 52 | * trace. 53 | * @param cause The exception that caused this one to be thrown. 54 | * @param rpc The RPC that timed out. 55 | */ 56 | RpcTimedOutException(final String msg, 57 | final Throwable cause, 58 | final HBaseRpc rpc) { 59 | super(msg, cause); 60 | failed_rpc = rpc; 61 | } 62 | 63 | /** @return The RPC that timed out. */ 64 | public HBaseRpc getFailedRpc() { 65 | return failed_rpc; 66 | } 67 | 68 | @Override 69 | RpcTimedOutException make(final Object msg, final HBaseRpc rpc) { 70 | if (msg == this || msg instanceof RpcTimedOutException) { 71 | final RpcTimedOutException e = (RpcTimedOutException) msg; 72 | if (e.getCause() != null) { 73 | return new RpcTimedOutException(e.getMessage(), e.getCause(), rpc); 74 | } else { 75 | return new RpcTimedOutException(e.getMessage(), rpc); 76 | } 77 | } 78 | return new RpcTimedOutException(msg.toString(), rpc); 79 | } 80 | 81 | private static final long serialVersionUID = -6245448564580938789L; 82 | 83 | } 84 | 85 | -------------------------------------------------------------------------------- /src/ScanFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import org.jboss.netty.buffer.ChannelBuffer; 30 | 31 | /** 32 | * Abstract base class for {@link org.hbase.async.Scanner} filters. 33 | *

34 | * These filters are executed on the server side, inside the 35 | * {@code RegionServer}, while scanning. They are useful to 36 | * prune uninteresting data before it gets to the network, 37 | * but remember that the {@code RegionServer} still has to 38 | * load the data before it can know whether the filter passes 39 | * or not, so it's generally not efficient to filter out large 40 | * amounts of data. 41 | *

42 | * Subclasses are guaranteed to be immutable and are thus 43 | * thread-safe as well as usable concurrently on multiple 44 | * {@link org.hbase.async.Scanner} instances. 45 | * @since 1.5 46 | */ 47 | public abstract class ScanFilter { 48 | 49 | /** Package-private constructor to avoid sub-classing outside this package. */ 50 | ScanFilter() { 51 | } 52 | 53 | /** 54 | * Returns the name of this scanner on the wire. 55 | *

56 | * This method is only used with HBase 0.95 and newer. 57 | * The contents of the array returned MUST NOT be modified. 58 | */ 59 | abstract byte[] name(); 60 | 61 | /** 62 | * Serializes the byte representation to a protobuf in a byte array. 63 | *

64 | * This method is only used with HBase 0.95 and newer. 65 | */ 66 | abstract byte[] serialize(); 67 | 68 | /** 69 | * Serializes the byte representation to the RPC channel buffer. 70 | *

71 | * This method is only used with HBase 0.94 and before. 72 | * @param buf The RPC channel buffer to which the byte array is serialized 73 | */ 74 | abstract void serializeOld(ChannelBuffer buf); 75 | 76 | /** 77 | * returns the number of bytes that it will write to the RPC channel buffer when {@code serialize} 78 | * is called. This method helps predict the initial size of the byte array 79 | *

80 | * This method is only used with HBase 0.94 and before. 81 | * @return A strictly positive integer 82 | */ 83 | abstract int predictSerializedSize(); 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/ServerNotRunningYetException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Thrown by the region server when it is not yet running. 31 | * @since 1.7.2 32 | */ 33 | public final class ServerNotRunningYetException extends NotServingRegionException { 34 | 35 | static final String REMOTE_CLASS = 36 | "org.apache.hadoop.hbase.ipc.ServerNotRunningYetException"; 37 | 38 | /** 39 | * Constructor. 40 | * @param msg The message of the exception, potentially with a stack trace. 41 | * @param failed_rpc The RPC that caused this exception, if known, or null. 42 | */ 43 | ServerNotRunningYetException(final String msg, final HBaseRpc failed_rpc) { 44 | super(msg, failed_rpc); 45 | } 46 | 47 | @Override 48 | ServerNotRunningYetException make(final Object msg, final HBaseRpc rpc) { 49 | if (msg == this || msg instanceof ServerNotRunningYetException) { 50 | final ServerNotRunningYetException e = (ServerNotRunningYetException) msg; 51 | return new ServerNotRunningYetException(e.getMessage(), rpc); 52 | } 53 | return new ServerNotRunningYetException(msg.toString(), rpc); 54 | } 55 | 56 | private static final long serialVersionUID = -5874735592785825342L; 57 | } -------------------------------------------------------------------------------- /src/SubstringComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import com.google.protobuf.ByteString; 30 | import org.jboss.netty.buffer.ChannelBuffer; 31 | 32 | import org.hbase.async.generated.ComparatorPB; 33 | 34 | /** 35 | * A substring comparator used in comparison filters such as RowFilter, 36 | * QualifierFilter, and ValueFilter. A Substring comparator matches any value 37 | * which contains the provided substring. 38 | *

39 | * Only EQUAL and NOT_EQUAL comparisons are valid with this comparator. 40 | * @since 1.6 41 | */ 42 | public final class SubstringComparator extends FilterComparator { 43 | 44 | private static final byte[] NAME = 45 | Bytes.UTF8("org.apache.hadoop.hbase.filter.SubstringComparator"); 46 | 47 | private final String substr; 48 | 49 | public SubstringComparator(String substr) { 50 | this.substr = substr; 51 | } 52 | 53 | public String substring() { 54 | return this.substr; 55 | } 56 | 57 | @Override 58 | byte[] name() { 59 | return NAME; 60 | } 61 | 62 | @Override 63 | ComparatorPB.Comparator toProtobuf() { 64 | ByteString byte_string = ComparatorPB 65 | .SubstringComparator 66 | .newBuilder() 67 | .setSubstr(substr) 68 | .build() 69 | .toByteString(); 70 | return super.toProtobuf(byte_string); 71 | } 72 | 73 | @Override 74 | void serializeOld(ChannelBuffer buf) { 75 | super.serializeOld(buf); // super.predictSerializedSize() 76 | // Write code 77 | buf.writeByte(0); // 1 78 | buf.writeByte((byte) NAME.length); // 1 79 | buf.writeBytes(NAME); // NAME.length 80 | // writeUTF the substring 81 | byte[] expr_bytes = Bytes.UTF8(substr); 82 | buf.writeShort(expr_bytes.length); // 2 83 | buf.writeBytes(expr_bytes); // expr.length 84 | } 85 | 86 | @Override 87 | int predictSerializedSize() { 88 | return super.predictSerializedSize() 89 | + 1 + 1 + NAME.length 90 | + 2 + Bytes.UTF8(substr).length; 91 | } 92 | 93 | @Override 94 | public String toString() { 95 | return String.format("%s(%s)", getClass().getSimpleName(), substr); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/TableNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Exception thrown when an attempt to use an inexistent table was made. 31 | */ 32 | public final class TableNotFoundException extends NonRecoverableException { 33 | 34 | private final byte[] table; 35 | 36 | /** 37 | * Constructor. 38 | */ 39 | TableNotFoundException() { 40 | super("(unknown table)"); 41 | table = null; 42 | } 43 | 44 | /** 45 | * Constructor. 46 | * @param table The table that wasn't found. 47 | */ 48 | TableNotFoundException(final byte[] table) { 49 | super(Bytes.pretty(table)); 50 | this.table = table; 51 | } 52 | 53 | /** 54 | * Returns the table that was doesn't exist. 55 | */ 56 | public byte[] getTable() { 57 | return table; 58 | } 59 | 60 | private static final long serialVersionUID = 1280638742; 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/TimestampsFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import com.google.common.collect.Lists; 30 | import org.hbase.async.generated.FilterPB; 31 | import org.jboss.netty.buffer.ChannelBuffer; 32 | 33 | import java.util.Collection; 34 | import java.util.TreeSet; 35 | 36 | /** 37 | * Filter that returns only cells whose timestamp (version) is 38 | * in the specified list of timestamps (versions). 39 | *

40 | * Note: Use of this filter overrides any time range/time stamp 41 | * options specified using {@link org.hbase.async.Scanner#setTimeRange(long, long)}. 42 | * @since 1.6 43 | */ 44 | public final class TimestampsFilter extends ScanFilter { 45 | 46 | private static final byte[] NAME = 47 | Bytes.UTF8("org.apache.hadoop.hbase.filter.TimestampsFilter"); 48 | 49 | private final TreeSet timestamps; 50 | 51 | /** 52 | * Create a timestamp filter which filters all key values with a timestamp not 53 | * in the provided collection. 54 | * 55 | * @param timestamps collection of timestamps to keep 56 | */ 57 | public TimestampsFilter(Collection timestamps) { 58 | this.timestamps = new TreeSet(timestamps); 59 | } 60 | 61 | /** 62 | * Create a timestamp filter which filters all key values with a timestamp 63 | * not in the provided timestamps. 64 | * 65 | * @param timestamps collection of timestamps to keep 66 | */ 67 | public TimestampsFilter(Long... timestamps) { 68 | this(Lists.newArrayList(timestamps)); 69 | } 70 | 71 | @Override 72 | byte[] name() { 73 | return NAME; 74 | } 75 | 76 | @Override 77 | byte[] serialize() { 78 | final FilterPB.TimestampsFilter.Builder builder = 79 | FilterPB.TimestampsFilter.newBuilder(); 80 | builder.addAllTimestamps(timestamps); 81 | return builder.build().toByteArray(); 82 | } 83 | 84 | @Override 85 | void serializeOld(ChannelBuffer buf) { 86 | buf.writeByte((byte) NAME.length); // 1 87 | buf.writeBytes(NAME); // 47 88 | buf.writeInt(timestamps.size()); // 4 89 | for (Long timestamp : timestamps) { 90 | buf.writeLong(timestamp); // timestamps.size() * 8 91 | } 92 | } 93 | 94 | @Override 95 | int predictSerializedSize() { 96 | return 1 + 47 + 4 + timestamps.size() * 8; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/UnknownProtocolException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Used by HBase 2.0 to indicate the server doesn't support 31 | * getClosestRowBefore any more (or other incorrect calls to HBase). 32 | */ 33 | public class UnknownProtocolException extends NonRecoverableException 34 | implements HasFailedRpcException { 35 | 36 | static final String REMOTE_CLASS = 37 | "org.apache.hadoop.hbase.exceptions.UnknownProtocolException"; 38 | 39 | final HBaseRpc failed_rpc; 40 | 41 | /** 42 | * Package private ctor. 43 | * @param msg The message of the exception, potentially with a stack trace. 44 | * @param failed_rpc The RPC that caused this exception, if known, or null. 45 | */ 46 | UnknownProtocolException(String msg, final HBaseRpc failed_rpc) { 47 | super(msg); 48 | this.failed_rpc = failed_rpc; 49 | } 50 | 51 | public HBaseRpc getFailedRpc() { 52 | return failed_rpc; 53 | } 54 | 55 | @Override 56 | UnknownProtocolException make(final Object msg, final HBaseRpc rpc) { 57 | if (msg == this || msg instanceof CallQueueTooBigException) { 58 | final UnknownProtocolException e = (UnknownProtocolException) msg; 59 | return new UnknownProtocolException(e.getMessage(), rpc); 60 | } 61 | return new UnknownProtocolException(msg.toString(), rpc); 62 | } 63 | private static final long serialVersionUID = -2266064834713807063L; 64 | } 65 | -------------------------------------------------------------------------------- /src/UnknownRowLockException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Exception thrown when we try to use an invalid or expired {@link RowLock}. 31 | */ 32 | public final class UnknownRowLockException extends NonRecoverableException 33 | implements HasFailedRpcException { 34 | 35 | static final String REMOTE_CLASS = 36 | "org.apache.hadoop.hbase.UnknownRowLockException"; 37 | 38 | final HBaseRpc failed_rpc; 39 | 40 | /** 41 | * Constructor. 42 | * @param msg The message of the exception, potentially with a stack trace. 43 | * @param failed_rpc The RPC that caused this exception, if known, or null. 44 | */ 45 | UnknownRowLockException(final String msg, final HBaseRpc failed_rpc) { 46 | super(msg + "\nCaused by RPC: " + failed_rpc); 47 | this.failed_rpc = failed_rpc; 48 | } 49 | 50 | public HBaseRpc getFailedRpc() { 51 | return failed_rpc; 52 | } 53 | 54 | @Override 55 | UnknownRowLockException make(final Object msg, final HBaseRpc rpc) { 56 | if (msg == this || msg instanceof UnknownRowLockException) { 57 | final UnknownRowLockException e = (UnknownRowLockException) msg; 58 | return new UnknownRowLockException(e.getMessage(), rpc); 59 | } 60 | return new UnknownRowLockException(msg.toString(), rpc); 61 | } 62 | 63 | private static final long serialVersionUID = 1281540942; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/UnknownScannerException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Exception thrown when we try to use an invalid or expired scanner ID. 31 | */ 32 | public final class UnknownScannerException extends RecoverableException 33 | implements HasFailedRpcException { 34 | 35 | static final String REMOTE_CLASS = 36 | "org.apache.hadoop.hbase.UnknownScannerException"; 37 | 38 | final HBaseRpc failed_rpc; 39 | 40 | /** 41 | * Constructor. 42 | * @param msg The message of the exception, potentially with a stack trace. 43 | * @param failed_rpc The RPC that caused this exception, if known, or null. 44 | */ 45 | UnknownScannerException(final String msg, final HBaseRpc failed_rpc) { 46 | super(msg + "\nCaused by RPC: " + failed_rpc); 47 | this.failed_rpc = failed_rpc; 48 | } 49 | 50 | public HBaseRpc getFailedRpc() { 51 | return failed_rpc; 52 | } 53 | 54 | @Override 55 | UnknownScannerException make(final Object msg, final HBaseRpc rpc) { 56 | if (msg == this || msg instanceof UnknownScannerException) { 57 | final UnknownScannerException e = (UnknownScannerException) msg; 58 | return new UnknownScannerException(e.getMessage(), rpc); 59 | } 60 | return new UnknownScannerException(msg.toString(), rpc); 61 | } 62 | 63 | private static final long serialVersionUID = 1281457342; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/ValueFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import org.hbase.async.generated.FilterPB; 30 | 31 | /** 32 | * Filter key values based on their value. Takes an operator (equal, greater, 33 | * not equal, etc). and a filter comparator. 34 | * @since 1.6 35 | */ 36 | public final class ValueFilter extends CompareFilter { 37 | 38 | private static final byte[] NAME = 39 | Bytes.UTF8("org.apache.hadoop.hbase.filter.ValueFilter"); 40 | 41 | public ValueFilter(final CompareOp valueCompareOp, 42 | final FilterComparator valueComparator) { 43 | super(valueCompareOp, valueComparator); 44 | } 45 | 46 | @Override 47 | byte[] name() { 48 | return NAME; 49 | } 50 | 51 | @Override 52 | byte[] serialize() { 53 | return FilterPB 54 | .ValueFilter 55 | .newBuilder() 56 | .setCompareFilter(toProtobuf()) 57 | .build() 58 | .toByteArray(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/VersionMismatchException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | /** 30 | * Indicates that an RPC version mismatch occurred. 31 | * The RPC sent to the server failed because the server didn't support the RPC 32 | * versions used by the client. 33 | */ 34 | public final class VersionMismatchException extends NonRecoverableException 35 | implements HasFailedRpcException { 36 | 37 | static final String REMOTE_CLASS = 38 | "org.apache.hadoop.io.VersionMismatchException"; 39 | 40 | final HBaseRpc failed_rpc; 41 | 42 | /** 43 | * Constructor. 44 | * @param msg The message of the exception, potentially with a stack trace. 45 | * @param failed_rpc The RPC that caused this exception, if known, or null. 46 | */ 47 | VersionMismatchException(final String msg, final HBaseRpc failed_rpc) { 48 | super(msg + "\nCaused by RPC: " + failed_rpc); 49 | this.failed_rpc = failed_rpc; 50 | } 51 | 52 | public HBaseRpc getFailedRpc() { 53 | return failed_rpc; 54 | } 55 | 56 | @Override 57 | VersionMismatchException make(final Object msg, final HBaseRpc rpc) { 58 | if (msg == this || msg instanceof VersionMismatchException) { 59 | final VersionMismatchException e = (VersionMismatchException) msg; 60 | return new VersionMismatchException(e.getMessage(), rpc); 61 | } 62 | return new VersionMismatchException(msg.toString(), rpc); 63 | } 64 | 65 | private static final long serialVersionUID = 1324486442; 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/auth/ClientAuthProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async.auth; 28 | 29 | import java.util.Map; 30 | 31 | import javax.security.auth.Subject; 32 | import javax.security.sasl.SaslClient; 33 | 34 | import org.hbase.async.HBaseClient; 35 | 36 | /** 37 | * Class to extend to support other authentication mechanisms for Secure RPC 38 | * versions. To select a provider fully qualified class names are passed to 39 | * 'hbase.security.authentication' system property. 40 | * @since 1.7 41 | */ 42 | public abstract class ClientAuthProvider { 43 | 44 | public static final byte SIMPLE_CLIENT_AUTH_CODE = 80; 45 | public static final byte KEBEROS_CLIENT_AUTH_CODE = 81; 46 | 47 | /** The hbase client object for fetching settings */ 48 | final HBaseClient hbase_client; 49 | 50 | /** 51 | * Default CTor that stores a reference to the AsyncHBase client 52 | * @param hbase_client The HBaseClient to fetch configuration and timers from 53 | */ 54 | public ClientAuthProvider(final HBaseClient hbase_client) { 55 | this.hbase_client = hbase_client; 56 | } 57 | 58 | /** 59 | * Return a new SaslClient for target serviceIP host. Properties passed 60 | * are expected to be passed as part of the newSaslClient props parameter. 61 | * @param service_ip The IP of the target host. 62 | * @param props The set of properties with which to create a new client. 63 | * @return the newly-created client. 64 | */ 65 | public abstract SaslClient newSaslClient(final String service_ip, 66 | final Map props); 67 | 68 | /** 69 | * @return The name of the user this provider is tied to. 70 | */ 71 | public abstract String getClientUsername(); 72 | 73 | /** 74 | * @return The RPC code identifying this authentication mechanism 75 | */ 76 | public abstract byte getAuthMethodCode(); 77 | 78 | /** 79 | * @return The subject identifying the client user this provider is tied to. 80 | */ 81 | public abstract Subject getClientSubject(); 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/auth/SimpleClientAuthProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async.auth; 28 | 29 | import java.util.Map; 30 | 31 | import javax.security.auth.Subject; 32 | import javax.security.sasl.SaslClient; 33 | 34 | import org.hbase.async.HBaseClient; 35 | 36 | /** 37 | * Handles simple user based authentication 38 | * @since 1.7 39 | */ 40 | public class SimpleClientAuthProvider extends ClientAuthProvider { 41 | public static final String USERNAME_KEY = "hbase.security.simple.username"; 42 | 43 | /** Username to use for auth */ 44 | private final String username; 45 | 46 | /** 47 | * Default ctor 48 | * @param hbase_client The HBaseClient to fetch configuration and timers from 49 | * @throws IllegalArgumentException if the 50 | * asynchbase.security.auth.simple.username is missing, null or empty. 51 | */ 52 | public SimpleClientAuthProvider(final HBaseClient hbase_client) { 53 | super(hbase_client); 54 | if (!hbase_client.getConfig().hasProperty(USERNAME_KEY)) { 55 | throw new IllegalArgumentException("Missing client username"); 56 | } 57 | username = hbase_client.getConfig().getString(USERNAME_KEY); 58 | if (username == null || username.isEmpty()) { 59 | throw new IllegalArgumentException("Missing client username"); 60 | } 61 | } 62 | 63 | @Override 64 | public SaslClient newSaslClient(final String service_ip, 65 | final Map props) { 66 | return null; 67 | } 68 | 69 | @Override 70 | public String getClientUsername() { 71 | return username; 72 | } 73 | 74 | @Override 75 | public byte getAuthMethodCode() { 76 | return ClientAuthProvider.SIMPLE_CLIENT_AUTH_CODE; 77 | } 78 | 79 | @Override 80 | public Subject getClientSubject() { 81 | return null; 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/jsr166e/README: -------------------------------------------------------------------------------- 1 | The contents of this directory contains code from JSR 166e. 2 | ** THIS IS NOT PART OF THE PUBLIC INTERFACE OF ASYNCHBASE ** 3 | 4 | Code was downloaded from: 5 | http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jsr166e/ 6 | 7 | The code was released to the public domain, as explained at 8 | http://creativecommons.org/publicdomain/zero/1.0/ 9 | 10 | The code is bundled in asynchbase as it is not available until JDK8 11 | becomes a reality, which is expected to take years (at time of writing). 12 | Ideally another library, such as Google Guava, would provide this 13 | code until JDK8 becomes the norm. But in the mean time it's here 14 | for asynchbase's internal use. 15 | -------------------------------------------------------------------------------- /src/jsr166e/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | /** 29 | *

This package is not part of asynchbase's public interface.

30 | * Use {@link org.hbase.async.Counter} instead. 31 | */ 32 | package org.hbase.async.jsr166e; 33 | -------------------------------------------------------------------------------- /src/protobuf/ZeroCopyLiteralByteString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package com.google.protobuf; // This is a lie. 28 | 29 | /** 30 | * Helper class to extract byte arrays from {@link ByteString} without copy. 31 | *

32 | * Without this protobufs would force us to copy every single byte array out 33 | * of the objects de-serialized from the wire (which already do one copy, on 34 | * top of the copies the JVM does to go from kernel buffer to C buffer and 35 | * from C buffer to JVM buffer). 36 | *

37 | * This class isn't part of the public API of AsyncHBase. 38 | * @since 1.5 39 | */ 40 | public final class ZeroCopyLiteralByteString extends LiteralByteString { 41 | 42 | /** Private constructor so this class cannot be instantiated. */ 43 | private ZeroCopyLiteralByteString() { 44 | super(null); 45 | throw new UnsupportedOperationException("Should never be here."); 46 | } 47 | 48 | /** 49 | * Wraps a byte array in a {@link ByteString} without copying it. 50 | */ 51 | public static ByteString wrap(final byte[] array) { 52 | return new LiteralByteString(array); 53 | } 54 | 55 | /** 56 | * Extracts the byte array from the given {@link ByteString} without copy. 57 | * @param buf A buffer from which to extract the array. This buffer must be 58 | * actually an instance of a {@code LiteralByteString}. 59 | */ 60 | public static byte[] zeroCopyGetBytes(final ByteString buf) { 61 | if (buf instanceof LiteralByteString) { 62 | return ((LiteralByteString) buf).bytes; 63 | } 64 | throw new UnsupportedOperationException("Need a LiteralByteString, got a " 65 | + buf.getClass().getName()); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /test/Common.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import org.jboss.netty.logging.InternalLoggerFactory; 30 | import org.jboss.netty.logging.Slf4JLoggerFactory; 31 | import org.junit.Ignore; 32 | import org.slf4j.Logger; 33 | import org.slf4j.LoggerFactory; 34 | 35 | @Ignore // ignore for test runners 36 | final class Common { 37 | 38 | static { 39 | InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory()); 40 | } 41 | 42 | static Logger logger(final Class klass) { 43 | return LoggerFactory.getLogger(klass); 44 | } 45 | 46 | static HBaseClient getOpt(final Class klass, final String[] args) { 47 | if (args.length < 2) { 48 | System.err.println("Usage: " + klass.getSimpleName() 49 | + " [zkquorum] [znode]"); 50 | System.exit(1); 51 | } 52 | final String zkquorum; 53 | if (args.length > 2) { 54 | zkquorum = args[2]; 55 | } else { 56 | zkquorum = "localhost"; 57 | } 58 | if (args.length > 3) { 59 | return new HBaseClient(zkquorum, args[3]); 60 | } else { 61 | return new HBaseClient(zkquorum); // Default znode 62 | } 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /test/TestMETALookup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import java.util.Comparator; 30 | 31 | import org.junit.Test; 32 | import org.junit.runner.RunWith; 33 | import static org.junit.Assert.fail; 34 | 35 | import org.powermock.core.classloader.annotations.PrepareForTest; 36 | import org.powermock.modules.junit4.PowerMockRunner; 37 | 38 | /** 39 | * Unit tests for META lookups and associated regressions. 40 | */ 41 | @RunWith(PowerMockRunner.class) 42 | @PrepareForTest 43 | final class TestMETALookup { 44 | 45 | private static final Comparator cmp = RegionInfo.REGION_NAME_CMP; 46 | 47 | @Test 48 | public void testRegionCmp() { 49 | // Different table names. 50 | assertGreater("table,,1234567890", ".META.,,1234567890"); 51 | // Any key is greater than the start key. 52 | assertGreater("table,foo,1234567890", "table,,1234567890"); 53 | // Different keys. 54 | assertGreater("table,foo,1234567890", "table,bar,1234567890"); 55 | // Shorter key is smaller than longer key. 56 | assertGreater("table,fool,1234567890", "table,foo,1234567890"); 57 | // Properly handle keys that contain commas. 58 | assertGreater("table,a,,c,1234567890", "table,a,,b,1234567890"); 59 | // If keys are equal, then start code should break the tie. 60 | assertGreater("table,foo,1234567891", "table,foo,1234567890"); 61 | // Make sure that a start code being a prefix of another is handled. 62 | assertGreater("table,foo,1234567890", "table,foo,123456789"); 63 | // If both are start keys, then start code should break the tie. 64 | assertGreater("table,,1234567891", "table,,1234567890"); 65 | // The value `:' is always greater than any start code. 66 | assertGreater("table,foo,:", "table,foo,9999999999"); 67 | // Issue 27: searching for key "8,\001" and region key is "8". 68 | assertGreater("table,8,\001,:", "table,8,1339667458224"); 69 | } 70 | 71 | /** Ensures that {@code sa > sb} in the META cache. */ 72 | private static void assertGreater(final String sa, final String sb) { 73 | final byte[] a = sa.getBytes(); 74 | final byte[] b = sb.getBytes(); 75 | int c = cmp.compare(a, b); 76 | if (c <= 0) { 77 | fail("compare(" + Bytes.pretty(a) + ", " + Bytes.pretty(b) + ")" 78 | + " returned " + c + ", but was expected to return > 0"); 79 | } 80 | c = cmp.compare(b, a); 81 | if (c >= 0) { 82 | fail("compare(" + Bytes.pretty(b) + ", " + Bytes.pretty(a) + ")" 83 | + " returned " + c + ", but was expected to return < 0"); 84 | } 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /test/TestScanner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async; 28 | 29 | import static org.junit.Assert.assertArrayEquals; 30 | import static org.junit.Assert.assertNull; 31 | import static org.mockito.Mockito.mock; 32 | 33 | import org.junit.Before; 34 | import org.junit.Test; 35 | import org.junit.runner.RunWith; 36 | import org.powermock.core.classloader.annotations.PrepareForTest; 37 | import org.powermock.modules.junit4.PowerMockRunner; 38 | import org.powermock.reflect.Whitebox; 39 | 40 | @RunWith(PowerMockRunner.class) 41 | @PrepareForTest({ HBaseClient.class, Scanner.class }) 42 | public class TestScanner { 43 | 44 | private static final byte[] TABLE = new byte[] { 't', 'a', 'b', 'l', 'e' }; 45 | private HBaseClient client; 46 | 47 | @Before 48 | public void before() { 49 | client = mock(HBaseClient.class); 50 | } 51 | 52 | @Test 53 | public void setFamiliesString() throws Exception { 54 | Scanner scanner = new Scanner(client, TABLE); 55 | scanner.setFamilies("fam1", "fam2"); 56 | final byte[][] families = (byte[][])Whitebox.getInternalState(scanner, 57 | "families"); 58 | assertArrayEquals(families[0], "fam1".getBytes()); 59 | assertArrayEquals(families[1], "fam2".getBytes()); 60 | assertNull(Whitebox.getInternalState(scanner, "qualifiers")); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /test/auth/MockProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async.auth; 28 | 29 | import java.util.Map; 30 | 31 | import javax.security.auth.Subject; 32 | import javax.security.sasl.SaslClient; 33 | 34 | import org.hbase.async.HBaseClient; 35 | import org.junit.Ignore; 36 | 37 | /** 38 | * This is a dummy implementation of the ClientAuthProvider for unit testing 39 | * purposes to make sure we can load an auth plugin if provided in the class 40 | * path. 41 | */ 42 | @Ignore // ignore for test runners 43 | public class MockProvider extends ClientAuthProvider { 44 | 45 | public MockProvider(HBaseClient hbase_client) { 46 | super(hbase_client); 47 | } 48 | 49 | @Override 50 | public SaslClient newSaslClient(final String service_ip, 51 | final Map props) { 52 | return null; 53 | } 54 | 55 | @Override 56 | public String getClientUsername() { 57 | return null; 58 | } 59 | 60 | @Override 61 | public byte getAuthMethodCode() { 62 | return -1; 63 | } 64 | 65 | @Override 66 | public Subject getClientSubject() { 67 | return null; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /test/auth/TestSimpleClientAuthProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Async HBase Authors. All rights reserved. 3 | * This file is part of Async HBase. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of the StumbleUpon nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | package org.hbase.async.auth; 28 | 29 | import static org.junit.Assert.assertEquals; 30 | import static org.junit.Assert.assertNull; 31 | import static org.mockito.Mockito.mock; 32 | import static org.mockito.Mockito.when; 33 | 34 | import java.util.Collections; 35 | 36 | import org.hbase.async.Config; 37 | import org.hbase.async.HBaseClient; 38 | import org.junit.Before; 39 | import org.junit.Test; 40 | import org.junit.runner.RunWith; 41 | import org.powermock.core.classloader.annotations.PrepareForTest; 42 | import org.powermock.modules.junit4.PowerMockRunner; 43 | 44 | @RunWith(PowerMockRunner.class) 45 | @PrepareForTest({ HBaseClient.class }) 46 | public class TestSimpleClientAuthProvider { 47 | private HBaseClient client; 48 | private Config config; 49 | 50 | @Before 51 | public void before() throws Exception { 52 | config = new Config(); 53 | client = mock(HBaseClient.class); 54 | when(client.getConfig()).thenReturn(config); 55 | config.overrideConfig(SimpleClientAuthProvider.USERNAME_KEY, "Weatherwax"); 56 | } 57 | 58 | @Test 59 | public void ctor() throws Exception { 60 | final ClientAuthProvider provider = new SimpleClientAuthProvider(client); 61 | assertEquals("Weatherwax", provider.getClientUsername()); 62 | assertNull(provider.newSaslClient("127.0.0.1", 63 | Collections. emptyMap())); 64 | assertEquals(ClientAuthProvider.SIMPLE_CLIENT_AUTH_CODE, 65 | provider.getAuthMethodCode()); 66 | assertNull(provider.getClientSubject()); 67 | } 68 | 69 | @Test (expected = IllegalArgumentException.class) 70 | public void ctorMissingUsername() throws Exception { 71 | config = new Config(); 72 | when(client.getConfig()).thenReturn(config); 73 | new SimpleClientAuthProvider(client); 74 | } 75 | 76 | @Test (expected = IllegalArgumentException.class) 77 | public void ctorNullUsername() throws Exception { 78 | config.overrideConfig(SimpleClientAuthProvider.USERNAME_KEY, null); 79 | new SimpleClientAuthProvider(client); 80 | } 81 | 82 | @Test (expected = IllegalArgumentException.class) 83 | public void ctorEmptyUsername() throws Exception { 84 | config.overrideConfig(SimpleClientAuthProvider.USERNAME_KEY, ""); 85 | new SimpleClientAuthProvider(client); 86 | } 87 | 88 | @Test (expected = NullPointerException.class) 89 | public void ctorNullClient() throws Exception { 90 | new SimpleClientAuthProvider(null); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /third_party/.gitignore: -------------------------------------------------------------------------------- 1 | *.jar 2 | *.*-t 3 | -------------------------------------------------------------------------------- /third_party/guava/guava-13.0.1.jar.md5: -------------------------------------------------------------------------------- 1 | 539a72e3c7b7bd1b12b9cf7a567fb28a 2 | -------------------------------------------------------------------------------- /third_party/guava/guava-18.0.jar.md5: -------------------------------------------------------------------------------- 1 | 947641f6bb535b1d942d1bc387c45290 2 | -------------------------------------------------------------------------------- /third_party/guava/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | GUAVA_VERSION := 18.0 27 | GUAVA := third_party/guava/guava-$(GUAVA_VERSION).jar 28 | GUAVA_BASE_URL := http://central.maven.org/maven2/com/google/guava/guava/$(GUAVA_VERSION) 29 | 30 | $(GUAVA): $(GUAVA).md5 31 | set dummy "$(GUAVA_BASE_URL)" "$(GUAVA)"; shift; $(FETCH_DEPENDENCY) 32 | 33 | THIRD_PARTY += $(GUAVA) 34 | -------------------------------------------------------------------------------- /third_party/hamcrest/hamcrest-core-1.3.jar.md5: -------------------------------------------------------------------------------- 1 | 6393363b47ddcbba82321110c3e07519 2 | -------------------------------------------------------------------------------- /third_party/hamcrest/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | HAMCREST_VERSION := 1.3 27 | HAMCREST := third_party/hamcrest/hamcrest-core-$(HAMCREST_VERSION).jar 28 | HAMCREST_BASE_URL := http://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/$(HAMCREST_VERSION) 29 | 30 | $(HAMCREST): $(HAMCREST).md5 31 | set dummy "$(HAMCREST_BASE_URL)" "$(HAMCREST)"; shift; $(FETCH_DEPENDENCY) 32 | 33 | THIRD_PARTY += $(HAMCREST) 34 | -------------------------------------------------------------------------------- /third_party/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011-2012 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | ASYNCHBASE_THIRD_PARTY_BASE_URL := http://central.maven.org/maven2/ 27 | FETCH_DEPENDENCY := ./build-aux/fetchdep.sh "$$@" 28 | THIRD_PARTY = 29 | 30 | include third_party/guava/include.mk 31 | include third_party/hamcrest/include.mk 32 | include third_party/javassist/include.mk 33 | include third_party/junit/include.mk 34 | include third_party/logback/include.mk 35 | include third_party/mockito/include.mk 36 | include third_party/netty/include.mk 37 | include third_party/objenesis/include.mk 38 | include third_party/powermock/include.mk 39 | include third_party/protobuf/include.mk 40 | include third_party/slf4j/include.mk 41 | include third_party/suasync/include.mk 42 | include third_party/zookeeper/include.mk 43 | -------------------------------------------------------------------------------- /third_party/javassist/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011-2012 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | JAVASSIST_VERSION := 3.18.1-GA 27 | JAVASSIST := third_party/javassist/javassist-$(JAVASSIST_VERSION).jar 28 | JAVASSIST_BASE_URL := http://central.maven.org/maven2/org/javassist/javassist/$(JAVASSIST_VERSION) 29 | 30 | $(JAVASSIST): $(JAVASSIST).md5 31 | set dummy "$(JAVASSIST_BASE_URL)" "$(JAVASSIST)"; shift; $(FETCH_DEPENDENCY) 32 | 33 | THIRD_PARTY += $(JAVASSIST) 34 | -------------------------------------------------------------------------------- /third_party/javassist/javassist-3.15.0-GA.jar.md5: -------------------------------------------------------------------------------- 1 | 98b83db263880dc3bd9fd234ac4b8802 2 | -------------------------------------------------------------------------------- /third_party/javassist/javassist-3.17.1-GA.jar.md5: -------------------------------------------------------------------------------- 1 | d6a8586b96f0a0fb5f6100371759fa17 2 | -------------------------------------------------------------------------------- /third_party/javassist/javassist-3.18.1-GA.jar.md5: -------------------------------------------------------------------------------- 1 | 5bb83868c87334320562af7eded65cc2 2 | -------------------------------------------------------------------------------- /third_party/junit/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011-2012 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | JUNIT_VERSION := 4.11 27 | JUNIT := third_party/junit/junit-$(JUNIT_VERSION).jar 28 | JUNIT_BASE_URL := http://repo1.maven.org/maven2/junit/junit/$(JUNIT_VERSION) 29 | 30 | $(JUNIT): $(JUNIT).md5 31 | set dummy "$(JUNIT_BASE_URL)" "$(JUNIT)"; shift; $(FETCH_DEPENDENCY) 32 | 33 | THIRD_PARTY += $(JUNIT) 34 | -------------------------------------------------------------------------------- /third_party/junit/junit-4.10.jar.md5: -------------------------------------------------------------------------------- 1 | 972c3b8fb2cc26008cbceb01ff889ec4 2 | -------------------------------------------------------------------------------- /third_party/junit/junit-4.11.jar.md5: -------------------------------------------------------------------------------- 1 | 3c42be5ea7cbf3635716abbb429cb90d 2 | -------------------------------------------------------------------------------- /third_party/logback/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011-2021 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | https://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.2.9/logback-classic-1.2.9.jar 27 | LOGBACK_VERSION := 1.2.9 28 | 29 | LOGBACK_CLASSIC_VERSION := $(LOGBACK_VERSION) 30 | LOGBACK_CLASSIC := third_party/logback/logback-classic-$(LOGBACK_CLASSIC_VERSION).jar 31 | LOGBACK_CLASSIC_BASE_URL := https://repo1.maven.org/maven2/ch/qos/logback/logback-classic/$(LOGBACK_VERSION) 32 | 33 | $(LOGBACK_CLASSIC): $(LOGBACK_CLASSIC).md5 34 | set dummy "$(LOGBACK_CLASSIC_BASE_URL)" "$(LOGBACK_CLASSIC)"; shift; $(FETCH_DEPENDENCY) 35 | 36 | 37 | LOGBACK_CORE_VERSION := $(LOGBACK_VERSION) 38 | LOGBACK_CORE := third_party/logback/logback-core-$(LOGBACK_CORE_VERSION).jar 39 | LOGBACK_CORE_BASE_URL := https://repo1.maven.org/maven2/ch/qos/logback/logback-core/$(LOGBACK_VERSION) 40 | 41 | $(LOGBACK_CORE): $(LOGBACK_CORE).md5 42 | set dummy "$(LOGBACK_CORE_BASE_URL)" "$(LOGBACK_CORE)"; shift; $(FETCH_DEPENDENCY) 43 | 44 | THIRD_PARTY += $(LOGBACK_CLASSIC) $(LOGBACK_CORE) 45 | -------------------------------------------------------------------------------- /third_party/logback/logback-classic-1.0.13.jar.md5: -------------------------------------------------------------------------------- 1 | 18586a078b51918942002ec085338e19 2 | -------------------------------------------------------------------------------- /third_party/logback/logback-classic-1.2.9.jar.md5: -------------------------------------------------------------------------------- 1 | de212f6deebb4cf8b5c91853602db5ec 2 | -------------------------------------------------------------------------------- /third_party/logback/logback-core-1.0.13.jar.md5: -------------------------------------------------------------------------------- 1 | 945c6dc3c10d3ce784d456a8bbbd0262 2 | -------------------------------------------------------------------------------- /third_party/logback/logback-core-1.2.9.jar.md5: -------------------------------------------------------------------------------- 1 | e0e576b4001e1c99e551655b3fcbacbf 2 | -------------------------------------------------------------------------------- /third_party/mockito/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011-2012 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | MOCKITO_VERSION := 1.9.5 27 | MOCKITO := third_party/mockito/mockito-core-$(MOCKITO_VERSION).jar 28 | MOCKITO_BASE_URL := http://central.maven.org/maven2/org/mockito/mockito-core/$(MOCKITO_VERSION) 29 | 30 | $(MOCKITO): $(MOCKITO).md5 31 | set dummy "$(MOCKITO_BASE_URL)" "$(MOCKITO)"; shift; $(FETCH_DEPENDENCY) 32 | 33 | THIRD_PARTY += $(MOCKITO) 34 | -------------------------------------------------------------------------------- /third_party/mockito/mockito-1.9.0.jar.md5: -------------------------------------------------------------------------------- 1 | cab21b44958a173a5b1d55a6aff0ab54 2 | -------------------------------------------------------------------------------- /third_party/mockito/mockito-core-1.9.5.jar.md5: -------------------------------------------------------------------------------- 1 | 6f73cf04a56eb60aaa996506e7c10fc7 2 | -------------------------------------------------------------------------------- /third_party/netty/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011-2012 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | NETTY_MAJOR_VERSION = 3.9 27 | NETTY_VERSION := 3.9.4.Final 28 | NETTY := third_party/netty/netty-$(NETTY_VERSION).jar 29 | NETTY_BASE_URL := http://central.maven.org/maven2/io/netty/netty/$(NETTY_VERSION) 30 | 31 | $(NETTY): $(NETTY).md5 32 | set dummy "$(NETTY_BASE_URL)" "$(NETTY)"; shift; $(FETCH_DEPENDENCY) 33 | 34 | THIRD_PARTY += $(NETTY) 35 | -------------------------------------------------------------------------------- /third_party/netty/netty-3.8.0.Final.jar.md5: -------------------------------------------------------------------------------- 1 | 41881e69dd4e0a012dc065ae4c7845fe 2 | -------------------------------------------------------------------------------- /third_party/netty/netty-3.9.4.Final.jar.md5: -------------------------------------------------------------------------------- 1 | b3701ef46c7518d0d63705e2f092dbe5 2 | -------------------------------------------------------------------------------- /third_party/objenesis/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | OBJENESIS_VERSION := 2.1 27 | OBJENESIS := third_party/objenesis/objenesis-$(OBJENESIS_VERSION).jar 28 | OBJENESIS_BASE_URL := http://central.maven.org/maven2/org/objenesis/objenesis/$(OBJENESIS_VERSION) 29 | 30 | $(OBJENESIS): $(OBJENESIS).md5 31 | set dummy "$(OBJENESIS_BASE_URL)" "$(OBJENESIS)"; shift; $(FETCH_DEPENDENCY) 32 | 33 | THIRD_PARTY += $(OBJENESIS) 34 | -------------------------------------------------------------------------------- /third_party/objenesis/objenesis-1.3.jar.md5: -------------------------------------------------------------------------------- 1 | 2d649907bd6203f2661f70d430a6ade8 2 | -------------------------------------------------------------------------------- /third_party/objenesis/objenesis-2.1.jar.md5: -------------------------------------------------------------------------------- 1 | 32ccb1d20a42b5aaaceb90c9082a2efa 2 | -------------------------------------------------------------------------------- /third_party/powermock/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011-2012 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | POWERMOCK_MOCKITO_VERSION := 1.5.4 27 | POWERMOCK_MOCKITO := third_party/powermock/powermock-mockito-release-full-$(POWERMOCK_MOCKITO_VERSION)-full.jar 28 | POWERMOCK_MOCKITO_BASE_URL := http://central.maven.org/maven2/org/powermock/powermock-mockito-release-full/$(POWERMOCK_MOCKITO_VERSION) 29 | 30 | $(POWERMOCK_MOCKITO): $(POWERMOCK_MOCKITO).md5 31 | set dummy "$(POWERMOCK_MOCKITO_BASE_URL)" "$(POWERMOCK_MOCKITO)"; shift; $(FETCH_DEPENDENCY) 32 | 33 | THIRD_PARTY += $(POWERMOCK_MOCKITO) 34 | -------------------------------------------------------------------------------- /third_party/powermock/powermock-mockito-1.5.jar.md5: -------------------------------------------------------------------------------- 1 | da9e7012d0e13f90c71829f2ac7d5462 2 | -------------------------------------------------------------------------------- /third_party/powermock/powermock-mockito-release-full-1.5.4-full.jar.md5: -------------------------------------------------------------------------------- 1 | 5dee1dce6952bb7338d4d053157ae647 2 | -------------------------------------------------------------------------------- /third_party/protobuf/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | PROTOBUF_VERSION := 2.5.0 27 | PROTOBUF := third_party/protobuf/protobuf-java-$(PROTOBUF_VERSION).jar 28 | PROTOBUF_BASE_URL := http://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/$(PROTOBUF_VERSION) 29 | 30 | $(PROTOBUF): $(PROTOBUF).md5 31 | set dummy "$(PROTOBUF_BASE_URL)" "$(PROTOBUF)"; shift; $(FETCH_DEPENDENCY) 32 | 33 | THIRD_PARTY += $(PROTOBUF) 34 | -------------------------------------------------------------------------------- /third_party/protobuf/protobuf-java-2.5.0.jar.md5: -------------------------------------------------------------------------------- 1 | a44473b98947e2a54c54e0db1387d137 2 | -------------------------------------------------------------------------------- /third_party/slf4j/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011-2012 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | SLF4J_VERSION := 1.7.7 27 | 28 | 29 | LOG4J_OVER_SLF4J_VERSION := $(SLF4J_VERSION) 30 | LOG4J_OVER_SLF4J := third_party/slf4j/log4j-over-slf4j-$(LOG4J_OVER_SLF4J_VERSION).jar 31 | LOG4J_OVER_SLF4J_BASE_URL := http://central.maven.org/maven2/org/slf4j/log4j-over-slf4j/$(LOG4J_OVER_SLF4J_VERSION) 32 | 33 | $(LOG4J_OVER_SLF4J): $(LOG4J_OVER_SLF4J).md5 34 | set dummy "$(LOG4J_OVER_SLF4J_BASE_URL)" "$(LOG4J_OVER_SLF4J)"; shift; $(FETCH_DEPENDENCY) 35 | 36 | 37 | SLF4J_API_VERSION := $(SLF4J_VERSION) 38 | SLF4J_API := third_party/slf4j/slf4j-api-$(SLF4J_API_VERSION).jar 39 | SLF4J_API_BASE_URL := http://central.maven.org/maven2/org/slf4j/slf4j-api/$(SLF4J_API_VERSION) 40 | 41 | $(SLF4J_API): $(SLF4J_API).md5 42 | set dummy "$(SLF4J_API_BASE_URL)" "$(SLF4J_API)"; shift; $(FETCH_DEPENDENCY) 43 | 44 | THIRD_PARTY += $(JCL_OVER_SLF4J) $(LOG4J_OVER_SLF4J) $(SLF4J_API) 45 | -------------------------------------------------------------------------------- /third_party/slf4j/log4j-over-slf4j-1.7.5.jar.md5: -------------------------------------------------------------------------------- 1 | bf9d6e634b0fa91cd2dff322394942a9 2 | -------------------------------------------------------------------------------- /third_party/slf4j/log4j-over-slf4j-1.7.7.jar.md5: -------------------------------------------------------------------------------- 1 | 93ab42a5216afd683c35988c6b6fc3d8 2 | -------------------------------------------------------------------------------- /third_party/slf4j/slf4j-api-1.7.5.jar.md5: -------------------------------------------------------------------------------- 1 | 48968da44a8ff71040112253929c8129 2 | -------------------------------------------------------------------------------- /third_party/slf4j/slf4j-api-1.7.7.jar.md5: -------------------------------------------------------------------------------- 1 | ca4280bf93d64367723ae5c8d42dd0b9 2 | -------------------------------------------------------------------------------- /third_party/suasync/async-1.4.0.jar.md5: -------------------------------------------------------------------------------- 1 | 90aa9cc566423f12af88e205804d5161 2 | -------------------------------------------------------------------------------- /third_party/suasync/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011-2012 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | SUASYNC_VERSION := 1.4.0 27 | SUASYNC := third_party/suasync/async-$(SUASYNC_VERSION).jar 28 | SUASYNC_BASE_URL := http://central.maven.org/maven2/com/stumbleupon/async/$(SUASYNC_VERSION) 29 | 30 | $(SUASYNC): $(SUASYNC).md5 31 | set dummy "$(SUASYNC_BASE_URL)" "$(SUASYNC)"; shift; $(FETCH_DEPENDENCY) 32 | 33 | THIRD_PARTY += $(SUASYNC) 34 | -------------------------------------------------------------------------------- /third_party/suasync/suasync-1.3.2.jar.md5: -------------------------------------------------------------------------------- 1 | 62cf94994a0a6c2c9e3ed32b2cef837f 2 | -------------------------------------------------------------------------------- /third_party/zookeeper/include.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011-2012 The Async HBase Authors. All rights reserved. 2 | # This file is part of Async HBase. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # - Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # - Redistributions in binary form must reproduce the above copyright notice, 9 | # this list of conditions and the following disclaimer in the documentation 10 | # and/or other materials provided with the distribution. 11 | # - Neither the name of the StumbleUpon nor the names of its contributors 12 | # may be used to endorse or promote products derived from this software 13 | # without specific prior written permission. 14 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | 26 | ZOOKEEPER_VERSION := 3.4.5 27 | ZOOKEEPER := third_party/zookeeper/zookeeper-$(ZOOKEEPER_VERSION).jar 28 | ZOOKEEPER_BASE_URL := http://central.maven.org/maven2/org/apache/zookeeper/zookeeper/$(ZOOKEEPER_VERSION) 29 | 30 | $(ZOOKEEPER): $(ZOOKEEPER).md5 31 | set dummy "$(ZOOKEEPER_BASE_URL)" "$(ZOOKEEPER)"; shift; $(FETCH_DEPENDENCY) 32 | 33 | THIRD_PARTY += $(ZOOKEEPER) 34 | -------------------------------------------------------------------------------- /third_party/zookeeper/zookeeper-3.3.6.jar.md5: -------------------------------------------------------------------------------- 1 | a4425412297adf88c157a263d61e2cf1 2 | -------------------------------------------------------------------------------- /third_party/zookeeper/zookeeper-3.4.5.jar.md5: -------------------------------------------------------------------------------- 1 | 00b9db19ad7f18681761edc6db524ceb 2 | --------------------------------------------------------------------------------