}
public static final synchronized int tx_begin ()
{
int toReturn = tx.TX_OK;
CurrentImple current = OTSImpleManager.current();
if (!__tx_allow_nesting)
{
/*
* Already have a transaction?
*/
try
{
Control control = current.get_control();
if (control != null)
{
/*
* Have a transaction already, and not allowed to
* create nested transactions!
*/
toReturn = tx.TX_PROTOCOL_ERROR;
control = null;
}
}
catch (Exception e)
{
// something went wrong!
toReturn = tx.TX_FAIL;
}
}
if (toReturn == tx.TX_OK)
{
try
{
current.begin();
}
catch (Exception e)
{
toReturn = tx.TX_FAIL;
}