An Executor with blocking submit()

Today we are going to talk about an executor that will be blocking on submit if n number of threads are already executing. Suppose if you have a threads running in parallel and they are resource intensive, you may want to limit the number of threads executing. This is what we will do in this … Read more

HelloWorld for PhantomReference

PhantomReference allows a programmer to know that an object has been garbage collected. And hence the programmer can do something else when an object is collected. Today I was working on a code that was using PhantomReference. And since I had never worked with it so I decided to write some tests and see how it … Read more

Migrating from tomcat 6 to tomcat 7

Recently I was working on an application and we were using tomcat 6 as the web container. We were changing from tomcat 6 to tomcat 7. I wanted to do it very easy, so just copied the server.xml from tomcat 6 and pasted it into the tomcat 7 config folder. I did so that I … Read more

Eclipse Tips

Here are eclipse tips and tricks that I find useful in everyday use of eclipse. Eclipse shortcuts: Shortcuts I use everyday Ctrl+1 seems to be the most useful shortcut of eclipse. It shows the quick help. e.g. create getter and setter on a property or rename a property. If you see an error or warning … Read more

Thread safe caching of JAX-WS clientproxies

According to http://cxf.apache.org/faq.html#FAQ-AreJAX-WSclientproxiesthreadsafe? , clientproxies are not thread safe so I decided to create a Component which can pool the connections. I do it it by using Singleton design pattern. What is handled by this Singleton: This class creates the connections on the start and then caches them If the connection to the server is not available … Read more

GWT nocache.js cached by browser

Recently we faced an issue with the GWT deployment. Whenever we were doing a new deployment the users seemed to get errors as the gwt did not refresh the javascript files even when the user reloaded the page. Then the temporary solution was to reload all the files using Shift+F5.  All our pages had this … Read more

How should autocomplete work?

We were recently developing an application that has a fixed set of data. The data may change very little over time. And this application has one search box to search over all this data. The search page is quite like google page with one search box and search results showing on the page    So … Read more

migrate from maven2.x to maven3.x

Recently I migrated an application from maven2.x to maven3.x. And the only issue we faced was that profiles.xml was used in maven2. Here is the warning raised by maven3 while building. Since we had all the properties for building in profiles.xml so the first step we took was to copy these properties into pom.xml. And … Read more

maven properties in pom.xml converted to properties file

With maven 3.x profiles.xml is no longer supported. We had all our properties in the profiles.xml. So we changed to maven 3 and had to convert properties in profiles.xml to properties file. Here are the details about maven2.x to maven3.x migration   So here is the java utility class that reads the properties in pom.xml … Read more