本文整理匯總了Python中java.util.Collections.synchronizedMap方法的典型用法代碼示例。如果您正苦於以下問題:Python Collections.synchronizedMap方法的具體用法?Python Collections.synchronizedMap怎麽用?Python Collections.synchronizedMap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.Collections
的用法示例。
在下文中一共展示了Collections.synchronizedMap方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setName
# 需要導入模塊: from java.util import Collections [as 別名]
# 或者: from java.util.Collections import synchronizedMap [as 別名]
def setName(self, name):
self._thread.setName(str(name))
def isAlive(self):
return self._thread.isAlive()
def isDaemon(self):
return self._thread.isDaemon()
def setDaemon(self, daemonic):
self._thread.setDaemon(bool(daemonic))
# relies on the fact that this is a CHM
_threads = weakref.WeakValueDictionary()
_active = _threads
_jthread_to_pythread = Collections.synchronizedMap(WeakHashMap())
class Thread(JavaThread):
def __init__(self, group=None, target=None, name=None, args=None, kwargs=None):
assert group is None, "group argument must be None for now"
_thread = self._create_thread()
JavaThread.__init__(self, _thread)
if args is None:
args = ()
if kwargs is None:
kwargs = {}
self._target = target
self._args = args
self._kwargs = kwargs
if name:
self._thread.setName(str(name))