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, seedCUSTOMER_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, warehouseTableprivate 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 LoadsetupLoad in class SimpleInsertconn - -
database connectionscale - -
scale of the database. The WAREHOUSE table is used as the base
unit of scaling.java.sql.SQLExceptionpublic void setThreadCount(int threadCount)
setThreadCount in interface LoadsetThreadCount in class SimpleInsertthreadCount - Number of threads to use if loading supports
multiple threading.public void populateAllTables()
throws java.lang.Exception
populateAllTables in interface LoadpopulateAllTables in class SimpleInsertjava.sql.SQLExceptionjava.lang.Exceptionprivate void threadPopulate()
throws java.sql.SQLException,
java.lang.InterruptedException
java.sql.SQLExceptionjava.lang.InterruptedExceptionshort getNextWarehouse()
void addException(java.sql.SQLException sqle)
public void run()
run in interface java.lang.RunnableApache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.