460 likes | 625 Views
GlassFish BOF. Reza Rahman, GlassFish Evangelist Anil Gaur, VP Software Development.
E N D
GlassFish BOF Reza Rahman, GlassFish Evangelist Anil Gaur, VP Software Development
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
Agenda Journey since JavaOne 2012 Road Ahead Community Feedback Your agenda…Q&A
GlassFish Community Shipped Java EE 7 RI More social: More Twitter followers Community contributions FishCat – Mohammed, Marcus, Adam & many more Adopt-a-JSR effort with 20+ JUGs Tic Tac Toe Sample - Johan Since JavaOne 2012…
Java EE Past, Present, & Future Java EE 7 JMS 2, Batch, TX, Concurrency, Interceptor, WebSocket, JSON Java EE 6 Pruning,Extensibility,Ease of Use, CDI, JAX-RS Java EE 5 Ease of Development, EJB 3, JPA, JSF, JAXB, JAX-WS, StAX, SAAJ JAX-RPC, CMP/ BMP, JSR 88 J2EE 1.4 Web Services Mgmt, Deployment, Async Connector J2EE 1.3 CMP,Connector Architecture Web Profile JAX-RS 2 J2EE 1.2 Servlet, JSP, EJB, JMS, RMI Web Profile Servlet 3, EJB 3.1Lite
Java EE 7 Portable Extensions JSP 2.2 JSF 2.2 JAX-RS 2.0 EL 3.0 Bean Validation 1.1 Concurrency Utilities (JSR 236) Servlet 3.1 Batch Applications(JSR 352) Common Annotations 1.1 Interceptors 1.1 CDI 1.1 Java API for JSON(JSR 353) Managed Beans 1.0 EJB 3.2 Java API for WebSocket (JSR 356) Connector 1.6 JPA 2.1 JTA 1.2 JMS 2.0 New MajorRelease Updated
Java API for WebSocket Full-duplex, bidirectional communication over HTTP Part of HTML 5 API for WebSocket Client/Server Declarative, annotation-driven Programmatic, interface-driven
Java API for WebSocket Connection Life Cycle @Singleton @ServerEndpoint(”/chat”) public class ChatServer { Set<Session> peers = ... @OnOpen public void onOpen(Session peer) { peers.add(session); } @OnClose public void onClose(Session session) { peers.remove(session); } ...
Java API for WebSocket WebSocket Communication ... @OnMessage public void message(String message, Session client) throws IOException { for (Session session : peers) { if (!session.equals(client)) { session.getBasicRemote().sendObject(message); } } } }
JAX-RS 2 Client API Message filters & entity interceptors Asynchronous processing Server and client Hypermedia Support Mime type negotiation
JAX-RS 2 Client API // Get instance of ClientClient client = ClientBuilder.newClient();// Get customer name for the shipped productsString name = client.target(“../orders/{orderId}/customer”) .pathParam(”orderId", ”10”) .queryParam(”shipped", ”true”) .request() .get(String.class);
JMS 2 API modernization Streamlined APIs Dependency injection Runtime exceptions Builder pattern Intelligent defaults Delivery delay, async send, delivery count MDB alignment JMS resource definition
JMS 2 Old API @Resource(lookup = "java:global/jms/demoConnectionFactory") ConnectionFactory connectionFactory; @Resource(lookup = "java:global/jms/demoQueue") Queue demoQueue; public void sendMessage(String payload) { try { Connection connection = connectionFactory.createConnection(); try { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer messageProducer = session.createProducer(demoQueue); TextMessage textMessage = session.createTextMessage(payload); messageProducer.send(textMessage); } finally { connection.close(); } } catch (JMSException ex) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); } } Boilerplate Functional core Checked exceptions
JMS 2 Simplified API Higher-level managed, injected API @Inject private JMSContext context; @Resource(mappedName = "jms/inboundQueue") private Queue inboundQueue; public void sendMessage (String payload) { context.createProducer().send(inboundQueue, payload); } Reduced to functional core
Batch Applications for the Java Platform Standard Java API for batch processing Lingua franca for well understood batch concepts Jobs, job specification language (JSL), steps, readers, writers, processors, chunking, flow, parallelization, repositories
Batch Applications for the Java Platform Step Example ...implements ItemReader {public Object readItem() {// read account using JPA } <step id=”sendStatements”> <chunk reader ref=”accountReader” processor ref=”accountProcessor” writer ref=”emailWriter” chunk-size=”10” /> </step> ...implements ItemProcessor { Public Object processItems(Object account) {// read Account, return Statement } ...implements ItemWriter { public void writeItems(List accounts) {// use JavaMail to send email }
Concurrency Utilities for Java EE Provides low-level asynchronous processing capabilities to Java EE application components in a safe, reliable, consistent manner Mostly extension of Java SE Concurrency Utilities APIs ManagedExecutorService ManagedScheduledExecutorService ManagedThreadFactory
Concurrency Utilities for Java EE Managed Task Executor public class TestServlet extends HTTPServlet {@Resource(name=“concurrent/MyExecutorService”) ManagedExecutorService executor; Future future = executor.submit(new MyTask()); class MyTask implements Runnable { public void run() { ... // Task logic } }}
Many others . . . • JSON-P: Parsing, writing and querying JSON • JSF 2.2: @FlowScoped, HTML5 forms, CDI alignment… • Bean Validation 1.1: Method validation, CDI alignment… • Servlet 3.1: Non-blocking IO, Upgrade to WebSocket… • EL 3.0: Lambda expressions, Collection, Operators… • JPA 2.1: Schema generation, stored procedures, converters… • JTA 1.2: @Transactional, @TransactionScoped… • CDI 1.1: Ordering of interceptors, Servlet events, @Vetoed… • EJB 3.2: Optional CMP/BMP…
GlassFish 4 Feature Summary • Primary focus on making Java EE 7 usable by developers • Java EE 7 support in the Admin Console • Java EE Concurrency, JBatch • Background execution of admin commands • More REST/SSE support for administration • Log format changes • Configuration defaults • OSGi administration
GlassFish 4 and JBatch list-batch-job-executions list-batch-job-steps list-batch-jobs
Attach/Detach Admin Commands Commands can be executed in the background Use --detach with any command to send to the background Use --terse in scripts to receive just job id Show all running jobs using list-jobs Bring a job back to the foreground using the attach command Use the configure-managed-jobs command to further control the lifecycle of jobs
More Support for REST/SSE A more REST centric approach with /command/{command_name} GET for command syntax, POST to execute JSON for data interchange curl -X POST -H "X-Requested-By: reza" http://localhost:4848/command/uptime Supports Server Sent Events (SSE) Try the [start|stop]-cluster command curl -X POST -H "X-Requested-By: reza" -H "Accept: text/event-stream" -d "clusterName=c01" http://localhost:4848/command/stop-cluster
ODL vs. ULF Default log format changed to align with Oracle products Oracle Diagnostics Logging [yyyy-mm-ddThh:mm:ss.SSS-Z][ProductName-Version][Log Level] [Message ID][LoggerName][Key Value Pairs][[Message]] Uniform Log Formatter [#|yyyy-mm-ddThh:mm:ss.SSS-Z|Log Level|ProductName-Version|LoggerName|Key Value Pairs|Message|#] Well understood from GlassFish 3.1
More Logging Commands Large set of existing logging related commands Define threshold, file rotation, file names, … New commands list-loggers helps in understanding logger hierarchy set-log-file-format to choose ODL, ULF or custom Still possible to use log viewer in the Admin Console
Configuration Defaults GlassFish 3.1 – configuration values must be specified GlassFish 4 – introduce default values where possible Convergence to zero initial configuration get-active-module-config prints effective values create-module-config forces default values into the configuration Use as a template for configuration changes --dryrun just prints what’s being added delete-module-config removes actual configuration
OSGi Administration GlassFish modularity is based on OSGi Default OSGi subsystem is Apache Felix Integrated GoGo interface The osgi command executes one GoGo command The osgi-shell command opens interactive GoGo console Optional OSGi admin console Add on to GlassFish
More Details/Demos CON3319: GlassFish 4 Overview: What’s Under the Hood? Chanda Patel/Martin Mares Wednesday, September 25, 11:30 AM - 12:30 PM Parc 55 - Cyril Magnin I
GlassFish Server The Ecosystem
What is Avatar? R&D on HTML5/JavaScript • Industry trends • HTML5 and JavaScript is a significant trendsetter in market • HTML5 Connectivity – need a server • Strong interest in server-side JavaScript; horizontally scale • Native Applications gaining ground (but expensive) • Simplified user interface for browser-based applications for mobile, tablets and desktops • Avatar Scope • Java EE features to support HTML5 connectivity • WebSocket, JAX-RS, Server Sent Events • JavaScript services on the server • Enable Thin Server Architecture • Web Application Framework
Publishing services using 3 programming models: WebSockets RESTful WebServices Server-Sent Events (SSE) Node.js services & programming model hosted on the JVM (avatar.js on Nashorn) Optional server-side template support for HTML5 data binding Optional client library to consume all the above Project Avatar Architecture Java EE HTTP (REST) 1 Databases Data Access Data Sources JAX-RS JMS EJB Application Server *.html HTML 5 Client Web Sockets 4 Servlets SSE *.js JAXBJSONB ChangeNotification WebSockets *.css SSE JPA Avatar Server 3 Scripting Container Node.jar 2 Nashorn
Project Avatar Call to Action • Participate and provide feedback • Join avatar.java.net • Download and Review sample applications • Use Project Avatar • Ask questions • What is the direction we should take? • GlassFish Open Source Project • Java EE .next
GlassFish Server Roadmap GlassFish Server 4.0 GlassFish Server 3.1.2.2 GlassFish Server 4.1 2014 2012 2013
Summary Java EE 7 themes are HTML5, productivity and enterprise needs Well received by the community GlassFish 4 reference implementation and first application server implementing Java EE 7 Oracle continues to invest in Java EE/GlassFish Get involved in shaping the future!
Try it Out! 4.0 http://glassfish.org