Commit d19241aedb19e662bb46af9e28eee499e0c46215
1 parent
35d59a00
close HandlerList's ClassLoader on Java 7 and later.
Showing
1 changed file
with
9 additions
and
0 deletions
java/common/com/mumfrey/liteloader/core/event/HandlerList.java
1 | 1 | package com.mumfrey.liteloader.core.event; |
2 | 2 | |
3 | +import java.io.Closeable; | |
3 | 4 | import java.io.IOException; |
4 | 5 | import java.lang.reflect.Constructor; |
5 | 6 | import java.net.URL; |
... | ... | @@ -165,6 +166,14 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T |
165 | 166 | { |
166 | 167 | HandlerListClassLoader<T> classLoader = new HandlerListClassLoader<T>(this.type, this.logicOp); |
167 | 168 | this.bakedHandler = classLoader.newHandler(this); |
169 | + if (classLoader instanceof Closeable) | |
170 | + { | |
171 | + try | |
172 | + { | |
173 | + ((Closeable)classLoader).close(); | |
174 | + } | |
175 | + catch (IOException ex) {} | |
176 | + } | |
168 | 177 | } |
169 | 178 | |
170 | 179 | /** | ... | ... |