#NEWLINE# def __init__( self , store , subject , lease_time = None , token = None ) : #NEWLINE# #INDENT# 'Ensure we can take a lock on this subject.' #NEWLINE# super ( MySQLTransaction , self ) . __init__ ( store , subject , lease_time = lease_time , token = token ) #NEWLINE# if ( lease_time is None ) : #NEWLINE# #INDENT# lease_time = config_lib . CONFIG [ 'Datastore.transaction_timeout' ] #NEWLINE# #UNINDENT# self . lock_token = thread . get_ident ( ) #NEWLINE# self . lock_time = lease_time #NEWLINE# self . expires_lock = int ( ( ( time . time ( ) + self . lock_time ) * 1000000.0 ) ) #NEWLINE# query = 'UPDATE locks SET lock_expiration=%s, lock_owner=%s WHERE subject_hash=unhex(md5(%s)) AND (lock_expiration < %s)' #NEWLINE# args = [ self . expires_lock , self . lock_token , subject , ( time . time ( ) * 1000000.0 ) ] #NEWLINE# self . store . ExecuteQuery ( subject , args ) #NEWLINE# self . _CheckForLock ( )