Java one 2010
-
Upload
scdn -
Category
Technology
-
view
794 -
download
0
Transcript of Java one 2010
![Page 1: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/1.jpg)
Javaone 2010 report
Tadaya Tsuyukubo@ttddyy
http://bit.ly/ttddyy_javaone2010
![Page 2: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/2.jpg)
Oracle OpenWorld+
JavaOne
Year 2010 Sep 19-23San Francisco
![Page 3: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/3.jpg)
![Page 4: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/4.jpg)
Java 7, 8
• Productivity• Performance• Modularity
o Project Coin
Productivity with More Concise Codeo Project Lambda
Closures for Javao Project Jigsaw
The Modular Java Platform
NIO2(jsr203), Concurrency and Collections updates(jsr166y), JDBC4.1, etc.
![Page 5: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/5.jpg)
Project Coin
• Diamond Map<String, List<Integer>> map = new HashMap<>()
• Try-with-resources try( InputStream is = new FileInputStream(in); OutputStream os = new FileOutputStream(out) ) { ... } catch (Exception e) { ... }
• Strings in Switch• Improved integral literals• Vargs warnings• Multi-catch & precise rethrow
![Page 6: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/6.jpg)
Project Lambda
• SAM (Single Abstract Method)
Collections.sort( data, #( int a, int b ){ a.length() - b.length() } ); double max = students.filter( #{ s -> s.gradYear == 2010 }) .map( #{ s -> s.score }) .max();
• Method Reference
Collections.sortBy(students, #Student.getName);
![Page 7: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/7.jpg)
Project Jigsaw
• eliminate the class path• light weight memory foot print
• module-info.javao meta data (module dependency info)
@Version("1.0") @ImportModules( {
@ImportModule(name="java.se"), @ImportModule(name="com.foo.OrderProcessingService"), @ImportModule(name="com.bar.PrintService") } ) @MainClass("hello.HelloWorld") module hello;
![Page 8: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/8.jpg)
etc.
• Value Class value class Foo { property Foo parent; property String name; }
• JVMo upto 32G Heap Compactiono NUMA (Non-Uniform Memory Access)o G1GC (Garbage First GC)
• Integrate JRockit to HotSpot o Nondisruptive, Scalable, High Performance VM
![Page 9: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/9.jpg)
Java Release Plan
Plan B• Java7 (mid 2011)
o most of "Project Coin"o New I/O APIso Fork/Join Frameworko InvokeDynamico etc.
• Java8 (late 2012)o Project Lambdao Project Jigsawo Rest of Project Coino etc.
![Page 10: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/10.jpg)
Web related tech sessions
• EJB3 features (Transaction, Business Tier)o Bean Validation (JSR303)
Hibernate Validatoro CDI(Contexts and Dependency Injection) (JSR299)
@Inject, @Model, @Singleton, @Stateless, etc.o JPA 2.0 (JSR317)
• For Java6
o Common Annotation for the Java Platform (JSR250) @Resource, @PostConstruct, @PreDestroy
![Page 11: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/11.jpg)
Annotation Jam
@Secure@Transactional@RequestScoped@Named class SomeClass { ......}
@BusinessLogic class SomeClass {}
use customized stereotype
![Page 12: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/12.jpg)
Web session summary
• new features are mostly available in springo using spring is a correct choiceo giving more confusion to developers
• EJB containers are requiredo mostly commercialo still heavy weight
Advantage of using EJB • session clustering• remoting• commercial support?• vendor specific tools
spring is much better!! - lightweight - integration to other tech
![Page 13: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/13.jpg)
Case Study (mint.com)
• Free personal financial management web• 2billion financial transaction• 10m+ transaction per day
Architecture • spring + hibernate• memcached• intensive use of AOP
![Page 14: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/14.jpg)
DB Scaling
NOSQL• lose integrity ==> not best fit
User ID based sharding• Hierarchical data model• Logical database separation
o user data & non user data• put user_id to all hierarchical entities (user data)
o every user data is exclusive and have locality
![Page 15: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/15.jpg)
Implementation
Minimize infrastructure sharding info to implementation context• annotation • AOP
@MintUserdataclass UserService { .... }
@MintCommondataclass MasterDataService { .... }
switch SessionFactory, Datasource by AOP based on the annotation
![Page 16: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/16.jpg)
Monitoring
• collect data from real prod requestso viewed page, traffic, behavioro cache statisticso hibernate statisticso thread pool & queue size
• monitoring overhead must be low
o aggregate results in memoryo persist periodically
![Page 17: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/17.jpg)
Monitoring Impl
monitor all spring beans• AOP autoproxy all beans, no code change• All methods (request-response lifecycle) can be drilldown
• build custom tool (80/20 rule)• intensive use of AOP to monitor application error logs• log messages are parametrized, centeralized• web tool to easily search/parse errors
o like splunk
~/account.htm?id=1 100ms
AccountController#info() 10ms
AccountService#getInfo() 20ms
AccountDao#getInfoById() 70ms
![Page 18: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/18.jpg)
Security & How to reduce Bug
Use hibernate to enforce isolation• use AOP or hibernate callback
o if data tries to access data that doesn't belong to the user, throws exception
Detect crosstalk (multi thread test)• run test class with multiple user (sequential, multithread)
![Page 19: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/19.jpg)
Case Study (eBay)
• 10bil requests per day• 10K java servers
• partition everything• asynchronous everywhere• automate everything• everything fails• embrace inconsistency
• expect (r)evolution• dependencies matters• respect authority (data)• never enough data• custom infrastructure
![Page 20: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/20.jpg)
Case Study (Sinapto)
Online Poker in Italy3000 concurrent players
Architecture• Vertical, Horizontal partitioning (table, tournament)• asynchronous (event driven)• pass around status object
![Page 21: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/21.jpg)
Case Study (Caché)
Specialized to write huge data example:
3-D map of Galaxy monitor 1billion stars, more & more newly found ones (Peta byte level data) stock market trading information government, healthcare, financial industry
solution:o wrote DB : 130+K sustained inserts per sec
![Page 22: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/22.jpg)
JDBC: runs over tcp/ip (even locally) use JNI (Java Native Interface) Store multi dimensional data XEP: serialize & store MDS: Monitoring & Deiscovery Service
![Page 23: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/23.jpg)
NOSQL
• This does not replace RDBMS• Suit for representing data in a simple datastructure
o High Scalabilityo Flexible modificationo Specialized process
Characteristic• no join• mostly search data by single rowkey• eventual consistency
![Page 24: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/24.jpg)
Data Model Eventual Consistency• no transaction, no consistency
o application needs to handle consistency
Example: For column based DB, there is no association table, and no
cascade delete. When parent data is removed, child data needs to deleted
by application
RDBMS NoSQL
relational column, KV, etc.
![Page 25: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/25.jpg)
Testing
Unit Test• selenium IDE• junit• mock
Integration Test• starting container at beginning of test in code
![Page 26: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/26.jpg)
Functional Programming
"OO is better to project our world structure FP excels at actual coding of the algorithm"
Use OO to build classes Use FP to implement methods
Java 7, 8 will have FP(closure) feature. (lambda project)
![Page 27: Java one 2010](https://reader036.fdocuments.net/reader036/viewer/2022062901/58f32ed01a28abdb2d8b4583/html5/thumbnails/27.jpg)
Conclusionspring is the best!! Java future loadmap, Case Studies javaone 2010 Technical sessions• Spring One• Server Side • No Fluff, Just Stuff
met jp java community