Package org.apache.hama.bsp.message.io

Examples of org.apache.hama.bsp.message.io.SpillingDataOutputBuffer$SpillingStream


      processor.init(conf);
    } catch (FileNotFoundException e) {
      LOG.error("Error initializing spilled data stream.", e);
      throw new RuntimeException(e);
    }
    spillOutputBuffer = new SpillingDataOutputBuffer(bufferCount, bufferSize,
        threshold, direct, processor);
    objectWritable = new ObjectWritable();
    objectWritable.setConf(conf);
    this.conf = conf;
  }
View Full Code Here


public class TestMessageIO extends TestCase {

  public void testNonSpillBuffer() throws Exception {

    SpillingDataOutputBuffer outputBuffer = new SpillingDataOutputBuffer();
    Text text = new Text("Testing the spillage of spilling buffer");

    for (int i = 0; i < 100; ++i) {
      text.write(outputBuffer);
    }
    assertTrue(outputBuffer != null);
    assertTrue(outputBuffer.size() == 4000);
    assertFalse(outputBuffer.hasSpilled());
    outputBuffer.close();
  }
View Full Code Here

    Configuration conf = new HamaConfiguration();
    String fileName = System.getProperty("java.io.tmpdir") + File.separatorChar
        + new BigInteger(128, new SecureRandom()).toString(32);
    SpilledDataProcessor processor = new WriteSpilledDataProcessor(fileName);
    processor.init(conf);
    SpillingDataOutputBuffer outputBuffer = new SpillingDataOutputBuffer(2,
        1024, 1024, true, processor);
    Text text = new Text("Testing the spillage of spilling buffer");
    for (int i = 0; i < 100; ++i) {
      text.write(outputBuffer);
    }

    assertTrue(outputBuffer != null);
    assertTrue(outputBuffer.size() == 4000);
    assertTrue(outputBuffer.hasSpilled());
    File f = new File(fileName);
    assertTrue(f.exists());
    assertTrue(f.delete());
    outputBuffer.close();

  }
View Full Code Here

      String fileName = System.getProperty("java.io.tmpdir")
          + File.separatorChar + "testSpillInputStream.txt";
      Configuration conf = new HamaConfiguration();
      SpilledDataProcessor processor = new WriteSpilledDataProcessor(fileName);
      processor.init(conf);
      SpillingDataOutputBuffer outputBuffer = new SpillingDataOutputBuffer(2,
          1024, 1024, true, processor);
      Text text = new Text("Testing the spillage of spilling buffer");
      for (int i = 0; i < 100; ++i) {
        text.write(outputBuffer);
        outputBuffer.markRecordEnd();
      }

      assertTrue(outputBuffer != null);
      assertTrue(outputBuffer.size() == 4000);
      assertTrue(outputBuffer.hasSpilled());
      f = new File(fileName);
      assertTrue(f.exists());
      outputBuffer.close();
      assertTrue(f.length() == 4000);// + (4000 / 1024 + 1) * 4));

      SpilledDataInputBuffer inputBuffer = outputBuffer
          .getInputStreamToRead(fileName);

      for (int i = 0; i < 100; ++i) {
        text.readFields(inputBuffer);
        assertTrue("Testing the spillage of spilling buffer".equals(text
View Full Code Here

      processor.init(conf);
    } catch (FileNotFoundException e) {
      LOG.error("Error initializing spilled data stream.", e);
      throw new RuntimeException(e);
    }
    spillOutputBuffer = new SpillingDataOutputBuffer(bufferCount, bufferSize,
        threshold, direct, processor);
    objectWritable = new ObjectWritable();
    objectWritable.setConf(conf);
    this.conf = conf;
  }
View Full Code Here

public class TestMessageIO extends TestCase {

  public void testNonSpillBuffer() throws Exception {

    SpillingDataOutputBuffer outputBuffer = new SpillingDataOutputBuffer();
    Text text = new Text("Testing the spillage of spilling buffer");

    for (int i = 0; i < 100; ++i) {
      text.write(outputBuffer);
    }
    assertTrue(outputBuffer != null);
    assertTrue(outputBuffer.size() == 4000);
    assertFalse(outputBuffer.hasSpilled());
    outputBuffer.close();
  }
View Full Code Here

    Configuration conf = new HamaConfiguration();
    String fileName = System.getProperty("java.io.tmpdir") + File.separatorChar
        + new BigInteger(128, new SecureRandom()).toString(32);
    SpilledDataProcessor processor = new WriteSpilledDataProcessor(fileName);
    processor.init(conf);
    SpillingDataOutputBuffer outputBuffer = new SpillingDataOutputBuffer(2,
        1024, 1024, true, processor);
    Text text = new Text("Testing the spillage of spilling buffer");
    for (int i = 0; i < 100; ++i) {
      text.write(outputBuffer);
    }

    assertTrue(outputBuffer != null);
    assertTrue(outputBuffer.size() == 4000);
    assertTrue(outputBuffer.hasSpilled());
    File f = new File(fileName);
    assertTrue(f.exists());
    assertTrue(f.delete());
    outputBuffer.close();

  }
View Full Code Here

      String fileName = System.getProperty("java.io.tmpdir")
          + File.separatorChar + "testSpillInputStream.txt";
      Configuration conf = new HamaConfiguration();
      SpilledDataProcessor processor = new WriteSpilledDataProcessor(fileName);
      processor.init(conf);
      SpillingDataOutputBuffer outputBuffer = new SpillingDataOutputBuffer(2,
          1024, 1024, true, processor);
      Text text = new Text("Testing the spillage of spilling buffer");
      for (int i = 0; i < 100; ++i) {
        text.write(outputBuffer);
        outputBuffer.markRecordEnd();
      }

      assertTrue(outputBuffer != null);
      assertTrue(outputBuffer.size() == 4000);
      assertTrue(outputBuffer.hasSpilled());
      f = new File(fileName);
      assertTrue(f.exists());
      outputBuffer.close();
      assertTrue(f.length() == 4000);// + (4000 / 1024 + 1) * 4));

      SpilledDataInputBuffer inputBuffer = outputBuffer
          .getInputStreamToRead(fileName);

      for (int i = 0; i < 100; ++i) {
        text.readFields(inputBuffer);
        assertTrue("Testing the spillage of spilling buffer".equals(text
View Full Code Here

      processor.init(conf);
    } catch (FileNotFoundException e) {
      LOG.error("Error initializing spilled data stream.", e);
      throw new RuntimeException(e);
    }
    spillOutputBuffer = new SpillingDataOutputBuffer(bufferCount, bufferSize,
        threshold, direct, processor);
    objectWritable = new ObjectWritable();
    objectWritable.setConf(conf);
    this.conf = conf;
  }
View Full Code Here

      processor.init(conf);
    } catch (FileNotFoundException e) {
      LOG.error("Error initializing spilled data stream.", e);
      throw new RuntimeException(e);
    }
    spillOutputBuffer = new SpillingDataOutputBuffer(bufferCount, bufferSize,
        threshold, direct, processor);
    objectWritable = new ObjectWritable();
    objectWritable.setConf(conf);
    this.conf = conf;
  }
View Full Code Here

TOP

Related Classes of org.apache.hama.bsp.message.io.SpillingDataOutputBuffer$SpillingStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.