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

They should be closed somewhere near requestTermination() methods, but as we discusses it yesterday - this code should be fixed.

I think we should rewrite it in the following way (basic idea):

// in DbgpTermination
public final requestTermination() {
  if (terminated) return;
  terminated = true;
  doRequstTermination();
}

protected abstract void doRequstTermination();

doRequstTermination() should be implemented in all descendants and
a) relay requestTermination() method call to all objects it knows without additional checks, because the check is moved to the requestTermination().
and
b) closed resources

Alex


Johan Compagner wrote:
ahhh.. :)

i am not looking at the DbgpServer because that is not the thing i use..

DbgpService -> DbgpServer
and that one creates a DbgpDebugingEngine and DbgpSession objects for a socket.

and shutdown of the service only calls shutdown on DbgpServer that closes the server socket..
But who closes/cleans up the DbgpDebugingEngine sockets??

But mine is different, i have a:

RemoteDbgpService that creates a DbgpClient and that one gets a port number that it doesnt use to create ServerSockets
but:

                Socket client = new Socket("127.0.0.1",port);
                client.setSoTimeout(clientTimeout);
                   
                    try {
                        dbgpDebugingEngine = new DbgpDebugingEngine(client);
                        session = new DbgpSession(dbgpDebugingEngine);
                        listener.clientConnected(session);

and in requestTermination of DbgpClient i call session.terminate()
that closes the socket..

Maybe i just shouldnt do that but then i am curious who cleans up the socket...
Because that should happen i dont want my remote client (that can live longer then the eclipse client) still have a socket at some point
i want to clean up correctly.

johan


On Thu, May 8, 2008 at 2:18 PM, Alex Panchenko <alex@xxxxxxxxx> wrote:
Johan Compagner wrote:

we first called shutdown on the service and then on the debug targets.

That seems to be the other way around because th debug targes depend on the service.
The dependency from debug targets is only to call unregisterAcceptor(). And there is nothing bad to call it after service shutdown.

The idea to call service shutdown before is to prevent new attachments to occur during shutdown process.
There is no need to change this.

i do think there is..
Because if i dont switch them i get all kinds of io exceptions

Because  the code:

((ScriptDebugTarget) target).shutdown();

does use the dbgpService to send the terminate command to the other side.

If you first do dbgpService.shutdown() we have a problem because the that cleans up and shutdown the dbgpService
that then the shutdown of the target still want to use..
As I can see the responsibility of DbgpService is to instantiate DbgpServer.
And the responsibility of DbgpServer is to accept new connections - it does not take part in IO operations besides that.

Are we talking about the same piece of code?

Alex

_______________________________________________
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