Hello,
I have some questions about Singleton and concurrency, I'd appreciate
any help you can give me.
I have a Windows Service which, on start, registers on remoting (using
IPC channel and WellKnownObjectMode.Singleton) a 'Test' class.
public class Test
{
public void SendMessage()
{
// etc. etc.
}
}
1. First, just to be sure, the instantiation and singleton
implementation is already provided by Remoting, right? Because I just
ask for the object using Activator.GetObject and I receive it without
additional code.
2. If two (or more) simultaneous invocations to SendMessage() occurs,
is the execution sequential? I mean, the first thread executes
SendMessage() and the second waits for the first to finish? Or both of
them executes the method at the same time?
3. In case the execution is sequential, if I'd want to SendMessage() be
executed simultaneously any times as invoked, it would be correct that
SendMessage() be just a wrapper that creates a new Thread and executes
inside it a method i.e. SendMessageImpl()?
Thank you in advance.
Luis