@Override // from Closeable -- note, does NOT throw IOException public synchronized final void close() { // first do regular cleanup clear(); // then free the head/tail node as well _usedSegmentsCount = 0; // 24-Apr-2013, tatu: As per #16, must ensure proper cleaning if (_head != null) { _head.markFree(); _segmentAllocator.releaseSegment(_head); _head = _tail = null; } // and any locally recycled buffers as well S seg = _firstFreeSegment; _firstFreeSegment = null; _freeSegmentCount = 0; while (seg != null) { S next = seg.getNext(); _segmentAllocator.releaseSegment(seg); seg = next; } // one more thing: wake up thread(s) that are blocked (if any) this.notifyAll(); }
@Override // from Closeable -- note, does NOT throw IOException public synchronized final void close() { // first do regular cleanup clear(); // then free the head/tail node as well _usedSegmentsCount = 0; // 24-Apr-2013, tatu: As per #16, must ensure proper cleaning if (_head != null) { _head.markFree(); _segmentAllocator.releaseSegment(_head); _head = _tail = null; } // and any locally recycled buffers as well S seg = _firstFreeSegment; _firstFreeSegment = null; _freeSegmentCount = 0; while (seg != null) { S next = seg.getNext(); _segmentAllocator.releaseSegment(seg); seg = next; } // one more thing: wake up thread(s) that are blocked (if any) this.notifyAll(); }
old.markFree(); _segmentAllocator.releaseSegment(old);
old.markFree(); _segmentAllocator.releaseSegment(old);