justcoding121/titanium-web-proxy

Throwing exceptions wastes resources

ByronAP opened this issue · 2 comments

It looks like there are a few places where exceptions are intentionally being throw. This seems to have a very adverse effect on performance, especially in RequestHandler and ResponseHandler and how they bubble up.

Agree, I also hate that much exceptions. Something shoud be done :)

I noted up to 54 exception explicitly thrown. I am to blame for writing the most new exceptions :-)
https://github.com/justcoding121/Titanium-Web-Proxy/search?q=throw

Some of the exceptions are thrown so that the client/server connection can be disposed on the parent call. A way to reduce this would be to log the error, then dispose the connections immediately if they are in scope. If client/server connections are in parent scope, we need to return an error status from child method to parent method, so that parent can call dispose.