Saturday, September 3, 2016

How to exclude a computer from SonicWALL Content Filtering Service/ to Allow Specific Email Addresses to Bypass Detection and Prevention by DPI Services

Java Code Examples for org.apache.cassandra.streaming.OperationType

 

 

/**
    * Not multi-threaded intentionally.
    * @return 
    */
   public Collection<PendingFile> stream(File directory) throws IOException, InterruptedException
   {
       Client client = new Client()
       {
           public boolean validateColumnFamily(String keyspace, String cfName)
           {
               return true;
           }

           public void init(String keyspace)
           {
           }
       };
       try {
    client.setPartitioner(config.getPartitioner());
} catch (Exception e) {
    logger.error("Configuration Exception while setting partitioner", e);
}
       
       
       SSTableLoader loader = new SSTableLoader(directory, client, options);       
       
       Collection<PendingFile> pendingFiles = Lists.newArrayList();
       for (SSTableReader sstable : loader.openSSTables())
       {
           Descriptor desc = sstable.descriptor;
           List<Pair<Long, Long>> sections = Lists.newArrayList(Pair.create(0L, sstable.onDiskLength()));
           PendingFile pending = new PendingFile(sstable, desc, SSTable.COMPONENT_DATA, sections, OperationType.BULK_LOAD);
           StreamHeader header = new StreamHeader(directory.getName(), UUID.randomUUID(), pending, Collections.singleton(pending));
           logger.info("Streaming to {}", InetAddress.getLocalHost());
           new FileStreamTask(header, InetAddress.getLocalHost()).run();
           logger.info("Done Streaming: " + pending.toString());
           sstable.releaseReference();
           pendingFiles.add(pending);
       }
       return pendingFiles;
   }
 
http://www.programcreek.com/java-api-examples/index.php?api=org.apache.cassandra.streaming.OperationType




No comments: