handles the parallel case of spawning the instances will create child executions accordingly for every instance needed

protected int create instances ( delegate execution execution ) { int nr of instances = resolve nr of instances ( execution ) ; if ( nr of instances < 0 ) { throw new activiti illegal argument exception ( " invalid number of instances : must be non - negative integer value " + " , but was " + nr of instances ) ; } execution set multi instance root ( true ) ; set loop variable ( execution , number of instances , nr of instances ) ; set loop variable ( execution , number of completed instances , 0 ) ; set loop variable ( execution , number of active instances , nr of instances ) ; list < delegate execution > concurrent executions = new array list < delegate execution > ( ) ; for ( int loop counter = 0 ; loop counter < nr of instances ; loop counter + + ) { delegate execution concurrent execution = context get command context ( ) get execution entity manager ( ) create child execution ( ( execution entity ) execution ) ; concurrent execution set current flow element ( activity ) ; concurrent execution set active ( true ) ; concurrent execution set scope ( false ) ; concurrent executions add ( concurrent execution ) ; log loop details ( concurrent execution , " initialized " , loop counter , 0 , nr of instances , nr of instances ) ; } / / before the activities are executed , all executions must be created up front / / do not try to merge this loop with the previous one , as it will lead / / to bugs , due to possible child execution pruning for ( int loop counter = 0 ; loop counter < nr of instances ; loop counter + + ) { delegate execution concurrent execution = concurrent executions get ( loop counter ) ; / / executions can be inactive , if instances are all automatics / / ( no - waitstate ) and completion condition has been met in the meantime if ( concurrent execution is active ( ) & & ! concurrent execution is ended ( ) & & concurrent execution get parent ( ) is active ( ) & & ! concurrent execution get parent ( ) is ended ( ) ) { set loop variable ( concurrent execution , get collection element index variable ( ) , loop counter ) ; execute original behavior ( concurrent execution , loop counter ) ; } } / / see act - 1586 : execution query returns wrong results when using multi / / instance on a receive task the parent execution must be set to false , so it wouldn ' t show up in / / the execution query when using activity id ( something ) do not we cannot nullify the / / activity id ( that would have been a better solution ) , as it would break boundary event behavior if ( ! concurrent executions is empty ( ) ) { execution entity execution entity = ( execution entity ) execution ; execution entity set active ( false ) ; } return nr of instances ; }


public void test type holder default ( ) { / / todo : test type holder default }


public void test entry set ( ) { concurrent map map = map 5 ( ) ; set s = map entry set ( ) ; assert equals ( 5 , s size ( ) ) ; iterator it = s iterator ( ) ; while ( it has next ( ) ) { map entry e = ( map entry ) it next ( ) ; assert true ( ( e get key ( ) equals ( one ) & & e get value ( ) equals ( " a " ) ) | | ( e get key ( ) equals ( two ) & & e get value ( ) equals ( " b " ) ) | | ( e get key ( ) equals ( three ) & & e get value ( ) equals ( " c " ) ) | | ( e get key ( ) equals ( four ) & & e get value ( ) equals ( " d " ) ) | | ( e get key ( ) equals ( five ) & & e get value ( ) equals ( " e " ) ) ) ; } }


declares the fragments required by this rule for the configuration of the host machine this rule ' s actions execute on this is not the same as the rule ' s configuration the rule ' s configuration is its target configuration , which determines the platform it builds outputs for the actions created by this rule run on a host machine , which is what the host configuration corresponds to in contrast to { @ link # requires host configuration fragments ( class ) } , this method takes starlark module names of fragments instead of their classes

public config aware rule class builder requires host configuration fragments by starlark builtin name ( collection < string > configuration fragment names ) { rule class builder requires configuration fragments by starlark module name ( host transition instance , configuration fragment names ) ; return this ; }


processes each model ' s property mapped to date type and adds related vendor extensions

public void process date type property ( codegen model model , codegen property property , string description , ktorm schema ktorm schema ) { map < string , object > column definition = new hash map < string , object > ( ) ; string base name = property get base name ( ) ; string col name = to column name ( base name ) ; string data type = property get data type ( ) ; string data format = property get data format ( ) ; string actual type = to column type ( data type , data format ) ; ktorm schema put ( " column definition " , column definition ) ; column definition put ( " col name " , col name ) ; column definition put ( " col type " , actual type ) ; column definition put ( " col kotlin type " , data type ) ; process type args ( data type , data format , null , null , column definition ) ; process null and default ( model , property , description , column definition ) ; }


this test runs all benchmarks defined in { @ link n n throughput benchmark } , with explicit local - fs option

public void test n n throughput with fs option ( ) throws exception { configuration conf = new hdfs configuration ( ) ; conf set int ( d f s config keys dfs block size key , 16 ) ; file name dir = new file ( mini d f s cluster get base directory ( ) , " name " ) ; conf set ( d f s config keys dfs namenode name dir key , name dir get absolute path ( ) ) ; d f s test util format name node ( conf ) ; n n throughput benchmark run benchmark ( conf , new string [ ] { " - fs " , " file : / / / " , " - op " , " all " } ) ; }


verify if storage space quota is violated once quota is set relevant method { @ link directory with quota feature # verify storagespace quota }

public void verify storagespace quota ( ) throws d s quota exceeded exception { long space quota = get space quota ( ) ; long space consumed = get space consumed ( ) ; if ( quota is violated ( space quota , space consumed ) ) { throw new d s quota exceeded exception ( space quota , space consumed ) ; } }


public < t extends metric > t register ( string name , t metric ) throws illegal argument exception { if ( metric = = null ) { throw new null pointer exception ( " metric = = null " ) ; } return metric ; }


get the group name of the owner of the fs

public string get owner user primary group ( ) { return abfs store get primary group ( ) ; }


set the field value for the specified field

public void set field ( int col index , field value ) { if ( field values [ col index ] get field type ( ) ! = value get field type ( ) ) { throw new illegal argument exception ( ) ; } invalidate length ( ) ; field values [ col index ] = value ; }


returns { @ code true } if and only if the user - defined writability flag at the specified index is set to { @ code true }

public boolean get user defined writability ( int index ) { return ( unwritable & writability mask ( index ) ) = = 0 ; }


write the full message to the systrace buffer you must call this to log the trace message


return a map with parsed and decoded query parameter values

multi value map < string , string > get query params ( ) ;


get the number of milliseconds of each tick

public int get tick time ( ) { return tick time ; }


called when a { @ link counter } is removed from the registry

void on counter removed ( string name ) ;


post fakeoutercomposite test serialization of object with outer number type

default response entity < outer composite > fake outer composite serialize ( outer composite body ) { get request ( ) if present ( request - > { for ( media type media type : media type parse media types ( request get header ( " accept " ) ) ) { if ( media type is compatible with ( media type value of ( " * / * " ) ) ) { string example string = " { \ " my string \ " : \ " my string \ " , \ " my number \ " : 0 8008281904610115 , \ " my boolean \ " : true } " ; api util set example response ( request , " * / * " , example string ) ; break ; } } } ) ; return new response entity < > ( http status not implemented ) ; }


gets the start address for the call frame augmentation data

public address get augmentation ex data address ( ) { return augmentation data ex addr ; }


determine whether the given bean property is excluded from dependency checks this implementation excludes properties defined by cglib

public static boolean is excluded from dependency check ( property descriptor pd ) { method wm = pd get write method ( ) ; if ( wm = = null ) { return false ; } if ( ! wm get declaring class ( ) get name ( ) contains ( " $ $ " ) ) { / / not a cglib method so it ' s ok return false ; } / / it was declared by cglib , but we might still want to autowire it / / if it was actually declared by the superclass class < ? > superclass = wm get declaring class ( ) get superclass ( ) ; return ! class utils has method ( superclass , wm ) ; }


public static glide get ( @ non null context context ) { if ( glide = = null ) { generated app glide module annotation generated module = get annotation generated glide modules ( context get application context ( ) ) ; synchronized ( glide class ) { if ( glide = = null ) { check and initialize glide ( context , annotation generated module ) ; } } } return glide ; }


analyze litepal xml , and store the analyzed result in lite pal parser use dom parse to parse the configuration file as default s a x parser and xml pull parser is also optional , but not visible to developers

public static lite pal config parse lite pal configuration ( ) { if ( parser = = null ) { parser = new lite pal parser ( ) ; } return parser use pull parse ( ) ; }


public final void set access time ( long access time ) { this access time = access time ; }


set the parent of this application context the parent { @ linkplain application context # get environment ( ) environment } is { @ linkplain configurable environment # merge ( configurable environment ) merged } with this ( child ) application context environment if the parent is non - { @ code null } and its environment is an instance of { @ link configurable environment }

public void set parent ( @ nullable application context parent ) { this parent = parent ; if ( parent ! = null ) { environment parent environment = parent get environment ( ) ; if ( parent environment instanceof configurable environment ) { get environment ( ) merge ( ( configurable environment ) parent environment ) ; } } }


tests if specific configs and metrics are retrieve for get entity call

public void test get entity data to retrieve ( ) throws exception { client client = create client ( ) ; try { uri uri = uri create ( " http : / / localhost : " + get server port ( ) + " / ws / v 2 / " + " timeline / clusters / cluster 1 / apps / application 1111111111 1111 / " + " entities / type 1 / entity 2 ? confstoretrieve = cfg , configuration " ) ; client response resp = get response ( client , uri ) ; timeline entity entity = resp get entity ( timeline entity class ) ; assert not null ( entity ) ; assert equals ( " entity 2 " , entity get id ( ) ) ; assert equals ( " type 1 " , entity get type ( ) ) ; assert equals ( 2 , entity get configs ( ) size ( ) ) ; for ( string config key : entity get configs ( ) key set ( ) ) { assert true ( config key starts with ( " configuration " ) | | config key starts with ( " cfg " ) ) ; } uri = uri create ( " http : / / localhost : " + get server port ( ) + " / ws / v 2 / " + " timeline / clusters / cluster 1 / apps / application 1111111111 1111 / " + " entities / type 1 / entity 2 ? confstoretrieve = ! ( cfg , configuration ) " ) ; resp = get response ( client , uri ) ; entity = resp get entity ( timeline entity class ) ; assert not null ( entity ) ; assert equals ( " entity 2 " , entity get id ( ) ) ; assert equals ( " type 1 " , entity get type ( ) ) ; assert equals ( 1 , entity get configs ( ) size ( ) ) ; for ( string config key : entity get configs ( ) key set ( ) ) { assert true ( config key starts with ( " config " ) ) ; } uri = uri create ( " http : / / localhost : " + get server port ( ) + " / ws / v 2 / " + " timeline / clusters / cluster 1 / apps / application 1111111111 1111 / " + " entities / type 1 / entity 2 ? metricstoretrieve = map1 , hdfs " ) ; resp = get response ( client , uri ) ; entity = resp get entity ( timeline entity class ) ; assert not null ( entity ) ; assert equals ( " entity 2 " , entity get id ( ) ) ; assert equals ( " type 1 " , entity get type ( ) ) ; assert equals ( 2 , entity get metrics ( ) size ( ) ) ; for ( timeline metric metric : entity get metrics ( ) ) { assert true ( metric get id ( ) starts with ( " map1 " ) | | metric get id ( ) starts with ( " hdfs " ) ) ; } uri = uri create ( " http : / / localhost : " + get server port ( ) + " / ws / v 2 / " + " timeline / clusters / cluster 1 / apps / application 1111111111 1111 / " + " entities / type 1 / entity 2 ? metricstoretrieve = ! ( map1 , hdfs ) " ) ; resp = get response ( client , uri ) ; entity = resp get entity ( timeline entity class ) ; assert not null ( entity ) ; assert equals ( " entity 2 " , entity get id ( ) ) ; assert equals ( " type 1 " , entity get type ( ) ) ; assert equals ( 1 , entity get metrics ( ) size ( ) ) ; for ( timeline metric metric : entity get metrics ( ) ) { assert true ( metric get id ( ) starts with ( " map11 " ) ) ; assert equals ( timeline metric type single value , metric get type ( ) ) ; assert equals ( 1 , metric get values ( ) size ( ) ) ; } uri = uri create ( " http : / / localhost : " + get server port ( ) + " / ws / v 2 / " + " timeline / clusters / cluster 1 / apps / application 1111111111 1111 / " + " entities / type 1 / entity 2 ? metricstoretrieve = ! ( map1 , hdfs ) & " + " metricslimit = 5 " ) ; resp = get response ( client , uri ) ; entity = resp get entity ( timeline entity class ) ; assert not null ( entity ) ; assert equals ( " entity 2 " , entity get id ( ) ) ; assert equals ( " type 1 " , entity get type ( ) ) ; assert equals ( 1 , entity get metrics ( ) size ( ) ) ; for ( timeline metric metric : entity get metrics ( ) ) { assert true ( metric get id ( ) starts with ( " map11 " ) ) ; assert equals ( timeline metric type single value , metric get type ( ) ) ; } } finally { client destroy ( ) ; } }


turn an array of resource - colors ( contains resource - id integers ) into an array list of actual color integers

public static list < integer > create colors ( resources r , int [ ] colors ) { list < integer > result = new array list < integer > ( ) ; for ( int i : colors ) { result add ( r get color ( i ) ) ; } return result ; }


return whether the underlying class is declared within an enclosing class ( i e the underlying class is an innernested class or a local class within a method ) if this method returns { @ code false } , then the underlying class is a top - level class

default boolean has enclosing class ( ) { return ( get enclosing class name ( ) ! = null ) ; }


public long get record count ( ) { return this record count ; }


adds { @ link align # bottom } and clears { @ link align # top } for the alignment of each column of widgets when { @ link # wrap ( ) wrapping } is enabled

public vertical group column bottom ( ) { column align | = align bottom ; column align & = ~ align top ; return this ; }


returns the number of undefined bytes that are available in the structure beginning at the specified row index

protected int get num undefined bytes at ( int row index ) { return 0 ; }


asynchronous version of { @ link abstract dao session # call in tx ( callable ) }

public async operation call in tx ( callable < ? > callable , int flags ) { return enqueue database operation ( operation type transaction callable , callable , flags ) ; }


gets the azure storage account name corresponding to this instance of configuration

public string get account name ( ) { return account name ; }


public abstract prepared prepare ( long min utc millis , long max utc millis ) ;


builds a map which can be used with create , confirming that the desired flag values were actually received , and producing an error if they were not ( because aliases were used ) if the attribute which defines feature flags was not specified , an empty { @ link optional } instance is returned

public static optional < immutable map < label , string > > get and validate flag map from rule context ( rule context rule context ) throws rule error exception { nonconfigurable attribute mapper attrs = nonconfigurable attribute mapper of ( rule context get rule ( ) ) ; if ( ! attrs is attribute value explicitly specified ( feature flag attr ) ) { return optional absent ( ) ; } map < label , string > expected values = attrs get ( feature flag attr , build type label keyed string dict ) ; if ( expected values is empty ( ) ) { return optional of ( immutable map of ( ) ) ; } if ( ! config feature flag is available ( rule context ) ) { throw rule context throw with attribute error ( feature flag attr , string format ( " the % s attribute is not available in package ' % s ' " , feature flag attr , rule context get label ( ) get package identifier ( ) ) ) ; } iterable < ? extends transitive info collection > actual targets = rule context get prerequisites ( feature flag attr ) ; rule error exception exception = null ; for ( transitive info collection target : actual targets ) { label label = alias provider get dependency label ( target ) ; if ( ! label equals ( target get label ( ) ) ) { try { exception = rule context throw with attribute error ( feature flag attr , string format ( " feature flags must be named directly , not through aliases ; use ' % s ' , not " + " ' % s ' " , target get label ( ) , label ) ) ; } catch ( rule error exception e ) { exception = e ; } } } if ( exception ! = null ) { throw exception ; } return optional of ( immutable map copy of ( expected values ) ) ; }


returns the number of instructions in the pattern sequence

public int instruction count ( ) { return pattern instructions length ; }


invoked when a menu is no longer selected this is always preceeded by a menu selected invocation this is invoked prior to the process menu action if an action item is selected

public void menu deselected ( menu event e ) { }


get the range of maps or reduces to profile

public integer ranges get profile task range ( boolean is map ) { return conf get profile task range ( is map ) ; }


adds a type information hint about the return type of this operator this method can be used in cases where flink cannot determine automatically what the produced type of a function is that can be the case if the function uses generic type variables in the return type that cannot be inferred from the input type in most cases , the methods { @ link # returns ( class ) } and { @ link # returns ( type hint ) } are preferable

public o returns ( type information < out > type info ) { require non null ( type info , " type information must not be null " ) ; fill in type ( type info ) ; @ suppress warnings ( " unchecked " ) o return type = ( o ) this ; return return type ; }


initialize the given application context

void initialize ( c application context ) ;


method that is called when the priority of the request changes


post storeorder : place an order for a pet

default response entity < order > place order ( order body ) { get request ( ) if present ( request - > { for ( media type media type : media type parse media types ( request get header ( " accept " ) ) ) { if ( media type is compatible with ( media type value of ( " application / json " ) ) ) { string example string = " { \ " pet id \ " : 6 , \ " quantity \ " : 1 , \ " id \ " : 0 , \ " ship date \ " : \ " 2000 - 01 - 23t04 : 56 : 07 000 + 00 : 00 \ " , \ " complete \ " : false , \ " status \ " : \ " placed \ " } " ; api util set example response ( request , " application / json " , example string ) ; break ; } if ( media type is compatible with ( media type value of ( " application / xml " ) ) ) { string example string = " < order > < id > 123456789 < / id > < pet id > 123456789 < / pet id > < quantity > 123 < / quantity > < ship date > 2000 - 01 - 23t04 : 56 : 07 000z < / ship date > < status > aeiou < / status > < complete > true < / complete > < / order > " ; api util set example response ( request , " application / xml " , example string ) ; break ; } } } ) ; return new response entity < > ( http status not implemented ) ; }


< code > required string city = 2 ; < code >

public java lang string get city ( ) { java lang object ref = city ; if ( ref instanceof java lang string ) { return ( java lang string ) ref ; } else { com google protobuf byte string bs = ( com google protobuf byte string ) ref ; java lang string s = bs to string utf 8 ( ) ; if ( bs is valid utf 8 ( ) ) { city = s ; } return s ; } }


stores the specified watch record any existing watch record will be overwritten

private void force put history ( watch record watch record ) { try { try ( x content builder builder = x content factory json builder ( ) ; thread context stored context ignore = client thread pool ( ) get thread context ( ) stash with origin ( watcher origin ) ) { watch record to x content ( builder , watcher params hide secrets ) ; index request request = new index request ( history store field data stream ) id ( watch record id ( ) value ( ) ) source ( builder ) op type ( index request op type create ) ; client index ( request ) get ( 30 , time unit seconds ) ; logger debug ( " indexed watch history record [ { } ] " , watch record id ( ) value ( ) ) ; } catch ( version conflict engine exception vcee ) { watch record = new watch record message watch record ( watch record , execution state executed multiple times , " watch record [ { " + watch record id ( ) + " } ] has been stored before , previous state [ " + watch record state ( ) + " ] " ) ; try ( x content builder x content builder = x content factory json builder ( ) ; thread context stored context ignore = client thread pool ( ) get thread context ( ) stash with origin ( watcher origin ) ) { index request request = new index request ( history store field data stream ) id ( watch record id ( ) value ( ) ) source ( x content builder value ( watch record ) ) ; client index ( request ) get ( 30 , time unit seconds ) ; } logger debug ( " overwrote watch history record [ { } ] " , watch record id ( ) value ( ) ) ; } } catch ( interrupted exception | execution exception | timeout exception | i o exception ioe ) { final watch record wr = watch record ; logger error ( ( supplier < ? > ) ( ) - > new parameterized message ( " failed to persist watch record [ { } ] " , wr ) , ioe ) ; } }


get ' s the { @ link index shard routing table } for the given shard id from the given { @ link index routing table } or throws a { @ link shard not found exception } if no shard by the given id is found in the index routing table

public static index shard routing table shard routing table ( index routing table index routing , int shard id ) { index shard routing table index shard = index routing shard ( shard id ) ; if ( index shard = = null ) { throw new shard not found exception ( new shard id ( index routing get index ( ) , shard id ) ) ; } return index shard ; }


create a kafka topic with the given parameters

public void create topic ( final string topic , final int partitions , final int replication ) { create topic ( topic , partitions , replication , collections empty map ( ) ) ; }


specifies what type of requested indices to ignore and how to deal with wildcard expressions for example indices that don ' t exist

public indices options indices options ( ) { return indices options ; }


parameters used for controlling the response and thus might not be consumed during preparation of the request execution in { @ link base rest handler # prepare request ( rest request , node client ) }

protected set < string > response params ( ) { return collections empty set ( ) ; }


set the maximum size of the dynamic table entries are evicted from the dynamic table until the size of the table is less than or equal to the maximum size

public void set capacity ( long capacity ) { if ( capacity < min header table size | | capacity > max header table size ) { throw new illegal argument exception ( " capacity is invalid : " + capacity ) ; } / / initially capacity will be - 1 so init won ' t return here if ( this capacity = = capacity ) { return ; } this capacity = capacity ; if ( capacity = = 0 ) { clear ( ) ; } else { / / initially size will be 0 so remove won ' t be called while ( size > capacity ) { remove ( ) ; } } int max entries = ( int ) ( capacity / hpack header field header entry overhead ) ; if ( capacity % hpack header field header entry overhead ! = 0 ) { max entries + + ; } / / check if capacity change requires us to reallocate the array if ( hpack header fields ! = null & & hpack header fields length = = max entries ) { return ; } hpack header field [ ] tmp = new hpack header field [ max entries ] ; / / initially length will be 0 so there will be no copy int len = length ( ) ; if ( hpack header fields ! = null ) { int cursor = tail ; for ( int i = 0 ; i < len ; i + + ) { hpack header field entry = hpack header fields [ cursor + + ] ; tmp [ i ] = entry ; if ( cursor = = hpack header fields length ) { cursor = 0 ; } } } tail = 0 ; head = tail + len ; hpack header fields = tmp ; }


returns the port instance ' s task manager expects to receive transfer envelopes on

public int data port ( ) { return data port ; }


returns true if the owner of the field or method designated by this handle is an interface

public boolean is interface ( ) { return is interface ; }


public string get capital camel ( ) { return capital camel ; }


disconnect the { @ link channel } of the { @ link channel future } and notify the { @ link channel promise } once the operation was complete

void disconnect ( channel promise promise ) ;


protected void place 0 ( section added to , int offset ) { / / encode the data and note the size byte array annotated output out = new byte array annotated output ( ) ; value encoder encoder = new value encoder ( added to get file ( ) , out ) ; encoder write annotation ( annotation , false ) ; encoded form = out to byte array ( ) ; / / add one for the visibility byte in front of the encoded annotation set write size ( encoded form length + 1 ) ; }


starts the fetcher after starting the fetcher , it can only be stopped by calling { @ link kinesis data fetcher # shutdown fetcher ( ) }

public void run fetcher ( ) throws exception { / / check that we are running before proceeding if ( ! running ) { return ; } this main thread = thread current thread ( ) ; / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / / procedures before starting the infinite while loop : / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / / 1 check that there is at least one shard in the subscribed streams to consume from ( can / / be done by / / checking if at least one value in subscribed streams to last discovered shard ids is not / / null ) boolean has shards = false ; string builder streams with no shards found = new string builder ( ) ; for ( map entry < string , string > stream to last discovered shard entry : subscribed streams to last discovered shard ids entry set ( ) ) { if ( stream to last discovered shard entry get value ( ) ! = null ) { has shards = true ; } else { streams with no shards found append ( stream to last discovered shard entry get key ( ) ) append ( " , " ) ; } } if ( streams with no shards found length ( ) ! = 0 & & log is warn enabled ( ) ) { log warn ( " subtask { } has failed to find any shards for the following subscribed streams : { } " , index of this consumer subtask , streams with no shards found to string ( ) ) ; } if ( ! has shards ) { throw new runtime exception ( " no shards can be found for all subscribed streams : " + streams ) ; } / / 2 start consuming any shard state we already have in the subscribed shard state up to / / this point ; the / / subscribed shard state may already be seeded with values due to step 1 , or explicitly / / added by the / / consumer using a restored state checkpoint for ( int seeded state index = 0 ; seeded state index < subscribed shards state size ( ) ; seeded state index + + ) { kinesis stream shard state seeded shard state = subscribed shards state get ( seeded state index ) ; / / only start a consuming thread if the seeded subscribed shard has not been completely / / read already if ( ! seeded shard state get last processed sequence num ( ) equals ( sentinel sequence number sentinel shard ending sequence num get ( ) ) ) { if ( log is info enabled ( ) ) { log info ( " subtask { } will start consuming seeded shard { } from sequence number { } with shard consumer { } " , index of this consumer subtask , seeded shard state get stream shard handle ( ) to string ( ) , seeded shard state get last processed sequence num ( ) , seeded state index ) ; } stream shard handle stream shard handle = subscribed shards state get ( seeded state index ) get stream shard handle ( ) ; kinesis deserialization schema < t > shard deserialization schema = get cloned deserialization schema ( ) ; shard deserialization schema open ( runtime context initialization context adapters deserialization adapter ( runtime context , / / ignore the provided metric group metric group - > consumer metric group add group ( " subtask id " , string value of ( index of this consumer subtask ) ) add group ( " shard id " , stream shard handle get shard ( ) get shard id ( ) ) add group ( " user " ) ) ) ; shard consumers executor submit ( create shard consumer ( seeded state index , stream shard handle , subscribed shards state get ( seeded state index ) get last processed sequence num ( ) , register shard metric group ( consumer metric group , subscribed shards state get ( seeded state index ) ) , shard deserialization schema ) ) ; } } / / start periodic watermark emitter , if a watermark assigner was configured if ( periodic watermark assigner ! = null ) { long periodic watermark interval millis = runtime context get execution config ( ) get auto watermark interval ( ) ; if ( periodic watermark interval millis > 0 ) { processing time service timer service = ( ( streaming runtime context ) runtime context ) get processing time service ( ) ; log info ( " starting periodic watermark emitter with interval { } " , periodic watermark interval millis ) ; new periodic watermark emitter ( timer service , periodic watermark interval millis ) start ( ) ; if ( watermark tracker ! = null ) { / / setup global watermark tracking long watermark sync millis = long parse long ( get consumer configuration ( ) get property ( consumer config constants watermark sync millis , long to string ( consumer config constants default watermark sync millis ) ) ) ; watermark tracker set update timeout millis ( watermark sync millis * 3 ) ; / / synchronization latency watermark tracker open ( runtime context ) ; new watermark sync callback ( timer service , watermark sync millis ) start ( ) ; / / emit records ahead of watermark to offset synchronization latency long lookahead millis = long parse long ( get consumer configuration ( ) get property ( consumer config constants watermark lookahead millis , long to string ( 0 ) ) ) ; record emitter set max lookahead millis ( math max ( lookahead millis , watermark sync millis * 3 ) ) ; / / record emitter depends on periodic watermark / / it runs in a separate thread since main thread is used for discovery runnable record emitter runnable = new runnable ( ) { @ override public void run ( ) { try { record emitter run ( ) ; } catch ( throwable error ) { / / report the error that terminated the emitter loop to / / source thread stop with error ( error ) ; } } } ; thread thread = new thread ( record emitter runnable ) ; thread set name ( " record emitter - " + runtime context get task name with subtasks ( ) ) ; thread set daemon ( true ) ; thread start ( ) ; } } this shard idle interval millis = long parse long ( get consumer configuration ( ) get property ( consumer config constants shard idle interval millis , long to string ( consumer config constants default shard idle interval millis ) ) ) ; } / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / / finally , start the infinite shard discovery and consumer launching loop ; / / we will escape from this loop only when shutdown fetcher ( ) or stop with error ( ) is called / / todo : have this thread emit the records for tracking backpressure final long discovery interval millis = long parse long ( config props get property ( consumer config constants shard discovery interval millis , long to string ( consumer config constants default shard discovery interval millis ) ) ) ; if ( this number of active shards get ( ) = = 0 ) { log info ( " subtask { } has no active shards to read on startup ; marking the subtask as temporarily idle " , index of this consumer subtask ) ; source context mark as temporarily idle ( ) ; } while ( running ) { if ( log is debug enabled ( ) ) { log debug ( " subtask { } is trying to discover new shards that were created due to resharding " , index of this consumer subtask ) ; } list < stream shard handle > new shards due to resharding = discover new shards to subscribe ( ) ; for ( stream shard handle shard : new shards due to resharding ) { / / since there may be delay in discovering a new shard , all new shards due to / / resharding should be read starting from the earliest record possible kinesis stream shard state new shard state = new kinesis stream shard state ( convert to stream shard metadata ( shard ) , shard , sentinel sequence number sentinel earliest sequence num get ( ) ) ; int new state index = register new subscribed shard state ( new shard state ) ; if ( log is info enabled ( ) ) { log info ( " subtask { } has discovered a new shard { } due to resharding , and will start consuming " + " the shard from sequence number { } with shard consumer { } " , index of this consumer subtask , new shard state get stream shard handle ( ) to string ( ) , new shard state get last processed sequence num ( ) , new state index ) ; } stream shard handle stream shard handle = new shard state get stream shard handle ( ) ; kinesis deserialization schema < t > shard deserialization schema = get cloned deserialization schema ( ) ; shard deserialization schema open ( runtime context initialization context adapters deserialization adapter ( runtime context , / / ignore the provided metric group metric group - > consumer metric group add group ( " subtask id " , string value of ( index of this consumer subtask ) ) add group ( " shard id " , stream shard handle get shard ( ) get shard id ( ) ) add group ( " user " ) ) ) ; shard consumers executor submit ( create shard consumer ( new state index , new shard state get stream shard handle ( ) , new shard state get last processed sequence num ( ) , register shard metric group ( consumer metric group , new shard state ) , shard deserialization schema ) ) ; } / / we also check if we are running here so that we won ' t start the discovery sleep / / interval if the running flag was set to false during the middle of the while loop if ( running & & discovery interval millis ! = 0 ) { try { thread sleep ( discovery interval millis ) ; } catch ( interrupted exception iex ) { / / the sleep may be interrupted by shutdown fetcher ( ) } } } / / make sure all resources have been terminated before leaving try { await termination ( ) ; } catch ( interrupted exception ie ) { / / if there is an original exception , preserve it , since that ' s more important / useful this error compare and set ( null , ie ) ; } / / any error thrown in the shard consumer threads will be thrown to the main thread throwable throwable = this error get ( ) ; if ( throwable ! = null ) { if ( throwable instanceof exception ) { throw ( exception ) throwable ; } else if ( throwable instanceof error ) { throw ( error ) throwable ; } else { throw new exception ( throwable ) ; } } }


return an new { @ link channel progressive promise }

channel progressive promise new progressive promise ( ) ;


immediately delays operations and uses the { @ code executor } to wait for in - flight operations to finish and then acquires all permits when all permits are acquired , the provided { @ link action listener } is called under the guarantee that no new operations are started delayed operations are run once the { @ link releasable } is released or if a failure occurs while acquiring all permits ; in this case the { @ code on failure } handler will be invoked after delayed operations are released

public void block operations ( final action listener < releasable > on acquired , final long timeout , final time unit time unit , string executor ) { delay operations ( ) ; thread pool executor ( executor ) execute ( new abstract runnable ( ) { final run once released = new run once ( ( ) - > release delayed operations ( ) ) ; @ override public void on failure ( final exception e ) { try { released run ( ) ; / / resume delayed operations as soon as possible } finally { on acquired on failure ( e ) ; } } @ override protected void do run ( ) throws exception { final releasable releasable = acquire all ( timeout , time unit ) ; on acquired on response ( ( ) - > { try { releasable close ( ) ; } finally { released run ( ) ; } } ) ; } } ) ; }


public void run request ( @ non null request request ) { requests add ( request ) ; if ( ! is paused ) { request begin ( ) ; } else { request clear ( ) ; if ( log is loggable ( tag , log verbose ) ) { log v ( tag , " paused , delaying request " ) ; } pending requests add ( request ) ; } }


ignore { @ code method } in the tests that follow returns this object

public null pointer tester ignore ( method method ) { ignored members add ( check not null ( method ) ) ; return this ; }


public server build ( ) throws i o exception , hadoop illegal argument exception { if ( this conf = = null ) { throw new hadoop illegal argument exception ( " conf is not set " ) ; } if ( this protocol = = null ) { throw new hadoop illegal argument exception ( " protocol is not set " ) ; } if ( this instance = = null ) { throw new hadoop illegal argument exception ( " instance is not set " ) ; } return get protocol engine ( this protocol , this conf ) get server ( this protocol , this instance , this bind address , this port , this num handlers , this num readers , this queue size per handler , this verbose , this conf , this secret manager , this port range config , this alignment context ) ; }


cleans up internal state for all existing mocks you may assume there won ' t be any interaction to mocks created previously after this is called


test that environment variables are not escaped or quoted

public void test extra action info environment variables ( ) throws exception { map < string , string > env = immutable map of ( " p1 " , " simple " , " p2 " , " spaces are not escaped " , " p3 " , " : " , " p4 " , " " , " nonsense variable " , " value " ) ; spawn info spawn info = create copy from welcome to destination ( env ) get extra action info ( action key context ) build ( ) get extension ( spawn info spawn info ) ; assert that ( env ) has size ( spawn info get variable count ( ) ) ; for ( environment variable variable : spawn info get variable list ( ) ) { assert that ( env ) contains entry ( variable get name ( ) , variable get value ( ) ) ; } }


returns true if field uploaded jar location is set ( has been assigned a value ) and false otherwise

public boolean is set uploaded jar location ( ) { return this uploaded jar location ! = null ; }


switch the target object , replacing the cached introspection results only if the class of the new object is different to that of the replaced object

public void set wrapped instance ( object object , @ nullable string nested path , @ nullable object root object ) { this wrapped object = object utils unwrap optional ( object ) ; assert not null ( this wrapped object , " target object must not be null " ) ; this nested path = ( nested path ! = null ? nested path : " " ) ; this root object = ( ! this nested path is empty ( ) ? root object : this wrapped object ) ; this nested property accessors = null ; this type converter delegate = new type converter delegate ( this , this wrapped object ) ; }


file get root dir ( ) { return root dir file ; }


return the maximum number of messages to load into a session

public int get prefetch size ( ) { return this prefetch size ; }


returns an instance of impersonation provider looks up the configuration to see if there is custom class specified

private static impersonation provider get instance ( configuration conf ) { class < ? extends impersonation provider > clazz = conf get class ( common configuration keys public hadoop security impersonation provider class , default impersonation provider class , impersonation provider class ) ; return reflection utils new instance ( clazz , conf ) ; }


returns an exception for an unexpected error during type inference

public static table exception create unexpected exception ( call context call context , throwable cause ) { return new table exception ( string format ( " unexpected error in type inference logic of function ' % s ' this is a bug " , call context get name ( ) ) , cause ) ; }


find the next child that needs to be traversed

public int get operand ( ) { return breadcrumb [ depth ] ; }


public string get last name ( ) { return last name ; }


the version of this retention lease collection the version is managed on the primary and incremented any time that a retention lease is added , renewed , or when retention leases expire

public long version ( ) { return version ; }


start rendering one or more { @ link renderable } s use one of the render ( ) methods to provide the renderables must be followed by a call to { @ link # end ( ) } the open g l context must not be altered between { @ link # begin ( camera ) } and { @ link # end ( ) }

public void begin ( final camera cam ) { if ( camera ! = null ) throw new gdx runtime exception ( " call end ( ) first " ) ; camera = cam ; if ( own context ) context begin ( ) ; }


returns a new no - op { @ code removal listener }

static < k , v > null removal listener < k , v > null removal listener ( ) { return new null removal listener < > ( ) ; }


public void big decimal test ( ) { / / todo : test big decimal }


public get calendars response get calendars ( get calendars request request , request options options ) throws i o exception { return rest high level client perform request and parse entity ( request , m l request converters : : get calendars , options , get calendars response : : from x content , collections empty set ( ) ) ; }


deserializes an { @ link abstract ms type } from the { @ link pdb byte reader } and returns it

public abstract ms type parse ( pdb byte reader reader ) throws pdb exception , cancelled exception { abstract ms type result = parse ( reader , abstract ms type class ) ; return result ; }


private void connect tools ( ) { tool manager tm = plugin get active project ( ) get tool manager ( ) ; if ( tool connection dialog = = null ) { tool connection dialog = new tool connection dialog ( tool , tm ) ; } else { tool connection dialog set tool manager ( tm ) ; } tool connection dialog set visible ( true ) ; / / dialog handles the connections }


moves all information stored in the given range to the new location

public void move address range ( address from addr , address to addr , long length , task monitor monitor ) throws address overflow exception , rollback exception { / / todo : ensure that managers are notified with address ranges which correspond to a sequential set of address keys / / todo : warning ! from addr range may no longer exist in memory map which could affect certain database iterators lock acquire ( ) ; try { for ( int i = num managers - 1 ; i > = 0 ; i - - ) { managers [ i ] move address range ( from addr , to addr , length , monitor ) ; } clear cache ( false ) ; iterator < string > iter = addr set property map key set ( ) iterator ( ) ; while ( iter has next ( ) ) { address set property map d b pm = addr set property map get ( iter next ( ) ) ; pm move address range ( from addr , to addr , length , monitor ) ; } iter = int range property map key set ( ) iterator ( ) ; while ( iter has next ( ) ) { int range map map = int range property map get ( iter next ( ) ) ; map move address range ( from addr , to addr , length , monitor ) ; } } catch ( cancelled exception e ) { throw new rollback exception ( " operation cancelled " ) ; } finally { lock release ( ) ; } }


get the name of this tree which is the same name as the view in the program

string get tree name ( ) { return tree get tree name ( ) ; }


returns the idl srcs defined on the given rule

private static collection < artifact > get idl srcs ( rule context rule context ) { if ( ! rule context get rule ( ) is attr defined ( " idl srcs " , build type label list ) ) { return immutable list of ( ) ; } check idl srcs same package ( rule context ) ; return rule context get prerequisite artifacts ( " idl srcs " ) filter ( android rule classes android idl ) list ( ) ; }


seriously complicated algorithm ( conceptually ) to ensure that we never store in our collection of ungrouped edges ( which we may sometime have to re - install ) any group vertex , as when we go to restore the edges , we do not know how to do so if the group is no longer there ( like as a result of an ungroup operation )

private void convert grouped edge ( f g edge edge , set < f g edge > updated edges ) { f g vertex start vertex = edge get start ( ) ; f g vertex destination vertex = edge get end ( ) ; if ( ! either grouped endpoint ( start vertex , destination vertex ) ) { updated edges add ( edge ) ; / / plain old edge return ; } / / / / when both endpoints are groups , we want to get all edges in common for later restoring , / / as we don ' t know which edges either group refers to if the group goes away / / if ( both grouped endpoints ( start vertex , destination vertex ) ) { set < f g edge > intersecting converted edges = get intersecting edges ( ( grouped function graph vertex ) start vertex , ( grouped function graph vertex ) destination vertex ) ; updated edges add all ( intersecting converted edges ) ; return ; } / / / / o k , one of the endpoints is grouped find out which one and get all edges that / / have the same start / destination for later restoring , / / as we don ' t know which edges the group refers to if the group goes away / / if ( start vertex instanceof grouped function graph vertex ) { set < f g edge > converted destination edges = ( ( grouped function graph vertex ) start vertex ) get all edges with destination ( destination vertex ) ; updated edges add all ( converted destination edges ) ; } else { set < f g edge > converted start edges = ( ( grouped function graph vertex ) destination vertex ) get all edges with start ( start vertex ) ; updated edges add all ( converted start edges ) ; } }


public array < k > to array ( array < k > array ) { while ( has next ) array add ( next ( ) ) ; return array ; }


returns the simple name , which identifies this mapper against other mappers at the same level in the mappers hierarchy todo : make this protected once mapper and field mapper are merged together

public final string simple name ( ) { return simple name ; }


public void test dog all of ( ) { / / todo : test dog all of }


reads an enum with type e that was serialized based on the value of it ' s ordinal

public < e extends enum < e > > enum set < e > read enum set ( class < e > enum class ) throws i o exception { int size = read v int ( ) ; final enum set < e > res = enum set none of ( enum class ) ; if ( size = = 0 ) { return res ; } final e [ ] values = enum class get enum constants ( ) ; for ( int i = 0 ; i < size ; i + + ) { res add ( read enum ( enum class , values ) ) ; } return res ; }


emit a response that should be on nexted to an observer

public void emit response ( t response ) { if ( ! is terminated ( ) ) { subject on next ( response ) ; value set set ( true ) ; } else { throw new illegal state exception ( " response has already terminated so response can not be set : " + response ) ; } }


returns a list with external versions of the given list of internal class names

private list external class names ( list internal class names ) { list external class names = new array list ( internal class names size ( ) ) ; for ( int index = 0 ; index < internal class names size ( ) ; index + + ) { external class names add ( class util external class name ( ( string ) internal class names get ( index ) ) ) ; } return external class names ; }


invokes the authorizer to obtain a sas token

string get s a s token ( string account , string file system , string path , string operation ) throws i o exception , access control exception ;


public void trace ( string path , string accept type , route route ) { add route ( http method trace , create route impl ( path , accept type , route ) ) ; }


build call for upload file with required file

public okhttp 3 call upload file with required file call ( long pet id , file required file , string additional metadata , final api callback callback ) throws api exception { object local var post body = null ; / / create path and map variables api operation api operation = local var api client get operation lookup map ( ) get ( " upload file with required file " ) ; if ( api operation = = null ) { throw new api exception ( " operation not found in oas " ) ; } operation operation = api operation get operation ( ) ; string local var path = api operation get path ( ) ; map < string , object > param map = new hash map < > ( ) ; param map put ( " pet id " , pet id ) ; list < pair > local var query params = new array list < pair > ( ) ; list < pair > local var collection query params = new array list < pair > ( ) ; map < string , string > local var header params = new hash map < string , string > ( ) ; map < string , string > local var cookie params = new hash map < string , string > ( ) ; map < string , object > local var form params = new hash map < string , object > ( ) ; if ( additional metadata ! = null ) { local var form params put ( " additional metadata " , additional metadata ) ; } if ( required file ! = null ) { local var form params put ( " required file " , required file ) ; } local var path = local var api client fill parameters from operation ( operation , param map , local var path , local var query params , local var collection query params , local var header params , local var cookie params ) ; final string [ ] local var accepts = { " application / json " } ; final string local var accept = local var api client select header accept ( local var accepts ) ; if ( local var accept ! = null ) { local var header params put ( " accept " , local var accept ) ; } final string [ ] local var content types = { " multipart / form - data " } ; final string local var content type = local var api client select header content type ( local var content types ) ; local var header params put ( " content - type " , local var content type ) ; string [ ] local var auth names = new string [ ] { " petstore auth " } ; return local var api client build call ( local var path , api operation get method ( ) , local var query params , local var collection query params , local var post body , local var header params , local var cookie params , local var form params , local var auth names , callback ) ; }


public static void set status bar custom ( @ non null final view fake status bar ) { if ( build version sdk int < build version codes kitkat ) return ; activity activity = utils bridge get activity by context ( fake status bar get context ( ) ) ; if ( activity = = null ) return ; transparent status bar ( activity ) ; fake status bar set visibility ( view visible ) ; view group layout params layout params = fake status bar get layout params ( ) ; if ( layout params = = null ) { layout params = new view group layout params ( view group layout params match parent , get status bar height ( ) ) ; fake status bar set layout params ( layout params ) ; } else { layout params width = view group layout params match parent ; layout params height = get status bar height ( ) ; } }


verify the following scenario a put a live node to maintenance = > 1 maintenance , 2 live b the maintenance node becomes dead = > block map still has 1 maintenance , 2 live c take the node out of maintenance = > nn should schedule the replication and end up with 3 live

public void test take dead node out of maintenance ( ) throws exception { log info ( " starting test take dead node out of maintenance " ) ; final int num namenodes = 1 ; final int num datanodes = 4 ; start cluster ( num namenodes , num datanodes ) ; final path file = new path ( " / test take dead node out of maintenance dat " ) ; final int replicas = 3 ; final file system file sys = get cluster ( ) get file system ( 0 ) ; final f s namesystem ns = get cluster ( ) get namesystem ( 0 ) ; write file ( file sys , file , replicas , 1 ) ; final datanode info node outof service = take node outof service ( 0 , get first block first replica uuid ( file sys , file ) , long max value , null , admin states in maintenance ) ; check with retry ( ns , file sys , file , replicas - 1 , node outof service ) ; final d f s client client = get dfs client ( 0 ) ; assert equals ( " all datanodes must be alive " , num datanodes , client datanode report ( datanode report type live ) length ) ; get cluster ( ) stop data node ( node outof service get xfer addr ( ) ) ; d f s test util wait for datanode state ( get cluster ( ) , node outof service get datanode uuid ( ) , false , 20000 ) ; assert equals ( " maintenance node shouldn ' t be alive " , num datanodes - 1 , client datanode report ( datanode report type live ) length ) ; / / dead maintenance node ' s blocks should remain in block map check with retry ( ns , file sys , file , replicas - 1 , node outof service ) ; / / when dead maintenance mode is transitioned to out of maintenance mode , / / its blocks should be removed from block map / / this will then trigger replication to restore the live replicas back / / to replication factor put node in service ( 0 , node outof service get datanode uuid ( ) ) ; check with retry ( ns , file sys , file , replicas , node outof service , null ) ; cleanup file ( file sys , file ) ; }


check whether current user have permissions to access the path traverse is always checked parent path means the parent directory for the path ancestor path means the last ( the closest ) existing ancestor directory of the path note that if the parent path exists , then the parent path and the ancestor path are the same for example , suppose the path is " foobarbaz " no matter baz is a file or a directory , the parent path is " foobar " if bar exists , then the ancestor path is also " foobar " if bar does not exist and foo exists , then the ancestor path is " foo " further , if both foo and bar do not exist , then the ancestor path is " "

void check permission ( i nodes in path inodes in path , boolean do check owner , fs action ancestor access , fs action parent access , fs action access , fs action sub access , boolean ignore empty dir ) throws access control exception { if ( log is debug enabled ( ) ) { log debug ( " access check : " + this + " , do check owner = " + do check owner + " , ancestor access = " + ancestor access + " , parent access = " + parent access + " , access = " + access + " , sub access = " + sub access + " , ignore empty dir = " + ignore empty dir ) ; } / / check if ( parent access ! = null ) & & file exists , then check sb / / if resolve link , the check is performed on the link target final int snapshot id = inodes in path get path snapshot id ( ) ; final i node [ ] inodes = inodes in path get i nodes array ( ) ; final i node attributes [ ] inode attrs = new i node attributes [ inodes length ] ; final byte [ ] [ ] components = inodes in path get path components ( ) ; for ( int i = 0 ; i < inodes length & & inodes [ i ] ! = null ; i + + ) { inode attrs [ i ] = get i node attrs ( inodes [ i ] , snapshot id ) ; } string path = inodes in path get path ( ) ; int ancestor index = inodes length - 2 ; access control enforcer enforcer = get access control enforcer ( ) ; string op type = operation type get ( ) ; if ( this authorize with context & & op type ! = null ) { i node attribute provider authorization context builder builder = new i node attribute provider authorization context builder ( ) ; builder fs owner ( fs owner ) supergroup ( supergroup ) caller ugi ( caller ugi ) inode attrs ( inode attrs ) inodes ( inodes ) path by name arr ( components ) snapshot id ( snapshot id ) path ( path ) ancestor index ( ancestor index ) do check owner ( do check owner ) ancestor access ( ancestor access ) parent access ( parent access ) access ( access ) sub access ( sub access ) ignore empty dir ( ignore empty dir ) operation name ( op type ) caller context ( caller context get current ( ) ) ; enforcer check permission with context ( builder build ( ) ) ; } else { enforcer check permission ( fs owner , supergroup , caller ugi , inode attrs , inodes , components , snapshot id , path , ancestor index , do check owner , ancestor access , parent access , access , sub access , ignore empty dir ) ; } }


< code > repeated aapt pb styled string span span = 2 ; < code >

private void set span ( int index , com android aapt resources styled string span builder builder for value ) { ensure span is mutable ( ) ; span set ( index , builder for value build ( ) ) ; }


set the { @ code name } to { @ code value } this will remove all previous values associated with { @ code name }


given a pattern and a full path , determine the pattern - mapped part this method is supposed to find out which part of the path is matched dynamically through an actual pattern , that is , it strips off a statically defined leading path from the given full path , returning only the actually pattern - matched part of the path for example : for " myroot html " as pattern and " myrootmyfile html " as full path , this method should return " myfile html " the detailed determination rules are specified to this path matcher ' s matching strategy a simple implementation may return the given full path as - is in case of an actual pattern , and the empty string in case of the pattern not containing any dynamic parts ( i e the { @ code pattern } parameter being a static path that wouldn ' t qualify as an actual { @ link # is pattern pattern } ) a sophisticated implementation will differentiate between the static parts and the dynamic parts of the given path pattern

string extract path within pattern ( string pattern , string path ) ;


reconstruct this data block and recalculate checksum

private void recalculate checksum ( int err blk index , long block length ) throws i o exception { log debug ( " recalculate checksum for the missing / failed block index { } " , err blk index ) ; byte [ ] err indices = new byte [ 1 ] ; err indices [ 0 ] = ( byte ) err blk index ; striped reconstruction info striped recon info = new striped reconstruction info ( block group , ec policy , block indices , datanodes , err indices ) ; block checksum type group checksum type = get block checksum options ( ) get block checksum type ( ) ; try ( striped block checksum reconstructor checksum recon = group checksum type = = block checksum type composite crc ? new striped block checksum composite crc reconstructor ( get datanode ( ) get erasure coding worker ( ) , striped recon info , block checksum buf , block length ) : new striped block checksum md 5 crc reconstructor ( get datanode ( ) get erasure coding worker ( ) , striped recon info , block checksum buf , block length ) ) { checksum recon reconstruct ( ) ; data checksum checksum = checksum recon get checksum ( ) ; long crc per block = checksum get checksum size ( ) < = 0 ? 0 : checksum recon get checksum data len ( ) / checksum get checksum size ( ) ; set or verify checksum properties ( err blk index , checksum get bytes per checksum ( ) , crc per block , checksum get checksum type ( ) ) ; log debug ( " recalculated checksum for the block index : { } , checksum = { } " , err blk index , checksum recon get digest object ( ) ) ; } }


used for handling output of callable statements

public string get result map id ( ) { return result map id ; }


perform a scan within the specified base packages , returning the registered bean definitions this method does not register an annotation config processor but rather leaves this up to the caller

protected set < bean definition holder > do scan ( string base packages ) { assert not empty ( base packages , " at least one base package must be specified " ) ; set < bean definition holder > bean definitions = new linked hash set < > ( ) ; for ( string base package : base packages ) { set < bean definition > candidates = find candidate components ( base package ) ; for ( bean definition candidate : candidates ) { scope metadata scope metadata = this scope metadata resolver resolve scope metadata ( candidate ) ; candidate set scope ( scope metadata get scope name ( ) ) ; string bean name = this bean name generator generate bean name ( candidate , this registry ) ; if ( candidate instanceof abstract bean definition ) { post process bean definition ( ( abstract bean definition ) candidate , bean name ) ; } if ( candidate instanceof annotated bean definition ) { annotation config utils process common definition annotations ( ( annotated bean definition ) candidate ) ; } if ( check candidate ( bean name , candidate ) ) { bean definition holder definition holder = new bean definition holder ( candidate , bean name ) ; definition holder = annotation config utils apply scoped proxy mode ( scope metadata , definition holder , this registry ) ; bean definitions add ( definition holder ) ; register bean definition ( definition holder , this registry ) ; } } } return bean definitions ; }


write out the tuples in a temporary file and return it

public void write tuples ( ) throws i o exception { this temp file = file create temp file ( " binary input format " , null ) ; this temp file delete on exit ( ) ; configuration configuration = new configuration ( ) ; configuration set long ( binary output format block size parameter key , this block size ) ; if ( this parallelism = = 1 ) { binary output format < t > output = create output format ( this temp file to u r i ( ) to string ( ) , configuration ) ; for ( int index = 0 ; index < this number of tuples ; index + + ) { output write record ( this get record ( index ) ) ; } output close ( ) ; } else { this temp file delete ( ) ; this temp file mkdir ( ) ; int record index = 0 ; for ( int file index = 0 ; file index < this parallelism ; file index + + ) { binary output format < t > output = create output format ( this temp file to u r i ( ) + " / " + ( file index + 1 ) , configuration ) ; for ( int file count = 0 ; file count < this get number of tuples per file ( file index ) ; file count + + , record index + + ) { output write record ( this get record ( record index ) ) ; } output close ( ) ; } } }


should create a key by which this scm configuration might be distinguished from others in the same project should be invariable across builds but otherwise as distinctive as possible could include information such as the relative paths used in { @ link # get module roots ( file path , abstract build ) } , andor configured repository u r ls and branch names , andor labels set for this purpose by the user the result may be used for various purposes , but it may be long andor include url - unsafe characters , so to use in a url path component you may need to first wrap it in { @ link util # get digest of ( string ) } or otherwise encode it

public @ non null string get key ( ) { return get type ( ) ; }


tries to resolve the given path against the list of available roots if path starts with one of the listed roots , it returned back by this method , otherwise null is returned

public static path get ( path [ ] roots , string path ) { for ( path root : roots ) { path normalized root = root normalize ( ) ; path normalized path = normalized root resolve ( path ) normalize ( ) ; if ( normalized path starts with ( normalized root ) ) { return normalized path ; } } return null ; }


remove a listener that is listening to when the tool chest is changed

public void remove tool chest change listener ( tool chest change listener l ) ;


public void clear ( ) { ( ( f v table model ) get model ( ) ) clear ( ) ; }


convenient call for { @ link abstract dao # delete ( object ) }

public < t > void delete ( t entity ) { @ suppress warnings ( " unchecked " ) abstract dao < t , ? > dao = ( abstract dao < t , ? > ) get dao ( entity get class ( ) ) ; dao delete ( entity ) ; }


gets the source of this reference { @ link source type } s


returns the status of current or last executed work plan

public disk balancer work status query disk balancer plan ( ) throws i o exception { check superuser privilege ( ) ; return get disk balancer ( ) query work status ( ) ; }


creates a function at entry point in the specified program

public final function create function ( address entry point , program current program , task monitor monitor ) { create function cmd cmd = new create function cmd ( null , entry point , null , source ) ; if ( cmd apply to ( current program , monitor ) ) { return current program get listing ( ) get function at ( entry point ) ; } return null ; }


assert that a service configuration contains a specific key ; the value is ignored

public static void assert service configuration contains ( service service , string key ) { assert not null ( " no option " + key + " in service configuration " , service get config ( ) get ( key ) ) ; }


allocates the given slot for the given slot request this entails sending a registration message to the task manager and treating failures

private void allocate slot ( task manager slot task manager slot , pending slot request pending slot request ) { preconditions check state ( task manager slot get state ( ) = = slot state free ) ; task executor connection task executor connection = task manager slot get task manager connection ( ) ; task executor gateway gateway = task executor connection get task executor gateway ( ) ; final completable future < acknowledge > completable future = new completable future < > ( ) ; final allocation i d allocation id = pending slot request get allocation id ( ) ; final slot i d slot id = task manager slot get slot id ( ) ; final instance i d instance i d = task manager slot get instance id ( ) ; task manager slot assign pending slot request ( pending slot request ) ; pending slot request set request future ( completable future ) ; return pending task manager slot if assigned ( pending slot request ) ; task manager registration task manager registration = task manager registrations get ( instance i d ) ; if ( task manager registration = = null ) { throw new illegal state exception ( " could not find a registered task manager for instance id " + instance i d + ' ' ) ; } task manager registration mark used ( ) ; / / rpc call to the task manager completable future < acknowledge > request future = gateway request slot ( slot id , pending slot request get job id ( ) , allocation id , pending slot request get resource profile ( ) , pending slot request get target address ( ) , resource manager id , task manager request timeout ) ; request future when complete ( ( acknowledge acknowledge , throwable throwable ) - > { if ( acknowledge ! = null ) { completable future complete ( acknowledge ) ; } else { completable future complete exceptionally ( throwable ) ; } } ) ; completable future when complete async ( ( acknowledge acknowledge , throwable throwable ) - > { try { if ( acknowledge ! = null ) { update slot ( slot id , allocation id , pending slot request get job id ( ) ) ; } else { if ( throwable instanceof slot occupied exception ) { slot occupied exception exception = ( slot occupied exception ) throwable ; update slot ( slot id , exception get allocation id ( ) , exception get job id ( ) ) ; } else { remove slot request from slot ( slot id , allocation id ) ; } if ( ! ( throwable instanceof cancellation exception ) ) { handle failed slot request ( slot id , allocation id , throwable ) ; } else { log debug ( " slot allocation request { } has been cancelled " , allocation id , throwable ) ; } } } catch ( exception e ) { log error ( " error while completing the slot allocation " , e ) ; } } , main thread executor ) ; }


any comments associated with the plural < code > optional string comment = 2 ; < code >

public java lang string get comment ( ) { return comment ; }


filters { @ code args } by removing superfluous items : the client ' s environment variables may contain sensitive data , so we filter it out { @ code - - default override } is spammy

private static immutable list < string > filter args ( iterable < string > args ) { if ( args = = null ) { return null ; } immutable list builder < string > filtered args = immutable list builder ( ) ; for ( string arg : args ) { if ( arg ! = null & & ! arg starts with ( " - - client env = " ) & & ! arg starts with ( " - - default override = " ) ) { filtered args add ( arg ) ; } } return filtered args build ( ) ; }


return the configured { @ link xnio worker }

public xnio worker get xnio worker ( ) { return this worker ; }


returns a hash code for the elements of the given array , or 0 if it is null

public static int hash code or null ( object [ ] array ) { return array = = null ? 0 : hash code ( array , array length ) ; }


re - checks the requirements if there are network requirements that are currently not met when we receive an event that implies newly established network connectivity , we re - check the requirements by calling { @ link # check requirements ( ) } this check sometimes sees that there is still no active network , meaning that any network requirements will remain not met by calling this method when we receive other events that imply continued network connectivity , we can detect that the requirements are met once an active network does exist

private void recheck not met network requirements ( ) { if ( ( not met requirements & ( requirements network | requirements network unmetered ) ) = = 0 ) { / / no unmet network requirements to recheck return ; } check requirements ( ) ; }


private int alloc space ( int size ) { if ( size > floats length - next free ) { adjust space ( 2 * ( total space allocated + size ) ) ; } int ret = next free ; next free + = size ; total space allocated + = size ; return ret ; }


verify that delayed s3 listings doesn ' t stop the fs from deleting a directory tree this has not always been the case ; this test verifies the fix and prevents regression

public void test delete uses s 3 guard ( ) throws throwable { describe ( " verify that delete ( ) uses s 3 guard to get a consistent " + " listing of its directory structure " ) ; assume v 2 list a p i ( ) ; s 3 a file system fs = get file system ( ) ; path root = path ( " test delete uses s 3 guard - " + default delay key substring ) ; for ( int i = 0 ; i < 3 ; i + + ) { path path = new path ( root , " file - " + i ) ; touch ( fs , path ) ; } / / we now expect the listing to miss these string key = fs path to key ( root ) + " / " ; / / verify that the inconsistent listing does not show these log info ( " listing objects before executing delete ( ) " ) ; list < path > pre delete paths = objects to paths ( list objects v 2 ( fs , key , null ) ) ; assertions assert that ( pre delete paths ) is empty ( ) ; / / do the delete fs delete ( root , true ) ; / / now go through every file and verify that it is not there / / if you comment out the delete above and run this test case , / / the assertion will fail ; this is how the validity of the assertions / / were verified clear inconsistency ( fs ) ; list < path > post delete paths = objects to paths ( list objects v 2 ( fs , key , null ) ) ; assertions assert that ( post delete paths ) is empty ( ) ; }


seeks to the specified position in microseconds

public void seek to us ( long position us ) { last seek position us = position us ; if ( is pending reset ( ) ) { / / a reset is already pending we only need to update its position pending reset position us = position us ; return ; } / / detect whether the seek is to the start of a chunk that ' s at least partially buffered @ nullable base media chunk seek to media chunk = null ; for ( int i = 0 ; i < media chunks size ( ) ; i + + ) { base media chunk media chunk = media chunks get ( i ) ; long media chunk start time us = media chunk start time us ; if ( media chunk start time us = = position us & & media chunk clipped start time us = = c time unset ) { seek to media chunk = media chunk ; break ; } else if ( media chunk start time us > position us ) { / / we ' re not going to find a chunk with a matching start time break ; } } / / see if we can seek inside the primary sample queue boolean seek inside buffer ; if ( seek to media chunk ! = null ) { / / when seeking to the start of a chunk we use the index of the first sample in the chunk / / rather than the seek position this ensures we seek to the keyframe at the start of the / / chunk even if its timestamp is slightly earlier than the advertised chunk start time seek inside buffer = primary sample queue seek to ( seek to media chunk get first sample index ( 0 ) ) ; } else { seek inside buffer = primary sample queue seek to ( position us , / * allow time beyond buffer = * / position us < get next load position us ( ) ) ; } if ( seek inside buffer ) { / / we can seek inside the buffer next notify primary format media chunk index = primary sample index to media chunk index ( primary sample queue get read index ( ) , / * min chunk index = * / 0 ) ; / / seek the embedded sample queues for ( sample queue embedded sample queue : embedded sample queues ) { embedded sample queue seek to ( position us , / * allow time beyond buffer = * / true ) ; } } else { / / we can ' t seek inside the buffer , and so need to reset pending reset position us = position us ; loading finished = false ; media chunks clear ( ) ; next notify primary format media chunk index = 0 ; if ( loader is loading ( ) ) { / / discard as much as we can synchronously primary sample queue discard to end ( ) ; for ( sample queue embedded sample queue : embedded sample queues ) { embedded sample queue discard to end ( ) ; } loader cancel loading ( ) ; } else { loader clear fatal error ( ) ; reset sample queues ( ) ; } } }


protected void finalize profile response ( final o auth 2 0 access token access token ticket , final map < string , object > map , final principal principal , final registered service registered service ) { if ( registered service instanceof o auth registered service ) { val service = access token ticket get service ( ) ; map put ( cas protocol constants parameter service , service get id ( ) ) ; } }


add the extra memory that will be utilized by the sort method

public long get memory utilized ( ) { / / this is memory that will be actually utilized ( considering the temp / / array that will be allocated by the sort ( ) method ( mergesort ) ) return super get memory utilized ( ) + super count * 4 ; }


ignore bundle progress if flink metric container is null the flink metric container will be set to null if metric is configured to be turned off

private bundle progress handler get progress handler ( flink metric container flink metric container ) { if ( flink metric container = = null ) { return bundle progress handler ignored ( ) ; } else { return new bundle progress handler ( ) { @ override public void on progress ( beam fn api process bundle progress response progress ) { flink metric container update metrics ( task name , progress get monitoring infos list ( ) ) ; } @ override public void on completed ( beam fn api process bundle response response ) { flink metric container update metrics ( task name , response get monitoring infos list ( ) ) ; } } ; } }


public purge task status get purge task status ( ) { return purge task status ; }


gets the string representation at the given index in the block

public string get data representation ( byte block block , big integer index ) throws byte block access exception { byte b = block get byte ( index ) ; int i = b ; i & = 0xff ; / / 0377 string str = integer to octal string ( i ) ; if ( str length ( ) > symbol size ) { str = str substring ( str length ( ) - symbol size ) ; } return pad ( str ) ; }


writes the given job manager address to the associated configuration object

static void set job manager address in config ( configuration config , inet socket address address ) { config set string ( job manager options address , address get host string ( ) ) ; config set integer ( job manager options port , address get port ( ) ) ; config set string ( rest options address , address get host string ( ) ) ; config set integer ( rest options port , address get port ( ) ) ; }


public final delete response delete ( delete request delete request , request options options ) throws i o exception { return perform request and parse entity ( delete request , request converters : : delete , options , delete response : : from x content , singleton ( 404 ) ) ; }


checks if the given http message should be considered as a last spdy frame

private static boolean is last ( http message http message ) { if ( http message instanceof full http message ) { full http message full message = ( full http message ) http message ; if ( full message trailing headers ( ) is empty ( ) & & ! full message content ( ) is readable ( ) ) { return true ; } } return false ; }


delegate implementation which cares about the element type

private static < e > boolean retain occurrences impl ( multiset < e > multiset to modify , multiset < ? > occurrences to retain ) { check not null ( multiset to modify ) ; check not null ( occurrences to retain ) ; / / avoiding concurrent modification exceptions is tricky iterator < entry < e > > entry iterator = multiset to modify entry set ( ) iterator ( ) ; boolean changed = false ; while ( entry iterator has next ( ) ) { entry < e > entry = entry iterator next ( ) ; int retain count = occurrences to retain count ( entry get element ( ) ) ; if ( retain count = = 0 ) { entry iterator remove ( ) ; changed = true ; } else if ( retain count < entry get count ( ) ) { multiset to modify set count ( entry get element ( ) , retain count ) ; changed = true ; } } return changed ; }


register a listener that will be called when this model is unbound from a view the listener will contribute to this model ' s hash code state per the { @ link com airbnb epoxy epoxy attribute option # do not hash } rules you may clear the listener by setting a null value , or by calling { @ link # reset ( ) }

public generate default layout method parent layout $ with layout on unbind ( on model unbound listener < generate default layout method parent layout $ with layout , object > listener ) { on mutation ( ) ; this on model unbound listener epoxy generated model = listener ; return this ; }


gets the { @ link user code class loader } to load classes that are not in system ' s classpath , but are part of the jar file of a user job

user code class loader get user code class loader ( ) ;


reverses the elements of { @ code array } this is equivalent to { @ code collections reverse ( ints as list ( array ) ) } , but is likely to be more efficient

public static void reverse ( int [ ] array ) { check not null ( array ) ; reverse ( array , 0 , array length ) ; }


test serialization of object with outer number type

public void fake outer composite serialize test ( ) throws api exception { outer composite outer composite = null ; outer composite response = api fake outer composite serialize ( outer composite ) ; / / todo : test validations }


creates a transition for the components with the given transition keys

public static transition units builder create ( string keys ) { return create ( default transition key type , keys ) ; }


asserts that { @ code actual } is equal to the contents of { @ code dump file } if the assertion fails because of an intended change in the output or a new dump file needs to be created , set { @ link # dump file action } to { @ link # write to local } for local tests and to { @ link # write to device } for instrumentation tests , and run the test again instead of assertion , { @ code actual } will be written to { @ code dump file } for instrumentation tests , this new dump file needs to be copied to the project { @ code testdatasrctest } folder manually

public static void assert output ( context context , string actual , string dump file ) throws i o exception { if ( dump file action = = compare with existing ) { string expected ; try { expected = test util get string ( context , dump file ) ; } catch ( file not found exception e ) { throw new i o exception ( " dump file not found " + dump update instructions , e ) ; } assert with message ( " actual data doesn ' t match dump file : % s \ n % s " , dump file , dump update instructions ) that ( actual ) is equal to ( expected ) ; } else { file file = dump file action = = write to local ? new file ( standard system property user dir value ( ) , " / / testdata / src / test / assets " ) : context get external files dir ( null ) ; file = new file ( file , dump file ) ; assertions check state not null ( file get parent file ( ) ) mkdirs ( ) ; print writer out = new print writer ( file ) ; out print ( actual ) ; out close ( ) ; } }


specifies the name of the default database in the initial catalog to be created when instantiating a { @ link table environment } the database will be used to store all non - serializable objects such as tables and functions registered via e g { @ link table environment # register table sink ( string , table sink ) } or { @ link table environment # register function ( string , scalar function ) } it will also be the initial value for the current database which can be altered via { @ link table environment # use database ( string ) } default : " default database "

public builder with built in database name ( string built in database name ) { this built in database name = built in database name ; return this ; }


following method performs the finalization

public void unprepare ( ) { if ( this output ! = null ) { this output flush ( ) ; this output close ( ) ; } if ( this error ! = null ) { this error flush ( ) ; this error close ( ) ; } logger debug ( " console logger module : : unprepare ( ) ; " ) ; }


method that adds delimiter information ( based on the state to the { @ link string } representation of the input argument the boolean argument is available to give the caller a single - line way of calling the method in a conditional sense ( i e , eliminates the need for a conditional block wrapping the call )

public string out ( boolean output , string val ) { if ( output ) { if ( first ) { first = false ; return delim start + val ; } return delim + val ; } return " " ; }


public void property class test ( ) { / / todo : test property class }


note that a file was committed increase the counter of files and total size if there is room in the committed files list , the file will be added to the list and so end up in the success file

public synchronized void upload committed ( string key , long size ) { if ( committed objects size ( ) < success marker file limit ) { committed objects add ( key starts with ( " / " ) ? key : ( " / " + key ) ) ; } committed object count + + ; committed bytes + = size ; }


combine the values of records in this stream by the grouped key and defined windows records with { @ code null } key or value are ignored combining implies that the type of the aggregate result is the same as the type of the input value the result is written into a local { @ link window store } ( which is basically an ever - updating materialized view ) furthermore , updates to the store are sent downstream into a { @ link k table } changelog stream the default key and value serde from the config will be used for serializing the result if a different serde is required then you should use { @ link # reduce ( reducer , named , materialized ) } the value of the first record per window initialized the aggregation result the specified { @ link reducer } is applied for each additional input record per window and computes a new aggregate using the current aggregate ( first argument ) and the record ' s value ( second argument ) : { @ code at the example of a reducer < long > new reducer < long > ( ) { public long apply ( long agg value , long curr value ) { return agg value + curr value ; } } } thus , { @ code reduce ( ) } can be used to compute aggregate functions like sum , min , or max not all updates might get sent downstream , as an internal cache is used to deduplicate consecutive updates to the same window and key the rate of propagated updates depends on your input data rate , the number of distinct keys , the number of parallel running kafka streams instances , and the { @ link streams config configuration } parameters for { @ link streams config # cache max bytes buffering config cache size } , and { @ link streams config # commit interval ms config commit interval } for failure and recovery the store ( which always will be of type { @ link timestamped window store } ) will be backed by an internal changelog topic that will be created in kafka the changelog topic will be named " $ { application id } - $ { internal store name } - changelog " , where " application id " is user - specified in { @ link streams config } via parameter { @ link streams config # application id config application id config } , " internal store name " is an internal name and " - changelog " is a fixed suffix you can retrieve all generated internal topic names via { @ link topology # describe ( ) }

k table < windowed < k > , v > reduce ( final reducer < v > reducer , final named named ) ;


the source file information of the parent inheritance declaration < code > optional aapt pb source parent source = 2 ; < code >

public builder clear parent source ( ) { copy on write ( ) ; instance clear parent source ( ) ; return this ; }


check if dfs remains in proper condition after a restart

void test restart dfs ( boolean use flush ) throws exception { final configuration conf = new hdfs configuration ( ) ; / / turn off persistent ipc , so that the d f s client can survive nn restart conf set int ( common configuration keys public ipc client connection maxidletime key , 0 ) ; mini d f s cluster cluster = null ; long len = 0 ; f s data output stream stream ; try { cluster = new mini d f s cluster builder ( conf ) num data nodes ( 3 ) build ( ) ; file system fs = cluster get file system ( ) ; / / creating a file with 4096 block size to write multiple blocks stream = fs create ( file path , true , block size , ( short ) 1 , block size ) ; stream write ( data before restart ) ; if ( use flush ) stream flush ( ) ; else stream hflush ( ) ; / / wait for at least a few blocks to get through while ( len < = block size ) { file status status = fs get file status ( file path ) ; len = status get len ( ) ; thread sleep ( 100 ) ; } / / explicitly do not close the file cluster restart name node ( ) ; / / check that the file has no less bytes than before the restart / / this would mean that blocks were successfully persisted to the log file status status = fs get file status ( file path ) ; assert true ( " length too short : " + status get len ( ) , status get len ( ) > = len ) ; / / and keep writing ( ensures that leases are also persisted correctly ) stream write ( data after restart ) ; stream close ( ) ; / / verify that the data showed up , both from before and after the restart f s data input stream read stream = fs open ( file path ) ; try { byte [ ] verify buf = new byte [ data before restart length ] ; i o utils read fully ( read stream , verify buf , 0 , verify buf length ) ; assert array equals ( data before restart , verify buf ) ; i o utils read fully ( read stream , verify buf , 0 , verify buf length ) ; assert array equals ( data after restart , verify buf ) ; } finally { i o utils close stream ( read stream ) ; } } finally { if ( cluster ! = null ) { cluster shutdown ( ) ; } } }


advance this instance to the given document id

public abstract boolean advance exact ( int doc ) throws i o exception ;


create a new { @ code server service definition } whose { @ link server call handler } s will call { @ code interceptors } before calling the pre - existing { @ code server call handler } the last interceptor will have its { @ link server interceptor # intercept call } called first

public static server service definition intercept ( server service definition service def , list < ? extends server interceptor > interceptors ) { preconditions check not null ( service def , " service def " ) ; if ( interceptors is empty ( ) ) { return service def ; } server service definition builder service def builder = server service definition builder ( service def get service descriptor ( ) ) ; for ( server method definition < ? , ? > method : service def get methods ( ) ) { wrap and add method ( service def builder , method , interceptors ) ; } return service def builder build ( ) ; }


convenience method , so that we don ' t open a new connection when using this method from within another method otherwise every api invocation incurs the overhead of openingclosing a tcp connection

private boolean exists ( f t p client client , path file ) throws i o exception { try { get file status ( client , file ) ; return true ; } catch ( file not found exception fnfe ) { return false ; } }


encode " - stl - " in contexts where the ' t ' is silent also encode " - uscle - " in contexts where the ' c ' is silent

boolean encode stl ( ) { / / ' hustle ' , ' bustle ' , ' whistle ' if ( ( string at ( m current , 4 , " stle " , " stli " , " " ) & & ! string at ( ( m current + 2 ) , 4 , " less " , " like " , " line " , " " ) ) | | string at ( ( m current - 3 ) , 7 , " thistly " , " bristly " , " gristly " , " " ) / / e g " corpuscle " | | string at ( ( m current - 1 ) , 5 , " uscle " , " " ) ) { / / kristen , krystle , crystle , kristle all pronounce the ' t ' / / also , exceptions where " - ling " is a nominalizing suffix if ( string at ( 0 , 7 , " kristen " , " krystle " , " crystle " , " kristle " , " " ) | | string at ( 0 , 11 , " christensen " , " christenson " , " " ) | | string at ( ( m current - 3 ) , 9 , " firstling " , " " ) | | string at ( ( m current - 2 ) , 8 , " nestling " , " westling " , " " ) ) { metaph add ( " st " ) ; m current + = 2 ; } else { if ( m encode vowels & & ( char at ( m current + 3 ) = = ' e ' ) & & ( char at ( m current + 4 ) ! = ' r ' ) & & ! string at ( ( m current + 3 ) , 4 , " ette " , " etta " , " " ) & & ! string at ( ( m current + 3 ) , 2 , " ey " , " " ) ) { metaph add ( " sal " ) ; flag al inversion = true ; } else { metaph add ( " sl " ) ; } m current + = 3 ; } return true ; } return false ; }


create an action listener that will collect results and finish the request once all results are in

private action listener < exporter resource status > result collector ( final exporter config exporter config , final action listener < monitoring migrate alerts response > listener , final atomic integer remaining , final list < exporter resource status > results ) { return new action listener < > ( ) { @ override public void on response ( exporter resource status exporter resource status ) { add status ( exporter resource status ) ; } @ override public void on failure ( exception e ) { / / need the exporter name and type here for reporting purposes maybe we need to make multiple of these listeners add status ( exporter resource status not ready ( exporter config name ( ) , exporter config type ( ) , e ) ) ; } private void add status ( exporter resource status exporter resource status ) { results add ( exporter resource status ) ; int tasks remaining = remaining decrement and get ( ) ; if ( tasks remaining = = 0 ) { final result ( ) ; } } private void final result ( ) { try { list < exporter migration result > collected results = results stream ( ) map ( status - > new exporter migration result ( status get exporter name ( ) , status get exporter type ( ) , status is complete ( ) , compile reason ( status ) ) ) collect ( collectors to list ( ) ) ; monitoring migrate alerts response response = new monitoring migrate alerts response ( collected results ) ; listener on response ( response ) ; } catch ( exception e ) { / / make this self contained , we don ' t want to bubble up exceptions in a way where this listener ' s / / on failure method could be called multiple times listener on failure ( e ) ; } } private exception compile reason ( exporter resource status status ) { / / the reason for unsuccessful setup could be multiple exceptions : one or more watches / / may fail to be removed for any reason list < exception > exceptions = status get exceptions ( ) ; if ( exceptions = = null | | exceptions size ( ) = = 0 ) { return null ; } else if ( exceptions size ( ) = = 1 ) { return exceptions get ( 0 ) ; } else { / / set first exception as the cause , and the rest as suppressed under it exception head = new elasticsearch exception ( " multiple errors occurred during migration " , exceptions get ( 0 ) ) ; list < exception > tail = exceptions sub list ( 1 , exceptions size ( ) ) ; return tail stream ( ) reduce ( head , exceptions helper : : use or suppress ) ; } } } ; }


handle cas authentication policy failure event

public void handle cas authentication transaction failure event ( final cas authentication transaction failure event event ) { if ( this cas event repository ! = null ) { val dto = prepare cas event ( event ) ; dto set principal id ( event get credential ( ) get id ( ) ) ; dto put event id ( cas authentication policy failure event class get simple name ( ) ) ; this cas event repository save ( dto ) ; } }


utility method for tests converts an array of strings into a set of labels

public static set < label > as label set ( iterable < string > strings ) throws label syntax exception { set < label > result = sets new tree set ( ) ; for ( string s : strings ) { result add ( label parse absolute ( s , immutable map of ( ) ) ) ; } return result ; }


randomly choose one node from scope if scope starts with ~ , choose one from the all nodes except for the ones in scope ; otherwise , choose one from scope if excluded nodes is given , choose a node that ' s not in excluded nodes

public node choose random ( final string scope , final collection < node > excluded nodes ) { netlock read lock ( ) lock ( ) ; try { if ( scope starts with ( " ~ " ) ) { return choose random ( node base root , scope substring ( 1 ) , excluded nodes ) ; } else { return choose random ( scope , null , excluded nodes ) ; } } finally { netlock read lock ( ) unlock ( ) ; } }


fully skips the specified size from the given input stream { @ link input stream # skip ( long ) } has two problems one is that it doesn ' t let us reliably differentiate " hit eof " case vs " inputstream just returning 0 since there ' s no data currently available at hand " , and some subtypes ( such as { @ link file input stream # skip ( long ) } returning - 1 so to reliably skip just the n bytes , we ' ll actually read all those bytes

public static input stream skip ( input stream in , long size ) throws i o exception { data input stream di = new data input stream ( in ) ; while ( size > 0 ) { int chunk = ( int ) math min ( skip buffer length , size ) ; di read fully ( skip buffer , 0 , chunk ) ; size - = chunk ; } return in ; }


< code > merge program context < code > merges all program context register values ( as indicated ) in the specified address set from the second program it merges them into the merge program

void merge program context ( address set view p 1 merge set , program merge filter filter , task monitor monitor ) throws cancelled exception { monitor set message ( " applying program context " ) ; if ( filter get filter ( program merge filter program context ) = = program merge filter ignore ) { return ; } program diff filter program context diff filter = new program diff filter ( program diff filter program context diffs ) ; address set diff addr set = p 1 merge set intersect ( program diff get differences ( program context diff filter , monitor ) ) ; address set diff addr set 2 = diff utility get compatible address set ( diff addr set , program 2 ) ; if ( diff addr set 2 is empty ( ) ) { return ; } merger merge program context ( diff addr set 2 , monitor ) ; }


returns whether a { @ link correlation id } is satisfied by at least one of a collection of { @ link cor def } s

private boolean has ( collection < cor def > cor defs , cor ref corr ) { for ( cor def cor def : cor defs ) { if ( cor def corr equals ( corr corr ) & & cor def field = = corr field ) { return true ; } } return false ; }


checks the number of dateline intersections detected for a component if there is only one , it clears it as it means that the component just touches the dateline

private static boolean clear component touching dateline ( edge [ ] edges , int component ) { edge intersection = null ; for ( int j = 0 ; j < edges length ; j + + ) { if ( edges [ j ] intersect ! = edge max coordinate & & edges [ j ] component = = component ) { if ( intersection = = null ) { intersection = edges [ j ] ; } else { return false ; } } } if ( intersection ! = null ) { intersection intersect = edge max coordinate ; } return intersection ! = null ; }