System.setProperty 的范围

发布于 2024-10-08 11:50:36 字数 315 浏览 0 评论 0原文

System.setProperty

如果我设置一个属性(例如 System.setProperty("http.keepAlive", "false")),它是否会影响系统中的所有应用程序、当前应用程序、当前任务或当前线程仅有的?

这是在哪里记录的?

What's the scope of System.setProperty in Android?

If I set a property (say System.setProperty("http.keepAlive", "false")), does it affect all apps in the system, the current app, the current task or the current thread only?

Where is this documented?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

金橙橙 2024-10-15 11:50:36

Java“系统”属性不跨越进程边界,它们保存在内存中并绑定到虚拟机的单个实例。因此,如果您在应用程序中设置系统属性,设备上运行的其他应用程序将看不到该属性。

Java "system" properties do not cross process boundaries, they are held in memory and are tied to a single instance of the virtual machine. Therefore if you set a system property within application it will not be visible to other applications running on the device.

长不大的小祸害 2024-10-15 11:50:36

如果您没有在 Manifest.xml 中另外指定,同一应用程序的 Android 活动将在应用程序启动时在为该应用程序创建的默认进程中运行。

每个进程都在自己的 JVM 中运行。因此,基于 @mmccomb 的答案, System.setProperty() 将到达同一应用程序中的所有活动,除非您有意声明活动在不同的进程中运行。

请参阅http://developer.android.com/guide/components/processes- and-threads.html

Android Activities of the same application, if you don't specify otherwise in the Manifest.xml, will run in a default Process created for the application when it starts.

Each process runs in its own JVM. So the System.setProperty(), based on @mmccomb 's answer, will reach all Activities in the same Application except if you, on pupose, declare Activities to run in different Processes.

See http://developer.android.com/guide/components/processes-and-threads.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文