gpt4 book ai didi

java - Guava EventBus Google App Engine 友好吗?

转载 作者:行者123 更新时间:2023-11-30 06:26:13 25 4
gpt4 key购买 nike

GAE 限制在运行时创建新的 Thread 实例。 Guava 有一个很好的EventBus我想我想在即将进行的 GAE 项目中使用它。

但如果我要遇到任何与线程相关的访问限制,我什至不想开始走这条路。所以我问:Guava 的 EventBus 是否利用线程创建? 它对 GAE 友好吗?

最佳答案

看起来你可以创建一个 AsyncEventBusGAE thread factory :

//GAE Thread Factory
ThreadFactory factory = ThreadManager.currentRequestThreadFactory();
Executor executor = Executors.newCachedThreadPool(factory)
//AsyncEventBus
EventBus eventBus = new AsyncEventBus(executor);

另请参阅:https://developers.google.com/appengine/docs/java/runtime

关于java - Guava EventBus Google App Engine 友好吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14662099/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com