Java in Motion
-
Upload
alexey-fyodorov -
Category
Technology
-
view
201 -
download
0
description
Transcript of Java in Motion
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.1
Java в движении
Алексей Фёдоров
Software Engineer, Oracle,
JCK, Java Platform Group
jug.msk, Москва
02.12.2013
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.3
«А ты кто такой?»
Software Engineer
–Cначала были военные,
–потом legacy systems на Java EE
–С 2011 года в Oracle: JCK Team
Community driver: JUG.ru, CodeFreeze
Conferences: Jpoint, Joker
Peopleware advocate
ФМЛ 239, СПбГУ, к.ф.-м.н.
@23derevo, http://about.me/alexey.fyodorov
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.4
Agenda
Java Platform Updates
Java Platform Tradeoffs
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.5
Часть 1.Java Platform Updates
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.6
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.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.7
С чем работает Java-приложение?
My Java-
application
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.8
С чем работает Java-приложение?
JDK
My Java-
application
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.9
С чем работает Java-приложение?
JDKFrame-works
My Java-
application
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.10
С чем работает Java-приложение?
JDKFrame-works
OS
My Java-
application
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.11
С чем работает Java-приложение?
JDK
Hardware
Frame-works
OS
My Java-
application
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.12
С чем работает Java-приложение?
JDK
Hardware
Frame-works
OS
My Java-
application
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.13
Как исправлять баги
OS
JDK
Frameworks
App
Hardware
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.14
Обновления
Минимизируйте время на обновление
Вашего приложения
Библиотеки
ОС
Железо
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.15
Обновления
Минимизируйте время на обновление
Вашего приложения
Библиотеки
ОС
Железо
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.16
Обновления Java
Типы обновлений:
–Release update :7u17 → 7u21
–Major update: Java 7 → Java 8
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.17
Обновления Java
Типы обновлений:
–Release update :7u17 → 7u21
–Major update: Java 7 → Java 8
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.18
Java 7 Updates versioning
7, 7u1, 7u2, 7u3, 7u4, 7u5, 7u6, 7u7 …
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.19
Java 7 Updates versioning
7, 7u1, 7u2, 7u3, 7u4, 7u5, 7u6, 7u7 …
–7u8 ?
–7u9, 7u10, 7u11…
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.20
Java 7 Updates versioning
7, 7u1, 7u2, 7u3, 7u4, 7u5, 7u6, 7u7 …
–7u8 ?
–7u9, 7u10, 7u11…
–7u12?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.21
Java 7 Updates versioning
7, 7u1, 7u2, 7u3, 7u4, 7u5, 7u6, 7u7 …
–7u8 ?
–7u9, 7u10, 7u11…
–7u12?
7u13, 7u15, 7u17 …
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.22
Java 7 Updates versioning
7, 7u1, 7u2, 7u3, 7u4, 7u5, 7u6, 7u7 …
–7u8 ?
–7u9, 7u10, 7u11…
–7u12?
7u13, 7u15, 7u17 …
–7u19 ?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.23
Java 7 Updates versioning
7, 7u1, 7u2, 7u3, 7u4, 7u5, 7u6, 7u7 …
–7u8 ?
–7u9, 7u10, 7u11…
–7u12?
7u13, 7u15, 7u17 …
–7u19 ?
7u21, 7u25
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.24
Java 7 Updates versioning
7, 7u1, 7u2, 7u3, 7u4, 7u5, 7u6, 7u7 …
–7u8 ?
–7u9, 7u10, 7u11…
–7u12?
7u13, 7u15, 7u17 …
–7u19 ?
7u21, 7u25
–7u29?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.25
Java 7 Updates versioning
7, 7u1, 7u2, 7u3, 7u4, 7u5, 7u6, 7u7 …
–7u8 ?
–7u9, 7u10, 7u11…
–7u12?
7u13, 7u15, 7u17 …
–7u19 ?
7u21, 7u25
–7u29?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.26
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.27
Номера обновлений в JDK 7
Раз в два месяца
Чётные
–Исправление ошибок
–Новая функциональность
Нечётные
–Исправление ошибок
–Обновления системы безопасности
CPU = ?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.28
Номера обновлений в JDK 7
Раз в два месяца
Чётные
–Исправление ошибок
–Новая функциональность
Нечётные
–Исправление ошибок
–Обновления системы безопасности
CPU = Critical Patch Update
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.29
Номера обновлений в JDK 7
Функциональность
–7u40, 7u60, 7u80
–8, 8u20, 8u40
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.30
Номера обновлений в JDK 7
Функциональность
–7u40, 7u60, 7u80
–8, 8u20, 8u40
Безопасность
–7u45, 7u51, 7u55, 7u61
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.31
Номера обновлений в JDK 7
Функциональность
–7u40, 7u60, 7u80
–8, 8u20, 8u40
Безопасность
–7u45, 7u51, 7u55, 7u61
–Exploit?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.32
Номера обновлений в JDK 7
Функциональность
–7u40, 7u60, 7u80
–8, 8u20, 8u40
Безопасность
–7u45, 7u51, 7u55, 7u61
–Exploit?
Emergency Releases!
(7u47, 7u49, 7u53, 7u57 etc.)
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.33
Нечётные обновления –Security Baseline Updates
Любой патч, закрывающий какие-либо
уязвимости в JDK 7 должен быть
портирован в JDK 6 и все остальные
поддерживаемые версии
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.34
Нечётные обновления –Security Baseline Updates
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.35
Чётные обновления: Feature Updates
JDK 7 Update 40 Highlights (пример)
Olson Data 2013d
Java Mission Control (JMC) 5.2
JavaFX 2.2.40
Serviceability Agent support for ARM
Retina Display support on Mac OS X
Deployment Rule Set
Option to disable "JRE out of date" warning
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.36
Чётные обновления: Feature Updates
JDK 7 Update 40 Highlights (продолж.)
New Security Warnings for Unsigned and
Self-Signed Applications
JAXP Security Improvements
Security Baselines не изменились!
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.37
Другие технологии
Java SE:
Standalone Technologies: JAXP, JAXB,
JNLP, JAX-WS (Везде своя нумерация!)
IANA Time Zone Database (aka Olson Data)
New platforms: Mac OS X, Windows 8.1 etc.
New HotSpot VM: new GC, new –XX options
Not Java SE:
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.38
Правило Joe Darcy
Не бывает стопроцентно
совместимых изменений!
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.39
Протокол взаимодействия
API spec
(aka Javadoc)
JLS8 JSR 337JVMS
8
Standalone
documents
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.40
Спецификация платформы
Спецификация платформы Java –
это протокол!
– Версия! (Java SE 6, 7, 8)
Протокол нельзя менять часто!
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.41
Протокол SMTP
Тысячи серверов
Тысячи клиентов
тысячи + тысячи = тысячи
Timeline
1982 – RFC 821
2001 – RFC 2821
2008 – RFC 5321
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.42
Java
Миллионы Java-приложений
Тысячи реализаций Java
миллионы + тысячи = миллионы
Timeline
1996 – JDK 1.0 2002 – J2SE 1.4
1997 – J2SE 1.1 2004 – J2SE 5.0
1998 – J2SE 1.2 2006 – Java SE 6
2000 – J2SE 1.3 2011 – Java SE 7
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.43
Как управлять изменениями в Java
OpenJDK / Oracle JDK
JDK QA
Community
Java-программисты по всему миру
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.44
Java от других вендоров
Процедура сертифицикации
Java Compatibility Kit (JCK)
Сотни тысяч тестов
Feedback от лицензиатов
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.45
Как мы управляем изменениями?
Специальные процессы и процедуры
Множественное ревью на предмет
Сompatibility, Security, Performance etc.
–Tracking, Accepting / Rejecting
–Проверяются изменения
В спецификации
В реализации
JCP + OpenJDK
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.46
Какие изменения допустимы?
Предлагаемое изменение Update Major
release
Добавить что-нибудь в Public API
(пакет / класс / метод / поле)
- +
Удалить что-нибудь из Public API - -*
Добавить что-нибудь в Private API + +
Удалить что-нибудь из Private API +** +
Изменить спецификацию чего-нибудь - +**
Исправить ошибку (несоответствие
поведения требуемому в спецификации)
+**,*** +
* - @Deprecated, @Override ** - проанализировать риски
*** - см. следующий слайд
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.47
Adding null key to empty TreeMap
without Comparator should throw NPE
JDK-5045147 JDK-2188127
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.48
«Давайте разрешим менять спецификацию чаще!»
Кто начнёт сходить с ума?
–Пользователи
–Инженеры Java Platform
–Лицензиаты Java
Совместимость может нарушаться!
–см. следующий слайд
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.49
Совместимость может нарушаться!
Compatibility:
–binary
–source
–Behavioral
Bug-2-Bug
Incompatibilities
–between Java SE 7 and Java SE 6
–between JDK 7 and JDK 6
–Java SE 7 and JDK 7 Compatibility
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.50
Наши инструменты (TCK Tools)
Проверяются изменения в сигнатурах
SigTest - http://sigtest.java.net/
–JDK – Public API
Жёсткие правила для Major Releases
Очень жёсткие правила для Updates
–NetBeans – Plugin API: полегчало!
Разметка спецификации и привязка тестов
–SpecTrac / SpecDiff
http://jcp.org/en/resources/tdk
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.51
Выход Java 8 передвинут на март
http://mreinhold.org/blog/secure-the-train
–Люди не берутся из ниоткуда
–Добавляя людей в конце проекта, сроки
не уменьшить
–Какие рассматривались варианты?
Выкинуть Lambda
Выпустить в срок с сыроватыми Lambda
Подвинуть на полгода
http://openjdk.java.net/projects/jdk8/
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.52
Что в итогеОбновление платформы, используемой
сотнями миллионов людей –
это очень сложный процесс!
Разные политики обновления для
Major Releases (Java 7 → Java 8) и для
Updates (7uXX)
–Отслеживание/Управление изменениями
–Специальные процессы
–Review изменений разными командами
–Инструменты: SpecTrac, SigTest и другие
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.53
Компромиссы в обновлении платформы Java
Инженерное искусство – это искусство
компромисса!
A trade-off (or tradeoff) is a situation that
involves losing one quality or aspect of
something in return for gaining another
quality or aspect.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.54
Java Platform Tradeoffs
Cкорость выхода новых версий vs. Качество
Cкорость vs. частота выпуска CPU
Совместимость vs. Развитие
И так далее
– Подробности после перерыва!
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.55
Java Platform Updates
Q&A
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.56
Часть 2.Java Platform Tradeoffs
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.57
Agenda
Частота выхода апдейтов
Фикс багов ломает совместимость
История про Substring
Совместимость как груз тянущий вниз
История о неизвестных отцах
История о четырёх аккумуляторах
GUI: Нативный или универсальный?
История про Beep
Как быть хитрому лицензиату?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.58
Сюжет 1Апдейты: часто или редко?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.59
Обновления Java и политика
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.60
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.61
Сюжет 2Исправление багов или совместимость?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.62
Adding null key to empty TreeMap
without Comparator should throw NPE
JDK-5045147 JDK-2188127
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.63
Adding null key to empty TreeMap
without Comparator should throw NPE
JDK-5045147 JDK-2188127
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.64
Сюжет 3String.substring()
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.65
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.66
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.67
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.68
Since JDK
7u6
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.69
Performance vs. Memory
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.70
Сюжет 4Совместимость или новые фичи?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.71
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.72
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.73
Сюжет 5Неизвестные отцы
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.74
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.75
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.76
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.77
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.78
Сюжет 6История о четырёх аккумуляторах
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.79
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.80
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.81
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.82
Утекающий Striped64
Варианты решения:
Делегирование вместо наследования
Дупликация кода
Кодогенерация в билде JDK
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.83
Утекающий Striped64
Варианты решения:
Делегирование вместо наследования
Дупликация кода
Кодогенерация в билде JDK
Serialization Proxy
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.84
Сериализация
Implements Serializable
Есть в любой JDK
Гибкая
–writeObject, readObject, readObjectNoData
–writeReplace, readResolve
–Externalizable
Легко использовать
Много лет, мало багов
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.85
Сюжет 7GUI: Нативный или универсальный?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.86
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.87
Сюжет 7Toolkit.beep()
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.88
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.89
Java 7
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.90
Java 7
Java 8
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.91
Сюжет 8История о хитром лицензиате
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.92
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.93
Выводы
Большинство tradeoff’ов связаны с
совместимостью
–в том или ином её смысле
Имеющиеся риски трудно оценивать
Разные риски в update releases
и в major updates
Java двигается в Embedded
–Больше различий в поведении
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.94
Q&A
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.95
Мои контакты
@23derevo
Skype: fyodorov.spbu
http://about.me/alexey.fyodorov