Tabnine Logo
OutputStreamAndPath.stream
Code IndexAdd Tabnine to your IDE (free)

How to use
stream
method
in
org.apache.flink.core.fs.OutputStreamAndPath

Best Java code snippets using org.apache.flink.core.fs.OutputStreamAndPath.stream (Showing top 5 results out of 315)

origin: apache/flink

@Test
public void testCreateEntropyAwarePlainFs() throws Exception {
  File folder = TMP_FOLDER.newFolder();
  Path path = new Path(Path.fromLocalFile(folder), "_entropy_/file");
  OutputStreamAndPath out = EntropyInjector.createEntropyAware(
      LocalFileSystem.getSharedInstance(), path, WriteMode.NO_OVERWRITE);
  out.stream().close();
  assertEquals(path, out.path());
  assertTrue(new File (new File(folder, "_entropy_"), "file").exists());
}
origin: apache/flink

@Test
public void testCreateEntropyAwareEntropyFs() throws Exception {
  File folder = TMP_FOLDER.newFolder();
  Path path = new Path(Path.fromLocalFile(folder), "_entropy_/file");
  Path pathWithEntropy = new Path(Path.fromLocalFile(folder), "test-entropy/file");
  FileSystem fs = new TestEntropyInjectingFs("_entropy_", "test-entropy");
  OutputStreamAndPath out = EntropyInjector.createEntropyAware(fs, path, WriteMode.NO_OVERWRITE);
  out.stream().close();
  assertEquals(new Path(Path.fromLocalFile(folder), "test-entropy/file"), out.path());
  assertTrue(new File (new File(folder, "test-entropy"), "file").exists());
}
origin: apache/flink

@Test
public void testWithSafetyNet() throws Exception {
  final String entropyKey = "__ekey__";
  final String entropyValue = "abc";
  final File folder = TMP_FOLDER.newFolder();
  final Path path = new Path(Path.fromLocalFile(folder), entropyKey + "/path/");
  final Path pathWithEntropy = new Path(Path.fromLocalFile(folder), entropyValue + "/path/");
  TestEntropyInjectingFs efs = new TestEntropyInjectingFs(entropyKey, entropyValue);
  FSDataOutputStream out;
  FileSystemSafetyNet.initializeSafetyNetForThread();
  FileSystem fs = FileSystemSafetyNet.wrapWithSafetyNetWhenActivated(efs);
  try  {
    OutputStreamAndPath streamAndPath = EntropyInjector.createEntropyAware(
        fs, path, WriteMode.NO_OVERWRITE);
    out = streamAndPath.stream();
    assertEquals(pathWithEntropy, streamAndPath.path());
  }
  finally {
    FileSystemSafetyNet.closeSafetyNetAndGuardedResourcesForThread();
  }
  // check that the safety net closed the stream
  try {
    out.write(42);
    out.flush();
    fail("stream should be already close and hence fail with an exception");
  } catch (IOException ignored) {}
}
origin: org.apache.flink/flink-runtime

  private void createStream() throws IOException {
    Exception latestException = null;
    for (int attempt = 0; attempt < 10; attempt++) {
      try {
        OutputStreamAndPath streamAndPath = EntropyInjector.createEntropyAware(
            fs, createStatePath(), WriteMode.NO_OVERWRITE);
        this.outStream = streamAndPath.stream();
        this.statePath = streamAndPath.path();
        return;
      }
      catch (Exception e) {
        latestException = e;
      }
    }
    throw new IOException("Could not open output stream for state backend", latestException);
  }
}
origin: org.apache.flink/flink-runtime_2.11

  private void createStream() throws IOException {
    Exception latestException = null;
    for (int attempt = 0; attempt < 10; attempt++) {
      try {
        OutputStreamAndPath streamAndPath = EntropyInjector.createEntropyAware(
            fs, createStatePath(), WriteMode.NO_OVERWRITE);
        this.outStream = streamAndPath.stream();
        this.statePath = streamAndPath.path();
        return;
      }
      catch (Exception e) {
        latestException = e;
      }
    }
    throw new IOException("Could not open output stream for state backend", latestException);
  }
}
org.apache.flink.core.fsOutputStreamAndPathstream

Popular methods of OutputStreamAndPath

  • path
  • <init>
    Creates a OutputStreamAndPath.

Popular in Java

  • Creating JSON documents from java classes using gson
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • addToBackStack (FragmentTransaction)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now