hama-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward J. Yoon" <edwardy...@apache.org>
Subject Re: Hama message can't be received
Date Tue, 31 Mar 2015 04:16:33 GMT
Hello,

I tested and it works fine for me. BTW, why there's no constructor in
your ValueVector?

--
      ValueVector v = new ValueVector();
      v.set(3);
      peer.send(peer.getPeerName(1), v);
      peer.sync();

      System.out.println(peer.getPeerIndex()
          + ": the number of received messages: " +
peer.getNumCurrentMessages());
--

I'm CC'ing user@ list.

Thanks.


On Tue, Mar 31, 2015 at 12:15 PM, Peter Zhang <zhangpeiran1227@gmail.com> wrote:
> Hi:
> I define a class like this :
> import java.io.DataInput;
> import java.io.DataOutput;
> import java.io.IOException;
>
> import org.apache.hadoop.io.FloatWritable;
> import org.apache.hadoop.io.VIntWritable;
> import org.apache.hadoop.io.Writable;
> import org.apache.hadoop.io.WritableFactories;
>
>
> public class ValueVector implements Writable {
> public FloatWritable values[];
> public void set(int N){
> values = new FloatWritable[N];
> for(int i=0;i<values.length;i++){
> values[i] = new FloatWritable(0.0f);
> }
> }
> public void set(float[] a){
> values = new FloatWritable[a.length];
> for(int i=0;i<values.length;i++){
> values[i] = new FloatWritable(a[i]);
> }
> }
> public FloatWritable[] get(){
> return values;
> }
> public void add(ValueVector other){
> for(int i=0;i<values.length;i++){
> values[i].set(values[i].get() + other.values[i].get());
> }
> }
> @Override
> public void readFields(DataInput in) throws IOException{
> values = new FloatWritable[in.readInt()];
> for(int i=0;i<values.length;i++){
> Writable value = WritableFactories.newInstance(FloatWritable.class);
> value.readFields(in);
> values[i] = (FloatWritable) value;
> }
> }
> @Override
> public void write(DataOutput out) throws IOException{
> out.writeInt(values.length);
> for(int i=0;i<values.length;i++){
> values[i].write(out);
> }
> }
> }
>
> In the BSP task , My message type is ValueVector
>  In the code like this:
> peer.send(mastertask, ValueVector);
> peer.sync();
>
> But ,the mastertask doeen't get any message!!!
> peer.getNumCurrentMessages() =0 !!!!!!!!
>
> I don't know why??? Please help,thanks!!!1



-- 
Best Regards, Edward J. Yoon

Mime
View raw message