|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.controller.requestmanager.RequestManager
This class defines the Request Manager.
The RM is composed of a Request Scheduler, an optional Query Cache, and a Load Balancer and an optional Recovery Log.
Field Summary | |
private long |
beginTimeout
|
private int |
cacheParsingranularity
|
private long |
commitTimeout
|
private DatabaseSchema |
dbs
|
private int |
execWriteRequestResult
|
private java.sql.ResultSet |
execWriteRequestWithKeysResult
|
protected AbstractLoadBalancer |
loadBalancer
The request load balancer to use to send requests to the databases |
private int |
loadBalancerParsingranularity
|
private static Trace |
logger
|
private ParsingCache |
parsingCache
|
protected AbstractRecoveryLog |
recoveryLog
An optional recovery log |
protected AbstractRequestCache |
requestCache
An optional request cache to cache responses to SQL requests |
private int |
requiredGranularity
|
private long |
rollbackTimeout
|
protected AbstractScheduler |
scheduler
The request scheduler to order and schedule requests |
private int |
schedulerParsingranularity
|
private boolean |
schemaIsStatic
|
private java.util.Hashtable |
tidLoginTable
|
private VirtualDatabase |
vdb
|
Constructor Summary | |
RequestManager(VirtualDatabase vdb,
AbstractScheduler scheduler,
AbstractLoadBalancer loadBalancer,
AbstractRecoveryLog recoveryLog,
long beginTimeout,
long commitTimeout,
long rollbackTimeout)
Creates a new RequestManager instance
without cache. |
|
RequestManager(VirtualDatabase vdb,
AbstractScheduler scheduler,
AbstractLoadBalancer loadBalancer,
long beginTimeout,
long commitTimeout,
long rollbackTimeout)
Creates a new RequestManager instance
without cache and log recovery. |
|
RequestManager(VirtualDatabase vdb,
AbstractScheduler scheduler,
AbstractRequestCache cache,
AbstractLoadBalancer loadBalancer,
AbstractRecoveryLog recoveryLog,
long beginTimeout,
long commitTimeout,
long rollbackTimeout)
Creates a new RequestManager instance. |
|
RequestManager(VirtualDatabase vdb,
AbstractScheduler scheduler,
AbstractRequestCache cache,
AbstractLoadBalancer loadBalancer,
long beginTimeout,
long commitTimeout,
long rollbackTimeout)
Creates a new RequestManager instance
without log recovery. |
Method Summary | |
private void |
addWorkerTask(BackendWorkerThread bwt,
AbstractTask task)
Add a task to a BackendWorkerThread using the proper synchronization. |
private void |
assignAndCheckSchedulerLoadBalancerValidity(AbstractScheduler scheduler,
AbstractLoadBalancer loadBalancer)
Check that Scheduler and Load Balancer are not null and have compatible RAIDb levels. |
int |
begin(java.lang.String login)
Begin a new transaction and return the corresponding transaction identifier. |
void |
commit(int transactionId)
Commit a transaction given its id. |
void |
disableBackend(DatabaseBackend db)
Disable a backend that is currently enabled on this virtual database. |
void |
disableBackendForCheckpoint(DatabaseBackend db,
java.lang.String checkpointName)
The backend must belong to this virtual database and be in the enabled state. |
void |
enableBackend(DatabaseBackend db)
Enable a backend that has been previously added to this virtual database and that is in the disabled state. |
void |
enableBackendFromCheckpoint(DatabaseBackend db,
java.lang.String checkpointName)
The backend must have been previously added to this virtual database and be in the disabled state. |
java.sql.ResultSet |
execReadRequest(SelectRequest request)
Perform a read request and return the reply. |
java.sql.ResultSet |
execReadStoredProcedure(StoredProcedure proc)
Call a stored procedure that returns a ResultSet. |
int |
execWriteRequest(AbstractWriteRequest request)
Perform a write request and return the number of rows affected Call first the scheduler (if defined), then notify the cache (if defined) and finally call the load balancer. |
private void |
execWriteRequest(AbstractWriteRequest request,
boolean useKeys)
Common code for execWriteRequest(AbstractWriteRequest) and execWriteRequestWithKeys(AbstractWriteRequest). |
java.sql.ResultSet |
execWriteRequestWithKeys(AbstractWriteRequest request)
Perform a write request and return the auto generated keys. |
int |
execWriteStoredProcedure(StoredProcedure proc)
Call a stored procedure that performs an update. |
DatabaseSchema |
getDatabaseSchema()
Get the DatabaseSchema used by this Request Manager. |
java.lang.String |
getInformation()
Get information about this Request Controller |
AbstractLoadBalancer |
getLoadBalancer()
Get the Request Load Balancer used in this Request Controller. |
AbstractRecoveryLog |
getRecoveryLog()
Returns the Recovery Log Manager. |
AbstractRequestCache |
getRequestCache()
Get the Request Cache (if any) used in this Request Controller. |
int |
getRequiredParsingGranularity()
|
AbstractScheduler |
getScheduler()
Get the Request Scheduler (if any) used in this Request Controller. |
java.lang.String |
getXmlInformation()
Get xml information about this Request Controller |
private void |
initRequestManagerVariables(VirtualDatabase vdb,
long beginTimeout,
long commitTimeout,
long rollbackTimeout)
Method initRequestManagerVariables. |
void |
mergeDatabaseSchema(DatabaseSchema backendSchema)
Merge the given schema with the existing database schema. |
void |
rollback(int transactionId)
Rollback a transaction given its id. |
void |
setBackgroundParsing(boolean backgroundParsing)
Sets the background parsing. |
void |
setCaseSensitiveParsing(boolean isCaseSensitiveParsing)
Sets the parsing case sensitivity. |
void |
setDatabaseSchema(DatabaseSchema schema,
boolean isStatic)
Sets the DatabaseSchema to be able to parse
the requests and find dependencies. |
void |
setLoadBalancer(AbstractLoadBalancer loadBalancer)
Set the Request Load Balancer to use in this Request Controller. |
void |
setRecoveryLog(AbstractRecoveryLog recoveryLog)
Sets the Recovery Log Manager. |
void |
setRequestCache(AbstractRequestCache cache)
Set the Request Cache to use in this Request Controller. |
void |
setScheduler(AbstractScheduler scheduler)
Set the Request Scheduler to use in this Request Controller. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private long beginTimeout
private long commitTimeout
private long rollbackTimeout
protected AbstractScheduler scheduler
protected AbstractRequestCache requestCache
protected AbstractLoadBalancer loadBalancer
protected AbstractRecoveryLog recoveryLog
private VirtualDatabase vdb
private DatabaseSchema dbs
private boolean schemaIsStatic
private ParsingCache parsingCache
private int schedulerParsingranularity
private int cacheParsingranularity
private int loadBalancerParsingranularity
private int requiredGranularity
private java.util.Hashtable tidLoginTable
private static Trace logger
private int execWriteRequestResult
private java.sql.ResultSet execWriteRequestWithKeysResult
Constructor Detail |
public RequestManager(VirtualDatabase vdb, AbstractScheduler scheduler, AbstractLoadBalancer loadBalancer, long beginTimeout, long commitTimeout, long rollbackTimeout) throws java.sql.SQLException
RequestManager
instance
without cache and log recovery.
vdb
- the virtual database this request manager belongs toscheduler
- the Request Scheduler to useloadBalancer
- the Request Load Balancer to usebeginTimeout
- timeout in seconds for begincommitTimeout
- timeout in seconds for commitrollbackTimeout
- timeout in seconds for rollback
java.sql.SQLException
- if an error occurspublic RequestManager(VirtualDatabase vdb, AbstractScheduler scheduler, AbstractRequestCache cache, AbstractLoadBalancer loadBalancer, long beginTimeout, long commitTimeout, long rollbackTimeout) throws java.sql.SQLException
RequestManager
instance
without log recovery.
vdb
- the virtual database this request manager belongs toscheduler
- the Request Scheduler to usecache
- a Query Cache implementationloadBalancer
- the Request Load Balancer to usebeginTimeout
- timeout in seconds for begincommitTimeout
- timeout in seconds for commitrollbackTimeout
- timeout in seconds for rollback
java.sql.SQLException
- if an error occurspublic RequestManager(VirtualDatabase vdb, AbstractScheduler scheduler, AbstractLoadBalancer loadBalancer, AbstractRecoveryLog recoveryLog, long beginTimeout, long commitTimeout, long rollbackTimeout) throws java.sql.SQLException
RequestManager
instance
without cache.
vdb
- the virtual database this request manager belongs toscheduler
- the Request Scheduler to useloadBalancer
- the Request Load Balancer to userecoveryLog
- the Log Recovery to usebeginTimeout
- timeout in seconds for begincommitTimeout
- timeout in seconds for commitrollbackTimeout
- timeout in seconds for rollback
java.sql.SQLException
- if an error occurspublic RequestManager(VirtualDatabase vdb, AbstractScheduler scheduler, AbstractRequestCache cache, AbstractLoadBalancer loadBalancer, AbstractRecoveryLog recoveryLog, long beginTimeout, long commitTimeout, long rollbackTimeout) throws java.sql.SQLException
RequestManager
instance.
vdb
- the virtual database this request manager belongs toscheduler
- the Request Scheduler to usecache
- a Query Cache implementationloadBalancer
- the Request Load Balancer to userecoveryLog
- the Log Recovery to usebeginTimeout
- timeout in seconds for begincommitTimeout
- timeout in seconds for commitrollbackTimeout
- timeout in seconds for rollback
java.sql.SQLException
- if an error occursMethod Detail |
private void assignAndCheckSchedulerLoadBalancerValidity(AbstractScheduler scheduler, AbstractLoadBalancer loadBalancer) throws java.sql.SQLException
scheduler
- loadBalancer
-
java.sql.SQLException
- if an error occursprivate void initRequestManagerVariables(VirtualDatabase vdb, long beginTimeout, long commitTimeout, long rollbackTimeout)
vdb
- beginTimeout
- commitTimeout
- rollbackTimeout
- public java.sql.ResultSet execReadRequest(SelectRequest request) throws java.sql.SQLException
request
- the request to execute
java.sql.ResultSet
value
java.sql.SQLException
- if an error occurspublic int execWriteRequest(AbstractWriteRequest request) throws java.sql.SQLException
request
- the request to execute
java.sql.SQLException
- if an error occurspublic java.sql.ResultSet execWriteRequestWithKeys(AbstractWriteRequest request) throws java.sql.SQLException
request
- the request to execute
java.sql.SQLException
- if an error occursprivate void execWriteRequest(AbstractWriteRequest request, boolean useKeys) throws java.sql.SQLException
request
- the request to executeuseKeys
- true if this must give an auto generated keys ResultSet
java.sql.SQLException
- if an error occurspublic java.sql.ResultSet execReadStoredProcedure(StoredProcedure proc) throws java.sql.SQLException
proc
- the stored procedure call
java.sql.ResultSet
value
java.sql.SQLException
- if an error occurspublic int execWriteStoredProcedure(StoredProcedure proc) throws java.sql.SQLException
proc
- the stored procedure call
java.sql.SQLException
- if an error occurspublic int begin(java.lang.String login) throws java.sql.SQLException
login
- the login used by the connection
java.sql.SQLException
- if an error occurspublic void commit(int transactionId) throws java.sql.SQLException
transactionId
- the transaction id
java.sql.SQLException
- if an error occurspublic void rollback(int transactionId) throws java.sql.SQLException
transactionId
- the transaction id
java.sql.SQLException
- if an error occurspublic void enableBackend(DatabaseBackend db) throws java.sql.SQLException
The backend is enabled without further check.
The enableBackend method of the load balancer is called.
db
- The database backend to enable
java.sql.SQLException
- if an error occursprivate void addWorkerTask(BackendWorkerThread bwt, AbstractTask task)
bwt
- BackendWorkerThread to synchronize ontask
- the task to add to the thread queuepublic void enableBackendFromCheckpoint(DatabaseBackend db, java.lang.String checkpointName) throws java.sql.SQLException
All the queries since the given checkpoint are played and the backend state is set to enabled when it is completely synchronized.
db
- The database backend to enablecheckpointName
- The checkpoint name to restart from
java.sql.SQLException
- if an error occurspublic void disableBackend(DatabaseBackend db) throws java.sql.SQLException
The backend is disabled without further check.
The load balancer disabled method is called on the specified backend.
db
- The database backend to disable
java.sql.SQLException
- if an error occurspublic void disableBackendForCheckpoint(DatabaseBackend db, java.lang.String checkpointName) throws java.sql.SQLException
The backend is disabled once all the pending write queries are executed. A checkpoint is inserted in the recovery log.
db
- The database backend to enablecheckpointName
- The checkpoint name to restart from
java.sql.SQLException
- if an error occurspublic void setDatabaseSchema(DatabaseSchema schema, boolean isStatic)
DatabaseSchema
to be able to parse
the requests and find dependencies.
schema
- a DatabaseSchema
valueisStatic
- true if the given schema is staticpublic void mergeDatabaseSchema(DatabaseSchema backendSchema)
backendSchema
- The virtual database schema to merge.public DatabaseSchema getDatabaseSchema()
DatabaseSchema
used by this Request Manager.
DatabaseSchema
valuepublic AbstractLoadBalancer getLoadBalancer()
AbstractLoadBalancer
valuepublic void setLoadBalancer(AbstractLoadBalancer loadBalancer)
loadBalancer
- a Request Load Balancer implementationpublic AbstractRequestCache getRequestCache()
AbstractRequestCache
value or null if no Request Cache has been definedpublic AbstractRecoveryLog getRecoveryLog()
public void setRecoveryLog(AbstractRecoveryLog recoveryLog)
recoveryLog
- The log recovery to setpublic void setRequestCache(AbstractRequestCache cache)
cache
- a Request Cache implementationpublic AbstractScheduler getScheduler()
AbstractScheduler
value or null if no Request Scheduler has been definedpublic void setScheduler(AbstractScheduler scheduler)
scheduler
- a Request Scheduler implementationpublic void setBackgroundParsing(boolean backgroundParsing)
backgroundParsing
- The backgroundParsing to setpublic void setCaseSensitiveParsing(boolean isCaseSensitiveParsing)
isCaseSensitiveParsing
- true if parsing is case sensitivepublic int getRequiredParsingGranularity()
public java.lang.String getXmlInformation()
String
in xml formatted textpublic java.lang.String getInformation()
String
containing information
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |