Day 1 was primarily scripting, day 2 hardcore java. Days 3 and 4 saw sessions on the entire gamut of Java technologies - from garbage collection to mashups. I discuss some of them here.
Blueprints for Mashups
This was arguably the most informative session for me by far at this year's JavaOne. Kudos to Greg, Mark and Sean for putting together a to-the-point, practical and readily-usable session together. Personally, this session validated the REST and JSON concepts I had gathered over the past few months. I'll recommend this session to anybody interested in building mashups, REST services, AJAX and a whole lot more. (No, they haven't paid me to say this.)
- Server-side proxy: Clients always send requests to the server that is hosting the page. The server in turn acts as a proxy, sends your request to the (remote) mashup service and returns the data it gets from the mashup service to you.
- Dynamic script tags: Browsers allow script tags to communicate with cross domain servers. This opens up the opportunity for you to issue requests to any mashup service by generating dynamic script tags.
Various options are available for securing your REST services:
- User tokens
- Session based hash
- URL based API key
- Authentication headers
- Use namespaces
- Use CSS for applying styles
- Setting the
innerHTMLproperty is easier / better than DOM manipulation
- A server-side service
- A client-side CSS for applying styles
- Document the API
- Create simple examples enabling a simple cut-and-paste approach to learning your API
If there was one objective of this session, it was to clear the GC myths out there. Some of the finest Java minds were refuting the urban legends out there and when they talk you listen:
- Object allocation is cheap. Reclaiming young objects is also cheap.
- Small, short-lived immutable objects are good. Large, long-lived mutable objects are bad.
- Nulling references rarely helps - except when it comes to arrays.
- Avoid finalizers - in most cases there are better alternatives possible.
System.gc()- except between well-defined application phases and when the load on your system is low.
- Object pooling is not required in today's VMs. It is a legacy of older VMs. Exceptions are objects that are expensive to allocate / initialize or objects that represent scarce resources.
- Consider using reference-objects for limited interactivity with the garbage collector.
Certain memory-leak pitfalls:
- Objects in wrong scope
- Lapsed listeners
- Metadata mismanagement
They strongly advocated FindBugs for finding such pitfalls as well as other potential bugs.