Saturday, June 29, 2013

More on CDI scopes

A couple of months ago I wrote a simple JavaEE web application to illustrate a desire for enhancements to the JAXB specification to better support custom JAXB ObjectFactory integration in relation to marshalling and unmarshalling objects in a CDI scope. You can find the project here. The premise of the application was to demonstrate using an XML file and CDI scopes to brand a site based on request parameters (request domain or in this case HTTP parameters). On startup the application used JAXB to read in an XML configuration file containing site banner related configurations. Through the use of a custom ObjectFactory when the XML was parsed the resulting Java objects were created in custom CDI scopes. Finally a custom servlet filter intercepted all the requests to the application and based on the value of a HTTP parameter the corresponding custom CDI scope was set for the desired banner. The interesting thing about this application and why I am mentioning it here is that the objects in the custom scope were referable from JSF pages without any further customizations needed, i.e. no custom JSF VariableResolver. It is really exciting to see JavaEE using CDI scoped objects without any appserver specific plugins. When CDI was first introduced I remember reading this article and the following statement:
Anybody can build an extension, you don't have to be a vendor or anything like that. You can add extra functionality to the Java EE platform or you can, in fact, replace quite a lot of the core functionality with something that you think is better. - Pete Muir, CDI Spec Lead
I was a bit sceptical at the time but it turns out he was completely right. CDI provides extreme flexibility for framework developers to push the envelope and in my opinion CDI is the greatest contribution to JavaEE ever.

Wednesday, April 24, 2013

Windows guest OS hanging in VirtualBox running on Ubuntu Linux 12.10

I am really enjoying using my portable PC as a developer workstation and it certainly has increased my productivity. I upgraded to an A10-5800K and retained the 128GB SSD but I lament that I only put 8GB of RAM into it instead of the maximum 16GB. I still like to lug around my 22 inch Acer LED and if I ever went back to a laptop I would still carry it as an extended screen.

 I recently purchased a Windows 7 ultimate license key and wanted to activate it in VirtualBox so that I could have multiple authenticate versions in different configurations for different projects/clients while using Ubuntu as the host OS. If I was more adventurous and knew more about Xen I would run Ubuntu as a hypervisor. In any event recently on both my AMD FX-8350 workstation and this AMD A-10 Ubuntu completely locks up and I have to hard reboot the machine. These lockups more often than not happen during startup. In this day in age it is extremely annoying.  This happened after I activated Windows 7 and I expressed some choice words. After trying serveral settings tweaks I I enabled host I/O cache on the controller and that seemed to fix the lockups. Since the change I have rebooted serveral times, IO intensive operations, and no lockups. I also enabled SSD for the virtual harddrive since the VM is running on a SSD drive in the host. I believe this is a new feature with Virtualbox. I also remembered to disable paging and defragmentation in the guest OS it increase performance and preserved the SSD. Virtualization with throw away OSes is the way to go!!!