Beginning Jakarta EE by Peter Späth
Author:Peter Späth
Language: eng
Format: epub
ISBN: 9781484250792
Publisher: Apress
// Simulate some long-running calculation
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
}
return new AsyncResult<String>(
"Hi from tellMeLater()");
}
}
This example EJB uses the no-interface method, but asynchronous invocation works for local and remote interfaces as well. The AsyncResult is a convenience class that allows for the easy creation of a Future object. This Future object will not really be exposed to the client; its main purpose is to obey the method signature. The Future returned to the client will instead be transparently created by the EJB container.
On the EJB client side you invoke the EJB as usual and handle the Future you received from the EJB invocation as you are used to from the JRE concurrency API, as follows: ...
@EJB
private SomeEjb someEjb;
...
Future<String> f = someEjb.tellMeLater();
try {
// Example only: block until the result
// is available:
String s = f.get();
System.err.println(s);
} catch (Exception e) {
e.printStackTrace(System.err);
}
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12593)
Hello! Python by Anthony Briggs(9928)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9803)
The Mikado Method by Ola Ellnestam Daniel Brolund(9787)
Dependency Injection in .NET by Mark Seemann(9348)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8310)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7772)
Grails in Action by Glen Smith Peter Ledbrook(7705)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7567)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7178)
Microservices with Go by Alexander Shuiskov(6946)
Practical Design Patterns for Java Developers by Miroslav Wengner(6861)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6805)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6424)
Angular Projects - Third Edition by Aristeidis Bampakos(6223)
The Art of Crafting User Stories by The Art of Crafting User Stories(5740)
NetSuite for Consultants - Second Edition by Peter Ries(5668)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5484)
Kotlin in Action by Dmitry Jemerov(5074)
