class AccountStateServiceImpl implements AccountStateService {

    @Override
    public synchronized AccountState getOrCreateAccountState(AccountAddress address, Accounts accounts) throws IOException, ClassNotFoundException {
        logger.traceEntry("params: {} {}", address, accounts);

        Util.check(address != null, "address!=null");
        Util.check(accounts != null, "accounts!=null");

        AccountState state = getAccountState(address, accounts);

        if (state != null) {
            logger.trace("state not null");
            return logger.traceExit(state);
        }

        logger.trace("Create account state...");
        setAccountState(address, new AccountState(address), accounts);
        return logger.traceExit(getAccountState(address, accounts));
    }

}