private Task < Exec . Result > getBuildTask ( final String hash , final InputStream body ) { Task < Exec . Result > existing = _inFlightBuildTasks . get ( hash ) ; if ( existing != null ) { LOG . info ( "using in flight shareable: " + hash ) ; return existing . shareable ( ) ; } else { Task < Exec . Result > newBuildTask = createNewBuildTask ( hash , body ) ; existing = _inFlightBuildTasks . putIfAbsent ( hash , newBuildTask ) ; if ( existing != null ) { LOG . info ( "using in flight shareable: " + hash ) ; return existing . shareable ( ) ; } else { return newBuildTask ; } } }
Returns task that builds graph using graphviz . Returned task might be shared with other concurrent requests .