cleanup: Cleaner closing of MergingDatagramSocket.
This commit is contained in:
parent
633f05b4e5
commit
dae6d32875
@ -117,15 +117,16 @@ public class MergingDatagramSocket
|
|||||||
@Override
|
@Override
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
logger.info("Closing.");
|
|
||||||
if (isClosed())
|
if (isClosed())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
closed = true;
|
closed = true;
|
||||||
|
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 find out about the close after it's next timeout?
|
// let any thread in receive() find out about the close after it's next
|
||||||
|
// timeout?
|
||||||
synchronized (receiveLock)
|
synchronized (receiveLock)
|
||||||
{
|
{
|
||||||
receiveLock.notifyAll();
|
receiveLock.notifyAll();
|
||||||
@ -135,8 +136,9 @@ public class MergingDatagramSocket
|
|||||||
{
|
{
|
||||||
for (SocketContainer container : socketContainers)
|
for (SocketContainer container : socketContainers)
|
||||||
{
|
{
|
||||||
doRemove(container.getSocket());
|
container.close(false);
|
||||||
}
|
}
|
||||||
|
socketContainers = new SocketContainer[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user