[jboss-dev-forums] [Design of JBossCache] - Re: Partial state transfer -when target root integration is
vblagojevic@jboss.com
do-not-reply at jboss.com
Wed Nov 8 10:06:21 EST 2006
We need delim because in JGroups once channel1 requests partial state with channel1.getState(String state_id) it eventually receives setState callback with the *same state_id*. This is a problem for partial state transfer that has to be integrated in a different subroot that source subroot.
I am not sure I understand your question regarding BR. I've seen BR code and it transfers state in a map through RPC call. Maybe we have to convert this somehow to make use of partial state transfer.
I am providing code, still local on my laptop, that explains how this encoding is done. I think code will be more clear than my English :)
TreeCache.MessageListenerAdaptor.getState
public byte[] getState(String state_id)
| {
| String sourceRoot = state_id;
| boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMETER)>0;
| if(hasDifferentSourceAndIntegrationRoots)
| {
| sourceRoot = state_id.split(StateTransferManager.PARTIAL_STATE_DELIMETER)[0];
| }
| try
| {
| return _getState(Fqn.fromString(sourceRoot), timeout, true, true);
| }
| catch (Throwable t)
| {
| my_log.error("Caught " + t.getClass().getName() +
| " while responding to partial state transfer request;" +
| " returning null", t);
| return null;
| }
| }
TreeCache.MessageListenerAdaptor.setState
public void setState(String state_id, byte[] state)
| {
| String targetRoot = state_id;
| boolean hasDifferentSourceAndIntegrationRoots = state_id.indexOf(StateTransferManager.PARTIAL_STATE_DELIMETER)>0;
| if(hasDifferentSourceAndIntegrationRoots)
| {
| targetRoot = state_id.split(StateTransferManager.PARTIAL_STATE_DELIMETER)[1];
| }
| try
| {
|
| if (state != null)
| {
| my_log.debug("Setting received partial state for subroot " +state_id);
| Fqn subroot = Fqn.fromString(targetRoot);
| Region region = regionManager.getRegion(subroot,false);
| ClassLoader cl = null;
| if(region!= null)
| {
| // If a classloader is registered for the node's region, use it
| cl = region.getClassLoader();
| }
| getStateTransferManager().setState(state, subroot, cl);
| isStateSet = true;
| }
| }
| ....
| ...
| }
TreeCache.fetchPartialState()
| public void fetchPartialState(Object sources [], Fqn sourceTarget, Fqn integrationTarget) throws Exception
| {
| String encodedStateId = sourceTarget + StateTransferManager.PARTIAL_STATE_DELIMETER + integrationTarget;
| fetchPartialState(sources,encodedStateId);
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984180#3984180
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984180
More information about the jboss-dev-forums
mailing list