[Red5] Red5.getConnectionLocal() from SchedulerJob returns null
Jake Hilton
red5 at jakehilton.com
Mon Nov 19 09:35:22 PST 2007
I don't call that .. instead I do like the following:
public class Application extends ApplicationAdapter {
public void initCount(){
CountID = addScheduledJob(1000, new startCountJob(this));
}
}
class startCountJob implements IScheduledJob {
private Application appref;
public startCountdownJob(Application ref){
appref=ref;
}
public void execute(ISchedulingService service) {
appref.someMethod();
}
}
Works great thus far.
Jake
On Nov 19, 2007 9:52 AM, Mamontov Sergey V. <moonlight at ua.elro.com> wrote:
> 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
>
More information about the Red5
mailing list