public class ThreadInsert extends SimpleInsert implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
private javax.sql.DataSource |
ds |
private java.sql.SQLException |
loadExceptions |
private ThreadInsert |
master
The main ThreadInsert, created by the main
thread and holds the valid nextWarehouse.
|
private short |
nextWarehouse
Next warehouse that needs to be populated.
|
private int |
threadCount |
conn, random, scale, seed
CUSTOMER_COUNT_W, DISTRICT_COUNT_W, HISTORY_COUNT_W, ITEM_COUNT, NEWORDERS_BREAKPOINT, NEWORDERS_COUNT_W, ORDERLINE_COUNT_WV, ORDERS_COUNT_W, STOCK_COUNT_W
Modifier | Constructor and Description |
---|---|
|
ThreadInsert(javax.sql.DataSource ds)
Create a ThreadInsert loader.
|
private |
ThreadInsert(ThreadInsert master) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addException(java.sql.SQLException sqle)
Save all the exceptions seen during load.
|
(package private) short |
getNextWarehouse()
Get the next warehouse to populate.
|
void |
populateAllTables()
Populate the database.
|
void |
run()
Run the load for a thread.
|
void |
setThreadCount(int threadCount)
Set the thread count.
|
void |
setupLoad(java.sql.Connection conn,
short scale)
Initialize the load by calling the super-class's method
and default the number of threads to the smaller of the number
of cpus and the scale.
|
private void |
threadPopulate()
Populate the database using multiple threads.
|
customerTable, districtTable, itemTable, orderTable, populateForOneWarehouse, setRandomGenerator, setSeed, setupConnection, stockTable, warehouseTable
private final ThreadInsert master
private java.sql.SQLException loadExceptions
private int threadCount
private javax.sql.DataSource ds
private short nextWarehouse
public ThreadInsert(javax.sql.DataSource ds)
ds
- getConnection() will be used to create connections
for the spaened threads.private ThreadInsert(ThreadInsert master)
public void setupLoad(java.sql.Connection conn, short scale) throws java.sql.SQLException
setupLoad
in interface Load
setupLoad
in class SimpleInsert
conn
- -
database connectionscale
- -
scale of the database. The WAREHOUSE table is used as the base
unit of scaling.java.sql.SQLException
public void setThreadCount(int threadCount)
setThreadCount
in interface Load
setThreadCount
in class SimpleInsert
threadCount
- Number of threads to use if loading supports
multiple threading.public void populateAllTables() throws java.lang.Exception
populateAllTables
in interface Load
populateAllTables
in class SimpleInsert
java.sql.SQLException
java.lang.Exception
private void threadPopulate() throws java.sql.SQLException, java.lang.InterruptedException
java.sql.SQLException
java.lang.InterruptedException
short getNextWarehouse()
void addException(java.sql.SQLException sqle)
public void run()
run
in interface java.lang.Runnable
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.