Performance tuning and resource management in Java applications