flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/CopyOnWriteStateTable.java
/**
	 * Creates and inserts a new {@link StateTableEntry}.
	 */
Creates and inserts a new  StateTableEntry.
Creates and inserts a new StateTableEntry .
private StateTableEntry<K, N, S> addNewStateTableEntry(
			StateTableEntry<K, N, S>[] table,
			K key,
			N namespace,
			int hash) {
		if (namespace.equals(lastNamespace)) {
			namespace = lastNamespace;
		} else {
			lastNamespace = namespace;
		}
		int index = hash & (table.length - 1);
		StateTableEntry<K, N, S> newEntry = new StateTableEntry<>(
				key,
				namespace,
				null,
				hash,
				table[index],
				stateTableVersion,
				stateTableVersion);
		table[index] = newEntry;
		if (table == primaryTable) {
			++primaryTableSize;
		} else {
			++incrementalRehashTableSize;
		}
		return newEntry;
	}
private StateTableEntry < K , N , S > addNewStateTableEntry ( StateTableEntry < K , N , S > [ ] table , K key , N namespace , int hash ) { if ( namespace . equals ( lastNamespace ) ) { namespace = lastNamespace ; } else { lastNamespace = namespace ; } int index = hash & ( table . length - 1 ) ; StateTableEntry < K , N , S > newEntry = new StateTableEntry < > ( key , namespace , null , hash , table [ index ] , stateTableVersion , stateTableVersion ) ; table [ index ] = newEntry ; if ( table == primaryTable ) { ++ primaryTableSize ; } else { ++ incrementalRehashTableSize ; } return newEntry ; }
Creates and inserts a new {@link StateTableEntry}.
Creates and inserts a new { @link StateTableEntry } .
// small optimization that aims to avoid holding references on duplicate namespace objects