class AbstractLifecycle {
    private boolean init;
    private boolean shutdown;

    final ReentrantLock reentrantLock = new ReentrantLock();

    public final void init() {<FILL_FUNCTION_BODY>}

    protected void doInit() {
    }

    public final void shutdown() {
        reentrantLock.lock();
        try {
            if (init && !shutdown) {
                doShutdown();
                init = false;
                shutdown = true;
            }
        }finally {
            reentrantLock.unlock();
        }
    }

    protected void doShutdown() {
    }
}

        reentrantLock.lock();
        try {
            if (!init) {
                doInit();
                init = true;
            }
        }finally {
            reentrantLock.unlock();
        }
    
<no_super_class>