本文整理汇总了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))