Package com.gengoai.sql.sqlite
Class SQLiteConnectionRegistry
- java.lang.Object
-
- com.gengoai.sql.sqlite.SQLiteConnectionRegistry
-
public final class SQLiteConnectionRegistry extends Object
Registry to prevent more than one SQLite connection from being opened to the same database. Also will auto close the connection when there are no longer any references to the connection in memory.
-
-
Field Summary
Fields Modifier and Type Field Description static Map<String,WeakReference<Connection>>
registry
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
cleanup()
static Connection
getConnection(@NonNull String jdbc)
Gets connection.
-
-
-
Field Detail
-
registry
public static final Map<String,WeakReference<Connection>> registry
-
-
Method Detail
-
cleanup
public static void cleanup()
-
getConnection
public static Connection getConnection(@NonNull @NonNull String jdbc) throws SQLException
Gets connection.- Parameters:
jdbc
- the jdbc- Returns:
- the connection
- Throws:
SQLException
- the sql exception
-
-