_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q162100
EditLogInputStream.skipUntil
train
public boolean skipUntil(long txid) throws IOException { while (true) { FSEditLogOp op = readOp(); if (op == null) { return false; } if (op.getTransactionId() >= txid) { cachedOp = op; return true; } } }
java
{ "resource": "" }
q162101
SkipBadRecords.getSkipOutputPath
train
public static Path getSkipOutputPath(Configuration conf) { String name = conf.get(OUT_PATH); if(name!=null) { if("none".equals(name)) { return null; } return new Path(name); } Path outPath = FileOutputFormat.getOutputPath(new JobConf(conf)); return outPath==null ? null : n...
java
{ "resource": "" }
q162102
SkipBadRecords.setSkipOutputPath
train
public static void setSkipOutputPath(JobConf conf, Path path) { String pathStr = null; if(path==null) { pathStr = "none"; } else { pathStr = path.toString(); } conf.set(OUT_PATH, pathStr); }
java
{ "resource": "" }
q162103
MergeSorter.sort
train
public RawKeyValueIterator sort() { MergeSort m = new MergeSort(this); int count = super.count; if (count == 0) return null; int [] pointers = super.pointers; int [] pointersCopy = new int[count]; System.arraycopy(pointers, 0, pointersCopy, 0, count); m.mergeSort(pointers, pointersCopy, 0, c...
java
{ "resource": "" }
q162104
ResourceRequestInfo.write
train
public void write(JsonGenerator jsonGenerator) throws IOException { // We neither need the list of RequestedNodes, nodes, nor excludedHosts, // because we can reconstruct them from the request object jsonGenerator.writeStartObject(); jsonGenerator.writeObjectField("request", request); jsonGenerator....
java
{ "resource": "" }
q162105
FSOutputSummer.write
train
public synchronized void write(int b) throws IOException { eventStartWrite(); try { sum.update(b); buf[count++] = (byte) b; if (bytesSentInChunk + count == buf.length) { flushBuffer(true, shouldKeepPartialChunkData()); } } finally { eventEndWrite(); } }
java
{ "resource": "" }
q162106
FSOutputSummer.write1
train
private int write1(byte b[], int off, int len) throws IOException { eventStartWrite(); try { if(count==0 && bytesSentInChunk + len>=buf.length) { // local buffer is empty and user data can fill the current chunk // checksum and output data final int length = buf.length - bytesSent...
java
{ "resource": "" }
q162107
FSOutputSummer.writeChecksumChunk
train
private void writeChecksumChunk(byte b[], int off, int len, boolean keep) throws IOException { int tempChecksum = (int)sum.getValue(); if (!keep) { sum.reset(); } int2byte(tempChecksum, checksum); writeChunk(b, off, len, checksum); }
java
{ "resource": "" }
q162108
INode.getUserName
train
public String getUserName() { int n = (int)PermissionStatusFormat.USER.retrieve(permission); return SerialNumberManager.INSTANCE.getUser(n); }
java
{ "resource": "" }
q162109
INode.getGroupName
train
public String getGroupName() { int n = (int)PermissionStatusFormat.GROUP.retrieve(permission); return SerialNumberManager.INSTANCE.getGroup(n); }
java
{ "resource": "" }
q162110
INode.enforceRegularStorageINode
train
public static void enforceRegularStorageINode(INodeFile inode, String msg) throws IOException { if (inode.getStorageType() != StorageType.REGULAR_STORAGE) { LOG.error(msg); throw new IOException(msg); } }
java
{ "resource": "" }
q162111
INode.getPathComponents
train
static byte[][] getPathComponents(String[] strings) { if (strings.length == 0) { return new byte[][]{null}; } byte[][] bytes = new byte[strings.length][]; for (int i = 0; i < strings.length; i++) bytes[i] = DFSUtil.string2Bytes(strings[i]); return bytes; }
java
{ "resource": "" }
q162112
INode.getPathNames
train
static String[] getPathNames(String path) { if (path == null || !path.startsWith(Path.SEPARATOR)) { return null; } return StringUtils.split(path, Path.SEPARATOR_CHAR); }
java
{ "resource": "" }
q162113
INode.compareTo
train
public final int compareTo(byte[] name2) { if (name == name2) return 0; int len1 = (name == null ? 0 : name.length); int len2 = (name2 == null ? 0 : name2.length); int n = Math.min(len1, len2); byte b1, b2; for (int i = 0; i < n; i++) { b1 = name[i]; b2 = name2[i]; if (b1...
java
{ "resource": "" }
q162114
INode.newINode
train
static INode newINode(long id, PermissionStatus permissions, BlockInfo[] blocks, short replication, long modificationTime, long atime, long nsQuota, lo...
java
{ "resource": "" }
q162115
DataBlockScannerSet.waitForUpgradeDone
train
private void waitForUpgradeDone(int namespaceId) { UpgradeManagerDatanode um = datanode.getUpgradeManager(namespaceId); while (!um.isUpgradeCompleted()) { try { datanode.updateAndReportThreadLiveness(BackgroundThread.BLOCK_SCANNER); Thread.sleep(5000); LOG.info("sleeping .............
java
{ "resource": "" }
q162116
DataBlockScannerSet.getNextNamespaceSliceScanner
train
private DataBlockScanner getNextNamespaceSliceScanner(int currentNamespaceId) { Integer nextNsId = null; while ((nextNsId == null) && datanode.shouldRun && !blockScannerThread.isInterrupted()) { waitForOneNameSpaceUp(); synchronized (this) { if (getNamespaceSetSize() > 0) { ...
java
{ "resource": "" }
q162117
HashFunction.hash
train
public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0,...
java
{ "resource": "" }
q162118
HttpServer.createBaseListener
train
protected Connector createBaseListener(Configuration conf) throws IOException { Connector ret; if (conf.getBoolean("hadoop.http.bio", false)) { SocketConnector conn = new SocketConnector(); conn.setAcceptQueueSize(4096); conn.setResolveNames(false); ret = conn; } else { S...
java
{ "resource": "" }
q162119
HttpServer.getFilterInitializers
train
private static FilterInitializer[] getFilterInitializers(Configuration conf) { if (conf == null) { return null; } Class<?>[] classes = conf.getClasses(FILTER_INITIALIZER_PROPERTY); if (classes == null) { return null; } FilterInitializer[] initializers = new FilterInitializer[classe...
java
{ "resource": "" }
q162120
HttpServer.addDefaultApps
train
protected void addDefaultApps(ContextHandlerCollection parent, final String appDir) throws IOException { // set up the context for "/logs/" if "hadoop.log.dir" property is defined. String logDir = System.getProperty("hadoop.log.dir"); if (logDir != null) { Context logContext = new Context(paren...
java
{ "resource": "" }
q162121
HttpServer.addDefaultServlets
train
protected void addDefaultServlets() { // set up default servlets addServlet("stacks", "/stacks", StackServlet.class); addServlet("logLevel", "/logLevel", LogLevel.Servlet.class); addServlet("jmx", "/jmx", JMXJsonServlet.class); addServlet("metrics", "/metrics", MetricsServlet.class); addServlet(...
java
{ "resource": "" }
q162122
HttpServer.addContext
train
protected void addContext(String pathSpec, String dir, boolean isFiltered) throws IOException { if (0 == webServer.getHandlers().length) { throw new RuntimeException("Couldn't find handler"); } WebAppContext webAppCtx = new WebAppContext(); webAppCtx.setContextPath(pathSpec); webAppCtx.setWar(...
java
{ "resource": "" }
q162123
HttpServer.addServlet
train
public void addServlet(String name, String pathSpec, Class<? extends HttpServlet> clazz) { addInternalServlet(name, pathSpec, clazz); addFilterPathMapping(pathSpec, webAppContext); }
java
{ "resource": "" }
q162124
HttpServer.addInternalServlet
train
@Deprecated public void addInternalServlet(String name, String pathSpec, Class<? extends HttpServlet> clazz) { ServletHolder holder = new ServletHolder(clazz); if (name != null) { holder.setName(name); } webAppContext.addServlet(holder, pathSpec); }
java
{ "resource": "" }
q162125
HttpServer.removeServlet
train
public void removeServlet(String name, String pathSpec, Class<? extends HttpServlet> clazz) { if(clazz == null) { return; } //remove the filters from filterPathMapping ServletHandler servletHandler = webAppContext.getServletHandler(); List<FilterMapping> newFilterMappings = new ArrayLi...
java
{ "resource": "" }
q162126
HttpServer.removeInternalServlet
train
public void removeInternalServlet(String name, String pathSpec, Class<? extends HttpServlet> clazz) { if(null == clazz) { return; } ServletHandler servletHandler = webAppContext.getServletHandler(); List<ServletHolder> newServletHolders = new ArrayList<ServletHolder>(); List<Servle...
java
{ "resource": "" }
q162127
HttpServer.defineFilter
train
protected void defineFilter(Context ctx, String name, String classname, Map<String,String> parameters, String[] urls) { FilterHolder holder = new FilterHolder(); holder.setName(name); holder.setClassName(classname); holder.setInitParameters(parameters); FilterMapping fmap = new FilterMapping(...
java
{ "resource": "" }
q162128
HttpServer.addFilterPathMapping
train
protected void addFilterPathMapping(String pathSpec, Context webAppCtx) { ServletHandler handler = webAppCtx.getServletHandler(); for(String name : filterNames) { FilterMapping fmap = new FilterMapping(); fmap.setPathSpec(pathSpec); fmap.setFilterName(name); fmap.setDispatches(Hand...
java
{ "resource": "" }
q162129
HttpServer.getWebAppsPath
train
protected String getWebAppsPath() throws IOException { URL url = getClass().getClassLoader().getResource("webapps"); if (url == null) throw new IOException("webapps not found in CLASSPATH"); return url.toString(); }
java
{ "resource": "" }
q162130
HttpServer.stop
train
public void stop() throws Exception { listener.close(); webAppContext.clearAttributes(); webServer.removeHandler(webAppContext); webServer.stop(); }
java
{ "resource": "" }
q162131
AbstractMetricsContext.getAttribute
train
protected String getAttribute(String attributeName) { String factoryAttribute = contextName + "." + attributeName; return (String) factory.getAttribute(factoryAttribute); }
java
{ "resource": "" }
q162132
AbstractMetricsContext.registerUpdater
train
public synchronized void registerUpdater(final Updater updater) { if (!updaters.containsKey(updater)) { updaters.put(updater, Boolean.TRUE); } }
java
{ "resource": "" }
q162133
AbstractMetricsContext.startTimer
train
private synchronized void startTimer() { if (timer == null) { timer = new Timer("Timer thread for monitoring " + getContextName(), true); TimerTask task = new TimerTask() { public void run() { try { timerEvent(); } ...
java
{ "resource": "" }
q162134
AbstractMetricsContext.timerEvent
train
private void timerEvent() throws IOException { if (isMonitoring) { Collection<Updater> myUpdaters; synchronized (this) { myUpdaters = new ArrayList<Updater>(updaters.keySet()); } // Run all the registered updates without holding a lock // on this context for (Updater upda...
java
{ "resource": "" }
q162135
AbstractMetricsContext.emitRecords
train
private synchronized void emitRecords() throws IOException { for (String recordName : bufferedData.keySet()) { RecordMap recordMap = bufferedData.get(recordName); synchronized (recordMap) { Set<Entry<TagMap, MetricMap>> entrySet = recordMap.entrySet (); for (Entry<TagMap, MetricMap>...
java
{ "resource": "" }
q162136
AbstractMetricsContext.sum
train
private Number sum(Number a, Number b) { if (a instanceof Integer) { return Integer.valueOf(a.intValue() + b.intValue()); } else if (a instanceof Float) { return new Float(a.floatValue() + b.floatValue()); } else if (a instanceof Short) { return Short.valueOf((short)(a.shor...
java
{ "resource": "" }
q162137
AbstractMetricsContext.parseAndSetPeriod
train
protected void parseAndSetPeriod(String attributeName) { String periodStr = getAttribute(attributeName); if (periodStr != null) { int period = 0; try { period = Integer.parseInt(periodStr); } catch (NumberFormatException nfe) { } if (period <= 0) { throw ne...
java
{ "resource": "" }
q162138
AbstractMetricsContext.getAllRecords
train
@Override public synchronized Map<String, Collection<OutputRecord>> getAllRecords() { Map<String, Collection<OutputRecord>> out = new TreeMap<String, Collection<OutputRecord>>(); for (String recordName : bufferedData.keySet()) { RecordMap recordMap = bufferedData.get(recordName); synchronized...
java
{ "resource": "" }
q162139
SimulatorTaskTracker.accept
train
@Override public List<SimulatorEvent> accept(SimulatorEvent event) { if (LOG.isDebugEnabled()) { LOG.debug("Accepted event " + event); } if (event instanceof HeartbeatEvent) { return processHeartbeatEvent((HeartbeatEvent)event); } else if (event instanceof TaskAttemptCompletionEvent) { ...
java
{ "resource": "" }
q162140
SimulatorTaskTracker.init
train
public List<SimulatorEvent> init(long when) { LOG.debug("TaskTracker starting up, current simulation time=" + when); return Collections.<SimulatorEvent>singletonList(new HeartbeatEvent(this, when)); }
java
{ "resource": "" }
q162141
SimulatorTaskTracker.finishRunningTask
train
private void finishRunningTask(TaskStatus finalStatus, long now) { TaskAttemptID taskId = finalStatus.getTaskID(); if (LOG.isDebugEnabled()) { LOG.debug("Finishing running task id=" + taskId + ", now=" + now); } SimulatorTaskInProgress tip = tasks.get(taskId); if (tip == null) { throw n...
java
{ "resource": "" }
q162142
SimulatorTaskTracker.processTaskAttemptCompletionEvent
train
private List<SimulatorEvent> processTaskAttemptCompletionEvent( TaskAttemptCompletionEvent event) { if (LOG.isDebugEnabled()) { LOG.debug("Processing task attempt completion event" + event); } long now = event.getTimeStamp(); TaskStatus finalStatus = event.getStatus(); TaskAttempt...
java
{ "resource": "" }
q162143
SimulatorTaskTracker.createTaskAttemptCompletionEvent
train
private TaskAttemptCompletionEvent createTaskAttemptCompletionEvent( SimulatorTaskInProgress tip, long now) { // We need to clone() status as we modify and it goes into an Event TaskStatus status = (TaskStatus)tip.getTaskStatus().clone(); long delta = tip.getUserSpaceR...
java
{ "resource": "" }
q162144
SimulatorTaskTracker.handleSimulatorLaunchTaskAction
train
private List<SimulatorEvent> handleSimulatorLaunchTaskAction( SimulatorLaunchTaskAction action, long now) { if (LOG.isDebugEnabled()) { LOG.debug("Handling launch task action " + action); } // First, create statuses and update used slots for map and reduce // task separat...
java
{ "resource": "" }
q162145
SimulatorTaskTracker.handleKillTaskAction
train
private List<SimulatorEvent> handleKillTaskAction(KillTaskAction action, long now) { TaskAttemptID taskId = action.getTaskID(); // we don't have a nice(r) toString() in Hadoop's TaskActions if (LOG.isDebugEnabled()) { LOG.debug("Handling kill task action, taskId=" + taskId + ", now=" + now); } ...
java
{ "resource": "" }
q162146
SimulatorTaskTracker.progressTaskStatus
train
private void progressTaskStatus(SimulatorTaskInProgress tip, long now) { TaskStatus status = tip.getTaskStatus(); if (status.getRunState() != State.RUNNING) { return; // nothing to be done } boolean isMap = tip.isMapTask(); // Time when the user space code started long startTime = -1; ...
java
{ "resource": "" }
q162147
SimulatorTaskTracker.garbageCollectCompletedTasks
train
private void garbageCollectCompletedTasks() { for (Iterator<TaskAttemptID> iter = tasks.keySet().iterator(); iter.hasNext();) { TaskAttemptID taskId = iter.next(); SimulatorTaskInProgress tip = tasks.get(taskId); if (tip.getTaskStatus().getRunState() != State.RUNNING) { iter.remov...
java
{ "resource": "" }
q162148
SimulatorTaskTracker.processHeartbeatEvent
train
private List<SimulatorEvent> processHeartbeatEvent(HeartbeatEvent event) { if (LOG.isDebugEnabled()) { LOG.debug("Processing heartbeat event " + event); } long now = event.getTimeStamp(); // Create the TaskTrackerStatus to report progressTaskStatuses(now); List<TaskStatus> taskSt...
java
{ "resource": "" }
q162149
Decoder.retrieveStripe
train
public StripeInfo retrieveStripe(Block lostBlock, Path p, long lostBlockOffset, FileSystem fs, Context context, boolean online) throws IOException { StripeInfo si = null; if (stripeStore != null) { IOException caughtException = null; try { si = stripeStore.getStripe(co...
java
{ "resource": "" }
q162150
Decoder.retrieveChecksum
train
public Long retrieveChecksum(Block lostBlock, Path p, long lostBlockOffset, FileSystem fs, Context context) throws IOException { Long oldCRC = null; if (checksumStore != null) { IOException caughtException = null; try { oldCRC = checksumStore.getChecksum(lostBlock); ...
java
{ "resource": "" }
q162151
Decoder.recoverBlockToFileFromStripeInfo
train
public CRC32 recoverBlockToFileFromStripeInfo( FileSystem srcFs, Path srcPath, Block lostBlock, File localBlockFile, long blockSize, long lostBlockOffset, long limit, StripeInfo si, Context context) throws IOException { OutputStream out = null; try { out = new FileOutputStream(localBlo...
java
{ "resource": "" }
q162152
Decoder.getOldCodeId
train
private String getOldCodeId(FileStatus srcStat ) throws IOException { if (codec.id.equals("xor") || codec.id.equals("rs")) { return codec.id; } else { // Search for xor/rs parity files if (ParityFilePair.getParityFile( Codec.getCodec("xor"), srcStat, this.conf) != null) return ...
java
{ "resource": "" }
q162153
HsftpFileSystem.setupSsl
train
private static void setupSsl(Configuration conf) { Configuration sslConf = new Configuration(false); sslConf.addResource(conf.get("dfs.https.client.keystore.resource", "ssl-client.xml")); System.setProperty("javax.net.ssl.trustStore", sslConf.get( "ssl.client.truststore.location", "")); ...
java
{ "resource": "" }
q162154
TaskController.setup
train
void setup() { // Cannot set wait for confirmed kill mode if cannot check if task is alive if (supportsIsTaskAlive()) { waitForConfirmedKill = getConf().getBoolean(WAIT_FOR_CONFIRMED_KILL_KEY, WAIT_FOR_CONFIRMED_DEFAULT); confirmedKillRetries = getConf().getInt(CONFIRMED_KILL_RETRIES_KEY, ...
java
{ "resource": "" }
q162155
TaskController.destroyTaskJVM
train
final void destroyTaskJVM(TaskControllerContext context) { Thread taskJVMDestroyer = new Thread(new DestroyJVMTaskRunnable(context)); taskJVMDestroyer.start(); if (waitForConfirmedKill) { try { taskJVMDestroyer.join(); } catch (InterruptedException e) { throw new IllegalStateExce...
java
{ "resource": "" }
q162156
INodeRegularStorage.getPenultimateBlock
train
@Override public Block getPenultimateBlock() { if (blocks == null || blocks.length <= 1) { return null; } return blocks[blocks.length - 2]; }
java
{ "resource": "" }
q162157
INodeRegularStorage.addBlock
train
@Override public void addBlock(BlockInfo newblock) { if (this.blocks == null) { this.blocks = new BlockInfo[1]; this.blocks[0] = newblock; } else { int size = this.blocks.length; BlockInfo[] newlist = new BlockInfo[size + 1]; System.arraycopy(this.blocks, 0, newlist, 0, size); ...
java
{ "resource": "" }
q162158
INodeRegularStorage.convertToRaidStorage
train
@Override public INodeRaidStorage convertToRaidStorage(BlockInfo[] parityBlocks, RaidCodec codec, int[] checksums, BlocksMap blocksMap, short replication, INodeFile inode) throws IOException { if (codec == null) { throw new IOException("Codec is null"); } else { return new INodeRaidSt...
java
{ "resource": "" }
q162159
BlockCompressorStream.write
train
public void write(byte[] b, int off, int len) throws IOException { // Sanity checks if (compressor.finished()) { throw new IOException("write beyond end of stream"); } if (b == null) { throw new NullPointerException(); } else if ((off < 0) || (off > b.length) || (len < 0) || ...
java
{ "resource": "" }
q162160
DatanodeBlockInfo.detachBlock
train
boolean detachBlock(int namespaceId, Block block, int numLinks) throws IOException { if (isDetached()) { return false; } if (blockDataFile.getFile() == null || blockDataFile.volume == null) { throw new IOException("detachBlock:Block not found. " + block); } File meta = null; if (!in...
java
{ "resource": "" }
q162161
Job.addDependingJob
train
public synchronized boolean addDependingJob(Job dependingJob) { if (this.state == Job.WAITING) { //only allowed to add jobs when waiting if (this.dependingJobs == null) { this.dependingJobs = new ArrayList<Job>(); } return this.dependingJobs.add(dependingJob); } else { return fal...
java
{ "resource": "" }
q162162
Job.checkRunningState
train
private void checkRunningState() { RunningJob running = null; try { running = jc.getJob(this.mapredJobID); if (running.isComplete()) { if (running.isSuccessful()) { this.state = Job.SUCCESS; } else { this.state = Job.FAILED; this.message = "Job failed!";...
java
{ "resource": "" }
q162163
Job.checkState
train
synchronized int checkState() { if (this.state == Job.RUNNING) { checkRunningState(); } if (this.state != Job.WAITING) { return this.state; } if (this.dependingJobs == null || this.dependingJobs.size() == 0) { this.state = Job.READY; return this.state; } Job pred = nu...
java
{ "resource": "" }
q162164
Job.submit
train
protected synchronized void submit() { try { if (theJobConf.getBoolean("create.empty.dir.if.nonexist", false)) { FileSystem fs = FileSystem.get(theJobConf); Path inputPaths[] = FileInputFormat.getInputPaths(theJobConf); for (int i = 0; i < inputPaths.length; i++) { if (!fs.ex...
java
{ "resource": "" }
q162165
SimpleSeekableFormatOutputStream.write
train
@Override public void write(byte[] b, int start, int length) throws IOException { currentDataSegmentBuffer.write(b, start, length); flushIfNeeded(); }
java
{ "resource": "" }
q162166
SimpleSeekableFormatOutputStream.flush
train
@Override public void flush() throws IOException { // Do not do anything if no data has been written if (currentDataSegmentBuffer.size() == 0) { return; } // Create the current DataSegment DataSegmentWriter currentDataSegment = new DataSegmentWriter(currentDataSegmentBuffer, codec,...
java
{ "resource": "" }
q162167
DistributedFileSystem.checkPath
train
protected void checkPath(Path path) { URI thisUri = this.getUri(); URI thatUri = path.toUri(); String thatAuthority = thatUri.getAuthority(); if (thatUri.getScheme() != null && thatUri.getScheme().equalsIgnoreCase(thisUri.getScheme()) && thatUri.getPort() == NameNode.DEFAULT_PORT ...
java
{ "resource": "" }
q162168
DistributedFileSystem.append
train
public FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws IOException { DFSOutputStream op = (DFSOutputStream)dfs.append(getPathName(f), bufferSize, progress); return new FSDataOutputStream(op, statistics, op.getInitialLen()); }
java
{ "resource": "" }
q162169
DistributedFileSystem.concat
train
public void concat(Path trg, Path [] psrcs, boolean restricted) throws IOException { String [] srcs = new String [psrcs.length]; for(int i=0; i<psrcs.length; i++) { srcs[i] = getPathName(psrcs[i]); } dfs.concat(getPathName(trg), srcs, restricted); }
java
{ "resource": "" }
q162170
DistributedFileSystem.concat
train
@Deprecated public void concat(Path trg, Path [] psrcs) throws IOException { concat(trg, psrcs, true); }
java
{ "resource": "" }
q162171
DistributedFileSystem.setQuota
train
public void setQuota(Path src, long namespaceQuota, long diskspaceQuota) throws IOException { dfs.setQuota(getPathName(src), namespaceQuota, diskspaceQuota); }
java
{ "resource": "" }
q162172
DistributedFileSystem.getFileStatus
train
public FileStatus getFileStatus(Path f) throws IOException { FileStatus fi = dfs.getFileInfo(getPathName(f)); if (fi != null) { fi.makeQualified(this); return fi; } else { throw new FileNotFoundException("File does not exist: " + f); } }
java
{ "resource": "" }
q162173
DataJoinReducerBase.joinAndCollect
train
private void joinAndCollect(Object[] tags, ResetableIterator[] values, Object key, OutputCollector output, Reporter reporter) throws IOException { if (values.length < 1) { return; } Object[] partialList = new Object[values.length]; joinAndCollect(tags, values, 0, ...
java
{ "resource": "" }
q162174
DataJoinReducerBase.joinAndCollect
train
private void joinAndCollect(Object[] tags, ResetableIterator[] values, int pos, Object[] partialList, Object key, OutputCollector output, Reporter reporter) throws IOException { if (values.length == pos) { // get a value from each source. Combine th...
java
{ "resource": "" }
q162175
HadoopServer.purgeJob
train
public void purgeJob(final HadoopJob job) { runningJobs.remove(job.getJobID()); Display.getDefault().asyncExec(new Runnable() { public void run() { fireJobRemoved(job); } }); }
java
{ "resource": "" }
q162176
HadoopServer.loadFromXML
train
public boolean loadFromXML(File file) throws ParserConfigurationException, SAXException, IOException { Configuration newConf = new Configuration(this.conf); DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = builder.parse(file); Elem...
java
{ "resource": "" }
q162177
HadoopServer.storeSettingsToFile
train
public void storeSettingsToFile(File file) throws IOException { FileOutputStream fos = new FileOutputStream(file); this.conf.writeXml(fos); fos.close(); }
java
{ "resource": "" }
q162178
HadoopServer.addPluginConfigDefaultProperties
train
private void addPluginConfigDefaultProperties() { for (ConfProp prop : ConfProp.values()) { if (conf.get(prop.name) == null) conf.set(prop.name, prop.defVal); } }
java
{ "resource": "" }
q162179
JobID.downgrade
train
public static JobID downgrade(org.apache.hadoop.mapreduce.JobID old) { if (old instanceof JobID) { return (JobID) old; } else { return new JobID(old.getJtIdentifier(), old.getId()); } }
java
{ "resource": "" }
q162180
APITrace.logCall
train
public static void logCall(long entryTime, long returnTime, int callIndex, Object returnValue, Object argValues[], long streamId) { if (!API_TRACE_LOG.isInfoEnabled()) { ...
java
{ "resource": "" }
q162181
SleepJobRunner.calcStats
train
private static Stats calcStats(List<Double> nums) { double sum = 0.0, mean = 0.0, variance = 0.0, stdDev = 0.0; for (Double d : nums) { sum += d.doubleValue(); } if (nums.size() > 0) { mean = sum / nums.size(); } sum = 0.0; for (Double d : nums) { sum += (d.doubleValue() -...
java
{ "resource": "" }
q162182
PoolInfo.write
train
public void write(JsonGenerator jsonGenerator) throws IOException { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("poolGroupName", poolGroupName); jsonGenerator.writeStringField("poolName", poolName); jsonGenerator.writeEndObject(); }
java
{ "resource": "" }
q162183
PoolInfo.createPoolInfoStrings
train
public static PoolInfoStrings createPoolInfoStrings(PoolInfo poolInfo) { if (poolInfo == null) { return null; } return new PoolInfoStrings(poolInfo.getPoolGroupName(), poolInfo.getPoolName()); }
java
{ "resource": "" }
q162184
PoolInfo.createPoolInfo
train
public static PoolInfo createPoolInfo(PoolInfoStrings poolInfoStrings) { if (poolInfoStrings == null) { return null; } return new PoolInfo(poolInfoStrings.getPoolGroupName(), poolInfoStrings.getPoolName()); }
java
{ "resource": "" }
q162185
PoolInfo.isLegalPoolInfo
train
public static boolean isLegalPoolInfo(PoolInfo poolInfo) { if (poolInfo == null || poolInfo.getPoolGroupName() == null || poolInfo.getPoolName() == null) { return false; } if (INVALID_REGEX_PATTERN.matcher(poolInfo.getPoolGroupName()).matches() || poolInfo.getPoolGroupName().isEmpty())...
java
{ "resource": "" }
q162186
FsPermission.applyUMask
train
public FsPermission applyUMask(FsPermission umask) { return new FsPermission(useraction.and(umask.useraction.not()), groupaction.and(umask.groupaction.not()), otheraction.and(umask.otheraction.not())); }
java
{ "resource": "" }
q162187
FsPermission.valueOf
train
public static FsPermission valueOf(String unixSymbolicPermission) { if (unixSymbolicPermission == null) { return null; } else if (unixSymbolicPermission.length() != 10) { throw new IllegalArgumentException("length != 10(unixSymbolicPermission=" + unixSymbolicPermission + ")"); } ...
java
{ "resource": "" }
q162188
SecondaryNameNode.initialize
train
private void initialize(Configuration conf) throws IOException { // initiate Java VM metrics JvmMetrics.init("SecondaryNameNode", conf.get("session.id")); // Create connection to the namenode. shouldRun = true; nameNodeAddr = NameNode.getClientProtocolAddress(conf); this.conf = conf; t...
java
{ "resource": "" }
q162189
SecondaryNameNode.shutdown
train
public void shutdown() { shouldRun = false; try { if (infoServer != null) infoServer.stop(); } catch (Exception e) { LOG.warn("Exception shutting down SecondaryNameNode", e); } try { if (checkpointImage != null) checkpointImage.close(); } catch(IOException e) { LOG.warn(S...
java
{ "resource": "" }
q162190
SecondaryNameNode.getInfoServer
train
private String getInfoServer() throws IOException { URI fsName = FileSystem.getDefaultUri(conf); if (!"hdfs".equals(fsName.getScheme())) { throw new IOException("This is not a DFS"); } return NetUtils.getServerAddress(conf, "dfs.info.bindAddress", "dfs.info.po...
java
{ "resource": "" }
q162191
SecondaryNameNode.doCheckpoint
train
boolean doCheckpoint() throws IOException { LOG.info("Checkpoint starting"); // Do the required initialization of the merge work area. startCheckpoint(); checkpointImage.ensureCurrentDirExists(); NNStorage dstStorage = checkpointImage.storage; // Tell the namenode to start logging transactio...
java
{ "resource": "" }
q162192
SecondaryNameNode.doMerge
train
private void doMerge(CheckpointSignature sig, RemoteEditLogManifest manifest, boolean loadImage, FSImage dstImage) throws IOException { if (loadImage) { // create an empty namespace if new image namesystem = new FSNamesystem(checkpointImage, conf); checkpointImage.setFSNamesystem(namesystem); ...
java
{ "resource": "" }
q162193
GenWriterThread.writeControlFile
train
private void writeControlFile(FileSystem fs, Path outputPath, Path checksumFile, String name) throws IOException { SequenceFile.Writer write = null; try { Path parentDir = new Path(rtc.input, "filelists"); if (!fs.exists(parentDir)) { fs.mkdirs(parentDir); } ...
java
{ "resource": "" }
q162194
GenWriterThread.prepare
train
@Override public GenThread[] prepare(JobConf conf, Text key, Text value) throws IOException { this.rtc = new GenWriterRunTimeConstants(); super.prepare(conf, key, value, rtc); rtc.task_name = key.toString() + rtc.taskID; rtc.roll_interval = conf.getLong(WRITER_ROLL_INTERVAL_KEY, ...
java
{ "resource": "" }
q162195
Ingest.setCatchingUp
train
private void setCatchingUp() throws IOException { try { if (inputEditStream != null && inputEditStream.isInProgress()) { catchingUp = (inputEditStream.length() - inputEditStream.getPosition() > catchUpLag); } else { catchingUp = true; } } catch (Exception e) { catchingUp ...
java
{ "resource": "" }
q162196
Ingest.getLagBytes
train
public long getLagBytes() { try { if (inputEditStream != null && inputEditStream.isInProgress()) { // for file journals it may happen that we read a segment finalized // by primary, but not refreshed by the standby, so length() returns 0 // hence we take max(-1,lag) return Math...
java
{ "resource": "" }
q162197
Ingest.loadFSEdits
train
private int loadFSEdits() throws IOException { FSDirectory fsDir = fsNamesys.dir; int numEdits = 0; long startTime = FSNamesystem.now(); LOG.info("Ingest: Consuming transactions: " + this.toString()); try { logVersion = inputEditStream.getVersion(); if (!LayoutVersion.supports(Feature.T...
java
{ "resource": "" }
q162198
Ingest.ingestFSEdit
train
private FSEditLogOp ingestFSEdit(EditLogInputStream inputEditLog) throws IOException { FSEditLogOp op = null; try { op = inputEditLog.readOp(); InjectionHandler.processEventIO(InjectionEvent.INGEST_READ_OP); } catch (EOFException e) { return null; // No more transactions. } catch...
java
{ "resource": "" }
q162199
Ingest.shouldLoad
train
private boolean shouldLoad(long txid) { boolean shouldLoad = txid > standby.getLastCorrectTxId(); if (!shouldLoad) { LOG.info("Ingest: skip loading txId: " + txid + " to namesystem, but writing to edit log, last correct txid: " + standby.getLastCorrectTxId()); } return shouldL...
java
{ "resource": "" }