Mercurial Hosting > luan
diff src/luan/modules/http/LuanHandler.java @ 1231:0b75337bb91a
better closing
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 05 Apr 2018 16:38:33 -0600 |
parents | c7adcdf79bf2 |
children | c147e2e877e3 |
line wrap: on
line diff
--- a/src/luan/modules/http/LuanHandler.java Wed Apr 04 14:54:29 2018 -0600 +++ b/src/luan/modules/http/LuanHandler.java Thu Apr 05 16:38:33 2018 -0600 @@ -1,5 +1,6 @@ package luan.modules.http; +import java.io.Closeable; import java.io.Writer; import java.io.PrintWriter; import java.io.IOException; @@ -25,7 +26,7 @@ import luan.modules.PackageLuan; -public class LuanHandler implements Handler { +public class LuanHandler implements Handler, Closeable { private final LuanState luanInit; private final Logger logger; private final ReadWriteLock lock = new ReentrantReadWriteLock(); @@ -40,8 +41,8 @@ } } - public LuanHandler(LuanState luan,String loggerRoot) { - this.luanInit = luan; + public LuanHandler(LuanState luanInit,String loggerRoot) { + this.luanInit = luanInit; if( loggerRoot==null ) loggerRoot = ""; logger = LoggerFactory.getLogger(loggerRoot+LuanHandler.class.getName()); @@ -52,6 +53,7 @@ throw new RuntimeException(e); } setLuan(); + luanInit.onClose(this); } private void setLuan() { @@ -92,7 +94,7 @@ } } - public void close() throws IOException { + public void close() { synchronized(luan) { luan.close(); }