[infinispan-issues] [JBoss JIRA] (ISPN-5131) Deploy custom cache store to Infinispan Server

Sebastian Łaskawiec (JIRA) issues at jboss.org
Thu Feb 12 14:50:49 EST 2015


    [ https://issues.jboss.org/browse/ISPN-5131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13039941#comment-13039941 ] 

Sebastian Łaskawiec commented on ISPN-5131:
-------------------------------------------

{quote}
Indeed you don't want to limit users deploying instances of AdvancedLoadWriteStore only. You want to support deploying AdvancedCacheLoader, CacheLoader, AdvancedCacheWriter, CacheWriter and ExternalStore as well. This should be tested to make sure it works as expected. Ideally, you'd make sure you can support all of these with the least amount of internal changes. It will require though supporting multiple META-INF/services/xxx definitions based on which interface the user decides to implement.
{quote}

I would like to propose slightly different approach. Let's create new interface called CacheStoreFactory:
{code}
public interface CacheStoreFacory {

    public CacheLoader createCacheLoader();
    public CacheWriter createCacheWriter();

}
{code}

This interface will need to be implemented in deployable cache store. {{PersistenceManagerImpl}} would use such factories to obtain {{CacheLoader}} and {{CacheWriter}} instances. I think the biggest advantage of this approach is that we have only one service responsible for deployable Cache stores. The client has also the same level of flexibility (one might implement only one {{ExternalStore}} and return the same instance in both methods. The biggest drawback is slightly bigger refactoring in core (but on the other hand we guarded by a lot of unit/interaction tests there)

Does it sound reasonable or would you still vote for multiple services?

> Deploy custom cache store to Infinispan Server
> ----------------------------------------------
>
>                 Key: ISPN-5131
>                 URL: https://issues.jboss.org/browse/ISPN-5131
>             Project: Infinispan
>          Issue Type: Feature Request
>          Components: Loaders and Stores, Server
>            Reporter: Tristan Tarrant
>            Assignee: Sebastian Łaskawiec
>             Fix For: 7.2.0.Final
>
>
> h2. Overview
> Support the deployment and configuration of a custom cache store.
> h2. Client Perspective
> In order to create a deployable Cache Store the client will have to implement {{AdvancedLoadWriteStoreFactory}} (which will contain factory methods for creating {{AdvancedLoadWriteStore}}). Next, the factory will have to be annotated with {{@NamedFactory}} and placed into a jar together with proper entry of {{META-INF/services/org.infinispan.persistence.AdvancedLoadWriteStoreFactory}}. The last activity is to deploy given jar into Hotrod server.
> h2. Implementation overview
> The implementation is based on Deployable Filters and Converters. 
> Currently all writers and loaders are instantiated in {{PersistenceManagerImpl#createLoadersAndWriters}}. This implementation will be modified to use {{LoadWriteStoreRegistry}}, which will contain a list of {{AdvancedLoadWriteStoreFactories}}. One of the factories will be added by default - the local one (which will the same mechanism as we do now - {{Util.getInstance(classAnnotation)}}. Other {{AdvancedLoadWriteStoreFactories}} will be added after deployment scanning.
> h2. Implementation doubts and questions:
> * Should we expose a factory for {{AdvancedLoadWriteStore}} or should we include also {{ExternalStore}} (or even separate factory for {{CacheLoader}} and {{CacheWriter}}?
> * How to ensure that deployment scanning has finished before creating instantiating {{AdvancedLoadWriteStore}}?



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)



More information about the infinispan-issues mailing list