Class StatsEJB

  • All Implemented Interfaces:
    Stats, StatsLocal, StatsRemote

    public class StatsEJB
    extends Object
    implements StatsLocal, StatsRemote
    This class provides an example of a Singleton EJB. The container will instantiate only one instance of this class and manage concurrent access to the instance.
    • Field Detail

      • log

        static final org.slf4j.Logger log
      • delta

        private int delta
      • total

        private int total
    • Constructor Detail

      • StatsEJB

        public StatsEJB()
    • Method Detail

      • open

        public void open()
        An example of a write method that the container will protect against other write and readers.
        Specified by:
        open in interface Stats
      • close

        public void close()
        Specified by:
        close in interface Stats
      • getTotal

        public int getTotal()
        An example read method that the container will protect from other write methods, but allow concurrent read access.
        Specified by:
        getTotal in interface Stats
      • getDelta

        public int getDelta()
        Specified by:
        getDelta in interface Stats
      • reset

        public void reset()
        Specified by:
        reset in interface Stats