Package org.apache.flink.runtime.types

Examples of org.apache.flink.runtime.types.IntegerRecord


      Runtime.getRuntime().addShutdownHook(this.jobCleanUp);
    }

    long sleep = 0;
    try {
      final IntegerRecord interval = this.jobSubmitClient.getRecommendedPollingInterval();
      sleep = interval.getValue() * 1000;
    } catch (IOException ioe) {
      Runtime.getRuntime().removeShutdownHook(this.jobCleanUp);
      // Rethrow error
      throw ioe;
    }
View Full Code Here


  @Override
  public void invoke() throws Exception {
    try {
      writer.initializeSerializers();
      writer.emit(new IntegerRecord(42));
      writer.emit(new IntegerRecord(1337));
      writer.flush();
    }
    finally {
      writer.clearBuffers();
    }
View Full Code Here

    reader = new RecordReader<IntegerRecord>(this, IntegerRecord.class);
  }

  @Override
  public void invoke() throws Exception {
    IntegerRecord i1 = reader.next();
    IntegerRecord i2 = reader.next();
    IntegerRecord i3 = reader.next();
   
    if (i1.getValue() != 42 || i2.getValue() != 1337 || i3 != null) {
      throw new Exception("Wrong Data Received");
    }
  }
View Full Code Here

   
  }
   
  private void speedTestStream(int bufferSize) throws IOException {
    final Channel.ID tmpChannel = ioManager.createChannel();
    final IntegerRecord rec = new IntegerRecord(0);
   
    File tempFile = null;
    DataOutputStream daos = null;
    DataInputStream dais = null;
   
    try {
      tempFile = new File(tmpChannel.getPath());
     
      FileOutputStream fos = new FileOutputStream(tempFile);
      daos = new DataOutputStream(new BufferedOutputStream(fos, bufferSize));
     
      long writeStart = System.currentTimeMillis();
     
      int valsLeft = NUM_INTS_WRITTEN;
      while (valsLeft-- > 0) {
        rec.setValue(valsLeft);
        rec.write(new OutputViewDataOutputStreamWrapper(daos));
      }
      daos.close();
      daos = null;
     
      long writeElapsed = System.currentTimeMillis() - writeStart;
     
      // ----------------------------------------------------------------
     
      FileInputStream fis = new FileInputStream(tempFile);
      dais = new DataInputStream(new BufferedInputStream(fis, bufferSize));
     
      long readStart = System.currentTimeMillis();
     
      valsLeft = NUM_INTS_WRITTEN;
      while (valsLeft-- > 0) {
        rec.read(new InputViewDataInputStreamWrapper(dais));
      }
      dais.close();
      dais = null;
     
      long readElapsed = System.currentTimeMillis() - readStart;
View Full Code Here

    int numEventsTillEndOfSuperstep = taskConfig.getNumberOfEventsUntilInterruptInIterativeGate(0);
    eventHandler = new SyncEventHandler(numEventsTillEndOfSuperstep, aggregators,
        getEnvironment().getUserClassLoader());
    headEventReader.subscribeToEvent(eventHandler, WorkerDoneEvent.class);

    IntegerRecord dummy = new IntegerRecord();
   
    while (!terminationRequested()) {

//      notifyMonitor(IterationMonitoring.Event.SYNC_STARTING, currentIteration);
      if (log.isInfoEnabled()) {
View Full Code Here

   * Tests the serialization/deserialization of the {@link IntegerRecord} class.
   */
  @Test
  public void testIntegerRecord() {

    final IntegerRecord orig = new IntegerRecord(12);

    try {

      final IntegerRecord copy = (IntegerRecord) CommonTestUtils.createCopyWritable(orig);

      assertEquals(orig.getValue(), copy.getValue());
      assertEquals(orig, copy);
      assertEquals(orig.hashCode(), copy.hashCode());

    } catch (IOException ioe) {
      fail(ioe.getMessage());
    }

View Full Code Here

    }

    @Override
    public void invoke() throws Exception {
      writer.initializeSerializers();
      writer.emit(new IntegerRecord(42));
      writer.emit(new IntegerRecord(1337));
      writer.flush();
    }
View Full Code Here

      reader = new RecordReader<IntegerRecord>(this, IntegerRecord.class);
    }

    @Override
    public void invoke() throws Exception {
      IntegerRecord i1 = reader.next();
      IntegerRecord i2 = reader.next();
      IntegerRecord i3 = reader.next();
     
      if (i1.getValue() != 42 || i2.getValue() != 1337 || i3 != null) {
        throw new Exception("Wrong Data Received");
      }
    }
View Full Code Here

    return this.instanceManager;
  }

  @Override
  public IntegerRecord getRecommendedPollingInterval() throws IOException {
    return new IntegerRecord(this.recommendedClientPollingInterval);
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.types.IntegerRecord

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.