# Initializing ThreadWork

Each `ThreadWorker` instance can expect to have its `initializeThreadWork()` method called once by the framework before any actual work is performed. This method may be implemented to do any setup necessary for that thread's execution, most commonly output files opened, or variables initialized.

Warning: It is very important that any setup necessary to execute a `WorkUnit`, including accessing batch parameters, is done here and not in the creation of `JobWork`. There is no guarantee that static variables set at the time of the `JobWork` creation will be available at this time. The framework may be calling `ThreadWork` in a different process from the creation of `JobWork`.
Parent topic: Creating a ThreadWorker