当前位置: 首页>>代码示例>>Python>>正文


Python Runtime.maxMemory方法代码示例

本文整理汇总了Python中java.lang.Runtime.maxMemory方法的典型用法代码示例。如果您正苦于以下问题:Python Runtime.maxMemory方法的具体用法?Python Runtime.maxMemory怎么用?Python Runtime.maxMemory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.Runtime的用法示例。


在下文中一共展示了Runtime.maxMemory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initialize

# 需要导入模块: from java.lang import Runtime [as 别名]
# 或者: from java.lang.Runtime import maxMemory [as 别名]
def initialize(classpath, parameters):
    global RelationshipType, Evaluator, StopAtDepth, IndexService, FulltextIndexService, FulltextQueryIndexService,\
        array, to_java, to_python
    heap_size = parameters.pop('heap_size', None)
    if heap_size is not None:
        from java.lang import Runtime as jre; jre = jre.getRuntime()
        if is_integer(heap_size):
            heap_size *= (1024**2) # Default to megabyte
        elif heap_size[-1].isdigit():
            heap_size = int(heap_size) * (1024**2)
        else:
            heap_size = int(heap_size[:-1]) * {
                'k': 1024,
                'm': 1024**2,
                'g': 1024**3,
                't': 1024**4,
            }[heap_size[-1].lower()]
        if jre.maxMemory() < heap_size:
            warnings.warn(RuntimeWarning(
                    "Insufficient heap size!\n"
                    "Requested %s bytes, running in %s bytes." % (
                        heap_size, jre.maxMemory())))
    # Import implementation
    try:
        Stop, Returnable, Type = import_api()
    except:
        import sys
        sys.path.extend(classpath)
        Stop, Returnable, Type = import_api()
    try:
        from org.neo4j.kernel import EmbeddedGraphDatabase
    except:
        EmbeddedGraphDatabase = None
    try:
        from org.neo4j.remote import RemoteGraphDatabase
    except:
        RemoteGraphDatabase = None
    try:
        from org.neo4j.index.lucene import LuceneFulltextIndexService as FulltextIndexService
    except:
        FulltextIndexService = None
    try:
        from org.neo4j.index.lucene import LuceneFulltextQueryIndexService as FulltextQueryIndexService
    except:
        FulltextQueryIndexService = None
    try:
        from org.neo4j.index.lucene import LuceneIndexService as IndexService
    except:
        try:
            from org.neo4j.index import NeoIndexService as IndexService
        except:
            IndexService = None
    # Define conversions
    def array(lst):
        return lst
    def to_java(obj):
        return obj
    def to_python(obj):
        return obj
    class Evaluator(Stop,Returnable):
        def __init__(self):
            self.stop = self
            self.returnable = self
    class StopAtDepth(Stop):
        def __init__(self, limit):
            limit = int(limit)
            assert limit > 0, "Illegal stop depth."
            self.__limit
        def isStopNode(self, position):
            return self.__limit <= position.depth()
    types = {}
    def RelationshipType(name):
        if name in types:
            return types[name]
        else:
            types[name] = type = RelType(name)
            return type
    class RelType(Type):
        def __init__(self, name):
            self.__name = name
        def name(self):
            return self.__name
        def __eq__(self, other):
            return self.name() == other.name()
    return EmbeddedGraphDatabase, RemoteGraphDatabase
开发者ID:RandomStuffs22,项目名称:neo4j-components-svn,代码行数:87,代码来源:native.py


注:本文中的java.lang.Runtime.maxMemory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。