Book a Demo

Author Topic: Concurrent activities in one class  (Read 7228 times)

revdev

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
  • Love this stuff.
    • View Profile
Concurrent activities in one class
« on: May 15, 2006, 01:14:15 pm »
Hello.  I'm interested in representing one class doing 2 things at the same time in one diagram.  For example, there are 2 client tasks running simultaneously.  One makes a call to my server class which can take some time to complete.  Meanwhile, another client (in another task) can request a bit of information while the first request is being handled.

This does not seem to be supported in interaction diagrams.
Is there a UML way to do this and is it supported in EA?

Thanks,
revdev
re-Vision Development

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Concurrent activities in one class
« Reply #1 on: May 15, 2006, 03:55:16 pm »
This will be fixed for EA 6.5
The Sparx Team
[email protected]

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Concurrent activities in one class
« Reply #2 on: May 15, 2006, 04:59:30 pm »
Quote
I'm interested in representing one class doing 2 things at the same time in one diagram.  For example, there are 2 client tasks running simultaneously.  One makes a call to my server class which can take some time to complete.  Meanwhile, another client (in another task) can request a bit of information while the first request is being handled.
]

In actual fact what you are interested in doing is showing two objects that are instances of the same class!  Try using objects instead of classes in the diagram.

hth
bruce
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

revdev

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
  • Love this stuff.
    • View Profile
Re: Concurrent activities in one class
« Reply #3 on: May 15, 2006, 05:06:52 pm »
It is one instance.  It has accessors which may be called by different tasks (each with a pointer to it) while one if its longer execution methods is processing.

It's not my favorite implementation, but it is possible.  FWIW, we may also use mutexes to protect critical sections.

Thanks,
rev
re-Vision Development

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Concurrent activities in one class
« Reply #4 on: May 15, 2006, 05:25:57 pm »
Oh I see, the problem is one instance of the server object, presumeably running multiple threads.  
There was some discussion around a year? ago where I suggested a method of faking this by creating a second server object and hiding it behind the first.  This solves it for diagramming purposes but is a bit of a hack.  If you are looking for a diagramming solution only this may do the trick.

bruce  
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Concurrent activities in one class
« Reply #5 on: May 15, 2006, 05:33:25 pm »
Sorry, my short answer above could've done with being a bit longer...

I think what you want are called overlapping execution occurrences. There is a diagram in the UML 2.0 Superstructure that shows this, Figure 14.15 in section 14.3.10 (I'm looking at the spec dated July 2005). If you don't have the document, I'll describe the picture:

It's a sequence diagram with two lifelines. Lifeline L1 sends a message to lifeline L2 which sends a callback to L1 which replies to L2 which replies to L1. The callback creates a nested execution occurrence (a.k.a. activation box) at its target lifeline L1. This can't be shown in EA 6.1; it will be in EA 6.5.

HTH

Neil
« Last Edit: May 15, 2006, 05:34:14 pm by KP »
The Sparx Team
[email protected]

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Concurrent activities in one class
« Reply #6 on: May 15, 2006, 05:48:55 pm »
Like this?
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Concurrent activities in one class
« Reply #7 on: May 15, 2006, 05:54:26 pm »
That's how I read it at first Bruce, but I don't think it's what they are talking about.

I was going to try the same thing as an instance model of some kind, but gave up.

I think there might be a case for the same instance of the class doing two things simultaneously, at least from an outside perspective. This might also be the case for shared (or static or whatever) methods of a class, or for a singleton. However, these might not be the only cases. What about multithreaded classes?
No, you can't have it!

revdev

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
  • Love this stuff.
    • View Profile
Re: Concurrent activities in one class
« Reply #8 on: May 16, 2006, 12:04:06 pm »
Hi KP.  The spec describes it nicely.  Can't wait for 6.5.

Thanks,
Bruce
re-Vision Development