ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Why did the tomcat server come across some exceptions thrown frequently in some part of the code?

When I examined the code, this what it looked like public static String doSomething() { String returnVakue = "default value"; try { ResultSet rs = getMyResultSet(); rs.first(); returnValue = rs.getString("my_field"); // Note that Exception happens at times when the ResultSet is empty } catch (Exception e) { throw new Exception(e); } finally { return returnValue; } } While I am aware that it is perfectly OK to have both throws exception and return, wondering if this can cause any kind of leaks in tomcat. And Is there any potential risk with performance. ? Hoowever my caller function stops the execution at this point. Any views on this? Does it affect the GC? EDIT : NOTE : Please share your views whether this can potentially cause tomcat hanging.

user-image
تم إضافة السؤال من قبل Usama Saad , Senior Software Engineer (Java) , Saudi Catering Company
تاريخ النشر: 2013/08/23
mirza habeeb
من قبل mirza habeeb , Application Support & Database Developer , Via Technology

It doesn't close() the ResultSet, an possibly not the JDBC connection either.
This will pile up and you'll eventually run out of memory or slow down your database

المزيد من الأسئلة المماثلة