|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread
This class handles a connection with a C-JDBC driver.
Field Summary | |
private boolean |
closed
|
private Controller |
controller
|
private long |
currentTid
The following variables represent the state of the connection with the client |
private CJDBCInputStream |
in
|
private boolean |
isKilled
true ifthis has been killed. |
private Trace |
logger
Logger instance. |
private java.lang.String |
login
|
(package private) boolean |
needSkeleton
Do we require the templates of PreparedStatements? |
private CJDBCOutputStream |
out
|
private boolean |
queryExecutedInThisTransaction
|
private java.util.HashMap |
streamedResultSet
|
private int |
transactionIsolation
|
private boolean |
transactionStarted
|
private VirtualDatabaseUser |
user
|
private VirtualDatabase |
vdb
Virtual database instantiating this thread. |
private boolean |
waitForCommand
|
private boolean |
writeQueryExecutedInThisTransaction
|
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
VirtualDatabaseWorkerThread(Controller controller,
VirtualDatabase vdb)
Creates a new VirtualDatabaseWorkerThread instance. |
Method Summary | |
private void |
begin()
|
private void |
close()
|
private void |
closeRemoteResultSet()
|
private void |
commit()
|
private void |
connectionGetCatalog()
|
private void |
connectionGetCatalogs()
|
private void |
connectionSetCatalog()
|
private void |
connectionSetTransactionIsolation()
|
private void |
databaseMetaDataGetAttributes()
|
private void |
databaseMetaDataGetBestRowIdentifier()
|
private void |
databaseMetaDataGetColumnPrivileges()
|
private void |
databaseMetaDataGetColumns()
|
private void |
databaseMetaDataGetCrossReference()
|
private void |
databaseMetaDataGetDatabaseProductName()
|
private void |
databaseMetaDataGetExportedKeys()
|
private void |
databaseMetaDataGetImportedKeys()
|
private void |
databaseMetaDataGetIndexInfo()
|
private void |
databaseMetaDataGetPrimaryKeys()
|
private void |
databaseMetaDataGetProcedureColumns()
|
private void |
databaseMetaDataGetProcedures()
|
private void |
databaseMetaDataGetSchemas()
|
private void |
databaseMetaDataGetSuperTables()
|
private void |
databaseMetaDataGetSuperTypes()
|
private void |
databaseMetaDataGetTablePrivileges()
|
private void |
databaseMetaDataGetTables()
|
private void |
databaseMetaDataGetTableTypes()
|
private void |
databaseMetaDataGetTypeInfo()
|
private void |
databaseMetaDataGetUDTs()
|
private void |
databaseMetaDataGetVersionColumns()
|
private void |
databaseStaticMetadata()
Get the static metadata key from the socket and return the corresponding metadata. |
private AbstractWriteRequest |
decodeWriteRequestFromStream()
Read a write request send by the Connection object. |
private void |
execReadRequest()
|
private void |
execReadStoredProcedure()
|
private void |
execWriteRequest()
|
private void |
execWriteRequestWithKeys()
execWriteRequestWithKeys() will probably have soon no difference with execWriteRequest() anymore; then we can get rid of it. |
private void |
execWriteStoredProcedure()
|
private void |
fetchNextResultSetRows()
Implements streaming: send the next ResultSet chunk to driver, pulling it from ControllerResultSet. |
private void |
getControllerVersionNumber()
|
long |
getTimeActive()
Get time active |
java.lang.String |
getUser()
|
private void |
getVirtualDatabaseName()
|
private void |
putStreamingReferences(ControllerResultSet crs,
DriverResultSet drs)
Keep a reference to both ResultSets, but garbage collect data already sent. |
private void |
releaseSavepoint()
|
private void |
reset()
|
private void |
restoreConnectionState()
|
java.lang.String[] |
retrieveClientData()
Retrieve general information on this client |
private void |
rollback()
|
private void |
rollbackToSavepoint()
|
void |
run()
Gets a connection from the connection queue and process it. |
private void |
sendToDriver(boolean b)
Send a protocol boolean, prefixed with the appropriate TypeTag |
private void |
sendToDriver(DriverResultSet drs)
Serialize a DriverResultSet answer, prefixed with the appropriate TypeTag |
private void |
sendToDriver(java.lang.Exception e)
|
private void |
sendToDriver(int i)
Send a protocol int, prefixed with the appropriate TypeTag |
private void |
sendToDriver(long l)
Send a protocol long, prefixed with the appropriate TypeTag |
private void |
sendToDriver(java.lang.String str)
Send a protocol String, prefixed with the appropriate TypeTag |
private void |
setAutoCommit()
|
private void |
setNamedSavepoint()
|
private boolean |
setRequestParameters(AbstractRequest request,
java.lang.String login,
long tid,
boolean transactionStarted)
Set the login and transaction id on the given request. |
private void |
setUnnamedSavepoint()
|
void |
shutdown()
Shutdown this thread by setting isKilled value to true. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private boolean isKilled
true
ifthis has been killed.
boolean needSkeleton
private VirtualDatabase vdb
private Trace logger
private CJDBCInputStream in
private CJDBCOutputStream out
private VirtualDatabaseUser user
private Controller controller
private boolean waitForCommand
private java.util.HashMap streamedResultSet
private long currentTid
private boolean transactionStarted
private boolean queryExecutedInThisTransaction
private boolean writeQueryExecutedInThisTransaction
private java.lang.String login
private boolean closed
private int transactionIsolation
Constructor Detail |
public VirtualDatabaseWorkerThread(Controller controller, VirtualDatabase vdb)
VirtualDatabaseWorkerThread
instance.
controller
- the thread was originated fromvdb
- the virtual database instantiating this thread.Method Detail |
private AbstractWriteRequest decodeWriteRequestFromStream() throws java.io.IOException
Connection
object. Only the
needed parameters are sent, so we can reconstruct the object on the
controller side, without serializing everything.
AbstractWriteRequest
java.io.IOException
AbstractRequest.AbstractRequest(CJDBCInputStream, int)
private boolean setRequestParameters(AbstractRequest request, java.lang.String login, long tid, boolean transactionStarted) throws java.sql.SQLException
request
- The request to setlogin
- user login to settid
- the transaction id to set
java.sql.SQLException
private void putStreamingReferences(ControllerResultSet crs, DriverResultSet drs)
public void run()
private void close() throws java.io.IOException
java.io.IOException
private void closeRemoteResultSet() throws java.io.IOException
java.io.IOException
private void reset()
private void restoreConnectionState() throws java.io.IOException
java.io.IOException
private void connectionSetCatalog() throws java.io.IOException
java.io.IOException
private void connectionGetCatalog() throws java.io.IOException
java.io.IOException
private void connectionGetCatalogs() throws java.io.IOException
java.io.IOException
private void connectionSetTransactionIsolation() throws java.io.IOException
java.io.IOException
private void databaseMetaDataGetAttributes() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getAttributes(java.lang.String,
java.lang.String, java.lang.String, java.lang.String)
private void databaseMetaDataGetBestRowIdentifier() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getBestRowIdentifier(java.lang.String,
java.lang.String, java.lang.String, int, boolean)
private void databaseMetaDataGetColumnPrivileges() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getColumnPrivileges(java.lang.String,
java.lang.String, java.lang.String, java.lang.String)
private void databaseMetaDataGetColumns() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getColumns(java.lang.String,
java.lang.String, java.lang.String, java.lang.String)
private void databaseMetaDataGetCrossReference() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getCrossReference(java.lang.String,
java.lang.String, java.lang.String, java.lang.String,
java.lang.String, java.lang.String)
private void databaseMetaDataGetDatabaseProductName() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getDatabaseProductName()
private void databaseMetaDataGetExportedKeys() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getExportedKeys(java.lang.String,
java.lang.String, java.lang.String)
private void databaseMetaDataGetImportedKeys() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getImportedKeys(java.lang.String,
java.lang.String, java.lang.String)
private void databaseMetaDataGetIndexInfo() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getIndexInfo(java.lang.String,
java.lang.String, java.lang.String, boolean, boolean)
private void databaseMetaDataGetPrimaryKeys() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getPrimaryKeys(java.lang.String,
java.lang.String, java.lang.String)
private void databaseMetaDataGetProcedureColumns() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getProcedureColumns(java.lang.String,
java.lang.String, java.lang.String, java.lang.String)
private void databaseMetaDataGetProcedures() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getProcedures(java.lang.String,
java.lang.String, java.lang.String)
private void databaseMetaDataGetSchemas() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getSchemas()
private void databaseMetaDataGetSuperTables() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getSuperTables(java.lang.String,
java.lang.String, java.lang.String)
private void databaseMetaDataGetSuperTypes() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getSuperTypes(java.lang.String,
java.lang.String, java.lang.String)
private void databaseMetaDataGetTablePrivileges() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getTablePrivileges(java.lang.String,
java.lang.String, java.lang.String)
private void databaseMetaDataGetTables() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getTables(java.lang.String,
java.lang.String, java.lang.String, java.lang.String[])
private void databaseMetaDataGetTableTypes() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getTableTypes()
private void databaseMetaDataGetTypeInfo() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getTypeInfo()
private void databaseMetaDataGetUDTs() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getUDTs(java.lang.String, java.lang.String,
java.lang.String, int[])
private void databaseMetaDataGetVersionColumns() throws java.io.IOException
java.io.IOException
DatabaseMetaData.getVersionColumns(java.lang.String,
java.lang.String, java.lang.String)
private void databaseStaticMetadata() throws java.io.IOException, NotImplementedException
java.io.IOException
- if an IO error occurs
NotImplementedException
- if the underlying metadata access method is
not implementedprivate void getControllerVersionNumber() throws java.io.IOException
java.io.IOException
private void getVirtualDatabaseName() throws java.io.IOException
java.io.IOException
private void begin() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
private void commit() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
private void rollback() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
private void setAutoCommit() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
private void setNamedSavepoint() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
private void setUnnamedSavepoint() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
private void releaseSavepoint() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
private void rollbackToSavepoint() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
private void execReadRequest() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
private void execReadStoredProcedure() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
private void execWriteRequest() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
private void execWriteRequestWithKeys() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
private void execWriteStoredProcedure() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
private void sendToDriver(DriverResultSet drs) throws java.io.IOException
drs
- the resultset to send
java.io.IOException
- stream errorprivate void sendToDriver(java.lang.String str) throws java.io.IOException
java.io.IOException
private void sendToDriver(boolean b) throws java.io.IOException
java.io.IOException
private void sendToDriver(int i) throws java.io.IOException
java.io.IOException
private void sendToDriver(long l) throws java.io.IOException
java.io.IOException
private void sendToDriver(java.lang.Exception e) throws java.io.IOException
java.io.IOException
private void fetchNextResultSetRows() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
AbstractLoadBalancer.executeSelectRequestOnBackend(SelectRequest,
org.objectweb.cjdbc.controller.backend.DatabaseBackend, Connection,
org.objectweb.cjdbc.controller.cache.metadata.MetadataCache)
,
ControllerResultSet.fetchData(int)
public java.lang.String[] retrieveClientData()
public long getTimeActive()
public java.lang.String getUser()
public void shutdown()
isKilled
value to true. This
gives time to check for needed rollback transactions
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |