[Design of EJB 3.0] - Re: Integration with different JBoss Cache releases
by bstansberry@jboss.com
OK, I see your point. My expectation was StatefulTreeCache remains part of core, as does the factory class I mentioned in my first post. The factory uses org.jboss.cache.Version to detect the JBC release that's available. That adds a dependency on JBC to core, but only on the very stable API of the Version class. The factory instantiates the adapter delegate via reflection. The adapter delegate lives in a JBC-version-specific project.
The dependency of core on org.jboss.cache.Version isn't so good.
IIRC, StatefulTreeCache itself is instantiated via reflection, so it and the factory can certainly be moved out of core. But your statement about needing a basic roadmap is certainly valid; this all needs to fit into an overall architecture of what the core is, what the adapters are, etc. My main concern to this point has been being sure it *could* be abstracted without too much pain; I think that's the case. I don't intend to actually do the abstraction until we have an overall plan.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984194#3984194
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984194
19 years, 5 months
[Design of JBossCache] - Re: Partial state transfer -when target root integration is
by vblagojevic@jboss.com
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
19 years, 5 months