Thứ Hai, 3 tháng 10, 2011

JavaOne 2011: JVM Bytecode for Dummies

Charles Nutter's "JVM Bytecode for Dummies (and for the rest of you, as well)" was the last technical session for me early Monday evening. It was held in the Hilton San Francisco Yosemite Ballroom A/B/C. Ten to twenty percent of the audience responded affirmatively when Nutter asked who had done something with bytecode. Nutter stated that he's been working full time on JRuby for nearly five years and has had to work closely with JVM bytecode in this role. He stated that this particular presentation is really one of two parts at JavaOne 2011, though he has presented both as a single presentation previously.. Today's presentation is how to inspect it, how to generate it, and how it works. His other presentation will go even deeper into the bytecode. The room was packaged, so it seems that this is definitely a popular topic.

Nutter's "Bytecode Definition" consists of two bullets from Wikipedia. He provided a more detailed slide on "Byte Code," which is a one-byte instruction with 256 possible "opcodes" available (and about 200 used currently). Microsoft's CLR is another example, but it has two-byte "Wordcodes" and operations that are similar to the JVM.

Nutter stated that learning bytecode is useful for better understanding the platform and (his words) "it's fun to play with." From a more practical perspective, Nutter pointed out that there may come a day when a developer needs to read bytecode (rather than doing it just for fun). A fourth and less practical purpose is to write one's own JVM language.

Nutter showed a slide with Java's "Hello World" (which he called "the longest 'Hello World' in the world"). He then discussed javap and some of its options before showing different byte code representations produced by javap with different options.

Another option that Nutter talked about to emit byte codes was use of ASM to manipulate Java bytecode. Nutter also talked about BiteScript ["a (J)Ruby DSL for emitting JVM bytecode"] and Mirah. For developers who want only Java dependency, Nutter introduced JiteScript. Nutter had slides on the JVM Stack, basic operations, stack operations, stack juggling, typed opcodes, constant values, local variable tables, arrays, math operations, conversions, flow control, classes/types, invokedynamic, and exceptions and synchronization.

There were several bits of bytecode wisdom that Nutter told us about that I want to list. Nutter said that booleans in bytecode are treated simply as integers (reminds me of my C/C++ days!). Similarly, boolean and bitwise operators act as if on ints. Indeed, Nutter stated that integers get special treatment in Java bytecode. He also explained that 64-bit values require two slots. Instance methods have "this" at zero in the local variable tables. The "iinc" variable is what is produced from i++, but takes two arguments)! One is which one to increment and one is by how much. Nutter also showed that Java does have a GOTO at the bytecode level! Nutter noted that signatures of classes and types is probably the most difficult part.

Nutter showed an example of Fibonacci in byte code with BiteScript syntax before moving onto real-world cases using bytecode manipulation. He specifically mentioned JRuby, Groovy, Hibernate, java.lang.reflect.Proxy. He reviewed his tools including BiteScript, JiteScript, and ASM that backs both of them up. He then previewed his part 2 including tracking JVM bytecode and analyzing performance of JVM bytecode. It is scheduled for 10 am on Wednesday in this same room (Hilton Yosemite A/B/C).

The version of this presentation Nutter presented at OSCON 2011 is available on SlideShare. It appears to be very similar to the version he presented at OSCON 2011 (in fact, I found it helpful to look at it while listening to his presentation because it was hard to see the bottom of the screens in that room), but the JavaOne version adds slides on invokedynamic. Nutter made some simple but highly effective animations on many of his slides, so I highly recommend accessing this online version of the slides. Nutter also stated that you can paste the code in these animated slides into a BiteScript file and run it. One thing to note is that the OSCON version of slides has 209 slides (many exist because of "almost duplicate" slides used in "animation"), so it is evidently inclusive of both parts that Nutter mentioned at the beginning.

I believe that Nutter achieved his stated goal of presenting Java bytecode in an approachable manner. His slides are a great (and rare) combination of being useful for real-time presentation and useful as reference material. The "animation" (duplicate slides with changed/new/removed values) certainly took significant investment of his time, but the result is extremely helpful. Nutter mixes tables with reference material on codes and their meanings with animated charts showing samples of those in action. This is definitely a presentation to use to learn and to reference when trying to understand Java bytecode better. Even with Nutter splitting his overall presentation into two parts, this one (of two) parts was still loaded with details. It felt like I was drinking from a fire hose (and, for me, that's a good thing!). It wasn't an easy presentation to end the day with (no being lazy and checking out here), but Nutter's dynamic and energetic style helped keep the energy level reasonable. I even started to wonder if this possibly might be just a little "fun" after all?

JavaOne 2011: Moving to the Client - JavaFX and HTML5

Stephen Chin (Chief Agile Methodologist at GXS) and Kevin Nilson (Just Me VP of Engineering) presented "Moving to the Client - JavaFX and HTML5" (22122) in Nikko Ballroom in Hotel Nikko on mid-afternoon Monday of JavaOne 2011. This was another well-attended session in a relatively large room, which is not too surprising when its title contains one of the most popular topics in recent JavaOne conferences (JavaFX) and one of the trendiest topics in all of software development (HTML5).

After both speakers introduced themselves, Kevin Nilson went into the "History of the Web" and the road to HTML5. He showed a slide with "Tableless Web Design" in 2002, Ajax in 2005, and HTML5 in 2009. Nilson contrasted Web Hypertext Application Technology Working Group (WHATWG) with Java's Java Community Process (JCP).

Nilson said that HTML5 is not simply HTML + CSS + JavaScript. He instead calls HTML5 the "next generation features for modern web development." He also outlined some specific HTML features such as web storage, HTML5 Geolocation API, and so forth.

Nilson dove deeper into HTML5 examples by starting with rounded corners. Images are no longer necessary to present rounded corners. Nilson then moved onto WebGL (OpenGL in the web browser), which is an extension of HTML5's canvas.

Nilson talked about "Prefixes" which are useful "before the spec is final" and "before the browser implementation is verified." Nilson talked about one of my pet peeves of HTML and related technologies: lack of standardization in implementation. Nilson pointed out that we've had to use JavaScript frameworks such as jQuery, Dojo, and YUI to have a consistent API. The hope is that HTML5 will bring standardization without frameworks. Nilson talked about the Acid Test which states how many requirements out of 100 a particular browser satisfies.

Nilson showed a snippet of code using JQuery which is available at http://jsfiddle.net/3urR9/. The jsFiddle tool that Nilson used to demonstrate this is an interesting tool for playing with JavaScript in an online environment. Nilson also introduced Chrome Frame for running Chrome within IE6, IE7, and IE8. It is designed so that administrative privileges are not required to install it. Nilson also referenced Modernizr, a tool I discussed in my post Modernizr: A Handy HTML5 Tool.

Stephen Chin spoke about JavaFX 2.0 GA being released today. Because JavaFX now uses Java rather than its own scripting language, the dominant Java IDEs support JavaFX. Similarly, Java developers can "leverage [their] Java skills with modern JavaFX APIs." Nilson added commentary on an iPhone app he wrote called Indalo. Nilson talked about Titanium which allows writing of application in JavaScript that is converted to iPhone or Android for runtime. Nilson also referenced Adobe's purchase of Nitobi and their PhoneGap, which is similar to Titanium.

Chin introduced WebView for embedding web content within JavaFX. He also spoke about the ability to use JavaFX with other JVM languages such as Groovy and Scala. Chin and Nilson made the important point that JavaFX can call the browser, but the browser cannot call JavaFX. Although JavaScript cannot call back to JavaFX code directly, you can "hack" a work-around to use status to communicate back from JavaScript to JavaFX.

I have had trouble with the Wifi for most of the conference so far. I thought it might just be me, but I heard other attendees talking about problems and it was definitely an issue in this presentation as both Nilson and Chin had examples that relied on web connectivity, of which they had none. All of this confirms the wisdom in reactivating and bringing my Verizon Prepaid Wireless Broadband to the conference. It was also nice to have my Droid on hand for getting around the city and for web connectivity. Chin used NetBeans IDE 7.1 beta for showing JavaFX code and he stated that he also used today's released JavaFX 2.0 GA.

The slides of a previous version of this presentation are available on SlideShare.

JavaOne 2011: Project Lambda: To Multicore and Beyond

The presentation "Project Lambda: To Multicore and Beyond" (Session 27400 and not to be confused with Brian Goetz's presentation of the same name) was given in the Hilton San Francisco Grand Ballroom B in the early afternoon on Monday at JavaOne 2011. Even with Grand Ballroom A closed off, this is an extremely large venue for a non-keynote session and there is a large camera (with camera operator) poised to film the presentation. This can probably be construed to mean that the conference organizers anticipated huge interest in coverage of Java SE 8 (JSR 337) and Project Lambda. Alex Buckley (Specification Lead for Java Language and Virtual Machine) and Daniel Smith (Project Lambda Specification Lead) were the presenters and their abstract for this presentation is shown next.

This session covers the primary new language features for Java SE 8 - lambda expressions, method references, and extension methods - and explores how existing as well as future libraries will be able to take advantage of them to make client code simultaneously more performant and less error-prone.

A functional interface is "an interface with one method." A lambda expression is "a way to create an implementation of a functional interface." Lambda expression allows "meat" of functionality to be simply and concisely expressed, especially when compared to the bloat of an anonymous class. Several slides included code examples showing how we'd do it today versus the more succinct representation supported by lambda expressions.

Lambda expressions "can refer to any effectively final variables in the enclosing scope." This means that the final keyword is not required, but rather than it needed to be treated as final (reference not assigned) in the method to be referenced by lambda expression. Some more rules of lambda expressions were announced: the this pointer references enclosing object rather than lambda expression. There is "no need for parameter types in a lambda expression" because they are "inferred based on the functional interface's method signature" (no dynamic typing necessary). Method references support the "reuse" of "a method as a lambda expression."

Buckley talked about external iteration as the current predominate approach in Java libraries. In this idiom, the "client determines iteration" and is "not thread-safe." He talked about disadvantages of introduction of a parallel for loop for solving this issue, but extracted some concepts from the parallel for approach: a "filter" and a "reducer." Buckley introduced the idea that "internal iteration facilitates parallel idioms" because it does not need to be performed serially and is thread-safe.

One of the issues Java 8 faces is the need to retrofit libraries to use lambda expressions, but they already have defined interfaces heavily used in the libraries and collections. One approach that might be used to deal with this issue is the use of static extension methods in Java similar to those available in C#. There are numerous advantages to this approach, but there are also some major disadvantages such as not being able to use reflection. The decision was made to revisit the "rule" that one "can't add an operation to an interface." Based on thism the subsequent decision was made to add virtual extension methods which provide default implementation in the interface that is used only when the receiver class does not override the method with a default implementation.

The slide titled "Are you adding multiple inheritance to Java?!" stated that "Java always had multiple inheritance of types" and "now has multiple inheritance of behavior," but still does not support "multiple inheritance of state, which causes most problems." The slide added that "multiple inheritance of behavior is fairly benign" and is really a problem only when compilation occurs in multiple steps. It was emphasized in this presentation that extension methods are a language feature and a virtual machine feature ("everything else about inheritance and invocation is a VM feature!"). As part of this, a bullet stated, "invokeinterface will disambiguate multiple behaviors if necessary." The non-Java JVM languages can "share the wealth" of extension methods and there was a slide providing three examples of this.

Daniel Smith took over the presentation with the topic of parallel libraries. He showed a slide "Behold the New Iterable" which showed an Iterable interface with methods such as isEmpty(), forEach, filter, map, reduce, and into. He also showed a slide on a Parallelterable interface available from Iterable via extension method parallel().

Smith provided references to JSR 335, JSR 166, and Project Lambda as part of his slide on community contributions. He also cited four additional sessions at JavaOne 2011 regarding lambda expressions and closely related topics. Smith ended with a quote from Brian Goetz on Project Lambda:

...we believe the best thing we can do for Java developers is to give them a gentle push towards a more functional style of programming. We're not going to turn Java into Haskell, nor even into Scala. But the direction is clear.
Conclusion

Smith's examples made it clear that lambda expressions will provide tremendous benefits to Java developers in their daily tasks. He showed the types of loops we've all had to write many hundreds or thousands of times and the cleaner, more concise syntax that lambda expressions make possible. This presentation has made it clear that, with the introduction of lambda expressions, Java will gain many of the benefits enjoyed by dynamically typed languages in terms of fluency and conciseness.

JavaOne 2011: Extending Java's Reach with Groovy: Seven Scenarios

Dierk Koenig's presentation "Extending Java's Reach with Groovy: Seven Scenarios" was held in Market Street conference room in Parc 55 Hotel on late Monday morning and was a well-attended session. Koenig used IntelliJ IDEA for several of his demonstrations and showed off its ability to provide method completion for Groovy objects. Although Koenig's presentation was not intended as an introduction to Groovy, he did provide some introductory details in the course of his presentation. Between one quarter and one half of the audience raised their hand when asked if they used Groovy regularly.

Koenig started by stating something that I happen to agree with: he said that Groovy allows Java developers to take advantage of their Java knowledge in some situations in which Java might not normally be well suited. He also started by saying a recording of this presentation would be made available. He then dove into the seven scenarios covered in this presentation:

  1. Super Glue
  2. Liquid Heart
  3. Lipstick
  4. Keyhole Surgery
  5. Unlimited Openness
  6. Ghost Writer
  7. House Elf
Super Glue

The "Super Glue" category refers to using Groovy as "glue" between "existing [Java] building blocks." Groovy makes use of the countless Java libraries and frameworks. Koenig provided an example of this that uses "Java awesome XML parsing" with not-so-great API. For this example, Koenig referenced groovy.blogs() and showed a single-line of Groovy that scraped the HTML from that source (see #6 of my Groovy one-liners for an example of this and Minimalistic HTTP Clients with Groovy for a more detailed example). Koenig expanded the single line into a simple 12-line script using SwingBuilder to build up a Swing-based table with the content from the HTML-based blog. This showed off Groovy's AST Transformations functionality.

Liquid Heart

This category describes Groovy usefulness when proven business logic is implemented in Java. Koenig's example showed implementing calculation of employee bonuses in Groovy code and then invoking that Groovy code from within a Java application using Binding and GroovyShell.

Lipstick

This category involves putting a thin veneer of Groovy on top of existing Java applications. It increases code fluency and converts traditional APIs to DSL ease of use. Koenig showed an example that cannot be performed directly in Java even with bytecode manipulation. The example showed off several more features of Groovy including TupleConstructor.

Keyhole Surgery

This category involves using Groovy to be minimally invasive. Koenig's example showed using the GDK-provided findAll(Closure) to filter out negative prices in a shopping cart.

Unlimited Openness

Every line of code might be changed. This category incorporates "lessons of Perl, PHP, and Python" and perhaps the best summary is the bullet "Allow for easily changing the code without tedious setup for compilation and deployment."

Ghost Writer

Ghost Writer describes functionality available since Groovy 1.8 for "code generation without source code generation." The feature allows production of byte code for which there is no corresponding source code. I have blogged on some of these in previous posts such as Groovy 1.8 Transformations: @ToString, @EqualsAndHashCode, and @TupleConstructor and Groovy 1.8's @Canonical Transformation: Great Functionality, Less Code. Koenig's example focused on how much easier it is to use @Immutable without fear of doing it wrong and avoiding the verbosity required in Java. Koenig also referenced gcontracts in relation to this topic.

House Elf

This category is about "delegating the housework." Koenig described examples as senv, groovy install, and gradle and stated it might be used with Ant, Maven, AntBuilder, Gant, Gradle, Grails scaffolding, etc.

Other Observations

Koenig observed that the IDE provides details that the compiler does not provide when using Groovy. He stated, "You're not so much concerned if the compiler catches the error; you're concerned if the IDE catches the error."

Conclusion

Koenig's presentation demonstrated seven usage patterns that allow Java developers to supplement their Java work with Groovy. I find that my most common use of Groovy is as a scripting language in my Java development environment and so was not surprised to see many of the ways I use Groovy discussed in this presentation. However, Koenig presented a couple of ideas that are new to me and that I look forward to adding to my Java development toolbox. You can find Koenig's initial impressions of JavaOne 2011 in his post JavaOne 2011 Arrival on his blog.

JavaOne 2011: The Definitive Set of HotSpot Performance Command-line Options

Charlie Hunt (Oracle's Lead JVM Performance Engineer) presented "The Definitive Set of HotSpot Performance Command-line Options" (19820) in Yosemite A/B/C in the Hilton San Francisco on Monday morning. He introduced himself with description of his "12+ years of Java performance experience" and "20 years of (general) performance experience." He is also lead author of the just-published book Java Performance.

Hunt provided a slide categorizing command line options: data, memory, startup, latency, throughput, and "other." He stated that his presentation is structured around these groupings. He also said that there is no reason to use these options if the standard JVM configuration works satisfactorily for a given application. As the session's title explicitly states, this session is on HotSpot JVM Options.

Data

For collecting garbage collection data, Hunt prefers -XX:+PrintGCDetails. He says it is descriptive, but not intrusive. He stated that -XX:+PrintGCTimeStamps and -XX:+PrintGCDataStamps work well for offering a timestamp of a garbage collection event. Because the former is based on the beginning of the JVM and the latter is based on "wall clock," Hunt's general rule of thumb is that the longer running the application, the more likely that -XX:+PrintGCDataStamps will be preferred. -XX:+PrintReferenceGC is useful when employing reference objects. It therefore is most useful when using reference objects such as WeakReference and SoftReference.

Memory

Hunt introduced the memory command-line options with the "obvious" -Xmx and -Xms. I think few of us have the luxury of not using these two, but Hunt pointed out that some applications may not even need to set these. -XX:NewSize and -XX:MaxNewSize allow specification of the initial and maximum young generation sizes respectively. -Xmn allows specification of initial, maximum, and minimum young generation size. Hunt stated that -XX:NewRatio's biggest disadvantage is the difficulty in understanding ratios, but the advantage is knowing the ration between young generation and old generation is maintained. Hunt showed -XX:PermSize and -XX:MaxPermSize for initial and maximum perm generation sizes. -Xshare:on enables class data sharing, lowers footprint and startup time, and is available in Java 7 for -client or -server in conjunction with serial garbage collection.

Startup

Hunt discussed -client and -server for enabling the client and server JVM runtimes respectively. -XX:+TieredCompilation enables "JIT compilation policy" similar to that used for -client for rapid startup time commonly associated with -client with the advantages of running a -server JVM. It's the "best of both worlds." Hunt again referenced -Xshare:on in relation to startup performance.

Latency

Hunt showed a slide on throughput options -XX:+UseParallelOldGC/-XX:+UseParallelGC and suggested starting with these options first when tuning for latency. His recommendation is to "start with ParallelOld/Parallel GC first" and then "move to CS (or G1) if latency requirements are not met." -XX:ParallelGCThreads is used to specify number of parallel garbage collection threads to use.

-XX:+ParallelRefProcEnabled is available for all garbage collectors and "enables multithreaded reference processing," Hunt's recommendation is to "enable this option when -XX:+PrintReferenceGC output shows high Reference reclamation time." -XX:SoftRefLRUPolicyMSPerMB is an option Hunt said he has rarely seen needed in the past, but is starting to see people need. The option is useful for specifying the survival time of a soft reference "after last strong reference to the object has been collected" and smaller values mean more aggressive collection. Hunt cautioned that this last option is only useful in very specific situations.

-XX:+UseConcMarkSweepGC is option for enabling CMS ("enables a mostly concurrent old generation GC"). CMS is default garbage collector on Apple machines. -XX:+ParNewGC is automatically enabled when -XX:+UseConcMarkSweepGC is employed and thus does not need to be enabled explicitly. Hunt stated that tuning CMS is challenging when he showed the slide on -XX:CMSInitiatingOccupancyFraction and -XX:+UseCMSInitiatiingOccupancyOnly. The former is only used on the first CMS cycle while the latter specifies using it for all CMS cycles.

Hunt had a slide on -XX:+CMSClassUnloadingEnabled and -XX:+CMSPermGenSweepingEnabled. The latter is only necessary when using Java SE 6 Update 3 or earlier. Newer versions only need the first option. If the second option is used anyway in a new JDK, there is a message stating that it is not needed.

Hunt talked about -XX:+ScavengeBeforeFullGC even though it is the default setting in the HotSpot JVM and is applicable to all garbage collectors. His reasoning for including this is that he has seen many people explicitly disable this feature to not have young generation collected before old generation. Hunt talked about using -XX:+DisableExplicitGC to disable hints/calls to garbage collector via System.gc(). -XX:+ExplicitGCInvokeConcurrent and (preferred) -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses can be used when explicit garbage collection is used. -XX:ParallelCMSThreads specifies number of parallel CMS threads.

-XX:SurvivorRatio "sets the ratio of survivor space size to eden space size." -XX:TargetSurvivorRatio "sets the target survivor space occupancy to target after a minor garbage collection." Hunt says developers should error on the side of setting -XX:MaxTenuringThreshold "too high rather than too low" to "avoid a full GC." -XX:+PrintTenuringDistribution is "very useful in fine-tuning young gen's survivor space size for effective object aging."

-XX:+UseG1GC "enables the garbage first GC" and is available with later Java SE 6 releases and Java SE 7 as an experimental feature. Hunt's opinion is that it will eventually be supported in a later Java SE 7 release. Hunt "generally likes" what he is seeing using this garbage first garbage collector. -XX:MaxGCPauseMillis "sets a maximum pause time target for G1 GC."

Hunt talked about the concept of "JVM safepoint" when discussing the options -XX:+PrintGCApplicationStoppedTime and -XX:+PrintGCApplicationConcurrentTime. These two options "are useful for tracking down latency induced into the application as a result of JVM safepoint operations." -XX:+PrintSafePointStatistics provides details on safepoint events (which happened and when they happened) and produces the report when the JVM exits. Hunt generally discourages use of the CMS incremental options.

Throughput

-XX:UseAdaptiveSizePolicy and -XX:+PrintAdaptiveSizePolicy were the first two options Hunt covered in the "throughput" section. He also covered -XX:InitialSurviorRatio and -XX:TargetSurivorRatio (again).

Other

-XX::+UseCompressedOops,-XX:+UseLargePages, and -XX:LargePageSizeInBytes were covered in the "Other" section and all three options are applicable across the HotSpot garbage collectors. Large pages reduce TLB misses. -XX:+UseNUMA "enables a heap space allocation policy favorable for NUMA architectures." -XX:+AggressiveOpts "enables the most recent Java HotSpot VM optimizations" and is a supported option. Hunt recommends using it over -XX:AggressiveHeap. -XX:+UseBiasedLocking, -XX:+DoEscapeAnalysis, -XX:+AlwaysPreTouch,-XX:+PrintCommandLineFlags, and -XX:+PrintFlagsFinal were all also part of the "Other" secton. -XX:+PrintcommandLineFlags shows the ergonomically selected options for a JVM and -XX:+PrintFlagsFinal shows supported options used by default.

Conclusion

Hunt stated that his book has the "gory details" and includes the options summary in an appendix. There are many options available and some of them affect each other. In many ways, their use feels like something of a black art. I can see how a book might be useful in situations where every last ounce of performance needs to be squeezed out of the HotSpot VM.

JavaOne 2011: Opening (Technical) Keynote

JavaOne 2011 appears to be very well attended. The Hilton San Francisco Ballroom A/B is standing-room only for the JavaOne 2011 Technical (Opening) Keynote and they have announced the overflow rooms as the Imperial and Yosemite conference rooms. As I type this, we are being told that there is more space devoted to JavaOne this year (as compared to last year) and that there is increased attendance at JavaOne this year (again as compared to last year).

As we waited for the keynote to begin, the main screens showed slides touting the prevalence of Java and the 2011 Duke's Choice Awards winners. It was an interesting set of slides to pass the time reading. Latin America 2011 (December 6-8) and Tokyo 2012 (April 4-6) editions of JavaOne were announced.

Doug Fisher of Intel stated that Intel started using Java the year it came out. He talked about dedicating Intel resources to optimizing the JVM on Intel architectures. He spoke of the greatly increased footprint of Java that has occurred since those days. He credited those in attendance for this increased footprint. Doug introduced Intel and Oracle folks involved with optimizing the JVM on the Intel architecture and asked them to speak. The speakers from Intel and Oracle talked about how they collaborated together ("4 years of JVM Optimization") to break speed records related to JVM performance. They credited hardware vendors for many important improvements. They talked about work on Java 7 and Java 8 JVMs for Intel architecture. All work they collaborate on "ends up in OpenJDK."

Ashok Joshi (Senior Director of Development NoSQL Database) announced the new Oracle NoSQL Database (not a big surprise). Joshi's presentation was relatively short, but I expect that Oracle OpenWorld sessions will cover this in more detail as described in Oracle docs show plans for Hadoop, NoSQL.

Mark Reinhold kicked off the Technical Keynote portion of this opening keynote with "The Java SE Platform: Rebuilding Momentum." He started by recounting the drawn-out development of Java 7 and last year's announcements. Mark then focused on Project Coin, invokedynamic, and Fork/Join.

Mark showed code samples for Java 7 Project Coin enhancements for "everyday programming tasks" such as diamond operator, switching on Strings, catching multiple exceptions, try-with-resources, precise rethrow, literal number representations, and the new standard annotation for safe variable arguments. Reinhold announced that the three major Java IDEs now all support Project Coin enhancements.

Reinhold stated that "invokedynamic is more about Java the platform than about Java the language." Reinhold introduced Charles Nutter (JRuby) to discuss invokedynamic in more detail. Nutter stated that this new feature would significantly improve JRuby performance. He said the method handling API and the ability to dynamically invoke methods are the two biggest reasons for the performance improvement. Nutter explained that invokedynamic may be the first time the JVM has been modified for something other than the Java language. Reinhold introduced Project Nashorn, which he stated has been introduced to test out invokedynamic and to provide a really good JavaScript implementation on the JVM.

Reinhold said that while Java 7 is "more evolutionary than revolutionary," Java 8 is likely to be "more revolutionary." The two main concepts of Java 8 that he discussed are adding lambda expressions to the Java language (Project Lambda) and Project Jigsaw. Reinhold stated that while part of introducing lambda expressions is to "keep up with the cool kids," a more important reason for introducing lambda expressions is dealing with multiple processors.

Reinhold talked about Project Jigsaw being intended for "programming in the large" with a module-based system. He briefly mentioned the difficulty of using the classpath as we know it today. He showed a slide that showed dependencies in a graph knowing only their own dependencies without the software itself needing to know every indirect dependency. Reinhold showed "an improvement over JAR format." He also stated they have a goal to get a "base JVM" down to a much smaller size by installing only the necessary modules for the type of application being developed. Reinhold said other goals include using Jigsaw all the way the stack into Java EE and to work well and interact properly with OSGi.

Reinhold stated that Java 8 is likely to see improvements to the Date/Time API, continued JVM convergence, and Type Annotations (JSR 308). He stated that planned timing for Java 8 will be discussed in the Strategy session. He looked forward to post Java 8 with reference to potential improvements such as self-tuning JVM, improved native integration, big data, reification, tail calls/continuations, multi-tenancy, resource management, and heterogenous computer models.

OpenJDK was highlighted in Reinhold's portion of the presentation. He showed a slide with Duke pointing to the Java developers and saying "I need you" to communicate the need for the community to provide feedback on the future of OpenJDK as Java's reference implementation.

Richard Bair (Chief Architect, Java Client Platform) followed Reinhold and focused on JavaFX. He stated that a key design objective of JavaFX is cross platform compatibility. He also said that JavaFX needs the best graphical interface building tools as Java already has "the best IDEs." Another JavaFX design objective is productivity ("Java + Tools + Docs + API Consistency"). After introducing the design objectives, Bair formally announced "JavaFX 2.0 General Availability" and the "JavaFX 2.0 Developer Preview for Mac OS X." He also announced "JavaFX Scene Builder Early Access" and "NetBeans IDE 7.1 Beta" with JavaFX 2.0 support.

Bair highlighted "key features" of JavaFX 2 such as "100% Java API," "FXML for UI markup," integrated web content (embedded web pages), Swing integration, and "rich graphics and animation." Bair moved to the demonstrations portion after his slide of "key features." Bair demonstrated downloadable samples such as Ensemble and Sales Dashboard. These demonstrations were then followed by additional JavaFX demonstrations including one that demonstrated running 60 frames per second seemingly with no troubles or hesitations. An example was shown of converting a 2D Rubix Cube into 3D space. Another example showed Duke in 3D. The demonstration of integrating the JavaFX rendering with Kinect to move Duke's arms and bodies was received with loud applause.

Linda DeMichiel talked about Java EE 7 and "moving Java EE into the cloud." She stated that Java EE 7's focus is "Platform as a Service" (PaaS), She talked about the PaaS Roadmap, including defining new platform roles, adding metadata, adding useful cloud environment APIs (JAX-RS client API, caching API, state management, JSON), and extending existing APIs to support multitenancy.

Arun Gupta talked about and demonstrated "Running a Java EE Application in the Cloud" using GlassFish, JPA, JSF (and PrimeFaces), and EJBs. His demonstration is available under "Running your Java EE Applications in a PaaS: JavaOne 2011 Java EE Technical Keynote Demo" section of the GlassFish at JavaOne 2011 page. Gupta mentioned the PaaS Console delivered with recent versions of GlassFish.

DeMichiel stated that Java EE 7 "is Not Just Cloud-y." She talked about "alignment of ManagedBeans across CDI, EJB, JSF" and "further simplifications for each-of-development." Other Java EE 7 planned improvements include "Update to Web Profile" and the concept of "Pruning" (making features such as EJB CMP, EJB BMP, JAX-RPC, and Deployment API as optional features of the Java EE specification). DeMichiel stated that all Oracle-led JSRs are being run openly for greater transparency on Java.net with one project per specification request.

Java Mobile and Embedded was the last featured portion of the keynote. Hinkmond Wong did not get to start on this portion until after the planned end time of the session. Because of this, he had to deal with large crowds of people leaving during his presentation. As a presenter myself, I know how difficult that can be and felt for him. The peak attendance of the session was for the Reinhold portion on Java SE and attendance decreased throughout the remainder of the session, particularly at the beginning of the JavaFX section, at the beginning of the Java EE section, and particularly at the beginning of the Java ME section. I don't think the exodus of attendees was due to the speakers, but is more a reflection of the level of interest in the different subjects. It seems clear that nearly everyone wanted to hear about Java SE. The section of Java Mobile and Embedded is more difficult to gauge interest in due to the fact that it started after the session was supposed to be finished.

Several of the JavaOne 2011 major announcements are collected in the post The Most Exciting Oracle OpenWorld and JavaOne Announcements in One Place. This post appears to be updated regularly and includes announcements from this keynote such as Oracle NoSQL Database (see also Oracle Joins the NoSQL Club), JavaFX 2.0 for Windows GA, and JavaFX 2.0 for Mac OS Developer Preview. More information "under the covers" of Linda DeMichiel's presentation can be found in JavaOne 2011 Java EE Technical Keynote Demo - under the covers.

I enjoyed this opening (technical) kick-off to JavaOne 2011. There were many interesting portions, but the portion I most anticipated was Mark Reinhold's section on SE improvements. The JavaFX 2.0 demonstrations were also especially interesting. The session required more than the advertised two hours to pack in the many different speakers and demonstrations. The opening (technical) keynote provided a good kick-off to the technical content of JavaOne 2011. This session can be viewed directly as described in JavaOne Keynotes: Watch Live!

Thứ Bảy, 1 tháng 10, 2011

Let JavaOne 2011 and Oracle OpenWorld Begin

As I wait at the airport for fog to burn off in San Francisco so that we can board our airplane and head that direction, it is interesting to see the plethora of news regarding JavaOne 2011 and Oracle OpenWorld 2011. This post contains links to some of these recently published online resources covering JavaOne and Oracle OpenWorld.

Meeting and Networking

Numerous posts are encouraging networking and meeting of colleagues. Several blog posts outline the authors' tentative sessions schedules (presenting and attending), making it easier for people to meet up with those blog authors. These include Meet Up With DZone @ JavaOne 2011 and Oracle Open World In San Francisco!!, Java and Center Stage: Meet us at JavaOne 2011 (GigaSpaces), Ed Burns JavaOne 2011 Session Picks, JavaOne 2011 schedule (David Blevins), and JBoss at JavaOne 2011.

Other posts have talked about organizations or people who won't be at JavaOne 2011. An example of this is the post Farewell, JavaOne (JNBridge).

JavaOne Conference Blog Recommendations

The JavaOne Conference Blog has seen increasingly frequent posts lately. These include Restaurant Recommendations for JavaOne, Finding Your Way Around JavaOne, and JavaOne Community Activities on Sunday.

Oracle NoSQL

In Oracle to Launch NoSQL Database at OpenWorld, Alex Williams highlights an item on the Oracle OpenWorld Demos schedule that shows Oracle NoSQL Database being demonstrated in Moscone South. Other posts speculating on Oracle NoSQL Database include Oracle Rigs MySQL for NoSQL-like Access and Oracle docs show plans for Hadoop, NoSQL.

No Google/Oracle Agreement

Some had speculated that there might be a settlement between Google and Oracle that would lead to Google participating in JavaOne 2011. At this point, this does not seem to be the case.

Conclusion

These has been a noticeable surge of interest and postings related to JavaOne 2011 in recent days and weeks. I think we're all ready to get it started.