Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
JavaOne 2012 Report for Java EE
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Yoshio Terada
November 09, 2012
Technology
65
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JavaOne 2012 Report for Java EE
Yoshio Terada
November 09, 2012
More Decks by Yoshio Terada
See All by Yoshio Terada
エンジニア歴 30年 AI 時代のエンジニアとしての成長戦略 Y
yoshioterada
0
3
Other Decks in Technology
See All in Technology
SAENM ~Jupyterで残すPoCの試行錯誤、未来の自分と仲間を助ける記録!~
terapyon
0
110
Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
1
580
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
300
WasmをRustにする
sansantech
PRO
0
250
CTO Night|NotionのAIエージェントとFDE
kzkhykw1991
0
120
USB PDを使ってスマホを労わりたい
raspython3
0
180
Running Kotlin + Quarkus with Lambda
nealle
1
3.7k
遠藤な_めぐろLT #38 「社内のAI活用推進」@麻布台_20261009
endonanana
0
130
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
150
夫婦で子育てするための育児標準化
codmoninc
PRO
0
340
PagerDuty Tech Hub-鳴らすけれど、人は動かない
ezaki
0
170
実践! SRE × AI - ABEMA における AIOps -
tetsuya28
8
3.1k
Featured
See All Featured
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Everyday Curiosity
cassininazir
0
350
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
750
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
330
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
We Have a Design System, Now What?
morganepeng
55
8.4k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Transcript
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
1 Yoshio Terada Java Evangelist http://yoshio3.com, Twitter : @yoshioterada
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
2 ҎԼͷࣄ߲ɺฐࣾͷҰൠతͳͷํੑʹؔ͢Δ֓ཁΛઆ໌͢Δͷ Ͱ͢ɻ·ͨɺใఏڙΛ།Ұͷతͱ͢ΔͷͰ͋Γɺ͍͔ͳΔܖʹ ΈࠐΉ͜ͱͰ͖·ͤΜɻҎԼͷࣄ߲ɺϚςϦΞϧίʔυɺػೳΛ ఏڙ͢Δ͜ͱΛίϛοτϝϯτʢ֬ʣ͢ΔͷͰͳ͍ͨΊɺߪങܾఆ Λߦ͏ࡍͷஅࡐྉʹͳ͞Βͳ͍ͰԼ͍͞ɻΦϥΫϧʹؔͯ͠هࡌ͞ Ε͍ͯΔػೳͷ։ൃɺϦϦʔε͓Αͼ࣌ظʹ͍ͭͯɺฐࣾͷࡋྔʹΑΓ ܾఆ͞Ε·͢ɻ 0SBDMFɺถࠃΦϥΫϧίʔϙϨʔγϣϯٴͼͦͷࢠձࣾɺؔ࿈ձࣾͷถࠃٴͼͦͷଞͷࠃʹ͓͚Δొ ඪͰ͢ɻจதͷ໊ࣾɺ໊֤ࣾͷඪ·ͨొඪͰ͋Δ߹͕͋Γ·͢ɻ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
3
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
4 .BLFUIF'VUVSF+BWB +BWBͷະདྷΛ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
5 May 1998 Enterprise Java Platform Dec 1999 10 specs Robustness Sep 20110 13 specs Web Services Nov 2003 20 specs Ease of Development May 2006 23 specs Lightweight Dec 2009 28 specs JPE Project J2EE 1.3 CMP, Connector Architecture Java EE 5 Ease of Development, Annotations, EJB 3.0, JPA, JSF, Updated Web Services J2EE 1.4 Web Services Mgmt, Deployment, Async Connector Java EE 6 Pruning, Extensibility Ease of Dev, CDI, JAX-RS Web Profile Servlet 3.0, EJB 3.1 Lite J2EE 1.2 Servlet, JSP, EJB, JMS RMI/IIOP +BWB&&ͷྺ࢙
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
6 ࠓͷ݄·Ͱ+BWB&&ͷςʔϚ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
7 § +BWB&&Λय़ϦϦʔε § +BWB&&ͰΫϥυରԠ Ϋϥυػೳʹ͍ͭͯ +BWB&&ͷϩʔυϚοϓʹ͍ͭͯ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
8 ϩʔυϚοϓʹର͢ΔϑΟʔυόοΫ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16 +BWB&&ύοέʔδํ๏ɺඋɺҠ২ੑͷ໘ʹ ͢Δͱطʹ͕ΫϥυରԠʹͳ͍ͬͯΔͱݴ ͑ΔͰ͠ΐ͏ɻΫϥυڥͰඞཁͳΓͷຬ ͨ͞Εͯͳ͍ࣄʹͳΔͱɺܦݧΛੵΜͩ࣌ʹ໌Β͔ʹ ͳΔͨΊɺ ·ͩඪ४ԽΛߦ͏ஈ֊Ͱ͋ Γ·ͤΜɻ ϕϯμʔʹΑΔٕज़ֵ৽ͱ૯߹ͯ͠ඪ४ԽΛߦ͍·͢ɻ զʑݱ࣌Ͱ·ͩ͜ͷʹ͓͍ٕͯज़ֵ৽Λߦͬ ͍ͯ·ͤΜɻ %BWJE#MFWJOT "QBDIF5PN&& (FSPOJNP Apache ϩʔυϚοϓʹର͢ΔϑΟʔυόοΫ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16 ਖ਼͍͠அͰ͢ɻ Ϋϥυͷඪ४Խࢢʹରͯ͠ɺඇৗʹ େ͖ͳมԽΛ༩͑ѱ͍ಈ͖ʹͳΓ·͢ɻ ࢧ࣋ twiigs ϩʔυϚοϓʹର͢ΔϑΟʔυόοΫ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16 ίϛϡχςΟͷཁʹԠ͑ΔͨΊ+BWB&&Λ࠶ฤ ͢Δࣄɺ ΤΩεύʔτάϧʔϓͷ༐ Ͱ࣮ͳӳஅͰ͢ɻ ͷय़ʹ༧ఆ͞Ε͍ͯΔ+BWB&&ͰΫϥ υͱ1BB4ػೳͷ࣮Λ࠶ࢼΈ͍ͯͩ͘͞ɻ .BSLVT&JTFMF +BWB&&$POTVMUBOU IUUQCMPHFJTFMFOFU Java EE Consultant ϩʔυϚοϓʹର͢ΔϑΟʔυόοΫ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16 +BWB&&ͷ࣮ऀͱͯ͠ਃ্͛͠ΔͳΒɺ զʑ 3FE)BU ͜ͷܾஅʹର ͠ଟ͍ʹࢧ͍࣋ͯ͠·͢ɻ ࢲ͔ͨͪͶ͔ͯΒ+BWB&&ίϛϡχςΟ·ͩΫ ϥυͷඪ४Խͷ४උ͕Ͱ͖͍ͯͳ͍ࣄΛఏএ͖ͯ͠ ·ͨ͠ɻͦͯ͜͠Εࢲ͕ͨͪఏڙ͢ΔΫϥυαʔ ϏεͰ͋Δ0QFO4IJGUͷ࣮ʹΑͬͯײ͍ͯ͡·͢ɻ 0QFO4IJGU+BWB&&ͱ͏·͘ద߹͍ͯ͠·͢ɻ 1FUF.VJS 3FE)BU redhat ϩʔυϚοϓʹର͢ΔϑΟʔυόοΫ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
13 ͘ΘΕΔٕज़ͷ ඪ४Խʹ४උظ͕ؒඞཁ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
14 § +BWB&& – )5.-ͱγϯϓϧԽʹϑΥʔΧε § +BWB&& – ΫϥυରԠͱϞδϡʔϧԽରԠͷ ܧଓతͳࢿ +BWB&&ͷࠓޙ Java EE Hasan Rizvi
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
15 May 1998 Enterprise Java Platform Dec 1999 10 specs Robustness Sep 20110 13 specs Web Services Nov 2003 20 specs Ease of Development May 2006 23 specs Lightweight Dec 2009 28 specs Simplicity & HTML5 CY 2013 33+ specs JPE Project J2EE 1.3 CMP, Connector Architecture Java EE 5 Ease of Development, Annotations, EJB 3.0, JPA, JSF, Updated Web Services J2EE 1.4 Web Services Mgmt, Deployment, Async Connector Java EE 6 Pruning, Extensibility Ease of Dev, CDI, JAX-RS Web Profile Servlet 3.0, EJB 3.1 Lite Java EE 7 JMS 2.0, Batch, JCache, TX Interceptors HTML5: WebSocket, JSON Web Profile JAX-RS 2.0 J2EE 1.2 Servlet, JSP, EJB, JMS RMI/IIOP +BWB&&ͷྺ࢙
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
16 τϐοΫ +BWB&&ͷ8FC1SPpMFʹ +"934͕ಋೖ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
17 +BWB&&ؚ·ΕΔ༧ఆͷ+43Ұཡ $POOFDUPS +1" +5" +.4 .BOBHFE#FBO &+# $PNNPO "OOPUBUJPOT *OUFSDFQUPST $%* 1PSUBCMF &YUFOTJPOT 4FSWMFU +41 +4' +"934 &- #FBO7BMJEBUJPO +BWB$BDIJOH "1* +43 #BUDI "QQMJDBUJPO +43 +BWB"1*GPS +40/ +43 +BWB"1*GPS 8FC4PDLFU +43 ৽نՃ େ෯ͳߋ৽ ௨ৗͷߋ৽
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
18 +BWB&&ͷٕज़
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
19 ࠓ͝հ͢Δ༰ γϯϓϧԽʹؔ͢ΔςʔϚ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
20 8FC4PDLFUͷৄࡉ ໌ͷ++6($$$Ͱ Ͱগ͚ͩ͠ɺσϞ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
21 5XJUUFS Singleton 8FC4PDLFU5XJUUFS5JNF-JOFΞϓϦ 3FNPUF &OEQPJOU RE RE RE Session Session Session 8FC4PDLFU &OEQPJOU 5XJUUFS+
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
22 ࠓ͝հ͢Δ༰ γϯϓϧԽʹؔ͢ΔςʔϚ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
23 +43 +BWB"1*GPS 1SPDFTTJOH+40/
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
24 3'$ 5IFBQQMJDBUJPOKTPO.FEJB5ZQFGPS +BWB4DSJQU0CKFDU/PUBUJPO ܰྔɺςΩετϕʔεɺϓϩάϥϛϯάݴޠʹඇґଘ Ҡ২ੑ͕ߴ͘ɺߏԽ͞ΕͨσʔλަϑΥʔϚοτ {“name”:”Bob”,”age”:20,”phone”:[“276 1234”,”124 4567”]} +40/ͱ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
25 JSR 353 : Java API for Processing JSON § 4USFBNJOH"1* – Ϩϕϧ – +40/ͷղੳੜͷޮతͳํ๏ § 0CKFDU.PEFM"1* – ߴϨϕϧ – 4USFBNJOHΑΓ͔ΜͨΜʹ࣮Մೳ – 4USFBNJOH"1*্ʹ࣮ Streaming & Object Model
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
26 +40/"1*ͷΞʔΩςΫνϟ +40/ϓϩόΠμ 41* 4USFBNJOH"1* 0CKFDU.PEFM "1* "11 "11 "11O ・・・ ศརͳػೳ Ϩϕϧ"1*
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
27 {! "firstName": "John", "lastName": "Smith", ! "age": 25,! "phoneNumber": [! { "type": "home", "number": "212 555-1234" }, ! { "type": "fax", "number": "646 555-4567" }! ]! } +40/σʔλͷαϯϓϧ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
28 0CKFDU.PEFM"1* ѻ͍қ͍%0.ϥΠΫͳ࣮
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
29 0CKFDU.PEFM"1* ѻ͍қ͍"1* +TPO0CKFDU +TPO"SSBZ +TPO#VJMEFS +TPO3FBEFS+TPO8SJUFS
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
30 +4PO0CKFDU ,FZ7BMVFͷϖΞͰૢ࡞ .BQ4USJOH +TPO7BMVFͰૢ࡞Մೳ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
31 JsonObject jobj = ...! Map<String, JsonValue> map = jobj.getValues();! ! if (map.containsKey(“firstName”)) {! JsonString jstring = jobj.getValue(“firstName”, ! JsonString.class);! String lastName = jstring.getValue();! } +4PO0CKFDU͔Βಛఆ,FZͷ7BMVFΛऔಘ ,FZͱ7BMVFͷܕ͕͔͍ͬͯΔ߹ʹ༗ޮ \pSTU/BNF:PTIJP ʜʜ^
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
32 if (map.containsKey("phoneNumber")) {! JsonArray jarray = jobj.getValue("phoneNumber", ! JsonArray.class);! for (int i = 0; i < jarray.size(); i++) {! JsonValue jvalue = jarray.getValue(i);! if (jvalue.getValueType() == JsonValueType.OBJECT) {! JsonObject jobj2 = jarray.getValue(i, JsonObject.class);! QIPOF/VNCFS< \UZQFIPNFz ^ \UZQFIPNFz ^ʜʜ> +4PO0CKFDU͔Βಛఆ"SSBZΛऔಘ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
33 +4PO#VJMEFS͔Β+TPO0CKFDUͷੜ JsonObject jsono = new JsonBuilder().! beginObject().! add("KEY1", "VALUE1").! beginArray("KEY2").! beginObject().! add("KEY3", "VALUE3").! endObject().! endArray().! endObject().! build();! \,&:7"-6& ,&:<\,&: 7"-6&z^>^
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
34 try (JsonReader reader = new JsonReader(! ɹɹɹɹɹɹɹɹɹɹɹɹnew FileReader("/tmp/json.dat"));) {! JsonObject jobj = reader.readObject();! Person person = json2Person(jobj);! printPerson(person);! } catch (IOException ioe) {! ioe.printStackTrace();! } *0͔Β+4PO0CKFDUͷಡΈࠐΈ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
35 try (FileWriter f = new FileWriter(! "/tmp/jsonout.dat");! JsonWriter writer = new JsonWriter(f)) {! writer.writeObject(jsono);! }catch(IOException ioe){! ioe.printStackTrace();! } *0+4PO0CKFDUͷॻ͖ࠐΈ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
36 ࠓ͝հ͢Δ༰ γϯϓϧԽʹؔ͢ΔςʔϚ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
37 +43 #BUDI"QQMJDBUJPOT GPSUIF+BWB1MBUGPSN
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
38 § όονॲཧ༻ͷϑϨʔϜϫʔΫ § +BWB4&&&ڥͰར༻Մೳ § όονॲཧʹඞཁͳɺೖྗɺॲཧɺग़ྗͷ࣮Λඪ४Խ § γʔέϯγϟϧɺฒྻॲཧʹରԠ ػೳͷҰཡ KCBUDI
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
39 KCBUDIͷΞʔΩςΫνϟ +PC3FQPTJUPSZ +PC 0QFSBUPS Item Reader Item Processor Item Writer +PC 4UFQ ̍ɹ ̍ ̍ ̍ ̍ ̍ ̍ શମΞʔΩςΫνϟ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
40 +PC0QFSBUPS +PC3FQPTJUPSZ +PC 0QFSBUPS Item Reader Item Processor Item Writer +PC 4UFQ ̍ɹ ̍ ̍ ̍ ̍ ̍ ̍ δϣϒॲཧͷશମΛཧ ʢىಈɾఀࢭɾ࠶ىಈɾϨϙδτϦใऔಘͳͲʣ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
41 +PC +PC3FQPTJUPSZ +PC 0QFSBUPS Item Reader Item Processor Item Writer +PC 4UFQ ̍ɹ ̍ ̍ ̍ ̍ ̍ ̍ όονͷॲཧ༰ΛӅณ +4- δϣϒ༷هड़ݴޠ Ͱهࡌͨ͠༰ͱؔ࿈͚
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
42 4UFQ +PC3FQPTJUPSZ +PC 0QFSBUPS Item Reader Item Processor Item Writer +PC 4UFQ ̍ɹ ̍ ̍ ̍ ̍ ̍ ̍ όονͷॲཧ༰ΛӅณ +4- δϣϒ༷هड़ݴޠ Ͱهࡌͨ͠༰ͱؔ࿈͚ ํࣜɿDIVOL CBUDIMFU
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
43 <job id="job1" xmlns="http://batch.jsr351/js1">! <split id="split1">! <flow id="flow1" next="flow2">! <step id="step1" next="step2">! <batchlet ref="MyBatchlet"/>! </step>! <step id="step2" next="stepDONE">! <batchlet ref="MyBatchlet2"/>! </step>! </flow>… </job>! +PC4QFDJpDBUJPO-BOHVBHF +4-δϣϒ༷هड़ݴޠ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
44 <flow id="flow2">! <step id="step3">! <chunk reader="MyReader" processor="MyProcessor" ! write="MyWriter” commit-interval=“2”>! <properties>! <property name="audit" value="true"/>! </properties>! </chunk>! </step>! </flow></split></job>! +PC4QFDJpDBUJPO-BOHVBHF +4-δϣϒ༷هड़ݴޠ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
45 DIVOLํࣜ +PC3FQPTJUPSZ +PC 0QFSBUPS Item Reader Item Processor Item Writer +PC 4UFQ ̍ɹ ̍ ̍ ̍ ̍ ̍ ̍ όονΛΞΠςϜʢೖྗɺॲཧɺग़ྗʣຖʹ͚࣮ͯ *UFN3FBEFSσʔλͷೖྗ *UFN1SPDFTTPSσʔλͷॲཧ *UFN8SJUFSσʔλͷग़ྗ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
46 DIVOLํࣜͷγʔέϯεਤͷྫ DPNNJUJOUFSWBMlzͷ߹
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
47 package javax.batch.api;! import java.io.Externalizable;! public interface ItemReader <T> {! public void open(Externalizable checkpoint) throws Exception;! public void close() throws Exception;! public T readItem() throws Exception;! public Externalizable checkpointInfo() throws Exception;! } *UFN3FBEFSΠϯλϑΣʔε
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
48 import javax.batch.api.ItemReader;! @Named! public class MyReader implements ItemReader { ! ɹ...! } *UFN3FBEFSͷ࣮ྫ ΠϯλϑΣʔε࣮༗
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
49 *UFN3FBEFSͷ࣮ྫ ΠϯλϑΣʔε࣮ແ import javax.batch.annotation.*;! @Named! public class MyReader {! @Open void open(MyCheckpointData checkpoint) ! throws Exception {...}! @Close void close() throws Exception {...}! @ReadItem MyBatchInputRecord read() throws Exception {...}! @CheckpointInfo Externalizable MyCheckpointData getChkpt() ! throws Exception {...}! }
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
50 package javax.batch.api;! public interface ItemProcessor <T, R> {! public R processItem(T item) throws Exception;! }! *UFN1SPDFTTPSΠϯλϑΣʔε
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
51 *UFN3FBEFSͱಉ༷ ɹ˔ΠϯλϑΣʔεͷ࣮༗ ɹ˔ΠϯλϑΣʔεͷ࣮ແ ɹɹʢϝιουϨϕϧɾΞϊςʔγϣϯʣ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
52 package javax.batch.api; ! import java.io.Externalizable;! import java.util.List;! public interface ItemWriter <T> {! public void open(Externalizable checkpoint) throws Exception;! public void close() throws Exception;! public void writeItems(List<T> items) throws Exception;! public Externalizable checkpointInfo() throws Exception;! }! *UFN8SJUFSΠϯλϑΣʔε
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
53 *UFN3FBEFSͱಉ༷ ɹ˔ΠϯλϑΣʔεͷ࣮ ɹ˔ΠϯλϑΣʔεͷະ࣮ ɹɹʢϝιουϨϕϧɾΞϊςʔγϣϯʣ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
54 Batchlet #BUDIMFUํࣜ +PC3FQPTJUPSZ +PC 0QFSBUPS +PC 4UFQ ̍ɹ ̍ ̍ όονΛ̍ͭͷλεΫͱ࣮ͯ͠ Ұ୴ॲཧΛ࣮ߦ͢Δͱ࠷ޙ·ͰॲཧΛଓߦ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
55 package javax.batch.api;! public interface Batchlet {! public String process() throws Exception;! public void stop() throws Exception;! }! #BUDIMFUΠϯλϑΣʔε
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
56 package javax.batch.api;! public interface Batchlet {! public String process() throws Exception;! public void stop() throws Exception;! }! #BUDIMFUΠϯλϑΣʔε @Named! public class MyBatchLet{! @Process String process() throws Exception {...} ! @Stop void stopMe() throws Exception {...}! }! ΠϯλϑΣʔε࣮༗ ΠϯλϑΣʔε࣮ແ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
57 +PC3FQPTJUPSZ +PC3FQPTJUPSZ +PC 0QFSBUPS Item Reader Item Processor Item Writer +PC 4UFQ ̍ɹ ̍ ̍ ̍ ̍ ̍ ̍ +PCʹؔ͢ΔݱࡏɾաڈͷใΛอ࣋
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
58 ࠓ͝հ͢Δ༰ γϯϓϧԽʹؔ͢ΔςʔϚ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
59 +43 +BWBä.FTTBHF4FSWJDF
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
60 § ͔ΜͨΜʹ࣮Ͱ͖ΔΑ͏ʹͳͬͨ"1* – +.4$POUFYU +.41SPEVDFS +.4$POTVNFSͷՃ § ྫ֎ͷ࣮ํ๏ͷมߋ § طଘ"1*ʹର͢Δվળ § $%*Λར༻ͨ͠ίʔυͷഉআ § Ϋϥυػೳ+BWB&& ৽ػೳͷҰཡ +.4 ҙɿ ڈͷ+BWB0OF +BWB0OF5PLZPͷ ༰͔Βएׯมߋ͋Γ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
61 @Resource( mappedName="jms/MyConnectionFactory” )! private static ConnectionFactory connectionFactory; ! @Resource( mappedName="jms/mySampleQueue” )! private static Queue queue;! public void sendMessage(String text){! Connection con = connectionFactory.createConnection();! Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);! MessageProducer prod = session.createProducer(queue);! TextMessage message = session.createTextMessage(text);! message.setText(message);! prod.send(message);! con.close();} طଘͷϝοηʔδૹ৴ίʔυ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
62 @Resource( mappedName="jms/MyConnectionFactory” )! private static ConnectionFactory connectionFactory; ! @Resource( mappedName="jms/mySampleQueue” )! private static Queue queue;! public void sendMessage(String text){! Connection con = connectionFactory.createConnection();! Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);! MessageProducer prod = session.createProducer(queue);! TextMessage message = session.createTextMessage(text);! message.setText(message);! prod.send(message);! con.close();} طଘͷίʔυͷ՝ ୯ͳΔϝοηʔδૹ৴ʹ தؒΦϒδΣΫτ͕ඞཁ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
63 @Resource( mappedName="jms/MyConnectionFactory” )! private static ConnectionFactory connectionFactory; ! @Resource( mappedName="jms/mySampleQueue” )! private static Queue queue;! public void sendMessage(String text){! Connection con = connectionFactory.createConnection();! Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);! MessageProducer prod = session.createProducer(queue);! TextMessage message = session.createTextMessage(text);! message.setText(message);! prod.send(message);! con.close();} طଘͷίʔυͷ՝ ఆܕతͳίʔυ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
64 javax.jms.JMSContext インタフェース +.4$POUFYU $POOFDUJPO 4FTTJPO • ผʑͷΫϥεΛ̍ͭʹ౷߹ – $POOFDUJPO – 4FTTJPO • +.41SPEVDFSͷఏڙ • +.4$POTVNFSͷఏڙ ৽نʹ+.4$POUFYUΠϯλϑΣʔεΛఏڙ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
65 JMScontext = conFactory.createContext();! TextMessage textMsg = context.createTextMessage(message);! context.createProducer(). send(queue, textMsg);! ! JMSContext context = conFactory.! createContext(AUTO_ACKNOWLEDGE);! MessageListener mListener = new MyMsgListener();! context.createConsumer(dest).setMessageListener(mListener);! ϝοηʔδૹ৴ྫ ϝοηʔδड৴ +.4$POUFYUΛར༻࣮ͨ͠ྫ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
66 MessageProducer producer = session.createProducer(); ! producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); ! producer.setPriority(1);! producer.setTimeToLive(1000); ! producer.send(destination,message);! context.createProducer().setDeliveryMode(DeliveryMode.NON_ ! PERSISTENT). setPriority(1).setTimeToLive(1000).send( ! destination,message);! +.4 +.4 +.41SPEVDFSͷར༻ྫ ϝιουɾνΣʔϯʹΑΔઃఆ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
67 public void sendMessage(String text){! Connection con = null;! try{! con = connectionFactory.createConnection();! Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);! MessageProducer prod = session.createProducer(queue);! TextMessage message = session.createTextMessage(text);! message.setText(message);! prod.send(message);! }finally{! con.close();! } ༻ޙίωΫγϣϯͷ Ϋϩʔζ͕ඞཁ ૹ৴ίʔυʹ͓͚Δطଘͷίʔυͷ՝
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
68 AutoCloseable による実装 (close()の実装が不要) ! public void sendMessage(String text){! ɹ try(JMSContext context = conFactory.createContext();){! TextMessage message = session.createTextMessage(text);! context.createProducer().send(outQueue,message);! message.sendText(outQueue,message);! }! }! +BWB4&USZXJUISFTPVSDFʹରԠ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
69 public void sendMessage(String text){! try{! ……// 送信処理! prod.send(message);! }catch(JMSException jmse){! // 例外処理! }finally{! try{! if(con != null) con.close();! }catch (JMSException jmse2){! // 例外処理! }}} ྫ֎ॲཧͷ࣮͕ ඞཁ ૹ৴ίʔυʹ͓͚Δطଘͷίʔυͷ՝
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
70 νΣοΫྫ֎͔ΒඇνΣοΫྫ֎ աڈͷྫ֎Ϋϥε ࠓޙͷྫ֎Ϋϥε JMSException JMSRuntimeException TransactionRolledBackException TransactionRolledBackRuntimeException IllegalStateException IllegalStateRuntimeException! InvalidDestinationException IllegalDestinationRuntimeException! InvalidSelectorException InvalidSelectorRuntimeException MessageFormatException MessageFormatRuntimeException ྫ֎ͷ࣮ํ๏͕มߋ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
71 ྫ֎͕3VOUJNF&YDFQUJPOʹมߋ public void sendMessage(String text){! try{! ……// ૹ৴ॲཧ! prod.send(message);! } catch (JMSRuntimeException ex) {! Logger.getLogger(getClass().getName()).! log(Level.SEVERE, null, ex); ! }! } ྫ֎ͷ࣮ํ๏͕มߋ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
72 § +/%*ϧοΫΞοϓͰίϯςφͷଓϑΝΫτϦΛ༻ – ίωΫγϣϯɾϓʔϧΛར༻Մೳ § +/%*໊Λະࢦఆ࣌ɺγεςϜͷσϑΥϧτ༻ +.4$POUFYUʹର͢Δೖ @Inject! @JMSConnectionFactory(“jms/MyConFactory”)! private JMSContext context; ΞϊςʔγϣϯΛར༻ͨ͠ґଘੑೖ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
73 +.4$POUFYUʹର͢Δೖ @Inject! @JMSConnectionFactory(“jms/MyConFactory”) ! @JMSPasswordCredential(userName=“admin”,password=“admin”)! @JMSSessionMode(JMSContext.AUTO_ACKNOWLEDGE)! private JMSContext context; パスワードやセッションモードの設定 ΞϊςʔγϣϯΛར༻ͨ͠ґଘੑೖ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
74
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
75 @Resource( mappedName="jms/MyConnectionFactory” )! private static ConnectionFactory connectionFactory; ! @Resource( mappedName="jms/mySampleQueue” )! private static Queue queue;! ! public void sendMessage(String text){! Connection con = connectionFactory.createConnection();! Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);! MessageProducer prod = session.createProducer(queue);! TextMessage message = session.createTextMessage(text);! message.setText(message);! prod.send(message);! con.close(); +BWB&&·Ͱͷϝοηʔδૹ৴ίʔυ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
76 @Inject! @JMSConnectionFactory(“jms/MyConFactory”) ! private JMSContext context;! @Resource(mappedName = “jms/queue”)! private Queue queue;! ! public void sendNewMessage(String msg){! context.createProducer().send(queue, msg);! } +BWB&&͔Βͷϝοηʔδૹ৴ίʔυ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
77 ࠓ͝հ͢Δ༰ γϯϓϧԽʹؔ͢ΔςʔϚ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
78 +43 &YQSFTTJPO-BOHVBHF
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
79 § -BNCEBࣜରԠ – "SSBZ -JTU .BQͷߏ § ίϨΫγϣϯʹର͢ΔΫΤϦԋࢉࢠ -*/2ࣜ § +BWB4&ڥͰར༻͢ΔͨΊͷ"1*Λఏڙ § σϑΥϧτͷ&-࣮ߦڥϚωʔδϟͷՃ § Ϋϥε TUBUJD มɺΫϥε TUBUJD ϝιουɺFOVNఆରԠ § ΫϥεɺύοέʔδͷΠϯϙʔτ ৽ػೳͷҰཡ &-
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
80 § ໊લۭؒΛ࣋ͭ/BNF – SFGFSFODF JNQPSU § ؔఆٛ § ίϯετϥΫλ § ৽͍͠ԋࢉࢠ – จࣈྻ࿈݁ԋࢉࢠɺมׂ༻ԋࢉࢠ § ܕม § දهͷධՁ༻ͷϦεφʔ ৽ػೳͷҰཡ &-
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
81 +BWB&&य़ࠒ ఏڙ։࢝༧ఆ ςʔϚɿ)5.-ͱ։ൃੜ࢈ੑͷ্ +BWB&&4%,ͷఏڙ։࢝
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
82 http://www.oracle.com/javaone
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
83 /FX"OOPVODFNFOU य़ࠒ +BWBΠϕϯτ։࠵༧ఆ
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
84
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
85