persistent state /////////////////////////////////////////////////////////
543371
public Object getPersistentState() {
    Map<String, Object> persistentState = new HashMap<>();
    persistentState.put("processDefinitionId", this.processDefinitionId);
    persistentState.put("businessKey", businessKey);
    persistentState.put("activityId", this.activityId);
    persistentState.put("activityInstanceId", this.activityInstanceId);
    persistentState.put("isActive", this.isActive);
    persistentState.put("isConcurrent", this.isConcurrent);
    persistentState.put("isScope", this.isScope);
    persistentState.put("isEventScope", this.isEventScope);
    persistentState.put("parentId", parentId);
    persistentState.put("superExecution", this.superExecutionId);
    persistentState.put("superCaseExecutionId", this.superCaseExecutionId);
    persistentState.put("caseInstanceId", this.caseInstanceId);
    persistentState.put("suspensionState", this.suspensionState);
    persistentState.put("cachedEntityState", getCachedEntityState());
    persistentState.put("sequenceCounter", getSequenceCounter());
    return persistentState;
  }
639009
public function persistData()
    {
        // we sort the array first, useful for doing ris match
        if (!empty($this->userAgentsWithDeviceID)) {
            ksort($this->userAgentsWithDeviceID);

            $this->persistenceProvider->save($this->getPrefix(), $this->userAgentsWithDeviceID);
            $this->persistenceProvider->save($this->getPrefix(self::PREFIX_OVERWRITTEN), $this->overwritten_devices);
            $this->persistenceProvider->save($this->getPrefix(self::PREFIX_UA_BUCKET), array_keys($this->userAgentsWithDeviceID));
        }
    }
1314232
def persist(self):
        """"""
        # In dryrun mode, without wandb run, we don't
        # save config  on initial load, because the run directory
        # may not be created yet (because we don't know if we're
        # being used in a run context, or as an API).
        # TODO: Defer saving somehow, maybe via an events system
        path = self._config_path()
        if path is None:
            return
        with open(path, "w") as conf_file:
            conf_file.write(str(self))
14550
public synchronized boolean setToSuspended()
    {
        if ( state.get() != State.STARTED )
        {
            return false;
        }

        if ( (currentConnectionState == ConnectionState.LOST) || (currentConnectionState == ConnectionState.SUSPENDED) )
        {
            return false;
        }

        currentConnectionState = ConnectionState.SUSPENDED;
        postState(ConnectionState.SUSPENDED);

        return true;
    }
895644
def save_state(self):
        """"""
        set_setting('lastSourceDir', self.source_directory.text())
        set_setting('lastOutputDir', self.output_directory.text())
        set_setting(
            'useDefaultOutputDir', self.scenario_directory_radio.isChecked())
1248671
def persist(self):
        """"""

        self.persisted_nodes = self.graph.dump_nodes()
        self.persisted_streamers = self.graph.dump_streamers()
        self.persisted_exists = True
        self.persisted_constants = self._sensor_log.dump_constants()
585517
function onSetPersistence() {
  var type = $('#persistence-type').val();
  try {
    auth.setPersistence(type).then(function() {
      log('Persistence state change to "' + type + '".');
      alertSuccess('Persistence state change to "' + type + '".');
    }, function(error) {
      alertError('Error: ' + error.code);
    });
  } catch (error) {
    alertError('Error: ' + error.code);
  }
}
1081709
public void saveState() {
	  ByteArrayOutputStream bos = new ByteArrayOutputStream();
	  try {
		ObjectOutputStream oos = new ObjectOutputStream(bos);
		oos.writeObject(this);
		oos.flush();
		keyValStore.setValue(keyValStoreName, Hex.toHexString(bos.toByteArray()));
		bos.close();
	} catch (IOException e) {
		logger.debug(String.format("Could not save state of member %s", this.name), e);
	}
   }
983705
public void persistAttributes()
    {
        String attrName = getScopedName( STORED_ATTRS_ATTR );
        getSession().setAttribute( attrName, _scopedContainer.getSerializableAttrs() );
    }
497611
public final void persist(BatchingContext batchingContext, TransactionState tranState)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "persist", new Object[] { batchingContext, tranState});

        if ((tranState == TransactionState.STATE_COMMITTED) || (tranState == TransactionState.STATE_COMMITTING_1PC))
        {
            batchingContext.updateRedeliveredCountOnly(getPersistable());
        }
        else
        {
            throw new IllegalStateException(nls.getFormattedMessage("INVALID_TASK_OPERATION_SIMS1520", new Object[] {tranState}, null));
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "persist");
    }
1219679
void persistBlocks(String path, INodeFileUnderConstruction file)
                     throws IOException {
    waitForReady();

    writeLock();
    try {
      fsImage.getEditLog().logOpenFile(path, file);
      if (NameNode.stateChangeLog.isDebugEnabled()) {
        NameNode.stateChangeLog.debug("DIR* FSDirectory.persistBlocks: "
                                      +path+" with "+ file.getBlocks().length
                                      +" blocks is persisted to the file system");
      }
    } finally {
      writeUnlock();
    }
  }
1019646
def persist(self, storageLevel):
        
        if not isinstance(storageLevel, StorageLevel):
            raise TypeError("`storageLevel` should be a StorageLevel, got %s" % type(storageLevel))
        javaStorageLevel = self._java_matrix_wrapper._sc._getJavaStorageLevel(storageLevel)
        self._java_matrix_wrapper.call("persist", javaStorageLevel)
        return self
1126147
protected function persist()
    {
        /**
         * @var IObject $object
         */
        foreach ($this->newObjects as $object) {
            $object->getCollection()
                ->persistNewObject($object);

            /**
             * @var ICalculableProperty[] $calculableProperties
             */
            $calculableProperties = [];
            foreach ($object->getAllProperties() as $property) {
                if (!$property->getIsModified() && $property instanceof ICalculableProperty) {
                    $calculableProperties[] = $property;
                }
            }

            $this->getObjectManager()
                ->storeNewObject($object);

            foreach ($calculableProperties as $property) {
                $property->recalculate();
            }
        }

        foreach ($this->relatedObjects as $object) {
            $this->restoreObjectRelations($object, $this->relatedObjects->getInfo());
        }

        foreach ($this->modifiedObjects as $object) {
            $object->getCollection()
                ->persistModifiedObject($object);
        }

        foreach ($this->deletedObjects as $object) {
            $object->getCollection()
                ->persistDeletedObject($object);
        }

        foreach ($this->modifiedObjects as $object) {
            $object->setIsConsistent();
        }

        $this->unloadStorageObjects($this->deletedObjects);
        $this->clearObjectsState();
    }
249401
public void persist() throws Exception {
		if (!mapping.equals(initialMapping)) {
			state.clear();
			for (Map.Entry<W, W> window : mapping.entrySet()) {
				state.add(new Tuple2<>(window.getKey(), window.getValue()));
			}
		}
	}
527039
def persist(self):
        """"""
        if self.hash:
            with open(self.file_name, 'wb') as f:
                pickle.dump(self.object_property, f)
            return True
        return False
628631
@Override
    public void storePortletEntity(HttpServletRequest request, final IPortletEntity portletEntity) {
        Validate.notNull(portletEntity, "portletEntity can not be null");

        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final IPerson person = userInstance.getPerson();
        if (person.isGuest()) {
            // Never persist things for the guest user, just rely on in-memory storage
            return;
        }

        final IPortletEntityId wrapperPortletEntityId = portletEntity.getPortletEntityId();
        final Lock portletEntityLock = this.getPortletEntityLock(request, wrapperPortletEntityId);
        portletEntityLock.lock();
        try {
            final boolean shouldBePersisted = this.shouldBePersisted(portletEntity);

            if (portletEntity instanceof PersistentPortletEntityWrapper) {
                // Unwrap the persistent entity
                final IPortletEntity persistentEntity =
                        ((PersistentPortletEntityWrapper) portletEntity).getPersistentEntity();

                // Already persistent entity that still has prefs
                if (shouldBePersisted) {
                    try {
                        this.portletEntityDao.updatePortletEntity(persistentEntity);
                    } catch (HibernateOptimisticLockingFailureException e) {
                        // Check if this exception is from the entity being deleted from under us.
                        final boolean exists =
                                this.portletEntityDao.portletEntityExists(
                                        persistentEntity.getPortletEntityId());
                        if (!exists) {
                            this.logger.warn(
                                    "The persistent portlet has already been deleted: "
                                            + persistentEntity
                                            + ". The passed entity should be persistent so a new persistent entity will be created");
                            this.deletePortletEntity(request, portletEntity, true);
                            this.createPersistentEntity(persistentEntity, wrapperPortletEntityId);
                        } else {
                            throw e;
                        }
                    }
                }
                // Already persistent entity that should not be, DELETE!
                else {
                    // Capture identifiers needed to recreate the entity as session persistent
                    final IPortletDefinitionId portletDefinitionId =
                            portletEntity.getPortletDefinitionId();
                    final String layoutNodeId = portletEntity.getLayoutNodeId();
                    final int userId = portletEntity.getUserId();

                    // Delete the persistent entity
                    this.deletePortletEntity(request, portletEntity, false);

                    // Create a new entity and stick it in the cache
                    this.getOrCreatePortletEntity(
                            request, portletDefinitionId, layoutNodeId, userId);
                }
            } else if (portletEntity instanceof SessionPortletEntityImpl) {
                // There are preferences on the interim entity, create an store it
                if (shouldBePersisted) {
                    // Remove the session scoped entity from the request and session caches
                    this.deletePortletEntity(request, portletEntity, false);

                    final IPortletEntity persistentEntity =
                            createPersistentEntity(portletEntity, wrapperPortletEntityId);

                    if (this.logger.isTraceEnabled()) {
                        this.logger.trace(
                                "Session scoped entity "
                                        + wrapperPortletEntityId
                                        + " should now be persistent. Deleted it from session cache and created persistent portlet entity "
                                        + persistentEntity.getPortletEntityId());
                    }
                }
                // Session scoped entity that is still session scoped,
                else {
                    // Look for a persistent entity and delete it
                    final String channelSubscribeId = portletEntity.getLayoutNodeId();
                    final int userId = portletEntity.getUserId();
                    IPortletEntity existingPersistentEntity =
                            this.portletEntityDao.getPortletEntity(channelSubscribeId, userId);
                    if (existingPersistentEntity != null) {
                        final IPortletEntityId consistentPortletEntityId =
                                this.createConsistentPortletEntityId(existingPersistentEntity);
                        existingPersistentEntity =
                                new PersistentPortletEntityWrapper(
                                        existingPersistentEntity, consistentPortletEntityId);

                        this.logger.warn(
                                "A persistent portlet entity already exists: "
                                        + existingPersistentEntity
                                        + ". The passed entity has no preferences so the persistent version will be deleted");
                        this.deletePortletEntity(request, existingPersistentEntity, false);

                        // Add to request cache
                        final PortletEntityCache<IPortletEntity> portletEntityMap =
                                this.getPortletEntityMap(request);
                        portletEntityMap.storeIfAbsentEntity(portletEntity);

                        // Add to session cache
                        final PortletEntityCache<PortletEntityData> portletEntityDataMap =
                                this.getPortletEntityDataMap(request);
                        portletEntityDataMap.storeIfAbsentEntity(
                                ((SessionPortletEntityImpl) portletEntity).getPortletEntityData());
                    }
                }
            } else {
                throw new IllegalArgumentException(
                        "Invalid portlet entity implementation passed: "
                                + portletEntity.getClass());
            }
        } finally {
            portletEntityLock.unlock();
        }
    }
1077953
public com.google.protobuf.ByteString
      getPersistenceStateBytes() {
    java.lang.Object ref = persistenceState_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      persistenceState_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }