SlideShare a Scribd company logo
J2SE 5.0 Tiger
J2SE Road Map Version Code Name Release Date JDK 1.1.4 JDK 1.1.5 JDK 1.1.6 JDK 1.1.7 JDK 1.1.8 J2SE 1.2 J2SE 1.2.1 J2SE 1.2.2 J2SE 1.3 J2SE 1.3.1 J2SE 1.4.0 J2SE 1.4.1 J2SE 1.4.2 Sparkler Pumpkin Abigail Brutus Chelsea Playground (none) Cricket Kestrel Ladybird Merlin Hopper Mantis Sept 12, 1997 Dec 3, 1997 April 24, 1998 Sept 28, 1998 April 8, 1999 Dec 4, 1998 March 30, 1999 July 8, 1999 May 8, 2000 May 17, 2001 Feb 13, 2002 Sept 16, 2002 June 26, 2003 J2SE 5.0 (1.5.0)   Tiger   Sept 29, 2004
J2SE Themes J2SE 1.4.0  -  Quality (Merlin) J2SE 5.0 -  Ease of Development (Tiger) J2SE 6.0 -  Becoming more open (Mustang)     (Java goes multilingual)
Theme for J2SE 5.0 Ease of development Quality Monitoring and Manageability Performance and Scalability Desktop Client
New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
Language Features Generics Enhanced  for  Loop Variable Arguments Boxing / Unboxing Type-safe enumerations Static import
Generics A way to make class type-safe that are written on any  arbitrary object type. Allows to narrow an instance of a Collection to hold a specific object type and eliminating the need to typecast it while retrieving the object.
J2SE 1.4.0 ArrayList  intList  =  new ArrayList(); intList.add(new Integer(0)); Integer  intObj  =  (Integer) intList.get(0); J2SE 5.0 ArrayList<Integer> intList = new ArrayList<Integer>(); intList.add(new Integer(0));   //  Only Integer Objects allowed Integer  intObj  =  intList.get(0);   // No need to Type Cast
Enhanced  for  Loop Iterating over collections is a pain. ●  Often, iterator is unused except to get elements. Iterators are error-prone. –  Iterator variable occurs three times per loop. –  Gives you two opportunities to get it wrong. –  Common cut-and-paste error. Wouldn’t it be nice if the compiler took care of the iterator for you?
J2SE 1.4.0 for(Iterator iter = myArray.iterator(); iter.hasNext(); ) {     MyClass myObj = (MyClass)iter.next();     myObj.someOperation();  }  J2SE 5.0 for(MyClass myObj : myArray)  {       myObj.someOperation(); }
// Returns the sum of the elements of a int sum(int[] a)  { int result = 0; for (int i : a) result += i; return result; } For Arrays ●  Eliminates array index rather than iterator ●  Similar advantages
Variable Arguments To write a method that takes an arbitrary number of parameters, you must use an array. Creating and initializing arrays is a pain. Why not complier take care of it?
public int sum(int... intList){     int i, sum;         sum=0;     for(i=0; i<intList.length; i++)  {         sum += intList[i];     }         return(sum); }   Possible ways to call this method   int arr[] = { 3,5,7 }; int result = sum (arr); int result = sum (20, 30, 10 ,5 ); int result = sum(); Example of a method that takes an arbitrary number of int arguments and returns their sum:
Boxing / Unboxing Collections hold only objects, so to put primitive data types it needs to be wrapped into a class, like int to Integer. It is a pain to wrap and unwrap. Wouldn’t it be nice if the compiler took care of it for you?
J2SE 1.4.0 ArrayList arrayList = new ArrayList();     Integer intObject = new Integer(10); arrayList.add(intObject);  // cannot add 10 directly   J2SE 5.0 ArrayList arrayList = new ArrayList();     arrayList.add(10);   // int 10 is automatically wrapped into Integer
Type-safe enumerations Compiler support for Typesafe Enum pattern. Looks like traditional enum (C, C++, Pascal). Far more powerful. Can be used in switch/case statements. Can be used in for loops.
An enumeration is an ordered list of items wrapped into a single entity.   enum Season {winter, spring, summer, fall} Usage Example for (Season s : Season.VALUES){ // } An enumeration (abbreviated  enum  in Java) is a special type of class.  All enumerations implicitly subclass a new class in Java,  java.lang.Enum.   This class cannot be subclassed manually.
Static import Ability to access static members from a class without need to qualify them with a class name.
interface ShapeNumbers {     public static int CIRCLE = 0;     public static int SQUARE = 1;     public static int TRIANGLE = 2; }  Implementing this interface creates an unnecessary dependence on the ShapeNumbers interface.  It becomes awkward to maintain as the class evolves, especially if other classes need access to these constants also and implement this interface
To make this cleaner, the static members are placed into a class and then imported via a modified syntax of the import directive . package MyConstants;     class ShapeNumbers {     public static int CIRCLE = 0;     public static int SQUARE = 1;     public static int TRIANGLE = 2; }  To import the static members in your class, specify the following in the import section of your Java source file. import static MyConstants.ShapeNumbers.*;   // imports all static data   You can also import constants individually by using the following syntax: import static MyConstants.ShapeNumbers.CIRCLE; import static MyConstants.ShapeNumbers.SQUARE;
New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
Virtual Machine Features Class Data Sharing Server-Class Machine Detection Garbage Collector Ergonomics Thread Priority Changes High-Precision Timing Support
Class Data Sharing Reduces startup time of java applications. Better results for smaller applications. Automatically enabled when conditions allow it to be used. Not supported in Microsoft Windows 95/98/ME.
How CDS Works :  When JRE is installed on 32-bit platforms using the Sun provided installer, it loads a set of classes from the system jar file into a private internal representation, and dumps that representation to a file, called a &quot; shared archive &quot;.  Unix    :  jre/lib/[arch]/client/classes.jsa  Windows  :  jre/bin/client/classes.jsa  During subsequent JVM invocations, the shared archive is memory-mapped in, saving the cost of loading those classes and allowing much of the JVM's metadata for these classes to be shared among multiple JVM processes.   CDS produces better results for smaller applications because it eliminates a fixed cost of loading certain core classes .
The footprint cost of new JVM instances has been reduced in two ways.   First, a portion of the shared archive, currently 5-6 MB, is mapped read-only and therefore shared among multiple JVM processes. Previously this data was replicated in each JVM instance.  Second, since the shared archive contains class data in the form in which the Java VM uses it, the memory which would otherwise be required to access the original class information in rt.jar is not needed.  These savings allow more applications to be run concurrently on the same machine.
Server-Class Machine Detection At startup Launcher automatically detects if application is running on “server-class” Machine. Uses Server VM / Client VM accordingly. Server-class Machine :   One with at least 2 CPUs and at least 2GB of physical memory. Server VM start more slowly than client VM, but over time runs more quickly.
Garbage Collector Ergonomics On server-class machines running the  server VM , the garbage collector (GC) has changed from the previous serial collector to a parallel collector.  Can switch the GC collector mode using the command-line option. XX:+UseSerialGC  -  Serial collector XX:+UseParallelGC  -  Parallel collector
Thread Priority Changes Java threads and Native threads to compete on equal footing. Java threads at NORM_PRIORITY can now compete as expected with native threads.  Java priorities in the range [10...5] are all mapped to the highest possible TS (timeshare) or IA (interactive) priority. Priorities in the range [1..4] are mapped to correspondingly lower native TS or IA priorities
High-Precision Timing Support System.nanoTime()  method added. Provides access to nanosecond granularity time source for relative time measurements. The actual precision of the time value returned is platform dependant.
New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
Performance Enhancements Garbage collection Ergonomics StringBuilder Class Java 2D Technology Image I/O
Garbage collection Ergonomics Automatic detection of Sever-Class Machine Using Client / Server VM accordingly. Parallel Garbage Collection Default parallel garbage collection on Server VM.
StringBuilder Class Introduced a new class  java.lang.StringBuilder. It is like unsunchronized StringBuffer. Faster than StringBuffer.
Java 2D Technology Improved acceleration for Buffered Image Objects Support for H/W accelerated rendering using OpenGL. Improved text-rendering performance.
Image I/O Improved Performance and memory usage while reading and writing JPEG Images. In mage I/O API ( javax.imageio ) added support for reading and writing BMP and WBMP images.
New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
Base Libraries Lang and Util Packages Networking JAXP Bit Manipulation Operations
Lang and Util Packages ProcesBuilder More convenient way to invoke sub processes than Runtime.exec Formatter printf  style format strings. Support for layout justification and alignment, common formats for numeric, string and date/time data. Scanner Converts text into primitives or Strings. regular expression based searches on streams, file data, strings.
Lang and Util Packages  contd… Instrumentation New package  java.land.instrument , allows java programming agents to instrument programs running on the Java virtual machine by modifying methods' bytecodes at runtime  Threads getState() for querying the execution state of a thread. getStackTrace to obtain stack trace of a thread. A new form of the sleep() method is provided which allows for sleep times smaller than one millisecond.
Networking Complete support for IPv6 on Windows XP (sp1) and 2003. ping like feature –  InetAddress  class provides API to test the reachability of a host. Improved Cookie support. Proxy Sever Configuration –  ProxySelector  API provides dynamic proxy configuration.
JAXP 1.3 A built-in validation processor for  XML Schema. XSLTC, the fast, compiling transformer, which is now the default engine for XSLT processing.  Java-Centric  XPath  APIs in  javax.xml.xpath , which provide a more java-friendly way to use an XPath expression . Grammar pre-parsing and caching, which has a major impact on performance for high-volume XML processing.
Bit Manipulation Operations The wrapper classes (Integer, Long, Short, Byte, and Char) now support common bit manipulation operations like highestOneBit,  lowestOneBit,  numberOfLeadingZeros,  numberOfTrailingZeros,  bitCount,  rotateLeft,  rotateRight,  reverse,  signum, and  reverseBytes.
New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
Integration Libraries Remote Method Invocation (RMI) Java Database Connectivity (JDBC) Java Naming and Directory Interface (JNDI)
Remote Method Invocation (RMI) Dynamic Generation of Stub Classes Generation of stub at runtime eliminated the need of stub compiler  rmic . Standard SSL/TLS Socket Factory Classes Standard Java RMI socket factory classes,  javax.rmi.ssl.SslRMIClientSocketFactory  and  javax.rmi.ssl.SslRMIServerSocketFactory  added. Communicate over the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocols using the Java Secure Socket Extension (JSSE).
Java Database Connectivity (JDBC) RowSet  interface has been implemented in five common ways a RowSet object can be used. JdbcRowSet   -  used to encapsulate a result set or a driver. CachedRowSet   -  disconnects from its data source and operates independently except when it is getting data from the data source or writing modified data back to the data source.  FilteredRowSet   -  extends CachedRowSet and is used to get a subset of data. JoinRowSet   -  extends CachedRowSet and is used to get an SQL JOIN of data from multiple RowSet objects. WebRowSet  -  extends CachedRowSet and is used for XML data.
Java Naming and Directory Interface (JNDI) Enhancements to  javax.naming.NameClassPair  to access the fullname from the directory/naming service. Support for standard LDAP controls: Manage Referral Control, Paged Results Control and Sort Control. Support for manipulation of LDAP names.
Q & A Tiger
Thank You

More Related Content

PPTX
Multithreading in java
PDF
Java Multithreading Using Executors Framework
PDF
Multithreading in Java
PPT
Java Multithreading and Concurrency
PPTX
Java concurrency - Thread pools
PPTX
Multithreading programming in java
PPTX
The Java memory model made easy
ODP
Java Concurrency, Memory Model, and Trends
Multithreading in java
Java Multithreading Using Executors Framework
Multithreading in Java
Java Multithreading and Concurrency
Java concurrency - Thread pools
Multithreading programming in java
The Java memory model made easy
Java Concurrency, Memory Model, and Trends

What's hot (20)

PPT
Java Tut1
PPTX
Multithreading in java
PDF
Java Concurrency by Example
PPT
CS6270 Virtual Machines - Java Virtual Machine Architecture and APIs
PPTX
Multithreading in java
PPTX
Concurrency with java
PPTX
Unit1 introduction to Java
PPT
Java multi threading
PDF
Java programming basics
PPT
Java concurrency
PPTX
MULTI THREADING IN JAVA
PDF
Java Course 10: Threads and Concurrency
PDF
Ppl for students unit 4 and 5
PDF
02 basic java programming and operators
PPTX
Java memory model
PDF
Java Concurrency in Practice
PDF
New Features Of JDK 7
PPT
Tech talk
PPT
iOS Multithreading
PDF
Multi threading
Java Tut1
Multithreading in java
Java Concurrency by Example
CS6270 Virtual Machines - Java Virtual Machine Architecture and APIs
Multithreading in java
Concurrency with java
Unit1 introduction to Java
Java multi threading
Java programming basics
Java concurrency
MULTI THREADING IN JAVA
Java Course 10: Threads and Concurrency
Ppl for students unit 4 and 5
02 basic java programming and operators
Java memory model
Java Concurrency in Practice
New Features Of JDK 7
Tech talk
iOS Multithreading
Multi threading
Ad

Viewers also liked (20)

PDF
Enterprise Java Beans - EJB
PPS
computer slaves
ODP
engineering,career,how to
PPT
Pds Web 2 0 Teacher Tube 12 8 09
PPT
Megan w - trail presentation
PPT
Unlocking Social CRM for your Organisation (Keynote)
PPT
Comunicare col web2.0 (Vesuviocamp 2010
PDF
Toronto Real Estate Board Housing Market_Charts-December_2011
PDF
The latest in advanced technical Seo
DOCX
How to make flipped classroom accessible
PPT
Il codice del marketing della conversazione
PPTX
NEA Retired Groupsite
 
PPT
Mondi virtuali, numeri e prospettive
PPT
technology
PPT
SAP Roadmap in Essar Offshore Subsea Ltd.
PPT
Law Uncovered - One degree many options
PPTX
Risk Scores in Cardiac Surgery
PPT
Presentatie informatieavond januari 2012
PDF
How to Become an Effective Front-line Manager?
Enterprise Java Beans - EJB
computer slaves
engineering,career,how to
Pds Web 2 0 Teacher Tube 12 8 09
Megan w - trail presentation
Unlocking Social CRM for your Organisation (Keynote)
Comunicare col web2.0 (Vesuviocamp 2010
Toronto Real Estate Board Housing Market_Charts-December_2011
The latest in advanced technical Seo
How to make flipped classroom accessible
Il codice del marketing della conversazione
NEA Retired Groupsite
 
Mondi virtuali, numeri e prospettive
technology
SAP Roadmap in Essar Offshore Subsea Ltd.
Law Uncovered - One degree many options
Risk Scores in Cardiac Surgery
Presentatie informatieavond januari 2012
How to Become an Effective Front-line Manager?
Ad

Similar to J2SE 5 (20)

ODP
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
PDF
Why should i switch to Java SE 7
PPT
What is Java Technology (An introduction with comparision of .net coding)
PPT
What is new in J2SE 5
PDF
Java Standard Edition 5 Performance
ODP
Java Generics
PDF
Core java part1
PDF
Introduction java programming
PDF
Java 5 and 6 New Features
PPT
Java Basics
DOC
Java 5
PDF
First fare 2011 frc-java-introduction
PDF
JEE Programming - 01 Introduction
PDF
Java Programming - 01 intro to java
PDF
IBM Java PackedObjects
PPTX
What is Java? Presentation On Introduction To Core Java By PSK Technologies
PDF
J2 Se 5.0 Name And Version Change
PPTX
UNIT 1.pptx
PPTX
Java and the JVM
PPTX
Introduction to JcjfjfjfkuutyuyrsdterdfbvAVA.pptx
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Why should i switch to Java SE 7
What is Java Technology (An introduction with comparision of .net coding)
What is new in J2SE 5
Java Standard Edition 5 Performance
Java Generics
Core java part1
Introduction java programming
Java 5 and 6 New Features
Java Basics
Java 5
First fare 2011 frc-java-introduction
JEE Programming - 01 Introduction
Java Programming - 01 intro to java
IBM Java PackedObjects
What is Java? Presentation On Introduction To Core Java By PSK Technologies
J2 Se 5.0 Name And Version Change
UNIT 1.pptx
Java and the JVM
Introduction to JcjfjfjfkuutyuyrsdterdfbvAVA.pptx

More from Luqman Shareef (10)

PPTX
Containers virtaulization and docker
PPTX
Restful webservices
PPTX
Scrum luqman
PPTX
Cloud computing by Luqman
PPT
Tech Days 2010
PPTX
Service Oriented Architecture Luqman
PPT
Xml by Luqman
PPTX
Web Service Security
PPTX
Service Oriented Architecture
Containers virtaulization and docker
Restful webservices
Scrum luqman
Cloud computing by Luqman
Tech Days 2010
Service Oriented Architecture Luqman
Xml by Luqman
Web Service Security
Service Oriented Architecture

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Empathic Computing: Creating Shared Understanding
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Cloud computing and distributed systems.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Unlocking AI with Model Context Protocol (MCP)
PPT
Teaching material agriculture food technology
PPTX
MYSQL Presentation for SQL database connectivity
PDF
KodekX | Application Modernization Development
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation_ Review paper, used for researhc scholars
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Spectral efficient network and resource selection model in 5G networks
Empathic Computing: Creating Shared Understanding
Machine learning based COVID-19 study performance prediction
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Review of recent advances in non-invasive hemoglobin estimation
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
The AUB Centre for AI in Media Proposal.docx
Cloud computing and distributed systems.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Unlocking AI with Model Context Protocol (MCP)
Teaching material agriculture food technology
MYSQL Presentation for SQL database connectivity
KodekX | Application Modernization Development
Diabetes mellitus diagnosis method based random forest with bat algorithm
Building Integrated photovoltaic BIPV_UPV.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

J2SE 5

  • 2. J2SE Road Map Version Code Name Release Date JDK 1.1.4 JDK 1.1.5 JDK 1.1.6 JDK 1.1.7 JDK 1.1.8 J2SE 1.2 J2SE 1.2.1 J2SE 1.2.2 J2SE 1.3 J2SE 1.3.1 J2SE 1.4.0 J2SE 1.4.1 J2SE 1.4.2 Sparkler Pumpkin Abigail Brutus Chelsea Playground (none) Cricket Kestrel Ladybird Merlin Hopper Mantis Sept 12, 1997 Dec 3, 1997 April 24, 1998 Sept 28, 1998 April 8, 1999 Dec 4, 1998 March 30, 1999 July 8, 1999 May 8, 2000 May 17, 2001 Feb 13, 2002 Sept 16, 2002 June 26, 2003 J2SE 5.0 (1.5.0) Tiger Sept 29, 2004
  • 3. J2SE Themes J2SE 1.4.0 - Quality (Merlin) J2SE 5.0 - Ease of Development (Tiger) J2SE 6.0 - Becoming more open (Mustang) (Java goes multilingual)
  • 4. Theme for J2SE 5.0 Ease of development Quality Monitoring and Manageability Performance and Scalability Desktop Client
  • 5. New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
  • 6. New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
  • 7. Language Features Generics Enhanced for Loop Variable Arguments Boxing / Unboxing Type-safe enumerations Static import
  • 8. Generics A way to make class type-safe that are written on any arbitrary object type. Allows to narrow an instance of a Collection to hold a specific object type and eliminating the need to typecast it while retrieving the object.
  • 9. J2SE 1.4.0 ArrayList intList = new ArrayList(); intList.add(new Integer(0)); Integer intObj = (Integer) intList.get(0); J2SE 5.0 ArrayList<Integer> intList = new ArrayList<Integer>(); intList.add(new Integer(0)); // Only Integer Objects allowed Integer intObj = intList.get(0); // No need to Type Cast
  • 10. Enhanced for Loop Iterating over collections is a pain. ● Often, iterator is unused except to get elements. Iterators are error-prone. – Iterator variable occurs three times per loop. – Gives you two opportunities to get it wrong. – Common cut-and-paste error. Wouldn’t it be nice if the compiler took care of the iterator for you?
  • 11. J2SE 1.4.0 for(Iterator iter = myArray.iterator(); iter.hasNext(); ) {     MyClass myObj = (MyClass)iter.next();     myObj.someOperation(); } J2SE 5.0 for(MyClass myObj : myArray) {     myObj.someOperation(); }
  • 12. // Returns the sum of the elements of a int sum(int[] a) { int result = 0; for (int i : a) result += i; return result; } For Arrays ● Eliminates array index rather than iterator ● Similar advantages
  • 13. Variable Arguments To write a method that takes an arbitrary number of parameters, you must use an array. Creating and initializing arrays is a pain. Why not complier take care of it?
  • 14. public int sum(int... intList){     int i, sum;         sum=0;     for(i=0; i<intList.length; i++) {         sum += intList[i];     }         return(sum); } Possible ways to call this method int arr[] = { 3,5,7 }; int result = sum (arr); int result = sum (20, 30, 10 ,5 ); int result = sum(); Example of a method that takes an arbitrary number of int arguments and returns their sum:
  • 15. Boxing / Unboxing Collections hold only objects, so to put primitive data types it needs to be wrapped into a class, like int to Integer. It is a pain to wrap and unwrap. Wouldn’t it be nice if the compiler took care of it for you?
  • 16. J2SE 1.4.0 ArrayList arrayList = new ArrayList();     Integer intObject = new Integer(10); arrayList.add(intObject); // cannot add 10 directly J2SE 5.0 ArrayList arrayList = new ArrayList();     arrayList.add(10); // int 10 is automatically wrapped into Integer
  • 17. Type-safe enumerations Compiler support for Typesafe Enum pattern. Looks like traditional enum (C, C++, Pascal). Far more powerful. Can be used in switch/case statements. Can be used in for loops.
  • 18. An enumeration is an ordered list of items wrapped into a single entity. enum Season {winter, spring, summer, fall} Usage Example for (Season s : Season.VALUES){ // } An enumeration (abbreviated enum in Java) is a special type of class. All enumerations implicitly subclass a new class in Java, java.lang.Enum. This class cannot be subclassed manually.
  • 19. Static import Ability to access static members from a class without need to qualify them with a class name.
  • 20. interface ShapeNumbers {     public static int CIRCLE = 0;     public static int SQUARE = 1;     public static int TRIANGLE = 2; } Implementing this interface creates an unnecessary dependence on the ShapeNumbers interface. It becomes awkward to maintain as the class evolves, especially if other classes need access to these constants also and implement this interface
  • 21. To make this cleaner, the static members are placed into a class and then imported via a modified syntax of the import directive . package MyConstants;     class ShapeNumbers {     public static int CIRCLE = 0;     public static int SQUARE = 1;     public static int TRIANGLE = 2; } To import the static members in your class, specify the following in the import section of your Java source file. import static MyConstants.ShapeNumbers.*; // imports all static data You can also import constants individually by using the following syntax: import static MyConstants.ShapeNumbers.CIRCLE; import static MyConstants.ShapeNumbers.SQUARE;
  • 22. New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
  • 23. Virtual Machine Features Class Data Sharing Server-Class Machine Detection Garbage Collector Ergonomics Thread Priority Changes High-Precision Timing Support
  • 24. Class Data Sharing Reduces startup time of java applications. Better results for smaller applications. Automatically enabled when conditions allow it to be used. Not supported in Microsoft Windows 95/98/ME.
  • 25. How CDS Works : When JRE is installed on 32-bit platforms using the Sun provided installer, it loads a set of classes from the system jar file into a private internal representation, and dumps that representation to a file, called a &quot; shared archive &quot;. Unix : jre/lib/[arch]/client/classes.jsa Windows : jre/bin/client/classes.jsa During subsequent JVM invocations, the shared archive is memory-mapped in, saving the cost of loading those classes and allowing much of the JVM's metadata for these classes to be shared among multiple JVM processes. CDS produces better results for smaller applications because it eliminates a fixed cost of loading certain core classes .
  • 26. The footprint cost of new JVM instances has been reduced in two ways. First, a portion of the shared archive, currently 5-6 MB, is mapped read-only and therefore shared among multiple JVM processes. Previously this data was replicated in each JVM instance. Second, since the shared archive contains class data in the form in which the Java VM uses it, the memory which would otherwise be required to access the original class information in rt.jar is not needed. These savings allow more applications to be run concurrently on the same machine.
  • 27. Server-Class Machine Detection At startup Launcher automatically detects if application is running on “server-class” Machine. Uses Server VM / Client VM accordingly. Server-class Machine : One with at least 2 CPUs and at least 2GB of physical memory. Server VM start more slowly than client VM, but over time runs more quickly.
  • 28. Garbage Collector Ergonomics On server-class machines running the server VM , the garbage collector (GC) has changed from the previous serial collector to a parallel collector. Can switch the GC collector mode using the command-line option. XX:+UseSerialGC - Serial collector XX:+UseParallelGC - Parallel collector
  • 29. Thread Priority Changes Java threads and Native threads to compete on equal footing. Java threads at NORM_PRIORITY can now compete as expected with native threads. Java priorities in the range [10...5] are all mapped to the highest possible TS (timeshare) or IA (interactive) priority. Priorities in the range [1..4] are mapped to correspondingly lower native TS or IA priorities
  • 30. High-Precision Timing Support System.nanoTime() method added. Provides access to nanosecond granularity time source for relative time measurements. The actual precision of the time value returned is platform dependant.
  • 31. New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
  • 32. Performance Enhancements Garbage collection Ergonomics StringBuilder Class Java 2D Technology Image I/O
  • 33. Garbage collection Ergonomics Automatic detection of Sever-Class Machine Using Client / Server VM accordingly. Parallel Garbage Collection Default parallel garbage collection on Server VM.
  • 34. StringBuilder Class Introduced a new class java.lang.StringBuilder. It is like unsunchronized StringBuffer. Faster than StringBuffer.
  • 35. Java 2D Technology Improved acceleration for Buffered Image Objects Support for H/W accelerated rendering using OpenGL. Improved text-rendering performance.
  • 36. Image I/O Improved Performance and memory usage while reading and writing JPEG Images. In mage I/O API ( javax.imageio ) added support for reading and writing BMP and WBMP images.
  • 37. New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
  • 38. Base Libraries Lang and Util Packages Networking JAXP Bit Manipulation Operations
  • 39. Lang and Util Packages ProcesBuilder More convenient way to invoke sub processes than Runtime.exec Formatter printf style format strings. Support for layout justification and alignment, common formats for numeric, string and date/time data. Scanner Converts text into primitives or Strings. regular expression based searches on streams, file data, strings.
  • 40. Lang and Util Packages contd… Instrumentation New package java.land.instrument , allows java programming agents to instrument programs running on the Java virtual machine by modifying methods' bytecodes at runtime Threads getState() for querying the execution state of a thread. getStackTrace to obtain stack trace of a thread. A new form of the sleep() method is provided which allows for sleep times smaller than one millisecond.
  • 41. Networking Complete support for IPv6 on Windows XP (sp1) and 2003. ping like feature – InetAddress class provides API to test the reachability of a host. Improved Cookie support. Proxy Sever Configuration – ProxySelector API provides dynamic proxy configuration.
  • 42. JAXP 1.3 A built-in validation processor for XML Schema. XSLTC, the fast, compiling transformer, which is now the default engine for XSLT processing. Java-Centric XPath APIs in javax.xml.xpath , which provide a more java-friendly way to use an XPath expression . Grammar pre-parsing and caching, which has a major impact on performance for high-volume XML processing.
  • 43. Bit Manipulation Operations The wrapper classes (Integer, Long, Short, Byte, and Char) now support common bit manipulation operations like highestOneBit, lowestOneBit, numberOfLeadingZeros, numberOfTrailingZeros, bitCount, rotateLeft, rotateRight, reverse, signum, and reverseBytes.
  • 44. New Features in J2SE 5.0 Language Features Virtual Machine Features Performance Enhancements Base Libraries Integration Libraries
  • 45. Integration Libraries Remote Method Invocation (RMI) Java Database Connectivity (JDBC) Java Naming and Directory Interface (JNDI)
  • 46. Remote Method Invocation (RMI) Dynamic Generation of Stub Classes Generation of stub at runtime eliminated the need of stub compiler rmic . Standard SSL/TLS Socket Factory Classes Standard Java RMI socket factory classes, javax.rmi.ssl.SslRMIClientSocketFactory and javax.rmi.ssl.SslRMIServerSocketFactory added. Communicate over the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocols using the Java Secure Socket Extension (JSSE).
  • 47. Java Database Connectivity (JDBC) RowSet interface has been implemented in five common ways a RowSet object can be used. JdbcRowSet - used to encapsulate a result set or a driver. CachedRowSet - disconnects from its data source and operates independently except when it is getting data from the data source or writing modified data back to the data source. FilteredRowSet - extends CachedRowSet and is used to get a subset of data. JoinRowSet - extends CachedRowSet and is used to get an SQL JOIN of data from multiple RowSet objects. WebRowSet - extends CachedRowSet and is used for XML data.
  • 48. Java Naming and Directory Interface (JNDI) Enhancements to javax.naming.NameClassPair to access the fullname from the directory/naming service. Support for standard LDAP controls: Manage Referral Control, Paged Results Control and Sort Control. Support for manipulation of LDAP names.
  • 49. Q & A Tiger