JAVA: Executing Code Before Shutdown

Sometimes, you need to do something before application is shutting down, such as closing any open connection, closing up all opened file or anything else. Luckily, the JVM is always do these two steps below before shutdown:

  1. Run all registered shutdown hooks, if any. Shutdown hooks are threads registered with the Runtime. All shutdown hooks are run concurrently until they finish.
  2. Calls all uninvoked finalizers, if appropriate

Now we can use shutdown hooks to cleanup any resources or do something when application shutdown.

Continue reading ›

WebServer Benchmark - Gatling VS Nginx

Gatling is a high performance web server, developed by this guy. This webserver in my opinion is very light, but very fast. I benchmark against nginx and it runs faster.

Continue reading ›

Reducing Overhead inside CodeIgniter DB Library

I like CodeIgniter database library alot. Infact, I use it for standalone purpose in several of my projects. One thing that distracting me is that it has an overhead while fetching result. The result_xxx method is bugging me.

Continue reading ›

Implementing CDB hash in PHP

The CDB (Constant Database) got a really cool and simple hash function, what I'm trying to do, is implementing CDB hash function in PHP script. There are interesting explanation from here and here.

Continue reading ›

Very Funny Iphone Related Video

I'm sorry, I can't help it ...