为什么我的小程序必须使用单独的 jvm?
我编写了一个小程序,通过我们的电话系统 switchvox 自动拨打联系人号码,并将呼叫信息记录到我们的 CRM、salesforce 中。我遇到的问题是,除非我使用单独的 JVM 参数,否则事情会变得很棘手。
例如,假设他们为多个联系人打开了多个选项卡,因此多个小程序在同一个 jvm 中运行。如果没有单独的 jvm 参数,有时它会从另一个选项卡拨打号码。我通过参数标签传递数字,甚至尝试通过从小程序调用 JS 方法来传递数字,但仍然没有成功。
由于我们的 crm 是基于云的,人们喜欢打开多个选项卡,但不喜欢在下面看到多个 java 图标,请看图。任何人以前都遇到过这个问题,并且/或者有一个无需单独的 jvm 的解决方法。
I made up an applet to auto dial a contacts number via our phone system switchvox, as well as log the call information into our CRM, salesforce. The issue I am running into is that unless I use the separate JVM parameter things get screwy.
For example say they have multiple tabs open for multiple contacts, thus multiple applets running in the same jvm. Without the separate jvm parameter sometimes it will dial a number from another tab. I pass the number via the parameter tags and I have even tried passing the number by calling a JS method from the applet with still no luck.
Since our crm is cloud based people like to have multiple tabs open, but do not like seeing multiple java icons down below, go figure. Anybody have this issue before, and/or have a workaround without the separate jvms.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果不查看您的小程序代码,很难说。
但我会冒险猜测您的代码将其一些可变状态放入静态中,并且偶尔小程序的一个实例会通过静态干扰另一个实例。
如果您的小程序中有任何共享的可变静态,理想情况下您应该删除它们。或者,如果状态确实需要由小程序的多个实例共享,请确保所有访问都正确同步。
It is hard to say without looking at your applet's code.
But I would hazard a guess that your code is putting some of its mutable state in statics, and occasionally one instance of the applet is interfering with another via the statics.
If you have any shared mutable statics in your applet, ideally you should get rid of them. Or if the state really needs to be shared by multiple instances of the applet, make sure that all accesses are properly synchronized.
静态数据在小程序之间共享,因为它们都在同一虚拟机中运行。您可以尝试
classloader_cache= “false”
小程序选项并且仍然共享虚拟机。然而,我不确定这个选项是否只适用于小程序启动,因为我并没有成功地让它一直工作。最好的选择是摆脱静态或使用separate_jvm。
Statics are shared among the applets since they're all running in the same VM. You could try the
classloader_cache="false"
applet option and still share the VM. I am not sure whether this option applies only on applet startup, however, as I haven't had success with it working all the time.The best bet is to get rid of statics or use separate_jvm.