Open-source multiplayer game server compatible with the RuneScape client
https://www.openrs2.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
527 B
23 lines
527 B
package org.openrs2.inject
|
|
|
|
import com.google.inject.Injector
|
|
import com.google.inject.Scopes
|
|
|
|
public class CloseableInjector(
|
|
private val injector: Injector
|
|
) : Injector by injector, AutoCloseable {
|
|
override fun close() {
|
|
for (binding in allBindings.values) {
|
|
if (!Scopes.isSingleton(binding)) {
|
|
continue
|
|
}
|
|
|
|
val o = binding.provider.get()
|
|
if (o !is AutoCloseable) {
|
|
continue
|
|
}
|
|
|
|
o.close()
|
|
}
|
|
}
|
|
}
|
|
|