How is job state persisted

If a running job is shut down due to server reboot or app pool recycle, is there a way to persist some custom state for the job so that when Hangfire resumes the job later, that state is automatically available?

A code example would be very helpful.