This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class TestPriorityQueue { | |
| private static class HalfRingQ<E> { | |
| private final Comparator<? super E> comparator; | |
| private final E[] objects; | |
| private int head = 0; | |
| private int tail = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private class NamedLock<T> { | |
| private HashSet<T> locks = new HashSet<T>(); | |
| public void lock(final T name) { | |
| synchronized (locks) { | |
| while (locks.contains(name)) { | |
| locks.wait(); | |
| } | |
| locks.add(name); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java | |
| index 9de02f0..68524ab 100644 | |
| --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java | |
| +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java | |
| @@ -356,7 +356,7 @@ public class HttpServer implements FilterContainer { | |
| if ("http".equals(scheme)) { | |
| listener = HttpServer.createDefaultChannelConnector(); | |
| } else if ("https".equals(scheme)) { | |
| - SslSocketConnector c = new SslSocketConnector(); | |
| + SslSocketConnector c = new SslSocketConnectorSecure(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java | |
| index 413bc98..16357c1 100644 | |
| --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java | |
| +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java | |
| @@ -1013,10 +1013,15 @@ public class ZKUtil { | |
| } | |
| private static ArrayList<ACL> createACL(ZooKeeperWatcher zkw, String node) { | |
| + return createACL(zkw, node, isSecureZooKeeper(zkw.getConfiguration())); | |
| + } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * | |
| * Licensed to the Apache Software Foundation (ASF) under one | |
| * or more contributor license agreements. See the NOTICE file | |
| * distributed with this work for additional information | |
| * regarding copyright ownership. The ASF licenses this file | |
| * to you under the Apache License, Version 2.0 (the | |
| * "License"); you may not use this file except in compliance | |
| * with the License. You may obtain a copy of the License at | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/IdLock.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/IdLock.java | |
| index b9d0983..8a0ec9b 100644 | |
| --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/IdLock.java | |
| +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/IdLock.java | |
| @@ -22,6 +22,9 @@ import java.io.IOException; | |
| import java.io.InterruptedIOException; | |
| import java.util.concurrent.ConcurrentHashMap; | |
| import java.util.concurrent.ConcurrentMap; | |
| +import java.util.concurrent.atomic.*; | |
| +import java.util.concurrent.*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://issues.apache.org/jira/secure/attachment/12739639/IdLockPerf.java | |
| Base IdLock (master) | |
| [T] 16920ms 17.730497op/ms | |
| [T] 17020ms 17.626322op/ms | |
| [T] 17204ms 17.437805op/ms | |
| [T] 17227ms 17.414524op/ms | |
| [T] 17181ms 17.46115op/ms | |
| [T] 17301ms 17.340038op/ms | |
| [T] 17364ms 17.277124op/ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static class Entry<T extends Comparable<T>> { | |
| private Entry<T> avlRight = null; | |
| private Entry<T> avlLeft = null; | |
| private int avlHeight = 1; | |
| private T key; | |
| public Entry(T k) { key = k;} | |
| public int compareKey(T cmpKey) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static class Entry<TKey extends Comparable<TKey>> { | |
| private Entry<TKey> avlParent = null; | |
| private Entry<TKey> avlRight = null; | |
| private Entry<TKey> avlLeft = null; | |
| private int avlHeight = 1; | |
| private final TKey key; | |
| public Entry(TKey key) { | |
| this.key = key; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import randint, shuffle | |
| from uuid import uuid4 | |
| from time import time, sleep | |
| import logging | |
| FORMAT = '%(asctime)s %(levelname)s %(funcName)s():%(lineno)d - %(message)s' | |
| logging.basicConfig(format=FORMAT) | |
| LOG = logging.getLogger('raft') |