Melvin Koh's Weblog

I'm just a contractor

20070302 Friday March 02, 2007


Clustered JVM - Terracotta

Terracotta is an open source distributed shared object facility for Java, which allows multithreaded applications to run on clusters with minimal changes. It works with existing application servers and other web platforms, which makes distributing application loads across multiple nodes (JVMs) straightforward. It performs thread synchronization and even thread migration transparently for the user.

In addition to the runtime facilities, Terracotta provides a declarative approach to clustered software. That is, the programmer merely annotates which data members are shared. Likewise, the user may specify which methods contain critical sections, thereby creating a monitor.

The system architecture relies on a central server that stores the state of shared objects. Client nodes (JVMs) receive updates for objects currently in memory; thus, any data transfers occur only at the object level. For fault tolerance, the server itself may be clustered with one live and others in standby.

Best of all, it is open source. While I still don't think that Java is suitable for building HPC applications, the solution may be great for developing Grid and cluster management tools.
 

Posted by melvin ( Mar 02 2007, 02:41:15 PM SGT ) Permalink Comments [0]

20070222 Thursday February 22, 2007


Java is not slow?

There is an article that debunks the rumor that Java is slow. This article suggests that the "myth" of C/C++ applications, as native binary, will always be faster than Java, is not true. To a certain extend I agree with the author - poorly written C/C++ app can perform much worse than a Java app. Now, Java is my favorite programming language, but as someone working in HPC, all I can say is that I'm not at all convinced.

 

Posted by melvin ( Feb 22 2007, 04:53:26 PM SGT ) Permalink Comments [4]

20060802 Wednesday August 02, 2006


Manual display of table contents in Java Studio Creator 2

I'm playing around with the new Java Studio Creator 2 recently and find that it is able to perform alot of powerful stuff very easily. For example, to display the content of a database table, just create a JSF table component, from the datasources drag the database table to the table component and you're done! The JSF table component should now list the content of the database table with the columns representing each fields. To customize the table, just click on the column and modify the properties or edit the JSP codes if you're programming inclined.



All these is well and good but what happen if the content is not stored in a proper database? I wanted to display the content of a textfile in the JSF table and it took me a while to figure how to do that. The trick is to use either a Object List or Object Array Data provider. Firstmost, I drag-n-drop an ObjectListDataProvider to my page. Then I need to create a javabean wrapper class for my data in the textfile. In the page init(), I do whatever I need to read the first line of datafile, transfer to the bean object, throw it into an ArrayList, and repeat for each line until EOF. Next assign the ArrayList to the ObjectListDataProvider by doing:

objectListDataProvider.setList(arrayList);

Finally I need to bind this data provider to the JSF table. I switched to the JSP view, locate the table code and change the sourceData="#{....}" to:

<ui:tableRowGroup binding="#{main.tableRowGroup1}" 
id="tableRowGroup1" rows="10"
sourceData="#{page1.objectListTableDataProvider}"
sourceVar="currentRow">

For each column, I also have to change the text="#{currentRow.value['xxx']}" by replace xxx with the variable name of the javabean class, then I'm done!


Posted by melvin ( Aug 02 2006, 03:45:58 PM SGT ) Permalink Comments [2]


This is a personal weblog, I do not speak for my employer.