_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q162200
LookasideCacheFileSystem.mapCachePath
train
Path mapCachePath(Path hdfsPath) { assert hdfsPath.isAbsolute(); Path value = new Path(cacheDir + Path.SEPARATOR + hdfsPath); return value; }
java
{ "resource": "" }
q162201
LookasideCacheFileSystem.evictCache
train
public void evictCache(Path hdfsPath, Path localPath, long size) throws IOException { boolean done = cacheFs.delete(localPath, false); if (!done) { if (LOG.isDebugEnabled()) { LOG.debug("Evict for path: " + hdfsPath + " local path " + localPath + " unsuccessful."); } ...
java
{ "resource": "" }
q162202
LookasideCacheFileSystem.create
train
@Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { FSDataOutputStream fd = new FSDataOutputStream( new CacheOutputStream(conf, thi...
java
{ "resource": "" }
q162203
Command.runAll
train
public int runAll() { int exitCode = 0; if (args == null) { // no argument return run(); } for (String src : args) { try { Path srcPath = new Path(src); FileSystem fs = srcPath.getFileSystem(getConf()); FileStatus[] statuses = fs.globStatus(srcPath); if (...
java
{ "resource": "" }
q162204
FreightStreamer.printToStdout
train
private void printToStdout(InputStream in) throws IOException { try { IOUtils.copyBytes(in, System.out, getConf(), false); } finally { in.close(); } }
java
{ "resource": "" }
q162205
FreightStreamer.copyToLocal
train
private void copyToLocal(final FileSystem srcFS, final Path src, final File dst, final boolean copyCrc) throws IOException { /* Keep the structure similar to ChecksumFileSystem.copyToLocal(). * Ideal these two should just invoke FileUtil.copy() and not repeat * recursion he...
java
{ "resource": "" }
q162206
FreightStreamer.tail
train
private void tail(String[] cmd, int pos) throws IOException { CommandFormat c = new CommandFormat("tail", 1, 1, "f"); String src = null; Path path = null; try { List<String> parameters = c.parse(cmd, pos); src = parameters.get(0); } catch(IllegalArgumentException iae) { System.err...
java
{ "resource": "" }
q162207
LayoutVersion.supports
train
public static boolean supports(final Feature f, final int lv) { final EnumSet<Feature> set = map.get(lv); return set != null && set.contains(f); }
java
{ "resource": "" }
q162208
GetConf.doWork
train
private int doWork(String[] args) { if (args.length == 1) { CommandHandler handler = Command.getHandler(args[0]); if (handler != null) { return handler.doWork(this); } } printUsage(); return -1; }
java
{ "resource": "" }
q162209
JobInProgressTraits.reportTasksInProgress
train
public Vector<TaskInProgress> reportTasksInProgress(boolean shouldBeMap, boolean shouldBeComplete) { Vector<TaskInProgress> results = new Vector<TaskInProgress>(); TaskInProgress tips[] = null; if (shouldBeMap) { tips = maps; } else { tips = reduces; } for (int i = 0; i < tips.lengt...
java
{ "resource": "" }
q162210
JobInProgressTraits.reportCleanupTIPs
train
public Vector<TaskInProgress> reportCleanupTIPs(boolean shouldBeComplete) { Vector<TaskInProgress> results = new Vector<TaskInProgress>(); for (int i = 0; i < cleanup.length; i++) { if (cleanup[i].isComplete() == shouldBeComplete) { results.add(cleanup[i]); } } return results; }
java
{ "resource": "" }
q162211
JobInProgressTraits.reportSetupTIPs
train
public Vector<TaskInProgress> reportSetupTIPs(boolean shouldBeComplete) { Vector<TaskInProgress> results = new Vector<TaskInProgress>(); for (int i = 0; i < setup.length; i++) { if (setup[i].isComplete() == shouldBeComplete) { results.add(setup[i]); } } return results; }
java
{ "resource": "" }
q162212
JobInProgressTraits.getTaskInProgress
train
public TaskInProgress getTaskInProgress(TaskID tipid) { if (tipid.isMap()) { if (cleanup.length > 0 && tipid.equals(cleanup[0].getTIPId())) { // cleanup map tip return cleanup[0]; } if (setup.length > 0 && tipid.equals(setup[0].getTIPId())) { //setup map tip return setup[0]; ...
java
{ "resource": "" }
q162213
BinaryProtocol.close
train
public void close() throws IOException, InterruptedException { LOG.debug("closing connection"); stream.close(); uplink.closeConnection(); uplink.interrupt(); uplink.join(); }
java
{ "resource": "" }
q162214
BinaryProtocol.writeObject
train
private void writeObject(Writable obj) throws IOException { // For Text and BytesWritable, encode them directly, so that they end up // in C++ as the natural translations. if (obj instanceof Text) { Text t = (Text) obj; int len = t.getLength(); WritableUtils.writeVInt(stream, len); s...
java
{ "resource": "" }
q162215
HdfsProxy.stop
train
public void stop() { try { if (server != null) { server.stop(); server.join(); } } catch (Exception e) { LOG.warn("Got exception shutting down proxy", e); } }
java
{ "resource": "" }
q162216
Path.getParent
train
public Path getParent() { String path = uri.getPath(); int lastSlash = path.lastIndexOf('/'); int start = hasWindowsDrive(path, true) ? 3 : 0; if ((path.length() == start) || // empty path (lastSlash == start && path.length() == start+1)) { // at root return null; } S...
java
{ "resource": "" }
q162217
Path.makeQualified
train
public Path makeQualified(FileSystem fs) { Path path = this; if (!isAbsolute()) { FileSystem.LogForCollect .info("make Qualify non absolute path: " + this.toString() + " working directory: " + fs.getWorkingDirectory()); path = new Path(fs.getWorkingDirectory(), this); } ...
java
{ "resource": "" }
q162218
ValueAggregatorBaseDescriptor.configure
train
public void configure(JobConf job) { this.inputFile = job.get("map.input.file"); maxNumItems = job.getLong("aggregate.max.num.unique.values", Long.MAX_VALUE); }
java
{ "resource": "" }
q162219
INodeHardLinkFile.loadHardLinkFileInfo
train
public static HardLinkFileInfo loadHardLinkFileInfo(long hardLinkID, FSImageLoadingContext context) { // update the latest hard link ID context.getFSDirectory().resetLastHardLinkIDIfLarge(hardLinkID); // create the hard link file info if necessary HardLinkFileInfo fileInfo = context.getHar...
java
{ "resource": "" }
q162220
DirectoryTraversal.getNextFile
train
public FileStatus getNextFile() throws IOException { // Check if traversal is done. while (!doneTraversal()) { // If traversal is not done, check if the stack is not empty. while (!stack.isEmpty()) { // If the stack is not empty, look at the top node. Node node = stack.peek(); ...
java
{ "resource": "" }
q162221
TotalOrderPartitioner.getPartition
train
@SuppressWarnings("unchecked") // is memcmp-able and uses the trie public int getPartition(K key, V value, int numPartitions) { return partitions.findPartition(key); }
java
{ "resource": "" }
q162222
TotalOrderPartitioner.readPartitions
train
@SuppressWarnings("unchecked") // map output key class private K[] readPartitions(FileSystem fs, Path p, Class<K> keyClass, JobConf job) throws IOException { SequenceFile.Reader reader = new SequenceFile.Reader(fs, p, job); ArrayList<K> parts = new ArrayList<K>(); K key = (K) ReflectionUtils.newInst...
java
{ "resource": "" }
q162223
TotalOrderPartitioner.buildTrie
train
private TrieNode buildTrie(BinaryComparable[] splits, int lower, int upper, byte[] prefix, int maxDepth) { final int depth = prefix.length; if (depth >= maxDepth || lower == upper) { return new LeafTrieNode(depth, splits, lower, upper); } InnerTrieNode result = new InnerTrieNode(depth); ...
java
{ "resource": "" }
q162224
DFSActionImpl.mkdir
train
private void mkdir(IStructuredSelection selection) { List<DFSFolder> folders = filterSelection(DFSFolder.class, selection); if (folders.size() >= 1) { DFSFolder folder = folders.get(0); InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Create subfol...
java
{ "resource": "" }
q162225
DFSActionImpl.open
train
private void open(IStructuredSelection selection) throws IOException, PartInitException, InvocationTargetException, InterruptedException { for (DFSFile file : filterSelection(DFSFile.class, selection)) { IStorageEditorInput editorInput = new DFSFileEditorInput(file); targetPart.getSite().getWork...
java
{ "resource": "" }
q162226
JobInitializer.getAverageWaitMsecsPerHardAdmissionJob
train
synchronized float getAverageWaitMsecsPerHardAdmissionJob() { float averageWaitMsecsPerHardAdmissionJob = -1f; if (!hardAdmissionMillisQueue.isEmpty()) { long totalWait = 0; for (Long waitMillis : hardAdmissionMillisQueue) { totalWait += waitMillis; } averageWaitMsecsPerHardAdmis...
java
{ "resource": "" }
q162227
JobInitializer.getJobAdmissionWaitInfo
train
synchronized JobAdmissionWaitInfo getJobAdmissionWaitInfo(JobInProgress job) { Integer rank = jobToRank.get(job); int position = (rank == null) ? -1 : rank; float averageWaitMsecsPerHardAdmissionJob = getAverageWaitMsecsPerHardAdmissionJob(); return new JobAdmissionWaitInfo( exceedTaskLi...
java
{ "resource": "" }
q162228
ServerLogReaderAvatar.detectJournalManager
train
protected void detectJournalManager() throws IOException { int failures = 0; do { try { Stat stat = new Stat(); String primaryAddr = zk.getPrimaryAvatarAddress(logicalName, stat, true, true); if (primaryAddr == null || primaryAd...
java
{ "resource": "" }
q162229
ArrayOutputStream.expandIfNecessary
train
private void expandIfNecessary(int size) { if (bytes.length >= size) { // no need to expand return; } // either double, or expand to fit size int newlength = Math.max(2 * bytes.length, size); bytes = Arrays.copyOf(bytes, newlength); }
java
{ "resource": "" }
q162230
ArrayOutputStream.write
train
public void write(byte b[], int off, int len) { expandIfNecessary(count + len); System.arraycopy(b, off, bytes, count, len); count += len; }
java
{ "resource": "" }
q162231
LsImageVisitor.newLine
train
private void newLine() { numBlocks = 0; perms = username = group = path = linkTarget = replication = hardlinkId = ""; filesize = 0l; type = INode.INodeType.REGULAR_INODE.toString(); inInode = true; }
java
{ "resource": "" }
q162232
ReduceTask.getMapFiles
train
private Path[] getMapFiles(FileSystem fs, boolean isLocal) throws IOException { List<Path> fileList = new ArrayList<Path>(); if (isLocal) { // for local jobs for(int i = 0; i < numMaps; ++i) { fileList.add(mapOutputFile.getInputFile(i, getTaskID())); } } else { // for non l...
java
{ "resource": "" }
q162233
ReduceTask.getClosestPowerOf2
train
private static int getClosestPowerOf2(int value) { if (value <= 0) throw new IllegalArgumentException("Undefined for " + value); final int hob = Integer.highestOneBit(value); return Integer.numberOfTrailingZeros(hob) + (((hob >>> 1) & value) == 0 ? 0 : 1); }
java
{ "resource": "" }
q162234
BookKeeperJournalMetadataManager.init
train
public void init() throws IOException { try { if (zooKeeper.exists(zooKeeperParentPath, false) == null) { zooKeeper.create(zooKeeperParentPath, new byte[] { '0' }, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); LOG.info("Created ZNode " + zooKeeperParentPath); } i...
java
{ "resource": "" }
q162235
BookKeeperJournalMetadataManager.fullyQualifiedPathForLedger
train
public String fullyQualifiedPathForLedger(EditLogLedgerMetadata e) { String nameForLedger = nameForLedger(e); return fullyQualifiedPathForLedger(nameForLedger); }
java
{ "resource": "" }
q162236
BookKeeperJournalMetadataManager.deleteLedgerMetadata
train
public boolean deleteLedgerMetadata(EditLogLedgerMetadata ledger, int version) throws IOException { String ledgerPath = fullyQualifiedPathForLedger(ledger); try { zooKeeper.delete(ledgerPath, version); return true; } catch (KeeperException.NoNodeException e) { LOG.warn(ledgerPath + "...
java
{ "resource": "" }
q162237
BookKeeperJournalMetadataManager.verifyEditLogLedgerMetadata
train
public boolean verifyEditLogLedgerMetadata(EditLogLedgerMetadata metadata, String fullPathToVerify) { Preconditions.checkNotNull(metadata); try { EditLogLedgerMetadata otherMetadata = readEditLogLedgerMetadata(fullPathToVerify); if (otherMetadata == null) { LOG.warn("No metad...
java
{ "resource": "" }
q162238
BookKeeperJournalMetadataManager.listLedgers
train
public Collection<EditLogLedgerMetadata> listLedgers( boolean includeInProgressLedgers) throws IOException { // Use TreeSet to sort ledgers by firstTxId TreeSet<EditLogLedgerMetadata> ledgers = new TreeSet<EditLogLedgerMetadata>(); try { List<String> ledgerNames = zooKeeper.getChildren(...
java
{ "resource": "" }
q162239
DataStorage.doMerge
train
boolean doMerge(String[] srcDataDirs, Collection<File> dstDataDirs, int namespaceId, NamespaceInfo nsInfo, StartupOption startOpt) throws IOException { HashMap<File, File> dirsToMerge = new HashMap<File, File>(); int i = 0; for (Iterator<File> it = dstDataDirs.iterator(); it.hasNext(); i++) { ...
java
{ "resource": "" }
q162240
DataStorage.recoverTransitionRead
train
void recoverTransitionRead(DataNode datanode, int namespaceId, NamespaceInfo nsInfo, Collection<File> dataDirs, StartupOption startOpt, String nameserviceId) throws IOException { // First ensure datanode level format/snapshot/rollback is completed // recoverTransitionRead(datanode, nsInfo, dataDirs, start...
java
{ "resource": "" }
q162241
DataStorage.makeNameSpaceDataDir
train
public static void makeNameSpaceDataDir(Collection<File> dataDirs) throws IOException { for (File data : dataDirs) { try { DiskChecker.checkDir(data); } catch ( IOException e ) { LOG.warn("Invalid directory in: " + data.getCanonicalPath() + ": " + e.getMessage()); } ...
java
{ "resource": "" }
q162242
DataStorage.doTransition
train
private void doTransition(List<StorageDirectory> sds, NamespaceInfo nsInfo, StartupOption startOpt ) throws IOException { if (startOpt == StartupOption.ROLLBACK) doRollback(nsInfo); // rollback if applicable int numOf...
java
{ "resource": "" }
q162243
DataStorage.addNameSpaceStorage
train
private void addNameSpaceStorage(int nsID, NameSpaceSliceStorage nsStorage) throws IOException { if (!this.nsStorageMap.containsKey(nsID)) { this.nsStorageMap.put(nsID, nsStorage); } }
java
{ "resource": "" }
q162244
Host2NodesMap.contains
train
boolean contains(DatanodeDescriptor node) { if (node==null) { return false; } String host = node.getHost(); hostmapLock.readLock().lock(); try { DatanodeDescriptor[] nodes = map.get(host); if (nodes != null) { for(DatanodeDescriptor containedNode:nodes) { i...
java
{ "resource": "" }
q162245
Host2NodesMap.add
train
boolean add(DatanodeDescriptor node) { hostmapLock.writeLock().lock(); try { if (node==null || contains(node)) { return false; } String host = node.getHost(); DatanodeDescriptor[] nodes = map.get(host); DatanodeDescriptor[] newNodes; if (nodes==null) { ...
java
{ "resource": "" }
q162246
Host2NodesMap.remove
train
boolean remove(DatanodeDescriptor node) { if (node==null) { return false; } String host = node.getHost(); hostmapLock.writeLock().lock(); try { DatanodeDescriptor[] nodes = map.get(host); if (nodes==null) { return false; } if (nodes.length==1) { ...
java
{ "resource": "" }
q162247
Host2NodesMap.getDatanodeByName
train
@Deprecated public DatanodeDescriptor getDatanodeByName(String name) { if (name == null) { return null; } int colon = name.indexOf(":"); String host; if (colon < 0) { host = name; } else { host = name.substring(0, colon); } hostmapLock.readLock().lock(); try { ...
java
{ "resource": "" }
q162248
ValueAggregatorMapper.reduce
train
public void reduce(Text arg0, Iterator<Text> arg1, OutputCollector<Text, Text> arg2, Reporter arg3) throws IOException { throw new IOException("should not be called\n"); }
java
{ "resource": "" }
q162249
TaskErrorCollector.getRecentErrorCounts
train
public synchronized Map<TaskError, Integer> getRecentErrorCounts(long timeWindow) { long start = System.currentTimeMillis() - timeWindow; Map<TaskError, Integer> errorCounts = createErrorCountsMap(); Iterator<Map<TaskError, Integer>> errorCountsIter = errorCountsQueue.iterator(); Iterator<Long> startTim...
java
{ "resource": "" }
q162250
TaskErrorCollector.parseConfigFile
train
private Map<String, TaskError> parseConfigFile(URL configURL) { Map<String, TaskError> knownErrors = new LinkedHashMap<String, TaskError>(); try { Element root = getRootElement(configURL); NodeList elements = root.getChildNodes(); for (int i = 0; i < elements.getLength(); ++i) { Node n...
java
{ "resource": "" }
q162251
CoronaJobTracker.processBadResource
train
public void processBadResource(int grant, boolean abandonHost) { synchronized (lockObject) { Set<String> excludedHosts = null; TaskInProgress tip = requestToTipMap.get(grant); if (!job.canLaunchJobCleanupTask() && (!tip.isRunnable() || (tip.isRunning() && !(specul...
java
{ "resource": "" }
q162252
CoronaJobTracker.updateTaskStatuses
train
private void updateTaskStatuses(TaskTrackerStatus status) { TaskTrackerInfo trackerInfo = TaskTrackerInfo.fromStatus(status); String trackerName = status.getTrackerName(); for (TaskStatus report : status.getTaskReports()) { // Ensure that every report has information about task tracker report.se...
java
{ "resource": "" }
q162253
CoronaJobTracker.updateTaskStatus
train
private void updateTaskStatus(TaskTrackerInfo info, TaskStatus report) { TaskAttemptID taskId = report.getTaskID(); // Here we want strict job id comparison. if (!this.jobId.equals(taskId.getJobID())) { LOG.warn("Task " + taskId + " belongs to unknown job " + taskId.getJobID()); retur...
java
{ "resource": "" }
q162254
CoronaJobTracker.saveNewRequestForTip
train
private void saveNewRequestForTip(TaskInProgress tip, ResourceRequest req) { requestToTipMap.put(req.getId(), tip); TaskContext context = taskToContextMap.get(tip); if (context == null) { context = new TaskContext(req); } else { context.resourceRequests.add(req); } taskToContextMap.p...
java
{ "resource": "" }
q162255
CoronaJobTracker.getNewJobId
train
@Override public JobID getNewJobId() throws IOException { int value = jobCounter.incrementAndGet(); if (value > 1) { throw new RuntimeException( "CoronaJobTracker can only run one job! (value=" + value + ")"); } createSession(); // the jobtracker can run only a single job. it's jobid...
java
{ "resource": "" }
q162256
CoronaJobTracker.dispatchCommitActions
train
private void dispatchCommitActions(List<CommitTaskAction> commitActions) throws IOException { if (!commitActions.isEmpty()) { TaskAttemptID[] wasCommitting; try { wasCommitting = commitPermissionClient .getAndSetCommitting(commitActions); } catch (IOException e) { ...
java
{ "resource": "" }
q162257
CoronaJobTracker.isMatchingJobId
train
private boolean isMatchingJobId(JobID jobId) { if (isStandalone) { // Requests to remote JT must hold exact attempt id. return this.jobId.equals(jobId); } else { // Local JT serves as translator between job id and job attempt id. return this.jobId.equals(getMainJobID(jobId)); } }
java
{ "resource": "" }
q162258
CoronaJobTracker.expiredLaunchingTask
train
public void expiredLaunchingTask(TaskAttemptID taskId) { synchronized (lockObject) { String trackerName = taskLookupTable.getAssignedTracker(taskId); trackerStats.recordTimeout(trackerName); localJTSubmitter.submit(new TaskTimeout(trackerName)); failTask(taskId, "Error launching task", false...
java
{ "resource": "" }
q162259
CoronaJobTracker.prepareFailover
train
public void prepareFailover() { if (!RemoteJTProxy.isJTRestartingEnabled(conf)) { return; } LOG.info("prepareFailover done"); this.isPurgingJob = false; if (this.parentHeartbeat != null) { // Because our failover mechanism based on remotJTProxy can't // reach remote...
java
{ "resource": "" }
q162260
StreamJob.go
train
@Deprecated public int go() throws IOException { try { return run(argv_); } catch (Exception ex) { throw new IOException(ex.getMessage()); } }
java
{ "resource": "" }
q162261
StreamJob.listJobConfProperties
train
protected void listJobConfProperties() { msg("==== JobConf properties:"); Iterator it = jobConf_.iterator(); TreeMap sorted = new TreeMap(); while(it.hasNext()) { Map.Entry en = (Map.Entry)it.next(); sorted.put(en.getKey(), en.getValue()); } it = sorted.entrySet().iterator(); w...
java
{ "resource": "" }
q162262
StreamJob.submitAndMonitorJob
train
public int submitAndMonitorJob() throws IOException { if (jar_ != null && isLocalHadoop()) { // getAbs became required when shell and subvm have different working dirs... File wd = new File(".").getAbsoluteFile(); StreamUtil.unJar(new File(jar_), wd); } // if jobConf_ changes must recrea...
java
{ "resource": "" }
q162263
DFSOutputStream.checkIfLastPacketTimeout
train
private void checkIfLastPacketTimeout() { synchronized (ackQueue) { if( !ackQueue.isEmpty() && ( System.currentTimeMillis() - lastPacketSentTime > packetTimeout) ) { DFSClient.LOG.warn("Packet " + ackQueue.getLast().seqno + " of...
java
{ "resource": "" }
q162264
DFSOutputStream.setupPipelineForAppend
train
private boolean setupPipelineForAppend(LocatedBlock lastBlock) throws IOException { if (nodes == null || nodes.length == 0) { String msg = "Could not get block locations. " + "Source file \"" + src + "\" - Aborting..."; DFSClient.LOG.warn(msg); setLastException(new IOException(...
java
{ "resource": "" }
q162265
DFSOutputStream.nextBlockOutputStream
train
private DatanodeInfo[] nextBlockOutputStream(String client) throws IOException { LocatedBlock lb = null; boolean retry = false; DatanodeInfo[] nodes; ArrayList<DatanodeInfo> excludedNodes = new ArrayList<DatanodeInfo>(); int count = dfsClient.conf.getInt("dfs.client.block.write.retries", 3); boo...
java
{ "resource": "" }
q162266
DFSOutputStream.sync
train
public void sync() throws IOException { long start = System.currentTimeMillis(); try { long toWaitFor; synchronized (this) { eventStartSync(); /* Record current blockOffset. This might be changed inside * flushBuffer() where a partial checksum chunk might be flushed. ...
java
{ "resource": "" }
q162267
DFSOutputStream.flushInternal
train
private void flushInternal() throws IOException { isClosed(); dfsClient.checkOpen(); long toWaitFor; synchronized (this) { enqueueCurrentPacket(); toWaitFor = lastQueuedSeqno; } waitForAckedSeqno(toWaitFor); }
java
{ "resource": "" }
q162268
DFSOutputStream.closeThreads
train
private void closeThreads() throws IOException { try { if (streamer != null) { streamer.close(); streamer.join(); } // shutdown response after streamer has exited. if (response != null) { response.close(); response.join(); response = null; } ...
java
{ "resource": "" }
q162269
OutputHandler.output
train
public void output(K key, V value) throws IOException { collector.collect(key, value); }
java
{ "resource": "" }
q162270
OutputHandler.partitionedOutput
train
public void partitionedOutput(int reduce, K key, V value) throws IOException { PipesPartitioner.setNextPartition(reduce); collector.collect(key, value); }
java
{ "resource": "" }
q162271
OutputHandler.progress
train
public void progress(float progress) throws IOException { progressValue = progress; reporter.progress(); if (recordReader != null) { progressKey.set(progress); recordReader.next(progressKey, nullValue); } }
java
{ "resource": "" }
q162272
OutputHandler.waitForFinish
train
public synchronized boolean waitForFinish() throws Throwable { while (!done && exception == null) { wait(); } if (exception != null) { throw exception; } return done; }
java
{ "resource": "" }
q162273
DirectoryScanner.getDiskReportPerNamespace
train
private Map<Integer, DiskScanInfo[]> getDiskReportPerNamespace() { if (dataset.volumes == null) { LOG.warn("Dataset volumes are not initialized yet"); return new HashMap<Integer, DiskScanInfo[]>(); } // First get list of data directories FSVolume[] volumes = dataset.volumes.getVolumes(); ...
java
{ "resource": "" }
q162274
DirectoryScanner.checkDifferenceAndReconcile
train
void checkDifferenceAndReconcile() { resetDiffsAndStats(); checkDifference(); // now reconcile the differences for (Entry<Integer, LinkedList<ScanDifference>> entry : diffsPerNamespace.entrySet()) { Integer namespaceId = entry.getKey(); LinkedList<ScanDifference> diff = entry.getValue()...
java
{ "resource": "" }
q162275
JarModule.createJarPackage
train
public static File createJarPackage(IResource resource) { JarModule jarModule = new JarModule(resource); try { PlatformUI.getWorkbench().getProgressService().run(false, true, jarModule); } catch (Exception e) { e.printStackTrace(); return null; } File jarFile = jarModu...
java
{ "resource": "" }
q162276
INodeFileUnderConstruction.getValidTargets
train
DatanodeDescriptor[] getValidTargets() { if (targetGSs == null) { return null; } int count = 0; long lastBlockGS = this.getLastBlock().getGenerationStamp(); for (long targetGS : targetGSs) { if (lastBlockGS == targetGS) { count++; } } if (count == 0) { return ...
java
{ "resource": "" }
q162277
INodeFileUnderConstruction.setTargets
train
void setTargets(DatanodeDescriptor[] locs, long generationStamp) { setTargets(locs); if (locs == null) { targetGSs = null; return; } long[] targetGSs = new long[locs.length]; for (int i=0; i<targetGSs.length; i++) { targetGSs[i] = generationStamp; } this.targetGSs = targetG...
java
{ "resource": "" }
q162278
INodeFileUnderConstruction.addTarget
train
boolean addTarget(DatanodeDescriptor node, long generationStamp) { if (this.targets == null) { this.targets = new DatanodeDescriptor[0]; } for (int i=0; i<targets.length; i++) { if (targets[i].equals(node)) { if (generationStamp != targetGSs[i]) { targetGSs[i] = generatio...
java
{ "resource": "" }
q162279
INodeFileUnderConstruction.assignPrimaryDatanode
train
void assignPrimaryDatanode() { //assign the first alive datanode as the primary datanode if (targets.length == 0) { NameNode.stateChangeLog.warn("BLOCK*" + " INodeFileUnderConstruction.initLeaseRecovery:" + " No blocks found, lease removed."); } int previous = primaryNodeIndex; ...
java
{ "resource": "" }
q162280
INodeFileUnderConstruction.setLastRecoveryTime
train
synchronized boolean setLastRecoveryTime(long now) { boolean expired = now - lastRecoveryTime > NameNode.LEASE_RECOVER_PERIOD; if (expired) { lastRecoveryTime = now; } return expired; }
java
{ "resource": "" }
q162281
INodeFileUnderConstruction.collectSubtreeBlocksAndClear
train
int collectSubtreeBlocksAndClear(List<BlockInfo> v, int blocksLimit, List<INode> removedINodes) { clearTargets(); return super.collectSubtreeBlocksAndClear(v, blocksLimit, removedINodes); }
java
{ "resource": "" }
q162282
INodeFileUnderConstruction.removeINodeFromDatanodeDescriptors
train
private void removeINodeFromDatanodeDescriptors(DatanodeDescriptor[] targets) { if (targets != null) { for (DatanodeDescriptor node : targets) { node.removeINode(this); } } }
java
{ "resource": "" }
q162283
INodeFileUnderConstruction.addINodeToDatanodeDescriptors
train
private void addINodeToDatanodeDescriptors(DatanodeDescriptor[] targets) { if (targets != null) { for (DatanodeDescriptor node : targets) { node.addINode(this); } } }
java
{ "resource": "" }
q162284
OuterJoinRecordReader.combine
train
protected boolean combine(Object[] srcs, TupleWritable dst) { assert srcs.length == dst.size(); return true; }
java
{ "resource": "" }
q162285
TrackerClientCache.getClient
train
public CoronaTaskTrackerProtocol getClient( String host, int port) throws IOException { String key = makeKey(host, port); Node ttNode = topologyCache.getNode(host); CoronaTaskTrackerProtocol client = null; synchronized (ttNode) { client = trackerClients.get(key); if (client == null) { ...
java
{ "resource": "" }
q162286
TrackerClientCache.createClient
train
private CoronaTaskTrackerProtocol createClient(String host, int port) throws IOException { String staticHost = NetUtils.getStaticResolution(host); InetSocketAddress s = null; InetAddress inetAddress = null; byte[] byteArr = null; if (staticHost != null) { inetAddress = InetAddress.getByNa...
java
{ "resource": "" }
q162287
ShardWriter.close
train
public void close() throws IOException { LOG.info("Closing the shard writer, processed " + numForms + " forms"); try { try { if (maxNumSegments > 0) { writer.optimize(maxNumSegments); LOG.info("Optimized the shard into at most " + maxNumSegments + " segment...
java
{ "resource": "" }
q162288
ShardWriter.restoreGeneration
train
private void restoreGeneration(FileSystem fs, Path perm, long startGen) throws IOException { FileStatus[] fileStatus = fs.listStatus(perm, new PathFilter() { public boolean accept(Path path) { return LuceneUtil.isSegmentsFile(path.getName()); } }); // remove the segments...
java
{ "resource": "" }
q162289
ShardWriter.moveFromTempToPerm
train
private void moveFromTempToPerm() throws IOException { try { FileStatus[] fileStatus = localFs.listStatus(temp, LuceneIndexFileNameFilter.getFilter()); Path segmentsPath = null; Path segmentsGenPath = null; // move the files created in temp dir except segments_N and segment...
java
{ "resource": "" }
q162290
ChmodParser.applyNewPermission
train
public short applyNewPermission(FileStatus file) { FsPermission perms = file.getPermission(); int existing = perms.toShort(); boolean exeOk = file.isDir() || (existing & 0111) != 0; return (short)combineModes(existing, exeOk); }
java
{ "resource": "" }
q162291
MaxTxId.store
train
public synchronized void store(long maxTxId) throws IOException { long currentMaxTxId = get(); if (currentMaxTxId < maxTxId) { if (LOG.isDebugEnabled()) { LOG.debug("Resetting maxTxId to " + maxTxId); } set(maxTxId); } }
java
{ "resource": "" }
q162292
MaxTxId.get
train
public synchronized long get() throws IOException { try { lastZNodeStat = zooKeeper.exists(fullyQualifiedZNode, false); if (lastZNodeStat == null) { return -1; } byte[] data = zooKeeper.getData(fullyQualifiedZNode, false, lastZNodeStat); WritableUtil.readWritableFromB...
java
{ "resource": "" }
q162293
ServerCore.checkAndSetServiceName
train
private void checkAndSetServiceName(Configuration conf, StartupInfo info) throws ConfigurationException { String fedrationMode = conf.get(FSConstants.DFS_FEDERATION_NAMESERVICES); String serviceName = info.serviceName; if (fedrationMode != null && !fedrationMode.trim().isEmpty()) { ...
java
{ "resource": "" }
q162294
ServerCore.shutdown
train
@Override public void shutdown() { LOG.info("Shutting down ..."); shouldShutdown = true; if (tserver != null) { tserver.stop(); } started = false; }
java
{ "resource": "" }
q162295
ServerCore.addClientAndConnect
train
@Override public long addClientAndConnect(String host, int port) throws TTransportException, IOException { long clientId = getNewClientId(); LOG.info("Adding client with id=" + clientId + " host=" + host + " port=" + port + " and connecting ..."); ClientHandler.Client clientHandler; ...
java
{ "resource": "" }
q162296
ServerCore.addClient
train
@Override public void addClient(ClientData clientData) { clientsData.put(clientData.id, clientData); dispatcher.assignClient(clientData.id); LOG.info("Succesfully added client " + clientData); metrics.numRegisteredClients.set(clientsData.size()); }
java
{ "resource": "" }
q162297
ServerCore.removeClient
train
@Override public boolean removeClient(long clientId) { ClientData clientData = clientsData.get(clientId); if (clientData == null) { return false; } dispatcher.removeClient(clientId); // Iterate over all the sets in which this client figures as subscribed // and remove it synchro...
java
{ "resource": "" }
q162298
ServerCore.getClientNotificationQueue
train
@Override public Queue<NamespaceNotification> getClientNotificationQueue(long clientId) { ClientData clientData = clientsData.get(clientId); return (clientData == null) ? null : clientData.queue; }
java
{ "resource": "" }
q162299
ServerCore.queueNotifications
train
private void queueNotifications(long clientId, NamespaceEvent event, long txId) throws TransactionIdTooOldException, InvalidClientIdException { if (txId == -1) { return; } if (LOG.isDebugEnabled()) { LOG.debug("Queueing notifications for client " + clientId + " from txId " + ...
java
{ "resource": "" }