Commit 0e432f47 authored by Shubham Ajmera's avatar Shubham Ajmera
Browse files

Release CloseGuard object when close is called for AbstractPlainSocketImpl

Also, enabled ResourceLeakageDetector check for URLConnectionTest.

When more than one thread has acquired fd in AbstractPlainSocketImpl,
then close called by one of the thread doesn't actually release the
fd. Fd is release when the last thread stops execution. In the current
implementation the CloseGuard object is notified about the close when
the last thread stops and finally calls socketClose.

As CloseGuard only checks if an explicit call to the "close" method is
made, the implementation shouldn't wait for the socket to actually get
closed and should notify the CloseGuard object as soon as close is
called.

The change also includes minor refactoring.

Bug: 31542223
Test: cts-tradefed run cts -m CtsLibcoreTestCases -t \
       org.apache.harmony.luni.tests.java.net.URLConnectionTest

Change-Id: I2db09b029288d734097ee2718e905d0a80d4d23e
parent 6c9fc6d2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment