Garbage Collection에 대한 정보만을 보고 싶다면 VisualGC를 추천한다.

하지만 VisualGC는 GC에 대한 정보만을 제공하기 때문에

Thread 등의 다른 정보를 원한다면 다른 도구를 사용해야만 한다.

JDK 5.0 이후 버전은 JConsole을 이용해서 모니터링을 할 수 있다.

JConsole로 모니터링하기 위해서는 모니터링 대상이 되는 애플리케이션 실행 시 다음과 같은 옵션을 추가해야만 한다.

-Dcom.sun.management.jmxremote

이것만으로 모니터링을 위한 준비는 완료되었다.

가볍게 JDK에 기본적으로 포함되어 있는 도구인 JConsole를 실행한다.

jconsole

Reference:
http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

Posted by 알 수 없는 사용자
,

답은 Yes이다.

똑똑한 자바.

Statement.close() 못할까 걱정하지 말고,

Connection.close()만 해주면 ㅇㅋ

다음은 이를 확인하는 코드와 실행 결과이다.



소스코드:

import java.sql.*;

public class DBTester {
 public static void main(String[] args) {
  try {
   Class.forName("org.gjt.mm.mysql.Driver");
  } catch (ClassNotFoundException e) {
   System.err.println(e);
  }

  String server = "127.0.0.1";
  String dbname = "mynms";
  String username = "mynms";
  String password = "mynms";
 
 
  String url = "jdbc:mysql://" + server + "/" + dbname + "?zeroDateTimeBehavior=convertToNull";
 
  try {
   Connection conn = DriverManager.getConnection(url, username, password);
   Statement stmt = conn.createStatement();
   System.out.println("Before conn.close(), stmt.isClosed(): " + stmt.isClosed());
   conn.close();
   System.out.println("After conn.close(), stmt.isClosed(): " + stmt.isClosed());
  } catch (SQLException e) {
   System.err.println(e);
  }
 }
}



실행결과:
Before conn.close(), stmt.isClosed(): false
After conn.close(), stmt.isClosed(): true

Posted by 알 수 없는 사용자
,

java.sql.Statement

Basics 2008. 8. 29. 09:58

The object used for executing a static SQL statement and returning the results it produces.

By default, only one ResultSet object per Statement object can be open at the same time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All execution methods in the Statement interface implicitly close a statment's current ResultSet object if an open one exists.

Posted by 알 수 없는 사용자
,