java – 如何选择一个AWT-EventQueue线程,当有几个
|
我成功地将自己的 Java代码注入到运行的Oracle Forms应用程序中,使用DLL注入和一些jni欺骗. (Windows 7,32位,Oracle Forms 11,JRE Java 8) 我可以遍历组件树,并查询和设置一些基本Java对象中的值,例如来自class oracle.forms.ui.VTextField的值 当我试图模拟用户点击oracle.apps.fnd.ui.Button时,我被卡住了 我试过2件事情: >调用AbstractButton类的simulatePush方法 (2类在Button的类层次结构中) 结果相同: 从那里,应用程序被挂起. 更新:
我的代码在这里:CustomAWT.run(CustomAWT.java:34),并使用invokeLater调用.问题可能是:在调用oracle.ewt.button.PushButton.activate方法时,我不在正确的EDT. 在Java控制台中使用“列表线程”,我得到: Dump thread list ...
Group main,ac=30,agc=2,pri=10
main,5,alive
traceMsgQueueThread,alive,daemon
Timer-0,alive
Java Plug-In Pipe Worker Thread (Client-Side),daemon
AWT-Shutdown,alive
AWT-Windows,6,daemon
AWT-EventQueue-0,alive
SysExecutionTheadCreator,daemon
CacheMemoryCleanUpThread,daemon
CacheCleanUpThread,daemon
Browser Side Object Cleanup Thread,alive
JVM[id=0]-Heartbeat,daemon
Windows Tray Icon Thread,alive
Thread-13,alive
Group Plugin Thread Group,ac=3,agc=0,pri=10
AWT-EventQueue-1,alive
TimerQueue,daemon
ConsoleWriterThread,daemon
Group http://xxxx.xxxx.xxxxx.xx:8001/OA_JAVA/-threadGroup,ac=13,pri=4
Applet 1 LiveConnect Worker Thread,4,alive
AWT-EventQueue-2,alive
thread applet-oracle/apps/fnd/formsClient/FormsLauncher.class-1,alive
Applet 2 LiveConnect Worker Thread,alive
thread applet-oracle.forms.engine.Main-2,alive
Forms-StreamMessageReader,alive
Forms-StreamMessageWriter,alive
HeartBeat,alive
Busy indicator,1,daemon
TaskScheduler timer,alive
CursorIdler,alive
Thread-14,alive
Flush Queue,alive
Done.
所以,有三个AWT-EventQueue线程…问题现在:如何查询/检索正确的一个,以及如何使Runnable传递给invokeLater运行在“好线程”(我猜,好的是最后一个(AWT-EventQueue-2) 解决方法经过大量的实验和谷歌搜索与关键字,如EventQueue和ThreadGroup我终于找到一个解决方案(在我的工作类别,介意你).我使用sun.awt.AppContext类.一些文档和来源here(grepcode.com) >使用getAppContexts方法获取正在运行的AppContext的集合. 备注: >这个答案是一个具体的,适用于我,通过Internet Explorer链接启动的Oracle Forms应用程序的解决方案,并在java.exe进程中运行.在这种情况下,3个线程组如问题所示:main,Plugin Thread Group和http://xxxx.xxxx.xxxxx.xx:8001 / OA_JAVA / -threadGroup您的里程可能会有所不同.>如果不使用完全反射,而是导入sun.awt.AppContext,编译器可能会以警告形式发出警告:sun.awt.AppContext是Sun专有API,可能会在将来的版本中删除这不是很很酷,但我会和那个一起生活的,暂时的.>在run方法中,我使用oracle.ewt.lwAWT.AbstractButton的simulatePush方法测试了OK.>这里仿真的方法是invokeLater.对于invokeAndWait,postEvent调用需要更多的代码.查看EventQueue类的一些来源,作为起点. (编辑:日照站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- java.lang.IllegalStateException:在onSaveInstanceState之
- hashtable桶数通常会取一个素数分析
- 如何解决Mybatis--java.lang.IllegalArgumentException: Re
- java – 查找证书是自签名还是CA签名
- Mybatis返回int或者Integer类型报错的解决办法
- 内存 – 多线程堆管理
- Java Spring Controller 获取请求参数的几种方法详解
- java – 如何从Eclipse导入包?
- java实现Spring在XML配置java类的方法
- java高效打印一个二维数组的实例(不用递归,不用两个for循环
