_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q22600 | SQLiteConnectionPool.dump | train | public void dump(Printer printer, boolean verbose) {
Printer indentedPrinter = printer;
synchronized (mLock) {
printer.println("Connection pool for " + mConfiguration.path + ":");
printer.println(" Open: " + mIsOpen);
printer.println(" Max connections: " + mMaxConne... | java | {
"resource": ""
} |
q22601 | HandshakeReader.readStatusLine | train | private StatusLine readStatusLine(WebSocketInputStream input) throws WebSocketException
{
String line;
try
{
// Read the status line.
line = input.readLine();
}
catch (IOException e)
{
// Failed to read an opening handshake respons... | java | {
"resource": ""
} |
q22602 | HandshakeReader.readBody | train | private byte[] readBody(Map<String, List<String>> headers, WebSocketInputStream input)
{
// Get the value of "Content-Length" header.
int length = getContentLength(headers);
if (length <= 0)
{
// Response body is not available.
return null;
}
... | java | {
"resource": ""
} |
q22603 | HandshakeReader.getContentLength | train | private int getContentLength(Map<String, List<String>> headers)
{
try
{
return Integer.parseInt(headers.get("Content-Length").get(0));
}
catch (Exception e)
{
return -1;
}
} | java | {
"resource": ""
} |
q22604 | WebSocketExtension.setParameter | train | public WebSocketExtension setParameter(String key, String value)
{
// Check the validity of the key.
if (Token.isValid(key) == false)
{
// The key is not a valid token.
throw new IllegalArgumentException("'key' is not a valid token.");
}
// If the val... | java | {
"resource": ""
} |
q22605 | WebSocketFrame.setPayload | train | public WebSocketFrame setPayload(byte[] payload)
{
if (payload != null && payload.length == 0)
{
payload = null;
}
mPayload = payload;
return this;
} | java | {
"resource": ""
} |
q22606 | WebSocketFrame.setPayload | train | public WebSocketFrame setPayload(String payload)
{
if (payload == null || payload.length() == 0)
{
return setPayload((byte[])null);
}
return setPayload(Misc.getBytesUTF8(payload));
} | java | {
"resource": ""
} |
q22607 | WebSocketFrame.setCloseFramePayload | train | public WebSocketFrame setCloseFramePayload(int closeCode, String reason)
{
// Convert the close code to a 2-byte unsigned integer
// in network byte order.
byte[] encodedCloseCode = new byte[] {
(byte)((closeCode >> 8) & 0xFF),
(byte)((closeCode ) & 0xFF)
... | java | {
"resource": ""
} |
q22608 | WebSocketFrame.getCloseCode | train | public int getCloseCode()
{
if (mPayload == null || mPayload.length < 2)
{
return WebSocketCloseCode.NONE;
}
// A close code is encoded in network byte order.
int closeCode = (((mPayload[0] & 0xFF) << 8) | (mPayload[1] & 0xFF));
return closeCode;
} | java | {
"resource": ""
} |
q22609 | WebSocketFrame.getCloseReason | train | public String getCloseReason()
{
if (mPayload == null || mPayload.length < 3)
{
return null;
}
return Misc.toStringUTF8(mPayload, 2, mPayload.length - 2);
} | java | {
"resource": ""
} |
q22610 | WebSocketFrame.createTextFrame | train | public static WebSocketFrame createTextFrame(String payload)
{
return new WebSocketFrame()
.setFin(true)
.setOpcode(TEXT)
.setPayload(payload);
} | java | {
"resource": ""
} |
q22611 | WebSocketFrame.createBinaryFrame | train | public static WebSocketFrame createBinaryFrame(byte[] payload)
{
return new WebSocketFrame()
.setFin(true)
.setOpcode(BINARY)
.setPayload(payload);
} | java | {
"resource": ""
} |
q22612 | ByteArray.get | train | public byte get(int index) throws IndexOutOfBoundsException
{
if (index < 0 || mLength <= index)
{
// Bad index.
throw new IndexOutOfBoundsException(
String.format("Bad index: index=%d, length=%d", index, mLength));
}
return mBuffer.get(in... | java | {
"resource": ""
} |
q22613 | ByteArray.expandBuffer | train | private void expandBuffer(int newBufferSize)
{
// Allocate a new buffer.
ByteBuffer newBuffer = ByteBuffer.allocate(newBufferSize);
// Copy the content of the current buffer to the new buffer.
int oldPosition = mBuffer.position();
mBuffer.position(0);
newBuffer.put(m... | java | {
"resource": ""
} |
q22614 | ByteArray.put | train | public void put(int data)
{
// If the buffer is small.
if (mBuffer.capacity() < (mLength + 1))
{
expandBuffer(mLength + ADDITIONAL_BUFFER_SIZE);
}
mBuffer.put((byte)data);
++mLength;
} | java | {
"resource": ""
} |
q22615 | ReadingThread.verifyReservedBit1 | train | private void verifyReservedBit1(WebSocketFrame frame) throws WebSocketException
{
// If a per-message compression extension has been agreed.
if (mPMCE != null)
{
// Verify the RSV1 bit using the rule described in RFC 7692.
boolean verified = verifyReservedBit1ForPMCE(... | java | {
"resource": ""
} |
q22616 | ReadingThread.verifyReservedBit2 | train | private void verifyReservedBit2(WebSocketFrame frame) throws WebSocketException
{
if (frame.getRsv2() == false)
{
// No problem.
return;
}
// The RSV2 bit of a frame is set unexpectedly.
throw new WebSocketException(
WebSocketError.UNEXPEC... | java | {
"resource": ""
} |
q22617 | ReadingThread.verifyReservedBit3 | train | private void verifyReservedBit3(WebSocketFrame frame) throws WebSocketException
{
if (frame.getRsv3() == false)
{
// No problem.
return;
}
// The RSV3 bit of a frame is set unexpectedly.
throw new WebSocketException(
WebSocketError.UNEXPEC... | java | {
"resource": ""
} |
q22618 | ReadingThread.verifyFrameOpcode | train | private void verifyFrameOpcode(WebSocketFrame frame) throws WebSocketException
{
switch (frame.getOpcode())
{
case CONTINUATION:
case TEXT:
case BINARY:
case CLOSE:
case PING:
case PONG:
// Known opcode
... | java | {
"resource": ""
} |
q22619 | ProxySettings.reset | train | public ProxySettings reset()
{
mSecure = false;
mHost = null;
mPort = -1;
mId = null;
mPassword = null;
mHeaders.clear();
mServerNames = null;
return this;
} | java | {
"resource": ""
} |
q22620 | ProxySettings.setServer | train | public ProxySettings setServer(URI uri)
{
if (uri == null)
{
return this;
}
String scheme = uri.getScheme();
String userInfo = uri.getUserInfo();
String host = uri.getHost();
int port = uri.getPort();
return setServer(scheme,... | java | {
"resource": ""
} |
q22621 | ProxySettings.addHeader | train | public ProxySettings addHeader(String name, String value)
{
if (name == null || name.length() == 0)
{
return this;
}
List<String> list = mHeaders.get(name);
if (list == null)
{
list = new ArrayList<String>();
mHeaders.put(name, li... | java | {
"resource": ""
} |
q22622 | SocketConnector.handshake | train | private void handshake() throws WebSocketException
{
try
{
// Perform handshake with the proxy server.
mProxyHandshaker.perform();
}
catch (IOException e)
{
// Handshake with the proxy server failed.
String message = String.form... | java | {
"resource": ""
} |
q22623 | WebSocket.addHeader | train | public WebSocket addHeader(String name, String value)
{
mHandshakeBuilder.addHeader(name, value);
return this;
} | java | {
"resource": ""
} |
q22624 | WebSocket.setUserInfo | train | public WebSocket setUserInfo(String id, String password)
{
mHandshakeBuilder.setUserInfo(id, password);
return this;
} | java | {
"resource": ""
} |
q22625 | WebSocket.flush | train | public WebSocket flush()
{
synchronized (mStateManager)
{
WebSocketState state = mStateManager.getState();
if (state != OPEN && state != CLOSING)
{
return this;
}
}
// Get the reference to the instance of WritingThread... | java | {
"resource": ""
} |
q22626 | WebSocket.connect | train | public WebSocket connect() throws WebSocketException
{
// Change the state to CONNECTING. If the state before
// the change is not CREATED, an exception is thrown.
changeStateOnConnect();
// HTTP headers from the server.
Map<String, List<String>> headers;
try
... | java | {
"resource": ""
} |
q22627 | WebSocket.disconnect | train | public WebSocket disconnect(int closeCode, String reason, long closeDelay)
{
synchronized (mStateManager)
{
switch (mStateManager.getState())
{
case CREATED:
finishAsynchronously();
return this;
case OPE... | java | {
"resource": ""
} |
q22628 | WebSocket.sendFrame | train | public WebSocket sendFrame(WebSocketFrame frame)
{
if (frame == null)
{
return this;
}
synchronized (mStateManager)
{
WebSocketState state = mStateManager.getState();
if (state != OPEN && state != CLOSING)
{
re... | java | {
"resource": ""
} |
q22629 | WebSocket.sendContinuation | train | public WebSocket sendContinuation(String payload, boolean fin)
{
return sendFrame(WebSocketFrame.createContinuationFrame(payload).setFin(fin));
} | java | {
"resource": ""
} |
q22630 | WebSocket.sendText | train | public WebSocket sendText(String payload, boolean fin)
{
return sendFrame(WebSocketFrame.createTextFrame(payload).setFin(fin));
} | java | {
"resource": ""
} |
q22631 | WebSocket.sendBinary | train | public WebSocket sendBinary(byte[] payload, boolean fin)
{
return sendFrame(WebSocketFrame.createBinaryFrame(payload).setFin(fin));
} | java | {
"resource": ""
} |
q22632 | WebSocket.sendClose | train | public WebSocket sendClose(int closeCode, String reason)
{
return sendFrame(WebSocketFrame.createCloseFrame(closeCode, reason));
} | java | {
"resource": ""
} |
q22633 | WebSocket.shakeHands | train | private Map<String, List<String>> shakeHands() throws WebSocketException
{
// The raw socket created by WebSocketFactory.
Socket socket = mSocketConnector.getSocket();
// Get the input stream of the socket.
WebSocketInputStream input = openInputStream(socket);
// Get the ou... | java | {
"resource": ""
} |
q22634 | WebSocket.openInputStream | train | private WebSocketInputStream openInputStream(Socket socket) throws WebSocketException
{
try
{
// Get the input stream of the raw socket through which
// this client receives data from the server.
return new WebSocketInputStream(
new BufferedInputSt... | java | {
"resource": ""
} |
q22635 | WebSocket.openOutputStream | train | private WebSocketOutputStream openOutputStream(Socket socket) throws WebSocketException
{
try
{
// Get the output stream of the socket through which
// this client sends data to the server.
return new WebSocketOutputStream(
new BufferedOutputStream... | java | {
"resource": ""
} |
q22636 | WebSocket.writeHandshake | train | private void writeHandshake(WebSocketOutputStream output, String key) throws WebSocketException
{
// Generate an opening handshake sent to the server from this client.
mHandshakeBuilder.setKey(key);
String requestLine = mHandshakeBuilder.buildRequestLine();
List<String[]> headers... | java | {
"resource": ""
} |
q22637 | WebSocket.readHandshake | train | private Map<String, List<String>> readHandshake(WebSocketInputStream input, String key) throws WebSocketException
{
return new HandshakeReader(this).readHandshake(input, key);
} | java | {
"resource": ""
} |
q22638 | WebSocket.startThreads | train | private void startThreads()
{
ReadingThread readingThread = new ReadingThread(this);
WritingThread writingThread = new WritingThread(this);
synchronized (mThreadsLock)
{
mReadingThread = readingThread;
mWritingThread = writingThread;
}
// Exe... | java | {
"resource": ""
} |
q22639 | WebSocket.stopThreads | train | private void stopThreads(long closeDelay)
{
ReadingThread readingThread;
WritingThread writingThread;
synchronized (mThreadsLock)
{
readingThread = mReadingThread;
writingThread = mWritingThread;
mReadingThread = null;
mWritingThread ... | java | {
"resource": ""
} |
q22640 | WebSocket.onReadingThreadStarted | train | void onReadingThreadStarted()
{
boolean bothStarted = false;
synchronized (mThreadsLock)
{
mReadingThreadStarted = true;
if (mWritingThreadStarted)
{
// Both the reading thread and the writing thread have started.
bothStar... | java | {
"resource": ""
} |
q22641 | WebSocket.onReadingThreadFinished | train | void onReadingThreadFinished(WebSocketFrame closeFrame)
{
synchronized (mThreadsLock)
{
mReadingThreadFinished = true;
mServerCloseFrame = closeFrame;
if (mWritingThreadFinished == false)
{
// Wait for the writing thread to finish.
... | java | {
"resource": ""
} |
q22642 | WebSocket.onWritingThreadFinished | train | void onWritingThreadFinished(WebSocketFrame closeFrame)
{
synchronized (mThreadsLock)
{
mWritingThreadFinished = true;
mClientCloseFrame = closeFrame;
if (mReadingThreadFinished == false)
{
// Wait for the reading thread to finish.
... | java | {
"resource": ""
} |
q22643 | WebSocket.findAgreedPerMessageCompressionExtension | train | private PerMessageCompressionExtension findAgreedPerMessageCompressionExtension()
{
if (mAgreedExtensions == null)
{
return null;
}
for (WebSocketExtension extension : mAgreedExtensions)
{
if (extension instanceof PerMessageCompressionExtension)
... | java | {
"resource": ""
} |
q22644 | Misc.getBytesUTF8 | train | public static byte[] getBytesUTF8(String string)
{
if (string == null)
{
return null;
}
try
{
return string.getBytes("UTF-8");
}
catch (UnsupportedEncodingException e)
{
// This never happens.
return nul... | java | {
"resource": ""
} |
q22645 | Misc.toOpcodeName | train | public static String toOpcodeName(int opcode)
{
switch (opcode)
{
case CONTINUATION:
return "CONTINUATION";
case TEXT:
return "TEXT";
case BINARY:
return "BINARY";
case CLOSE:
return "C... | java | {
"resource": ""
} |
q22646 | Misc.readLine | train | public static String readLine(InputStream in, String charset) throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while (true)
{
// Read one byte from the stream.
int b = in.read();
// If the end of the stream was reached.
... | java | {
"resource": ""
} |
q22647 | Misc.min | train | public static int min(int[] values)
{
int min = Integer.MAX_VALUE;
for (int i = 0; i < values.length; ++i)
{
if (values[i] < min)
{
min = values[i];
}
}
return min;
} | java | {
"resource": ""
} |
q22648 | Misc.max | train | public static int max(int[] values)
{
int max = Integer.MIN_VALUE;
for (int i = 0; i < values.length; ++i)
{
if (max < values[i])
{
max = values[i];
}
}
return max;
} | java | {
"resource": ""
} |
q22649 | Huffman.createIntArray | train | private static int[] createIntArray(int size, int initialValue)
{
int[] array = new int[size];
for (int i = 0; i < size; ++i)
{
array[i] = initialValue;
}
return array;
} | java | {
"resource": ""
} |
q22650 | QueryService.equalsSpecification | train | protected <X> Specification<ENTITY> equalsSpecification(Function<Root<ENTITY>, Expression<X>> metaclassFunction, final X value) {
return (root, query, builder) -> builder.equal(metaclassFunction.apply(root), value);
} | java | {
"resource": ""
} |
q22651 | PersistentTokenCache.get | train | public T get(String key) {
purge();
final Value val = map.get(key);
final long time = System.currentTimeMillis();
return val != null && time < val.expire ? val.token : null;
} | java | {
"resource": ""
} |
q22652 | PersistentTokenCache.put | train | public void put(String key, T token) {
purge();
if (map.containsKey(key)) {
map.remove(key);
}
final long time = System.currentTimeMillis();
map.put(key, new Value(token, time + expireMillis));
latestWriteTime = time;
} | java | {
"resource": ""
} |
q22653 | PageableParameterBuilderPlugin.createPageParameter | train | protected Parameter createPageParameter(ParameterContext context) {
ModelReference intModel = createModelRefFactory(context).apply(resolver.resolve(Integer.TYPE));
return new ParameterBuilder()
.name(getPageName())
.parameterType(PAGE_TYPE)
.modelRef(intModel)
... | java | {
"resource": ""
} |
q22654 | PageableParameterBuilderPlugin.createSizeParameter | train | protected Parameter createSizeParameter(ParameterContext context) {
ModelReference intModel = createModelRefFactory(context).apply(resolver.resolve(Integer.TYPE));
return new ParameterBuilder()
.name(getSizeName())
.parameterType(SIZE_TYPE)
.modelRef(intModel)
... | java | {
"resource": ""
} |
q22655 | PageableParameterBuilderPlugin.createSortParameter | train | protected Parameter createSortParameter(ParameterContext context) {
ModelReference stringModel = createModelRefFactory(context).apply(resolver.resolve(List.class, String.class));
return new ParameterBuilder()
.name(getSortName())
.parameterType(SORT_TYPE)
.modelRef(st... | java | {
"resource": ""
} |
q22656 | RedisCache.get | train | @Override
public V get(K key) throws CacheException {
logger.debug("get key [" + key + "]");
if (key == null) {
return null;
}
try {
Object redisCacheKey = getRedisCacheKey(key);
byte[] rawValue = redisManager.get(keySerializer.serialize(redisCacheKey));
if (rawValue == null) {
return null;
... | java | {
"resource": ""
} |
q22657 | RedisCache.size | train | @Override
public int size() {
Long longSize = 0L;
try {
longSize = new Long(redisManager.dbSize(keySerializer.serialize(this.keyPrefix + "*")));
} catch (SerializationException e) {
logger.error("get keys error", e);
}
return longSize.intValue();
} | java | {
"resource": ""
} |
q22658 | WorkAloneRedisManager.del | train | @Override
public void del(byte[] key) {
if (key == null) {
return;
}
Jedis jedis = getJedis();
try {
jedis.del(key);
} finally {
jedis.close();
}
} | java | {
"resource": ""
} |
q22659 | WorkAloneRedisManager.dbSize | train | @Override
public Long dbSize(byte[] pattern) {
long dbSize = 0L;
Jedis jedis = getJedis();
try {
ScanParams params = new ScanParams();
params.count(count);
params.match(pattern);
byte[] cursor = ScanParams.SCAN_POINTER_START_BINARY;
... | java | {
"resource": ""
} |
q22660 | WorkAloneRedisManager.keys | train | public Set<byte[]> keys(byte[] pattern) {
Set<byte[]> keys = new HashSet<byte[]>();
Jedis jedis = getJedis();
try {
ScanParams params = new ScanParams();
params.count(count);
params.match(pattern);
byte[] cursor = ScanParams.SCAN_POINTER_START_BIN... | java | {
"resource": ""
} |
q22661 | NumberList.delta | train | public static NumberList delta(Map<String, Object> currentMap, Map<String, Object> previousMap) {
LinkedHashMap<String, Long> values = new LinkedHashMap<String, Long>(currentMap.size());
if(currentMap.size() != previousMap.size()) {
throw new IllegalArgumentException("Maps must have the same... | java | {
"resource": ""
} |
q22662 | NumberList.deltaInverse | train | public static NumberList deltaInverse(Map<String, Object> map) {
LinkedHashMap<String, Long> values = new LinkedHashMap<String, Long>(map.size());
for (Entry<String, Object> k : map.entrySet()) {
Object v = k.getValue();
Number current = getNumber(v);
long d = -curren... | java | {
"resource": ""
} |
q22663 | StreamAggregator.aggregateUsingFlattenedGroupBy | train | @SuppressWarnings("unused")
private static Observable<GroupedObservable<TypeAndNameKey, Map<String, Object>>> aggregateUsingFlattenedGroupBy(Observable<GroupedObservable<InstanceKey, Map<String, Object>>> stream) {
Observable<Map<String, Object>> allData = stream.flatMap(instanceStream -> {
retu... | java | {
"resource": ""
} |
q22664 | StreamAggregator.tombstone | train | private static Observable<Map<String, Object>> tombstone(Observable<Map<String, Object>> instanceStream, InstanceKey instanceKey) {
return instanceStream.publish(is -> {
Observable<Map<String, Object>> tombstone = is
// collect all unique "TypeAndName" keys
.c... | java | {
"resource": ""
} |
q22665 | DefaultProperties.getFromInstanceConfig | train | public static Properties getFromInstanceConfig(InstanceConfig defaultInstanceConfig)
{
PropertyBasedInstanceConfig config = new PropertyBasedInstanceConfig(new ConfigCollectionImpl(defaultInstanceConfig, null));
return config.getProperties();
} | java | {
"resource": ""
} |
q22666 | DefaultProperties.newDefaultInstanceConfig | train | public static InstanceConfig newDefaultInstanceConfig(BackupProvider provider)
{
List<EncodedConfigParser.FieldValue> backupDefaultValues = Lists.newArrayList();
if ( provider != null )
{
for ( BackupConfigSpec spec : provider.getConfigs() )
{
backu... | java | {
"resource": ""
} |
q22667 | ActivityLog.toDisplayList | train | public List<String> toDisplayList(final String separator, ExhibitorArguments.LogDirection logDirection)
{
Iterable<String> transformed = Iterables.transform
(
queue,
new Function<Message, String>()
{
public String apply(Message message)
... | java | {
"resource": ""
} |
q22668 | ActivityLog.add | train | public void add(Type type, String message, Throwable exception)
{
String queueMessage = message;
if ( (type == Type.ERROR) && (exception != null) )
{
queueMessage += " (" + getExceptionMessage(exception) + ")";
}
if ( type.addToUI() )
{
... | java | {
"resource": ""
} |
q22669 | ActivityLog.getExceptionMessage | train | public static String getExceptionMessage(Throwable exception)
{
StringWriter out = new StringWriter();
exception.printStackTrace(new PrintWriter(out));
BufferedReader in = new BufferedReader(new StringReader(out.toString()));
try
{
StringBuilder ... | java | {
"resource": ""
} |
q22670 | EncodedConfigParser.getValue | train | public String getValue(final String field)
{
FieldValue fieldValue = Iterables.find
(
fieldValues,
new Predicate<FieldValue>()
{
@Override
public boolean apply(FieldValue fv)
{
return fv.getField(... | java | {
"resource": ""
} |
q22671 | JerseySupport.newApplicationConfig | train | public static DefaultResourceConfig newApplicationConfig(UIContext context)
{
final Set<Object> singletons = getSingletons(context);
final Set<Class<?>> classes = getClasses();
return new DefaultResourceConfig()
{
@Override
public Set<Class<?>> getClasses()
... | java | {
"resource": ""
} |
q22672 | ServerList.filterOutObservers | train | public ServerList filterOutObservers()
{
Iterable<ServerSpec> filtered = Iterables.filter
(
specs,
new Predicate<ServerSpec>()
{
@Override
public boolean apply(ServerSpec spec)
{
return spec.getSe... | java | {
"resource": ""
} |
q22673 | ActivityQueue.start | train | public void start()
{
for ( QueueGroups group : QueueGroups.values() )
{
final DelayQueue<ActivityHolder> thisQueue = queues.get(group);
service.submit
(
new Runnable()
{
@Override
public... | java | {
"resource": ""
} |
q22674 | ActivityQueue.add | train | public synchronized void add(QueueGroups group, Activity activity)
{
add(group, activity, 0, TimeUnit.MILLISECONDS);
} | java | {
"resource": ""
} |
q22675 | ActivityQueue.add | train | public synchronized void add(QueueGroups group, Activity activity, long delay, TimeUnit unit)
{
ActivityHolder holder = new ActivityHolder(activity, TimeUnit.MILLISECONDS.convert(delay, unit));
queues.get(group).offer(holder);
} | java | {
"resource": ""
} |
q22676 | ActivityQueue.replace | train | public synchronized void replace(QueueGroups group, Activity activity)
{
replace(group, activity, 0, TimeUnit.MILLISECONDS);
} | java | {
"resource": ""
} |
q22677 | Exhibitor.getHostname | train | public static String getHostname()
{
String host = "unknown";
try
{
return InetAddress.getLocalHost().getHostName();
}
catch ( UnknownHostException e )
{
// ignore
}
return host;
} | java | {
"resource": ""
} |
q22678 | Exhibitor.start | train | public void start() throws Exception
{
Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED));
//Try to restore data from backup before zookeeper will be started
backupManager.restoreAll();
activityQueue.start();
configManager.start();
monitorRun... | java | {
"resource": ""
} |
q22679 | BackupManager.getAvailableBackups | train | public List<BackupMetaData> getAvailableBackups() throws Exception
{
Map<String, String> config = getBackupConfig();
return backupProvider.get().getAvailableBackups(exhibitor, config);
} | java | {
"resource": ""
} |
q22680 | BackupManager.getBackupStream | train | public BackupStream getBackupStream(BackupMetaData metaData) throws Exception
{
return backupProvider.get().getBackupStream(exhibitor, metaData, getBackupConfig());
} | java | {
"resource": ""
} |
q22681 | BackupManager.restoreAll | train | public void restoreAll() throws Exception
{
if (!backupProvider.isPresent()) {
log.info("No backup provider configured. Skipping restore.");
return;
}
ZooKeeperLogFiles logFiles = new ZooKeeperLogFiles(exhibitor);
log.info("Restoring log files from backup.")... | java | {
"resource": ""
} |
q22682 | BackupManager.restore | train | public void restore(BackupMetaData backup, File destinationFile) throws Exception
{
File tempFile = File.createTempFile("exhibitor-backup", ".tmp");
OutputStream out = new FileOutputStream(tempFile);
InputStream in = null;
try {
backupProvider.get().downloadBackup(exhibit... | java | {
"resource": ""
} |
q22683 | Selectors.byAttribute | train | public static By byAttribute(String attributeName, String attributeValue) {
return By.cssSelector(String.format("[%s='%s']", attributeName, attributeValue));
} | java | {
"resource": ""
} |
q22684 | ElementsCollection.texts | train | public static List<String> texts(Collection<WebElement> elements) {
return elements.stream().map(ElementsCollection::getText).collect(toList());
} | java | {
"resource": ""
} |
q22685 | ElementsCollection.elementsToString | train | public static String elementsToString(Driver driver, Collection<WebElement> elements) {
if (elements == null) {
return "[not loaded yet...]";
}
if (elements.isEmpty()) {
return "[]";
}
StringBuilder sb = new StringBuilder(256);
sb.append("[\n\t");
for (WebElement element : elem... | java | {
"resource": ""
} |
q22686 | SelenideProxyServer.start | train | public void start() {
proxy.setTrustAllServers(true);
if (outsideProxy != null) {
proxy.setChainedProxy(getProxyAddress(outsideProxy));
}
addRequestFilter("authentication", new AuthenticationFilter());
addRequestFilter("requestSizeWatchdog", new RequestSizeWatchdog());
addResponseFilter("... | java | {
"resource": ""
} |
q22687 | SelenideProxyServer.createSeleniumProxy | train | public Proxy createSeleniumProxy() {
return isEmpty(config.proxyHost())
? ClientUtil.createSeleniumProxy(proxy)
: ClientUtil.createSeleniumProxy(proxy, inetAddressResolver.getInetAddressByName(config.proxyHost()));
} | java | {
"resource": ""
} |
q22688 | SelenideProxyServer.requestFilter | train | @SuppressWarnings("unchecked")
public <T extends RequestFilter> T requestFilter(String name) {
return (T) requestFilters.get(name);
} | java | {
"resource": ""
} |
q22689 | SelenideProxyServer.responseFilter | train | @SuppressWarnings("unchecked")
public <T extends ResponseFilter> T responseFilter(String name) {
return (T) responseFilters.get(name);
} | java | {
"resource": ""
} |
q22690 | Condition.value | train | public static Condition value(final String expectedValue) {
return new Condition("value") {
@Override
public boolean apply(Driver driver, WebElement element) {
return Html.text.contains(getAttributeValue(element, "value"), expectedValue);
}
@Override
public String toString() {... | java | {
"resource": ""
} |
q22691 | Condition.matchText | train | public static Condition matchText(final String regex) {
return new Condition("match text") {
@Override
public boolean apply(Driver driver, WebElement element) {
return Html.text.matches(element.getText(), regex);
}
@Override
public String toString() {
return name + " '... | java | {
"resource": ""
} |
q22692 | Condition.selectedText | train | public static Condition selectedText(final String expectedText) {
return new Condition("selectedText") {
String actualResult = "";
@Override
public boolean apply(Driver driver, WebElement element) {
actualResult = driver.executeJavaScript(
"return arguments[0].value.substring(a... | java | {
"resource": ""
} |
q22693 | Condition.and | train | public static Condition and(String name, final Condition... condition) {
return new Condition(name) {
private Condition lastFailedCondition;
@Override
public boolean apply(Driver driver, WebElement element) {
for (Condition c : condition) {
if (!c.apply(driver, element)) {
... | java | {
"resource": ""
} |
q22694 | ChromeDriverFactory.convertStringToNearestObjectType | train | private Object convertStringToNearestObjectType(String value) {
switch (value) {
case "true":
return true;
case "false":
return false;
default: {
if (NumberUtils.isParsable(value)) {
return Integer.parseInt(value);
}
return value;
}
}
} | java | {
"resource": ""
} |
q22695 | CompactCalendarController.isScrolling | train | private boolean isScrolling() {
float scrolledX = Math.abs(accumulatedScrollOffset.x);
int expectedScrollX = Math.abs(width * monthsScrolledSoFar);
return scrolledX < expectedScrollX - 5 || scrolledX > expectedScrollX + 5;
} | java | {
"resource": ""
} |
q22696 | CompactCalendarController.drawEventsWithPlus | train | private void drawEventsWithPlus(Canvas canvas, float xPosition, float yPosition, List<Event> eventsList) {
// k = size() - 1, but since we don't want to draw more than 2 indicators, we just stop after 2 iterations so we can just hard k = -2 instead
// we can use the below loop to draw arbitrary eventsBy... | java | {
"resource": ""
} |
q22697 | CompactCalendarController.getDayOfWeek | train | int getDayOfWeek(Calendar calendar) {
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - firstDayOfWeekToDraw;
dayOfWeek = dayOfWeek < 0 ? 7 + dayOfWeek: dayOfWeek;
return dayOfWeek;
} | java | {
"resource": ""
} |
q22698 | CompactCalendarController.drawCircle | train | private void drawCircle(Canvas canvas, float x, float y, int color, float circleScale) {
dayPaint.setColor(color);
if (animationStatus == ANIMATE_INDICATORS) {
float maxRadius = circleScale * bigCircleIndicatorRadius * 1.4f;
drawCircle(canvas, growfactorIndicator > maxRadius ? ma... | java | {
"resource": ""
} |
q22699 | EventsContainer.getKeyForCalendarEvent | train | private String getKeyForCalendarEvent(Calendar cal) {
return cal.get(Calendar.YEAR) + "_" + cal.get(Calendar.MONTH);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.