本文整理汇总了Python中Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB.hasInstance方法的典型用法代码示例。如果您正苦于以下问题:Python SQLiteCacheDB.hasInstance方法的具体用法?Python SQLiteCacheDB.hasInstance怎么用?Python SQLiteCacheDB.hasInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB
的用法示例。
在下文中一共展示了SQLiteCacheDB.hasInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tearDown
# 需要导入模块: from Tribler.Core.CacheDB.sqlitecachedb import SQLiteCacheDB [as 别名]
# 或者: from Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB import hasInstance [as 别名]
def tearDown(self):
if SQLiteCacheDB.hasInstance():
SQLiteCacheDB.getInstance().close_all()
SQLiteCacheDB.delInstance()
if Session.has_instance(): # Upgrading will create a session instance
Session.del_instance()
sqlitecachedb.INITIAL_UPGRADE_PAUSE, sqlitecachedb.SUCCESIVE_UPGRADE_PAUSE, sqlitecachedb.UPGRADE_BATCH_SIZE, sqlitecachedb.TEST_OVERRIDE = self.original_values
self.tearDownCleanup()
示例2: tearDown
# 需要导入模块: from Tribler.Core.CacheDB.sqlitecachedb import SQLiteCacheDB [as 别名]
# 或者: from Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB import hasInstance [as 别名]
def tearDown(self):
self.torrentChecking.shutdown()
TorrentChecking.delInstance()
if SQLiteCacheDB.hasInstance():
SQLiteCacheDB.getInstance().close_all()
SQLiteCacheDB.delInstance()
TorrentDBHandler.delInstance()
MyPreferenceDBHandler.delInstance()
NetworkBuzzDBHandler.delInstance()
self.tearDownCleanup()
示例3: tearDown
# 需要导入模块: from Tribler.Core.CacheDB.sqlitecachedb import SQLiteCacheDB [as 别名]
# 或者: from Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB import hasInstance [as 别名]
def tearDown(self):
self.annotate(self._testMethodName, start=False)
""" unittest test tear down code """
if self.session is not None:
self._shutdown_session(self.session)
Session.del_instance()
time.sleep(10)
gc.collect()
ts = enumerate_threads()
print >> sys.stderr, "test_as_server: Number of threads still running", len(ts)
for t in ts:
print >> sys.stderr, "test_as_server: Thread still running", t.getName(), "daemon", t.isDaemon(), "instance:", t
if SQLiteCacheDB.hasInstance():
SQLiteCacheDB.getInstance().close_all()
SQLiteCacheDB.delInstance()
self.tearDownCleanup()
示例4: tearDown
# 需要导入模块: from Tribler.Core.CacheDB.sqlitecachedb import SQLiteCacheDB [as 别名]
# 或者: from Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB import hasInstance [as 别名]
def tearDown(self):
if SQLiteCacheDB.hasInstance():
SQLiteCacheDB.getInstance().close_all()
SQLiteCacheDB.delInstance()
self.tearDownCleanup()
示例5: OnExit
# 需要导入模块: from Tribler.Core.CacheDB.sqlitecachedb import SQLiteCacheDB [as 别名]
# 或者: from Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB import hasInstance [as 别名]
def OnExit(self):
print >> sys.stderr, "main: ONEXIT"
self.ready = False
self.done = True
# write all persistent data to disk
if self.i2is:
self.i2is.shutdown()
if self.torrentfeed:
self.torrentfeed.shutdown()
self.torrentfeed.delInstance()
if self.webUI:
self.webUI.stop()
if self.guiserver:
self.guiserver.shutdown(True)
self.guiserver.delInstance()
if self.videoplayer:
self.videoplayer.shutdown()
self.videoplayer.delInstance()
delete_status_holders()
if self.frame:
self.frame.Destroy()
del self.frame
# Don't checkpoint, interferes with current way of saving Preferences,
# see Tribler/Main/Dialogs/abcoption.py
if self.utility:
# Niels: lets add a max waiting time for this session shutdown.
session_shutdown_start = time()
self.utility.session.shutdown(hacksessconfcheckpoint=False)
# Arno, 2012-07-12: Shutdown should be quick
# Niels, 2013-03-21: However, setting it too low will prevent checkpoints from being written to disk
waittime = 60
while not self.utility.session.has_shutdown():
diff = time() - session_shutdown_start
if diff > waittime:
print >> sys.stderr, "main: ONEXIT NOT Waiting for Session to shutdown, took too long"
break
print >> sys.stderr, "main: ONEXIT Waiting for Session to shutdown, will wait for an additional %d seconds" % (waittime - diff)
sleep(3)
print >> sys.stderr, "main: ONEXIT Session is shutdown"
try:
print >> sys.stderr, "main: ONEXIT cleaning database"
peerdb = self.utility.session.open_dbhandler(NTFY_PEERS)
peerdb._db.clean_db(randint(0, 24) == 0, exiting=True)
except:
print_exc()
print >> sys.stderr, "main: ONEXIT deleting instances"
Session.del_instance()
GUIUtility.delInstance()
GUIDBProducer.delInstance()
DefaultDownloadStartupConfig.delInstance()
if SQLiteCacheDB.hasInstance():
SQLiteCacheDB.getInstance().close_all()
SQLiteCacheDB.delInstance()
if not ALLOW_MULTIPLE:
del self.single_instance_checker
return 0