code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static boolean reduce(AbstractExpression expr, Predicate<AbstractExpression> pred) {
final boolean current = pred.test(expr);
if (current) {
return true;
} else if (expr == null) {
return pred.test(null);
} else {
return pred.test(expr.getLeft()... | java |
public static Collection<AbstractExpression> uncombineAny(AbstractExpression expr)
{
ArrayDeque<AbstractExpression> out = new ArrayDeque<AbstractExpression>();
if (expr != null) {
ArrayDeque<AbstractExpression> in = new ArrayDeque<AbstractExpression>();
// this chunk of code ... | java |
public static List<TupleValueExpression>
getTupleValueExpressions(AbstractExpression input)
{
ArrayList<TupleValueExpression> tves =
new ArrayList<TupleValueExpression>();
// recursive stopping steps
if (input == null)
{
return tves;
} else if (inp... | java |
private static boolean subqueryRequiresScalarValueExpressionFromContext(AbstractExpression parentExpr) {
if (parentExpr == null) {
// No context: we are a top-level expression. E.g, an item on the
// select list. In this case, assume the expression must be scalar.
return tr... | java |
private static AbstractExpression addScalarValueExpression(SelectSubqueryExpression expr) {
if (expr.getSubqueryScan().getOutputSchema().size() != 1) {
throw new PlanningErrorException("Scalar subquery can have only one output column");
}
expr.changeToScalarExprType();
Abst... | java |
public ClientResponseImpl shouldAccept(String name, AuthSystem.AuthUser user,
final StoredProcedureInvocation task,
final Procedure catProc) {
if (user.isAuthEnabled()) {
InvocationPermissionPolicy deniedPolicy = null;
I... | java |
@SuppressWarnings("deprecation")
public VoltTable[] run(SystemProcedureExecutionContext ctx,
String username,
String remoteHost,
String xmlConfig)
{
long oldLevels = 0;
if (ctx.isLowestSiteId()) {
// Lo... | java |
public void add(String item, String value) {
int maxChar = MaxLenInZChoice;
if (item.length() < MaxLenInZChoice) {
maxChar = item.length();
}
super.add(item.substring(0, maxChar));
values.addElement(value);
} | java |
private int findValue(String s) {
for (int i = 0; i < values.size(); i++) {
if (s.equals(values.elementAt(i))) {
return i;
} // end of if (s.equals(values.elementAt(i)))
} // end of for (int i=0; i<values.size(); i++)
return -1;
} | java |
public static ByteBuffer getNextChunk(byte[] schemaBytes, ByteBuffer buf,
CachedByteBufferAllocator resultBufferAllocator) {
buf.position(buf.position() + 4);//skip partition id
int length = schemaBytes.length + buf.remaining();
ByteBuffer outputBuffer ... | java |
private RestoreWork processMessage(DecodedContainer msg,
CachedByteBufferAllocator resultBufferAllocator) {
if (msg == null) {
return null;
}
RestoreWork restoreWork = null;
try {
if (msg.m_msgType == StreamSnapshotMessageTy... | java |
public static void copyFile(String fromPath, String toPath) throws Exception {
File inputFile = new File(fromPath);
File outputFile = new File(toPath);
com.google_voltpatches.common.io.Files.copy(inputFile, outputFile);
} | java |
public static String parseRevisionString(String fullBuildString) {
String build = "";
// Test for SVN revision string - example: https://svn.voltdb.com/eng/trunk?revision=2352
String[] splitted = fullBuildString.split("=", 2);
if (splitted.length == 2) {
build = splitted[1].... | java |
public static Object[] parseVersionString(String versionString) {
if (versionString == null) {
return null;
}
// check for whitespace
if (versionString.matches("\\s")) {
return null;
}
// split on the dots
String[] split = versionString.s... | java |
public static int compareVersions(Object[] left, Object[] right) {
if (left == null || right == null) {
throw new IllegalArgumentException("Invalid versions");
}
for (int i = 0; i < left.length; i++) {
// right is shorter than left and share the same prefix => left must ... | java |
public static boolean isPro() {
if (m_isPro == null) {
//Allow running pro kit as community.
if (!Boolean.parseBoolean(System.getProperty("community", "false"))) {
m_isPro = ProClass.load("org.voltdb.CommandLogImpl", "Command logging", ProClass.HANDLER_IGNORE)
... | java |
public static final long cheesyBufferCheckSum(ByteBuffer buffer) {
final int mypos = buffer.position();
buffer.position(0);
long checksum = 0;
if (buffer.hasArray()) {
final byte bytes[] = buffer.array();
final int end = buffer.arrayOffset() + mypos;
f... | java |
public static <T> T[] concatAll(final T[] empty, Iterable<T[]> arrayList) {
assert(empty.length == 0);
if (arrayList.iterator().hasNext() == false) {
return empty;
}
int len = 0;
for (T[] subArray : arrayList) {
len += subArray.length;
}
i... | java |
public static long getMBRss(Client client) {
assert(client != null);
long rssMax = 0;
try {
ClientResponse r = client.callProcedure("@Statistics", "MEMORY", 0);
VoltTable stats = r.getResults()[0];
stats.resetRowPosition();
while (stats.advanceRow(... | java |
public static <K, V> Multimap<K, V> zipToMap(List<K> keys, List<V> values)
{
if (keys.isEmpty() || values.isEmpty()) {
return null;
}
Iterator<K> keyIter = keys.iterator();
Iterator<V> valueIter = values.iterator();
ArrayListMultimap<K, V> result = ArrayListMulti... | java |
public static <K> List<K> zip(Collection<Deque<K>> stuff)
{
final List<K> result = Lists.newArrayList();
// merge the results
Iterator<Deque<K>> iter = stuff.iterator();
while (iter.hasNext()) {
final K next = iter.next().poll();
if (next != null) {
... | java |
public static <K extends Comparable<?>, V> ListMultimap<K, V> sortedArrayListMultimap()
{
Map<K, Collection<V>> map = Maps.newTreeMap();
return Multimaps.newListMultimap(map, new Supplier<List<V>>() {
@Override
public List<V> get()
{
return Lists.n... | java |
public static StoredProcedureInvocation roundTripForCL(StoredProcedureInvocation invocation) throws IOException
{
if (invocation.getSerializedParams() != null) {
return invocation;
}
ByteBuffer buf = ByteBuffer.allocate(invocation.getSerializedSize());
invocation.flattenT... | java |
public static Map<Integer, byte[]> getBinaryPartitionKeys(TheHashinator hashinator) {
Map<Integer, byte[]> partitionMap = new HashMap<>();
VoltTable partitionKeys = null;
if (hashinator == null) {
partitionKeys = TheHashinator.getPartitionKeys(VoltType.VARBINARY);
}
... | java |
public static Properties readPropertiesFromCredentials(String credentials) {
Properties props = new Properties();
File propFD = new File(credentials);
if (!propFD.exists() || !propFD.isFile() || !propFD.canRead()) {
throw new IllegalArgumentException("Credentials file " + credentials... | java |
public static int writeDeferredSerialization(ByteBuffer mbuf, DeferredSerialization ds) throws IOException
{
int written = 0;
try {
final int objStartPosition = mbuf.position();
ds.serialize(mbuf);
written = mbuf.position() - objStartPosition;
} finally {
... | java |
public NodeAVL getNode(int index) {
NodeAVL n = nPrimaryNode;
while (index-- > 0) {
n = n.nNext;
}
return n;
} | java |
NodeAVL getNextNode(NodeAVL n) {
if (n == null) {
n = nPrimaryNode;
} else {
n = n.nNext;
}
return n;
} | java |
private boolean listACLEquals(List<ACL> lista, List<ACL> listb) {
if (lista.size() != listb.size()) {
return false;
}
for (int i = 0; i < lista.size(); i++) {
ACL a = lista.get(i);
ACL b = listb.get(i);
if (!a.equals(b)) {
return fa... | java |
public synchronized Long convertAcls(List<ACL> acls) {
if (acls == null)
return -1L;
// get the value from the map
Long ret = aclKeyMap.get(acls);
// could not find the map
if (ret != null)
return ret;
long val = incrementIndex();
longKeyMa... | java |
public synchronized List<ACL> convertLong(Long longVal) {
if (longVal == null)
return null;
if (longVal == -1L)
return Ids.OPEN_ACL_UNSAFE;
List<ACL> acls = longKeyMap.get(longVal);
if (acls == null) {
LOG.error("ERROR: ACL not available for long " + l... | java |
public long approximateDataSize() {
long result = 0;
for (Map.Entry<String, DataNode> entry : nodes.entrySet()) {
DataNode value = entry.getValue();
synchronized (value) {
result += entry.getKey().length();
result += (value.data == null ? 0
... | java |
boolean isSpecialPath(String path) {
if (rootZookeeper.equals(path) || procZookeeper.equals(path)
|| quotaZookeeper.equals(path)) {
return true;
}
return false;
} | java |
public void updateCount(String lastPrefix, int diff) {
String statNode = Quotas.statPath(lastPrefix);
DataNode node = nodes.get(statNode);
StatsTrack updatedStat = null;
if (node == null) {
// should not happen
LOG.error("Missing count node for stat " + statNode);... | java |
public void deleteNode(String path, long zxid)
throws KeeperException.NoNodeException {
int lastSlash = path.lastIndexOf('/');
String parentName = path.substring(0, lastSlash);
String childName = path.substring(lastSlash + 1);
DataNode node = nodes.get(path);
if (node... | java |
private void getCounts(String path, Counts counts) {
DataNode node = getNode(path);
if (node == null) {
return;
}
String[] children = null;
int len = 0;
synchronized (node) {
Set<String> childs = node.getChildren();
if (childs != null) ... | java |
private void updateQuotaForPath(String path) {
Counts c = new Counts();
getCounts(path, c);
StatsTrack strack = new StatsTrack();
strack.setBytes(c.bytes);
strack.setCount(c.count);
String statPath = Quotas.quotaZookeeper + path + "/" + Quotas.statNode;
DataNode n... | java |
private void traverseNode(String path) {
DataNode node = getNode(path);
String children[] = null;
synchronized (node) {
Set<String> childs = node.getChildren();
if (childs != null) {
children = childs.toArray(new String[childs.size()]);
}
... | java |
private void setupQuota() {
String quotaPath = Quotas.quotaZookeeper;
DataNode node = getNode(quotaPath);
if (node == null) {
return;
}
traverseNode(quotaPath);
} | java |
public void dumpEphemerals(PrintWriter pwriter) {
Set<Long> keys = ephemerals.keySet();
pwriter.println("Sessions with Ephemerals ("
+ keys.size() + "):");
for (long k : keys) {
pwriter.print("0x" + Long.toHexString(k));
pwriter.println(":");
H... | java |
public int getCount() throws InterruptedException, KeeperException {
return ByteBuffer.wrap(m_zk.getData(m_path, false, null)).getInt();
} | java |
public boolean isCountedDown() throws InterruptedException, KeeperException {
if (countedDown) return true;
int count = ByteBuffer.wrap(m_zk.getData(m_path, false, null)).getInt();
if (count > 0) return false;
countedDown = true;
return true;
} | java |
private void copyTableSchemaFromShared() {
for (SchemaColumn scol : m_sharedScan.getOutputSchema()) {
SchemaColumn copy = new SchemaColumn(scol.getTableName(),
getTableAlias(),
scol.getColumnName(),
... | java |
public void harmonizeOutputSchema() {
boolean changedCurrent;
boolean changedBase;
boolean changedRecursive = false;
NodeSchema currentSchema = getOutputSchema();
NodeSchema baseSchema = getBestCostBasePlan().rootPlanGraph.getTrueOutputSchema(false);
NodeSchema recursiveS... | java |
private static void complete(AbstractFuture<?> future) {
boolean maskExecutorExceptions = future.maskExecutorExceptions;
Listener next = null;
outer: while (true) {
future.releaseWaiters();
// We call this before the listeners in order to avoid needing to manage a separate stack data
// st... | java |
public void addPath(String path) {
if (path == null) {
return;
}
String[] pathComponents = path.split("/");
TrieNode parent = rootNode;
String part = null;
if (pathComponents.length <= 1) {
throw new IllegalArgumentException("Invalid path " + path)... | java |
public void deletePath(String path) {
if (path == null) {
return;
}
String[] pathComponents = path.split("/");
TrieNode parent = rootNode;
String part = null;
if (pathComponents.length <= 1) {
throw new IllegalArgumentException("Invalid path " + pa... | java |
public String findMaxPrefix(String path) {
if (path == null) {
return null;
}
if ("/".equals(path)) {
return path;
}
String[] pathComponents = path.split("/");
TrieNode parent = rootNode;
List<String> components = new ArrayList<String>();
... | java |
public static VoltTable tableFromShorthand(String schema) {
String name = "T";
VoltTable.ColumnInfo[] columns = null;
// get a name
Matcher nameMatcher = m_namePattern.matcher(schema);
if (nameMatcher.find()) {
name = nameMatcher.group().trim();
}
/... | java |
private static void swap(Object[] w, int a, int b) {
Object t = w[a];
w[a] = w[b];
w[b] = t;
} | java |
synchronized void insertRowInTable(final VoltBulkLoaderRow nextRow) throws InterruptedException {
m_partitionRowQueue.put(nextRow);
if (m_partitionRowQueue.size() == m_minBatchTriggerSize) {
m_es.execute(new Runnable() {
@Override
public void run() {
... | java |
public static List<Field> getFields(Class<?> startClass) {
List<Field> currentClassFields = new ArrayList<Field>();
currentClassFields.addAll(Arrays.asList(startClass.getDeclaredFields()));
Class<?> parentClass = startClass.getSuperclass();
if (parentClass != null) {
List<Fie... | java |
public static synchronized void initialize(int myHostId, CatalogContext catalogContext, HostMessenger messenger) throws BundleException, IOException {
ImporterStatsCollector statsCollector = new ImporterStatsCollector(myHostId);
ImportManager em = new ImportManager(myHostId, messenger, statsCollector);
... | java |
private synchronized void create(CatalogContext catalogContext) {
try {
Map<String, ImportConfiguration> newProcessorConfig = loadNewConfigAndBundles(catalogContext);
restartImporters(newProcessorConfig);
} catch (final Exception e) {
VoltDB.crashLocalVoltDB("Error cr... | java |
private Map<String, ImportConfiguration> loadNewConfigAndBundles(CatalogContext catalogContext) {
Map<String, ImportConfiguration> newProcessorConfig;
ImportType importElement = catalogContext.getDeployment().getImport();
if (importElement == null || importElement.getConfiguration().isEmpty()) ... | java |
private boolean loadImporterBundle(Properties moduleProperties){
String importModuleName = moduleProperties.getProperty(ImportDataProcessor.IMPORT_MODULE);
String attrs[] = importModuleName.split("\\|");
String bundleJar = attrs[1];
String moduleType = attrs[0];
try {
... | java |
protected static void printCaughtException(String exceptionMessage) {
if (++countCaughtExceptions <= MAX_CAUGHT_EXCEPTION_MESSAGES) {
System.out.println(exceptionMessage);
}
if (countCaughtExceptions == MAX_CAUGHT_EXCEPTION_MESSAGES) {
System.out.println("In NonVoltDBBack... | java |
protected List<String> getAllColumns(String tableName) {
List<String> columns = new ArrayList<String>();
try {
// Lower-case table names are required for PostgreSQL; we might need to
// alter this if we use another comparison database (besides HSQL) someday
ResultSet ... | java |
protected List<String> getPrimaryKeys(String tableName) {
List<String> pkCols = new ArrayList<String>();
try {
// Lower-case table names are required for PostgreSQL; we might need to
// alter this if we use another comparison database (besides HSQL) someday
ResultSet ... | java |
protected List<String> getNonPrimaryKeyColumns(String tableName) {
List<String> columns = getAllColumns(tableName);
columns.removeAll(getPrimaryKeys(tableName));
return columns;
} | java |
protected String transformQuery(String query, QueryTransformer ... qts) {
String result = query;
for (QueryTransformer qt : qts) {
result = transformQuery(result, qt);
}
return result;
} | java |
static protected void printTransformedSql(String originalSql, String modifiedSql) {
if (transformedSqlFileWriter != null && !originalSql.equals(modifiedSql)) {
try {
transformedSqlFileWriter.write("original SQL: " + originalSql + "\n");
transformedSqlFileWriter.write(... | java |
private static SQLPatternPart makeGroup(boolean capture, String captureLabel, SQLPatternPart part)
{
// Need an outer part if capturing something that's already a group (capturing or not)
boolean alreadyGroup = (part.m_flags & (SQLPatternFactory.GROUP | SQLPatternFactory.CAPTURE)) != 0;
SQLP... | java |
public static HSQLInterface loadHsqldb(ParameterStateManager psMgr) {
// Specifically set the timezone to UTC to avoid the default usage local timezone in HSQL.
// This ensures that all VoltDB data paths use the same timezone for representing time.
TimeZone.setDefault(TimeZone.getTimeZone("GMT+0... | java |
public VoltXMLDiff runDDLCommandAndDiff(HSQLDDLInfo stmtInfo,
String ddl)
throws HSQLParseException
{
// name of the table we're going to have to diff (if any)
String expectedTableAffected = null;
// If ... | java |
public void runDDLCommand(String ddl) throws HSQLParseException {
sessionProxy.clearLocalTables();
Result result = sessionProxy.executeDirectStatement(ddl);
if (result.hasError()) {
throw new HSQLParseException(result.getMainString());
}
} | java |
private void fixupInStatementExpressions(VoltXMLElement expr) throws HSQLParseException {
if (doesExpressionReallyMeanIn(expr)) {
inFixup(expr);
// can't return because in with subquery can be nested
}
// recursive hunt
for (VoltXMLElement child : expr.children) ... | java |
private void inFixup(VoltXMLElement inElement) {
// make this an in expression
inElement.name = "operation";
inElement.attributes.put("optype", "in");
VoltXMLElement rowElem = null;
VoltXMLElement tableElem = null;
VoltXMLElement subqueryElem = null;
VoltXMLEleme... | java |
@SuppressWarnings("unused")
private void printTables() {
try {
String schemaName = sessionProxy.getSchemaName(null);
System.out.println("*** Tables For Schema: " + schemaName + " ***");
}
catch (HsqlException caught) {
caught.printStackTrace();
}
... | java |
public VoltXMLElement getXMLForTable(String tableName) throws HSQLParseException {
VoltXMLElement xml = emptySchema.duplicate();
// search all the tables XXX probably could do this non-linearly,
// but i don't know about case-insensitivity yet
HashMappedList hsqlTables = getHSQLTables(... | java |
private void calculateTrackers(Collection<TopicPartition> partitions) {
Map<TopicPartition, CommitTracker> trackers = new HashMap<>();
trackers.putAll(m_trackerMap.get());
Map<TopicPartition, AtomicLong> lastCommittedOffSets = new HashMap<>();
lastCommittedOffSets.putAll(m_lastCommitte... | java |
private void seek(List<TopicPartition> seekList) {
for (TopicPartition tp : seekList) {
AtomicLong lastCommittedOffset = m_lastCommittedOffSets.get().get(tp);
if (lastCommittedOffset != null && lastCommittedOffset.get() > -1L) {
AtomicLong lastSeeked = m_lastSeekedOffSets... | java |
public static String toZeroPaddedString(long value, int precision,
int maxSize) {
StringBuffer sb = new StringBuffer();
if (value < 0) {
value = -value;
}
String s = Long.toString(value);
if (s.length() > precision) {
s = s.substring(precis... | java |
public static String toLowerSubset(String source, char substitute) {
int len = source.length();
StringBuffer sb = new StringBuffer(len);
char ch;
for (int i = 0; i < len; i++) {
ch = source.charAt(i);
if (!Character.isLetterOrDigit(ch)) {
... | java |
public static String arrayToString(Object array) {
int len = Array.getLength(array);
int last = len - 1;
StringBuffer sb = new StringBuffer(2 * (len + 1));
sb.append('{');
for (int i = 0; i < len; i++) {
sb.append(Array.get(array, i));
... | java |
public static void appendPair(StringBuffer b, String s1, String s2,
String separator, String terminator) {
b.append(s1);
b.append(separator);
b.append(s2);
b.append(terminator);
} | java |
public static int rightTrimSize(String s) {
int i = s.length();
while (i > 0) {
i--;
if (s.charAt(i) != ' ') {
return i + 1;
}
}
return 0;
} | java |
public static int skipSpaces(String s, int start) {
int limit = s.length();
int i = start;
for (; i < limit; i++) {
if (s.charAt(i) != ' ') {
break;
}
}
return i;
} | java |
public static String[] split(String s, String separator) {
HsqlArrayList list = new HsqlArrayList();
int currindex = 0;
for (boolean more = true; more; ) {
int nextindex = s.indexOf(separator, currindex);
if (nextindex == -1) {
nextindex ... | java |
@Override
protected void populateColumnSchema(ArrayList<ColumnInfo> columns) {
super.populateColumnSchema(columns);
columns.add(new ColumnInfo(VoltSystemProcedure.CNAME_SITE_ID, VoltSystemProcedure.CTYPE_ID));
columns.add(new ColumnInfo(Columns.PARTITION_ID, VoltType.BIGINT));
column... | java |
private void offerInternal(Mailbox mailbox, Item item, long handle) {
m_bufferedReads.add(item);
releaseBufferedReads(mailbox, handle);
} | java |
public long sizeInBytes() throws IOException {
long memoryBlockUsage = 0;
for (StreamBlock b : m_memoryDeque) {
//Use only total size, but throw in the USO
//to make book keeping consistent when flushed to disk
//Also dont count persisted blocks.
memoryBlo... | java |
public void truncateToSequenceNumber(final long truncationSeqNo) throws IOException {
assert(m_memoryDeque.isEmpty());
m_persistentDeque.parseAndTruncate(new BinaryDequeTruncator() {
@Override
public TruncatorResponse parse(BBContainer bbc) {
ByteBuffer b = bbc.b... | java |
public int set(int pos) {
while (pos >= capacity) {
doubleCapacity();
}
if (pos >= limitPos) {
limitPos = pos + 1;
}
int windex = pos >> 5;
int mask = 0x80000000 >>> (pos & 0x1F);
int word = map[windex];
int result = (word & ... | java |
public static void and(byte[] map, int pos, byte source, int count) {
int shift = pos & 0x07;
int mask = (source & 0xff) >>> shift;
int innermask = 0xff >> shift;
int index = pos / 8;
if (count < 8) {
innermask = innermask >>> (8 - count);
i... | java |
public static void or(byte[] map, int pos, byte source, int count) {
int shift = pos & 0x07;
int mask = (source & 0xff) >>> shift;
int index = pos / 8;
if (index >= map.length) {
return;
}
byte b = (byte) (map[index] | mask);
map[index] = b;
... | java |
public synchronized boolean addUnsorted(int key, int value) {
if (count == capacity) {
if (fixedSize) {
return false;
} else {
doubleCapacity();
}
}
if (sorted && count != 0) {
if (sortOnValues) {
i... | java |
public synchronized boolean addUnique(int key, int value) {
if (count == capacity) {
if (fixedSize) {
return false;
} else {
doubleCapacity();
}
}
if (!sorted) {
fastQuickSort();
}
targetSearchValu... | java |
private int binaryFirstSearch() {
int low = 0;
int high = count;
int mid = 0;
int compare = 0;
int found = count;
while (low < high) {
mid = (low + high) / 2;
compare = compare(mid);
if (compare < 0) {
... | java |
private int binaryGreaterSearch() {
int low = 0;
int high = count;
int mid = 0;
int compare = 0;
while (low < high) {
mid = (low + high) / 2;
compare = compare(mid);
if (compare < 0) {
high = mid;
}... | java |
private int binarySlotSearch() {
int low = 0;
int high = count;
int mid = 0;
int compare = 0;
while (low < high) {
mid = (low + high) / 2;
compare = compare(mid);
if (compare <= 0) {
high = mid;
} e... | java |
private int binaryEmptySlotSearch() {
int low = 0;
int high = count;
int mid = 0;
int compare = 0;
while (low < high) {
mid = (low + high) / 2;
compare = compare(mid);
if (compare < 0) {
high = mid;
... | java |
private int compare(int i) {
if (sortOnValues) {
if (targetSearchValue > values[i]) {
return 1;
} else if (targetSearchValue < values[i]) {
return -1;
}
} else {
if (targetSearchValue > keys[i]) {
return 1;
... | java |
private boolean lessThan(int i, int j) {
if (sortOnValues) {
if (values[i] < values[j]) {
return true;
}
} else {
if (keys[i] < keys[j]) {
return true;
}
}
return false;
} | java |
public static void setFontSize(String inFontSize) {
// weconsultants@users 20050215 - Changed for Compatbilty fix for JDK 1.3
// Convert Strng to float for deriveFont() call
Float stageFloat = new Float(inFontSize);
float fontSize = stageFloat.floatValue();
Font fonttTree = ... | java |
public Host lookup(final String hostName) {
final Map<String, Host> cache = this.refresh();
Host h = cache.get(hostName);
if(h == null) {
h = new Host();
}
if(h.patternsApplied) {
return h;
}
for(final Map.Entry<String, Host> e : cache.ent... | java |
public static ListeningExecutorService getCachedSingleThreadExecutor(String name, long keepAlive) {
return MoreExecutors.listeningDecorator(new ThreadPoolExecutor(
0,
1,
keepAlive,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runn... | java |
public static ListeningExecutorService getBoundedSingleThreadExecutor(String name, int capacity) {
LinkedBlockingQueue<Runnable> lbq = new LinkedBlockingQueue<Runnable>(capacity);
ThreadPoolExecutor tpe =
new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, lbq, CoreUtils.getThreadFac... | java |
public static ThreadPoolExecutor getBoundedThreadPoolExecutor(int maxPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory tFactory) {
return new ThreadPoolExecutor(0, maxPoolSize, keepAliveTime, unit,
new SynchronousQueue<Runnable>(), tFactory);
} | java |
public static ExecutorService getQueueingExecutorService(final Queue<Runnable> taskQueue) {
return new ExecutorService() {
@Override
public void execute(Runnable command) {
taskQueue.offer(command);
}
@Override
public void shutdown() {... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.