public function fromLockObject(BatchJob $dbBatchJob, BatchJobLock $dbBatchJobLock) { $this->lockExpiration = $dbBatchJobLock->getExpiration(); $this->executionAttempts = $dbBatchJobLock->getExecutionAttempts(); $this->lockVersion = $dbBatchJobLock->getVersion(); $this->checkAgainTimeout = $dbBatchJobLock->getStartAt(null); $this->estimatedEffort = $dbBatchJobLock->getEstimatedEffort(); $this->schedulerId = $dbBatchJobLock->getSchedulerId(); $this->workerId = $dbBatchJobLock->getWorkerId(); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param BatchJobLock $value A BatchJobLock object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(BatchJobLock $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) { self::$instances[$key] = $obj; kMemoryManager::registerPeer('BatchJobLockPeer'); } } }
/** * Declares an association between this object and a BatchJobLock object. * * @param BatchJobLock $v * @return BatchJob The current object (for fluent API support) * @throws PropelException */ public function setBatchJobLock(BatchJobLock $v = null) { if ($v === null) { $this->setBatchJobLockId(NULL); } else { $this->setBatchJobLockId($v->getId()); } $this->aBatchJobLock = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the BatchJobLock object, it will not be re-added. if ($v !== null) { $v->addBatchJob($this); } return $this; }
private static function commonLockObjectUpdate(BatchJob $batchJob, BatchJobLock $batchJobLock) { $jobType = $batchJob->getJobType(); $batchJobLock->setStatus($batchJob->getStatus()); $batchJobLock->setObjectId($batchJob->getObjectId()); $batchJobLock->setObjectType($batchJob->getObjectType()); if ($batchJob->getStatus() == BatchJob::BATCHJOB_STATUS_RETRY || $batchJob->getStatus() == BatchJob::BATCHJOB_STATUS_ALMOST_DONE) { $batchJobLock->setStartAt(time() + BatchJobLockPeer::getRetryInterval($jobType)); } if ($batchJob->getLockInfo() != null) { $batchJobLock->setPriority($batchJob->getLockInfo()->getPriority()); $batchJobLock->setUrgency($batchJob->getLockInfo()->getUrgency()); $batchJobLock->setEstimatedEffort($batchJob->getLockInfo()->getEstimatedEffort()); $batchJobLock->setVersion($batchJob->getLockInfo()->getLockVersion()); } }