Subscribe: Anand's Java Blog
Added By: Feedage Forager Feedage Grade B rated
Language: English
blog  code review  code  data  design  don  exception  google desktop  google  java  jboss  make  object  review  time 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Anand's Java Blog

Anand's programming Blog

Thoughts and comments on Java software development.

Updated: 2018-03-02T08:37:52.410-08:00


Google Desktop and Java Install


I got my new laptop today. I had a list of applications to install in it. I kept Google Desktop high in my list of applications to be installed. So basically for the google desktop installer the machine is vanilla.

Newer version of google desktop( one which comes integrated with the gadgets) requires Java runtime engine available. On not finding one it installs the 1.4 version. All is well and good and I am happy.

Now I get to next item in the list of installs and that happens to be Java5. I download it from Java website and try to install and *DING* I CAN'T. Some application is holding up lock on the Java folder. For a some time I could not figure which app and then run through the task manager to figure. The usual suspect was Google Desktop.

Now what would be the way around? I killed the google desktop app and removed version 1.4 and then installed Java 5. All worked. BUT I can no longer see the google desktop gadget.Something messed up!

Final resort was to uninstall Google desktop and reinstall it all over. It sucks to to do that as I had to redo my google gadget setting all over again :(

Anyway, the moral of the story is " If your computer/laptop does not have Java Runtime engine installed, make sure you get what you want before installing Google Desktop else you will spend quite sometime to cleanup the mess"

I wish google had better way to handle this but Hey who care, I am happy with Google Gadgets!!!

Error Codes and Exceptions


Nice article on Error Codes and Exception here ( ).

Oracle Buying JBOSS????


Buying spree of Oracle might not be yet over... there are talks about Oracle buying Jboss in street.

In my opinion this is loss for open source developers and supporters.I forsee oracle trying to bundle Jboss with Oracle specific components by default and drive JBOSS future greared towards the coorporate milestone rather than developers needs.

What is your opnion?

Making JetBrains IDEA faster


Sorry this blog is only relevant to IDEA IDE users. But thought I will give the tips as I am sure there are many who may benefit.

1) If you have plenty of memory resource in computer give it to IDEA. I have seen that performance of IDEA is optimal at 512 MB heap size. You can do this by changing the VM options text file located at your IDEA install under bin directory. The name of the file is idea.exe.vmoptions.

2) Go to project setting and click on the IDE tab and turn off

** Synchronize files on frame activation
** Save file on frame deactivation
** File save on IDE being idle.

3) Remove unnecessary files from project by adding them in excluded. This can be done by setting the project properties and adding folder locations in excluded tab.

4) Avoid using shared views in source paths, local files are always faster.

5) I have seen that IDEA sometimes need a restart, lame but true , to be faster after being active for some days.

IOC and Dependency Injection - Simplified


Subject pattern is being thrown out in every Party and Kitchen/Water-cooler discussions now a days. Its not cool, if you have not heard about one of these buzz word. I am trying an attempt to simplify what this design pattern means and why IOC vs DI. For more in-depth information you should refer to Martin Flower's website.

I will use terms (A) and (B)below, it represents two decoupled applications/component.

Inversion of Control ( IOC): This should be interpreted as an application( A ) handing off control of logic/action to other component/application ( B). Martin Flower explains this in a very simplistic Hollywood slang " Don't call me, I will call you". Here B is saying to A that I have control over this part you worry about other things. This pattern is no new invention, the concept of IOC is very generic and used in day today software development even if you never heard the 3 letter acronym.. Good example is Java EventHandlers. Now where does DI - dependency injection comes into picture....

Dependency Injection ( DI): In simple terms, DI is specialized IOC, where in inversion of control deals with "plugin", thus the name injection-injecting the plugin. (A) application inverts/handsoff the responsibility of determining the plugin to B thus making itself decoupled and generic enough to be used by any client.

Types of DI: Client will still need to tell (B) what to plugin should be like. This is where different types of DI like setter based DI, constructor based DI etc. For example Spring framework use the setter based DI. A framework provides client an assembler mechanism to define and associate plugins. Like Spring provides XML configuration which is used to set appropriate methods of (B) with plugin.

That is all you need to know,if my explanation is still not simplistic enough. Try to remember these two

IOC: "Don't call me , I will call you"
DI: "Don't plugin yourself, I will do that"

Worlds Largest Database - BaBar


While most of us are struggling to solve the issues around TeraByte data storage and management, folks at Stanford are ready for handling PetaByte( 1024 TeraByte) of data with BaBar database. In 2004 Stanford LAC collected 500,000 GB in a day, thus a multi-petabytes of data getting stored is very near. Note that such challenges are not limited to reasearch groups. Wal-Mart is assumed to be storing somewhere near to 580 TeraByte of sales and inventory data, also EBAY stores 100s of TeraByte of consumer data.

There is an interesting article posted at Standford website giving an overview of challenge faced in storing and managing such large data which is worth a read. You can refer it by clicking Here

Here are some interesting data for starter:

1) DataStorage happens at IBM MSS storing 1.3 Petabyte in 13,000 tapes managed by 6 StorageTek tape silos.

2) Data is backed by 160 TeraByte of disk Cache for responsiveness.Disk cache is mainted by thousands of physical disks maintained by large disk arrays.

3) For multi-petabyte scalability uses ODBMS approach with Thick client and Thin Server approach. Uses Objectivity/DB

4) Database runs on 2000 CPUs with 100 servers supporting.

JBoss Open house


JBoss is opening a new office in Bay Area. If you are not registered you can refer below information for an open house organized

JBoss Open House in the Bay Area

We are growing! And we would like to invite you to visit us at our new office in the Bay Area. Please stop by and enjoy refreshments and light appetizers with your JBoss friends.

You can learn more about our company, our services and JBoss opportunities.

This is a great event for all Java architects to learn more about what JBoss has to offer with their innovative and high quality technology.

If you cannot make it, please visit us at:

Date: Thursday, January 12th

Time: 12 noon until 8pm

Where: 1600 Wyatt Dr. Suite 7
Santa Clara, CA 95054
(Please, click here for directions)

Parking: There is available parking for free around the office.

For questions about the event, please call us at (650) 255 0323

Also, announcing JBoss World Las Vegas June 12-15 at the Rio Hotel and Casino.
JBoss World Call for Papers and Innovation Awards are now open.
Click here for more information.

Make code reviewers life easy


Code review is a very important aspect in a software developement lifecycle but its not given due importance unfortunetly in most cases. General concept in the industry is that code review is for finding bugs, design flaws and coding style non-adherence issues. But the most important aspect of a code review I believe is knowledge transfer and sharing information with peers who may have to support the code they are trying to review.

What I learned from all these years of development is that - take code review seriously. Make sure you are well prepared for the review presentation and make it a point that either you have convienced the reviewer about the correctness of your code or understood what reviewer is suggesting the changes. Here are the list of things to keep in mind before you try to setup a code review.

1) Is your code ready. Does it even complie? Okay this is not silly, I have reviewed code myself which will even not compile. Usually happens when a third party/consultant writes a code and sends out the packet via email for reviewing. Please please make sure that it complies.

2) Have you unit tested your code base before review? This is next most important thing to do before review. Note that your reviewers are not only techincal director but some times end users who may have to integrate with the code base. So make sure you don't have many TODO's in the comments. Ideally you want to have a JUnit testcase with all the uses cases running before the code is reviewed.

3) I usually like to go QA lead for the project and handoff the JUnit testcases I prepared before review and ask him to run and make sure it works. Don't be surprised if QA folk comes back with couple of critical bugs which you would have never caught yourself.

4) Don't give a chance for reviewer to comment on coding style. Most of the oragnizations have thier own coding standard if you don't have one follow java coding standard. Don't take coding style lightly as it shows your seriousness for the coding and project overall.

5) Give reviewer enough time to prepare for the code review. Well most of the time reviewer don't prepare and just show up. But that is thier problem. Make sure that such reviewer don't get a chance to say , "hey you did not send out the code packet in time".

6) I can't stress this more but make code review easy for reviewer. Attach class diagrams of code being reviewed , no pointers to old design documents. Firstly because reviewer don't look at pointer , secondly old design diagram in most cases will be outdated.

7) Use merge tools. This is a very helpful way to make your reviewer happy so they don't ask questions trying to figure what changed and what not. I found Araxis code merge tool to be pretty good for such purposes. Integrates well with Clear case and other popular version control system.

8) Take notes and make sure you understood what changes reviwer changes.


JMX for OOM warning : Helpful but Useful?


Javaspecialist put up a good article on using java management API to introspect the JVM memory pool. A listener can be registered to the management bean which is a call back for the bean if the memory usage is exceeding the threshold value. Threshold value can be set by using MemoryPoolMxBean.setUsageThreshod(long) method.

This is all great, I can have some auto script warn the primary engineer or operations about memory related issue in advance. But what does it buy us apart from the advance notice. In my experience I have seen following actions for a OOM in live server

Script action:
A) Setup a back ground script on the server which looks for OOM exception on server log.
B) If the script finds an OOM exception , a restart is performed.
C) Script also alerts the production control for further action.

Engineer action:
D) Doh! I got a pager, damn why is it that pager rings on darn weekend. Ahh OOM, wish I had not replaced the pager battery.
E) Hum... Let me look at for some temporarily solution so I can buy some time. How about heap size increase or may be scale the server.
F) Back to office, setup profiler tool and figure out if there is a memory leak.
G) Send out an email with finding and resolution.

So having said this, I would be interested to know if you see any additional benefit from the management bean for OOM related issues? Also if you have some other ways to deal with live production OOM issues let me know.


Bookmark this: JDiff


So many times a blog is nothing but reference to others, but that is what blog is all about. I do feel that we should not always have to "write our own innovative blog", most of the time somebody has already thought about what you are writing but your way to express is what matters here and we ( blog readers) look forward to reading them.

I think the basic rule is : if you are not commenting on a blog or adding additional information, just for promotional purpose give the reference. Also copy pasting a blog is not a taboo, your blog is not just blog readers reference but your reference as well. So if you like a blog very much and don't want to loose it because that blogger might shut down the blog site , go do the copy-paste.

Since I talked about refrenences I happen to see a good sourceforge utility which provides differences in Java API. Wish I knew about it before, here is the Reference

Virtual spy driver for JDBC


IronGrid provides an easy to use virtual spy driver for JDBC which can be used to gather performance related data for all your SQL queries. I have benefited it from it so give it a try if you are not using something similar.

The driver is called p6spy which wraps the JDDC driver and traps all the request coming and going through it. Thus it has the flexibility in keeping frequency/responsiveness of your SQL queries. Apart from trapping the data this driver also listen to port( configurable) which can be used to connect from a client ( provided by IronGrid) to read the data.

Three things rocks most

1) You don't have to make a single line of code change on your app server. Everything is configured.
2) You can see the binding variable data on your prepared statement, which I believe is wonderful as I miss it a lot with straight JDBC logging.
3) Provides a client which can get all these data and present it in a nice way, can also generate reports.

Setup is quite straight forward , basically put the jar file in classpath and configure the so it knows which driver it has to wrap.It supports most of the popular JDBC driver, and the product is free of cost!!!

JDBC4.0 API feature sets


Some attachments from the feature sets of JDK5 like generic,MetaDeta and JDO and more..

1) Simpler access( factory) to Datasource,Get the connection of data source by parameters( host,port etc) rather than the JDBC URL.
2) Some enhancements over that state of Connection
3) Complaint to SQL 2003 : This brings
3.1 Associate SQL queries with object structure, inline with ORM ( object relational mapping)
3.2 SQL/XML support for XML datatypes.
4)Easy migration from JDBC rowset model( disconnected datasource access) via XML stand-point.

To me best they have to offer us is point-2 ( enhancement on state of connection). Now conncetion object can provide us a way check the validity of connection rather than just isClosed().

Mock SMTP server for Java emails


Ever got stuck with IT guys for having setup the SMTP server so that you can start testing your java application which has to deal with the emails. Now no more.... I happened to see a good tool which will mock the SMTP server. Its called Dumpster. It understands the SMTP protocol and does everything until the email has to be delivered. Email is cached so if you see it in cache consider that it should have been recieved by the user.

Here is the link:

Mock SMTP server

UncaughtExceptionHandler in Java5


Java5 provides a better way to handle the uncaught exception thrown by abnormal thread termination. Now the application can define its own handler which will be called by JVM if the thread is terminated and exception is not caught. The order of sequence is as follows

1) JVM checks if the Thread is handling the exception if not
2) It delegates the responsibility to handle the exception to the ThreadGroup object,if ThreadGroup does not handle the exception, then
3) JVM checks to see if there is Handler( object implementing Thread.UncaughtExceptionHandler) set for the Thread, if so ,JVM delegates the exception to the handler to handle. If no handler is defined for the Thread, then
4) JVM asks the ThreadGroup to use the default handler , if there isn't one, then JVM uses the pre 1.5 way of using the ThreadGroup to deal with handling the exception.

Advantages of defining a default handler:

1) Provides one layer of granularity of controlling the exception
2) Each Thread can have its own default exception handler.

How to build maintainable systems: Simple design


Wonderful post by tirsen on codehaus blog, I very much agree with him.

I'm not saying that simple designs by some divine judgement are better designs (I do believe so, I just don't want to start that particular debate again). There are other much larger problems with complicated designs when it comes to implementing maintainable systems: complicated designs usually become poorly understood and therefor poorly implemented.

I've seen this many times in the field: Some hot-shot architect works for an intense period early in a projects lifecycle and produces some really hot-shot, ultra-cool, super-slick design that solves everything that the system would ever be conceived to do and then some. Job done, the architect leaves for his next hot-shot assignment (he holds himself too high for such profane tasks as, bah, implementation).

Left on the project are a bunch of more junior people who are up to the task of actually delivering the system. If they ever understood the design in the first place they are certainly not understanding it good enough to be able to maintain it when exposed to realities such as time-pressure, performance problems, inconsistent requirements and so forth. The design starts to break down and technical debt accumulates. The biggest problem now is that not only has the design broken down, they are also dragging around a massive framework hampering their every step.

I have been to places that had frameworks of hundreds and hundreds of classes that when it came down to it did the equivalent functionality of about two mid-sized classes work. I kid you not.

Some warning signs to look out for:

"We're building a generic framework so it will take a little longer to deliver the first project. But then we will be able to reuse all this stuff so we'll save time in the long run." (Building reusable software is many, many times more difficult, expensive and time-consuming than one-off software. Is there really a business case for a reusable framework?)

"Let's build it so that all this functionality can be accessible from any possible client." (Technologies like web services or CORBA has a huge up-front cost in terms of complexity. It's better to build the remote interfaces when the client actually exists.)

"Make the customer disappointed the first time, because they will be more than happy the next time." (Are you sure you will get a next time?)

"We want to use a rules engine so that the business can easily extend the system in the future." (Even a rules engine requires programmers to write the rules.)

"It might seem a little complicated for this simple project, but if we stick to a standard technology we can be sure to find developers that can maintain the system in the future." (Nobody can maintain an unmaintainable system, standard or no standard.)

Java Prevalence, is it ridiculously that simple?


There is a talk in the town, its called "Prevayler"( . The idea is towards getting rid of Relational databases( Making Larry Ellison run for money) and persisting the data in-memory, yes all the data in memory. Now the claim is that its ~9000 times faster than using relational databases. Prevalyer has data objects ready to be used , meaning, you don't have to perform the object creation every time a data is being retrieved thus it saves on the costly object creation time. These objects are supposed to be cached in the same physical machine so you don't have deal with network latency and cost associated with such for database driven applications.

Folks behind this idea considers it ridiculously simple also its strange that they use the word prevalence which literally mean "Generally accepted". It is really that simple or can it be generally accepted.

I don't want to repeat what's in Prevalyer website. Prevalence folks have already figured how they can deal with system crash, backups/restore etc. What I am curious is how they are benchmarking Prevalance with relational database?

Some catchy points about Prevalance which are so debatable -->

** Rollback is needless according to prevalence. Wait a second, what about the A part solved by RDBMS in ACID, the Atomicity. I was looking for how prevalence answer my question and found that suggestion is pretty lame. Do a try and catch on your business object and have the catch remove the object graph associated so far before the exception happened. Well for first its clear that prevalence does not provide ACID and second I am not sure how you can revert from the catch block.

** Two-Phased commit is unnecessary. Well I just leave this comment to as is ...

** No SQL use OQL( Object query Language ).

In short I believe the attempt so far can be useful in using prevalence as good object caching architecture which guarantee cache recovery. But then do I need a cache database for it......



First Blog so making it simple and easy. I am going to post thoughts on the most predominant thing on my mind with regard to Java software development.

About me and why Java:
I am software professional ( Yeah yet another) and make my living out of it. I have been in this is field for last 8 years. For past 5 years I have been working on Java related technologies , you name it and I must havee worked on any of the 3/4 letter acronym buzz word in Java.

Why Blog:
Since its simply the best medium for digital knowledge sharing and opens to the channel for participation for anyone ( everyone is a buddy so no buddylist to share the information as in instant messenger).

What will I Post:
Mostly which makes sense and lingers in my mind from day today activity with Java development. I will share my experiences of past, present and future (yeah I know I am going to code Java for some foreseeable future).