Page 1 of 1

Shared Objects Wrapper

PostPosted: Mon Feb 01, 2016 12:18 pm
by chris55
Any shared objects experts out there?

I want to wrap up the various stages of shared objects management into a generic method. So the method would have the following components:

Code: Select all
* obtain area handle and write lock
CALL METHOD AREA=>ATTACH_FOR_WRITE
        EXPORTING INST_NAME = INST_NAME
        RECEIVING HANDLE    = OB_HANDLE.

* link root class to area handle
CREATE OBJECT OB_ROOT AREA HANDLE OB_HANDLE.

* link area instance to root class object
CALL METHOD OB_HANDLE->SET_ROOT
        EXPORTING ROOT = OB_ROOT.


The instance name, area class name and root class name would be passed into the method, and it would return a handle to OB_ROOT. I just can't get it to work. A lots of problems with typing etc. Any suggestions?

Thanks,
Chris.

Re: Shared Objects Wrapper

PostPosted: Wed Feb 03, 2016 4:46 am
by Gothmog
I don't think there's a common superclass or interface to the various OB_ROOT classes - you'll have to be very generic in the method parameter definition (TYPE REF TO OBJECT) to return the reference.
What typing problems are you encountering exactly?

Re: Shared Objects Wrapper

PostPosted: Thu Feb 04, 2016 5:31 am
by chris55
Hi Gothmog,

I used the TYPE REF to OBJECT for typing the formal parameters, but the basic problem is the AREA HANDLE specification in the CREATE OBJECT statement. The AH reference must be a class that is Shared Memory-Enabled, and you can't use a dynamic specification, so without a great deal of messing about and convoluted code it - downcast operators and all sorts of stuff - it seems very difficult to accomplish. This defeats the object of trying to simplify the whole thing. Reluctantly, I've had to give up on it. Thanks for your thoughts on it.

Re: Shared Objects Wrapper

PostPosted: Mon Feb 22, 2016 7:03 am
by chris55
As a follow-up to the subject of shared objects: they are application server specific. Has anyone had any experience of shared memory in a multi-server system? There's something about "propagating" shared memory across servers in some discussion boards but nothing is explained. What are the implications of a multi-server environment?

Thanks,
Chris.