[jbosscache-dev] Fixing PojoCache tutorial - exception from getState

Galder Zamarreno galder.zamarreno at redhat.com
Wed Apr 25 13:00:10 EDT 2007


That is a very good point actually.

Let's make it more obvious in the docu for users and problem solved :)

http://jira.jboss.com/jira/browse/JBCACHE-1036

Brian Stansberry wrote:
> Re: the handling of getState, if the state transfer is not done via RPC 
> but rather via the JGroups state transfer protocols, the sender cache 
> has no way to know what the receiver wants (in memory, persistent).  It 
> can only rely on its own configuration to decide what to send.
> 
> 
> Galder Zamarreno wrote:
>> Alternatively, if that code is behaving as it should, why is there 
>> that "hack" to prevent in memory state transfer for the GUI? So that 
>> it always starts empty?
>>
>> Galder Zamarreno wrote:
>>> Hi,
>>>
>>> I'm trying to fix the tutorial for PojoCache. This works slightly 
>>> different because you have an instance of the GUI and then the code 
>>> entered via ./runShellDemo.sh
>>>
>>> I have noted that in JBossCacheView, there following happens before 
>>> starting the cache:
>>>
>>> // hack to prevent a state transfer for now
>>> cache.getConfiguration().setFetchInMemoryState(false);
>>>
>>> pojocache.bsh which is loaded via ./runShellDemo.sh still uses the 
>>> same replSynch-service.xml descriptor but it does not set fetch in 
>>> memory to false.
>>>
>>> So, if you start the GUI first, and then execute ./runShellDemo.sh 
>>> and then type sourceRelative("pojocache.bsh");, you get an exception 
>>> like this:
>>>
>>> "Caused by: org.jboss.cache.CacheException: Cache instance at 
>>> 127.0.0.1:33058 cannot integrate state since state provider could not 
>>> provide state due to org.jboss.cache.CacheException: Cache instance 
>>> at 127.0.0.1:33056 is not configured to provide state"
>>>
>>> Now, i'm debating the suitability of the following code in 
>>> StateTransferManager.getState:
>>>
>>> if (!fetchPersistentState && !fetchTransientState)
>>> {
>>> e = new CacheException("Cache instance at " + cache.getLocalAddress() 
>>> + " is not configured to provide state");
>>> }
>>>
>>> Documentation says: "FetchInMemoryState: Whether or not to acquire 
>>> the initial in-memory state from existing members. "
>>>
>>> It does not say anything about giving a state. There's nothing saying 
>>> that a cache not configured to fetch should not be able to give it. I 
>>> mean, a cache could potentially be configured not to retrieve 
>>> transient state on startup, but another cache could be configured to 
>>> do so and should be able to retrieve it from the first cache started, 
>>> shouldn't it?
>>>
>>> Cheers,
>>>
>>
> 
> 

-- 
Galder Zamarreño
Sr. Software Maintenance Engineer
JBoss, a division of Red Hat



More information about the jbosscache-dev mailing list