/** * Maps the specified key/namespace composite key to the specified value. This method should be preferred * over {@link #putAndGetOld(Object, Object, Object)} (Object, Object)} when the caller is not interested * in the old value, because this can potentially reduce copy-on-write activity. * * @param key the key. Not null. * @param namespace the namespace. Not null. * @param value the value. Can be null. */ void put(K key, N namespace, S value) { final StateTableEntry<K, N, S> e = putEntry(key, namespace); e.state = value; e.stateVersion = stateTableVersion; }
/** * Maps the specified key/namespace composite key to the specified value. This method should be preferred * over {@link #putAndGetOld(Object, Object, Object)} (Object, Object)} when the caller is not interested * in the old value, because this can potentially reduce copy-on-write activity. * * @param key the key. Not null. * @param namespace the namespace. Not null. * @param value the value. Can be null. */ void put(K key, N namespace, S value) { final StateTableEntry<K, N, S> e = putEntry(key, namespace); e.state = value; e.stateVersion = stateTableVersion; }
/** * Maps the specified key/namespace composite key to the specified value. This method should be preferred * over {@link #putAndGetOld(Object, Object, Object)} (Object, Object)} when the caller is not interested * in the old value, because this can potentially reduce copy-on-write activity. * * @param key the key. Not null. * @param namespace the namespace. Not null. * @param value the value. Can be null. */ void put(K key, N namespace, S value) { final StateTableEntry<K, N, S> e = putEntry(key, namespace); e.state = value; e.stateVersion = stateTableVersion; }
/** * Maps the specified key/namespace composite key to the specified value. This method should be preferred * over {@link #putAndGetOld(Object, Object, Object)} (Object, Object)} when the caller is not interested * in the old value, because this can potentially reduce copy-on-write activity. * * @param key the key. Not null. * @param namespace the namespace. Not null. * @param value the value. Can be null. */ void put(K key, N namespace, S value) { final StateTableEntry<K, N, S> e = putEntry(key, namespace); e.state = value; e.stateVersion = stateTableVersion; }
/** * Maps the specified key/namespace composite key to the specified value. Returns the previous state that was * registered under the composite key. * * @param key the key. Not null. * @param namespace the namespace. Not null. * @param value the value. Can be null. * @return the value of any previous mapping with the specified key or * {@code null} if there was no such mapping. */ S putAndGetOld(K key, N namespace, S value) { final StateTableEntry<K, N, S> e = putEntry(key, namespace); // copy-on-write check for state S oldState = (e.stateVersion < highestRequiredSnapshotVersion) ? getStateSerializer().copy(e.state) : e.state; e.state = value; e.stateVersion = stateTableVersion; return oldState; }
/** * Maps the specified key/namespace composite key to the specified value. Returns the previous state that was * registered under the composite key. * * @param key the key. Not null. * @param namespace the namespace. Not null. * @param value the value. Can be null. * @return the value of any previous mapping with the specified key or * {@code null} if there was no such mapping. */ S putAndGetOld(K key, N namespace, S value) { final StateTableEntry<K, N, S> e = putEntry(key, namespace); // copy-on-write check for state S oldState = (e.stateVersion < highestRequiredSnapshotVersion) ? getStateSerializer().copy(e.state) : e.state; e.state = value; e.stateVersion = stateTableVersion; return oldState; }
/** * Maps the specified key/namespace composite key to the specified value. Returns the previous state that was * registered under the composite key. * * @param key the key. Not null. * @param namespace the namespace. Not null. * @param value the value. Can be null. * @return the value of any previous mapping with the specified key or * {@code null} if there was no such mapping. */ S putAndGetOld(K key, N namespace, S value) { final StateTableEntry<K, N, S> e = putEntry(key, namespace); // copy-on-write check for state S oldState = (e.stateVersion < highestRequiredSnapshotVersion) ? getStateSerializer().copy(e.state) : e.state; e.state = value; e.stateVersion = stateTableVersion; return oldState; }
/** * Maps the specified key/namespace composite key to the specified value. Returns the previous state that was * registered under the composite key. * * @param key the key. Not null. * @param namespace the namespace. Not null. * @param value the value. Can be null. * @return the value of any previous mapping with the specified key or * {@code null} if there was no such mapping. */ S putAndGetOld(K key, N namespace, S value) { final StateTableEntry<K, N, S> e = putEntry(key, namespace); // copy-on-write check for state S oldState = (e.stateVersion < highestRequiredSnapshotVersion) ? getStateSerializer().copy(e.state) : e.state; e.state = value; e.stateVersion = stateTableVersion; return oldState; }
/** * @param key the key of the mapping to remove. Not null. * @param namespace the namespace of the mapping to remove. Not null. * @param value the value that is the second input for the transformation. * @param transformation the transformation function to apply on the old state and the given value. * @param <T> type of the value that is the second input to the {@link StateTransformationFunction}. * @throws Exception exception that happen on applying the function. * @see #transform(Object, Object, StateTransformationFunction). */ <T> void transform( K key, N namespace, T value, StateTransformationFunction<S, T> transformation) throws Exception { final StateTableEntry<K, N, S> entry = putEntry(key, namespace); // copy-on-write check for state entry.state = transformation.apply( (entry.stateVersion < highestRequiredSnapshotVersion) ? getStateSerializer().copy(entry.state) : entry.state, value); entry.stateVersion = stateTableVersion; }
/** * @param key the key of the mapping to remove. Not null. * @param namespace the namespace of the mapping to remove. Not null. * @param value the value that is the second input for the transformation. * @param transformation the transformation function to apply on the old state and the given value. * @param <T> type of the value that is the second input to the {@link StateTransformationFunction}. * @throws Exception exception that happen on applying the function. * @see #transform(Object, Object, StateTransformationFunction). */ <T> void transform( K key, N namespace, T value, StateTransformationFunction<S, T> transformation) throws Exception { final StateTableEntry<K, N, S> entry = putEntry(key, namespace); // copy-on-write check for state entry.state = transformation.apply( (entry.stateVersion < highestRequiredSnapshotVersion) ? getStateSerializer().copy(entry.state) : entry.state, value); entry.stateVersion = stateTableVersion; }
/** * @param key the key of the mapping to remove. Not null. * @param namespace the namespace of the mapping to remove. Not null. * @param value the value that is the second input for the transformation. * @param transformation the transformation function to apply on the old state and the given value. * @param <T> type of the value that is the second input to the {@link StateTransformationFunction}. * @throws Exception exception that happen on applying the function. * @see #transform(Object, Object, StateTransformationFunction). */ <T> void transform( K key, N namespace, T value, StateTransformationFunction<S, T> transformation) throws Exception { final StateTableEntry<K, N, S> entry = putEntry(key, namespace); // copy-on-write check for state entry.state = transformation.apply( (entry.stateVersion < highestRequiredSnapshotVersion) ? getStateSerializer().copy(entry.state) : entry.state, value); entry.stateVersion = stateTableVersion; }
/** * @param key the key of the mapping to remove. Not null. * @param namespace the namespace of the mapping to remove. Not null. * @param value the value that is the second input for the transformation. * @param transformation the transformation function to apply on the old state and the given value. * @param <T> type of the value that is the second input to the {@link StateTransformationFunction}. * @throws Exception exception that happen on applying the function. * @see #transform(Object, Object, StateTransformationFunction). */ <T> void transform( K key, N namespace, T value, StateTransformationFunction<S, T> transformation) throws Exception { final StateTableEntry<K, N, S> entry = putEntry(key, namespace); // copy-on-write check for state entry.state = transformation.apply( (entry.stateVersion < highestRequiredSnapshotVersion) ? getStateSerializer().copy(entry.state) : entry.state, value); entry.stateVersion = stateTableVersion; }