[jboss-dev-forums] [JBoss AS 7 Development] - Re: EJB lookup during server shutdown
Maycon Oliveira
do-not-reply at jboss.com
Thu Mar 22 09:27:21 EDT 2012
Maycon Oliveira [https://community.jboss.org/people/FuinhaAzul] created the discussion
"Re: EJB lookup during server shutdown"
To view the discussion, visit: https://community.jboss.org/message/725609#725609
--------------------------------------------------------------
The problem still happen. Can you confirm ? Maybe I coded something wrong?
*Just hit ctrl + c when the "STOP SERVER NOW!!!!" message shows* and the exception will happen.
Here is my test: (I cleaned up the @DependsOn beacause I tried a lot of combinations and the problem persist, where I put this annotation?)
@Singleton
@Startup
public class InitializerBean {
@EJB
private FirstSessionBean firstSessionBean;
@PostConstruct
public void init() {
try {
firstSessionBean.someOperation();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Stateless
@LocalBean
public class FirstSessionBean {
@EJB
private SecondSessionBean secondSession;
public void someOperation() {
try {
// while (true) {
System.out.println("STOP SERVER NOW!!!!");
Thread.sleep(5000);
secondSession.someOperation();
System.out.println("INVOCATION COMPLETED");
// }
} catch (Exception e) {
System.out.println("INVOCATION FAILED! ");
e.printStackTrace();
}
}
@PreDestroy
public void destroy() {
System.out.println("FirstSessionBean.destroy");
}
}
@Stateless
@LocalBean
public class SecondSessionBean {
public void someOperation() {
System.out.println("Some operation");
}
@PreDestroy
public void destroy() {
System.out.println("SecondSessionBean.destroy");
}
}
If you guys prefer, I have uploaded the eclipse project and the ejb.jar file:
http://www.4shared.com/file/-1q3LQtw/file.html
http://www.4shared.com/zip/cG3YjHs_/file.html
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/725609#725609]
Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120322/5a53ff2b/attachment.html
More information about the jboss-dev-forums
mailing list