MultiThreadedApplicationAdapter 中的同步方法
我在 mmo 中使用 red5,并且我在同步方法方面遇到了麻烦,我在 MultiThreadedApplicationAdapter 中使用的方法总是阻止下一个请求。正常吗?因为我正在这些方法中执行一些数据库操作,并且这个同步块使我的性能非常差。我决定使用石英作业来克服这个问题,然而这次集群拓扑让我感到困惑。您能帮我一下吗,使用石英来解决这个问题是一个常见的解决方案吗?有没有人可以给我一个更明智的建议? 谢谢,
我想补充一下以澄清我的问题
在扩展 MultiThreadedApplicationAdapter 并创建我的重写类之后,我实现了
public boolean connect(IConnection conn, IScope scope, Object[] params) {
函数,在这个函数中我想在线设置用户状态(如您所见,该函数中没有任何同步文字)它的作用就如存在的那样。) 我想从数据库中获取用户实体,然后设置在线状态,然后将其保存回来 在这一部分中,即使我不使用同步文字,下一个即将到来的客户端也会等待上一个完成。我觉得我必须使用 Quartz 创建另一个作业并在该线程中进行数据库操作,但是我不确定这会降低我的性能。有没有其他方法可以防止这个阻止,这似乎是 Red5 的限制? 这也在博客 http://ria101.wordpress.com/2010/03/09/red5-cabin-fever-advanced-scope-and-room-management/
I am using red5 for mmo , and I am in trouble with syncronized methods , the methods which i used in MultiThreadedApplicationAdapter always blocking next request. Is it normal ? Because i am doing some database operations in these methods and this syncronized block is making my performance very poor. I decided to use quartz jobs to overcome this stuation, how ever this time clustered topolgy is making me confused . Could you please help me , is it a common solution to use quartz for this problem , is there any body to give me a smarter advice
Thank you
I want to make an addition to clear my question
After extending MultiThreadedApplicationAdapter and create my overriden class , I implemented
public boolean connect(IConnection conn, IScope scope, Object[] params) {
function and in this function I want to set user status Online (As you can see there is not any syncronized literal in this function however it is acting as there is.)
And I want to take user entity from database and then set online status and then save it back
In this part even if I dont use syncronized literal , next coming client is waiting previous completed. I feel like I must create another job with Quartz and make database operations in that thread however I am not sure this decrease my performance. Is there any other way to prevent this block , this seems to be a Red5 limitation ??
This is also mentioned in a blog http://ria101.wordpress.com/2010/03/09/red5-cabin-fever-advanced-scope-and-room-management/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只有一个线程可以调用对象的同步方法,石英不会改变它。从你的帖子来看,这似乎并不是你想要实现的目标。
Only one thread can invoke synchronized method of an object, an quartz won't change it. And from your post doesn't seem what you want to achieve.