method2testcases
stringlengths
118
3.08k
### Question: Platform { static Platform get() { return PLATFORM; } Platform(boolean hasJava8Types); }### Answer: @Test public void isAndroid() { assertFalse(Platform.get() instanceof Platform.Android); }
### Question: Invocation { public static Invocation of(Method method, List<?> arguments) { Objects.requireNonNull(method, "method == null"); Objects.requireNonNull(arguments, "arguments == null"); return new Invocation(method, new ArrayList<>(arguments)); } Invocation(Method method, List<?> arguments); static Invocatio...
### Question: HttpException extends RuntimeException { public @Nullable Response<?> response() { return response; } HttpException(Response<?> response); int code(); String message(); @Nullable Response<?> response(); }### Answer: @Test public void response() { Response<String> response = Response.success("Hi"); HttpEx...
### Question: Retrofit { public @Nullable Executor callbackExecutor() { return callbackExecutor; } Retrofit( okhttp3.Call.Factory callFactory, HttpUrl baseUrl, List<Converter.Factory> converterFactories, List<CallAdapter.Factory> callAdapterFactories, @Nullable Executor callbackExecutor, ...
### Question: NetworkBehavior { public Throwable failureException() { return failureException; } private NetworkBehavior(Random random); static NetworkBehavior create(); @SuppressWarnings("ConstantConditions") // Guarding API nullability. static NetworkBehavior create(Random random); void setDelay(long amount, TimeUni...
### Question: NetworkBehavior { public void setDelay(long amount, TimeUnit unit) { if (amount < 0) { throw new IllegalArgumentException("Amount must be positive value."); } this.delayMs = unit.toMillis(amount); } private NetworkBehavior(Random random); static NetworkBehavior create(); @SuppressWarnings("ConstantCondit...
### Question: UriTemplateParser { public static void parse(String template, Handler handler) { assert template != null; assert handler != null; int pos = 0; final int length = template.length(); State state = State.OutsideParam; StringBuilder builder = new StringBuilder(); while (pos < length) { char c = template.charA...
### Question: WadlXsltUtils { public static String hypernizeURI(String uri) { String result = uri.replaceAll("/", "/&#8203;"); return result; } static InputStream getUpgradeTransformAsStream(); static InputStream getWadlSummaryTransform(); static String hypernizeURI(String uri); }### Answer: @Test public void hyperni...
### Question: WadlAstBuilder { public ApplicationNode buildAst(URI rootFile) throws InvalidWADLException, IOException { try { Application a = processDescription(rootFile); return buildAst(a,rootFile); } catch (JAXBException ex) { throw new RuntimeException("Internal error",ex); } } WadlAstBuilder( SchemaCal...
### Question: JModule { public String name() { return name; } JModule(final String name); String name(); void _exports(final JPackage pkg); void _exports(final Collection<JPackage> pkgs, final boolean addEmpty); void _requires(final String name, final boolean isPublic, final boolean isStatic); void _requires(final Stri...
### Question: JModule { public void _exports(final JPackage pkg) { directives.add(new JExportsDirective(pkg.name())); } JModule(final String name); String name(); void _exports(final JPackage pkg); void _exports(final Collection<JPackage> pkgs, final boolean addEmpty); void _requires(final String name, final boolean is...
### Question: JModule { public void _requires(final String name, final boolean isPublic, final boolean isStatic) { directives.add(new JRequiresDirective(name, isPublic, isStatic)); } JModule(final String name); String name(); void _exports(final JPackage pkg); void _exports(final Collection<JPackage> pkgs, final boolea...
### Question: JModule { public JFormatter generate(final JFormatter f) { f.p("module").p(name); f.p('{').nl(); if (!directives.isEmpty()) { f.i(); for (final JModuleDirective directive : directives) { directive.generate(f); } f.o(); } f.p('}').nl(); return f; } JModule(final String name); String name(); void _exports(f...
### Question: SchemaGenerator { private static String setClasspath(String givenClasspath) { StringBuilder cp = new StringBuilder(); appendPath(cp, givenClasspath); ClassLoader cl = Thread.currentThread().getContextClassLoader(); while (cl != null) { if (cl instanceof URLClassLoader) { for (URL url : ((URLClassLoader) c...
### Question: PluginImpl extends Plugin { public boolean run(@NotNull Outline model, Options opt, ErrorHandler errorHandler) { checkAndInject(model.getClasses()); checkAndInject(model.getEnums()); return true; } String getOptionName(); List<String> getCustomizationURIs(); boolean isCustomizationTagName(String nsUri, S...
### Question: AuthenticationKey implements Writable { @Override public int hashCode() { int result = id; result = 31 * result + (int) (expirationDate ^ (expirationDate >>> 32)); result = 31 * result + ((secret == null) ? 0 : Arrays.hashCode(secret.getEncoded())); return result; } AuthenticationKey(); AuthenticationKey...
### Question: MultiTableSnapshotInputFormatImpl { public Map<String, Collection<Scan>> getSnapshotsToScans(Configuration conf) throws IOException { Map<String, Collection<Scan>> rtn = Maps.newHashMap(); for (Map.Entry<String, String> entry : ConfigurationUtil .getKeyValues(conf, SNAPSHOT_TO_SCANS_KEY)) { String snapsho...
### Question: MultiTableSnapshotInputFormatImpl { public Map<String, Path> getSnapshotDirs(Configuration conf) throws IOException { List<Map.Entry<String, String>> kvps = ConfigurationUtil.getKeyValues(conf, RESTORE_DIRS_KEY); Map<String, Path> rtn = Maps.newHashMapWithExpectedSize(kvps.size()); for (Map.Entry<String, ...
### Question: TableSplit extends InputSplit implements Writable, Comparable<TableSplit> { @Override public long getLength() { return length; } TableSplit(); @Deprecated TableSplit(final byte [] tableName, Scan scan, byte [] startRow, byte [] endRow, final String location); TableSplit(TableName tableName, Scan s...
### Question: CopyTable extends Configured implements Tool { public CopyTable(Configuration conf) { super(conf); } CopyTable(Configuration conf); Job createSubmittableJob(String[] args); static void main(String[] args); @Override int run(String[] args); }### Answer: @Test public void testCopyTable() throws Exception {...
### Question: CopyTable extends Configured implements Tool { public static void main(String[] args) throws Exception { int ret = ToolRunner.run(new CopyTable(HBaseConfiguration.create()), args); System.exit(ret); } CopyTable(Configuration conf); Job createSubmittableJob(String[] args); static void main(String[] args); ...
### Question: FSHDFSUtils extends FSUtils { boolean recoverLease(final DistributedFileSystem dfs, final int nbAttempt, final Path p, final long startWaiting) throws FileNotFoundException { boolean recovered = false; try { recovered = dfs.recoverLease(p); LOG.info((recovered? "Recovered lease, ": "Failed to recover leas...
### Question: HFileOutputFormat extends FileOutputFormat<ImmutableBytesWritable, KeyValue> { public static void configureIncrementalLoad(Job job, HTable table) throws IOException { HFileOutputFormat2.configureIncrementalLoad(job, table.getTableDescriptor(), table.getRegionLocator()); } @Override RecordWriter<Immutable...
### Question: SyncTable extends Configured implements Tool { public SyncTable(Configuration conf) { super(conf); } SyncTable(Configuration conf); Job createSubmittableJob(String[] args); static void main(String[] args); @Override int run(String[] args); }### Answer: @Test public void testSyncTable() throws Exception {...
### Question: HFileOutputFormat2 extends FileOutputFormat<ImmutableBytesWritable, Cell> { @Deprecated public static void configureIncrementalLoad(Job job, HTable table) throws IOException { configureIncrementalLoad(job, table.getTableDescriptor(), table.getRegionLocator()); } @Override RecordWriter<ImmutableBytesWrita...
### Question: JarFinder { public static String getJar(Class klass) { Preconditions.checkNotNull(klass, "klass"); ClassLoader loader = klass.getClassLoader(); if (loader != null) { String class_file = klass.getName().replaceAll("\\.", "/") + ".class"; try { for (Enumeration itr = loader.getResources(class_file); itr.has...
### Question: ReplicationSinkManager { public synchronized void chooseSinks() { List<ServerName> slaveAddresses = endpoint.getRegionServers(); Collections.shuffle(slaveAddresses, random); int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio); sinks = slaveAddresses.subList(0, numSinks); lastUpdateToPeers = Syst...
### Question: ReplicationSinkManager { public synchronized void reportBadSink(SinkPeer sinkPeer) { ServerName serverName = sinkPeer.getServerName(); int badReportCount = (badReportCounts.containsKey(serverName) ? badReportCounts.get(serverName) : 0) + 1; badReportCounts.put(serverName, badReportCount); if (badReportCou...
### Question: ConfigurationManager { public void notifyAllObservers(Configuration conf) { LOG.info("Starting to notify all observers that config changed."); synchronized (configurationObservers) { for (ConfigurationObserver observer : configurationObservers) { try { if (observer != null) { observer.onConfigurationChang...
### Question: BoundedRegionGroupingProvider extends RegionGroupingProvider { @Override public void close() throws IOException { IOException failure = null; for (WALProvider provider : delegates) { try { provider.close(); } catch (IOException exception) { LOG.error("Problem closing provider '" + provider + "': " + excep...
### Question: ZooKeeperMainServer { public String parse(final Configuration c) { return ZKConfig.getZKQuorumServersString(c); } String parse(final Configuration c); static void main(String args[]); }### Answer: @Test public void testHostPortParse() { ZooKeeperMainServer parser = new ZooKeeperMainServer(); Configurati...
### Question: RegionPlan implements Comparable<RegionPlan> { @Override public int hashCode() { return getRegionName().hashCode(); } RegionPlan(final HRegionInfo hri, ServerName source, ServerName dest); void setDestination(ServerName dest); ServerName getSource(); ServerName getDestination(); String getRegionName(); HR...
### Question: ServerAndLoad implements Comparable<ServerAndLoad>, Serializable { @Override public int hashCode() { int result = load; result = 31 * result + ((sn == null) ? 0 : sn.hashCode()); return result; } ServerAndLoad(final ServerName sn, final int load); @Override int compareTo(ServerAndLoad other); @Override in...
### Question: RegionLocationFinder { protected HDFSBlocksDistribution internalGetTopBlockLocation(HRegionInfo region) { try { HTableDescriptor tableDescriptor = getTableDescriptor(region.getTable()); if (tableDescriptor != null) { HDFSBlocksDistribution blocksDistribution = HRegion.computeHDFSBlocksDistribution(getConf...
### Question: RegionLocationFinder { protected List<ServerName> mapHostNameToServerName(List<String> hosts) { if (hosts == null || status == null) { if (hosts == null) { LOG.warn("RegionLocationFinder top hosts is null"); } return Lists.newArrayList(); } List<ServerName> topServerNames = new ArrayList<ServerName>(); Co...
### Question: RegionLocationFinder { protected List<ServerName> getTopBlockLocations(HRegionInfo region) { HDFSBlocksDistribution blocksDistribution = getBlockDistribution(region); List<String> topHosts = blocksDistribution.getTopHosts(); return mapHostNameToServerName(topHosts); } RegionLocationFinder(); Configuration...
### Question: StochasticLoadBalancer extends BaseLoadBalancer { @Override public synchronized void setClusterStatus(ClusterStatus st) { super.setClusterStatus(st); updateRegionLoad(); for(CostFromRegionLoadFunction cost : regionLoadFunctions) { cost.setClusterStatus(st); } } @Override void onConfigurationChange(Config...
### Question: DeadServer { public synchronized boolean areDeadServersInProgress() { return processing; } synchronized boolean cleanPreviousInstance(final ServerName newServerName); synchronized boolean isDeadServer(final ServerName serverName); synchronized boolean areDeadServersInProgress(); synchronized Set<ServerNa...
### Question: SplitLogManager { public long splitLogDistributed(final Path logDir) throws IOException { List<Path> logDirs = new ArrayList<Path>(); logDirs.add(logDir); return splitLogDistributed(logDirs); } SplitLogManager(Server server, Configuration conf, Stoppable stopper, MasterServices master, ServerName se...
### Question: StealJobQueue extends PriorityBlockingQueue<T> { @Override public T take() throws InterruptedException { lock.lockInterruptibly(); try { while (true) { T retVal = this.poll(); if (retVal == null) { retVal = stealFromQueue.poll(); } if (retVal == null) { notEmpty.await(); } else { return retVal; } } } fina...
### Question: ServerNonceManager { public void endOperation(long group, long nonce, boolean success) { if (nonce == HConstants.NO_NONCE) return; NonceKey nk = new NonceKey(group, nonce); OperationContext newResult = nonces.get(nk); assert newResult != null; synchronized (newResult) { assert newResult.getState() == Oper...
### Question: RegionSplitPolicy extends Configured { protected byte[] getSplitPoint() { byte[] explicitSplitPoint = this.region.getExplicitSplitPoint(); if (explicitSplitPoint != null) { return explicitSplitPoint; } List<Store> stores = region.getStores(); byte[] splitPointFromLargestStore = null; long largestStoreSize...
### Question: MetricsWAL extends WALActionsListener.Base { @Override public void logRollRequested(boolean underReplicated) { source.incrementLogRollRequested(); if (underReplicated) { source.incrementLowReplicationLogRoll(); } } MetricsWAL(); @VisibleForTesting MetricsWAL(MetricsWALSource s); @Override void postSync(f...
### Question: MetricsWAL extends WALActionsListener.Base { @Override public void postSync(final long timeInNanos, final int handlerSyncs) { source.incrementSyncTime(timeInNanos/1000000L); } MetricsWAL(); @VisibleForTesting MetricsWAL(MetricsWALSource s); @Override void postSync(final long timeInNanos, final int handle...
### Question: StealJobQueue extends PriorityBlockingQueue<T> { public BlockingQueue<T> getStealFromQueue() { return stealFromQueue; } StealJobQueue(); BlockingQueue<T> getStealFromQueue(); @Override boolean offer(T t); @Override T take(); @Override T poll(long timeout, TimeUnit unit); }### Answer: @Test public void te...
### Question: SequenceIdAccounting { byte[][] findLower(Map<byte[], Long> sequenceids) { List<byte[]> toFlush = null; synchronized (tieLock) { for (Map.Entry<byte[], Long> e: sequenceids.entrySet()) { Map<byte[], Long> m = this.lowestUnflushedSequenceIds.get(e.getKey()); if (m == null) continue; long lowest = getLowest...
### Question: IdLock { void assertMapEmpty() { assert map.size() == 0; } Entry getLockEntry(long id); void releaseLockEntry(Entry entry); @VisibleForTesting void waitForWaiters(long id, int numWaiters); }### Answer: @Test public void testMultipleClients() throws Exception { ExecutorService exec = Executors.newFixedTh...
### Question: SnapshotManifest { public static SnapshotManifest open(final Configuration conf, final FileSystem fs, final Path workingDir, final SnapshotDescription desc) throws IOException { SnapshotManifest manifest = new SnapshotManifest(conf, fs, workingDir, desc, null); manifest.load(); return manifest; } private ...
### Question: JMXListener implements Coprocessor { @Override public void stop(CoprocessorEnvironment env) throws IOException { stopConnectorServer(); } static JMXServiceURL buildJMXServiceURL(int rmiRegistryPort, int rmiConnectorPort); void startConnectorServer(int rmiRegistryPort, int rmiConnectorPort); void st...
### Question: KeyLocker { public ReentrantLock acquireLock(K key) { if (key == null) throw new IllegalArgumentException("key must not be null"); lockPool.purge(); ReentrantLock lock = lockPool.get(key); lock.lock(); return lock; } ReentrantLock acquireLock(K key); Map<K, Lock> acquireLocks(Set<? extends K> keys); }##...
### Question: SimpleMutableByteRange extends AbstractByteRange { @Override public boolean equals(Object thatObject) { if (thatObject == null) { return false; } if (this == thatObject) { return true; } if (hashCode() != thatObject.hashCode()) { return false; } if (!(thatObject instanceof SimpleMutableByteRange)) { retur...
### Question: AES extends Cipher { @VisibleForTesting SecureRandom getRNG() { return rng; } AES(CipherProvider provider); @Override String getName(); @Override int getKeyLength(); @Override int getIvLength(); @Override Key getRandomKey(); @Override Encryptor getEncryptor(); @Override Decryptor getDecryptor(); @Override...
### Question: BoundedByteBufferPool { public void putBuffer(ByteBuffer bb) { if (bb.capacity() > this.maxByteBufferSizeToCache) return; boolean success = false; int average = 0; lock.lock(); try { success = this.buffers.offer(bb); if (success) { this.totalReservoirCapacity += bb.capacity(); average = this.totalReservoi...
### Question: ChoreService implements ChoreServicer { @Override public synchronized void cancelChore(ScheduledChore chore) { cancelChore(chore, true); } @VisibleForTesting ChoreService(final String coreThreadPoolPrefix); ChoreService(final String coreThreadPoolPrefix, final boolean jitter); ChoreService(final String...
### Question: ChoreService implements ChoreServicer { int getCorePoolSize() { return scheduler.getCorePoolSize(); } @VisibleForTesting ChoreService(final String coreThreadPoolPrefix); ChoreService(final String coreThreadPoolPrefix, final boolean jitter); ChoreService(final String coreThreadPoolPrefix, int corePoolSi...
### Question: ZKConfig { public static Properties makeZKProps(Configuration conf) { Properties zkProperties = makeZKPropsFromZooCfg(conf); if (zkProperties == null) { zkProperties = makeZKPropsFromHbaseConfig(conf); } return zkProperties; } private ZKConfig(); static Properties makeZKProps(Configuration conf); @Deprec...
### Question: ZKConfig { public static String getZooKeeperClusterKey(Configuration conf) { return getZooKeeperClusterKey(conf, null); } private ZKConfig(); static Properties makeZKProps(Configuration conf); @Deprecated static Properties parseZooCfg(Configuration conf, InputStream inputStream); static String getZ...
### Question: ZKConfig { public static void validateClusterKey(String key) throws IOException { transformClusterKey(key); } private ZKConfig(); static Properties makeZKProps(Configuration conf); @Deprecated static Properties parseZooCfg(Configuration conf, InputStream inputStream); static String getZKQuorumServe...
### Question: FixedLengthWrapper implements DataType<T> { @Override public T decode(PositionedByteRange src) { if (src.getRemaining() < length) { throw new IllegalArgumentException("Not enough buffer remaining. src.offset: " + src.getOffset() + " src.length: " + src.getLength() + " src.position: " + src.getPosition() +...
### Question: TimeoutBlockingQueue { public TimeoutBlockingQueue(TimeoutRetriever<? super E> timeoutRetriever) { this(32, timeoutRetriever); } TimeoutBlockingQueue(TimeoutRetriever<? super E> timeoutRetriever); @SuppressWarnings("unchecked") TimeoutBlockingQueue(int capacity, TimeoutRetriever<? super E> timeoutRetriev...
### Question: ProcedureStoreTracker { public boolean isTracking(long minId, long maxId) { return map.floorEntry(minId) != null || map.floorEntry(maxId) != null; } void insert(long procId); void insert(final long procId, final long[] subProcIds); void update(long procId); void delete(long procId); long getUpdatedMinPro...
### Question: ProcedureStoreTracker { public void delete(long procId) { Map.Entry<Long, BitSetNode> entry = map.floorEntry(procId); assert entry != null : "expected node to delete procId=" + procId; BitSetNode node = entry.getValue(); assert node.contains(procId) : "expected procId in the node"; node.delete(procId); if...
### Question: WALProcedureStore extends ProcedureStoreBase { @VisibleForTesting protected void periodicRollForTesting() throws IOException { lock.lock(); try { periodicRoll(); } finally { lock.unlock(); } } WALProcedureStore(final Configuration conf, final FileSystem fs, final Path logDir, final LeaseRecovery lea...
### Question: ClientExceptionsUtil { public static Throwable findException(Object exception) { if (exception == null || !(exception instanceof Throwable)) { return null; } Throwable cur = (Throwable) exception; while (cur != null) { if (isSpecialException(cur)) { return cur; } if (cur instanceof RemoteException) { Remo...
### Question: LongComparator extends ByteArrayComparable { @Override public int compareTo(byte[] value, int offset, int length) { Long that = Bytes.toLong(value, offset, length); return this.longValue.compareTo(that); } LongComparator(long value); @Override int compareTo(byte[] value, int offset, int length); @Override...
### Question: IPCUtil { @SuppressWarnings("resource") public ByteBuffer buildCellBlock(final Codec codec, final CompressionCodec compressor, final CellScanner cellScanner) throws IOException { return buildCellBlock(codec, compressor, cellScanner, null); } IPCUtil(final Configuration conf); @SuppressWarnings("resource")...
### Question: PayloadCarryingRpcController extends TimeLimitedRpcController implements CellScannable { public CellScanner cellScanner() { return cellScanner; } PayloadCarryingRpcController(); PayloadCarryingRpcController(final CellScanner cellScanner); PayloadCarryingRpcController(final List<CellScannable> cellIterab...
### Question: AsyncProcess { @VisibleForTesting void waitUntilDone() throws InterruptedIOException { waitForMaximumCurrentTasks(0); } AsyncProcess(ClusterConnection hc, Configuration conf, ExecutorService pool, RpcRetryingCallerFactory rpcCaller, boolean useGlobalErrors, RpcControllerFactory rpcFactory); AsyncReq...
### Question: DelayingRunner implements Runnable { public DelayingRunner(long sleepTime, Map.Entry<byte[], List<Action<T>>> e) { this.sleepTime = sleepTime; add(e); } DelayingRunner(long sleepTime, Map.Entry<byte[], List<Action<T>>> e); void setRunner(Runnable runner); @Override void run(); void add(Map.Entry<byte[], L...
### Question: ClientScanner extends AbstractClientScanner { @Override public Result next() throws IOException { if (cache.size() == 0 && this.closed) { return null; } if (cache.size() == 0) { loadCache(); } if (cache.size() > 0) { return cache.poll(); } writeScanMetrics(); return null; } ClientScanner(final Configurati...
### Question: IdReadWriteLock { @VisibleForTesting int purgeAndGetEntryPoolSize() { gc(); Threads.sleep(200); lockPool.purge(); return lockPool.size(); } ReentrantReadWriteLock getLock(long id); @VisibleForTesting void waitForWaiters(long id, int numWaiters); }### Answer: @Test(timeout = 60000) public void testMultip...
### Question: ConnectionCache { ConnectionInfo getCurrentConnection() throws IOException { String userName = getEffectiveUser(); ConnectionInfo connInfo = connections.get(userName); if (connInfo == null || !connInfo.updateAccessTime()) { Lock lock = locker.acquireLock(userName); try { connInfo = connections.get(userNam...
### Question: RegionSizeCalculator { public long getRegionSize(byte[] regionId) { Long size = sizeMap.get(regionId); if (size == null) { LOG.debug("Unknown region:" + Arrays.toString(regionId)); return 0; } else { return size; } } @Deprecated RegionSizeCalculator(HTable table); RegionSizeCalculator(RegionLocator regi...
### Question: FSVisitor { public static void visitTableStoreFiles(final FileSystem fs, final Path tableDir, final StoreFileVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { if (LOG.isTraceEnabled()) { LOG.trace("No regi...
### Question: FSVisitor { public static void visitTableRecoveredEdits(final FileSystem fs, final Path tableDir, final FSVisitor.RecoveredEditsVisitor visitor) throws IOException { FileStatus[] regions = FSUtils.listStatus(fs, tableDir, new FSUtils.RegionDirFilter(fs)); if (regions == null) { if (LOG.isTraceEnabled()) {...
### Question: FileLink { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (this.getClass().equals(obj.getClass())) { return Arrays.equals(this.locations, ((FileLink) obj).locations); } return false; } protected FileLink(); FileLink(Path originPath, Path... alternativePaths); FileLi...
### Question: FileLink { @Override public int hashCode() { return Arrays.hashCode(locations); } protected FileLink(); FileLink(Path originPath, Path... alternativePaths); FileLink(final Collection<Path> locations); Path[] getLocations(); @Override String toString(); boolean exists(final FileSystem fs); Path getAvail...
### Question: LruCachedBlock implements HeapSize, Comparable<LruCachedBlock> { @Override public int hashCode() { return (int)(accessTime ^ (accessTime >>> 32)); } LruCachedBlock(BlockCacheKey cacheKey, Cacheable buf, long accessTime); LruCachedBlock(BlockCacheKey cacheKey, Cacheable buf, long accessTime, boolean...
### Question: BucketCache implements BlockCache, HeapSize { void stopWriterThreads() throws InterruptedException { for (WriterThread writerThread : writerThreads) { writerThread.disableWriter(); writerThread.interrupt(); writerThread.join(); } } BucketCache(String ioEngineName, long capacity, int blockSize, int[] bucke...
### Question: Reference { public static Reference read(final FileSystem fs, final Path p) throws IOException { InputStream in = fs.open(p); try { in = in.markSupported()? in: new BufferedInputStream(in); int pblen = ProtobufUtil.lengthOfPBMagic(); in.mark(pblen); byte [] pbuf = new byte[pblen]; int read = in.read(pbuf)...
### Question: MetaMigrationConvertingToPB { static boolean isMetaTableUpdated(final HConnection hConnection) throws IOException { List<Result> results = MetaTableAccessor.fullScanOfMeta(hConnection); if (results == null || results.isEmpty()) { LOG.info("hbase:meta doesn't have any entries to update."); return true; } f...
### Question: WsImportMojo extends AbstractJaxwsMojo { static String getActiveHttpProxy(Settings s) { String retVal = null; for (Proxy p : s.getProxies()) { if (p.isActive() && "http".equals(p.getProtocol())) { StringBuilder sb = new StringBuilder(); String user = p.getUsername(); String pwd = p.getPassword(); if (user...
### Question: TracingHttpClientBuilder extends HttpClientBuilder { public TracingHttpClientBuilder disableInjection() { this.injectDisabled = true; return this; } TracingHttpClientBuilder(); TracingHttpClientBuilder( RedirectStrategy redirectStrategy, boolean redirectHandlingDisabled); TracingHttpClie...
### Question: WXBizMsgCrypt { public String verifyUrl(String msgSignature, String timeStamp, String nonce, String echoStr) throws AesException { String signature = SHA1.getSHA1(token, timeStamp, nonce, echoStr); if (!signature.equals(msgSignature)) { throw new AesException(AesException.ValidateSignatureError); } String...
### Question: MainActivityPresenter implements MainActivityContract.Presenter { @VisibleForTesting void checkAndroidVersionCompatibility() { if (!supportedByArtist()) { mView.showIncompatibleAndroidVersionDialog(); } } MainActivityPresenter(MainActivityContract.View view, SettingsManager setti...
### Question: MainActivityPresenter implements MainActivityContract.Presenter { @Override public void selectFragment(@selectableFragment int id) { Fragment selectedFragment = null; switch (id) { case INFO_FRAGMENT: if (mInfoFragment == null) { mInfoFragment = new InfoFragment(); } selectedFragment = mInfoFragment; brea...
### Question: POP3Store extends Store { @Override public synchronized boolean isConnected() { if (!super.isConnected()) return false; try { if (port == null) port = getPort(null); else if (!port.noop()) throw new IOException("NOOP failed"); return true; } catch (IOException ioex) { try { super.close(); } catch (Messagi...
### Question: PropUtil { @Deprecated public static int getIntSessionProperty(Session session, String name, int def) { return getInt(getProp(session.getProperties(), name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props, ...
### Question: SeverityComparator implements Comparator<LogRecord>, Serializable { @Override public boolean equals(final Object o) { return o == null ? false : o.getClass() == getClass(); } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throw...
### Question: SeverityComparator implements Comparator<LogRecord>, Serializable { @Override public int hashCode() { return 31 * getClass().hashCode(); } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throwable t1, final Throwable t2); @Suppr...
### Question: PropUtil { @Deprecated public static boolean getBooleanSessionProperty(Session session, String name, boolean def) { return getBoolean(getProp(session.getProperties(), name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Pr...
### Question: CompactFormatter extends java.util.logging.Formatter { public String formatLevel(final LogRecord record) { return record.getLevel().getLocalizedName(); } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(final LogRec...
### Question: CompactFormatter extends java.util.logging.Formatter { public String formatLoggerName(final LogRecord record) { return simpleClassName(record.getLoggerName()); } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(fina...
### Question: CompactFormatter extends java.util.logging.Formatter { public Number formatThreadID(final LogRecord record) { return (((long) record.getThreadID()) & 0xffffffffL); } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(...
### Question: CompactFormatter extends java.util.logging.Formatter { public String formatError(final LogRecord record) { return formatMessage(record.getThrown()); } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(final LogRecord...
### Question: PropUtil { public static boolean getBooleanSystemProperty(String name, boolean def) { try { return getBoolean(getProp(System.getProperties(), name), def); } catch (SecurityException sex) { } try { String value = System.getProperty(name); if (value == null) return def; if (def) return !value.equalsIgnoreCa...
### Question: CompactFormatter extends java.util.logging.Formatter { protected Throwable apply(final Throwable t) { return SeverityComparator.getInstance().apply(t); } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(final LogRec...
### Question: PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props, String name, boolean def); @Depr...
### Question: CompactFormatter extends java.util.logging.Formatter { protected String toAlternate(final String s) { return s != null ? s.replaceAll("[\\x00-\\x1F\\x7F]+", "") : null; } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMes...
### Question: CollectorFormatter extends Formatter { @Override public String toString() { String result; try { result = formatRecord((Handler) null, false); } catch (final RuntimeException ignore) { result = super.toString(); } return result; } CollectorFormatter(); CollectorFormatter(String format); CollectorFormatt...