-Re: Avro Client-Server - generic vs specific
Doug Cutting 2013-10-01, 16:32
You would like to make runtime protocol changes and would also still
like to use code generation? You could perhaps use
java.lang.reflect.Proxy to implement a generated protocol interface.
If you need to process new protocols, then you could perhaps compile
an AVDL file to Java at runtime, compile that Java to .class files
(with javax.tools.JavaCompiler) then load those class files (using
URLClassLoader), then use Java reflection to create instances, make
calls and implement services. But this seems like a lot more work
than just using generic. More information about what you need to
accomplish would be useful.
On Tue, Oct 1, 2013 at 4:24 AM, michał <[EMAIL PROTECTED]> wrote:
> In this situation then wen we have a AVDL protocol definition. The
> documentation mentions Avro tools for generation.
> But I need runtime protocol changes.
> Can the generation of protocol classes be done automatically at runtime?
> W dniu 30.09.2013 23:08, Doug Cutting pisze:
>> For RPC, specific is usually most convenient. The generated interface
>> and classes can be used to create requests and make calls, while a
>> service can implement the interface. Generic might be useful for
>> proxy-type RPC services, that can handle RPCs made in any protocol.
>> On Mon, Sep 30, 2013 at 3:32 AM, michał <[EMAIL PROTECTED]> wrote:
>>> We have got two ways of creating an RPC communication protocol from AVDL.
>>> Specific provide a custom implementation (it require code generation
>>> on avdl) while generic provide 'generic' implementation. What this
>>> actually means in terms of a protocol specification and code use?
>>> 1. What is the difference between the two apart from code look?
>>> 2. I can not understand what would be a good example code showing the
>>> advantages of Specific vs Generic responder?
>>> 3. When would be the good choice to use *generic* and when *specific
>>> generation?)* responder?
>>> thank you in advance for your time replying.