The usual method of setting remote filter in continuous queries is just like
            qry.setRemoteFilterFactory(new
Factory<CacheEntryEventFilter&lt;Integer, String>>() {
                @Override public CacheEntryEventFilter<Integer, String>
create() {
                    return new CacheEntryFilter();
                }
            });

But I need send an additional parameter "name" to it, so I have to write a
Factory class with a parameter to implements
Factory<CacheEntryEventFilter&lt;Integer, String>>, just like following:

public class CacheEntryEventFilterFactory implements
Factory<CacheEntryEventFilter&lt;Integer, String>> {

    private String            name;
    
    public CacheEntryEventFilterFactory() {
    }
    
     public CacheEntryEventFilterFactory(String name){
     this.name=name;
     }
    
    /*
     * @see javax.cache.configuration.Factory#create()
     */
    @Override
    public CacheEntryEventFilter<Integer, String> create() {
        // TODO Auto-generated method stub
        return new CacheEntryNewAlarmFilter(name);
    }
    
    @IgniteAsyncCallback
    private class CacheEntryNewAlarmFilter implements
CacheEntryEventFilter<Integer, String> {
        private String             name;
        
        public CacheEntryNewAlarmFilter(String name) {
            this.name = name;
        }
        
        /** {@inheritDoc} */
        @Override
        public boolean evaluate(CacheEntryEvent<? extends Integer, ? extends
String> e) throws CacheEntryListenerException {
                if (e.getValue().equals(name)){
                System.out.println(">>>Remote Updated entry [key=" +
e.getKey() + ", val=" + e.getValue() + "]" + "name = " + name);
                return true;
            }
            return false;
        }
    }
}

And I set remote filter as 
qry.setRemoteFilterFactory(new CacheEntryEventFilterFactory(name)); 

After my modification, when one client is doing continuous queries, another
client can not join the cluster to do continuous queries.

But when I use 
qry.setRemoteFilterFactory(new Factory<CacheEntryEventFilter&lt;Integer,
String>>()

It can let more than one client to do continuous queries at the same time.



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Cluster-can-not-let-more-than-one-client-to-do-continuous-queries-tp9124.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to