Abstract class to create thread-safe objects.