Re: Connecting Out of Process Servers via COM+
- From: "Schmidt" <sss@xxxxxxxxx>
- Date: Thu, 21 Jul 2005 23:55:53 +0200
"Lance Wynn" <lance_wynn@xxxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:eW0UczijFHA.2152@xxxxxxxxxxxxxxxxxxxxxxx
> Is there a setting where I can have COM+ instantiate only one instance
> of the object (In this case, my connection wrapper) and allow client
> applications to "share" this one instance of the COM+ object?
I wouldn't try to find a setting for COM+ itself, to restrict the PoolSize
of a specific COM+-object to 1.
I would allow your clients, to access a "normal" configured COM+ Object
(name it ComPlusRMIWrap).
This ComPlusRMIWrap-Object (if requested) then accesses the
RunningObjectsTable (ROT) on the serverside per GetObject(,
"COMRMI.cServerDispatcher"), to get a (marshaled) Reference to your own
ServerApplication (running as a sessionwide Singleton-Object on the
COM+-Host).
If you want to implement such a "Singleton-Server" in VB, you can use a
Standard-Exe, that loads your RMI-DLL-Instance once, makes the connect to
the Java-Environment and registers this Object in the ROT.
Another (better, but more complicated) approach is, not to use a
VB-Standard-Exe, but an ActiveX-Exe instead.
With an ActiveX-Exe you can write a Server-Application, that can create more
than one instance of your RMI-Connection-Wrapper on different threads. If
the AX-Exe starts, it would create a Dispatcher-Object first and registers
that in the ROT (cServerDispatcher). This Dispatcher-Object is the
Singleton-Object, that the COM+Objects can reference per GetObject. Inside
the Dispatcher is a Thread-Pool-Collection (created at Startup) of (for
example 10) RMIWrapper-Objects (cRMIWrapper). Those Wrappers are the
(threaded) COM-Objects, wich create and hold a separate RMI-Connection (from
your Dll) inside.
> If this is possible, how would I instantiate the teh object at the client?
> GetObject? CreateObject? When one client sent a command, it would
> have to wait until the command had finished completely before
> allowing the next client's command through.
If two Clients at the same time are requesting the COM+-Server, the requests
are processed in parallel up to the point, where the Interface of the
ROT-Singleton (the Proxy) is used. Interface-Calls of a marshaled ROT-Object
are queued automatically (the call, wich is a moment later will be blocked
until the first request against the interface of the ROT-Singleton is
finished).
This means, altough COM+ would allow parallel requests, the calls would be
serialized regarding the internal ROT-Object-Requests.
In case of the VB-Standard-Exe, wich could place your RMIWrapper-Object
directly in the ROT, your Clients would block each other during parallel
RMI-Calls against the same ROT-Instance (I don't write a Code-Example for
the COM+WrapperClasses - that case would be easy)
In Case of the VB-AxtiveX-Exe, the ROT-Object is not the RMIWrapper itself,
it's a Dispatcher-Object, wich allows 'ThreadpoolCollection.Count' parallel
and async requests.
Your COM+ Objects would then have some Code like this (Aircode, no
error+timeout handling):
Private RMIDispatcher as COMRMI.cServerDispatcher
Public Function DoRMIRequest(Params)
Set RMIDispatcher = GetObject(, "COMRMI.cServerDispatcher")
'The Dispatcher takes the Params, chooses a free RMI-Pool-Object
internally
'and creates an EventObject, calls the PoolObject async and returns
immediately
hEvt = RMIDispatcher.GetFreePoolObjectAndCallAsyncWith(Params)
'The Dispatcher will raise a SystemWide-Event, if the threaded RMI-Pool
'-Object has finished the request and informed the ROT-Dispatcher
WaitForSingleObject hEvt, TimeOut
DoRMIRequest = RMIDispatcher.GetResult(hEvt)
End Function
Olaf
.
- Follow-Ups:
- Re: Connecting Out of Process Servers via COM+
- From: Lance Wynn
- Re: Connecting Out of Process Servers via COM+
- References:
- Connecting Out of Process Servers via COM+
- From: Lance Wynn
- Re: Connecting Out of Process Servers via COM+
- From: Ralph
- Re: Connecting Out of Process Servers via COM+
- From: Lance Wynn
- Re: Connecting Out of Process Servers via COM+
- From: Ralph
- Re: Connecting Out of Process Servers via COM+
- From: Lance Wynn
- Connecting Out of Process Servers via COM+
- Prev by Date: Re: Connecting Out of Process Servers via COM+
- Next by Date: Re: Connecting Out of Process Servers via COM+
- Previous by thread: Re: Connecting Out of Process Servers via COM+
- Next by thread: Re: Connecting Out of Process Servers via COM+
- Index(es):
Relevant Pages
|