You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Ted Dziuba <tj...@gmail.com> on 2008/06/18 01:22:16 UTC
Hadoop constructing public instance variables?
Hello all,
I have my own VersionedWritable class like so:
public class MyWritable extends VersionedWritable {
public OtherWritable anotherWritable; // instance var, implements Writable
...
public MyWritable() {
anotherWritable = null;
}
@Override
public void readFields(DataInput in) {
if (condition) {
anotherWritable = new OtherWritable();
// ...
}
}
}
I can verify that the no-arg constructor of MyWritable is being called,
but it appears as if the no-arg constructor for OtherWritable is being
called some time between the construction of MyWritable and the call to
MyWritable's readFields(). Is this expected behavior, because the
OtherWritable is a public instance variable that implements Writable?
This is happening when a SequenceFile containing a bunch of these is
read into a Reducer.
Ted