public abstract class ConnectionSet
extends java.lang.Object
implements ru.bitel.common.worker.Recyclable, ru.bitel.common.worker.Commitable, java.lang.AutoCloseable
Modifier and Type | Field and Description |
---|---|
protected boolean |
autoCommit |
static int |
TYPE_FAKE |
static int |
TYPE_MASTER |
static int |
TYPE_SLAVE |
static int |
TYPE_TRASH |
Constructor and Description |
---|
ConnectionSet(java.sql.Connection master,
boolean autoCommit) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
commit() |
protected void |
finalize() |
boolean |
getAutoCommit() |
java.sql.Connection |
getConnection() |
java.sql.Connection |
getSlaveConnection() |
java.sql.Connection |
getTrashConnection(java.lang.String tableName,
int defaultType) |
static ConnectionSet |
newInstance(DefaultServerSetup setup,
boolean autoCommit) |
static ConnectionSet |
newInstance(DefaultServerSetup setup,
java.sql.Connection con,
boolean autoCommit) |
protected abstract java.sql.Connection |
newMasterConnection() |
protected abstract java.sql.Connection |
newSlaveConnection() |
protected abstract java.sql.Connection |
newTrashConnection(java.lang.String tableName) |
void |
recycle() |
void |
rollback() |
void |
setAutoCommit(boolean autoCommit) |
public static final int TYPE_MASTER
public static final int TYPE_SLAVE
public static final int TYPE_TRASH
public static final int TYPE_FAKE
protected boolean autoCommit
public ConnectionSet(java.sql.Connection master, boolean autoCommit)
public java.sql.Connection getConnection()
protected abstract java.sql.Connection newMasterConnection()
protected abstract java.sql.Connection newSlaveConnection()
protected abstract java.sql.Connection newTrashConnection(java.lang.String tableName)
public java.sql.Connection getSlaveConnection()
public java.sql.Connection getTrashConnection(java.lang.String tableName, int defaultType)
public void commit() throws ru.bitel.bgbilling.common.BGException
commit
in interface ru.bitel.common.worker.Commitable
ru.bitel.bgbilling.common.BGException
public void recycle()
recycle
in interface ru.bitel.common.worker.Recyclable
public boolean getAutoCommit()
public void setAutoCommit(boolean autoCommit)
public void rollback()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public static final ConnectionSet newInstance(DefaultServerSetup setup, boolean autoCommit)
public static final ConnectionSet newInstance(DefaultServerSetup setup, java.sql.Connection con, boolean autoCommit)
public void close()
close
in interface java.lang.AutoCloseable