[jboss-user] [JBossCache] - PojoCache - increment global counter

fatbatman do-not-reply at jboss.com
Wed Aug 15 12:52:02 EDT 2007


Hello,

I'm trying to use PojoCache1.4 to share a share a global counter across a cluster of servers.  Something like this.

@PojoCacheable
public class GlobalValues implements Serializable {
    protected int globalCounter=0;

    public synchronized int incrementGlobalCounter(){
        globalCounter++;
        return globalCounter;
    }
}


incrementGlobalCounter() must always return the next value in the sequence even if called from two seperate machines in the cluster simulataneously.  How do I do this with PojoCache?  I've tried a number of things including setting the IsolationLevel to SERIALIZABLE, none of which work.

What should I do? 

thanks in advance

James




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074516#4074516

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074516



More information about the jboss-user mailing list