Your SlideShare is downloading. ×
Java Batch
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Java Batch

9,219
views

Published on

This fast-faced, code-centric lightning talk covers the new Java Batch (aka Batch Applications for the Java Platform) API. …

This fast-faced, code-centric lightning talk covers the new Java Batch (aka Batch Applications for the Java Platform) API.

Java Batch is a long-requested IBM-led standard for batch processing in Java applications. The API synthesizes well-understood batching concepts such as jobs, steps, repositories, the reader-processor-writer pattern, chunking, parallel processing, flow, split, join, transactions, retries, sequencing, partitioning and much, much more.

Published in: Technology

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
9,219
On Slideshare
0
From Embeds
0
Number of Embeds
24
Actions
Shares
0
Downloads
59
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.1
  • 2. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.2Batch Applications for theJava PlatformReza RahmanGlassFish/Java EE Evangelistreza.rahman@oracle.com
  • 3. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.3The following is intended to outline our general product direction. It is intendedfor information purposes only, and may not be incorporated into any contract.It is not a commitment to deliver any material, code, or functionality, and shouldnot be relied upon in making purchasing decisions. The development, release,and timing of any features or functionality described for Oracle’s productsremains at the sole discretion of Oracle.
  • 4. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.4Batch Applications for the Java Platform Standardizes batch processing for Java– Non-interactive, bulk-oriented, long-running– Computationally intensive– Sequentially or in parallel Led by IBM Spring Batch, WebSphere Compute Grid (WCG), z/OS Batch Part of Java EE 7, can be used in Java SE
  • 5. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.5JBatch Architecture
  • 6. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.6Batch Chunks
  • 7. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.7Reader, Processor, Writerpublic interface ItemReader<T> {public void open(Externalizable checkpoint);public T readItem();public Externalizable checkpointInfo();public void close();}public interface ItemProcessor<T, R> {public R processItem(T item);}public interface ItemWriter<T> {public void open(Externalizable checkpoint);public void writeItems(List<T> items);public Externalizable checkpointInfo();public void close();}
  • 8. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.8<step id=”sendStatements”><chunk reader=”accountReader”processor=”accountProcessor”writer=”emailWriter”item-count=”10” /></step>Batch Applications for the Java PlatformStep Example@Named(“accountReader")...implements ItemReader... {public Account readItem() {// read account using JPA@Named(“accountProcessor")...implements ItemProcessor... {Public Statement processItems(Account account) {// read Account, return Statement@Named(“emailWriter")...implements ItemWriter... {public void writeItems(List<Statements> statements) {// use JavaMail to send email
  • 9. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.9Checkpointing For data intensive, long periods of time– Checkpoint/restart is a common design requirement Basically saves Reader, Writer positions– Naturally fits Chunk oriented steps– reader.checkpointInfo() and writer.checkpointInf() are called– The resulting Externalizable data is persisted– When the Chunk restarts, the reader and writer are initialized with therespective Externalizable data
  • 10. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.10Reader, Processor, Writerpublic interface ItemReader<T> {public void open(Externalizable checkpoint);public T readItem();public Externalizable checkpointInfo();public void close();}public interface ItemProcessor<T, R> {public R processItem(T item);}public interface ItemWriter<T> {public void open(Externalizable checkpoint);public void writeItems(List<T> items);public Externalizable checkpointInfo();public void close();}
  • 11. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.11Handling Exceptions<job id=...><chunk reader...><skippable-exception-classes><include class="java.lang.Exception"/><exclude class="java.io.FileNotFoundException"/></skippable-exception-classes><retryable-exception-classes></retryable-exception-classes><no-rollback-exception-classes></no-rollback-exception-classes></chunk></job>
  • 12. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.12Partitioned Step A batch step may run as a partitioned step– A partitioned step runs as multiple instances of the same step definitionacross multiple threads, one partition per thread<step id="step1" ><chunk ...><partition><plan partitions=“10" threads="2"/><reducer .../></partition></chunk></step>
  • 13. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.13Flow and Split Flow defines a set of steps to be executed as a unit<flow id=”flow-1" next=“{flow, step, decision}-id” ><step id=“flow_1_step_1”></step><step id=“flow_1_step_2”></step></flow> Split defines a set of flows to be executed in parallel<split …><flow …./> <!– each flow runs on a separate thread --><flow …./></split>
  • 14. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.14Where to Find Out More Read the draft spec and API docs at http://java.net/projects/jbatch/ Join public@jbatch.java.net and send questions and comments GlassFish 4.0– http://glassfish.java.net/– http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/ Slide Deck– http://www.slideshare.net/reza_rahman
  • 15. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.15Graphic Section Divider
  • 16. Copyright © 2012, Oracle and/or its affiliates. All rights reserved.16