server/session.py
changeset 7665 0cd299c16f12
parent 7574 34154f48d255
child 7706 359bc86d2827
equal deleted inserted replaced
7664:e286216515d6 7665:0cd299c16f12
   756     @property
   756     @property
   757     def cnxset(self):
   757     def cnxset(self):
   758         """connections set, set according to transaction mode for each query"""
   758         """connections set, set according to transaction mode for each query"""
   759         if self._closed:
   759         if self._closed:
   760             self.free_cnxset(True)
   760             self.free_cnxset(True)
   761             raise Exception('try to access connections set on a closed session')
   761             raise Exception('try to access connections set on a closed session %s' % self.id)
   762         return getattr(self._threaddata, 'cnxset', None)
   762         return getattr(self._threaddata, 'cnxset', None)
   763 
   763 
   764     def set_cnxset(self):
   764     def set_cnxset(self):
   765         """the session need a connections set to execute some queries"""
   765         """the session need a connections set to execute some queries"""
   766         with self._closed_lock:
   766         with self._closed_lock:
   767             if self._closed:
   767             if self._closed:
   768                 self.free_cnxset(True)
   768                 self.free_cnxset(True)
   769                 raise Exception('try to set connections set on a closed session')
   769                 raise Exception('try to set connections set on a closed session %s' % self.id)
   770             if self.cnxset is None:
   770             if self.cnxset is None:
   771                 # get connections set first to avoid race-condition
   771                 # get connections set first to avoid race-condition
   772                 self._threaddata.cnxset = cnxset = self.repo._get_cnxset()
   772                 self._threaddata.cnxset = cnxset = self.repo._get_cnxset()
   773                 self._threaddata.ctx_count += 1
   773                 self._threaddata.ctx_count += 1
   774                 try:
   774                 try: