LowerProfile

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(New page: Profiles are the best thing in JDK8 (in spite they are not as famous as lambdas). Now when they are here with us, it is essential that we will want our applications, [...)
(Being Ready for JDK Profiles)
Line 5: Line 5:
What does it mean: to be ready for [[profiles]]? Well, first and foremost, it means to be able to run on smaller profile than the whole [[JDK]]. In older [[JDK]]s, up to [[JDK]]7, one always had the whole ''rt.jar''. As such it did not matter whether your code used pieces from [[Swing]] (like {{JDK|javax/swing/event|ChangeListener}}) - all the classes were always available.
What does it mean: to be ready for [[profiles]]? Well, first and foremost, it means to be able to run on smaller profile than the whole [[JDK]]. In older [[JDK]]s, up to [[JDK]]7, one always had the whole ''rt.jar''. As such it did not matter whether your code used pieces from [[Swing]] (like {{JDK|javax/swing/event|ChangeListener}}) - all the classes were always available.
-
The situation changes with [[profiles]]. The smallest [[JDK]]8 profile is ''compact 1'' and be sure, it does not contain a single class from [[Swing]] (neither [[JNDI]] or [[XML]] parsers).
+
The situation changes with [[profiles]]. The smallest [[JDK]]8 profile is ''compact 1'' and be sure, it does not contain a single class from [[Swing]] (neither [[JNDI]] or [[XML]] parsers). But as an owner of a library or running system you may be interested in in such small profile. Why? Because then your library can be used on small devices (phones, Raspberry PI) or in a headless environment (on servers). For example [[Grizzly]] was not ready to run on ''compact 2'' up until [[I]] submitted a patch which made a dependency on [[JNDI]] conditional since [[Grizzly]] revision 2.3.8.
 +
 
 +
The need to run on smaller [[profiles]] is clear. Let's look at patterns how to adapt your [[API]] to such limited [[environment]].

Revision as of 10:30, 5 March 2014

Profiles are the best thing in JDK8 (in spite they are not as famous as lambdas). Now when they are here with us, it is essential that we will want our applications, frameworks and libraries to be ready for them. Here is few tricks that will help you refactor your code for JDK8.

Being Ready for JDK Profiles

What does it mean: to be ready for profiles? Well, first and foremost, it means to be able to run on smaller profile than the whole JDK. In older JDKs, up to JDK7, one always had the whole rt.jar. As such it did not matter whether your code used pieces from Swing (like ChangeListener) - all the classes were always available.

The situation changes with profiles. The smallest JDK8 profile is compact 1 and be sure, it does not contain a single class from Swing (neither JNDI or XML parsers). But as an owner of a library or running system you may be interested in in such small profile. Why? Because then your library can be used on small devices (phones, Raspberry PI) or in a headless environment (on servers). For example Grizzly was not ready to run on compact 2 up until I submitted a patch which made a dependency on JNDI conditional since Grizzly revision 2.3.8.

The need to run on smaller profiles is clear. Let's look at patterns how to adapt your API to such limited environment.

Personal tools
buy