title: Do I use WeakReference correctly
body: <p>I am building a javaagent, which help people to find leaked JDBC connections.</p>
  <p>When client code creates a connection, my agent will record the stacktrace which called to create that connection, the time creation happens, and also makes a weak reference to that connection instance. When client code use that connection, my agent will update a &quot;lastActiveTime&quot; timestamp, when client code closes the connection, I am going to clear record.</p>
  <p>By doing so, the user can observe connection stats. And when the user can tell a connection was leaked, they can close it by getting that instance from the weak reference.</p>
  <p>As a connection instance may last a long time, the weak reference won't prevent it be GCed, when it was closed by client code normally.</p>
  <p>Is my design valid?</p>