Search

Notes from a Java 5.0 Presentation

Java 1.4.1

  • the focus was on quality
  • more than 2000 bug fixes
  • Garbage Collection(GC) Mark sweep and parallel going space
Java 1.4.2

Java 5.0
  • Community Development
  • 15 JSRs
  • Bug fixes
  • Performance
  • JMX, Decimal Arithmetic, Generic types...
Tiger(Java 5.0) Themes
  • Quality
  • Performance
  • Monitoring
  • Desktop Client
  • Easy development
Quality
  • Tighter control
  • Bug fixes
  • Compatibility
  • Reliability
  • Scalability
  • Big Heap support- Concurrent and Parallel GC
  • Hotspot virtual support
  • Chipset optimizations
  • AMD4 native compilers
  • Hyper Threading
  • Faster startup: Especially desktop apps-AWT, Swing
Class Data Sharing
  • Generated at install time'
  • Originally developed on Apple
  • Minimum memory footprint
  • Reduced startup time
Performance
  • Less reliance on command line tools
  • More support for Adaptive fine tuning
  • Tools: Jstat,Jvmstat
  • (In 1.4.2)2 different compilers: Client and Server
  • (in 1.4.2)Hot Spot client-default
  • In 5.0 Good out of box performace without fine tuning.
Server
  • Parallel GC
  • Server Hot Spot VM
  • Max heap 1/4, Max Memory 1.6
  • Initial heap 1/64 Max mem or max heap
Client
  • Minimum heap,
  • Serial GC,
  • Client Compiler
  • Visual GC - Graphical view of VM
Monitoring Manageability JSR 1.4
  • Low memory detection
  • Allow access of internal VM status
  • Heap size, GC info, Threads, etc
  • SNMP, JMX based
  • Plugs into JMX console
  • JMX Api JSR003
  • MBean Server part of JMX
  • Easy to configure
Profiling JSR 163
  • Improved performance analysis
  • JVMTI replaces JVMPi
  • Bytecode instrumentation
  • HProf updated to JVMPi

Improved Diagnostic Ability
  • Static trace Api
  • Fatal error handler
  • Start JVM with OnError Options
  • Java debug interface SA Connector
  • Attach connector to code file
Desktop
  • Java Webstart- Unified Console plugin and console
  • Continued quality and performance
  • Gnome skins
  • Synth Skinnable API
  • Ocean
Easy Development
  • Concurrent Library (JSR 166)- Dough LEA
  • XML, Webservices support
  • Language Changes.
  • Locking API, Higher level abstractions
    • Atomic variables
    • Thread executors and pools

JSR 206 JAXP 1.3
Java Web Services Standards
  • XML 1.1 and namespace
  • XML Schema
  • DOM, SAX
  • JAXRPC
  • SAAJ
  • JAXB
  • XML Security
    • Encryption and Digital Signatures
  • JAXR

Language Changes
  • Generics
  • Loop- For Each
  • Autoboxing/unboxing
  • Typesafe enums-Complie time
  • Varargs
  • Static imports
  • METADATA
  • easy to code
  • Simpler to Visualize, Readable
  • Minimize compatibility Issues
Generics
  • Abstract over types
  • Casting is a pain
  • Casting is unsafe
  • Casting may fail at runtime
  • Nice to Tell compiler type of Casting
  • Signature changes
  • List{
void add(E,x)
List mylist;
Copy (List dest, List src)
}
Generics vs Template
  • Generics- type checked
  • Generics-coded once and for all
  • Generics-no code bloating
  • Generic code not exposed to user
  • No hideous complexity
  • Common cut and paste error
Enhanced For loop
  • Painful iteration over collector
  • Iterators are error prone.
  • for (Object o:c)
    {
    ((TimerTask)o)Cancel();
    }
  • Cleaner, safer shorter
  • no iterator related clutter
  • Eliminates array index
  • nested iterators are tricky

  • Autoboxing/Unboxing
  • Cannot put an Integer in a collection
  • Must use Integer
  • Pain to convert back and forth
  • It would be nice if the compiler did it.
  • Map m =new TreeMap();

    Typesafe Enum Pattern
    Consider:
    int enum pattern
    public static final int SEASON_WINTER=1


  • Not type safe
  • No namespace, must prefix constants
  • Typesafe Enum pattern- Compiler supported


  • enum color("blue", "green", "red");
  • Use in switch

  • enum Suit ("club", "Spade", "Diamond", "Heart");
    enum rank("ace","two"..):
    for (Suit suit:Suit.Values)
    for(Rank rank: Rank.Values)

    VArgs
  • Methods with VArgs:Var
  • Must use array
  • Methods like printf

  • public static String format(pattern, Objects ...arguments);


    Static Imports
  • Classes import constants
  • Interface abuse
  • Analogous to package imports
  • Imports static members from a List
  • import static org.iso.Physics.*

  • Works with Enums

  • import static ...enum.*


    Metadata
  • Annotate code
  • Maintain side files
  • Function in EJBs occurs 5 times

  • import javax.xml.rpc.*
    public class CoffeeOrder{

    @remote public coffee[] getPriceList(){
    }
    }
  • Compatible

  • JAXRPC
  • EJB 3.0

  • Tiger rectifies collisions
  • New language to rectify collisions
  • Websites

  • java.sun.com/j2se/5.0
  • jcp.org/en/jsp/detail?id176
  • java.sun.com/features/2003/05/bloc-qu.html
  • blog comments powered by Disqus