method2testcases stringlengths 118 6.63k |
|---|
### Question:
ControllerFactory { public static Controller createController(final Config config) throws UnsupportedEnvironmentException, ConfigurationException { try { Class.forName("com.oracle.jrockit.jfr.Producer"); throw new UnsupportedEnvironmentException( "Not enabling profiling; it requires Oracle Java 11+."); } ... |
### Question:
ProfilingSystem { final Duration getStartupDelay() { return startupDelay; } ProfilingSystem(
final Controller controller,
final RecordingDataListener dataListener,
final Duration startupDelay,
final Duration startupDelayRandomRange,
final Duration uploadPeriod,
final bo... |
### Question:
ConstantPool { public int size() { return indexMap.size(); } ConstantPool(); ConstantPool(int startingIndex); T get(int index); int getOrInsert(T constant); void insert(int ptr, T constant); int size(); }### Answer:
@Test void size() { String value1 = "test1"; String value2 = "test2"; assertEquals(0, i... |
### Question:
AbstractLEB128Writer implements LEB128Writer { static int getPackedIntLen(long data) { if ((data & COMPRESSED_INT_MASK) == 0) { return 1; } data >>= 7; if ((data & COMPRESSED_INT_MASK) == 0) { return 2; } data >>= 7; if ((data & COMPRESSED_INT_MASK) == 0) { return 3; } data >>= 7; if ((data & COMPRESSED_I... |
### Question:
OpenJdkOngoingRecording implements OngoingRecording { @Override public OpenJdkRecordingData stop() { if (recording.getState() != RecordingState.RUNNING) { throw new IllegalStateException("Cannot stop recording that is not running"); } recording.stop(); return new OpenJdkRecordingData(recording); } OpenJdk... |
### Question:
Java8OptionalConverterFactory extends Converter.Factory { public static Java8OptionalConverterFactory create() { return new Java8OptionalConverterFactory(); } private Java8OptionalConverterFactory(); static Java8OptionalConverterFactory create(); @Override @Nullable Converter<ResponseBody, ?> responseBod... |
### Question:
NetworkBehavior { public void setVariancePercent(int variancePercent) { checkPercentageValidity(variancePercent, "Variance percentage must be between 0 and 100."); this.variancePercent = variancePercent; } private NetworkBehavior(Random random); static NetworkBehavior create(); @SuppressWarnings("Constan... |
### Question:
NetworkBehavior { public void setFailurePercent(int failurePercent) { checkPercentageValidity(failurePercent, "Failure percentage must be between 0 and 100."); this.failurePercent = failurePercent; } private NetworkBehavior(Random random); static NetworkBehavior create(); @SuppressWarnings("ConstantCondi... |
### Question:
NetworkBehavior { @SuppressWarnings("ConstantConditions") public void setFailureException(Throwable exception) { if (exception == null) { throw new NullPointerException("exception == null"); } this.failureException = exception; } private NetworkBehavior(Random random); static NetworkBehavior create(); @S... |
### Question:
NetworkBehavior { public void setErrorPercent(int errorPercent) { checkPercentageValidity(errorPercent, "Error percentage must be between 0 and 100."); this.errorPercent = errorPercent; } private NetworkBehavior(Random random); static NetworkBehavior create(); @SuppressWarnings("ConstantConditions") // G... |
### Question:
NetworkBehavior { @SuppressWarnings("ConstantConditions") public void setErrorFactory(Callable<Response<?>> errorFactory) { if (errorFactory == null) { throw new NullPointerException("errorFactory == null"); } this.errorFactory = errorFactory; } private NetworkBehavior(Random random); static NetworkBehav... |
### Question:
MockRetrofit { public Retrofit retrofit() { return retrofit; } MockRetrofit(Retrofit retrofit, NetworkBehavior behavior, ExecutorService executor); Retrofit retrofit(); NetworkBehavior networkBehavior(); Executor backgroundExecutor(); @SuppressWarnings("unchecked") // Single-interface proxy creation guard... |
### Question:
MockRetrofit { public NetworkBehavior networkBehavior() { return behavior; } MockRetrofit(Retrofit retrofit, NetworkBehavior behavior, ExecutorService executor); Retrofit retrofit(); NetworkBehavior networkBehavior(); Executor backgroundExecutor(); @SuppressWarnings("unchecked") // Single-interface proxy ... |
### Question:
MockRetrofit { public Executor backgroundExecutor() { return executor; } MockRetrofit(Retrofit retrofit, NetworkBehavior behavior, ExecutorService executor); Retrofit retrofit(); NetworkBehavior networkBehavior(); Executor backgroundExecutor(); @SuppressWarnings("unchecked") // Single-interface proxy crea... |
### Question:
Calls { public static <T> Call<T> response(@Nullable T successValue) { return new FakeCall<>(Response.success(successValue), null); } private Calls(); static Call<T> defer(Callable<Call<T>> callable); static Call<T> response(@Nullable T successValue); static Call<T> response(Response<T> response); static... |
### Question:
Calls { public static <T> Call<T> failure(IOException failure) { return new FakeCall<>(null, failure); } private Calls(); static Call<T> defer(Callable<Call<T>> callable); static Call<T> response(@Nullable T successValue); static Call<T> response(Response<T> response); static Call<T> failure(IOException ... |
### Question:
Result { @SuppressWarnings("ConstantConditions") public static <T> Result<T> response(Response<T> response) { if (response == null) throw new NullPointerException("response == null"); return new Result<>(response, null); } private Result(@Nullable Response<T> response, @Nullable Throwable error); @Suppre... |
### Question:
Calls { public static <T> Call<T> defer(Callable<Call<T>> callable) { return new DeferredCall<>(callable); } private Calls(); static Call<T> defer(Callable<Call<T>> callable); static Call<T> response(@Nullable T successValue); static Call<T> response(Response<T> response); static Call<T> failure(IOExcept... |
### Question:
Result { @SuppressWarnings("ConstantConditions") public static <T> Result<T> error(Throwable error) { if (error == null) throw new NullPointerException("error == null"); return new Result<>(null, error); } private Result(@Nullable Response<T> response, @Nullable Throwable error); @SuppressWarnings("Const... |
### Question:
RxJava2CallAdapterFactory extends CallAdapter.Factory { @SuppressWarnings("ConstantConditions") public static RxJava2CallAdapterFactory createWithScheduler(Scheduler scheduler) { if (scheduler == null) throw new NullPointerException("scheduler == null"); return new RxJava2CallAdapterFactory(scheduler, fal... |
### Question:
JaxbConverterFactory extends Converter.Factory { public static JaxbConverterFactory create() { return new JaxbConverterFactory(null); } private JaxbConverterFactory(@Nullable JAXBContext context); static JaxbConverterFactory create(); @SuppressWarnings("ConstantConditions") // Guarding API nullability. s... |
### Question:
ScalaCallAdapterFactory extends CallAdapter.Factory { @Override public @Nullable CallAdapter<?, ?> get( Type returnType, Annotation[] annotations, Retrofit retrofit) { if (getRawType(returnType) != Future.class) { return null; } if (!(returnType instanceof ParameterizedType)) { throw new IllegalStateExcep... |
### Question:
Java8CallAdapterFactory extends CallAdapter.Factory { @Override public @Nullable CallAdapter<?, ?> get( Type returnType, Annotation[] annotations, Retrofit retrofit) { if (getRawType(returnType) != CompletableFuture.class) { return null; } if (!(returnType instanceof ParameterizedType)) { throw new Illega... |
### Question:
MoshiConverterFactory extends Converter.Factory { public MoshiConverterFactory asLenient() { return new MoshiConverterFactory(moshi, true, failOnUnknown, serializeNulls); } private MoshiConverterFactory(
Moshi moshi, boolean lenient, boolean failOnUnknown, boolean serializeNulls); static MoshiConve... |
### Question:
RxJavaCallAdapterFactory extends CallAdapter.Factory { @SuppressWarnings("ConstantConditions") public static RxJavaCallAdapterFactory createWithScheduler(Scheduler scheduler) { if (scheduler == null) throw new NullPointerException("scheduler == null"); return new RxJavaCallAdapterFactory(scheduler, false)... |
### Question:
Result { @SuppressWarnings("ConstantConditions") public static <T> Result<T> response(Response<T> response) { if (response == null) throw new NullPointerException("response == null"); return new Result<>(response, null); } private Result(@Nullable Response<T> response, @Nullable Throwable error); @Suppre... |
### Question:
MoshiConverterFactory extends Converter.Factory { public MoshiConverterFactory failOnUnknown() { return new MoshiConverterFactory(moshi, lenient, true, serializeNulls); } private MoshiConverterFactory(
Moshi moshi, boolean lenient, boolean failOnUnknown, boolean serializeNulls); static MoshiConvert... |
### Question:
Result { @SuppressWarnings("ConstantConditions") public static <T> Result<T> error(Throwable error) { if (error == null) throw new NullPointerException("error == null"); return new Result<>(null, error); } private Result(@Nullable Response<T> response, @Nullable Throwable error); @SuppressWarnings("Const... |
### Question:
GuavaCallAdapterFactory extends CallAdapter.Factory { @Override public @Nullable CallAdapter<?, ?> get( Type returnType, Annotation[] annotations, Retrofit retrofit) { if (getRawType(returnType) != ListenableFuture.class) { return null; } if (!(returnType instanceof ParameterizedType)) { throw new Illegal... |
### Question:
DefaultCallAdapterFactory extends CallAdapter.Factory { @Override public @Nullable CallAdapter<?, ?> get( Type returnType, Annotation[] annotations, Retrofit retrofit) { if (getRawType(returnType) != Call.class) { return null; } if (!(returnType instanceof ParameterizedType)) { throw new IllegalArgumentEx... |
### Question:
GuavaOptionalConverterFactory extends Converter.Factory { public static GuavaOptionalConverterFactory create() { return new GuavaOptionalConverterFactory(); } private GuavaOptionalConverterFactory(); static GuavaOptionalConverterFactory create(); @Override @Nullable Converter<ResponseBody, ?> responseBod... |
### Question:
Response { public static <T> Response<T> success(@Nullable T body) { return success( body, new okhttp3.Response.Builder() .code(200) .message("OK") .protocol(Protocol.HTTP_1_1) .request(new Request.Builder().url("http: .build()); } private Response(
okhttp3.Response rawResponse, @Nullable T body, @... |
### Question:
Response { public static <T> Response<T> error(int code, ResponseBody body) { Objects.requireNonNull(body, "body == null"); if (code < 400) throw new IllegalArgumentException("code < 400: " + code); return error( body, new okhttp3.Response.Builder() .body(new OkHttpCall.NoContentResponseBody(body.contentT... |
### Question:
RxJava3CallAdapterFactory extends CallAdapter.Factory { @SuppressWarnings("ConstantConditions") public static RxJava3CallAdapterFactory createWithScheduler(Scheduler scheduler) { if (scheduler == null) throw new NullPointerException("scheduler == null"); return new RxJava3CallAdapterFactory(scheduler, fal... |
### 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 HttpUrl baseUrl() { return baseUrl; } Retrofit(
okhttp3.Call.Factory callFactory,
HttpUrl baseUrl,
List<Converter.Factory> converterFactories,
List<CallAdapter.Factory> callAdapterFactories,
@Nullable Executor callbackExecutor,
boolean validateEagerly)... |
### 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:
CompletableFutureCallAdapterFactory extends CallAdapter.Factory { @Override public @Nullable CallAdapter<?, ?> get( Type returnType, Annotation[] annotations, Retrofit retrofit) { if (getRawType(returnType) != CompletableFuture.class) { return null; } if (!(returnType instanceof ParameterizedType)) { thro... |
### 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("/", "/​"); 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 extends AbstractProcessor { private void filterClass(List<Reference> result, Collection<? extends Element> elements) { for (Element element : elements) { final ElementKind kind = element.getKind(); if (ElementKind.CLASS.equals(kind) || ElementKind.ENUM.equals(kind)) { result.add(new Refere... |
### 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:
EnforcingScanLabelGenerator implements ScanLabelGenerator { public EnforcingScanLabelGenerator() { this.labelsCache = VisibilityLabelsCache.get(); } EnforcingScanLabelGenerator(); @Override void setConf(Configuration conf); @Override Configuration getConf(); @Override List<String> getLabels(User user, Aut... |
### Question:
HttpServer implements FilterContainer { @Override public String toString() { if (listeners.size() == 0) { return "Inactive HttpServer"; } else { StringBuilder sb = new StringBuilder("HttpServer (") .append(isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE).append("), listening at:"); for (L... |
### Question:
NamespaceAuditor { public NamespaceTableAndRegionInfo getState(String namespace) { if (stateManager.isInitialized()) { return stateManager.getState(namespace); } return null; } NamespaceAuditor(MasterServices masterServices); void start(); void checkQuotaToCreateTable(TableName tName, int regions); void c... |
### Question:
NamespaceAuditor { public void deleteNamespace(String namespace) throws IOException { stateManager.deleteNamespace(namespace); } NamespaceAuditor(MasterServices masterServices); void start(); void checkQuotaToCreateTable(TableName tName, int regions); void checkQuotaToUpdateRegion(TableName tName, int reg... |
### 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 int hashCode() { int result = tableName != null ? tableName.hashCode() : 0; result = 31 * result + (scan != null ? scan.hashCode() : 0); result = 31 * result + (startRow != null ? Arrays.hashCode(startRow) : 0); r... |
### 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:
TableSplit extends InputSplit implements Writable, Comparable<TableSplit> { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("HBase table split("); sb.append("table name: ").append(tableName); sb.append(", scan: ").append(scan); sb.append(", start row: ").append(Bytes... |
### Question:
TableInputFormatBase extends InputFormat<ImmutableBytesWritable, Result> { @Deprecated public String reverseDNS(InetAddress ipAddress) throws NamingException, UnknownHostException { String hostName = this.reverseDNSCacheMap.get(ipAddress); if (hostName == null) { String ipAddressString = null; try { ipAdd... |
### Question:
LoadIncrementalHFiles extends Configured implements Tool { protected List<LoadQueueItem> splitStoreFile(final LoadQueueItem item, final Table table, byte[] startKey, byte[] splitKey) throws IOException { final Path hfilePath = item.hfilePath; final String TMP_DIR = "_tmp"; Path tmpDir = item.hfilePath.get... |
### Question:
HttpServer implements FilterContainer { public void stop() throws Exception { MultiException exception = null; for (ListenerInfo li : listeners) { if (!li.isManaged) { continue; } try { li.listener.close(); } catch (Exception e) { LOG.error( "Error while stopping listener for webapp" + webAppContext.getDi... |
### Question:
LoadIncrementalHFiles extends Configured implements Tool { public static byte[][] inferBoundaries(TreeMap<byte[], Integer> bdryMap) { ArrayList<byte[]> keysArray = new ArrayList<byte[]>(); int runningValue = 0; byte[] currStartKey = null; boolean firstBoundary = true; for (Map.Entry<byte[], Integer> item:... |
### Question:
LoadIncrementalHFiles extends Configured implements Tool { @Override public int run(String[] args) throws Exception { if (args.length != 2) { usage(); return -1; } initialize(); String dirPath = args[0]; TableName tableName = TableName.valueOf(args[1]); boolean tableExists = this.doesTableExist(tableName)... |
### 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 { @Override public int run(String[] args) throws Exception { String[] otherArgs = new GenericOptionsParser(getConf(), args).getRemainingArgs(); Job job = createSubmittableJob(otherArgs); if (job == null) return 1; if (!job.waitForCompletion(true)) { LOG.info("M... |
### 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> { @Override public RecordWriter<ImmutableBytesWritable, KeyValue> getRecordWriter( final TaskAttemptContext context) throws IOException, InterruptedException { return HFileOutputFormat2.createRecordWriter(context); } @Override R... |
### 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:
CellCounter { public static void main(String[] args) throws Exception { Configuration conf = HBaseConfiguration.create(); String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs(); if (otherArgs.length < 2) { System.err.println("ERROR: Wrong number of parameters: " + args.length); Syste... |
### Question:
FSHDFSUtils extends FSUtils { public static boolean isSameHdfs(Configuration conf, FileSystem srcFs, FileSystem desFs) { String srcServiceName = srcFs.getCanonicalServiceName(); String desServiceName = desFs.getCanonicalServiceName(); if (srcServiceName == null || desServiceName == null) { return false; }... |
### 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:
WALFactory { public WAL getWAL(final byte[] identifier) throws IOException { return provider.getWAL(identifier); } private WALFactory(Configuration conf); WALFactory(final Configuration conf, final List<WALActionsListener> listeners,
final String factoryId); void close(); void shutdown(); WAL getW... |
### Question:
FSTableDescriptors implements TableDescriptors { @VisibleForTesting static int getTableInfoSequenceId(final Path p) { if (p == null) return 0; Matcher m = TABLEINFO_FILE_REGEX.matcher(p.getName()); if (!m.matches()) throw new IllegalArgumentException(p.toString()); String suffix = m.group(2); if (suffix =... |
### 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:
CoprocessorHost { protected void loadSystemCoprocessors(Configuration conf, String confKey) { boolean coprocessorsEnabled = conf.getBoolean(COPROCESSORS_ENABLED_CONF_KEY, DEFAULT_COPROCESSORS_ENABLED); if (!coprocessorsEnabled) { return; } Class<?> implClass = null; String[] defaultCPClasses = conf.getStr... |
### Question:
FSTableDescriptors implements TableDescriptors { private static String formatTableInfoSequenceId(final int number) { byte [] b = new byte[WIDTH_OF_SEQUENCE_ID]; int d = Math.abs(number); for (int i = b.length - 1; i >= 0; i--) { b[i] = (byte)((d % 10) + '0'); d /= 10; } return Bytes.toString(b); } FSTable... |
### Question:
HttpRequestLog { public static RequestLog getRequestLog(String name) { String lookup = serverToComponent.get(name); if (lookup != null) { name = lookup; } String loggerName = "http.requests." + name; String appenderName = name + "requestlog"; Log logger = LogFactory.getLog(loggerName); if (logger instance... |
### 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:
HMasterCommandLine extends ServerCommandLine { public int run(String args[]) throws Exception { Options opt = new Options(); opt.addOption("localRegionServers", true, "RegionServers to start in master process when running standalone"); opt.addOption("masters", true, "Masters to start in this process"); op... |
### 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:
FavoredNodeAssignmentHelper { void placePrimaryRSAsRoundRobin(Map<ServerName, List<HRegionInfo>> assignmentMap, Map<HRegionInfo, ServerName> primaryRSMap, List<HRegionInfo> regions) { List<String> rackList = new ArrayList<String>(rackToRegionServerMap.size()); rackList.addAll(rackToRegionServerMap.keySet(... |
### Question:
FSTableDescriptors implements TableDescriptors { @Override public Map<String, HTableDescriptor> getAll() throws IOException { Map<String, HTableDescriptor> htds = new TreeMap<String, HTableDescriptor>(); if (fsvisited && usecache) { for (Map.Entry<TableName, HTableDescriptor> entry: this.cache.entrySet())... |
### Question:
BaseLoadBalancer implements LoadBalancer { @Override public Map<HRegionInfo, ServerName> immediateAssignment(List<HRegionInfo> regions, List<ServerName> servers) { metricsBalancer.incrMiscInvocations(); if (servers == null || servers.isEmpty()) { LOG.warn("Wanted to do random assignment but no servers to ... |
### 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:
FSTableDescriptors implements TableDescriptors { @Override public HTableDescriptor get(final TableName tablename) throws IOException { invocations++; if (TableName.META_TABLE_NAME.equals(tablename)) { cachehits++; return metaTableDescriptor; } if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(tablename.ge... |
### 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.