diff options
| author | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
|---|---|---|
| committer | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
| commit | 33613a85afc4b1481367fbe92a17ee59c240250b (patch) | |
| tree | 670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountCallbacks.java | |
| download | Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.gz Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.bz2 | |
Diffstat (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountCallbacks.java')
| -rw-r--r-- | Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountCallbacks.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountCallbacks.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountCallbacks.java new file mode 100644 index 0000000..d6f6aa1 --- /dev/null +++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountCallbacks.java @@ -0,0 +1,53 @@ +package examples.session.stateful;
+
+import javax.ejb.InvocationContext;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+/**
+ * This class is a lifecycle callback interceptor for the Count bean.
+ * The callback methods simply print a message when invoked by the
+ * container.
+ */
+public class CountCallbacks {
+
+ public CountCallbacks() {}
+ /**
+ * Called by the container after construction
+ */
+ @PostConstruct
+ public void construct(InvocationContext ctx) throws Exception {
+ System.out.println("cb:construct() ");
+ ctx.proceed();
+ }
+
+ /**
+ * Called by the container after activation
+ */
+ @PostActivate
+ public void activate(InvocationContext ctx) throws Exception {
+ System.out.println("cb:activate()");
+ ctx.proceed();
+ }
+
+ /**
+ * Called by the container before passivation
+ */
+ @PrePassivate
+ public void passivate(InvocationContext ctx) throws Exception {
+ System.out.println("cb:passivate()");
+ ctx.proceed();
+ }
+
+ /**
+ * Called by the container before destruction
+ */
+ @PreDestroy
+ public void destroy(InvocationContext ctx) throws Exception {
+ System.out.println("cb:destroy()");
+ ctx.proceed();
+ }
+
+}
|
