« Return to Thread: Question about IServiceCapableConnection invoke

Re: Question about IServiceCapableConnection invoke

by rfkrocktk :: Rate this Message:

Reply to Author | View in Thread

Refactor your conversion task into a class, either anonymous or an actual defined class. (I'd recommend defined) Make it implement Runnable. In the constructor, take some parameters of what you need to work with in the task, ie the connection reference, file name, etc. Set those to instance variables on the class instance. Then, in your run() method, do your work, referencing the connection that way. Something like this:

// innards of serverside remoting gateway class
public class RemotingGateway {

    private Executor executor;

    public RemotingGateway() {
        this.executor = Executors.newFixedThreadPool(16);
    }

    public void doWork() {
        executor.execute(new ConversionTask(Red5.getConnectionLocal());
    }
}

//task class
public class ConversionTask implements Runnable {
   
    private IConnection connection;
   
    public ConversionTask(IConnection connection) {
        this.connection = connection;
    }

    public void run() {
        //do conversion :)
    }
}

By the way, do you understand why you can't get access to Red5.getConnectionLocal() in a new Thread? It's because Red5 does work behind the scenes to tie the local connection to the currently executing Thread, which is what you'll have to do in order to get your demo working :)

On Thu, Jul 9, 2009 at 8:44 AM, Rhys Causey <rhys@...> wrote:
I'm actually using a Java library to do the conversion, not running a process. Thanks though!

Rhys



On 9-Jul-09, at 11:09 AM, Walter Tak wrote:

Your process might be blocking Red5 from spitting out the messages to the client. Try lowering the priority of your conversion process, either with "nice <your command>" or renice (see man for info).

E.g. "nice -n 19 top" will run the command "top" with priority +19 (which basically means it only runs at idle)


----- Original Message ----- From: "Rhys Causey" <rhys@...>
To: <red5@...>
Sent: Wednesday, 08 July 2009 22:22
Subject: [Red5] Question about IServiceCapableConnection invoke


Hi,

I'm using the IServiceCapableConnection invoke method to report  progress on a file conversion back to the flash client. The client is  receiving the messages fine, but they all come in one large chunk  after everything's done. I'm logging the invocations in my Red5 app,  and they're showing up in the log at the appropriate times, but they  only reach the client after the conversion is complete. Is there a way  to force it to send the messages right away?

Thanks!

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



--
Internal Virus Database is out-of-date.
Checked by AVG. Version: 7.5.560 / Virus Database: 270.12.26/2116 - Release Date: 15-05-09 06:16


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

 « Return to Thread: Question about IServiceCapableConnection invoke