Source:
<code>public FSDataOutputStream create( Path hadoopPath, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { long startTime = System.nanoTime(); Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null"); Preconditions.checkArgument( replication > 0, "replication must be a positive integer: %s", replication); Preconditions.checkArgument( blockSize > 0, "blockSize must be a positive integer: %s", blockSize); checkOpen(); logger.atFiner().log( "create(hadoopPath: %s, overwrite: %b, bufferSize: %d [ignored])", hadoopPath, overwrite, bufferSize); URI gcsPath = getGcsPath(hadoopPath); OutputStreamType type = GCS_OUTPUT_STREAM_TYPE.get(getConf(), getConf()::getEnum); OutputStream out; switch (type) { case BASIC: out = new GoogleHadoopOutputStream( this, gcsPath, statistics, new CreateFileOptions(overwrite)); break; case SYNCABLE_COMPOSITE: <START> case FLUSHABLE_COMPOSITE: <END> out = new GoogleHadoopSyncableOutputStream( this, gcsPath, statistics, new CreateFileOptions(overwrite)); break; default: throw new IOException( String.format( "Unsupported output stream type given for key '%s': '%s'", GCS_OUTPUT_STREAM_TYPE.getKey(), type)); } long duration = System.nanoTime() - startTime; increment(Counter.CREATE); increment(Counter.CREATE_TIME, duration); return new FSDataOutputStream(out, null); }</code><technical_language>put hflush configuration here, instead of accessing config object channel? I.e. add constructor boolean syncOnFlush parameter set true/false depending enum value? This place configuration depends enum value</technical_language>

Target:
public FSDataOutputStream create( Path hadoopPath, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { long startTime = System.nanoTime(); Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null"); Preconditions.checkArgument( replication > 0, "replication must be a positive integer: %s", replication); Preconditions.checkArgument( blockSize > 0, "blockSize must be a positive integer: %s", blockSize); checkOpen(); logger.atFiner().log( "create(hadoopPath: %s, overwrite: %b, bufferSize: %d [ignored])", hadoopPath, overwrite, bufferSize); URI gcsPath = getGcsPath(hadoopPath); OutputStreamType type = GCS_OUTPUT_STREAM_TYPE.get(getConf(), getConf()::getEnum); OutputStream out; switch (type) { case BASIC: out = new GoogleHadoopOutputStream( this, gcsPath, statistics, new CreateFileOptions(overwrite)); break; case FLUSHABLE_COMPOSITE: SyncableOutputStreamOptions flushableOutputStreamOptions = SyncableOutputStreamOptions.builder() .setMinSyncInterval( Duration.ofMillis( GCS_OUTPUT_STREAM_SYNC_MIN_INTERVAL_MS.get(getConf(), getConf()::getInt))) .setSyncOnFlushEnabled(true) .build(); out = new GoogleHadoopSyncableOutputStream( this, gcsPath, statistics, new CreateFileOptions(overwrite), flushableOutputStreamOptions); break; case SYNCABLE_COMPOSITE: SyncableOutputStreamOptions syncableOutputStreamOptions = SyncableOutputStreamOptions.builder() .setMinSyncInterval( Duration.ofMillis( GCS_OUTPUT_STREAM_SYNC_MIN_INTERVAL_MS.get(getConf(), getConf()::getInt))) .build(); out = new GoogleHadoopSyncableOutputStream( this, gcsPath, statistics, new CreateFileOptions(overwrite), syncableOutputStreamOptions); break; default: throw new IOException( String.format( "Unsupported output stream type given for key '%s': '%s'", GCS_OUTPUT_STREAM_TYPE.getKey(), type)); } long duration = System.nanoTime() - startTime; increment(Counter.CREATE); increment(Counter.CREATE_TIME, duration); return new FSDataOutputStream(out, null); }