[Red5] Red5.getConnectionLocal() from SchedulerJob returns null (The Bat making HTML :( )

Mamontov Sergey V. moonlight at ua.elro.com
Mon Nov 19 06:25:31 PST 2007


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
>>     
>>  

>>  

>>  

>>     
>>  

>>   
>>   





More information about the Red5 mailing list