- Messaging
- Baggage
Discuss what do we do with the TraceKeys in callables / runnables
| public class Trie { | |
| private static final char[] KEYS = "abcdefghijklmnopqrstuvwxyz".toCharArray(); | |
| private Map<Character, List<String>> data = new HashMap<>(KEYS.length); | |
| public Trie() { | |
| // init data | |
| for(Character key: KEYS) { | |
| data.put(key, new ArrayList<>()); | |
| } |
| import demo.client.OrderTypeEnum; | |
| import demo.client.SortTypeEnum; | |
| /** | |
| * Created by Max Malakhov on 9/7/16. | |
| */ | |
| public class QueryBuilder { | |
| private static final String PARAM_SOURCE_TYPE = "?site=stackoverflow"; |
| package java.util.concurrent; | |
| import java.util.concurrent.locks.*; | |
| import java.util.*; | |
| import java.io.Serializable; | |
| import java.io.IOException; | |
| import java.io.ObjectInputStream; | |
| import java.io.ObjectOutputStream; | |
| import java.io.ObjectStreamField; |
| package java.util; | |
| /** | |
| * A Red-Black tree based {@link NavigableMap} implementation. | |
| * The map is sorted according to the {@linkplain Comparable natural | |
| * ordering} of its keys, or by a {@link Comparator} provided at map | |
| * creation time, depending on which constructor is used. | |
| * | |
| * <p>This implementation provides guaranteed log(n) time cost for the | |
| * {@code containsKey}, {@code get}, {@code put} and {@code remove} |
| package java.util; | |
| /** | |
| * This class implements the <tt>Set</tt> interface, backed by a hash table | |
| * (actually a <tt>HashMap</tt> instance). It makes no guarantees as to the | |
| * iteration order of the set; in particular, it does not guarantee that the | |
| * order will remain constant over time. This class permits the <tt>null</tt> | |
| * element. | |
| * | |
| * <p>This class offers constant time performance for the basic operations |
| package java.util; | |
| /** | |
| * Doubly-linked list implementation of the {@code List} and {@code Deque} | |
| * interfaces. Implements all optional list operations, and permits all | |
| * elements (including {@code null}). | |
| * | |
| * <p>All of the operations perform as could be expected for a doubly-linked | |
| * list. Operations that index into the list will traverse the list from | |
| * the beginning or the end, whichever is closer to the specified index. |
| package java.util; | |
| /** | |
| * Resizable-array implementation of the <tt>List</tt> interface. Implements | |
| * all optional list operations, and permits all elements, including | |
| * <tt>null</tt>. In addition to implementing the <tt>List</tt> interface, | |
| * this class provides methods to manipulate the size of the array that is | |
| * used internally to store the list. (This class is roughly equivalent to | |
| * <tt>Vector</tt>, except that it is unsynchronized.) | |
| * |
| public class ReadWriteLock{ | |
| private int readers = 0; | |
| private int writers = 0; | |
| private int writeRequests = 0; | |
| public synchronized void lockRead() throws InterruptedException{ | |
| while(writers > 0 || writeRequests > 0){ | |
| wait(); | |
| } |
| // --- Compiling --- | |
| $ wget http://download.redis.io/releases/redis-2.8.3.tar.gz | |
| $ tar xzvf redis-2.8.3.tar.gz | |
| $ cd redis-2.8.3 | |
| $ make | |
| $ make install | |
| // --- or using yum --- | |
| $ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
| $ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm |