I've written a simple stateless session bean with the following interface:
@Remote
| public interface Foo {
| void sayHello();
| }
and the following implementation:
@Stateless
| public class FooBean implements Foo {
|
| @PostConstruct
| public void postConstruct() {
| System.out.println("Inside postConstruct");
| }
|
| @PreDestroy
| public void preDestroy() {
| System.out.println("Inside preDestroy");
| }
|
| public void sayHello() {
| System.out.println("Hello world");
| }
| }
When I call the sayHello() method from a client, I see the following output:
06:19:16,150 INFO [STDOUT] Inside postConstruct
| 06:19:16,170 INFO [STDOUT] Hello world
When I shutdown JBoss, however, I do not see "Inside preDestroy" printed to the
screen.
So, my question is two-fold:
Does the @PreDestroy callback get called when JBoss is shutdown? (I would have
expected it to, but apparently it does not..?)
If @PreDestroy does not get, how/where can I put cleanup code in my beans that
will get executed when JBoss shuts down?
Thanks!
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054302#4054302
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054302
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user