org.apache.hadoop.hdfs.shortcircuit.DomainSocketFactory Java Examples

The following examples show how to use org.apache.hadoop.hdfs.shortcircuit.DomainSocketFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientContext.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private ClientContext(String name, Conf conf) {
  this.name = name;
  this.confString = confAsString(conf);
  this.shortCircuitCache = new ShortCircuitCache(
      conf.shortCircuitStreamsCacheSize,
      conf.shortCircuitStreamsCacheExpiryMs,
      conf.shortCircuitMmapCacheSize,
      conf.shortCircuitMmapCacheExpiryMs,
      conf.shortCircuitMmapCacheRetryTimeout,
      conf.shortCircuitCacheStaleThresholdMs,
      conf.shortCircuitSharedMemoryWatcherInterruptCheckMs);
  this.peerCache =
        new PeerCache(conf.socketCacheCapacity, conf.socketCacheExpiry);
  this.keyProviderCache = new KeyProviderCache(conf.keyProviderCacheExpiryMs);
  this.useLegacyBlockReaderLocal = conf.useLegacyBlockReaderLocal;
  this.domainSocketFactory = new DomainSocketFactory(conf);

  this.byteArrayManager = ByteArrayManager.newInstance(conf.writeByteArrayManagerConf);
}
 
Example #2
Source File: ClientContext.java    From big-c with Apache License 2.0 6 votes vote down vote up
private ClientContext(String name, Conf conf) {
  this.name = name;
  this.confString = confAsString(conf);
  this.shortCircuitCache = new ShortCircuitCache(
      conf.shortCircuitStreamsCacheSize,
      conf.shortCircuitStreamsCacheExpiryMs,
      conf.shortCircuitMmapCacheSize,
      conf.shortCircuitMmapCacheExpiryMs,
      conf.shortCircuitMmapCacheRetryTimeout,
      conf.shortCircuitCacheStaleThresholdMs,
      conf.shortCircuitSharedMemoryWatcherInterruptCheckMs);
  this.peerCache =
        new PeerCache(conf.socketCacheCapacity, conf.socketCacheExpiry);
  this.keyProviderCache = new KeyProviderCache(conf.keyProviderCacheExpiryMs);
  this.useLegacyBlockReaderLocal = conf.useLegacyBlockReaderLocal;
  this.domainSocketFactory = new DomainSocketFactory(conf);

  this.byteArrayManager = ByteArrayManager.newInstance(conf.writeByteArrayManagerConf);
}
 
Example #3
Source File: FileSystemTracerTest.java    From garmadon with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws IOException, NoSuchFieldException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, URISyntaxException, InstantiationException {
    classLoader = new ByteArrayClassLoader.ChildFirst(FileSystemTracerTest.class.getClassLoader(),
        ClassFileExtraction.of(
            Tracer.class,
            MethodTracer.class,
            FileSystemTracer.class,
            FileSystemTracer.WriteTracer.class,
            FileSystemTracer.ReadTracer.class,
            FileSystemTracer.AddBlockTracer.class,
            FileSystemTracer.ListStatusTracer.class,
            FileSystemTracer.GetContentSummaryTracer.class,
            FileSystemTracer.RenameTracer.class,
            FileSystemTracer.DeleteTracer.class,
            DFSClient.class,
            DFSClient.Conf.class,
            ClientContext.class,
            DistributedFileSystem.class,
            DomainSocketFactory.class,
            DFSInputStream.class,
            DFSOutputStream.class,
            HdfsDataInputStream.class,
            HdfsDataOutputStream.class,
            ClientNamenodeProtocolTranslatorPB.class,
            Class.forName("org.apache.hadoop.hdfs.DFSOpsCountStatistics"),
            Class.forName("org.apache.hadoop.hdfs.BlockReaderLocal"),
            Class.forName(DFSOutputStream.class.getName() + "$Packet"),
            Class.forName(DFSOutputStream.class.getName() + "$DataStreamer"),
            Class.forName(DFSOutputStream.class.getName() + "$DataStreamer$1"),
            Class.forName(DFSOutputStream.class.getName() + "$DataStreamer$2"),
            Class.forName(DFSOutputStream.class.getName() + "$DataStreamer$ResponseProcessor"),
            Class.forName(DistributedFileSystem.class.getName() + "$1"),
            Class.forName(DistributedFileSystem.class.getName() + "$4"),
            Class.forName(DistributedFileSystem.class.getName() + "$7"),
            Class.forName(DistributedFileSystem.class.getName() + "$13"),
            Class.forName(DistributedFileSystem.class.getName() + "$14"),
            Class.forName(DistributedFileSystem.class.getName() + "$16"),
            Class.forName(DistributedFileSystem.class.getName() + "$19"),
            Class.forName("org.apache.hadoop.hdfs.LeaseRenewer"),
            Class.forName("org.apache.hadoop.hdfs.LeaseRenewer$1"),
            Class.forName("org.apache.hadoop.hdfs.LeaseRenewer$Factory"),
            Class.forName("org.apache.hadoop.hdfs.LeaseRenewer$Factory$Key"),
            Class.forName("org.apache.hadoop.fs.Hdfs"),
            HdfsDataOutputStream.class
        ),
        ByteArrayClassLoader.PersistenceHandler.MANIFEST);

    argument = ArgumentCaptor.forClass(DataAccessEventProtos.FsEvent.class);

    eventHandler = mock(BiConsumer.class);

    ReflectionHelper.setField(null, classLoader.loadClass(FileSystemTracer.class.getName()), "eventHandler", eventHandler);
    ReflectionHelper.setField(conf, Configuration.class, "classLoader", classLoader);
    assertThat(ByteBuddyAgent.install(), instanceOf(Instrumentation.class));

    new FileSystemTracer.WriteTracer().installOnByteBuddyAgent();
    new FileSystemTracer.ReadTracer().installOnByteBuddyAgent();
    new FileSystemTracer.ListStatusTracer().installOnByteBuddyAgent();
    new FileSystemTracer.GetContentSummaryTracer().installOnByteBuddyAgent();
    new FileSystemTracer.DeleteTracer().installOnByteBuddyAgent();
    new FileSystemTracer.RenameTracer().installOnByteBuddyAgent();

    // MiniDfsCluster
    File baseDir = new File("./target/hdfs/test").getAbsoluteFile();
    FileUtil.fullyDelete(baseDir);
    conf.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
    conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, baseDir.getAbsolutePath());
    MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(conf)
        .simulatedCapacities(new long[] {10240000L});
    hdfsCluster = builder.build();
    hdfsURI = "hdfs://localhost:" + hdfsCluster.getNameNodePort();

    initDFS();
}
 
Example #4
Source File: ClientContext.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public DomainSocketFactory getDomainSocketFactory() {
  return domainSocketFactory;
}
 
Example #5
Source File: ClientContext.java    From big-c with Apache License 2.0 4 votes vote down vote up
public DomainSocketFactory getDomainSocketFactory() {
  return domainSocketFactory;
}