@SuppressWarnings("deprecation")
	private static int calculateNumberOfNetworkBuffers(Configuration configuration, long maxJvmHeapMemory) {
		final int numberOfNetworkBuffers;
		if (!hasNewNetworkConfig(configuration)) {
			// fallback: number of network buffers
			numberOfNetworkBuffers = configuration.getInteger(TaskManagerOptions.NETWORK_NUM_BUFFERS);

			checkOldNetworkConfig(numberOfNetworkBuffers);
		} else {
			if (configuration.contains(TaskManagerOptions.NETWORK_NUM_BUFFERS)) {
				LOG.info("Ignoring old (but still present) network buffer configuration via {}.",
					TaskManagerOptions.NETWORK_NUM_BUFFERS.key());
			}

			final long networkMemorySize = calculateNewNetworkBufferMemory(configuration, maxJvmHeapMemory);

			// tolerate offcuts between intended and allocated memory due to segmentation (will be available to the user-space memory)
			long numberOfNetworkBuffersLong = networkMemorySize / getPageSize(configuration);
			if (numberOfNetworkBuffersLong > Integer.MAX_VALUE) {
				throw new IllegalArgumentException("The given number of memory bytes (" + networkMemorySize
					+ ") corresponds to more than MAX_INT pages.");
			}
			numberOfNetworkBuffers = (int) numberOfNetworkBuffersLong;
		}

		return numberOfNetworkBuffers;
	}
@ SuppressWarnings ( "deprecation" ) private static int calculateNumberOfNetworkBuffers ( Configuration configuration , long maxJvmHeapMemory ) { final int numberOfNetworkBuffers ; if ( ! hasNewNetworkConfig ( configuration ) ) { numberOfNetworkBuffers = configuration . getInteger ( TaskManagerOptions . NETWORK_NUM_BUFFERS ) ; checkOldNetworkConfig ( numberOfNetworkBuffers ) ; } else { if ( configuration . contains ( TaskManagerOptions . NETWORK_NUM_BUFFERS ) ) { LOG . info ( "Ignoring old (but still present) network buffer configuration via {}." , TaskManagerOptions . NETWORK_NUM_BUFFERS . key ( ) ) ; } final long networkMemorySize = calculateNewNetworkBufferMemory ( configuration , maxJvmHeapMemory ) ; long numberOfNetworkBuffersLong = networkMemorySize / getPageSize ( configuration ) ; if ( numberOfNetworkBuffersLong > Integer . MAX_VALUE ) { throw new IllegalArgumentException ( "The given number of memory bytes (" + networkMemorySize + ") corresponds to more than MAX_INT pages." ) ; } numberOfNetworkBuffers = ( int ) numberOfNetworkBuffersLong ; } return numberOfNetworkBuffers ; }
Calculates the number of network buffers based on configuration and jvm heap size.

@param configuration configuration object
@param maxJvmHeapMemory the maximum JVM heap size (in bytes)
@return the number of network buffers