Package eu.stratosphere.core.io

Examples of eu.stratosphere.core.io.IOReadableWritable


    private void processData() throws IOException, InterruptedException {
      DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data.array()));
      int id = dis.readInt(); // try to read an id


      IOReadableWritable invocation = newInstance(invocationClass); // read param
      invocation.read(dis);

      Call call = new Call(id, invocation, this);
      callQueue.put(call); // queue the call; maybe blocked here
    }
View Full Code Here


        try {
          final Call call = callQueue.take(); // pop the queue; maybe blocked here

          String errorClass = null;
          String error = null;
          IOReadableWritable value = null;

          CurCall.set(call);

          value = call(call.connection.protocol, call.param, call.timestamp);
View Full Code Here

        final Call call = calls.remove(id);

        final int state = in.readInt(); // read call status
        if (state == Status.SUCCESS.state) {
          IOReadableWritable value = null;
          boolean isNotNull = in.readBoolean();
          if (isNotNull) {
            final String returnClassName = StringRecord.readString(in);
            Class<? extends IOReadableWritable> c = null;
            try {
              c = ClassUtils.getRecordByName(returnClassName);
            } catch (ClassNotFoundException e) {
              LOG.error(e);
            }
            try {
              value = c.newInstance();
            } catch (InstantiationException e) {
              LOG.error(e);
            } catch (IllegalAccessException e) {
              LOG.error(e);
            }
            value.read(in); // read value
          }
          call.setValue(value);
        } else if (state == Status.ERROR.state) {
          call.setException(new RemoteException(StringRecord.readString(in), StringRecord.readString(in)));
        } else if (state == Status.FATAL.state) {
View Full Code Here

          } else {
            castArgs[i] = (IOReadableWritable) args[i];
          }
        }
      }
      final IOReadableWritable value = this.client.call(new Invocation(method, castArgs), this.address, method
        .getDeclaringClass());

      return value;
    }
View Full Code Here

    if (clazz == null) {
      fail("Cannot find class with name " + className);
    }

    IOReadableWritable copy = null;
    try {
      copy = clazz.newInstance();
    } catch (InstantiationException e) {
      fail(e.getMessage());
    } catch (IllegalAccessException e) {
      fail(e.getMessage());
    }

    if (copy == null) {
      fail("Copy of object of type " + className + " is null");
    }

    final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    final DataInputStream dis = new DataInputStream(bais);

    try {
      copy.read(dis);
    } catch (IOException e) {
      fail(e.getMessage());
    }

    return copy;
View Full Code Here

TOP

Related Classes of eu.stratosphere.core.io.IOReadableWritable

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.