-
1. Re: Register custom component in ComponentRegistry
mircea.markus Aug 15, 2012 10:50 AM (in response to ferwasy)If you do that after the cache has started, I think you'll need to rewire(ComponentRegistry.rewire()) the component registry in order to get these methods invoked. That's a not very orthodox though, can't you rather use @CacheStart/@CacheStop listeners instead?
-
2. Re: Register custom component in ComponentRegistry
ferwasy Aug 15, 2012 10:56 AM (in response to mircea.markus)I need to implement a new functionality before the cache has started (prefill the cache from a database before it can receive requests) and wire dependencies using the annotation @Inject. Can i do that using @CacheStart or @CacheStop, or i must implement a new module?
-
3. Re: Register custom component in ComponentRegistry
galder.zamarreno Aug 20, 2012 8:53 AM (in response to ferwasy)@Mircea, registering custom components in our component registry is not really something our users should be doing...
@Fernando, I've no idea why you need a custom component, but I'm pretty sure that if you explain the problem you're trying to solve, we might find another way to resolve it
-
4. Re: Register custom component in ComponentRegistry
galder.zamarreno Aug 20, 2012 8:58 AM (in response to galder.zamarreno)@Fernando, implementing listeners for those annotations should work. You can even avoid that if the database has been written by persisting data in Infinispan itself. Then, you just need to enable preloading.
-
5. Re: Register custom component in ComponentRegistry
ferwasy Aug 21, 2012 8:35 AM (in response to galder.zamarreno)Galder: thank you for your responses. Let me tell you what I have to do: I need to implement a distributed cluster based on Infinispan using a shared cache store (a single DB2 relational database instance). Given the fact that the database is shared, the idea is that at each topology change, a new consistent hash will be installed and the cache entries should be rehashed and rebalanced reading all the entries from the database and store in cache only the entries that "belong" (each node is owner) to the node, instead of rebalance entries among the nodes. This should be invoked when the topology changes, and also, could be implemented "on demand".
My idea is set the options "preload" and "rehashEnabled" to false and implement a new module which contains a @ViewChanged listener, a manager and other classes that implements this functionality.
Which I don't understand is that, if you have a shared cache store and "preload" = true, even if your clustering mode is "distribution", every noad preloads all the entries in the underlying shared cache stored.
Ideas are more than welcome.
Regards.
-
6. Re: Register custom component in ComponentRegistry
galder.zamarreno Aug 23, 2012 2:23 AM (in response to ferwasy)But why do you need that functionality? The rebalancing function already happens if state transfer is enabled. I'm not sure about the need to re-read the entries from the cache store.
And btw, preloading only happens when the cache starts, not when a view change happens.
-
7. Re: Register custom component in ComponentRegistry
ferwasy Aug 23, 2012 8:15 AM (in response to galder.zamarreno)Galder: 'stateTransfer' documentation says: "If true, this will cause the cache to ask neighboring caches for state when it starts up, so the cache starts 'warm', although it will impact startup time.".
'loader.fetchInMemoryState' documentation says: "Therefore, if a shared cache store is used, the cache will not allow a persistent state transfer".
What I need is, having a shared cache store (database) and a distributed clustering mode, the rebalancing of keys without asking to neighbours. I mean, something equals to "CacheLoaderManagerImpl.preload()" but having into account with entry belongs to each node.
-
8. Re: Register custom component in ComponentRegistry
galder.zamarreno Aug 27, 2012 4:59 AM (in response to ferwasy)You're explaining what you need but not why
IOW, what is that state transfer is not giving you that you're needing to do what you want to do?
If the caches have most of the information in memory, and some data might be in cache store due to memory eviction, I think you can easily live with state transfer rebalancing stuff and lazily retrieving what's missing in memory going to the cache store.
-
9. Re: Register custom component in ComponentRegistry
ferwasy Aug 27, 2012 8:15 AM (in response to galder.zamarreno)Galder: thank you for your answer. The need of implement this type of "rehashing" comes from a client (I work for a software company) in order to have an alternative to entries redistribution when all nodes in a cluster share a single database as a cache store, reducing the number of network traffic between nodes (although network traffic to and from database increases).
I think that this can be seen as somthing wrong, but i really think that 'preload' configuration option in distribution clustering mode, should preload entries that belong to each node only.
Regards.
Fernando.
-
10. Re: Register custom component in ComponentRegistry
galder.zamarreno Aug 30, 2012 4:50 AM (in response to ferwasy)Feel free to create a JIRA in http://issues.jboss.org/browse/ISPN, and if you want to contribute a patch to get preload() to work this way, even better :
https://docs.jboss.org/author/x/ZABG
We'd gladly review your pull request
-
11. Re: Register custom component in ComponentRegistry
ferwasy Sep 21, 2012 3:45 PM (in response to galder.zamarreno)Galder: thanks for your info. I just created a JIRA [#ISPN-2334] Distributed mode and single shared cache loader - preload and state transfer - JBoss Issue Tracker
I've implemented the functionality in a separated Infinispan module. Let me know if it can be interested for you.
Kind regards.