1 package org.myorg.basicejb.webejb;
2
3 import javax.annotation.PostConstruct;
4
5 import javax.annotation.PreDestroy;
6 import javax.ejb.Remove;
7 import javax.ejb.Stateful;
8
9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory;
11
12 @Stateful
13 public class ShopperEJB implements ShopperRemote {
14 private static Logger logger = LoggerFactory.getLogger(ShopperEJB.class);
15
16
17 private int counter=0;
18
19 @PostConstruct
20 public void init() {
21 logger.debug("*** ShopperEJB({}).init() ***", super.hashCode());
22 }
23
24 @PreDestroy
25 public void destroy() {
26 logger.debug("*** ShopperEJB({}).destroy() ***", super.hashCode());
27 }
28
29 @Override
30 public int ping() {
31 logger.debug("ping({}) called, returned {}", super.hashCode(), counter);
32 return counter++;
33 }
34
35 @Override
36 @Remove
37 public void close() {
38 logger.debug("close({}) called", super.hashCode());
39 }
40 }