|
Franz Inc, AllegroGraph | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.franz.util.Closer
public class Closer
Extend this class to add easy ability to safely close various resources.
TODO: track lastUsed and add method to removeAbandoned (beyond a timeout)
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.
Constructor Summary | |
---|---|
Closer()
|
Method Summary | ||
---|---|---|
void |
close()
Must be called in a finally block, to close all resources added with closeLater(). |
|
static
|
Close(info.aduna.iteration.CloseableIteration<Elem,Exc> o)
|
|
static
|
Close(CloseableType o)
|
|
static
|
Close(CloseableType o)
|
|
static Model |
Close(Model 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)
|
|
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() . |
|
boolean |
remove(Object o)
Remove from closeLater(Object) . |
|
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 <Obj> Obj close(Obj o)
public String toString()
toString
in class Object
public static <Obj> Obj Close(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 <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)
|
Copyright © 2008-2011 Franz Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |