multi threading in red5

a 夏天 提交于 2019-12-05 12:11:42

Thank you for finding a major bug in our socket handling, it was not operating as expected with the latest version of Mina (version 2.0.4). I will explore the problem further at a later date, but for now this is fixed at revision 4270

ApplicationAdapter already had ScheduleJob to manage multithreading.

the example

public boolean connect(IConnection conn, IScope scope, Object[] params) {
        iconn = (IServiceCapableConnection) conn;
        appScope = scope;
        createSharedObject(appScope, "thread", false);
        //updateArray();
        this.addScheduledJob(100, new IScheduledJob() {
            @Override
            public void execute(ISchedulingService jobs0)
                    throws CloneNotSupportedException {
                System.out.println(sendList);
                iconn.invoke("receiveVariable", new Object[] { sendList.toArray() });
                sendList.clear();
                try {
                    Thread.sleep(5000);
                    updateArray();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

            }
        });
        return true;
    }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!