idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
15,400 | private static Configuration loadYAMLResource ( File file ) { final Configuration config = new Configuration ( ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( file ) ) ) ) { String line ; int lineNo = 0 ; while ( ( line = reader . readLine ( ) ) != null ) { lineNo ++... | Loads a YAML - file of key - value pairs . |
15,401 | public static boolean isSensitive ( String key ) { Preconditions . checkNotNull ( key , "key is null" ) ; final String keyInLower = key . toLowerCase ( ) ; for ( String hideKey : SENSITIVE_KEYS ) { if ( keyInLower . length ( ) >= hideKey . length ( ) && keyInLower . contains ( hideKey ) ) { return true ; } } return fal... | Check whether the key is a hidden key . |
15,402 | public boolean close ( ) { lock . lock ( ) ; try { if ( open ) { if ( elements . isEmpty ( ) ) { open = false ; nonEmpty . signalAll ( ) ; return true ; } else { return false ; } } else { return true ; } } finally { lock . unlock ( ) ; } } | Tries to close the queue . Closing the queue only succeeds when no elements are in the queue when this method is called . Checking whether the queue is empty and marking the queue as closed is one atomic operation . |
15,403 | public boolean addIfOpen ( E element ) { requireNonNull ( element ) ; lock . lock ( ) ; try { if ( open ) { elements . addLast ( element ) ; if ( elements . size ( ) == 1 ) { nonEmpty . signalAll ( ) ; } } return open ; } finally { lock . unlock ( ) ; } } | Tries to add an element to the queue if the queue is still open . Checking whether the queue is open and adding the element is one atomic operation . |
15,404 | public void add ( E element ) throws IllegalStateException { requireNonNull ( element ) ; lock . lock ( ) ; try { if ( open ) { elements . addLast ( element ) ; if ( elements . size ( ) == 1 ) { nonEmpty . signalAll ( ) ; } } else { throw new IllegalStateException ( "queue is closed" ) ; } } finally { lock . unlock ( )... | Adds the element to the queue or fails with an exception if the queue is closed . Checking whether the queue is open and adding the element is one atomic operation . |
15,405 | public E peek ( ) { lock . lock ( ) ; try { if ( open ) { if ( elements . size ( ) > 0 ) { return elements . getFirst ( ) ; } else { return null ; } } else { throw new IllegalStateException ( "queue is closed" ) ; } } finally { lock . unlock ( ) ; } } | Returns the queue s next element without removing it if the queue is non - empty . Otherwise returns null . |
15,406 | public E poll ( ) { lock . lock ( ) ; try { if ( open ) { if ( elements . size ( ) > 0 ) { return elements . removeFirst ( ) ; } else { return null ; } } else { throw new IllegalStateException ( "queue is closed" ) ; } } finally { lock . unlock ( ) ; } } | Returns the queue s next element and removes it the queue is non - empty . Otherwise this method returns null . |
15,407 | public List < E > pollBatch ( ) { lock . lock ( ) ; try { if ( open ) { if ( elements . size ( ) > 0 ) { ArrayList < E > result = new ArrayList < > ( elements ) ; elements . clear ( ) ; return result ; } else { return null ; } } else { throw new IllegalStateException ( "queue is closed" ) ; } } finally { lock . unlock ... | Returns all of the queue s current elements in a list if the queue is non - empty . Otherwise this method returns null . |
15,408 | public E getElementBlocking ( ) throws InterruptedException { lock . lock ( ) ; try { while ( open && elements . isEmpty ( ) ) { nonEmpty . await ( ) ; } if ( open ) { return elements . removeFirst ( ) ; } else { throw new IllegalStateException ( "queue is closed" ) ; } } finally { lock . unlock ( ) ; } } | Returns the next element in the queue . If the queue is empty this method waits until at least one element is added . |
15,409 | public E getElementBlocking ( long timeoutMillis ) throws InterruptedException { if ( timeoutMillis == 0L ) { return getElementBlocking ( ) ; } else if ( timeoutMillis < 0L ) { throw new IllegalArgumentException ( "invalid timeout" ) ; } final long deadline = System . nanoTime ( ) + timeoutMillis * 1_000_000L ; lock . ... | Returns the next element in the queue . If the queue is empty this method waits at most a certain time until an element becomes available . If no element is available after that time the method returns null . |
15,410 | public List < E > getBatchBlocking ( ) throws InterruptedException { lock . lock ( ) ; try { while ( open && elements . isEmpty ( ) ) { nonEmpty . await ( ) ; } if ( open ) { ArrayList < E > result = new ArrayList < > ( elements ) ; elements . clear ( ) ; return result ; } else { throw new IllegalStateException ( "queu... | Gets all the elements found in the list or blocks until at least one element was added . If the queue is empty when this method is called it blocks until at least one element is added . |
15,411 | public void onCompleteHandler ( StreamElementQueueEntry < ? > streamElementQueueEntry ) throws InterruptedException { lock . lockInterruptibly ( ) ; try { if ( firstSet . remove ( streamElementQueueEntry ) ) { completedQueue . offer ( streamElementQueueEntry ) ; while ( firstSet . isEmpty ( ) && firstSet != lastSet ) {... | Callback for onComplete events for the given stream element queue entry . Whenever a queue entry is completed it is checked whether this entry belongs to the first set . If this is the case then the element is added to the completed entries queue from where it can be consumed . If the first set becomes empty then the n... |
15,412 | private < T > void addEntry ( StreamElementQueueEntry < T > streamElementQueueEntry ) { assert ( lock . isHeldByCurrentThread ( ) ) ; if ( streamElementQueueEntry . isWatermark ( ) ) { lastSet = new HashSet < > ( capacity ) ; if ( firstSet . isEmpty ( ) ) { firstSet . add ( streamElementQueueEntry ) ; } else { Set < St... | Add the given stream element queue entry to the current last set if it is not a watermark . If it is a watermark then stop adding to the current last set insert the watermark into its own set and add a new last set . |
15,413 | private StreamGraph generateInternal ( List < StreamTransformation < ? > > transformations ) { for ( StreamTransformation < ? > transformation : transformations ) { transform ( transformation ) ; } return streamGraph ; } | This starts the actual transformation beginning from the sinks . |
15,414 | private String determineSlotSharingGroup ( String specifiedGroup , Collection < Integer > inputIds ) { if ( specifiedGroup != null ) { return specifiedGroup ; } else { String inputGroup = null ; for ( int id : inputIds ) { String inputGroupCandidate = streamGraph . getSlotSharingGroup ( id ) ; if ( inputGroup == null )... | Determines the slot sharing group for an operation based on the slot sharing group set by the user and the slot sharing groups of the inputs . |
15,415 | public static void installAsShutdownHook ( Logger logger , long delayMillis ) { checkArgument ( delayMillis >= 0 , "delay must be >= 0" ) ; Thread shutdownHook = new JvmShutdownSafeguard ( delayMillis ) ; ShutdownHookUtil . addShutdownHookThread ( shutdownHook , JvmShutdownSafeguard . class . getSimpleName ( ) , logger... | Installs the safeguard shutdown hook . The maximum time that the JVM is allowed to spend on shutdown before being killed is the given number of milliseconds . |
15,416 | public void start ( JobLeaderIdActions initialJobLeaderIdActions ) throws Exception { if ( isStarted ( ) ) { clear ( ) ; } this . jobLeaderIdActions = Preconditions . checkNotNull ( initialJobLeaderIdActions ) ; } | Start the service with the given job leader actions . |
15,417 | public void clear ( ) throws Exception { Exception exception = null ; for ( JobLeaderIdListener listener : jobLeaderIdListeners . values ( ) ) { try { listener . stop ( ) ; } catch ( Exception e ) { exception = ExceptionUtils . firstOrSuppressed ( e , exception ) ; } } if ( exception != null ) { ExceptionUtils . rethro... | Stop and clear the currently registered job leader id listeners . |
15,418 | public void addJob ( JobID jobId ) throws Exception { Preconditions . checkNotNull ( jobLeaderIdActions ) ; LOG . debug ( "Add job {} to job leader id monitoring." , jobId ) ; if ( ! jobLeaderIdListeners . containsKey ( jobId ) ) { LeaderRetrievalService leaderRetrievalService = highAvailabilityServices . getJobManager... | Add a job to be monitored to retrieve the job leader id . |
15,419 | public void removeJob ( JobID jobId ) throws Exception { LOG . debug ( "Remove job {} from job leader id monitoring." , jobId ) ; JobLeaderIdListener listener = jobLeaderIdListeners . remove ( jobId ) ; if ( listener != null ) { listener . stop ( ) ; } } | Remove the given job from being monitored by the service . |
15,420 | public static Configuration generateTaskManagerConfiguration ( Configuration baseConfig , String jobManagerHostname , int jobManagerPort , int numSlots , FiniteDuration registrationTimeout ) { Configuration cfg = cloneConfiguration ( baseConfig ) ; if ( jobManagerHostname != null && ! jobManagerHostname . isEmpty ( ) )... | Generate a task manager configuration . |
15,421 | public static void writeConfiguration ( Configuration cfg , File file ) throws IOException { try ( FileWriter fwrt = new FileWriter ( file ) ; PrintWriter out = new PrintWriter ( fwrt ) ) { for ( String key : cfg . keySet ( ) ) { String value = cfg . getString ( key , null ) ; out . print ( key ) ; out . print ( ": " )... | Writes a Flink YAML config file from a Flink Configuration object . |
15,422 | public static void substituteDeprecatedConfigKey ( Configuration config , String deprecated , String designated ) { if ( ! config . containsKey ( designated ) ) { final String valueForDeprecated = config . getString ( deprecated , null ) ; if ( valueForDeprecated != null ) { config . setString ( designated , valueForDe... | Sets the value of a new config key to the value of a deprecated config key . |
15,423 | public static void substituteDeprecatedConfigPrefix ( Configuration config , String deprecatedPrefix , String designatedPrefix ) { final int prefixLen = deprecatedPrefix . length ( ) ; Configuration replacement = new Configuration ( ) ; for ( String key : config . keySet ( ) ) { if ( key . startsWith ( deprecatedPrefix... | Sets the value of a new config key to the value of a deprecated config key . Taking into account the changed prefix . |
15,424 | public static String getTaskManagerShellCommand ( Configuration flinkConfig , ContaineredTaskManagerParameters tmParams , String configDirectory , String logDirectory , boolean hasLogback , boolean hasLog4j , boolean hasKrb5 , Class < ? > mainClass ) { final Map < String , String > startCommandValues = new HashMap < > ... | Generates the shell command to start a task manager . |
15,425 | public static String getStartCommand ( String template , Map < String , String > startCommandValues ) { for ( Map . Entry < String , String > variable : startCommandValues . entrySet ( ) ) { template = template . replace ( "%" + variable . getKey ( ) + "%" , variable . getValue ( ) ) ; } return template ; } | Replaces placeholders in the template start command with values from startCommandValues . |
15,426 | public static Configuration cloneConfiguration ( Configuration configuration ) { final Configuration clonedConfiguration = new Configuration ( configuration ) ; if ( clonedConfiguration . getBoolean ( USE_LOCAL_DEFAULT_TMP_DIRS ) ) { clonedConfiguration . removeConfig ( CoreOptions . TMP_DIRS ) ; clonedConfiguration . ... | Clones the given configuration and resets instance specific config options . |
15,427 | public boolean readBufferFromFileChannel ( Buffer buffer ) throws IOException { checkArgument ( fileChannel . size ( ) - fileChannel . position ( ) > 0 ) ; header . clear ( ) ; fileChannel . read ( header ) ; header . flip ( ) ; final boolean isBuffer = header . getInt ( ) == 1 ; final int size = header . getInt ( ) ; ... | Reads data from the object s file channel into the given buffer . |
15,428 | public void collect ( final KEY key , final VALUE val ) throws IOException { this . outTuple . f0 = key ; this . outTuple . f1 = val ; this . flinkCollector . collect ( outTuple ) ; } | Use the wrapped Flink collector to collect a key - value pair for Flink . |
15,429 | public boolean isMatchingTopic ( String topic ) { if ( isFixedTopics ( ) ) { return getFixedTopics ( ) . contains ( topic ) ; } else { return topicPattern . matcher ( topic ) . matches ( ) ; } } | Check if the input topic matches the topics described by this KafkaTopicDescriptor . |
15,430 | public static OffsetCommitMode fromConfiguration ( boolean enableAutoCommit , boolean enableCommitOnCheckpoint , boolean enableCheckpointing ) { if ( enableCheckpointing ) { return ( enableCommitOnCheckpoint ) ? OffsetCommitMode . ON_CHECKPOINTS : OffsetCommitMode . DISABLED ; } else { return ( enableAutoCommit ) ? Off... | Determine the offset commit mode using several configuration values . |
15,431 | void assignExclusiveSegments ( List < MemorySegment > segments ) { checkState ( this . initialCredit == 0 , "Bug in input channel setup logic: exclusive buffers have " + "already been set for this input channel." ) ; checkNotNull ( segments ) ; checkArgument ( segments . size ( ) > 0 , "The number of exclusive buffers ... | Assigns exclusive buffers to this input channel and this method should be called only once after this input channel is created . |
15,432 | public void requestSubpartition ( int subpartitionIndex ) throws IOException , InterruptedException { if ( partitionRequestClient == null ) { partitionRequestClient = connectionManager . createPartitionRequestClient ( connectionId ) ; partitionRequestClient . requestSubpartition ( partitionId , subpartitionIndex , this... | Requests a remote subpartition . |
15,433 | void retriggerSubpartitionRequest ( int subpartitionIndex ) throws IOException , InterruptedException { checkState ( partitionRequestClient != null , "Missing initial subpartition request." ) ; if ( increaseBackoff ( ) ) { partitionRequestClient . requestSubpartition ( partitionId , subpartitionIndex , this , getCurren... | Retriggers a remote subpartition request . |
15,434 | public void recycle ( MemorySegment segment ) { int numAddedBuffers ; synchronized ( bufferQueue ) { if ( isReleased . get ( ) ) { try { inputGate . returnExclusiveSegments ( Collections . singletonList ( segment ) ) ; return ; } catch ( Throwable t ) { ExceptionUtils . rethrow ( t ) ; } } numAddedBuffers = bufferQueue... | Exclusive buffer is recycled to this input channel directly and it may trigger return extra floating buffer and notify increased credit to the producer . |
15,435 | void onSenderBacklog ( int backlog ) throws IOException { int numRequestedBuffers = 0 ; synchronized ( bufferQueue ) { if ( isReleased . get ( ) ) { return ; } numRequiredBuffers = backlog + initialCredit ; while ( bufferQueue . getAvailableBufferSize ( ) < numRequiredBuffers && ! isWaitingForFloatingBuffers ) { Buffer... | Receives the backlog from the producer s buffer response . If the number of available buffers is less than backlog + initialCredit it will request floating buffers from the buffer pool and then notify unannounced credits to the producer . |
15,436 | public void registerOngoingOperation ( final K operationKey , final CompletableFuture < R > operationResultFuture ) { final ResultAccessTracker < R > inProgress = ResultAccessTracker . inProgress ( ) ; registeredOperationTriggers . put ( operationKey , inProgress ) ; operationResultFuture . whenComplete ( ( result , er... | Registers an ongoing operation with the cache . |
15,437 | public InetSocketAddress getServerAddress ( ) { synchronized ( lock ) { Preconditions . checkState ( state != State . CREATED , "The RestServerEndpoint has not been started yet." ) ; Channel server = this . serverChannel ; if ( server != null ) { try { return ( ( InetSocketAddress ) server . localAddress ( ) ) ; } catc... | Returns the address on which this endpoint is accepting requests . |
15,438 | protected CompletableFuture < Void > shutDownInternal ( ) { synchronized ( lock ) { CompletableFuture < ? > channelFuture = new CompletableFuture < > ( ) ; if ( serverChannel != null ) { serverChannel . close ( ) . addListener ( finished -> { if ( finished . isSuccess ( ) ) { channelFuture . complete ( null ) ; } else ... | Stops this REST server endpoint . |
15,439 | static void createUploadDir ( final Path uploadDir , final Logger log , final boolean initialCreation ) throws IOException { if ( ! Files . exists ( uploadDir ) ) { if ( initialCreation ) { log . info ( "Upload directory {} does not exist. " + uploadDir ) ; } else { log . warn ( "Upload directory {} has been deleted ex... | Creates the upload dir if needed . |
15,440 | public MatchIterator get ( long key , int hashCode ) { int bucket = hashCode & numBucketsMask ; int bucketOffset = bucket << 4 ; MemorySegment segment = buckets [ bucketOffset >>> segmentSizeBits ] ; int segOffset = bucketOffset & segmentSizeMask ; while ( true ) { long address = segment . getLong ( segOffset + 8 ) ; i... | Returns an iterator for all the values for the given key or null if no value found . |
15,441 | private void updateIndex ( long key , int hashCode , long address , int size , MemorySegment dataSegment , int currentPositionInSegment ) throws IOException { assert ( numKeys <= numBuckets / 2 ) ; int bucketId = hashCode & numBucketsMask ; int bucketOffset = bucketId * SPARSE_BUCKET_ELEMENT_SIZE_IN_BYTES ; MemorySegme... | Update the address in array for given key . |
15,442 | public void registerListener ( JobID jobId , KvStateRegistryListener listener ) { final KvStateRegistryListener previousValue = listeners . putIfAbsent ( jobId , listener ) ; if ( previousValue != null ) { throw new IllegalStateException ( "Listener already registered under " + jobId + '.' ) ; } } | Registers a listener with the registry . |
15,443 | public KvStateID registerKvState ( JobID jobId , JobVertexID jobVertexId , KeyGroupRange keyGroupRange , String registrationName , InternalKvState < ? , ? , ? > kvState ) { KvStateID kvStateId = new KvStateID ( ) ; if ( registeredKvStates . putIfAbsent ( kvStateId , new KvStateEntry < > ( kvState ) ) == null ) { final ... | Registers the KvState instance and returns the assigned ID . |
15,444 | public void unregisterKvState ( JobID jobId , JobVertexID jobVertexId , KeyGroupRange keyGroupRange , String registrationName , KvStateID kvStateId ) { KvStateEntry < ? , ? , ? > entry = registeredKvStates . remove ( kvStateId ) ; if ( entry != null ) { entry . clear ( ) ; final KvStateRegistryListener listener = getKv... | Unregisters the KvState instance identified by the given KvStateID . |
15,445 | public BinaryMergeIterator < Entry > getMergingIterator ( List < ChannelWithMeta > channelIDs , List < FileIOChannel > openChannels ) throws IOException { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Performing merge of " + channelIDs . size ( ) + " sorted streams." ) ; } final List < MutableObjectIterator < Entry ... | Returns an iterator that iterates over the merged result from all given channels . |
15,446 | public List < ChannelWithMeta > mergeChannelList ( List < ChannelWithMeta > channelIDs ) throws IOException { final double scale = Math . ceil ( Math . log ( channelIDs . size ( ) ) / Math . log ( maxFanIn ) ) - 1 ; final int numStart = channelIDs . size ( ) ; final int numEnd = ( int ) Math . pow ( maxFanIn , scale ) ... | Merges the given sorted runs to a smaller number of sorted runs . |
15,447 | private ChannelWithMeta mergeChannels ( List < ChannelWithMeta > channelIDs ) throws IOException { List < FileIOChannel > openChannels = new ArrayList < > ( channelIDs . size ( ) ) ; final BinaryMergeIterator < Entry > mergeIterator = getMergingIterator ( channelIDs , openChannels ) ; final FileIOChannel . ID mergedCha... | Merges the sorted runs described by the given Channel IDs into a single sorted run . |
15,448 | public boolean isMetBy ( LocalProperties other ) { if ( this . ordering != null ) { return other . getOrdering ( ) != null && this . ordering . isMetBy ( other . getOrdering ( ) ) ; } else if ( this . groupedFields != null ) { if ( other . getGroupedFields ( ) != null && other . getGroupedFields ( ) . isValidUnorderedP... | Checks if this set of properties as interesting properties is met by the given properties . |
15,449 | public void parameterizeChannel ( Channel channel ) { LocalProperties current = channel . getLocalProperties ( ) ; if ( isMetBy ( current ) ) { channel . setLocalStrategy ( LocalStrategy . NONE ) ; } else if ( this . ordering != null ) { channel . setLocalStrategy ( LocalStrategy . SORT , this . ordering . getInvolvedI... | Parametrizes the local strategy fields of a channel such that the channel produces the desired local properties . |
15,450 | public boolean get ( ) { switch ( state ) { case UNSET : return valueIfUnset ; case FALSE : return false ; case TRUE : return true ; case CONFLICTING : return valueIfConflicting ; default : throw new RuntimeException ( "Unknown state" ) ; } } | Get the boolean state . |
15,451 | public boolean conflictsWith ( OptionalBoolean other ) { return state == State . CONFLICTING || other . state == State . CONFLICTING || ( state == State . TRUE && other . state == State . FALSE ) || ( state == State . FALSE && other . state == State . TRUE ) ; } | The conflicting states are true with false and false with true . |
15,452 | public void mergeWith ( OptionalBoolean other ) { if ( state == other . state ) { } else if ( state == State . UNSET ) { state = other . state ; } else if ( other . state == State . UNSET ) { } else { state = State . CONFLICTING ; } } | State transitions . - if the states are the same then no change - if either state is unset then change to the other state - if the states are conflicting then set to the conflicting state |
15,453 | @ SuppressWarnings ( "deprecation" ) public RestartStrategies . RestartStrategyConfiguration getRestartStrategy ( ) { if ( restartStrategyConfiguration instanceof RestartStrategies . FallbackRestartStrategyConfiguration ) { if ( getNumberOfExecutionRetries ( ) > 0 && getExecutionRetryDelay ( ) >= 0 ) { return RestartSt... | Returns the restart strategy which has been set for the current job . |
15,454 | @ SuppressWarnings ( "rawtypes" ) public void registerTypeWithKryoSerializer ( Class < ? > type , Class < ? extends Serializer > serializerClass ) { if ( type == null || serializerClass == null ) { throw new NullPointerException ( "Cannot register null class or serializer." ) ; } @ SuppressWarnings ( "unchecked" ) Clas... | Registers the given Serializer via its class as a serializer for the given type at the KryoSerializer |
15,455 | public LinkedHashSet < Class < ? > > getRegisteredKryoTypes ( ) { if ( isForceKryoEnabled ( ) ) { LinkedHashSet < Class < ? > > result = new LinkedHashSet < > ( ) ; result . addAll ( registeredKryoTypes ) ; for ( Class < ? > t : registeredPojoTypes ) { if ( ! result . contains ( t ) ) { result . add ( t ) ; } } return ... | Returns the registered Kryo types . |
15,456 | public CompletableFuture < Acknowledge > start ( final JobMasterId newJobMasterId ) throws Exception { start ( ) ; return callAsyncWithoutFencing ( ( ) -> startJobExecution ( newJobMasterId ) , RpcUtils . INF_TIMEOUT ) ; } | Start the rpc service and begin to run the job . |
15,457 | public CompletableFuture < Void > onStop ( ) { log . info ( "Stopping the JobMaster for job {}({})." , jobGraph . getName ( ) , jobGraph . getJobID ( ) ) ; final Set < ResourceID > taskManagerResourceIds = new HashSet < > ( registeredTaskManagers . keySet ( ) ) ; final FlinkException cause = new FlinkException ( "Stopp... | Suspend the job and shutdown all other services including rpc . |
15,458 | public CompletableFuture < Acknowledge > updateTaskExecutionState ( final TaskExecutionState taskExecutionState ) { checkNotNull ( taskExecutionState , "taskExecutionState" ) ; if ( executionGraph . updateState ( taskExecutionState ) ) { return CompletableFuture . completedFuture ( Acknowledge . get ( ) ) ; } else { re... | Updates the task execution state for a given task . |
15,459 | public Option defaultValue ( String defaultValue ) throws RequiredParametersException { if ( this . choices . isEmpty ( ) ) { return this . setDefaultValue ( defaultValue ) ; } else { if ( this . choices . contains ( defaultValue ) ) { return this . setDefaultValue ( defaultValue ) ; } else { throw new RequiredParamete... | Define a default value for the option . |
15,460 | public Option choices ( String ... choices ) throws RequiredParametersException { if ( this . defaultValue != null ) { if ( Arrays . asList ( choices ) . contains ( defaultValue ) ) { Collections . addAll ( this . choices , choices ) ; } else { throw new RequiredParametersException ( "Valid values for option " + this .... | Restrict the list of possible values of the parameter . |
15,461 | public static int getInt ( Properties config , String key , int defaultValue ) { String val = config . getProperty ( key ) ; if ( val == null ) { return defaultValue ; } else { try { return Integer . parseInt ( val ) ; } catch ( NumberFormatException nfe ) { throw new IllegalArgumentException ( "Value for configuration... | Get integer from properties . This method throws an exception if the integer is not valid . |
15,462 | public static long getLong ( Properties config , String key , long defaultValue ) { String val = config . getProperty ( key ) ; if ( val == null ) { return defaultValue ; } else { try { return Long . parseLong ( val ) ; } catch ( NumberFormatException nfe ) { throw new IllegalArgumentException ( "Value for configuratio... | Get long from properties . This method throws an exception if the long is not valid . |
15,463 | public static long getLong ( Properties config , String key , long defaultValue , Logger logger ) { try { return getLong ( config , key , defaultValue ) ; } catch ( IllegalArgumentException iae ) { logger . warn ( iae . getMessage ( ) ) ; return defaultValue ; } } | Get long from properties . This method only logs if the long is not valid . |
15,464 | CheckpointStatsHistory createSnapshot ( ) { if ( readOnly ) { throw new UnsupportedOperationException ( "Can't create a snapshot of a read-only history." ) ; } List < AbstractCheckpointStats > checkpointsHistory ; Map < Long , AbstractCheckpointStats > checkpointsById ; checkpointsById = new HashMap < > ( checkpointsAr... | Creates a snapshot of the current state . |
15,465 | void addInProgressCheckpoint ( PendingCheckpointStats pending ) { if ( readOnly ) { throw new UnsupportedOperationException ( "Can't create a snapshot of a read-only history." ) ; } if ( maxSize == 0 ) { return ; } checkNotNull ( pending , "Pending checkpoint" ) ; if ( checkpointsArray . length < maxSize ) { checkpoint... | Adds an in progress checkpoint to the checkpoint history . |
15,466 | boolean replacePendingCheckpointById ( AbstractCheckpointStats completedOrFailed ) { checkArgument ( ! completedOrFailed . getStatus ( ) . isInProgress ( ) , "Not allowed to replace with in progress checkpoints." ) ; if ( readOnly ) { throw new UnsupportedOperationException ( "Can't create a snapshot of a read-only his... | Searches for the in progress checkpoint with the given ID and replaces it with the given completed or failed checkpoint . |
15,467 | public static MessageType toParquetType ( TypeInformation < ? > typeInformation , boolean legacyMode ) { return ( MessageType ) convertField ( null , typeInformation , Type . Repetition . OPTIONAL , legacyMode ) ; } | Converts Flink Internal Type to Parquet schema . |
15,468 | public static int hashUnsafeBytesByWords ( Object base , long offset , int lengthInBytes ) { return hashUnsafeBytesByWords ( base , offset , lengthInBytes , DEFAULT_SEED ) ; } | Hash unsafe bytes length must be aligned to 4 bytes . |
15,469 | public static int hashUnsafeBytes ( Object base , long offset , int lengthInBytes ) { return hashUnsafeBytes ( base , offset , lengthInBytes , DEFAULT_SEED ) ; } | Hash unsafe bytes . |
15,470 | public static int hashBytesByWords ( MemorySegment segment , int offset , int lengthInBytes ) { return hashBytesByWords ( segment , offset , lengthInBytes , DEFAULT_SEED ) ; } | Hash bytes in MemorySegment length must be aligned to 4 bytes . |
15,471 | public static int hashBytes ( MemorySegment segment , int offset , int lengthInBytes ) { return hashBytes ( segment , offset , lengthInBytes , DEFAULT_SEED ) ; } | Hash bytes in MemorySegment . |
15,472 | public SerializedValue < JobInformation > getSerializedJobInformation ( ) { if ( serializedJobInformation instanceof NonOffloaded ) { NonOffloaded < JobInformation > jobInformation = ( NonOffloaded < JobInformation > ) serializedJobInformation ; return jobInformation . serializedValue ; } else { throw new IllegalStateE... | Return the sub task s serialized job information . |
15,473 | public SerializedValue < TaskInformation > getSerializedTaskInformation ( ) { if ( serializedTaskInformation instanceof NonOffloaded ) { NonOffloaded < TaskInformation > taskInformation = ( NonOffloaded < TaskInformation > ) serializedTaskInformation ; return taskInformation . serializedValue ; } else { throw new Illeg... | Return the sub task s serialized task information . |
15,474 | public void accept ( Visitor < PlanNode > visitor ) { for ( SinkPlanNode node : this . dataSinks ) { node . accept ( visitor ) ; } } | Applies the given visitor top down to all nodes starting at the sinks . |
15,475 | boolean insertToBucket ( int hashCode , int pointer , boolean spillingAllowed , boolean sizeAddAndCheckResize ) throws IOException { final int posHashCode = findBucket ( hashCode ) ; final int bucketArrayPos = posHashCode >> table . bucketsPerSegmentBits ; final int bucketInSegmentPos = ( posHashCode & table . bucketsP... | Insert into bucket by hashCode and pointer . |
15,476 | boolean appendRecordAndInsert ( BinaryRow record , int hashCode ) throws IOException { final int posHashCode = findBucket ( hashCode ) ; final int bucketArrayPos = posHashCode >> table . bucketsPerSegmentBits ; final int bucketInSegmentPos = ( posHashCode & table . bucketsPerSegmentMask ) << BUCKET_SIZE_BITS ; final Me... | Append record and insert to bucket . |
15,477 | private boolean findFirstSameBuildRow ( MemorySegment bucket , int searchHashCode , int bucketInSegmentOffset , BinaryRow buildRowToInsert ) { int posInSegment = bucketInSegmentOffset + BUCKET_HEADER_LENGTH ; int countInBucket = bucket . getShort ( bucketInSegmentOffset + HEADER_COUNT_OFFSET ) ; int numInBucket = 0 ; R... | For distinct build . |
15,478 | void startLookup ( int hashCode ) { final int posHashCode = findBucket ( hashCode ) ; final int bucketArrayPos = posHashCode >> table . bucketsPerSegmentBits ; final int bucketInSegmentOffset = ( posHashCode & table . bucketsPerSegmentMask ) << BUCKET_SIZE_BITS ; final MemorySegment bucket = this . buckets [ bucketArra... | Probe start lookup joined build rows . |
15,479 | private static boolean repStep ( BufferedReader in , boolean readConsoleInput ) throws IOException , InterruptedException { long startTime = System . currentTimeMillis ( ) ; while ( ( System . currentTimeMillis ( ) - startTime ) < CLIENT_POLLING_INTERVAL_MS && ( ! readConsoleInput || ! in . ready ( ) ) ) { Thread . sle... | Read - Evaluate - Print step for the REPL . |
15,480 | public static List < InputChannelDeploymentDescriptor > fromEdges ( List < ExecutionEdge > edges , boolean allowLazyDeployment ) { return edges . stream ( ) . map ( edge -> fromEdgeAndValidate ( allowLazyDeployment , edge ) ) . collect ( Collectors . toList ( ) ) ; } | Creates an input channel deployment descriptor for each partition . |
15,481 | long refreshAndGetTotal ( ) { long total = 0 ; for ( InputChannel channel : inputGate . getInputChannels ( ) . values ( ) ) { if ( channel instanceof RemoteInputChannel ) { RemoteInputChannel rc = ( RemoteInputChannel ) channel ; total += rc . unsynchronizedGetNumberOfQueuedBuffers ( ) ; } } return total ; } | Iterates over all input channels and collects the total number of queued buffers in a best - effort way . |
15,482 | int refreshAndGetMin ( ) { int min = Integer . MAX_VALUE ; Collection < InputChannel > channels = inputGate . getInputChannels ( ) . values ( ) ; for ( InputChannel channel : channels ) { if ( channel instanceof RemoteInputChannel ) { RemoteInputChannel rc = ( RemoteInputChannel ) channel ; int size = rc . unsynchroniz... | Iterates over all input channels and collects the minimum number of queued buffers in a channel in a best - effort way . |
15,483 | int refreshAndGetMax ( ) { int max = 0 ; for ( InputChannel channel : inputGate . getInputChannels ( ) . values ( ) ) { if ( channel instanceof RemoteInputChannel ) { RemoteInputChannel rc = ( RemoteInputChannel ) channel ; int size = rc . unsynchronizedGetNumberOfQueuedBuffers ( ) ; max = Math . max ( max , size ) ; }... | Iterates over all input channels and collects the maximum number of queued buffers in a channel in a best - effort way . |
15,484 | float refreshAndGetAvg ( ) { long total = 0 ; int count = 0 ; for ( InputChannel channel : inputGate . getInputChannels ( ) . values ( ) ) { if ( channel instanceof RemoteInputChannel ) { RemoteInputChannel rc = ( RemoteInputChannel ) channel ; int size = rc . unsynchronizedGetNumberOfQueuedBuffers ( ) ; total += size ... | Iterates over all input channels and collects the average number of queued buffers in a channel in a best - effort way . |
15,485 | static JarFileWithEntryClass findOnlyEntryClass ( Iterable < File > jarFiles ) throws IOException { List < JarFileWithEntryClass > jarsWithEntryClasses = new ArrayList < > ( ) ; for ( File jarFile : jarFiles ) { findEntryClass ( jarFile ) . ifPresent ( entryClass -> jarsWithEntryClasses . add ( new JarFileWithEntryClas... | Returns a JAR file with its entry class as specified in the manifest . |
15,486 | static Optional < String > findEntryClass ( File jarFile ) throws IOException { return findFirstManifestAttribute ( jarFile , PackagedProgram . MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS , PackagedProgram . MANIFEST_ATTRIBUTE_MAIN_CLASS ) ; } | Returns the entry class as specified in the manifest of the provided JAR file . |
15,487 | private static Optional < String > findFirstManifestAttribute ( File jarFile , String ... attributes ) throws IOException { if ( attributes . length == 0 ) { return Optional . empty ( ) ; } try ( JarFile f = new JarFile ( jarFile ) ) { return findFirstManifestAttribute ( f , attributes ) ; } } | Returns the value of the first manifest attribute found in the provided JAR file . |
15,488 | public final TypeSerializer < T > restoreSerializer ( ) { if ( serializer == null ) { throw new IllegalStateException ( "Trying to restore the prior serializer via TypeSerializerConfigSnapshot, " + "but the prior serializer has not been set." ) ; } else if ( serializer instanceof UnloadableDummyTypeSerializer ) { Throw... | Creates a serializer using this configuration that is capable of reading data written by the serializer described by this configuration . |
15,489 | private static < V , R extends Serializable > Accumulator < V , R > mergeSingle ( Accumulator < ? , ? > target , Accumulator < ? , ? > toMerge ) { @ SuppressWarnings ( "unchecked" ) Accumulator < V , R > typedTarget = ( Accumulator < V , R > ) target ; @ SuppressWarnings ( "unchecked" ) Accumulator < V , R > typedToMer... | Workaround method for type safety . |
15,490 | public static Map < String , OptionalFailure < Object > > toResultMap ( Map < String , Accumulator < ? , ? > > accumulators ) { Map < String , OptionalFailure < Object > > resultMap = new HashMap < > ( ) ; for ( Map . Entry < String , Accumulator < ? , ? > > entry : accumulators . entrySet ( ) ) { resultMap . put ( ent... | Transform the Map with accumulators into a Map containing only the results . |
15,491 | public static Map < String , OptionalFailure < Object > > deserializeAccumulators ( Map < String , SerializedValue < OptionalFailure < Object > > > serializedAccumulators , ClassLoader loader ) throws IOException , ClassNotFoundException { if ( serializedAccumulators == null || serializedAccumulators . isEmpty ( ) ) { ... | Takes the serialized accumulator results and tries to deserialize them using the provided class loader . |
15,492 | public void prepareAndCommitOffsets ( Map < KafkaTopicPartition , Long > internalOffsets ) throws Exception { for ( Map . Entry < KafkaTopicPartition , Long > entry : internalOffsets . entrySet ( ) ) { KafkaTopicPartition tp = entry . getKey ( ) ; Long lastProcessedOffset = entry . getValue ( ) ; if ( lastProcessedOffs... | Commits offsets for Kafka partitions to ZooKeeper . The given offsets to this method should be the offsets of the last processed records ; this method will take care of incrementing the offsets by 1 before committing them so that the committed offsets to Zookeeper represent the next record to process . |
15,493 | public void publish ( TaskEvent event ) { synchronized ( listeners ) { for ( EventListener < TaskEvent > listener : listeners . get ( event . getClass ( ) ) ) { listener . onEvent ( event ) ; } } } | Publishes the task event to all subscribed event listeners . |
15,494 | public static void register ( final Logger LOG ) { synchronized ( SignalHandler . class ) { if ( registered ) { return ; } registered = true ; final String [ ] SIGNALS = OperatingSystem . isWindows ( ) ? new String [ ] { "TERM" , "INT" } : new String [ ] { "TERM" , "HUP" , "INT" } ; StringBuilder bld = new StringBuilde... | Register some signal handlers . |
15,495 | private static < X extends CopyableValue < X > > CopyableValueSerializer < X > createCopyableValueSerializer ( Class < X > clazz ) { return new CopyableValueSerializer < X > ( clazz ) ; } | utility method to summon the necessary bound |
15,496 | private static void registerFactory ( Type t , Class < ? extends TypeInfoFactory > factory ) { Preconditions . checkNotNull ( t , "Type parameter must not be null." ) ; Preconditions . checkNotNull ( factory , "Factory parameter must not be null." ) ; if ( ! TypeInfoFactory . class . isAssignableFrom ( factory ) ) { th... | Registers a type information factory globally for a certain type . Every following type extraction operation will use the provided factory for this type . The factory will have highest precedence for this type . In a hierarchy of types the registered factory has higher precedence than annotations at the same level but ... |
15,497 | @ SuppressWarnings ( "unchecked" ) public static < IN , OUT > TypeInformation < OUT > getUnaryOperatorReturnType ( Function function , Class < ? > baseClass , int inputTypeArgumentIndex , int outputTypeArgumentIndex , int [ ] lambdaOutputTypeArgumentIndices , TypeInformation < IN > inType , String functionName , boolea... | Returns the unary operator s return type . |
15,498 | @ SuppressWarnings ( "unchecked" ) public static < IN1 , IN2 , OUT > TypeInformation < OUT > getBinaryOperatorReturnType ( Function function , Class < ? > baseClass , int input1TypeArgumentIndex , int input2TypeArgumentIndex , int outputTypeArgumentIndex , int [ ] lambdaOutputTypeArgumentIndices , TypeInformation < IN1... | Returns the binary operator s return type . |
15,499 | @ SuppressWarnings ( "unchecked" ) private < IN1 , IN2 , OUT > TypeInformation < OUT > createTypeInfoFromFactory ( Type t , ArrayList < Type > typeHierarchy , TypeInformation < IN1 > in1Type , TypeInformation < IN2 > in2Type ) { final ArrayList < Type > factoryHierarchy = new ArrayList < > ( typeHierarchy ) ; final Typ... | Creates type information using a factory if for this type or super types . Returns null otherwise . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.