Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] can somebody explain to me the 2 IDbgpTermination and IDbgpTerminationListener

hmmm
then i really need to dive in a bit more into that code.

Because everything is referencing everything and calling everything is it very hard to see for me directly what should do what ..
I will look if i can make head and tails of it and then try to figure out what the entry and exit points are

johan


On Wed, May 7, 2008 at 2:01 PM, Andrey Platov <andrey@xxxxxxxxx> wrote:
Also Johan, please feel free to rewrite this logic if you'd like.

----- Original Message -----
From: "Alex Panchenko" <alex@xxxxxxxxx>
To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
Sent: Wednesday, May 7, 2008 5:43:38 PM GMT +06:00 Almaty, Novosibirsk
Subject: Re: [Dltk-dev] can somebody explain to me the 2 IDbgpTermination and   IDbgpTerminationListener

Johan,

Yes, you are correct - all the "termination" logic looks strange.
We would like to fix it before 1.0 is released.

I believe we should move most of the logic into the DbgpTermination
class and simplify code its descendants.

Alex


Johan Compagner wrote:
> Because what method should exactly do what??
>
> for example we have the DbgpDebugingEngine
> that implements both
>
> IDbgpTerminationListener:
>   void objectTerminated(Object object, Exception e);
>
>
> IDbgpTermination:
>     void addTerminationListener(IDbgpTerminationListener listener);
>
>     void removeTerminationListener(IDbgpTerminationListener listener);
>
>     void requestTermination();
>
>     void waitTerminated() throws InterruptedException;
>
>
> The problem is that in DbgpDebugingEngine
> the socket.close() is called in
>
>     public void requestTermination() {
>         synchronized (terminatedLock) {
>             if (terminated) {
>                 return;
>             }
>             socket.close()
>
> But that boolean terminated is set in:
>
> public void objectTerminated(Object object, Exception e) {
>         synchronized (terminatedLock) {
>             if (terminated)
>                 return;
>
>             receiver.removeTerminationListener(this);
>             try {
>                 receiver.waitTerminated();
>             } catch (InterruptedException e1) {
>                 // OK, interrupted
>             }
>
>             terminated = true;
>         }
>
> and that is called before requestTermination() (at least in the
> situations i am in now)
> so socket.close() isnt called. So my debug client still thinks it is
> connected...
>
>
> So should socket.close() be called in objectTerminated()
> or should requestTermination not look at that terminated flag at all?
> because they are not really really related both are from different
> interfaces (behaviors)
>
> the simple fix i can think of is this:
>
>     public void requestTermination() {
>         try {
>             socket.close();
>         } catch (IOException e) {
>             // TODO: log exception
>             e.printStackTrace();
>         }
>     }
>
>
> But that code is a bit wired in each other that dont really know what
> is the head or what is the tail.... :(
>
> johan
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


Back to the top