MCPcopy Create free account
hub / github.com/apache/pig / getTempContainer

Method getTempContainer

src/org/apache/pig/impl/io/FileLocalizer.java:492–514  ·  view source on GitHub ↗
(final PigContext pigContext)

Source from the content-addressed store, hash-verified

490 }
491
492 private static synchronized ContainerDescriptor getTempContainer(final PigContext pigContext)
493 throws DataStorageException {
494 ContainerDescriptor tempContainer = null;
495 String tdir= Utils.substituteVars(pigContext.getProperties().getProperty(PigConfiguration.PIG_TEMP_DIR, "/tmp"));
496 try {
497 do {
498 tempContainer = pigContext.getDfs().asContainer(tdir + "/temp" + r.nextInt());
499 } while (tempContainer.exists());
500 createContainer(tempContainer);
501 }
502 catch (IOException e) {
503 // try one last time in case this was due IO Exception caused by dir
504 // operations on directory created by another JVM at the same instant
505 tempContainer = pigContext.getDfs().asContainer(tdir + "/temp" + r.nextInt());
506 try {
507 createContainer(tempContainer);
508 }
509 catch (IOException e1) {
510 throw new DataStorageException(e1);
511 }
512 }
513 return tempContainer;
514 }
515
516 private static void createContainer(ContainerDescriptor container) throws IOException {
517 container.create();

Callers 2

relativeRootMethod · 0.95

Calls 8

substituteVarsMethod · 0.95
createContainerMethod · 0.95
getPropertyMethod · 0.80
getDfsMethod · 0.80
asContainerMethod · 0.65
existsMethod · 0.65
getPropertiesMethod · 0.45
nextIntMethod · 0.45

Tested by

no test coverage detected