Use java.lang.ref.Cleaner in controller.cluster.io 62/93862/1
authortadei.bilan <tadei.bilan@pantheon.tech>
Fri, 23 Oct 2020 11:12:06 +0000 (14:12 +0300)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 17 Nov 2020 15:43:19 +0000 (16:43 +0100)
commitf8bb7e5da6aa039b963ebe17dcb7dee25a517aa9
tree17c9ee874edee14d6ff0acde10244014e3a0fa78
parent8143976a40029cc3a192e0e5be05f199003cd531
Use java.lang.ref.Cleaner in controller.cluster.io

Improve temporary file clean up by using a Cleaner to dispatch
cleaning tasks. Since it gives us a Cleanable, we can dispense with
a tracking map and removal from it -- Cleanable makes sure it is
called exactly once.

JIRA: CONTROLLER-1911
Change-Id: I5fb715102912359cf002129d25a7433199826982
Signed-off-by: tadei.bilan <tadei.bilan@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e0e956ecf0a4e5085f33e67f4fb73141876f1668)
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/io/FileBackedOutputStream.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/io/FileBackedOutputStreamTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/io/SharedFileBackedOutputStreamTest.java