Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Objects: Client-Server Relationship

Former Member
0 Likes
975

Hi,

As we are laready aware, there is a client - server relationship between the objects.

And in principle, objects can perform both roles simultaneously: They can offer

services to other objects while requesting services at the same time.

Consider an example, there are 3 objects. Object 1, object 2 and object 3.

Object 1 requests some services from object 2 and in turn object 2 request some services from object 3.

So in this case object 2 is playing the role of server and client.

My Query:

Is it possible that object 2 is requesting some services from object 1?

If so, it will create a 'deadlock' situation. How can we avoid this?

Please suggest...

Regards

s.a.k

8 REPLIES 8
Read only

Former Member
0 Likes
906

Hello,

it is possible and it does not produce a deadlock. The run-time control flow can "come back" to an object which has invoked another method. As in classical ABAP programming, all method calls are placed on the call stack. If an object 1 calls a method of object 2 and within the method of object 2 a method of object 1 is called, this is no problem.

The same can happen with the subroutines of different programs: Program A can call a subroutine of program B. Within this routine of program B, another (or even the same) subroutine of program A can be called.

Hope this helps,

David

Read only

0 Likes
906

Dear David,

Firstly thanks for your reply...:)

Can you provide me the link from where I can get more information regarding this ?

Thank you once again for your assistance here..

Regards

s.a.k

Read only

matt
Active Contributor
0 Likes
906

There are no "links" because it isn't an issue. Deadlocks occur when you have communicating processes running in seperate threads. In the situation you describe everything is in sequence in the same thread.

Standard ABAP Objects is single threaded.

For what reason are you concerned about this?

matt

Read only

Former Member
0 Likes
906

Hi Matt,

Thanks for your prompt response.

I was going through the abap objects document and this came to my mind.

I was unaware that these are single threaded. Thanks for that...:)

Regards

s.a.k

Read only

Former Member
0 Likes
906

Another query..

Read only

0 Likes
906

Hi,

Continuing with the above scenario:

Consider an example, there are 3 objects. Object 1, object 2 and object 3. Each belonging to different classes.

Now what will be the case when Object 1 of class 1 requests some services from Object 2 of class 2 and in turn object 2 requests services from object 1(instance of class 1)?

Please provide your comments...

Regards

s.a.k

Read only

0 Likes
906

Hello,

as Matt already said: ABAP is single-threaded, so also in this case there is no problem. Each procedure call is placed at the top of the call stack which is processed top-down. There is no danger of deadlocks.

Also remember that an object can call its own methods and especially can make recursive calls to the same method... all these method calls do not produce a deadlock (however, an infinite loop is possible).

Hope this solves your doubts,

David

Read only

0 Likes
906

Hi David/Matt,

Thank you very much for the response..it cleared all the doubts..:)

Regards

s.a.k