TOC PREV NEXT INDEX

ApplicationCounter.java


Since multiple users can potentially access and modify the value of our application-scoped counter, we need to create a version that guards against concurrent access. So we'll create an ApplicationCounter that extends our basic Counter and synchronizes methods that allow modification of our counter value.

Create a new class called ApplicationCounter by typing or copying the following into your editor:


 
package org.icefaces.tutorial.easyajaxpush;
 

 
import javax.faces.event.ActionEvent;
 

 
public class ApplicationCounter extends Counter {
 

 
    public ApplicationCounter() {
 
    }
 

 
    public synchronized void setCount(int count){
 
        super.setCount(count);
 
    }
 

 
    public synchronized void increment(ActionEvent event) {
 
        super.increment(event);
 
    }
 

 
    public synchronized void decrement(ActionEvent event) {
 
        super.decrement(event);
 
    }
 

 
}
 


Copyright 2005-2009. ICEsoft Technologies, Inc.
TOC PREV NEXT INDEX