Recovers the session state from persisted JSON.

@param persisted the persisted JSON format.
425582
public void setFromJson(final byte[] persisted) {
    try {
      SessionState decoded = JACKSON.readValue(persisted, SessionState.class);
      decoded.foreachPartition(new Action1<PartitionState>() {
        int i = 0;

        @Override
        public void call(PartitionState dps) {
          partitionStates.set(i++, dps);
        }
      });
    } catch (Exception ex) {
      throw new RuntimeException("Could not decode SessionState from JSON.", ex);
    }
  }
845817
@Override
	protected void serializeTo(RawDataBuffer out)
    {
        super.serializeTo(out);
        out.writeInt(sessionId.asInt());
        out.writeBoolean(transacted);
        out.writeInt(acknowledgeMode);
    }
134790
public synchronized void persist() throws KeyStoreException, NoSuchAlgorithmException, CertificateException {
		try
		{
			FileOutputStream kso = new FileOutputStream(new File(root, _caPrivateKeystore));
			_ks.store(kso, _keystorepass);
			kso.flush();
			kso.close();
			persistCertMap();
			persistSubjectMap();
			persistKeyPairMap();
			persistPublicKeyMap();
		}
		catch(IOException ioe)
		{
			ioe.printStackTrace();
		}
	}
856713
def restore(self, state):
        


        selector = DataStreamSelector.FromString(state.get(u'selector'))
        if self.selector != selector:
            raise ArgumentError("Attempted to restore an InvalidStreamWalker with a different selector",
                                selector=self.selector, serialized_data=state)

        if state.get(u'type') != u'invalid':
            raise ArgumentError("Invalid serialized state for InvalidStreamWalker", serialized_data=state)
707
protected static function restoreFromSession()
    {
        $session = Http\Session::getInstance();

        try {
            $mapper = new UserMapper(Database::get());
            $user   = $mapper->findFromSession($session);
        } catch (\Exception $exception) {
            $user = new Data\User\User();
        }

        static::$user = $user;
    }
1359406
@Override
	protected void unserializeFrom(RawDataBuffer in)
    {
        super.unserializeFrom(in);
        sessionId = new IntegerID(in.readInt());
        transacted = in.readBoolean();
        acknowledgeMode = in.readInt();
    }
455959
public Boolean persist(final String id, final Map<String, Object> snapshot, final int maxInactiveInterval) {
        final String sid = sessionPrefix + ":" + id;
        try {
            this.executor.execute(new RedisCallback<Void>() {
                public Void execute(Jedis jedis) {
                    if (snapshot.isEmpty()) {
                        // delete session
                        jedis.del(sid);
                    } else {
                        // set session
                        jedis.setex(sid, maxInactiveInterval, serializer.serialize(snapshot));
                    }
                    return null;
                }
            });
            return Boolean.TRUE;
        } catch (Exception e) {
            log.error("failed to persist session(id={}, snapshot={}), cause:{}",
                    sid, snapshot, Throwables.getStackTraceAsString(e));
            return Boolean.FALSE;
        }
    }
824682
private Result sessionInfoForSession(String sessionId) {

        Map<String, Object> dataEachSession = new HashMap<>();
        StatsStorage ss = knownSessionIDs.get(sessionId);
        if (ss != null) {
            Map<String, Object> dataThisSession = sessionData(sessionId, ss);
            dataEachSession.put(sessionId, dataThisSession);
        }
        return Results.ok(asJson(dataEachSession)).as("application/json");
    }
479065
@Override
  public Deferred<Object> persist() {
    final byte[] q = Arrays.copyOfRange(batched_qualifier, 0, qualifier_index);
    final byte[] v = Arrays.copyOfRange(batched_value, 0, value_index);
    final byte[] r = Arrays.copyOfRange(row_key, 0, row_key.length);
    final long base_time = this.base_time; // shadow fixes issue #1436
    System.out.println(Arrays.toString(q) + "  " + Arrays.toString(v) + "  " + Arrays.toString(r));
    reset();
    return tsdb.put(r, q, v, base_time);
  }
1001283
protected void removePersistedSession(String id) {
        if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[REMOVE_PERSISTED_SESSION], id);
        }
        Connection con;
        PreparedStatement ps = null;
        boolean psClose = false;

        //If the app calls invalidate, it may not be removed from the local cache yet.
        superRemove(id);

        con = getConnection(false);
        if (con == null) {
            return;
        }
        try {
            if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[REMOVE_PERSISTED_SESSION], "before upd " + id);
            }
            ps = con.prepareStatement(delOne);
            ps.setString(1, id);
            ps.setString(2, _iStore.getId());
            ps.executeUpdate();
            ps.close();
            psClose = true;
            if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[REMOVE_PERSISTED_SESSION], "after upd " + id);
            }
            addToRecentlyInvalidatedList(id);
        } catch (SQLException se) {
            //            if (isStaleConnectionException(se)) {
            //                com.ibm.ws.ffdc.FFDCFilter.processException(se, "com.ibm.ws.session.store.db.DatabaseHashMap.removePersistedSession", "619", id);
            //            } else {
            com.ibm.ws.ffdc.FFDCFilter.processException(se, "com.ibm.ws.session.store.db.DatabaseHashMap.removePersistedSession", "621", id);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[REMOVE_PERSISTED_SESSION], "DatabaseHashMap.removeSessionsError");
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[REMOVE_PERSISTED_SESSION], "CommonMessage.exception", se);
            //            }
        } catch (Exception e) {
            com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.session.store.db.DatabaseHashMap.removePersistedSession", "626", id);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[REMOVE_PERSISTED_SESSION], "DatabaseHashMap.removeSessionsError");
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[REMOVE_PERSISTED_SESSION], "CommonMessage.exception", e);
        } finally {
            if (!psClose && ps != null)
                closeStatement(ps);
            closeConnection(con);
        }
    }
306033
def session_rollback(self, session):
        
        # this may happen when there's nothing to rollback
        if not hasattr(session, 'meepo_unique_id'):
            self.logger.debug("skipped - session_rollback")
            return

        # del session meepo id after rollback
        self.logger.debug("%s - after_rollback" % session.meepo_unique_id)
        signal("session_rollback").send(session)
        self._session_del(session)
326110
void refreshSession(boolean forceRefresh) throws AzkabanClientException {
    Preconditions.checkArgument(this.sessionCreationTime != 0);
    boolean expired = (System.nanoTime() - this.sessionCreationTime) > Duration
        .ofMinutes(this.sessionExpireInMin)
        .toNanos();

    if (expired) {
      log.info("Session expired. Generating a new session.");
    } else if (forceRefresh) {
      log.info("Force to refresh session. Generating a new session.");
    }

    if (expired || forceRefresh) {
      this.sessionId = this.sessionManager.fetchSession();
      this.sessionCreationTime = System.nanoTime();
    }
  }
483276
private void requestRestore(MemberId primary) {
    context.protocol().restore(primary, RestoreRequest.request(context.descriptor(), context.currentTerm()))
        .whenCompleteAsync((response, error) -> {
          if (error == null && response.status() == PrimaryBackupResponse.Status.OK) {
            context.resetIndex(response.index(), response.timestamp());

            Buffer buffer = HeapBuffer.wrap(response.data());
            int sessions = buffer.readInt();
            for (int i = 0; i < sessions; i++) {
              context.getOrCreateSession(buffer.readLong(), MemberId.from(buffer.readString()));
            }

            context.service().restore(new DefaultBackupInput(buffer, context.service().serializer()));
            operations.clear();
          }
        }, context.threadContext());
  }
137611
def revert(self):
        """"""
        if self.filepath:
            if path.isfile(self.filepath):
                serialised_file = open(self.filepath, "r")
                try:
                    self.state = json.load(serialised_file)
                except ValueError:
                    print("No JSON information could be read from the persistence file - could be empty: %s" % self.filepath)
                    self.state = {}
                finally:
                    serialised_file.close()
            else:
                print("The persistence file has not yet been created or does not exist, so the state cannot be read from it yet.")
        else:
            print("Filepath to the persistence file is not set. State cannot be read.")
            return False
314742
public void restoreState(FacesContext context, Object state) {

        if (context == null) {
            throw new NullPointerException();
        }
        if (state == null) {
            return;
        }
        
        if (!component.initialStateMarked() && !defaultMap.isEmpty())
        {
            defaultMap.clear();
            if(deltaMap != null && !deltaMap.isEmpty())
            {
                deltaMap.clear();
            }
        }
        
        Object[] savedState = (Object[]) state;
        if (savedState[savedState.length - 1] != null) {
            component.initialState = (Boolean) savedState[savedState.length - 1];
        }
        int length = (savedState.length-1)/2;
        for (int i = 0; i < length; i++) {
           Object value = savedState[i * 2 + 1];
            Serializable serializable = (Serializable) savedState[i * 2];
            if (value != null) {
                if (value instanceof Collection) {
                    value = restoreAttachedState(context, value);
                } else if (value instanceof StateHolderSaver) {
                    value = ((StateHolderSaver) value).restore(context);
                } else {
                    value = (value instanceof Serializable
                             ? value
                             : restoreAttachedState(context, value));
                }
            }
            if (value instanceof Map) {
                for (Map.Entry<String, Object> entry : ((Map<String, Object>) value)
                      .entrySet()) {
                    this.put(serializable, entry.getKey(), entry.getValue());
                }
            } else if (value instanceof List) {
                List<Object> list = (List) get(serializable);
                for (Object o : ((List<Object>) value)) {
                    if (list == null || !list.contains(o)) {
                        this.add(serializable, o);
                    }
                }
            } else {
                put(serializable, value);
            }
        }
    }
605742
@Override
	protected void serializeTo(RawDataBuffer out)
    {
        super.serializeTo(out);
        out.writeInt(sessionId.asInt());
    }
2417
static void restoreState(Bundle savedState) {
        stateKeeper.bundle = savedState;

        MvcComponent root = getRootComponent();
        doRestoreState(root);

        stateKeeper.bundle = null;
    }