You will have to excuse the lack of cross references to session id in this post, I am writing it at SF airport after a lovely day on the cable cars and down by fisherman's key.
Started the day with NIO.2 or N^2IO depending on who you ask. This is a task to complete the job of filling out the APIs for nio introduced quite some time ago. (Although most people still wont use it directly you will find it underneath most network operations)
The focus in JDK 7 will be to provide a "proper" file system API with methods than throw usefull exceptions rather than just returning the very so useless "false". There is a default "FileSystem"; but the opportunity exists to implement new custom file systems. Where you would normally use File instead you might now use FileRef and Path but there are helper methods to convert in both directions.
There is a new channel type called SeekableByteChannel which is the equivalent of RandomAccessFile in nio. I suspect that most people will be sticking with streams though until and just making use of the extended create operations. In general any method of File has a much better version of FileRef and you can replace "file.move(...)" with "file.getPathRef.move(...)" and get an incremental upgrade to the new API.
There is also some quite cool stuff to down with support for symbolic links and file system attribute models for different platforms. Finally there is support for file system eventing. This allows you to monitor a file or directory for updates. Much better than having to ask for hte lastUpdated flag of each file when you flick focus back to an IDE for example.
Oh and a proper scallable way of getting directory listing that doesn't just block on network drives, about time too!
The presentation then went of to talk about true asynchronous channels. These provide an API very similar to the JAX-WS client API; but with more control over how threads are managed internally. I must find out how to take control of the threads in the JAX-WS client model. This should improve performance in Coment applications, the Grizzly bloke reported at least a 10% speed increase in 1.8 with JDK 7 support. (But that information didn't get to me until later on that day, the joys of writing on past tense.)
Finally the presentation briefly covered better multicast support, although to be honest this isn't used particlarly often but is good to know all the same.
Next up was the TS-5415 Servlets 3.0 presentation, again the key topic of conversation appeared to be asynchronous interfaces. The new specification provide support for suspending and restarting data flow in particlar this helps with comet style application as it now longer required one thread per request. Instead "idle" connections can be parked until some event wake them up and requires a thread for some work to be done in them. This is not going to be production until '09 though as it need to sync with JEE6 although I guess the open source bods will have an implementation much sooner.
They have also gone a long way to update the programming model to take into account the changes to the programming langauges. You can now do an annotation based servlet that looks very similar to the JAX-RS specification, indeed the HTTP operation type parameters are shared. So you servlet might now look like:
@Servlet(urlMaping = "/foo") public HelloServlet { @GET public void doGetOperation(...) { } }
Personally I am not 100% sure that this style of programming makes sense in this context; but I am willing to see it tried. A bit of my still like interfaces for this kind of stuff. But having said that composition is better in the long run than inheritance so we will just have to see how it goes.
They have also done some work to change the deployment model. For of all web.xml is optional, and if required can be split up into easier to manage fragments. There is also a programatic API that does much of what web.xml does, this will hopefully work around much of the boiler plate that you end up typing in when you want to use 'clever' framework X.
One final nice change is the ability to deploy an EJB in the war file. This might not seem like much but things get complicated packaging wise. You either have to duplicate the EJB interface in both the ear and war or create a shared jar file to contain it.
I did then briefly go to TS-7477 101 ways to interoperation with .NET which was a dissapointment and I didn't stay long; but I did walk away with a Microsoft/Java dual marketed pen drive. I wish I had gone to TS-6128 which was more about WS interop, I did pull the powerpoint though so hopefully there is anough in there to get me going. (Otherwise Sun will eventually get around to publishing the presentations as web casts.)
The last, and probably one of the best presentations of the day was TS-5186 Design Patterns Reconsidered. (You can find more stuff on this here, I am not sure I can do it justice.) It was a quick walk though although I could quite happily given this chap me ears for two or three hours.
He started the presentation by bashing singletons, which always get a presenter in my good books, covering the normal points about how hard it makes testing/ slash know what the hell the code is going to do next. As I would expect he doesn't critise the idea of holding onto a single object; just how it is implemented. Instead he quite rightly suggets using DI to managed and inject a refernece to the object as required, much better.
He covered the template patter and how it makes the code much harder to evolve all very good points. Suggested that composition is a much better way to go, which I agree with, and that perhaps this is even easier with some closure proposals as you don't end up having to define n interfaces for n injection points.
He skipped over proxy which is a shame, but when spent quite a bit of time on the Visitor pattern. Again this can make it very hard to evolve your system to include new types. In particular he suggested closured might make it much easier to do the visitor pattern in a flexible way. You might have something like:
for walkModel(model, {Node n => n....// get next node}, // Stratergy {Node n => if (n.getName().equals("foo") break;});
Could be a really powerfull syntax, he also had a real nice catagorization of visitor types which I will shamelessles copy here:
- "Collector" : gather a sub set of nodes from the model
- "Finder" : find one particular node and exit
- "Event" : walk the model and generate events, like the DOM->Sax bridge
- "Transform" : modify the model, could be real dangerous
- "Validation" : check the data in the model
Again well worth looking his his website and watching the presentation when it becomes avaliable.
Last presentation of the night was one of writing java implementations for Quicklook and Spotlight on OS X given by my friend Tim and he work collegue John. You can get the code from sf, but theirs was one of the few presentations where the demos to get a geniun round of applause. Mike from apple took question at the end; but as expected didn't resolve the 32bit intel mac issue. Grrr all my macs are 32bit.
Did bump into some BEA engineers, hi Mykola and Hang, and we swapped experiences of working for Oracle in line whilst waiting to get into the concert. They seem jolly nice chaps and I will look forward to working with them in the future as they happen to work on the web services stack in web logic. The gods of networking were smiling on me this evening.
Then up to the Bueno Yeuna gardens for a bit of beer food and music. Turns out to be a bit cold up there so after a few sets we went along the road to the thirsty bear for some beer and tapas. Then back to hte Nikko with my brain buzzing again from all the stuff I have been trying to learn.
1 comment:
Hey, thanks for the nice words about my Design Patterns Reconsidered talk. If you're interested in more resources and/or the slides (including the skipped Proxy section), they are also available on this page.
Post a Comment