fix: Propagates close() to the underlying DatagramSocket implementation
fixing a leak of fd's while the the objects waiting to be finalized.
This commit is contained in:
parent
72d1b1441c
commit
7c63d5202c
@ -202,9 +202,13 @@ public class ComponentSocket
|
|||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
Component component = this.component;
|
||||||
|
if (component != null)
|
||||||
{
|
{
|
||||||
component.getParentStream().removePairStateChangeListener(this);
|
component.getParentStream().removePairStateChangeListener(this);
|
||||||
component = null;
|
this.component = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,6 +136,13 @@ public class MergingDatagramSocket
|
|||||||
@Override
|
@Override
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
super.close();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
|
||||||
if (isClosed())
|
if (isClosed())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -144,8 +151,8 @@ public class MergingDatagramSocket
|
|||||||
logger.info("Closing.");
|
logger.info("Closing.");
|
||||||
|
|
||||||
// XXX do we want to risk obtaining the lock here, or should we just
|
// XXX do we want to risk obtaining the lock here, or should we just
|
||||||
// let any thread in receive() find out about the close after it's next
|
// let any thread in receive() find out about the close after it's
|
||||||
// timeout?
|
// next timeout?
|
||||||
synchronized (receiveLock)
|
synchronized (receiveLock)
|
||||||
{
|
{
|
||||||
receiveLock.notifyAll();
|
receiveLock.notifyAll();
|
||||||
@ -161,6 +168,7 @@ public class MergingDatagramSocket
|
|||||||
socketContainers = new SocketContainer[0];
|
socketContainers = new SocketContainer[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user