code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public long total(ByteBuffer context)
{
long total = 0L;
// we could use a ContextState but it is easy enough that we avoid the object creation
for (int offset = context.position() + headerLength(context); offset < context.limit(); offset += STEP_LENGTH)
total += context.getLong(... | java |
public static List<? extends IResource> chain(IResource resource)
{
List<IResource> chain = new ArrayList<IResource>();
while (true)
{
chain.add(resource);
if (!resource.hasParent())
break;
resource = resource.getParent();
}
ret... | java |
public void dumpInterArrivalTimes()
{
File file = FileUtils.createTempFile("failuredetector-", ".dat");
OutputStream os = null;
try
{
os = new BufferedOutputStream(new FileOutputStream(file, true));
os.write(toString().getBytes());
}
catch (IO... | java |
double phi(long tnow)
{
assert arrivalIntervals.size() > 0 && tLast > 0; // should not be called before any samples arrive
long t = tnow - tLast;
return t / mean();
} | java |
public static int pop(long x) {
/* Hacker's Delight 32 bit pop function:
* http://www.hackersdelight.org/HDcode/newCode/pop_arrayHS.cc
*
int pop(unsigned x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0F0F0F0F;
x = x + (x >> 8);... | java |
public static int ntz(long val) {
// A full binary search to determine the low byte was slower than
// a linear search for nextSetBit(). This is most likely because
// the implementation of nextSetBit() shifts bits to the right, increasing
// the probability that the first non-zero byte is in the rhs.
... | java |
public static int ntz(int val) {
// This implementation does a single binary search at the top level only.
// In addition, the case of a non-zero first byte is checked for first
// because it is the most common in dense bit arrays.
int lowByte = val & 0xff;
if (lowByte != 0) return ntzTable[lowByte... | java |
public boolean intersects(Iterable<Range<T>> ranges)
{
for (Range<T> range2 : ranges)
{
if (range2.intersects(this))
return true;
}
return false;
} | java |
private void warmup(OpDistributionFactory operations)
{
// warmup - do 50k iterations; by default hotspot compiles methods after 10k invocations
PrintStream warmupOutput = new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { } } );
int iterations = 500... | java |
public static boolean isSuperuser(String username)
{
UntypedResultSet result = selectUser(username);
return !result.isEmpty() && result.one().getBoolean("super");
} | java |
public static void deleteUser(String username) throws RequestExecutionException
{
QueryProcessor.process(String.format("DELETE FROM %s.%s WHERE name = '%s'",
AUTH_KS,
USERS_CF,
... | java |
public static void setup()
{
if (DatabaseDescriptor.getAuthenticator() instanceof AllowAllAuthenticator)
return;
setupAuthKeyspace();
setupTable(USERS_CF, USERS_CF_SCHEMA);
DatabaseDescriptor.getAuthenticator().setup();
DatabaseDescriptor.getAuthorizer().setup()... | java |
private static ConsistencyLevel consistencyForUser(String username)
{
if (username.equals(DEFAULT_SUPERUSER_NAME))
return ConsistencyLevel.QUORUM;
else
return ConsistencyLevel.LOCAL_ONE;
} | java |
public static void setupTable(String name, String cql)
{
if (Schema.instance.getCFMetaData(AUTH_KS, name) == null)
{
try
{
CFStatement parsed = (CFStatement)QueryProcessor.parseStatement(cql);
parsed.prepareKeyspace(AUTH_KS);
Cr... | java |
private Multimap<Range<Token>, InetAddress> getAllRangesWithSourcesFor(String keyspaceName, Collection<Range<Token>> desiredRanges)
{
AbstractReplicationStrategy strat = Keyspace.open(keyspaceName).getReplicationStrategy();
Multimap<Range<Token>, InetAddress> rangeAddresses = strat.getRangeAddresses... | java |
private Multimap<Range<Token>, InetAddress> getAllRangesWithStrictSourcesFor(String table, Collection<Range<Token>> desiredRanges)
{
assert tokens != null;
AbstractReplicationStrategy strat = Keyspace.open(table).getReplicationStrategy();
//Active ranges
TokenMetadata metadataClone... | java |
Multimap<String, Map.Entry<InetAddress, Collection<Range<Token>>>> toFetch()
{
return toFetch;
} | java |
private void validate(List<ByteBuffer> variables) throws InvalidRequestException
{
// Ensure that exactly one key has been specified.
if (keyValidator.size() < 1)
throw new InvalidRequestException("You must specify a PRIMARY KEY");
else if (keyValidator.size() > 1)
th... | java |
public int recover() throws IOException
{
FilenameFilter unmanagedFilesFilter = new FilenameFilter()
{
public boolean accept(File dir, String name)
{
// we used to try to avoid instantiating commitlog (thus creating an empty segment ready for writes)
... | java |
public int recover(File... clogs) throws IOException
{
CommitLogReplayer recovery = new CommitLogReplayer();
recovery.recover(clogs);
return recovery.blockForWrites();
} | java |
public void sync(boolean syncAllSegments)
{
CommitLogSegment current = allocator.allocatingFrom();
for (CommitLogSegment segment : allocator.getActiveSegments())
{
if (!syncAllSegments && segment.id > current.id)
return;
segment.sync();
}
} | java |
public ReplayPosition add(Mutation mutation)
{
assert mutation != null;
long size = Mutation.serializer.serializedSize(mutation, MessagingService.current_version);
long totalSize = size + ENTRY_OVERHEAD_SIZE;
if (totalSize > MAX_MUTATION_SIZE)
{
throw new Illega... | java |
public void discardCompletedSegments(final UUID cfId, final ReplayPosition context)
{
logger.debug("discard completed log segments for {}, column family {}", context, cfId);
// Go thru the active segment files, which are ordered oldest to newest, marking the
// flushed CF as clean, until we... | java |
public void shutdownBlocking() throws InterruptedException
{
executor.shutdown();
executor.awaitTermination();
allocator.shutdown();
allocator.awaitTermination();
} | java |
public static Bounds<RowPosition> makeRowBounds(Token left, Token right, IPartitioner partitioner)
{
return new Bounds<RowPosition>(left.minKeyBound(partitioner), right.maxKeyBound(partitioner), partitioner);
} | java |
public double rankLatency(float rank)
{
if (sample.length == 0)
return 0;
int index = (int)(rank * sample.length);
if (index >= sample.length)
index = sample.length - 1;
return sample[index] * 0.000001d;
} | java |
private double maxScore(List<InetAddress> endpoints)
{
double maxScore = -1.0;
for (InetAddress endpoint : endpoints)
{
Double score = scores.get(endpoint);
if (score == null)
continue;
if (score > maxScore)
maxScore = scor... | java |
public static FSError findNested(Throwable top)
{
for (Throwable t = top; t != null; t = t.getCause())
{
if (t instanceof FSError)
return (FSError) t;
}
return null;
} | java |
private static double hotness(SSTableReader sstr)
{
// system tables don't have read meters, just use 0.0 for the hotness
return sstr.getReadMeter() == null ? 0.0 : sstr.getReadMeter().twoHourRate() / sstr.estimatedKeys();
} | java |
public static String unescapeSQLString(String b)
{
if (b.charAt(0) == '\'' && b.charAt(b.length()-1) == '\'')
b = b.substring(1, b.length()-1);
return StringEscapeUtils.unescapeJava(b);
} | java |
public static IndexOperator getIndexOperator(String operator)
{
if (operator.equals("="))
{
return IndexOperator.EQ;
}
else if (operator.equals(">="))
{
return IndexOperator.GTE;
}
else if (operator.equals(">"))
{
re... | java |
public static Set<String> getCfNamesByKeySpace(KsDef keySpace)
{
Set<String> names = new LinkedHashSet<String>();
for (CfDef cfDef : keySpace.getCf_defs())
{
names.add(cfDef.getName());
}
return names;
} | java |
public static KsDef getKeySpaceDef(String keyspaceName, List<KsDef> keyspaces)
{
keyspaceName = keyspaceName.toUpperCase();
for (KsDef ksDef : keyspaces)
{
if (ksDef.name.toUpperCase().equals(keyspaceName))
return ksDef;
}
return null;
} | java |
public Hlr getViewHlr(final String hlrId) throws GeneralException, UnauthorizedException, NotFoundException {
if (hlrId == null) {
throw new IllegalArgumentException("Hrl ID must be specified.");
}
return messageBirdService.requestByID(HLRPATH, hlrId, Hlr.class);
} | java |
public MessageResponse sendMessage(final Message message) throws UnauthorizedException, GeneralException {
return messageBirdService.sendPayLoad(MESSAGESPATH, message, MessageResponse.class);
} | java |
public MessageResponse sendFlashMessage(final String originator, final String body, final List<BigInteger> recipients) throws UnauthorizedException, GeneralException {
final Message message = new Message(originator, body, recipients);
message.setType(MsgType.flash);
return messageBirdService.sen... | java |
public void deleteMessage(final String id) throws UnauthorizedException, GeneralException, NotFoundException {
if (id == null) {
throw new IllegalArgumentException("Message ID must be specified.");
}
messageBirdService.deleteByID(MESSAGESPATH, id);
} | java |
public void deleteVoiceMessage(final String id) throws UnauthorizedException, GeneralException, NotFoundException {
if (id == null) {
throw new IllegalArgumentException("Message ID must be specified.");
}
messageBirdService.deleteByID(VOICEMESSAGESPATH, id);
} | java |
public VoiceMessageList listVoiceMessages(final Integer offset, final Integer limit) throws UnauthorizedException, GeneralException {
if (offset != null && offset < 0) {
throw new IllegalArgumentException("Offset must be > 0");
}
if (limit != null && limit < 0) {
throw ne... | java |
void deleteContact(final String id) throws NotFoundException, GeneralException, UnauthorizedException {
if (id == null) {
throw new IllegalArgumentException("Contact ID must be specified.");
}
messageBirdService.deleteByID(CONTACTPATH, id);
} | java |
public Contact sendContact(final ContactRequest contactRequest) throws UnauthorizedException, GeneralException {
return messageBirdService.sendPayLoad(CONTACTPATH, contactRequest, Contact.class);
} | java |
public Contact updateContact(final String id, ContactRequest contactRequest) throws UnauthorizedException, GeneralException {
if (id == null) {
throw new IllegalArgumentException("Contact ID must be specified.");
}
String request = CONTACTPATH + "/" + id;
return messageBirdSe... | java |
public Contact viewContact(final String id) throws NotFoundException, GeneralException, UnauthorizedException {
if (id == null) {
throw new IllegalArgumentException("Contact ID must be specified.");
}
return messageBirdService.requestByID(CONTACTPATH, id, Contact.class);
} | java |
public void deleteGroup(final String id) throws NotFoundException, GeneralException, UnauthorizedException {
if (id == null) {
throw new IllegalArgumentException("Group ID must be specified.");
}
messageBirdService.deleteByID(GROUPPATH, id);
} | java |
public void deleteGroupContact(final String groupId, final String contactId) throws NotFoundException, GeneralException, UnauthorizedException {
if (groupId == null) {
throw new IllegalArgumentException("Group ID must be specified.");
}
if (contactId == null) {
throw new ... | java |
public Group sendGroup(final GroupRequest groupRequest) throws UnauthorizedException, GeneralException {
return messageBirdService.sendPayLoad(GROUPPATH, groupRequest, Group.class);
} | java |
public void sendGroupContact(final String groupId, final String[] contactIds) throws NotFoundException, GeneralException, UnauthorizedException {
// reuestByID appends the "ID" to the base path, so this workaround
// lets us add a query string.
String path = String.format("%s%s?%s", groupId, CON... | java |
public Group updateGroup(final String id, final GroupRequest groupRequest) throws UnauthorizedException, GeneralException {
if (id == null) {
throw new IllegalArgumentException("Group ID must be specified.");
}
String path = String.format("%s/%s", GROUPPATH, id);
return messa... | java |
public Group viewGroup(final String id) throws NotFoundException, GeneralException, UnauthorizedException {
if (id == null) {
throw new IllegalArgumentException("Group ID must be specified.");
}
return messageBirdService.requestByID(GROUPPATH, id, Group.class);
} | java |
public Conversation viewConversation(final String id) throws NotFoundException, GeneralException, UnauthorizedException {
if (id == null) {
throw new IllegalArgumentException("Id must be specified");
}
String url = CONVERSATIONS_BASE_URL + CONVERSATION_PATH;
return messageBir... | java |
public Conversation updateConversation(final String id, final ConversationStatus status)
throws UnauthorizedException, GeneralException {
if (id == null) {
throw new IllegalArgumentException("Id must be specified.");
}
String url = String.format("%s%s/%s", CONVERSATIONS_B... | java |
public ConversationList listConversations(final int offset, final int limit)
throws UnauthorizedException, GeneralException {
String url = CONVERSATIONS_BASE_URL + CONVERSATION_PATH;
return messageBirdService.requestList(url, offset, limit, ConversationList.class);
} | java |
public Conversation startConversation(ConversationStartRequest request)
throws UnauthorizedException, GeneralException {
String url = String.format("%s%s/start", CONVERSATIONS_BASE_URL, CONVERSATION_PATH);
return messageBirdService.sendPayLoad(url, request, Conversation.class);
} | java |
public ConversationMessageList listConversationMessages(
final String conversationId,
final int offset,
final int limit
) throws UnauthorizedException, GeneralException {
String url = String.format(
"%s%s/%s%s",
CONVERSATIONS_BASE_URL,
... | java |
public ConversationMessageList listConversationMessages(
final String conversationId
) throws UnauthorizedException, GeneralException {
final int offset = 0;
final int limit = 10;
return listConversationMessages(conversationId, offset, limit);
} | java |
public ConversationMessage viewConversationMessage(final String messageId)
throws NotFoundException, GeneralException, UnauthorizedException {
String url = CONVERSATIONS_BASE_URL + CONVERSATION_MESSAGE_PATH;
return messageBirdService.requestByID(url, messageId, ConversationMessage.class);
... | java |
public ConversationMessage sendConversationMessage(
final String conversationId,
final ConversationMessageRequest request
) throws UnauthorizedException, GeneralException {
String url = String.format(
"%s%s/%s%s",
CONVERSATIONS_BASE_URL,
... | java |
public void deleteConversationWebhook(final String webhookId)
throws NotFoundException, GeneralException, UnauthorizedException {
String url = CONVERSATIONS_BASE_URL + CONVERSATION_WEBHOOK_PATH;
messageBirdService.deleteByID(url, webhookId);
} | java |
public ConversationWebhook sendConversationWebhook(final ConversationWebhookRequest request)
throws UnauthorizedException, GeneralException {
String url = CONVERSATIONS_BASE_URL + CONVERSATION_WEBHOOK_PATH;
return messageBirdService.sendPayLoad(url, request, ConversationWebhook.class);
} | java |
public ConversationWebhook viewConversationWebhook(final String webhookId) throws NotFoundException, GeneralException, UnauthorizedException {
String url = CONVERSATIONS_BASE_URL + CONVERSATION_WEBHOOK_PATH;
return messageBirdService.requestByID(url, webhookId, ConversationWebhook.class);
} | java |
ConversationWebhookList listConversationWebhooks(final int offset, final int limit)
throws UnauthorizedException, GeneralException {
String url = CONVERSATIONS_BASE_URL + CONVERSATION_WEBHOOK_PATH;
return messageBirdService.requestList(url, offset, limit, ConversationWebhookList.class);
... | java |
public VoiceCallResponse sendVoiceCall(final VoiceCall voiceCall) throws UnauthorizedException, GeneralException {
if (voiceCall.getSource() == null) {
throw new IllegalArgumentException("Source of voice call must be specified.");
}
if (voiceCall.getDestination() == null) {
... | java |
public VoiceCallResponseList listAllVoiceCalls(Integer page, Integer pageSize) throws GeneralException, UnauthorizedException {
String url = String.format("%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH);
return messageBirdService.requestList(url, new PagedPaging(page, pageSize), VoiceCallResponseList.clas... | java |
public VoiceCallResponse viewVoiceCall(final String id) throws NotFoundException, GeneralException, UnauthorizedException {
if (id == null) {
throw new IllegalArgumentException("Voice Message ID must be specified.");
}
String url = String.format("%s%s", VOICE_CALLS_BASE_URL, VOICECA... | java |
public void deleteVoiceCall(final String id) throws NotFoundException, GeneralException, UnauthorizedException {
if (id == null) {
throw new IllegalArgumentException("Voice Message ID must be specified.");
}
String url = String.format("%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH);
... | java |
public VoiceCallLegResponse viewCallLegsByCallId(String callId, Integer page, Integer pageSize) throws UnsupportedEncodingException, UnauthorizedException, GeneralException {
if (callId == null) {
throw new IllegalArgumentException("Voice call ID must be specified.");
}
String url =... | java |
public VoiceCallLeg viewCallLegByCallIdAndLegId(final String callId, String legId) throws UnsupportedEncodingException, NotFoundException, GeneralException, UnauthorizedException {
if (callId == null) {
throw new IllegalArgumentException("Voice call ID must be specified.");
}
if (le... | java |
public WebhookResponseData createWebHook(Webhook webhook) throws UnauthorizedException, GeneralException {
if (webhook.getTitle() == null) {
throw new IllegalArgumentException("Title of webhook must be specified.");
}
if (webhook.getUrl() == null) {
throw new IllegalArgu... | java |
public WebhookResponseData viewWebHook(String id) throws NotFoundException, GeneralException, UnauthorizedException {
if (id == null) {
throw new IllegalArgumentException("Id of webHook must be specified.");
}
String url = String.format("%s%s", VOICE_CALLS_BASE_URL, WEBHOOKS);
... | java |
private byte[] computeSignature(Request request) {
String timestampAndQuery = request.getTimestamp() + '\n' +
request.getSortedQueryParameters() + '\n';
byte[] timestampAndQueryBytes = timestampAndQuery.getBytes(CHARSET_UTF8);
byte[] bodyHashBytes = getSha256Hash(request.getData... | java |
private byte[] appendArrays(byte[] first, byte[] second) {
byte[] result = new byte[first.length + second.length];
System.arraycopy(first, 0, result, 0, first.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
} | java |
<P> APIResponse doRequest(final String method, final String url, final P payload) throws GeneralException {
HttpURLConnection connection = null;
InputStream inputStream = null;
if (METHOD_PATCH.equalsIgnoreCase(method)) {
// It'd perhaps be cleaner to call this in the constructor, b... | java |
private static String[] getAllowedMethods(String[] existingMethods) {
int listCapacity = existingMethods.length + 1;
List<String> allowedMethods = new ArrayList<>(listCapacity);
allowedMethods.addAll(Arrays.asList(existingMethods));
allowedMethods.add(METHOD_PATCH);
return all... | java |
private String readToEnd(InputStream inputStream) {
Scanner scanner = new Scanner(inputStream).useDelimiter("\\A");
return scanner.hasNext() ? scanner.next() : "";
} | java |
private boolean isURLAbsolute(String url) {
for (String protocol : PROTOCOLS) {
if (url.startsWith(protocol)) {
return true;
}
}
return false;
} | java |
public <P> HttpURLConnection getConnection(final String serviceUrl, final P postData, final String requestType) throws IOException {
if (requestType == null || !REQUEST_METHODS.contains(requestType)) {
throw new IllegalArgumentException(String.format(REQUEST_METHOD_NOT_ALLOWED, requestType));
... | java |
private List<ErrorReport> getErrorReportOrNull(final String body) {
ObjectMapper objectMapper = new ObjectMapper();
try {
JsonNode jsonNode = objectMapper.readValue(body, JsonNode.class);
ErrorReport[] errors = objectMapper.readValue(jsonNode.get("errors").toString(), ErrorRepor... | java |
private String getPathVariables(final Map<String, Object> map) {
final StringBuilder bpath = new StringBuilder();
for (Map.Entry<String, Object> param : map.entrySet()) {
if (bpath.length() > 1) {
bpath.append("&");
}
try {
bpath.append... | java |
public void setPremiumSMS(Object shortcode, Object keyword, Object tariff, Object mid) {
final Map<String, Object> premiumSMSConfig = new LinkedHashMap<String, Object>(4);
premiumSMSConfig.put("shortcode", shortcode);
premiumSMSConfig.put("keyword", keyword);
premiumSMSConfig.put("tariff... | java |
public static ConversationHsmLocalizableParameter defaultValue(final String defaultValue) {
ConversationHsmLocalizableParameter parameter = new ConversationHsmLocalizableParameter();
parameter.defaultValue = defaultValue;
return parameter;
} | java |
public static ConversationHsmLocalizableParameter currency(final String defaultValue, final String code, final int amount) {
ConversationHsmLocalizableParameter parameter = new ConversationHsmLocalizableParameter();
parameter.defaultValue = defaultValue;
parameter.currency = new ConversationHsmL... | java |
public static InetAddress getInetAddress(String hostName) {
try {
return InetAddress.getByName(hostName);
} catch (UnknownHostException e) {
throw new IllegalStateException("Unknown host: " + e.getMessage() +
". Make sure you have specified the 'GelfUDPAppende... | java |
private Map<String, Object> mapFields(E logEvent) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("host", host);
map.put("full_message", fullMessageLayout.doLayout(logEvent));
map.put("short_message", shortMessageLayout.doLayout(logEvent));
stackTraceField(m... | java |
private void additionalFields(Map<String, Object> map, ILoggingEvent eventObject) {
if (useLoggerName) {
map.put("_loggerName", eventObject.getLoggerName());
}
if(useMarker && eventHasMarker(eventObject)) {
map.put("_marker", eventObject.getMarker().toString());
... | java |
public void addAdditionalField(String keyValue) {
String[] splitted = keyValue.split(":");
if (splitted.length != 2) {
throw new IllegalArgumentException("additionalField must be of the format key:value, where key is the MDC "
+ "key, and value is the GELF field name. B... | java |
public void addStaticAdditionalField(String keyValue) {
String[] splitted = keyValue.split(":");
if (splitted.length != 2) {
throw new IllegalArgumentException("staticAdditionalField must be of the format key:value, where key is the "
+ "additional field key (therefore ... | java |
public byte[] get() {
// Uniqueness is guaranteed by combining the hostname and the current nano second, hashing the result, and
// selecting the first x bytes of the result
String timestamp = String.valueOf(System.nanoTime());
byte[] digestString = (hostname + timestamp).getBytes();
... | java |
public static ObjectComparatorFactory newInstance(
final String objectComparatorFactoryClassName)
throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (ObjectComparatorFactory) Class.forName(objectComparatorFactoryClassName).newInstance();
} | java |
public static ObjectComparatorFactory newInstance(final String objectComparatorFactoryClassName,
final ClassLoader classLoader)
throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (ObjectComparatorFactory) Class
.forName(objectComparatorFactoryClassName, true, ... | java |
public static Initializer defaultInitializer() {
return newInitializer()
.setCloseConcurrency(0)
.setTestOnLogicalOpen(false)
.setTestOnLogicalClose(false)
.setIncompleteTransactionOnClosePolicy(ConnectionPoolConnection.IncompleteTransactionPolicy.REPORT)
... | java |
private void reopen(final ConnectionPoolConnection conn) {
if(isActive) {
if(conn.reopenAttempts == 0) {
conn.reopenAttempts++;
reopenService.execute(new Reopener(conn));
} else {
long delayMillis = 100L * conn.reopenAttempts;
if(delayMillis > max... | java |
final void close(final ConnectionPoolConnection conn) {
if(closeQueue != null) {
closeQueue.add(conn);
} else {
closer.close(conn);
}
} | java |
final String getPassword() {
if(passwordSource == null) {
return dbConnection.password;
} else {
String usePassword = passwordSource.getPassword(dbConnection.name);
if(!Strings.isNullOrEmpty(usePassword)) {
return usePassword;
} else {
usePassword ... | java |
private Connection createRealConnection(final long timeoutMillis) throws SQLException {
if(timeoutMillis < 1L) {
String usePassword = getPassword();
Connection conn = dbConnection.datasource == null ?
DriverManager.getConnection(dbConnection.connectionString, dbConnection.use... | java |
final void activate() throws SQLException {
for(ConnectionPoolConnection conn : connections) {
conn.forceRealClose();
conn.realOpen();
conn.logicalClose(true); //Tests the connection
}
if(closeQueue != null) {
closeQueue.clear();
}
availableQueue.clear... | java |
final boolean isIdle() {
for(ConnectionPoolConnection conn : connections) {
if(conn.state.get() == ConnectionPoolConnection.STATE_OPEN) {
return false;
}
}
return true;
} | java |
final void deactivateNow() {
isActive = false;
stats.deactivate();
availableQueue.clear();
reopenExecutor.getQueue().clear();
for(ConnectionPoolConnection conn : connections) {
conn.forceRealClose();
conn.state.set(ConnectionPoolConnection.STATE_DISCONNECTED);
}
... | java |
public final int getActiveConnectionCount() {
if(!isActive) {
return 0;
}
int count = 0;
for(ConnectionPoolConnection conn : connections) {
if(conn.state.get() != ConnectionPoolConnection.STATE_AVAILABLE) {
count++;
}
}
return count;
} | java |
void logError(final String message) {
if(logger != null) {
try {
StringBuilder buf = new StringBuilder(name);
buf.append(":");
buf.append(message);
logger.error(buf.toString());
} catch(Throwable t) {
//Ignore - logging shou... | java |
static final String getStack(final boolean filter) {
StringBuilder buf = new StringBuilder();
StackTraceElement[] stack = Thread.currentThread().getStackTrace();
for(int i = 2; i < stack.length; i++) {
if(!filter) {
buf.append(stack[i].toString());
buf.append(NEW_LINE)... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.