Hi Guys,
Im just wondering whats the best way to go about this problem that i have, i have on
one machine which receives a feed X, when the feed X stops and starts feeding into another
node a message is sent to all members that this node is the new source for feed X. What i
want to do is however before the new node takes over he should retrieve the state from the
old node. Question is what is the best way to go about this?
I have multiple feeds going into the one cache, so its not like i can configure the cache
to retrieve state on start up,cache could already be started and receiving a feed Y
already.
I currently am using the TCPCacheServer to handle remote requests for this data and was
looking at the loadState(FQN,ObjectOutputStream) as a way to retrieve the data from the
old node but so far have had no joy in getting it to work.
First off i dont know if it will do what i want. This is the quote from the docs
anonymous wrote :
| Fetches a portion of the state for this cache from secondary storage (disk, database)
and writes it to a provided ObjectOutputStream. State written to the provided
ObjectOutputStream parameter is used for activation of a portion of a new CacheImpl
instance.
|
Now the bit about fetches from secondary storage, so if i have a TcpDelegatingCacheLoader
and call this, does it take the data from memory or from secondary storage? (Even though i
dont have a cacheloader configured that persists cache data to secondary storage.
Ok if the above does what i want it to do then how do i get it to work, trouble i have is
creating the ObjectOutPutStream, what should it be? Tried with the following but no joy
| try {
| ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
| MarshalledValueOutputStream os = new MarshalledValueOutputStream(baos);
| String path = "/feed/feedA";
| loader.loadState(Fqn.fromString(path), os);
| state = baos.toByteArray();
| watch.stop();
| if(log.isDebugEnabled()){
| log.debug("It took "+watch.toString() + " to load state from
remote cache.Byte size = "+state.length);
| }
| } catch (Exception e) {
| log.error("Problem trying to load state from remote server",e);
| }
|
So how do you create the ObjectOutputStream so it can be written to remotely?? If i cant
use the TCPDelegatingCaceLoader to transfer the old state to the new node then whats the
best approach you would suggest.
Thanks for any help,
LL
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4177648#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...