[Red5] Red5.getConnectionLocal() from SchedulerJob returns null

Mamontov Sergey V. moonlight at ua.elro.com
Mon Nov 19 09:28:17 PST 2007


Kyoung,

Yes, it's works great :) But I still somehow have access to methods of StreamService such as: pause(boolean pausePlayback, Integer position), and maybe to start new scheduler witch I deploy in my CustomStreamService.

Regards,

Sergey

>   
>  yesterday, I showed a short example for that.
> it doesn't work?
>  

>> Date: Mon, 19 Nov 2007 18:52:22 +0200
>> From: moonlight at ua.elro.com
>> To: red5 at osflash.org
>> Subject: Re: [Red5] Red5.getConnectionLocal() from SchedulerJob returns null
>> 
>> Hello everyone,
>> 
>> Please, help me handle this feature request.
>> Even when I pass to IScheduleJob link to my CustomStreamService he can't trace it after invoking scheduling body :(
>> 
>> 
>> This all what I can do, please, help, I really need Your help :)
>> 
>> Thanks,
>> 
>> Sergey
>> 
>> 
>> > 
>> > 
>> > Hi,
>> > 
>> 
>> > 
>> > Can someone if it will not take a lot of time make short guide how to create events?
>> > 
>> > For example on ShedulerJob execute.
>> > 
>> 
>> > 
>> > Please :)
>> > 
>> 
>> > 
>> > Regards,
>> > 
>> 
>> > 
>> > Sergey
>> > 
>> 
>> > 
>> > 
>> 
>> > 
>> > John,
>> > 
>> 
>> > 
>> > Hello :) 
>> > 
>> > I still don't understand how to make custom events in application.
>> > And after I found attribute with of corresponding JobName, how can I
>> > invoke to pause sever stream exactly for this client?
>> > 
>> 
>> > 
>> > P.S. maybe someone found better solution, maybe native for Red5, this will be great :)
>> > 
>> 
>> > 
>> > Regards,
>> > 
>> 
>> > 
>> > Sergey 
>> > 
>> 
>> > 
>> > 
>> 
>> > 
>> > I looked at the title of this email and I did a double take because
>> > I had a "saved" email that I was going to send later with pretty
>> > much the Exact title. =) I thought gmail accidently sent my saved email hahaha
>> > 
>> 
>> > 
>> > anyway, I found that the way Red5.getconnectionlocal() works only
>> > allows the local Thread to the IConnection to have access. Since
>> > SchedulerJob is a completely separate thread, it does not had access to IConnection.
>> > 
>> 
>> > 
>> > I havent found a good solution for this yet, but for now Im setting
>> > an attribute to the IClient at appconnect and on the execute()
>> > method I loop through the client for the matching attribute and do my thing.
>> > 
>> 
>> > 
>> 
>> > 
>> 
>> > 
>> 
>> > 
>> > On Nov 16, 2007 9:22 AM, Mamontov Sergey V. <moonlight at ua.elro.com> wrote:
>> > 
>> 
>> > 
>> > Hi,
>> > 
>> 
>> > 
>> > During me development I've discovered some new strange thing. When I'm
>> > 
>> > trying to add some Scheduler in my application, calling of
>> > 
>> > Red5.getConnectionLocal(); return me "null" as connection, when 
>> > 
>> > calling it from body of ShedulerJob, mean time, same call in main
>> > 
>> > class return me connection info.
>> > 
>> 
>> > 
>> > This is small, but main part of class, witch causing strange behavior.
>> > 
>> 
>> > 
>> > public class CustomStreamService extends StreamService implements IScheduledJob { 
>> > 
>> 
>> > 
>> > public void play (String name){
>> > 
>> 
>> > 
>> > IConnection conn = Red5.getConnectionLocal();
>> > 
>> > ISchedulingService service = (ISchedulingService)
>> > conn.getScope().getContext().getBean(ISchedulingService.BEAN_NAME );
>> > 
>> > ClientData client =
>> > ((ClientData)conn.getClient().getAttribute("client"));
>> > 
>> > String clientId = client.getId();
>> > 
>> > log.info("@_StreamService_@ Connection info: "+conn); //<- works 
>> > 
>> > great ("Connection RTMPMinaConnection from XX.XXX.XXX.XXX:1245 to
>> > 
>> > XX.XXX.XXX.XXX (in: 3719, out: 5329) ")
>> > 
>> > startPlayBackWatcher();
>> > 
>> > }
>> > 
>> 
>> > 
>> > public void startPlayBackWatcher(){ 
>> > 
>> 
>> > 
>> > IConnection conn = Red5.getConnectionLocal();
>> > 
>> > ISchedulingService service = (ISchedulingService)
>> > conn.getScope().getContext().getBean(ISchedulingService.BEAN_NAME);
>> > 
>> > ClientData client =
>> > ((ClientData)conn.getClient().getAttribute("client")); 
>> > 
>> > String jobName1 = service.addScheduledOnceJob(5000, this);
>> > 
>> > }
>> > 
>> 
>> > 
>> > public void execute(ISchedulingService service) throws
>> > 
>> > CloneNotSupportedException {
>> > 
>> > IConnection conn = Red5.getConnectionLocal ();
>> > 
>> > pause(true, 15000);
>> > 
>> > log.info("@_StreamService_@ Connection info: "+conn); //<-
>> > 
>> > doesn't work :( ( return "null")
>> > 
>> > }
>> > 
>> 
>> > 
>> > What is wrong in my code? Please, help me :) 
>> > 
>> > P.S. Actually I'm not really good Java developer, Flash is My life
>> > 
>> > :)
>> > 
>> 
>> > 
>> 
>> > 
>> > Regards,
>> > 
>> 
>> > 
>> > Sergey
>> > 
>> 
>> > 
>> 
>> > 
>> > _______________________________________________
>> > 
>> > Red5 mailing list
>> > 
>> > Red5 at osflash.org
>> > 
>> > http://osflash.org/mailman/listinfo/red5_osflash.org
>> > 
>> mailto:moonlight at ua.elro.com
>> 
>> 
>> _______________________________________________
>> Red5 mailing list
>> Red5 at osflash.org
>> http://osflash.org/mailman/listinfo/red5_osflash.org



> Explore the seven wonders of the world Learn more!
>   


-- 
С уважением,
 Mamontov                          mailto:moonlight at ua.elro.com




More information about the Red5 mailing list