Hi,

Damián Arregui wrote:

Nuno Carvalho wrote:


Yes, I have some suggestions :-) One of them is that the send/receive methods receive messages has Serializable objects. heven if they are byte[], when I implement that primitives I'm forced to view this has an Serializable object. This has 2 drwabacks: 1) Java Serialization is a little bit heavy; 2) the messages became very big. Could these primitives receive a reference to a byte[] ? If the programmer knows the object contents, could serialize objects more efficiently. The interface could offer primitives to serialize objects based on the basic types. This is just an ideia that I will ilustrate with some code.


Hi Nuno,

I take the liberty to get back to you through the Hedera mailing list since other users may have their word to say on this API-related topic.

Off course, you did well.


In fact the optimization you talk about is contemplated in the org.continuent.hedera.channel.ChannelMessage class. You should be able to inherit from this class and override the getByteArray method. Any message-specific optimizations can be implemented there.

Then it's up to the particular Hedera implementation to invoke getByteArray rather than using plain Java serialization. You can see an example in the send method of the org.continuent.hedera.channel.JGroupsReliableGroupChannel class.


Yes, in fact Hedera already has a solution for this. But in the ChannelMessage, only half of the solution is solved. The user can override the getByteArray method to serialize the list of chunks, but must implement the inverted operation, that takes a byte[] and rebuilds the list of chunks, outside ChannelMessage (in the receive method of the hedera ReliableGroupChannel).

My suggestion is that the ChannelMessage should already have the 2 operations: the getByteArray() and something like getChunks(byte[] msg) that makes the inverted operation. Off course, if the programmer extends the ChannelMessage, could make this option, but shouldn't this be already on the API of the message it self?

Regards,
Nuno Carvalho

begin:vcard
fn:Nuno Carvalho
n:Carvalho;Nuno
org;quoted-printable;quoted-printable:Faculdade de Ci=C3=AAncias, U. Lisboa;Inform=C3=A1tica
adr;dom:;;;Lisboa
email;internet:[EMAIL PROTECTED]
url:http://lasige.di.fc.ul.pt/~ncarvalho
version:2.1
end:vcard

_______________________________________________
Hedera mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/hedera

Reply via email to