Finalize is invoked when an object is about to be GC'd. Since you never create an instance of WebServer, this will never be invoked. If you did create a new instance in main, it would never be GC'd since your reference would be a GC root, so finalize would never be invoked anyway. Furthermore shutting down a cluster in a finalize method is not a good idea. You're already covered with the try/finally block in your main method, so this finalize should be removed.