Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. COM+ singleton ?

COM+ singleton ?

Scheduled Pinned Locked Moved COM
c++helpcomquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Adrian Bacaianu
    wrote on last edited by
    #1

    Hy everybody, Please help me with an ideea. The problem is simple, but the solution... In fact, i need to have only one permanent instance of an ATL COM+ object (or more but only persistent public data members), and 3 or more clients who must connect at this COM object to get and put data. The clients are C++ who connect with CreateInstance and ASP who use CreateObject. The problem is at each new CreateInstance of a new client, in COM+ appear a new instance of my COM+ object, even i use DECLARE_CLASSFACTORY_SINGLETON. Even if i use the both threading model, in any apartments, the public data look to be the same only to C++ clients, a new ASP instance will create a new object with new different public memebers !!! Adrian Bacaianu

    L B 2 Replies Last reply
    0
    • A Adrian Bacaianu

      Hy everybody, Please help me with an ideea. The problem is simple, but the solution... In fact, i need to have only one permanent instance of an ATL COM+ object (or more but only persistent public data members), and 3 or more clients who must connect at this COM object to get and put data. The clients are C++ who connect with CreateInstance and ASP who use CreateObject. The problem is at each new CreateInstance of a new client, in COM+ appear a new instance of my COM+ object, even i use DECLARE_CLASSFACTORY_SINGLETON. Even if i use the both threading model, in any apartments, the public data look to be the same only to C++ clients, a new ASP instance will create a new object with new different public memebers !!! Adrian Bacaianu

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      sounds like a security problem : every single instance per launching user and winstation : check out DCOMCNFG

      1 Reply Last reply
      0
      • A Adrian Bacaianu

        Hy everybody, Please help me with an ideea. The problem is simple, but the solution... In fact, i need to have only one permanent instance of an ATL COM+ object (or more but only persistent public data members), and 3 or more clients who must connect at this COM object to get and put data. The clients are C++ who connect with CreateInstance and ASP who use CreateObject. The problem is at each new CreateInstance of a new client, in COM+ appear a new instance of my COM+ object, even i use DECLARE_CLASSFACTORY_SINGLETON. Even if i use the both threading model, in any apartments, the public data look to be the same only to C++ clients, a new ASP instance will create a new object with new different public memebers !!! Adrian Bacaianu

        B Offline
        B Offline
        Bart Robeyns
        wrote on last edited by
        #3

        It looks like you want a system-wide singleton (accross process boundaries). You would indeed get funny results with this approach: - different processes (in your example: IIS and the C++-application) instanciating your component would get a singleton *per process*. - any static data you maintain dies when your dll goes out of memory: this happens if all interfaces are released: DLLCanUnload is called on a regular basis, and when it returns true (default ATL-implementation: when all reference counts are zero), the dll is unloaded. You can solve this problem by leaving the COM-singleton for what it is, designing your component as a multiply instantiatable component and using either static data in a persistent, out-of-process server (take a look at ATL-service) or simply persist your data in a database.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups