Acquire the lock on the object
@return object the reloaded object
358287
public function acquire()
    {
        if (!$this->_object->isSaved()) {
            throw new LockingException("Can't lock unsaved objects");
        }

        $finder = \Pheasant::instance()->finderFor($this->_object);

        return $freshObject = $finder
            ->find($this->_object->className(), $this->_object->identity()->toCriteria())
            ->lock($this->_clause)
            ->one()
            ;
    }
988318
public function acquire()
    {
        $result = $this->redis->setnx($this->name, $this->owner);

        if ($result === 1 && $this->seconds > 0) {
            $this->redis->expire($this->name, $this->seconds);
        }

        return $result === 1;
    }
1166771
protected function getLockout()
    {
        if (!$this->lockout || !$this->lockout instanceof LockoutStorage) {
            $lockout = $this->getOption(self::OPTION_LOCKOUT_STORAGE);
            $this->lockout = ($lockout and class_exists($lockout)) ? new $lockout : new RdfLockoutStorage();
        }

        return $this->lockout;
    }
217756
protected function getExistingObject()
    {
        $orderStatus = OrderStatusQuery::create()
            ->findOneById($this->getRequest()->get('order_status_id', 0));

        if (null !== $orderStatus) {
            $orderStatus->setLocale($this->getCurrentEditionLocale());
        }

        return $orderStatus;
    }
1194273
public function reload()
    {
        $freshObject = static::find($this->id());
        $this->getAttributes()->dirty()->resetChanges();
        $this->getAttributes()->setRaw($freshObject->attributes());
        return $this;
    }
844490
public function one()
    {
        $object = $this->offsetGet(0);

        // execute after the query so we save a query
        $count = $this->count();
        if ($count === 0) {
            throw new NotFoundException("Expected 1 element, found 0");
        } elseif ($count > 1) {
            throw new ConstraintException("Expected only 1 element, found $count");
        }

        return $object;
    }
58614
public function acquire()
    {
        $results = $this->redis->eval(
            $this->luaScript(), 1, $this->name, microtime(true), time(), $this->decay, $this->maxLocks
        );

        $this->decaysAt = $results[1];

        $this->remaining = max(0, $results[2]);

        return (bool) $results[0];
    }
1168290
protected function getObject()
	{
		if( !isset( $this->object ) )
		{
			$siteid = $this->context->getLocale()->getSiteId();
			$conf = array( 'siteid' => $this->context->getConfig()->get( 'madmin/cache/prefix' ) . $siteid );
			$this->object = \Aimeos\MW\Cache\Factory::create( 'Flow', $conf, $this->cache );
		}

		return $this->object;
	}
382764
public function get()
    {
        $this->verifyRefreshTokenExists();

        $token = $this->storage->get('refresh_token');

        return $this->encryptor->decrypt($token);
    }
486837
public function checkedLock()
    {
        $isLocked = ! flock($this->handle, LOCK_EX | LOCK_NB);
        if ($isLocked) {
            $this->lock();

        }
        return $isLocked;
    }
567316
protected function _getStateObject()
    {
        if (is_null($this->_oStateObject)) {
            $this->_oStateObject = oxNew(\OxidEsales\Eshop\Application\Model\State::class);
        }

        return $this->_oStateObject;
    }
892477
private function getLockID()
    {
        if ($this->lockID) {
            return $this->lockID;
        }

        $id = uniqid('thumbnail_thread_', true);

        $this->lockID = $id;
        return $id;
    }
1318953
public function lock()
    {
        $user = UserHelper::getUser($this->getUserResource());

        if ($this->getUserLocksService()->lockUser($user)) {
            $this->returnJson(['success' => true, 'message' => __('User %s successfully locked', UserHelper::getUserLogin(UserHelper::getUser($user)))]);
        } else {
            $this->returnJson(['success' => false, 'message' => __('User %s can not be locked', UserHelper::getUserLogin(UserHelper::getUser($user)))]);
        }
    }
89734
protected function acquireAccessToken()
    {
        $accessToken = null;

        if ($this->refreshTokenGrantType) {
            // Get an access token using the stored refresh token.
            if ($this->refreshToken) {
                $this->refreshTokenGrantType->setRefreshToken($this->refreshToken->getToken());
            }
            if ($this->refreshTokenGrantType->hasRefreshToken()) {
                $accessToken = $this->refreshTokenGrantType->getToken();
            }
        }

        if (!$accessToken && $this->grantType) {
            // Get a new access token.
            $accessToken = $this->grantType->getToken();
        }

        return $accessToken ?: null;
    }
449840
public function reload()
    {
        $item = $this->getById($this->getId());
        if ($item !== false) {
            $this->loadFromRow($item);
            return $this;
        } else {
            return false;
        }
    }
1000453
private function _lock() {
        if (function_exists('sem_get')) {
            $fp = sem_get($this->handler, 1, 0600, 1);
            sem_acquire ($fp);
        } else {
            $fp = fopen($this->options['temp'].$this->options['prefix'].md5($this->handler), 'w');
            flock($fp, LOCK_EX);
        }
        return $fp;
    }
833740
public function obj()
    {
        if ($this->obj === null) {
            $this->obj = $this->createOrLoadObj();

            if ($this->obj instanceof ModelInterface) {
                $this->objId = $this->obj->id();
            } else {
                $this->objId = null;
            }
        }

        return $this->obj;
    }