XNIO version 1.2.1.GA

org.jboss.xnio
Class WeakCloseable

java.lang.Object
  extended by org.jboss.xnio.WeakCloseable
All Implemented Interfaces:
Closeable

public final class WeakCloseable
extends Object
implements Closeable

A Closeable that holds a weak reference to another Closeable, which can be used to close the other without creating a strong reference to it.


Constructor Summary
WeakCloseable(Closeable resource)
          Construct a new instance.
WeakCloseable(WeakReference<Closeable> resource)
          Construct a new instance.
 
Method Summary
 void close()
          Closes this resource and releases any system resources associated with it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeakCloseable

public WeakCloseable(WeakReference<Closeable> resource)
Construct a new instance.

Parameters:
resource - the target resource

WeakCloseable

public WeakCloseable(Closeable resource)
Construct a new instance.

Parameters:
resource - the target resource
Method Detail

close

public void close()
           throws IOException
Closes this resource and releases any system resources associated with it. If the resource is already closed, then invoking this method has no effect. In addition, if the resource has already been garbage collected, this operation has no effect.

Specified by:
close in interface Closeable
Throws:
IOException

XNIO version 1.2.1.GA

Copyright © 2008 JBoss, a division of Red Hat, Inc.