org.h2.store

## Class WriterThread

- java.lang.Object
- - org.h2.store.WriterThread

All Implemented Interfaces:
  java.lang.Runnable

    public class WriterThread
    extends java.lang.Object
    implements java.lang.Runnable

The writer thread is responsible to flush the transaction log from time to time.

### Method Summary

Methods
`static WriterThread` `create(Database database, int writeDelay)` Create and start a new writer thread for the given database.
`void` `run()`
`void` `setWriteDelay(int writeDelay)` Change the write delay
`void` `startThread()` Start the thread.
`void` `stopThread()` Stop the thread.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### setWriteDelay

    public void setWriteDelay(int writeDelay)

Change the write delay

Parameters:
  `writeDelay` - the new write delay

#### create

    public static WriterThread create(Database database,
                      int writeDelay)

Create and start a new writer thread for the given database. If the thread can't be created, this method returns null.

Parameters:
  `database` - the database
  `writeDelay` - the delay
Returns:
  the writer thread object or null

#### run

    public void run()

Specified by:
  `run` in interface `java.lang.Runnable`

#### stopThread

    public void stopThread()

Stop the thread. This method is called when closing the database.

#### startThread

    public void startThread()

Start the thread. This method is called after opening the database (to avoid deadlocks)