Can I see the code you're using for the singleton?

I've written remoting-based applications that do exactly what I think you're 
describing.  I have a remoting fa�ade class which uses SingleCall, and this then 
accesses a singleton object.

It is, as you say, a fairly common thing to want to do.  I've never had any problems 
with it.  If extra singletons are getting created, then the first thing to look at 
would be whatever code you are using to implement the singleton pattern.


-- 
Ian Griffiths - DevelopMentor
(RSS: http://www.interact-sw.co.uk/iangblog/rss2.0 )

> -----Original Message-----
> From: Norman Burkies
> 
> I have a problem which would normally be simple to solve (DCOM C++) but is
> causing me grief when attempting an implementation with .NET, C# and
> Remoting).
> 
> Simply put I have a service (or just a console host) which scans some
> sensors and stores the data in a singleton  object (based on the example
> in the Microsoft Enterprise Solution Patterns document - I have tried them
> all). I am attempting to use the same service (console) to host a .NET
> remote interface which provides application access to this data. Note I am
> not attempting to remote the singleton I just wan't to access it from both
> the internal threads and the runtime remoting thread hosting the remote
> method call.
> 
> Multiple internal threads can synchronise with and access the singleton
> normally, however the remote access SingleCall methods do not 'see' the
> same singleton. The runtime appears to create a new instance of the
> singleton (new static data) on first access (I can see the contructor
> being called). The remote object method instance and the internal service
> threads appear to be executing within the same AppDomain.
> 
> Is this an impossible solution? Is there something else I should know
> about (Contexts maybe).
> 
> This must be a fairly common thing to want to do say implementing an in
> memory global sesion cache for instance.

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to