Hi Kerem,

On 5/7/06, Kerem Hadimli <[EMAIL PROTECTED]> wrote:
well, i won't be dealing with local thread's connection, but accessing
that IConnection object from another thread (a thread created by
java.util.Timer).

For example;

client connects, invokes some call on server. When that call is
invoked, i create a new thread, to check if the username/password
information the client provided is correct, from a remote server (say
a DB server, or a http server, connected to a DB). I store the
IConnection object in that thread, and return the control to red5
(server side invoke is finished now). At a later time, when database
reply arrives, now, can i access the IConnection object's methods from
the other thread created before?

I mean, this makes the IConnection object a shared resource between
threads (between red5's thread, and authentication-waiting thread i've
created before), is IConnection object thread-safe? (at least the
methods for invoking client calls, and disconnecting the client)

In theory, you have access to IConnection and call methods on it on both threads. But as of now, the object is not implemented threading-safe. So you may need to do synchronization yourself.

Or, is there an alternative method for this, without blocking the
whole red5 server when a client connects, waiting for database reply?

Maybe it's a good idea for Red5 core to implement this functionality internally thus to free you from creating asynchronous service-handling yourself. I will submit a ticket on Trac. Thanks, Kerem.

thanks,
-kerem

On 5/6/06, Dominick Accattato < [EMAIL PROTECTED]> wrote:
> if your trying to access just that connections thread it would be a static
> method on the Red5 class
>
> /**
>      * Get the connection associated with the current thread
>      *
>      * @return connection object
>       */
>     public static IConnection getConnectionLocal() {
>         return connThreadLocal.get();
>     }
>
>     /**
>      * Get the connection object
>      *
>      * @return connection object
>      */
>     public IConnection getConnection() {
>         return conn;
>     }
>
>
> On 5/6/06, Kerem Hadimli <[EMAIL PROTECTED] > wrote:
> >
> we've been trying to implement a http based authentication mechanism
>  into a test application. This will prbably require using java's
> lang.util.Timer's. Is red5 thread-safe? I mean, i think we'll somehow
> create a thread (a Timer, etc) when we want to check authentication,
> and it'll call the handler in its new thread (when http request is
> replied). But then, can we call for example,
> (IServiceCapableConnection)conn.invoke(), or conn.close(),
> within this
> "other" thread?
>
> I've been thinking but couldn't find a workaround for this to call
> these red5 api functions through red5's own thread.
>
> thanks,
> -kerem
>
> _______________________________________________
> Red5 mailing list
> [email protected]
>  http://osflash.org/mailman/listinfo/red5_osflash.org
>
>
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
>
>

_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org



--
Best Regards
Steven Gong
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to