|
Franz Inc, AllegroGraph | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.franz.util.Closer
public class Closer
Use or extend this class to add easy ability to safely close various resources.
Also, static Close functions for various object types. These close functions are null safe and will catch Exception and call log.warn instead of throwing.
TODO: track lastUsed and add method to removeAbandoned (beyond a timeout)
Constructor Summary | |
---|---|
Closer()
|
Method Summary | ||
---|---|---|
void |
close()
Must be called in a finally block, to close all resources added with closeLater(). |
|
|
close(info.aduna.iteration.CloseableIteration<Elem,Exc> o)
|
|
static
|
Close(info.aduna.iteration.CloseableIteration<Elem,Exc> o)
|
|
|
close(CloseableType o)
|
|
static
|
Close(CloseableType o)
|
|
|
close(CloseableType o)
|
|
static
|
Close(CloseableType o)
|
|
Model |
close(Model o)
|
|
static Model |
Close(Model o)
|
|
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager |
close(org.apache.commons.httpclient.MultiThreadedHttpConnectionManager o)
|
|
static org.apache.commons.httpclient.MultiThreadedHttpConnectionManager |
Close(org.apache.commons.httpclient.MultiThreadedHttpConnectionManager o)
|
|
|
close(Obj o)
Close an object immediately, will not be closed "later". |
|
static
|
Close(Obj o)
|
|
org.apache.commons.httpclient.SimpleHttpConnectionManager |
close(org.apache.commons.httpclient.SimpleHttpConnectionManager o)
|
|
static org.apache.commons.httpclient.SimpleHttpConnectionManager |
Close(org.apache.commons.httpclient.SimpleHttpConnectionManager o)
|
|
XMLStreamReader |
close(XMLStreamReader o)
|
|
static XMLStreamReader |
Close(XMLStreamReader o)
|
|
Collection |
closeAll(Collection objects)
Close all objects immediately, will not be closed "later". |
|
|
closeLater(Obj o)
Add a resource to be closed with close() . |
|
|
closeReflection(Obj o)
|
|
|
handleCloseException(Obj o,
Throwable e)
Subclass may override, default behavior is to log.warn and return the object. |
|
boolean |
remove(Object o)
Remove object from collection so close will not be called later. |
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Closer()
Method Detail |
---|
public <Obj> Obj closeLater(Obj o)
close()
.
public boolean remove(Object o)
closeLater(Object)
public void close()
close
in interface Closeable
Closeable.close()
public Collection closeAll(Collection objects)
public String toString()
toString
in class Object
public <Obj> Obj close(Obj o)
public <Obj> Obj handleCloseException(Obj o, Throwable e)
public <CloseableType extends Closeable> CloseableType close(CloseableType o)
public <CloseableType extends Closeable> CloseableType close(CloseableType o)
public org.apache.commons.httpclient.MultiThreadedHttpConnectionManager close(org.apache.commons.httpclient.MultiThreadedHttpConnectionManager o)
public org.apache.commons.httpclient.SimpleHttpConnectionManager close(org.apache.commons.httpclient.SimpleHttpConnectionManager o)
public <Elem,Exc extends Exception> info.aduna.iteration.CloseableIteration<Elem,Exc> close(info.aduna.iteration.CloseableIteration<Elem,Exc> o)
public XMLStreamReader close(XMLStreamReader o)
public Model close(Model o)
public <Obj> Obj closeReflection(Obj o)
public static <CloseableType extends Closeable> CloseableType Close(CloseableType o)
public static <CloseableType extends Closeable> CloseableType Close(CloseableType o)
public static org.apache.commons.httpclient.MultiThreadedHttpConnectionManager Close(org.apache.commons.httpclient.MultiThreadedHttpConnectionManager o)
public static org.apache.commons.httpclient.SimpleHttpConnectionManager Close(org.apache.commons.httpclient.SimpleHttpConnectionManager o)
public static <Elem,Exc extends Exception> info.aduna.iteration.CloseableIteration<Elem,Exc> Close(info.aduna.iteration.CloseableIteration<Elem,Exc> o)
public static XMLStreamReader Close(XMLStreamReader o)
public static Model Close(Model o)
public static <Obj> Obj Close(Obj o)
|
Copyright © 2008-2012 Franz Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |