小编Rit*_*tel的帖子

将Hashcode标识为Java对象

我的一个朋友和我有以下赌注:

这是有可能得到Object从存储器使用再次Identity Hashcode收到对Object使用System.identityHashCode()Java.受垃圾收集器尚未清除的限制.

我一直在寻找一个答案,而且我找不到明确的答案.

我认为使用它可能会这样做JVMTI,但我还没有使用它.

你们中有谁对此有答案吗?如果我能在你的网站上这样做,会给你买一个coffie;)

菲利克斯提前谢谢你

ps:我说这种行为可以实现,而我的朋友说这是不可能的

java hashcode jvmti

4
推荐指数
1
解决办法
592
查看次数

Sphinx 没有记录复杂的 Enum 类

在我的代码中,我有一些复杂的 Enum 类型的类。例如:

class ComplexEnum(SomeOtherClass, Enum):
    """ Some documentation """

    MEMBER1 = SomeOtherClass(1)
    MEMBER2 = SomeOtherClass(2)

    def __init__(self, arg):
        """ more doc """
        pass

    def somemethod(self):
        """ more doc """
        pass

    @classmethod
    def someclassmethod(cls, otherparam):
        """ more doc """
        pass
Run Code Online (Sandbox Code Playgroud)

当我现在使用 autodoc 用 Sphinx 创建我的文档时,这个类被跳过了。我尝试将这样的自定义文档添加到我的 conf.py 文件中:

from sphinx.ext.autodoc import ClassDocumenter

class MyClassDocumenter(ClassDocumenter):
    objtype = 'ComplexEnum'
    directivetype = 'class'

    @classmethod
    def can_document_member(cls, member, membername, isattr, parent):
        return isinstance(member, ComplexEnum)

def setup(app):
    app.add_autodocumenter(MyClassDocumenter)
Run Code Online (Sandbox Code Playgroud)

但这也不起作用。

我怎样才能让 sphinx 记录那些类?

python enums python-sphinx autodoc

4
推荐指数
1
解决办法
1874
查看次数

读取后,Primefaces 不会立即关闭 DefaultStreamedContent 流

我有以下问题:

我正在使用<p:graphicImage>来自 Primefaces 的a 在我的 web 应用程序中显示图像

显示的图像由 bean 作为DefaultStreamedContent. 在我的应用程序中,我有时会删除运行时以这种方式显示的图像。

这总是需要一点时间才能删除图像。在调试了一点之后,我使用了Files.deleteJava 7 并得到以下异常:

The process cannot access the file because it is being used by another process.
Run Code Online (Sandbox Code Playgroud)

因此,我怀疑 Primefaces 没有立即关闭DefaultStreamedContent显示后的流,并且我无法随时删除文件。

有没有办法告诉DefaultStreamedContent阅读后立即关闭自己(我已经查看了文档并没有在 中找到任何合适的方法DefaultStreamedContent,但也许人们可以告诉流或类似的东西?)

file-io jsf stream primefaces

3
推荐指数
1
解决办法
3848
查看次数

标签 统计

autodoc ×1

enums ×1

file-io ×1

hashcode ×1

java ×1

jsf ×1

jvmti ×1

primefaces ×1

python ×1

python-sphinx ×1

stream ×1