什么是Java2D Disposer线程?

时间:2022-05-20 00:07:33

I have created a sample java application working with Hibernate, when I doing the thread-dump I observe the strange thread called Java2D Disposer.

我创建了一个使用Hibernate的示例java应用程序,当我进行线程转储时,我观察了一个名为Java2D Disposer的奇怪线程。

Can someone tell me the function of that thread?

有人能告诉我该线程的功能吗?

1 个解决方案

#1


9  

Certain entities in the AWT system need finalization to free resources. The most prominent example is java.awt.Windows which needs to dispose its native resources after the window is garbage collected.

AWT系统中的某些实体需要最终确定以释放资源。最突出的例子是java.awt.Windows,它需要在窗口被垃圾收集后处理其本机资源。

One could do this with finalizers, but a solution that gives you more detailed control is to use phantom references with a reference queue. That solution needs a dedicated thread which waits on the reference queue. That thread is the "Java 2D disposer" thread, It is created when you initialize the AWT system.

可以使用终结器来完成此操作,但是为您提供更详细控制的解决方案是使用具有引用队列的幻像引用。该解决方案需要一个等待引用队列的专用线程。该线程是“Java 2D disposer”线程,它是在初始化AWT系统时创建的。

#1


9  

Certain entities in the AWT system need finalization to free resources. The most prominent example is java.awt.Windows which needs to dispose its native resources after the window is garbage collected.

AWT系统中的某些实体需要最终确定以释放资源。最突出的例子是java.awt.Windows,它需要在窗口被垃圾收集后处理其本机资源。

One could do this with finalizers, but a solution that gives you more detailed control is to use phantom references with a reference queue. That solution needs a dedicated thread which waits on the reference queue. That thread is the "Java 2D disposer" thread, It is created when you initialize the AWT system.

可以使用终结器来完成此操作,但是为您提供更详细控制的解决方案是使用具有引用队列的幻像引用。该解决方案需要一个等待引用队列的专用线程。该线程是“Java 2D disposer”线程,它是在初始化AWT系统时创建的。