Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

JavaOne 2003 Notes

Summary/Highlights

Contents

Status and Release Schedule

J2SE

1.4.1 "Hopper" +2000 bug fixes, better GC

1.4.2 "Mantis" (June 2003) desktop client performance. Another 2000 bug fixes.Windows XP, Linux GTK Look and Feel improvements, Itanium CPU support, server GC. Swing performance improvments about 50% over 1.3.1. performance increases esp on Linux/X86. startup times 15-30% faster. Auto-update for JRE delayed until 1.4.2.x. PACK compression - reduce jar download time. Web Start fully integrated into JRE. (1.2 release candidate now available at http://java.sun.com/j2se/1.4.2/index.html is cobundled with NetBeans 3.5)

1.5 "Tiger" summer 2004. beta available end of 2003.

1.5.1 early 2005

1.6 "Mustang" early 2006

J2EE

J2EE 1.4 delayed for final Web Services Interoperability (WS-I) specification 2003 4Q

Mac OS X

J2SE 1.5 (Tiger) Summer 2004 release

Focus on "ease of development". Java is strong in enterprise (server) and devices (cell phones), still dont have the desktop. Target smaller "departmental applications" currently being written in Visual Basic."Got enough power, now focus on simplicity". "We've been over focused on tools - we need good clean platform APIs". There will still be new features, performance, quality emphasis, but all are "under control". Focus will be on developer productivity, ease of use.

Language Changes

First significant language changes since 1.1 (inner classes). All features (except metadata) are available
in early access 1.5 compiler: http://developer.java.sun.com/developer/earlyAccess/adding_generics

  1. Metadata

    Key new language idea, allows decoration of classes/methods/field. Allows simpler declarative programming, Will be used to simplify J2EE APIs
    public @debug mymethod;

    We already have "marker" conventions that cause special processing from tools / runtime libraries, for example:

      • get/setProperty javabean conventions.
      • EJB naming conventions
      • marker interfaces like serializable
      • javadoc @param etc

    We have already stretched the naming conventions too far. Metadata will now be part of the Java language. A kind of declarative programming. "Eliminate boilerplate"

           @Secure
           @Copyright(name = "Blake Stone")
           public class BankAccount {
            @NeedsTesting
            @Security(level = 12)
            public float getBalance() {
            // etc.
            }
           }
    
    		public @interface Copyright {
             String name();
           }

     

  2. Generics

    Modifies the type system - mostly transparent. Allows compiler to type check, eliminate explicit type casts. Not templates, no code blowup.

    ArrayList<String> // list of strings
      add(Object) becomes add(String)
    get(int) returns String values
    toArray() returns a String[]


    how to declare:

    class Container<T> {
    private T value;
    public void set(T value) { this.value = value; }
    public T get() { return value; }
    }

    some complications around "Variance" TBD

  3.  

  4. Collection Iterators "foreach"

    expand meaning of "for" : (read ":" as "in" )

     for (String s : c) { process (s); }
    
    

    combine with generics:

    
     void cancelAll(Collection<TimerTask> c) {
    for (TimerTask task : c)
    task.cancel();
    }

    works with arrays:

    
    int sum(int[] a) {
    int result = 0;
    for (int e : a)
    result += e;
    return result;
    }
  5. Enumerated types

    public enum Coin { head, tails }
  6. equivilent to type-safe enum in Bloch's book, but compiler does the boilerplate for you. can be used in switch statement. enum is now a keyword.

  7. Autoboxing of primitives.

            Integer x = 3;  // x = new Integer(3);
            int y = x;      // y = x.value();
  8. Varargs

    Variable length arguments, needed for printf formating

    public static String format(String pattern, Object... arguments), Object... same as Object[], compiler gathers up arguments into an array.

    allow C/C++ format string, fullly type safe at runtime.

       out.printf(“%.4s %5d\n”, user,total);
  9. Static import

    import static org.iso.Physics.*;
  10. Imports the static members from a class, rather than the classes from a package. Can now use:

    x = cos(PI * theta);
    x = Math.cos(Math.PI * theta); // old way
    

Other features

Component JSRs:

J2EE

J2EE is a $2.1 Billion market in 2001. 31 Commercial Licensees (Spring 2003). Main value vs .NET is portability

J2EE 1.4 Release

J2EE 1.5

Focus on ease of development, esp using metadata.

private @createEJB Foo myFoo;

Misc

Scripting Language Support

JSR 223 will specify how scripting languages are used in web tier (J2EE apps), how they interact with War / ear files. PHP will be key focus, refrence implementation will use Tomcat and PHP. "Java is upgrade path from PHP". Others include VBScript, Javascipt, perl, JPython.

Web Services Developer Pack (WSDP)

WSDP 1.2 shipped. based on Tomcat 4.1

Concurrency Utilities

This is Doug Lea's work refactored through JSR 166. java.util.concurrent. "The java.util.concurrent package aims to do for concurrency what java.util. collections did for data structures." Looks to me like you will want to replace your multithreading code with these classes..

  1. Executor - standard interface for asynch invocation; cancellation and shutdown support. use anExecutor.execute(aRunnable) instead of new Thread(aRunnable).start(). New interface Callable like Runnable but returns an Object. Future holds result of asynchronous call. Use via Executors utility class.
  2. Queue interface added to java.util. Fast thread-safe non-blocking java.util.concurrent.LinkedQueue. BlockingQueue extends Queue, common in producer-consumer designs, implementation is high throughput, concurrent access.
  3. TimeUnit class provides high resolution timing support static long nanoTime().
  4. Lock class replaces synchronized: more flexible but more verbose. uses low level hardware instructions for fast, scalable locking, doesnt use Java locks.. allow interrupts, allow lock/unlock in different places, allow "try lock".
  5. ReadWriteLock provides a pair of locks for enforcing multiple-reader, single-writer access. Concrete class ReentrantReadWriteLock usually the best choice for apps.
  6. Condition is an abstraction of wait-and-notify, for classic concurrency patterns.
  7. Synchronizers: common special-purpose synchronization problems: Semaphore, FifoSemaphore, CountDownLatch, CyclicBarrier, Exchanger.
  8. Atomics: Essential for writing efficient code on MPs. Nonblocking data structures, optimistic algorithms, reducing overhead and contention when updates center on a single field. JVM implementation will use best construct available on platform, eg: Compare-and-swap, Load-linked/StoreConditional, Locks.
  9. Concurrent Collection implementations: ConcurrentHashMap, CopyOnWriteArrayList.
  10. Improvements to existing thread-safe collections in part based on JSR-133 Memory Model rules

Desktop

Desktop Initiative

Desktop Java is booming. It’s a strategic priority for Sun."The market is shifting: Desktop Java technology is the right answer for an increasing number of development problems. Sun is betting on this trend and is committed to leading development of the Java desktop platform."

Swing Tips

Synth Skinnable L&F

XAWT (Tiger) for Linus and Solaris

Advanced OpenGL for Java : Jogl

 

Java Server Faces (JSF)

Server side user interface component framework It appears that this will become the main focus of Web UI frameworks in Java. Presenter (Craig McClanahan) was the main developer of Struts, claims JSF will become the standard API for web-based UI components, and that JSF will be more powerful and will supercede Struts within 6-12 months. Announced tool support from Oracle, Borland, as well as Sun's "Project Rave". can be used with/without JSP, with/without HTML.Allows business/presentation logic to be decoupled from output format.

Another session presented JSF in conjuction with Scaleable Vector Graphics (SVG).

Project Rave is a new Sun web development tool using JSF.

IO

NIO

Writing a Scaleable Server with NIO

Advanced Network IO

2 levels of abstraction in java.net: High level: URLs; Low level: Sockets

Combining Jini/Jxta

Deployment

Install-on-demand & auto-update

Java Webstart & Java Plug-in

Webstart Tips

Applets

Web Services

Fast Web Services

REST vs Web Services Architecture

There has been a lot of online debate concerning two ideas of how to do web services. REST (representational state transfer) is based on Roy Fielding's PhD thesis that essentially models the way HTTP was used in the early days of the web, which is arguably responsible for the web's success. In REST, all services are available only though a URI. There are many nouns (URIs) but only 4 verbs: GET, PUT, POST, and DELETE. Clients only know the data representation of the service, and clients manage their own sessions. All services are stateless, all messages are self descriptive. So a web service is just the exchange of XML documents using HTTP verbs: "document-centric". The simplicity of the verbs makes interoperability easier. Down side: client must manage state, so pushes complexity onto the client.

In contrast, the current Web Services Architecture (aka GXA) developed by Microsoft and IBM, uses SOAP, WSDL, and UDDI. There is a SOAP message definition for every service end point, and WSDL defines a collection of end points. UDDI is used for finding services. WSA is trying to add a lot more functionality such as security, authentication, and transactional processing. Its essentially trying to enable RPC across the firewall. Currently WSA has center stage. Down side: tight coupling between client and server : when the WSDL changes, you have to synchronize software updates (think RPC). The alternative is dynamic code generation and binding, which is still developing. May not scale to services with large number of endpoints.

So REST is simpler data-centric, better for simple services. WSA provides a framework for more capabilities like security, at the cost of more complexity, loss of scaleability, difficulty in upgrading to new versions.

Orchestration

Web Services can be thought of as a "way to exploit port 80", ie circumvent firewalls.

Working definitions:

Theoretical frameworks:

In WSDL, services are unordered message exchanges. No coreography, no collaboration, no orchestration. Too simple, everyone wants to fix.

Grid Computing

More Grid Computing

Performance

Platform Performance

Benchmarking

Performance Myths

Cliff Click, HotSpot server compiler architect. Generally these are performance "tricks", that may have once been useful, but now the JIT compiiler can do a better job.

Future:

Tips from Blake Stone (Borland)

  1. delayed object creation / processing. "be lazy - avoiding work is a huge win".
  2. eliminate redundancy - often UI event processing gets 2 events. need profiling to detect. event coalescing - always use deferred repainting. combine network round trips. cache font metrics, etc.
  3. code reuse: use collections, StringBuffer. HashMap is overkill for a handful of values.
  4. watch your heap - GC does not eliminate memory leaks.Full GC scales linearly with heap size, user perception is exponential. Java VM grinds to a halt when swapping. dont worry about short lived object, dont need object pools very often.
  5. Caches are a pain. memory leaks, out of date data.Only useful when content requires network IO or extensive disk IO. Check hashcode key distribution, avoid keys with external object references. Weak references and timestamps are useful.
  6. progress requires measurement

Swing/2D Graphics performance

Monitoring and Management

JMX Java Management Extension

Performance Monitoring

Monitoring: observe production application with minimally intrusive tools.

"Visual GC" jvmstat tool, you can get it via: http://www.sun.com/developers/coolstuff. Currently works only with 1.4.1, will have a 1.4.2 version by end of July.

XML

XML Parsing

  1. DOM
  2. SAX
  3. Streaming API for XML (StAX); JSR-173 will have the final draft soon http://www.jcp.org/en/jsr/detail?id=173

JAX-RPC

UBL

Miscellaneous

 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690