Ho appena letto questa domanda e le richieste di risposta :
"Lets assume db connection object is singleton in my application"
This is a must not. Your database connection MUST NEVER BE (yes, bolded and with capitals to make sure you and every reader never make this mistake) a singleton object. Your Connection con MUST NOT be part of a singleton to keep it open all the time. Instead, use a proper database connection pool that will take care of opening the necessary physical database connections and keep them alive through the live of your application.
Ovviamente usiamo un pool di connessioni per occuparci delle nostre connessioni. Tuttavia, conserviamo questa piscina in un singleton. In quale altro modo si potrebbe garantire che vive in tutta l'applicazione? Le sue cattive pratiche?