use of org.apache.derby.iapi.store.access.AccessFactory in project derby by apache.
the class ResourceAdapterImpl method boot.
/*
* Module control
*/
public void boot(boolean create, Properties properties) throws StandardException {
// we can only run on jdk1.2 or beyond with JTA and JAVA 20 extension
// loaded.
connectionTable = new Hashtable<XAXactId, XATransactionState>();
AccessFactory af = (AccessFactory) findServiceModule(this, AccessFactory.MODULE);
rm = (XAResourceManager) af.getXAResourceManager();
active = true;
}
use of org.apache.derby.iapi.store.access.AccessFactory in project derby by apache.
the class StreamFileContainer method getContainerProperties.
/**
* Request the system properties associated with a stream container.
* <p>
* Request the value of properties associated with a stream container.
* The following properties can be requested:
* derby.storage.streamFileBufferSize
*
* <p>
* To get the value of a particular property add it to the property list,
* and on return the value of the property will be set to it's current
* value. For example:
*
* get_prop(ConglomerateController cc)
* {
* Properties prop = new Properties();
* prop.put("derby.storage.streamFileBufferSize", "");
* cc.getContainerProperties(prop);
*
* System.out.println(
* "stream table's buffer size = " +
* prop.getProperty("derby.storage.streamFileBufferSize");
* }
*
* @param prop Property list to fill in.
*
* @exception StandardException Standard exception policy.
*/
public void getContainerProperties(Properties prop) throws StandardException {
AccessFactory af = (AccessFactory) getServiceModule(dataFactory, AccessFactory.MODULE);
TransactionController tc = (af == null) ? null : af.getTransaction(getContextService().getCurrentContextManager());
bufferSize = PropertyUtil.getServiceInt(tc, prop, RawStoreFactory.STREAM_FILE_BUFFER_SIZE_PARAMETER, RawStoreFactory.STREAM_FILE_BUFFER_SIZE_MINIMUM, RawStoreFactory.STREAM_FILE_BUFFER_SIZE_MAXIMUM, RawStoreFactory.STREAM_FILE_BUFFER_SIZE_DEFAULT);
}
use of org.apache.derby.iapi.store.access.AccessFactory in project derby by apache.
the class LogToFile method performWork.
public int performWork(ContextManager context) {
synchronized (this) {
if (corrupt != null)
// don't do this again.
return Serviceable.DONE;
}
// check to see if checkpointInterval and logSwitchInterval has changed
AccessFactory af = (AccessFactory) getServiceModule(this, AccessFactory.MODULE);
try {
if (af != null) {
TransactionController tc = null;
try {
tc = af.getAndNameTransaction(context, AccessFactoryGlobals.SYS_TRANS_NAME);
getLogFactoryProperties(tc);
} finally {
if (tc != null)
tc.commit();
}
}
// checkpoint will start its own internal transaction on the current
// context.
rawStoreFactory.checkpoint();
} catch (StandardException se) {
Monitor.logTextMessage(MessageId.LOG_CHECKPOINT_EXCEPTION);
logErrMsg(se);
} catch (ShutdownException shutdown) {
// If we are shutting down, just ignore the error and let the
// system go down without printing errors to the log.
}
checkpointDaemonCalled = false;
return Serviceable.DONE;
}
use of org.apache.derby.iapi.store.access.AccessFactory in project derby by apache.
the class D_DiagnosticUtil method diag_conglomid.
/**
* Given a Database name and conglomid, return diagnositic string.
* <p>
* Return a string with diagnostic information about a particular
* conglomerate, can be called for any type of conglomerate (some types
* may not return any info though).
* <p>
* Can be called from ij to find out info about conglomid 19 in database
* 'msgdb' by using the following syntax:
*
* values
* com.ibm.db2j.protocol.BasicServices.Diagnostic.T_Diagnosticable::
* diag_conglomid('msgdb', 19);
* maximumdisplaywidth 9000;
*
* CREATE FUNCTION DIAG_CONGLOMID(DBNAME VARCHAR(128), CONGLOMID INT)
* RETURNS VARCHAR(32000) RETURNS NULL ON NULL INPUT
* EXTERNAL NAME
* 'org.apache.derby.impl.store.raw.data.D_DiagnosticUtil.diag_conglomid'
* LANGUAGE JAVA PARAMETER STYLE JAVA;
*
* values DIAG_CONGLOMID('msgdb', 19);
* com.ibm.db2j.protocol.BasicServices.Diagnostic.T_Diagnosticable::
* diag_conglomid_print('msgdb', 19);
*
* RESOLVE - An interface that takes a table name would be nice.
*
* @param db_name name of the database
* @param conglomid conglomerate id of the conglomerate to debug
*
* @exception StandardException Standard exception policy.
*/
public static String diag_conglomid(String db_name, long conglomid) throws StandardException {
String ret_string = null;
AccessFactory store_module = null;
store_module = (AccessFactory) getModuleFromDbName(db_name);
if (store_module != null) {
TransactionController tc = store_module.getTransaction(FileContainer.getContextService().getCurrentContextManager());
ConglomerateController open_table = tc.openConglomerate(conglomid, false, 0, TransactionController.MODE_TABLE, TransactionController.ISOLATION_SERIALIZABLE);
open_table.debugConglomerate();
Diagnosticable diag_obj = DiagnosticUtil.findDiagnostic(open_table);
ret_string = diag_obj.diag();
open_table.close();
} else {
System.out.println("Could not find module for database: " + db_name);
}
return (ret_string);
}
use of org.apache.derby.iapi.store.access.AccessFactory in project derby by apache.
the class T_Access method waitForPostCommitToFinish.
/*
*Followng call waits until post commit thread queue is empty.
*This call is useful for tests which checks for the following type
*of cases:
* 1) Checking for space usage after delete statements
* 2) Checking for locks when delete statements are involved,
* because post commit thread might be holding locks when
* checking for snap shot of locks, so best thing to do
* to get consistent results is to call the following function
* before checking for locks (eg: store/updatelocks.sql)
* 3) Depending on whethere the space is not released yet by the post commit thread
* for commited deletes or not can change the order of rows in the heap.
* In such cases , it is good idea to call this method before doing
* inserts(Even adding/dropping constraints can have effect because they
* do inderectly deletes/inserts on system tables.) eg: lang/fk_nonsps.sql
*/
public static void waitForPostCommitToFinish() throws SQLException {
AccessFactory af = getAccessFactory();
af.waitForPostCommitToFinishWork();
}
Aggregations