Class ReferenceCountedFileDescriptor
java.lang.Object
com.martiansoftware.nailgun.ReferenceCountedFileDescriptor
Encapsulates a file descriptor plus a reference count to ensure close requests
only close the file descriptor once the last reference to the file descriptor
is released.
If not explicitly closed, the file descriptor will be closed when
this object is finalized.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate intprivate int -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
fd
private int fd -
fdRefCount
private int fdRefCount -
closePending
private boolean closePending
-
-
Constructor Details
-
ReferenceCountedFileDescriptor
public ReferenceCountedFileDescriptor(int fd)
-
-
Method Details
-
finalize
- Overrides:
finalizein classObject- Throws:
IOException
-
acquire
public int acquire() -
release
- Throws:
IOException
-
close
- Throws:
IOException
-
doClose
- Throws:
IOException
-