public void readFrom(DataInput in) throws Exception { type = Type.values()[in.readByte()]; lock_name = Util.readString(in); owner = (Owner) Util.readStreamable(Owner.class, in); timeout = in.readLong(); is_trylock = in.readBoolean(); }
public void readFrom(DataInput in) throws Exception { type = Type.values()[in.readByte()]; // We can't use Util.readObject since it's size is limited to 2^15-1 try { short first = in.readShort(); if (first == -1) { object = Util.readGenericStreamable(in); } else { ByteBuffer bb = ByteBuffer.allocate(4); bb.putShort(first); bb.putShort(in.readShort()); int size = bb.getInt(0); byte[] bytes = new byte[size]; in.readFully(bytes, 0, size); object = Util.objectFromByteBuffer(bytes); } } catch (IOException e) { throw e; } catch (Exception e) { throw new IOException("Exception encountered while serializing execution request", e); } request = in.readLong(); }