Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Distributed Applications / November 2004

Tip: Looking for answers? Try searching our database.

Are remotable objects multithreaded?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David - 18 Nov 2004 20:45 GMT
I haven't found the answer to a fairly simple question.

If I create a remotable object, hosted in a .exe process, will client calls
start new threads when using synchronous remoting?

In other words, if I have two clients each making a call, will the first
client block the server until it is done, locking out the second client?  
Does it matter if the remotable object is a Singleton or a SingleCall object?

I saw several references to this when using asynchronous remoting, and it
appears that in that case, a new thread is automatically started to handle
the method call, but is that also the case for synchronous remoting?  I am
concerned because I have one method that takes a very long time, and that is
not a problem because the user will expect it to take a long time, but a
different user on a different client will be making a different call to the
same singleton object.  That user expects a prompt response.  Will the second
user have to wait for the first user's call to finish?

I remember that in DCOM you could create the objects as single-threaded or
multi-threaded, as you wished.  Is that option available in .Net remoting?  
Or will I have to use asynchronous remoting?
"Peter Huang" - 19 Nov 2004 06:17 GMT
Hi

The .NET remoting mechanism  is different from DCOM.
Whatever asynchronous or synchronous of the caller(client), the server
side(callee) will keep its behavior dependent on whethere it is singlecall
or singleton.
If it is singleton, whether asynchronous or synchronous, the sencond call
will return only the first call finished.
But if we use singleton on serverside, and use asynchronous call, the
client will keep running the following code, the the asynchronous  callback
will be called until the first call finished.

Asynchronous Remoting
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconasynchronousremoting.asp

Remoting Example: Asynchronous Remoting
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconremotingexampleasynchronousremoting.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

David - 19 Nov 2004 14:05 GMT
Thanks.

Now I need to go rewrite some code.

> Hi
>
[quoted text clipped - 23 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
Ed - 25 Nov 2004 14:59 GMT
Here: http://msdn.microsoft.com/msdnmag/issues/02/10/NETRemoting/default.aspx

Quote from it:
"What happens if two requests arrive at the same time? The remoting
subsystem provides for them to be automatically serviced by distinct threads.
This requires singleton objects to be thread-safe. This is not a mandatory
programming rule, but more of a practical guideline for real-world
scenarios." (c)

I don't think that here is any difference in removable object behaviour
whether client uses asynchronous or synchronous call.
In order to "emulate" STA behaviour I would recommend use
SynchronizationAttribute (but you should inherit your removable class from
ContextBoundObject, not from MarshalByRefObject).

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.