From 26c8d6f9475fd32aff1bf99fde714ab4b937e1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCrten?= <sebastian@mobanisto.de> Date: Wed, 29 Sep 2021 17:48:59 +0200 Subject: [PATCH] Remove some methods from Database and make them internal to implementation --- .../org/briarproject/mailbox/core/db/Database.kt | 14 -------------- .../briarproject/mailbox/core/db/JdbcDatabase.kt | 4 ++-- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Database.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Database.kt index c02284f4..56e1dd9f 100644 --- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Database.kt +++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Database.kt @@ -2,7 +2,6 @@ package org.briarproject.mailbox.core.db import org.briarproject.mailbox.core.api.Contact import org.briarproject.mailbox.core.settings.Settings -import java.sql.Connection interface Database : TransactionManager { @@ -18,19 +17,6 @@ interface Database : TransactionManager { @Throws(DbException::class) fun close() - /** - * Aborts the given transaction - no changes made during the transaction - * will be applied to the database. - */ - fun abortTransaction(connection: Connection) - - /** - * Commits the given transaction - all changes made during the transaction - * will be applied to the database. - */ - @Throws(DbException::class) - fun commitTransaction(connection: Connection) - @Throws(DbException::class) fun getSettings(txn: Transaction, namespace: String): Settings diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcDatabase.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcDatabase.kt index 4639361c..79fafc22 100644 --- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcDatabase.kt +++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcDatabase.kt @@ -219,7 +219,7 @@ abstract class JdbcDatabase(private val dbTypes: DatabaseTypes, private val cloc return connection } - override fun abortTransaction(connection: Connection) { + private fun abortTransaction(connection: Connection) { try { connection.rollback() connectionsLock.lock() @@ -244,7 +244,7 @@ abstract class JdbcDatabase(private val dbTypes: DatabaseTypes, private val cloc } } - override fun commitTransaction(connection: Connection) { + private fun commitTransaction(connection: Connection) { try { connection.commit() } catch (e: SQLException) { -- GitLab