[infinispan-dev] MyRpcDispatcher

Brian Stansberry brian.stansberry at redhat.com
Mon Apr 12 09:05:13 EDT 2010


We need to think of another word besides "scope" for this, since it has 
a completely separate meaning elsewhere in JGroups.

Multiplexer? Just kidding ;-)

Shared/shareable? That seems reasonable in package/class names, but not 
so good for the short "scope" param/field. Maybe "scope" is ok for the 
param/field if we can come up with something else for the package/class 
names; by the time you are thinking about variables the package/class 
names have given you a clue what you're looking at.

On 04/12/2010 06:16 AM, Bela Ban wrote:
> I understand all of the new code is in the new package
> org.jgroups.blocks.scope. If that's the case, I suggest add and commit
> your changes so you can experiment with them.
>
> I also recall Galder needed to change some method from private to
> protected, why don't you go ahead and do this too ?
>
> Paul Ferraro wrote:
>> I've modified Bela's existing sample code to address the issues Brian
>> and I discussed below. Here's a summary of the changes:
>>
>> * Refactored pieces into separate classes with nicer names
>> * ScopedRpcDispatcher registers its scope with a ScopedUpHandler
>> * Added ScopeUpHandler deregistration on ScopedRpcDispatcher.stop().
>> * ScopedUpHandler accepts an optional default handler, which will be
>> triggered for non-message events or messages with no scope header
>> * ScopedUpHandler returns NoHandlerForScope object if message is
>> received for an unknown scope (e.g. its handler was not yet registered
>> or was already deregistered)
>> * Automatically adds RspFilter to RequestOptions that rejects
>> NoHandlerForScope responses, decorating any existing filter, if
>> necessary.
>> * Added ScopedMessageDispatcher analogue
>>
>> So, usage would look like:
>>
>> Channel c = new JChannel(...);
>>
>> ScopedUpHandler h = new ScopedUpHandlerImpl();
>>
>> ScopedRpcDispatcher d1 = new ScopedRpcDispatcher((short)1, h, c, null,
>> null, target1);
>> ScopedRpcDispatcher d2 = new ScopedRpcDispatcher((short)2, h, c, null,
>> null, target2);
>>
>> // This must be set after all rpc dispatchers are created
>> c.setUpHandler(h);
>> c.connect(...);
>>
>>
>> This will also work in conjunction with a standard rpc dispatcher:
>>
>> Channel c = new JChannel(...);
>>
>> RpcDispatcher d = new RpcDispatcher(c, null, null, target);
>> ScopedUpHandler h = new ScopedUpHandlerImpl(d.getProtocolAdapter());
>>
>> ScopedRpcDispatcher d1 = new ScopedRpcDispatcher((short)1, h, c, null,
>> null, target1);
>> ScopedRpcDispatcher d2 = new ScopedRpcDispatcher((short)2, h, c, null,
>> null, target2);
>>
>> c.setUpHandler(h);
>> c.connect(...);
>>
>>
>> I've attached the changes in the form of a patch to JGRP-1177.
>> Comments are welcome.
>>
>> Paul
>>
>>
>


-- 
Brian Stansberry
Lead, AS Clustering
JBoss by Red Hat



More information about the infinispan-dev mailing list