|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.AbstractBatcher
public abstract class AbstractBatcher
This is an abstract class for batchers that are connected to a
single DbControl
object. It implements all methods in the
Batcher
interface except the Batcher.flush()
method.
A subclass may also have to override the close()
method
if it has opened connections or statements to the database.
Field Summary | |
---|---|
private int |
batchSize
SQL command batch size. |
private WeakReference<DbControl> |
dc
A reference to the current DbControl object. |
protected static boolean |
debugSqlEnabled
So we don't always have to call logSql.debug() |
protected static Logger |
logSql
Log all SQL statements. |
private SessionControl |
sc
|
Constructor Summary | |
---|---|
AbstractBatcher()
Constructor for a batcher. |
Method Summary | |
---|---|
(package private) void |
analyzeTable(String catalog,
String schema,
String table)
Update index statistics for a table. |
void |
close()
Flush the batcher and close it. |
int |
getBatchSize()
Get the current batch size of the batcher. |
DbControl |
getDbControl()
Get the DbControl object that currently manages this batcher. |
SessionControl |
getSessionControl()
Get the SessionControl object that manages this item. |
boolean |
isClosed()
Check if this batcher is closed or not. |
(package private) void |
onBeforeClose()
Let a subclass cleanup itself before the connection to the database is closed. |
void |
setBatchSize(int batchSize)
Sets the batch size. |
protected void |
setDbControl(DbControl dc)
Set the DbControl that is controlling this batcher. |
(package private) void |
updateLastAccess()
Update the last access time so the session control doesn't get cleaned up. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.basedb.core.Batcher |
---|
flush |
Field Detail |
---|
protected static final Logger logSql
protected static final boolean debugSqlEnabled
private SessionControl sc
private WeakReference<DbControl> dc
private int batchSize
Constructor Detail |
---|
AbstractBatcher()
BaseException
- If there is an errorMethod Detail |
---|
public int getBatchSize()
Batcher
getBatchSize
in interface Batcher
public void setBatchSize(int batchSize)
Batcher
setBatchSize
in interface Batcher
batchSize
- Size of the batch, or 0 to disable automatic flushingpublic final boolean isClosed()
DbControl
or if the DbControl
it is attached to has been closed.
isClosed
in interface Batcher
Batcher.close()
public final void close() throws BaseException
Batcher
DbControl
to connect to the database
will automatically be closed when the DbControl
is closed.
close
in interface Batcher
BaseException
- If there is an errorBatcher.isClosed()
,
Batcher.flush()
void updateLastAccess()
protected final void setDbControl(DbControl dc)
DbControl.addBatcher(Batcher)
public final DbControl getDbControl() throws ConnectionClosedException
DbControl
object that currently manages this batcher.
ConnectionClosedException
- If the batcher is connected to a closed
DbControl
object, or not connected at allpublic final SessionControl getSessionControl() throws ConnectionClosedException
SessionControl
object that manages this item.
ConnectionClosedException
- If the item is connected to a closed
DbControl
object, or not connected at allvoid onBeforeClose() throws BaseException
close()
method after Batcher.flush()
has been called but before the connection
to the database is lost. Typical use of this method is to update
properties on parent object (for example, spot count) and to close
open SQL statements.
BaseException
void analyzeTable(String catalog, String schema, String table)
DbEngine.analyzeAfterBatchOperation()
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |