method2testcases stringlengths 118 6.63k |
|---|
### Question:
Counters extends AbstractCounters<Counters.Counter, Counters.Group> { public void incrCounter(Enum<?> key, long amount) { findCounter(key).increment(amount); } Counters(); Counters(org.apache.hadoop.mapreduce.Counters newCounters); synchronized Group getGroup(String groupName); @SuppressWarnings("uncheck... |
### Question:
Counters extends AbstractCounters<Counters.Counter, Counters.Group> { public synchronized String makeCompactString() { StringBuilder builder = new StringBuilder(); boolean first = true; for(Group group: this){ for(Counter counter: group) { if (first) { first = false; } else { builder.append(','); } builde... |
### Question:
ResourceMgrDelegate extends YarnClientImpl { public QueueInfo[] getRootQueues() throws IOException, InterruptedException { return TypeConverter.fromYarnQueueInfo(super.getRootQueueInfos(), this.conf); } ResourceMgrDelegate(YarnConfiguration conf); void cancelDelegationToken(Token<DelegationTokenIdentifier... |
### Question:
ResourceMgrDelegate extends YarnClientImpl { public JobStatus[] getAllJobs() throws IOException, InterruptedException { return TypeConverter.fromYarnApps(super.getApplicationList(), this.conf); } ResourceMgrDelegate(YarnConfiguration conf); void cancelDelegationToken(Token<DelegationTokenIdentifier> arg0)... |
### Question:
ClientServiceDelegate { public org.apache.hadoop.mapreduce.Counters getJobCounters(JobID arg0) throws IOException, InterruptedException { org.apache.hadoop.mapreduce.v2.api.records.JobId jobID = TypeConverter.toYarn(arg0); GetCountersRequest request = recordFactory.newRecordInstance(GetCountersRequest.cla... |
### Question:
ContainerLauncherImpl extends AbstractService implements
ContainerLauncher { @Override public void handle(ContainerLauncherEvent event) { try { eventQueue.put(event); this.allNodes.add(event.getContainerMgrAddress()); } catch (InterruptedException e) { throw new YarnException(e); } } ContainerLauncher... |
### Question:
Constraints { public static void remove(HTableDescriptor desc) { disable(desc); List<ImmutableBytesWritable> keys = new ArrayList<ImmutableBytesWritable>(); for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e : desc .getValues().entrySet()) { String key = Bytes.toString((e.getKey().get())); S... |
### Question:
MRAppMaster extends CompositeService { protected static void initAndStartAppMaster(final MRAppMaster appMaster, final JobConf conf, String jobUserName) throws IOException, InterruptedException { UserGroupInformation.setConfiguration(conf); Credentials credentials = UserGroupInformation.getCurrentUser().ge... |
### Question:
TaskImpl implements Task, EventHandler<TaskEvent> { @Override public void handle(TaskEvent event) { if (LOG.isDebugEnabled()) { LOG.debug("Processing " + event.getTaskID() + " of type " + event.getType()); } try { writeLock.lock(); TaskStateInternal oldState = getInternalState(); try { stateMachine.doTran... |
### Question:
TaskImpl implements Task, EventHandler<TaskEvent> { @Override public float getProgress() { readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); if (bestAttempt == null) { return 0f; } return bestAttempt.getProgress(); } finally { readLock.unlock(); } } TaskImpl(JobId jobId, TaskType taskT... |
### Question:
LoadTypedBytes implements Tool { public int run(String[] args) throws Exception { if (args.length == 0) { System.err.println("Too few arguments!"); printUsage(); return 1; } Path path = new Path(args[0]); FileSystem fs = path.getFileSystem(getConf()); if (fs.exists(path)) { System.err.println("given path ... |
### Question:
DumpTypedBytes implements Tool { public int run(String[] args) throws Exception { if (args.length == 0) { System.err.println("Too few arguments!"); printUsage(); return 1; } Path pattern = new Path(args[0]); FileSystem fs = pattern.getFileSystem(getConf()); fs.setVerifyChecksum(true); for (Path p : FileUt... |
### Question:
DistCpUtils { public static void preserve(FileSystem targetFS, Path path, FileStatus srcFileStatus, EnumSet<FileAttribute> attributes) throws IOException { FileStatus targetFileStatus = targetFS.getFileStatus(path); String group = targetFileStatus.getGroup(); String user = targetFileStatus.getOwner(); boo... |
### Question:
ThrottledInputStream extends InputStream { @Override public int read() throws IOException { throttle(); int data = rawStream.read(); if (data != -1) { bytesRead++; } return data; } ThrottledInputStream(InputStream rawStream); ThrottledInputStream(InputStream rawStream, long maxBytesPerSec); @Override int... |
### Question:
ResourceCalculatorProcessTree extends Configured { public static ResourceCalculatorProcessTree getResourceCalculatorProcessTree( String pid, Class<? extends ResourceCalculatorProcessTree> clazz, Configuration conf) { if (clazz != null) { try { Constructor <? extends ResourceCalculatorProcessTree> c = claz... |
### Question:
ProcfsBasedProcessTree extends ResourceCalculatorProcessTree { @Override public boolean checkPidPgrpidForMatch() { return checkPidPgrpidForMatch(pid, PROCFS); } ProcfsBasedProcessTree(String pid); ProcfsBasedProcessTree(String pid, String procfsDir); static boolean isAvailable(); @Override void updatePro... |
### Question:
ConverterUtils { public static String toString(ApplicationId appId) { return appId.toString(); } static Path getPathFromYarnURL(URL url); static Map<String, String> convertToString(
Map<CharSequence, CharSequence> env); static URL getYarnUrlFromPath(Path path); static URL getYarnUrlFromURI(URI uri)... |
### Question:
ApplicationClassLoader extends URLClassLoader { @VisibleForTesting static URL[] constructUrlsFromClasspath(String classpath) throws MalformedURLException { List<URL> urls = new ArrayList<URL>(); for (String element : Splitter.on(File.pathSeparator).split(classpath)) { if (element.endsWith("/*")) { String ... |
### Question:
ApplicationClassLoader extends URLClassLoader { @VisibleForTesting static boolean isSystemClass(String name, List<String> systemClasses) { if (systemClasses != null) { String canonicalName = name.replace('/', '.'); while (canonicalName.startsWith(".")) { canonicalName=canonicalName.substring(1); } for (St... |
### Question:
ApplicationClassLoader extends URLClassLoader { @Override public URL getResource(String name) { URL url = null; if (!isSystemClass(name, systemClasses)) { url= findResource(name); if (url == null && name.startsWith("/")) { if (LOG.isDebugEnabled()) { LOG.debug("Remove leading / off " + name); } url= findR... |
### Question:
HFileArchiveUtil { public static Path getTableArchivePath(Path tabledir) { Path root = tabledir.getParent(); return getTableArchivePath(root, tabledir.getName()); } private HFileArchiveUtil(); static Path getStoreArchivePath(final Configuration conf, final String tableName,
final String regionName,... |
### Question:
WebApp extends ServletModule { public void stop() { try { checkNotNull(httpServer, "httpServer").stop(); checkNotNull(guiceFilter, "guiceFilter").destroy(); } catch (Exception e) { throw new WebAppException(e); } } @Provides HttpServer httpServer(); InetSocketAddress getListenerAddress(); int port(); voi... |
### Question:
ServiceOperations { public static void init(Service service, Configuration configuration) { Service.STATE state = service.getServiceState(); ensureCurrentState(state, Service.STATE.NOTINITED); service.init(configuration); } private ServiceOperations(); static void ensureCurrentState(Service.STATE state,
... |
### Question:
ServiceOperations { public static void deploy(Service service, Configuration configuration) { init(service, configuration); start(service); } private ServiceOperations(); static void ensureCurrentState(Service.STATE state,
Service.STATE expectedState); static void ... |
### Question:
ServiceOperations { public static void stop(Service service) { if (service != null) { Service.STATE state = service.getServiceState(); if (state == Service.STATE.STARTED) { service.stop(); } } } private ServiceOperations(); static void ensureCurrentState(Service.STATE state,
... |
### Question:
HFileArchiveUtil { public static Path getArchivePath(Configuration conf) throws IOException { return getArchivePath(FSUtils.getRootDir(conf)); } private HFileArchiveUtil(); static Path getStoreArchivePath(final Configuration conf, final String tableName,
final String regionName, final String family... |
### Question:
LinuxContainerExecutor extends ContainerExecutor { @Override public boolean signalContainer(String user, String pid, Signal signal) throws IOException { String[] command = new String[] { containerExecutorExe, user, Integer.toString(Commands.SIGNAL_CONTAINER.getValue()), pid, Integer.toString(signal.getVal... |
### Question:
ProcessIdFileReader { public static String getProcessId(Path path) throws IOException { if (path == null) { throw new IOException("Trying to access process id from a null path"); } LOG.debug("Accessing pid from pid file " + path); String processId = null; FileReader fileReader = null; BufferedReader bufRe... |
### Question:
HFileArchiveUtil { public static Path getRegionArchiveDir(Configuration conf, Path tabledir, Path regiondir) { Path archiveDir = getTableArchivePath(tabledir); String encodedRegionName = regiondir.getName(); return HRegion.getRegionDir(archiveDir, encodedRegionName); } private HFileArchiveUtil(); static ... |
### Question:
NMAuditLogger { static void start(Keys key, String value, StringBuilder b) { b.append(key.name()).append(AuditConstants.KEY_VAL_SEPARATOR).append(value); } static void logSuccess(String user, String operation, String target,
ApplicationId appId, ContainerId containerId); static void logSuccess(Stri... |
### Question:
NodeManager extends CompositeService implements
ServiceStateChangeListener { @Override public void init(Configuration conf) { conf.setBoolean(Dispatcher.DISPATCHER_EXIT_ON_ERROR_KEY, true); NMContainerTokenSecretManager containerTokenSecretManager = null; if (UserGroupInformation.isSecurityEnabled()) ... |
### Question:
DirectoryCollection { synchronized boolean createNonExistentDirs(FileContext localFs, FsPermission perm) { boolean failed = false; for (final String dir : localDirs) { try { createDir(localFs, new Path(dir), perm); } catch (IOException e) { LOG.warn("Unable to create directory " + dir + " error " + e.getM... |
### Question:
LocalDirsHandlerService extends AbstractService { @Override public void init(Configuration config) { Configuration conf = new Configuration(config); diskHealthCheckInterval = conf.getLong( YarnConfiguration.NM_DISK_HEALTH_CHECK_INTERVAL_MS, YarnConfiguration.DEFAULT_NM_DISK_HEALTH_CHECK_INTERVAL_MS); moni... |
### Question:
NonAggregatingLogHandler extends AbstractService implements
LogHandler { @Override public void stop() { if (sched != null) { sched.shutdown(); boolean isShutdown = false; try { isShutdown = sched.awaitTermination(10, TimeUnit.SECONDS); } catch (InterruptedException e) { sched.shutdownNow(); isShutdown... |
### Question:
HFileArchiveUtil { public static Path getStoreArchivePath(final Configuration conf, final String tableName, final String regionName, final String familyName) throws IOException { Path tableArchiveDir = getTableArchivePath(conf, tableName); return Store.getStoreHomedir(tableArchiveDir, regionName, familyNa... |
### Question:
ContainerLaunch implements Callable<Integer> { static void writeLaunchEnv(OutputStream out, Map<String,String> environment, Map<Path,List<String>> resources, List<String> command) throws IOException { ShellScriptBuilder sb = new ShellScriptBuilder(); if (environment != null) { for (Map.Entry<String,String... |
### Question:
AuxServices extends AbstractService implements ServiceStateChangeListener, EventHandler<AuxServicesEvent> { public AuxServices() { super(AuxServices.class.getName()); serviceMap = Collections.synchronizedMap(new HashMap<String,AuxiliaryService>()); serviceMeta = Collections.synchronizedMap(new HashMap<Str... |
### Question:
Threads { public static void sleepWithoutInterrupt(final long msToWait) { long timeMillis = System.currentTimeMillis(); long endTime = timeMillis + msToWait; boolean interrupted = false; while (timeMillis < endTime) { try { Thread.sleep(endTime - timeMillis); } catch (InterruptedException ex) { interrupte... |
### Question:
ResourceManager extends CompositeService implements Recoverable { public RMContext getRMContext() { return this.rmContext; } ResourceManager(); RMContext getRMContext(); @Override synchronized void init(Configuration conf); @Override void start(); @Override void stop(); @Private ClientRMService getClientR... |
### Question:
RMAuditLogger { static void start(Keys key, String value, StringBuilder b) { b.append(key.name()).append(AuditConstants.KEY_VAL_SEPARATOR).append(value); } static void logSuccess(String user, String operation, String target,
ApplicationId appId, ContainerId containerId); static void logSuccess(Str... |
### Question:
ClientRMService extends AbstractService implements
ClientRMProtocol { @Override public GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request) throws YarnRemoteException { GetClusterNodesResponse response = recordFactory.newRecordInstance(GetClusterNodesResponse.class); Collection<RMNo... |
### Question:
ClientRMService extends AbstractService implements
ClientRMProtocol { @Override public GetApplicationReportResponse getApplicationReport( GetApplicationReportRequest request) throws YarnRemoteException { ApplicationId applicationId = request.getApplicationId(); UserGroupInformation callerUGI; try { ca... |
### Question:
ClientRMService extends AbstractService implements
ClientRMProtocol { @Override public GetQueueInfoResponse getQueueInfo(GetQueueInfoRequest request) throws YarnRemoteException { GetQueueInfoResponse response = recordFactory.newRecordInstance(GetQueueInfoResponse.class); try { QueueInfo queueInfo = sc... |
### Question:
FifoScheduler implements ResourceScheduler, Configurable { @Override public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, boolean recursive) { return DEFAULT_QUEUE.getQueueInfo(false, false); } @Override synchronized void setConf(Configuration conf); @Override synchronized Configur... |
### Question:
SchedulerUtils { public static void normalizeRequest(ResourceRequest ask, int minMemory) { int memory = Math.max(ask.getCapability().getMemory(), minMemory); ask.getCapability().setMemory( minMemory * ((memory / minMemory) + (memory % minMemory > 0 ? 1 : 0))); } static ContainerStatus createAbnormalConta... |
### Question:
FairScheduler implements ResourceScheduler { public QueueManager getQueueManager() { return queueMgr; } FairScheduler(); FairSchedulerConfiguration getConf(); QueueManager getQueueManager(); RMContainerTokenSecretManager getContainerTokenSecretManager(); synchronized double getAppWeight(AppSchedulable app... |
### Question:
FairScheduler implements ResourceScheduler { boolean isStarvedForMinShare(FSLeafQueue sched) { Resource desiredShare = Resources.min(sched.getMinShare(), sched.getDemand()); return Resources.lessThan(sched.getResourceUsage(), desiredShare); } FairScheduler(); FairSchedulerConfiguration getConf(); QueueMan... |
### Question:
FairScheduler implements ResourceScheduler { boolean isStarvedForFairShare(FSLeafQueue sched) { Resource desiredFairShare = Resources.max( Resources.multiply(sched.getFairShare(), .5), sched.getDemand()); return Resources.lessThan(sched.getResourceUsage(), desiredFairShare); } FairScheduler(); FairSchedul... |
### Question:
FSLeafQueue extends FSQueue { @Override public void updateDemand() { Resource maxRes = queueMgr.getMaxResources(getName()); demand = Resources.createResource(0); for (AppSchedulable sched : appScheds) { sched.updateDemand(); Resource toAdd = sched.getDemand(); if (LOG.isDebugEnabled()) { LOG.debug("Counti... |
### Question:
CapacityScheduler implements ResourceScheduler, CapacitySchedulerContext, Configurable { @Lock(CapacityScheduler.class) static CSQueue parseQueue( CapacitySchedulerContext csContext, CapacitySchedulerConfiguration conf, CSQueue parent, String queueName, Map<String, CSQueue> queues, Map<String, CSQueue> ol... |
### Question:
ProxyUriUtils { public static String getPath(ApplicationId id) { if(id == null) { throw new IllegalArgumentException("Application id cannot be null "); } return ujoin(PROXY_BASE, uriEncode(id)); } static String getPath(ApplicationId id); static String getPath(ApplicationId id, String path); static String... |
### Question:
ByteBufferUtils { public static void writeVLong(ByteBuffer out, long i) { if (i >= -112 && i <= 127) { out.put((byte) i); return; } int len = -112; if (i < 0) { i ^= -1L; len = -120; } long tmp = i; while (tmp != 0) { tmp = tmp >> 8; len--; } out.put((byte) len); len = (len < -120) ? -(len + 120) : -(len ... |
### Question:
ProxyUriUtils { public static String getPathAndQuery(ApplicationId id, String path, String query, boolean approved) { StringBuilder newp = new StringBuilder(); newp.append(getPath(id, path)); boolean first = appendQuery(newp, query, true); if(approved) { appendQuery(newp, PROXY_APPROVAL_PARAM+"=true", fir... |
### Question:
ProxyUriUtils { public static URI getProxyUri(URI originalUri, URI proxyUri, ApplicationId id) { try { String path = getPath(id, originalUri == null ? "/" : originalUri.getPath()); return new URI(proxyUri.getScheme(), proxyUri.getAuthority(), path, originalUri == null ? null : originalUri.getQuery(), orig... |
### Question:
ProxyUriUtils { public static URI getUriFromTrackingPlugins(ApplicationId id, List<TrackingUriPlugin> trackingUriPlugins) throws URISyntaxException { URI toRet = null; for(TrackingUriPlugin plugin : trackingUriPlugins) { toRet = plugin.getTrackingUri(id); if (toRet != null) { return toRet; } } return null... |
### Question:
KerberosName { public String getRealm() { return realm; } KerberosName(String name); String getDefaultRealm(); @Override String toString(); String getServiceName(); String getHostName(); String getRealm(); String getShortName(); static void setRules(String ruleString); static boolean hasRulesBeenSet(); }... |
### Question:
ByteBufferUtils { public static void moveBufferToStream(OutputStream out, ByteBuffer in, int length) throws IOException { copyBufferToStream(out, in, in.position(), length); skip(in, length); } private ByteBufferUtils(); static void writeVLong(ByteBuffer out, long i); static long readVLong(ByteBuffer in)... |
### Question:
HttpServer implements FilterContainer { @Override public String toString() { return listener != null ? ("HttpServer at http: + (isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE)) : "Inactive HttpServer"; } HttpServer(String name, String bindAddress, int port, boolean findPort
); Htt... |
### Question:
DataChecksum implements Checksum { public static DataChecksum newDataChecksum( int type, int bytesPerChecksum ) { if ( bytesPerChecksum <= 0 ) { return null; } switch ( type ) { case CHECKSUM_NULL : return new DataChecksum( CHECKSUM_NULL, new ChecksumNull(), CHECKSUM_NULL_SIZE, bytesPerChecksum ); case CH... |
### Question:
DataChecksum implements Checksum { @Override public String toString() { String strType = getNameOfType(type); return "DataChecksum(type=" + strType + ", chunkSize=" + bytesPerChecksum + ")"; } private DataChecksum( int checksumType, Checksum checksum,
int sumSize, int chunkSize );... |
### Question:
HostsFileReader { public synchronized void refresh() throws IOException { LOG.info("Refreshing hosts (include/exclude) list"); if (!includesFile.equals("")) { Set<String> newIncludes = new HashSet<String>(); readFileToSet(includesFile, newIncludes); includes = newIncludes; } if (!excludesFile.equals("")) ... |
### Question:
ByteBufferUtils { public static void copyBufferToStream(OutputStream out, ByteBuffer in, int offset, int length) throws IOException { if (in.hasArray()) { out.write(in.array(), in.arrayOffset() + offset, length); } else { for (int i = 0; i < length; ++i) { out.write(in.get(offset + i)); } } } private Byt... |
### Question:
StringUtils { public static String escapeString(String str) { return escapeString(str, ESCAPE_CHAR, COMMA); } static String stringifyException(Throwable e); static String simpleHostname(String fullHostname); @Deprecated static String humanReadableInt(long number); static String format(final String format... |
### Question:
StringUtils { public static String[] split(String str) { return split(str, ESCAPE_CHAR, COMMA); } static String stringifyException(Throwable e); static String simpleHostname(String fullHostname); @Deprecated static String humanReadableInt(long number); static String format(final String format, final Obje... |
### Question:
StringUtils { public static String unEscapeString(String str) { return unEscapeString(str, ESCAPE_CHAR, COMMA); } static String stringifyException(Throwable e); static String simpleHostname(String fullHostname); @Deprecated static String humanReadableInt(long number); static String format(final String fo... |
### Question:
StringUtils { public static String join(CharSequence separator, Iterable<?> strings) { Iterator<?> i = strings.iterator(); if (!i.hasNext()) { return ""; } StringBuilder sb = new StringBuilder(i.next().toString()); while (i.hasNext()) { sb.append(separator); sb.append(i.next().toString()); } return sb.toS... |
### Question:
StringUtils { public static String[] getTrimmedStrings(String str){ if (null == str || "".equals(str.trim())) { return emptyStringArray; } return str.trim().split("\\s*,\\s*"); } static String stringifyException(Throwable e); static String simpleHostname(String fullHostname); @Deprecated static String hu... |
### Question:
StringUtils { public static URI[] stringToURI(String[] str){ if (str == null) return null; URI[] uris = new URI[str.length]; for (int i = 0; i < str.length;i++){ try{ uris[i] = new URI(str[i]); }catch(URISyntaxException ur){ throw new IllegalArgumentException( "Failed to create uri for " + str[i], ur); } ... |
### Question:
ByteBufferUtils { public static void copyFromStreamToBuffer(ByteBuffer out, DataInputStream in, int length) throws IOException { if (out.hasArray()) { in.readFully(out.array(), out.position() + out.arrayOffset(), length); skip(out, length); } else { for (int i = 0; i < length; ++i) { out.put(in.readByte()... |
### Question:
StringUtils { public static String simpleHostname(String fullHostname) { if (InetAddresses.isInetAddress(fullHostname)) { return fullHostname; } int offset = fullHostname.indexOf('.'); if (offset != -1) { return fullHostname.substring(0, offset); } return fullHostname; } static String stringifyException(... |
### Question:
VersionUtil { public static int compareVersions(String version1, String version2) { boolean isSnapshot1 = version1.endsWith(SNAPSHOT_SUFFIX); boolean isSnapshot2 = version2.endsWith(SNAPSHOT_SUFFIX); version1 = stripSnapshotSuffix(version1); version2 = stripSnapshotSuffix(version2); String[] version1Parts... |
### Question:
NativeLibraryChecker { public static void main(String[] args) { String usage = "NativeLibraryChecker [-a|-h]\n" + " -a use -a to check all libraries are available\n" + " by default just check hadoop library is available\n" + " exit with error code if check failed\n" + " -h print this message\n"; if (args.... |
### Question:
NativeCodeLoader { public static boolean isNativeCodeLoaded() { return nativeCodeLoaded; } static boolean isNativeCodeLoaded(); static native boolean buildSupportsSnappy(); boolean getLoadNativeLibraries(Configuration conf); void setLoadNativeLibraries(Configuration conf,
... |
### Question:
ClassUtil { public static String findContainingJar(Class clazz) { ClassLoader loader = clazz.getClassLoader(); String classFile = clazz.getName().replaceAll("\\.", "/") + ".class"; try { for (Enumeration itr = loader.getResources(classFile); itr.hasMoreElements();) { URL url = (URL) itr.nextElement(); if ... |
### Question:
ByteBufferUtils { public static void copyFromBufferToBuffer(ByteBuffer out, ByteBuffer in, int sourceOffset, int length) { if (in.hasArray() && out.hasArray()) { System.arraycopy(in.array(), sourceOffset + in.arrayOffset(), out.array(), out.position() + out.arrayOffset(), length); skip(out, length); } els... |
### Question:
NodeFencer { public boolean fence(HAServiceTarget fromSvc) { LOG.info("====== Beginning Service Fencing Process... ======"); int i = 0; for (FenceMethodWithArg method : methods) { LOG.info("Trying method " + (++i) + "/" + methods.size() +": " + method); try { if (method.method.tryFence(fromSvc, method.arg... |
### Question:
ShellCommandFencer extends Configured implements FenceMethod { @Override public boolean tryFence(HAServiceTarget target, String cmd) { ProcessBuilder builder = new ProcessBuilder( "bash", "-e", "-c", cmd); setConfAsEnvVars(builder.environment()); addTargetInfoAsEnvVars(target, builder.environment()); Proc... |
### Question:
ByteBufferUtils { public static int intFitsIn(final int value) { if (value < 0) { return 4; } if (value < (1 << 2 * 8)) { if (value < (1 << 1 * 8)) { return 1; } return 2; } if (value <= (1 << 3 * 8)) { return 3; } return 4; } private ByteBufferUtils(); static void writeVLong(ByteBuffer out, long i); sta... |
### Question:
HAZKUtil { public static List<ACL> parseACLs(String aclString) { List<ACL> acl = Lists.newArrayList(); if (aclString == null) { return acl; } List<String> aclComps = Lists.newArrayList( Splitter.on(',').omitEmptyStrings().trimResults() .split(aclString)); for (String a : aclComps) { int firstColon = a.ind... |
### Question:
HAZKUtil { public static List<ZKAuthInfo> parseAuth(String authString) { List<ZKAuthInfo> ret = Lists.newArrayList(); if (authString == null) { return ret; } List<String> authComps = Lists.newArrayList( Splitter.on(',').omitEmptyStrings().trimResults() .split(authString)); for (String comp : authComps) { ... |
### Question:
ByteBufferUtils { public static int longFitsIn(final long value) { if (value < 0) { return 8; } if (value < (1l << 4 * 8)) { if (value < (1l << 2 * 8)) { if (value < (1l << 1 * 8)) { return 1; } return 2; } if (value < (1l << 3 * 8)) { return 3; } return 4; } if (value < (1l << 6 * 8)) { if (value < (1l <... |
### Question:
HAZKUtil { public static String resolveConfIndirection(String valInConf) throws IOException { if (valInConf == null) return null; if (!valInConf.startsWith("@")) { return valInConf; } String path = valInConf.substring(1).trim(); return Files.toString(new File(path), Charsets.UTF_8).trim(); } static List<... |
### Question:
ActiveStandbyElector implements StatCallback, StringCallback { public synchronized void joinElection(byte[] data) throws HadoopIllegalArgumentException { if (data == null) { throw new HadoopIllegalArgumentException("data cannot be null"); } if (wantToBeInElection) { LOG.info("Already in election. Not re-c... |
### Question:
ActiveStandbyElector implements StatCallback, StringCallback { public synchronized void quitElection(boolean needFence) { LOG.info("Yielding from election"); if (!needFence && state == State.ACTIVE) { tryDeleteOwnBreadCrumbNode(); } reset(); wantToBeInElection = false; } ActiveStandbyElector(String zookee... |
### Question:
ActiveStandbyElector implements StatCallback, StringCallback { public synchronized byte[] getActiveData() throws ActiveNotFoundException, KeeperException, InterruptedException, IOException { try { if (zkClient == null) { createConnection(); } Stat stat = new Stat(); return getDataWithRetries(zkLockFilePat... |
### Question:
ActiveStandbyElector implements StatCallback, StringCallback { public synchronized void ensureParentZNode() throws IOException, InterruptedException { Preconditions.checkState(!wantToBeInElection, "ensureParentZNode() may not be called while in the election"); String pathParts[] = znodeWorkingDir.split("/... |
### Question:
ActiveStandbyElector implements StatCallback, StringCallback { synchronized void processWatchEvent(ZooKeeper zk, WatchedEvent event) { Event.EventType eventType = event.getType(); if (isStaleClient(zk)) return; LOG.debug("Watcher event type: " + eventType + " with state:" + event.getState() + " for path:"... |
### Question:
ByteBufferUtils { public static boolean arePartsEqual(ByteBuffer buffer, int offsetLeft, int lengthLeft, int offsetRight, int lengthRight) { if (lengthLeft != lengthRight) { return false; } if (buffer.hasArray()) { return 0 == Bytes.compareTo( buffer.array(), buffer.arrayOffset() + offsetLeft, lengthLeft,... |
### Question:
HAAdmin extends Configured implements Tool { private int help(String[] argv) { if (argv.length == 1) { printUsage(out); return 0; } else if (argv.length != 2) { printUsage(errOut, "-help"); return -1; } String cmd = argv[1]; if (!cmd.startsWith("-")) { cmd = "-" + cmd; } UsageInfo usageInfo = USAGE.get(cm... |
### Question:
HealthMonitor { public void addCallback(Callback cb) { this.callbacks.add(cb); } HealthMonitor(Configuration conf, HAServiceTarget target); void addCallback(Callback cb); void removeCallback(Callback cb); void shutdown(); synchronized HAServiceProtocol getProxy(); }### Answer:
@Test(timeout=15000) public... |
### Question:
ByteBufferUtils { public static void putInt(OutputStream out, final int value) throws IOException { for (int i = Bytes.SIZEOF_INT - 1; i >= 0; --i) { out.write((byte) (value >>> (i * 8))); } } private ByteBufferUtils(); static void writeVLong(ByteBuffer out, long i); static long readVLong(ByteBuffer in);... |
### Question:
IOUtils { public static void writeFully(WritableByteChannel bc, ByteBuffer buf) throws IOException { do { bc.write(buf); } while (buf.remaining() > 0); } static void copyBytes(InputStream in, OutputStream out, int buffSize, boolean close); static void copyBytes(InputStream in, OutputStream out, int buffS... |
### Question:
IOUtils { public static int wrappedReadForCompressedData(InputStream is, byte[] buf, int off, int len) throws IOException { try { return is.read(buf, off, len); } catch (IOException ie) { throw ie; } catch (Throwable t) { throw new IOException("Error while reading compressed data", t); } } static void co... |
### Question:
IOUtils { public static void skipFully(InputStream in, long len) throws IOException { long amt = len; while (amt > 0) { long ret = in.skip(amt); if (ret == 0) { int b = in.read(); if (b == -1) { throw new EOFException( "Premature EOF from inputStream after " + "skipping " + (len - amt) + " byte(s)."); } r... |
### Question:
SecureIOUtils { static FileInputStream forceSecureOpenForRead(File f, String expectedOwner, String expectedGroup) throws IOException { FileInputStream fis = new FileInputStream(f); boolean success = false; try { Stat stat = NativeIO.getFstat(fis.getFD()); checkStat(f, stat.getOwner(), stat.getGroup(), exp... |
### 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) { LOG.info("No regions under directory:" + table... |
### Question:
NativeIO { private static native Stat fstat(FileDescriptor fd) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long offset, ... |
### Question:
NativeIO { public static Stat getFstat(FileDescriptor fd) throws IOException { Stat stat = fstat(fd); stat.owner = getName(IdCache.USER, stat.ownerId); stat.group = getName(IdCache.GROUP, stat.groupId); return stat; } static boolean isAvailable(); static native FileDescriptor open(String path, int flags,... |
### Question:
NativeIO { public static native FileDescriptor open(String path, int flags, int mode) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescr... |
### Question:
NativeIO { public static native void chmod(String path, int mode) throws IOException; static boolean isAvailable(); static native FileDescriptor open(String path, int flags, int mode); static native void chmod(String path, int mode); static void posixFadviseIfPossible(
FileDescriptor fd, long offse... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.