State is a local class (defined inside the gzip method), and so is private, no one is calling reset but this code, and this code guarantees that only one thread is using state at a time.