You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Doug Cutting <cu...@apache.org> on 2009/08/01 01:54:39 UTC

Re: How to define an RPC message with a void return type

George Porter wrote:
> The 'put' message gets compiled into the following signature in Java:
> 
> {code}
> Void put(ByteBuffer key, ByteBuffer value)
>     throws AvroRemoteException;
> {code}
> 
> Unfortunately, Void isn't an instantiatable type in Java.  Any thoughts?

When do you need to instantiate a Void?  I'm not saying this isn't a 
problem, I'm just not yet sure where the problem is.

Doug

Re: How to define an RPC message with a void return type

Posted by George Porter <gm...@gmail.com>.
The issue showed up when I was implementing put() on the server side.

I had written the method like this:

{code}
@Override
  public Void put(ByteBuffer key, ByteBuffer value) throws AvroRemoteException {
    kvstore.put(key, value);
  }
{code}

and was getting compiler errors.  I just added a "return null;" and it
fixed the problem.  I guess that I had expected the compiler to
produce a method with a return type of 'void', rather than 'Void'.

Thanks,
George

On Fri, Jul 31, 2009 at 4:54 PM, Doug Cutting<cu...@apache.org> wrote:
> George Porter wrote:
>>
>> The 'put' message gets compiled into the following signature in Java:
>>
>> {code}
>> Void put(ByteBuffer key, ByteBuffer value)
>>    throws AvroRemoteException;
>> {code}
>>
>> Unfortunately, Void isn't an instantiatable type in Java.  Any thoughts?
>
> When do you need to instantiate a Void?  I'm not saying this isn't a
> problem, I'm just not yet sure where the problem is.
>
> Doug
>