tango.net.cluster.NetworkMessage

License:

BSD style: see license.txt

Version:

July 2004: Initial release

Author:

Kris
class NetworkMessage : IMessage #
A cluster-based messaging class. You should override both read() and write() methods to transport non-transient content along with the msg.
Note that when using read() and write(), invoke the superclass first so that your Message can potentially be deserialized as a superclass instance. That is, read() and write() might look something like this:
1
2
3
4
5
6
7
8
9
10
11
void read (IReader input)
{       
        super.read (input);
        input (myAttribute) (myOtherAttribute);
}

void write (IWriter output)
{
        super.write (output);
        output (myAttribute) (myOtherAttribute2);
}
char[] toString() #
Have to proxy this to satisfy interface requirements. It's both annoying and fragile to be forced into this kind of call-brokering, but then interfaces also don't expose the methods from Object either. Interfaces in D are still a bit too immature
void reply(char[] channel) #
Set the optional reply-channel
char[] reply() #
Return the optional reply-channel
void time(Time time) #
Set the waterline of the cache-entries that should not be touched by an invalidation. This is typically the time of an entry in a local cache on the machine originating the invalidation. Without the ability to guard against local invalidation, the cache entry just added locally would be removed along with others across the cluster. An alternative would be to invalidate before adding, though that can become complicated by network race conditions.
Time time() #
Return our time value
void id(uint value) #
uint id() #
void read(IReader input) #
Recover the reply-channel from the provided reader
void write(IWriter output) #
Emit our reply-channel to the provided writer
IMessage clone() #
Creates a shallow object copy. This is used internally for setting up templates/hosts of registered objects and should be overridden where deep(er) copying is desired.

Specifically:

it makes a bit-copy only. Dynamic arrays or pointer/reference oriented attributes are not duplicated.

In general, there should be zero heap activity ocurring during cluster requests. Thus, specific cluster services utilize this method to construct message hosts, up-front, helping to ensure the heap remains untouched during normal operation.

void execute() #
Interface issues mean that we'd have to reimplement all the above methods again to support the ITask derivative. Just hack this in here instead :[