X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FWebLibrary.java;h=9af38e2b6bd1c7ccb565ca6f244e31ef42f40746;hp=42f7ea5ccadd4eb40d6b86cfd1f6842abab0db50;hb=0a264fbe3d5a43516006052574a5f322d9d38897;hpb=e247c76b6ae8c21b9d4af979b972140e9283dfbe diff --git a/src/be/nikiroo/fanfix/library/WebLibrary.java b/src/be/nikiroo/fanfix/library/WebLibrary.java index 42f7ea5..9af38e2 100644 --- a/src/be/nikiroo/fanfix/library/WebLibrary.java +++ b/src/be/nikiroo/fanfix/library/WebLibrary.java @@ -126,6 +126,26 @@ public class WebLibrary extends BasicLibrary { return new Version(); } + /** + * Stop the server. + * + * @throws IOException + * in case of I/O errors + */ + public void stop() throws IOException { + try { + post(WebLibraryUrls.EXIT_URL, null).close(); + } catch (Exception e) { + try { + Thread.sleep(200); + } catch (InterruptedException e1) { + } + if (getStatus() != Status.UNAVAILABLE) { + throw new IOException("Cannot exit the library", e); + } + } + } + @Override public Status getStatus() { try { @@ -154,6 +174,7 @@ public class WebLibrary extends BasicLibrary { try { Image img = new Image(in); if (img.getSize() > 0) { + img.close(); return img; } @@ -169,6 +190,7 @@ public class WebLibrary extends BasicLibrary { try { Image img = new Image(in); if (img.getSize() > 0) { + img.close(); return img; } @@ -184,6 +206,7 @@ public class WebLibrary extends BasicLibrary { try { Image img = new Image(in); if (img.getSize() > 0) { + img.close(); return img; }