sorts x , y pairs of values by the x value , then the y value

private void sort ( float [ ] values , int count ) { int lower = 0 ; int upper = count - 1 ; int array stack = quicksort stack ; stack add ( lower ) ; stack add ( upper - 1 ) ; while ( stack size > 0 ) { upper = stack pop ( ) ; lower = stack pop ( ) ; if ( upper < = lower ) continue ; int i = quicksort partition ( values , lower , upper ) ; if ( i - lower > upper - i ) { stack add ( lower ) ; stack add ( i - 2 ) ; } stack add ( i + 2 ) ; stack add ( upper ) ; if ( upper - i > = i - lower ) { stack add ( lower ) ; stack add ( i - 2 ) ; } } }


return the exception that was the first to be thrown within the failed transaction : i e the application exception , if any , or the transaction system exception ' s own cause

public throwable get original exception ( ) { return ( this application exception ! = null ? this application exception : get cause ( ) ) ; }


public int get command size ( ) { return cmdsize ; }


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


extracts the nameindex of the replacement field that starts at the specified location

private string get field name ( char [ ] chars , int opening brace ) throws eval exception { string builder result = new string builder ( ) ; boolean found closing brace = false ; for ( int pos = opening brace + 1 ; pos < chars length ; + + pos ) { char current = chars [ pos ] ; if ( current = = ' } ' ) { found closing brace = true ; break ; } else { if ( current = = ' { ' ) { throw starlark errorf ( " nested replacement fields are not supported " ) ; } else if ( illegal in field contains ( current ) ) { throw starlark errorf ( " invalid character ' % s ' inside replacement field " , current ) ; } result append ( current ) ; } } if ( ! found closing brace ) { throw starlark errorf ( " found ' { ' without matching ' } ' " ) ; } return result to string ( ) ; }


convert the given object to serialized form , possibly using a { @ link org springframework messaging converter message converter } , wrap it as a message with the given headers , apply the given post processor , and send the resulting message to the given destination

void convert and send ( d destination , object payload , @ nullable map < string , object > headers , @ nullable message post processor post processor ) throws messaging exception ;


convert the given { @ linkplain router function router function } into a { @ link web handler } , using the given strategies

public static web handler to web handler ( router function < ? > router function , handler strategies strategies ) { assert not null ( router function , " router function must not be null " ) ; assert not null ( strategies , " handler strategies must not be null " ) ; return new router function web handler ( strategies , router function ) ; }


wraps a { @ code runnable } for submission to the underlying executor the default implementation delegates to { @ link # wrap task ( callable ) }

protected runnable wrap task ( runnable command ) { final callable < object > wrapped = wrap task ( executors callable ( command , null ) ) ; return new runnable ( ) { @ override public void run ( ) { try { wrapped call ( ) ; } catch ( exception e ) { throw if unchecked ( e ) ; throw new runtime exception ( e ) ; } } } ; }


protected boolean is access token request ( final http servlet request request , final http servlet response response ) { val request path = request get request u r i ( ) ; val pattern = string format ( " ( % s | % s ) " , o auth 2 0 constants access token url , o auth 2 0 constants token url ) ; return does uri match pattern ( request path , pattern ) ; }


returns the { @ code int } value present at the given index

public int get ( int index ) { preconditions check element index ( index , length ( ) ) ; return array [ start + index ] ; }


loads a cache directory if the root directory is passed , also loads any subdirectories

private void load directory ( file directory , boolean is root , @ nullable file [ ] files , @ nullable map < string , cache file metadata > file metadata ) { if ( files = = null | | files length = = 0 ) { / / either ( a ) directory isn ' t really a directory ( b ) it ' s empty , or ( c ) listing files failed if ( ! is root ) { / / for ( a ) and ( b ) deletion is the desired result for ( c ) it will be a no - op if the / / directory is non - empty , so there ' s no harm in trying directory delete ( ) ; } return ; } for ( file file : files ) { string file name = file get name ( ) ; if ( is root & & file name index of ( ' ' ) = = - 1 ) { load directory ( file , / * is root = * / false , file list files ( ) , file metadata ) ; } else { if ( is root & & ( cached content index is index file ( file name ) | | file name ends with ( uid file suffix ) ) ) { / / skip expected uid and index files in the root directory continue ; } long length = c length unset ; long last touch timestamp = c time unset ; @ nullable cache file metadata metadata = file metadata ! = null ? file metadata remove ( file name ) : null ; if ( metadata ! = null ) { length = metadata length ; last touch timestamp = metadata last touch timestamp ; } @ nullable simple cache span span = simple cache span create cache entry ( file , length , last touch timestamp , content index ) ; if ( span ! = null ) { add span ( span ) ; } else { file delete ( ) ; } } } }


returns a new address inside the specified program as indicated by the string

public final address to addr ( string address string ) { return address evaluator evaluate ( current program , address string ) ; }


visit a provider instance binding the provider ' s { @ code get } method is invoked to resolve injections this target is found in both module and injector bindings

v visit ( provider instance binding < ? extends t > binding ) ;


long bit size ( ) { return ( long ) data length ( ) * long size ; }


public static j button create button ( string text ) { return new j button ( text ) ; }


public object get actual instance ( ) { return instance ; }


return the integer value of this status series ranges from 1 to 5

public int value ( ) { return this value ; }


return the first error codes for the field or object , if any

public string get error code ( ) { return ( ! object utils is empty ( this error codes ) ? this error codes [ 0 ] : " " ) ; }


share common attributes across both base and starlark base rules

public static rule class builder common core and starlark attributes ( rule class builder builder ) { return builder / / the visibility attribute is special : it is a nodep label , and loading the / / necessary package groups is handled by { @ link label visitor # visit target visibility } / / package groups always have the null configuration so that they are not duplicated / / needlessly add ( attr ( " visibility " , nodep label list ) order independent ( ) cfg ( host transition create factory ( ) ) nonconfigurable ( " special attribute integrated more deeply into bazel ' s core logic " ) ) add ( attr ( tagged trimming attr , nodep label list ) order independent ( ) nonconfigurable ( " used in determining configuration " ) ) add ( attr ( " deprecation " , string ) value ( deprecation default ) nonconfigurable ( " used in core loading phase logic with no access to configs " ) ) add ( attr ( " tags " , string list ) order independent ( ) taggable ( ) nonconfigurable ( " low - level attribute , used in target utils without configurations " ) ) add ( attr ( " generator name " , string ) undocumented ( " internal " ) nonconfigurable ( " static structure of a rule " ) ) add ( attr ( " generator function " , string ) undocumented ( " internal " ) nonconfigurable ( " static structure of a rule " ) ) add ( attr ( " generator location " , string ) undocumented ( " internal " ) nonconfigurable ( " static structure of a rule " ) ) add ( attr ( " testonly " , boolean ) value ( testonly default ) nonconfigurable ( " policy decision : rules testability should be consistent " ) ) add ( attr ( " features " , string list ) order independent ( ) ) add ( attr ( " : action listener " , label list ) cfg ( host transition create factory ( ) ) value ( action listener ) ) add ( attr ( rule class compatible environment attr , label list ) allowed rule classes ( constraint constants environment rule ) cfg ( host transition create factory ( ) ) allowed file types ( file type set no file ) dont check constraints ( ) nonconfigurable ( " special logic for constraints and select : see constraint semantics " ) ) add ( attr ( rule class restricted environment attr , label list ) allowed rule classes ( constraint constants environment rule ) cfg ( host transition create factory ( ) ) allowed file types ( file type set no file ) dont check constraints ( ) nonconfigurable ( " special logic for constraints and select : see constraint semantics " ) ) add ( attr ( rule class config setting deps attribute , label list ) nonconfigurable ( " stores configurability keys " ) ) add ( attr ( rule class applicable licenses attr , label list ) cfg ( host transition create factory ( ) ) allowed file types ( file type set no file ) / / todo ( b / 148601291 ) : require provider to be " license info " dont check constraints ( ) nonconfigurable ( " applicable licenses is not configurable " ) ) ; }


previously , it was possible to create partitioned state with < code > null < code > namespace this test makes sure that this is prohibited now

public void test require non null namespace ( ) throws exception { final abstract keyed state backend < integer > backend = create keyed backend ( int serializer instance ) ; value state descriptor < int value > kv id = new value state descriptor < > ( " id " , int value class , new int value ( - 1 ) ) ; try { backend get partitioned state ( null , void namespace serializer instance , kv id ) ; fail ( " did not throw expected null pointer exception " ) ; } catch ( null pointer exception ignored ) { } try { backend get partitioned state ( void namespace instance , null , kv id ) ; fail ( " did not throw expected null pointer exception " ) ; } catch ( null pointer exception ignored ) { } try { backend get partitioned state ( null , null , kv id ) ; fail ( " did not throw expected null pointer exception " ) ; } catch ( null pointer exception ignored ) { } backend dispose ( ) ; }


returns true if the defined recovery mode supports high availability

public static boolean is high availability mode activated ( configuration configuration ) { high availability mode mode = from config ( configuration ) ; return mode ha active ; }


constructs a key for loading the prelude bzl

static key key for build prelude ( root root , label label ) { return key create ( root , label , kind prelude ) ; }


merges the two runs at stack indices i and i + 1 run i must be the penultimate or antepenultimate run on the stack in other words , i must be equal to stack size - 2 or stack size - 3

private void merge at ( int i ) { if ( debug ) assert stack size > = 2 ; if ( debug ) assert i > = 0 ; if ( debug ) assert i = = stack size - 2 | | i = = stack size - 3 ; int base 1 = run base [ i ] ; int len 1 = run len [ i ] ; int base 2 = run base [ i + 1 ] ; int len 2 = run len [ i + 1 ] ; if ( debug ) assert len 1 > 0 & & len 2 > 0 ; if ( debug ) assert base 1 + len 1 = = base 2 ; / * * record the length of the combined runs ; if i is the 3rd - last run now , also slide over the last run ( which isn ' t involved * in this merge ) the current run ( i + 1 ) goes away in any case * / run len [ i ] = len 1 + len 2 ; if ( i = = stack size - 3 ) { run base [ i + 1 ] = run base [ i + 2 ] ; run len [ i + 1 ] = run len [ i + 2 ] ; } stack size - - ; / * * find where the first element of run 2 goes in run 1 prior elements in run 1 can be ignored ( because they ' re already in * place ) * / int k = gallop right ( ( comparable < object > ) a [ base 2 ] , a , base 1 , len 1 , 0 ) ; if ( debug ) assert k > = 0 ; base 1 + = k ; len 1 - = k ; if ( len 1 = = 0 ) return ; / * * find where the last element of run 1 goes in run 2 subsequent elements in run 2 can be ignored ( because they ' re already in * place ) * / len 2 = gallop left ( ( comparable < object > ) a [ base 1 + len 1 - 1 ] , a , base 2 , len 2 , len 2 - 1 ) ; if ( debug ) assert len 2 > = 0 ; if ( len 2 = = 0 ) return ; / / merge remaining runs , using tmp array with min ( len 1 , len 2 ) elements if ( len 1 < = len 2 ) merge lo ( base 1 , len 1 , base 2 , len 2 ) ; else merge hi ( base 1 , len 1 , base 2 , len 2 ) ; }


returns a " java hash code " for this { @ code hash code } instance ; this is well - defined ( so , for example , you can safely put { @ code hash code } instances into a { @ code hash set } ) but is otherwise probably not what you want to use

public final int hash code ( ) { / / if we have at least 4 bytes ( 32 bits ) , just take the first 4 bytes since this is / / already a ( presumably ) high - quality hash code , any four bytes of it will do if ( bits ( ) > = 32 ) { return as int ( ) ; } / / if we have less than 4 bytes , use them all byte [ ] bytes = get bytes internal ( ) ; int val = ( bytes [ 0 ] & 0x f f ) ; for ( int i = 1 ; i < bytes length ; i + + ) { val | = ( ( bytes [ i ] & 0x f f ) < < ( i * 8 ) ) ; } return val ; }


adjust thunk ' this ' auto - param if function has non - default source and does not reside within the global namespace

private parameter [ ] adjust thunk this parameter ( parameter [ ] parameters ) { symbol s = get symbol ( ) ; if ( s get parent namespace ( ) get i d ( ) = = namespace global namespace id ) { return parameters ; } for ( int i = 0 ; i < parameters length ; i + + ) { if ( parameters [ i ] instanceof auto parameter impl ) { parameters [ i ] = adjust thunk this parameter ( parameters [ i ] ) ; } } return parameters ; }


sets the distance from the center using the default distance unit

public geo distance query builder distance ( string distance ) { return distance ( distance , distance unit default ) ; }


returns the defined data whose min address equals the specified address

public data get defined data at ( address address ) { return get defined data at ( addr map get key ( address , false ) ) ; }


converts the given number of the current units into kibibytes

public long to kibibytes ( long l ) { return kibibytes convert ( l , this ) ; }


synchronized void refresh metadata ( token metadata metadata ) { bytes key current used key hash = new bytes key ( metadata get current key hash ( ) ) ; byte [ ] salt arr = new byte [ salt bytes ] ; map < bytes key , key and cache > map = new hash map < > ( metadata get keys ( ) size ( ) ) ; long max timestamp = created time stamps get ( ) ; for ( key and timestamp key : metadata get keys ( ) ) { secure random next bytes ( salt arr ) ; key and cache key and cache = new key and cache ( key , new bytes key ( salt arr ) ) ; max timestamp = math max ( key and cache key and timestamp get timestamp ( ) , max timestamp ) ; if ( key cache cache contains key ( key and cache get key hash ( ) ) = = false ) { map put ( key and cache get key hash ( ) , key and cache ) ; } else { map put ( key and cache get key hash ( ) , key cache get ( key and cache get key hash ( ) ) ) ; / / maintain the cache we already have } } if ( map contains key ( current used key hash ) = = false ) { / / this won ' t leak any secrets it ' s only exposing the current set of hashes throw new illegal state exception ( " current key is not in the map : " + map key set ( ) + " key : " + current used key hash ) ; } created time stamps set ( max timestamp ) ; key cache = new token keys ( collections unmodifiable map ( map ) , current used key hash ) ; logger debug ( ( ) - > new parameterized message ( " refreshed keys current : { } , keys : { } " , current used key hash , key cache cache key set ( ) ) ) ; }


sets the scale type for the actual image if not set , the default value center crop will be used

public generic drawee hierarchy builder set actual image scale type ( @ nullable scaling utils scale type actual image scale type ) { m actual image scale type = actual image scale type ; m actual image matrix = null ; return this ; }


returns a set of all key - value pairs changes to the returned set will update the underlying multimap , and vice versa the entries set does not support the { @ code add } or { @ code add all } operations the iterator generated by the returned set traverses the entries in the order they were added to the multimap each entry is an immutable snapshot of a key - value mapping in the multimap , taken at the time the entry is returned by a method call to the collection or its iterator

public set < entry < k , v > > entries ( ) { return super entries ( ) ; }


this gets the handler type structure for this model

public data type get data type ( ) { if ( data type = = null ) { data type = get data type ( get program ( ) ) ; } return data type ; }


returns the number of acquired channels that this pool thinks it has

public int acquired channel count ( ) { return acquired channel count get ( ) ; }


discuss waiting strategy between calls sleeping seems to be very inaccurate ( see below ) on the other hand calling system nano time ( ) a lot ( especially from different threads seems to impact its accuracy http : shipilev netblog 2 0 1 4nanotrusting - nanotime on my system the overhead of lock support park ( long ) seems to average at ~ 55 micros try to sleep for 1 nanosecond and measure how long it actually takes long start = system nano time ( ) ; int i = 0 ; while ( i < 10000 ) { lock support park nanos ( 1 ) ; i + + ; } long end = system nano time ( ) ; system out println ( ( end - start ) 10000 ) ;

public histogram call ( ) throws exception { long now = system nano time ( ) ; long next rpc = now ; long i = 0 ; while ( i < num rpcs ) { now = system nano time ( ) ; if ( next rpc - now < = 0 ) { / / todo : add option to print how far we have been off from the target delay in micros next rpc + = next delay ( target qps ) ; new rpc ( stub ) ; i + + ; } } wait for rpcs to complete ( 1 ) ; return histogram ; }


get the { @ link counter } for the given < code > group name < code > and < code > counter name < code >

public counter get counter ( string group name , string counter name ) ;


public boolean is active ( ) { return jni is active ( addr ) ; }


get the path variable with the given name , if present

default string path variable ( string name ) { map < string , string > path variables = path variables ( ) ; if ( path variables contains key ( name ) ) { return path variables ( ) get ( name ) ; } else { throw new illegal argument exception ( " no path variable with name \ " " + name + " \ " available " ) ; } }


returns < tt > true < tt > iff the given { @ link collection } s contain exactly the same elements with exactly the same cardinalities that is , iff the cardinality of e in a is equal to the cardinality of e in b , for each element e in a or b

public static boolean is equal collection ( final collection a , final collection b ) { if ( a size ( ) ! = b size ( ) ) { return false ; } else { map mapa = get cardinality map ( a ) ; map mapb = get cardinality map ( b ) ; if ( mapa size ( ) ! = mapb size ( ) ) { return false ; } else { iterator it = mapa key set ( ) iterator ( ) ; while ( it has next ( ) ) { object obj = it next ( ) ; if ( get freq ( obj , mapa ) ! = get freq ( obj , mapb ) ) { return false ; } } return true ; } } }


attempting to use h d r percentile aggregation on a string field throws illegal argument exception

public void test string field ( ) throws i o exception { final string field name = " string " ; mapped field type field type = new keyword field mapper keyword field type ( field name ) ; expect throws ( illegal argument exception class , ( ) - > test case ( new doc values field exists query ( field name ) , iw - > { iw add document ( singleton ( new sorted set doc values field ( " string " , new bytes ref ( " bogus " ) ) ) ) ; iw add document ( singleton ( new sorted set doc values field ( " string " , new bytes ref ( " zwomp " ) ) ) ) ; iw add document ( singleton ( new sorted set doc values field ( " string " , new bytes ref ( " foobar " ) ) ) ) ; } , hdr - > { } , field type , field name ) ) ; }


determine whether this { @ code http method } matches the given method value

public boolean matches ( string method ) { return ( this = = resolve ( method ) ) ; }


public string get clipboard text ( ) throws exception { clipboard c = g clipboard get system clipboard ( ) ; transferable t = c get contents ( null ) ; try { string text = ( string ) t get transfer data ( data flavor string flavor ) ; return text ; } catch ( unsupported flavor exception e ) { msg error ( this , " unsupported data flavor - ' string ' supported flavors : " ) ; data flavor [ ] flavors = t get transfer data flavors ( ) ; for ( data flavor data flavor : flavors ) { msg error ( this , " \ t " + data flavor get human presentable name ( ) ) ; } throw e ; } }


runs external binary in the specified working directory see { @ link builder runner }

public process result run binary ( path working directory , string process to run , boolean expect empty error , string arguments ) throws exception { process parameters parameters = process parameters builder ( ) set working directory ( working directory to file ( ) ) set name ( process to run ) set timeout millis ( get process timeout millis ( - 1 ) ) set arguments ( arguments ) set expected empty error ( expect empty error ) build ( ) ; return new process runner ( parameters , executor service ) run synchronously ( ) ; }


public long get $ special property name ( ) { return $ special property name ; }


returns true if the given target cpu is an apple platform

public static boolean is apple platform ( string target cpu ) { return for target cpu nullable ( target cpu ) ! = null ; }


gets all features contained within the given bounding { @ link rectangle }

public void list features ( rectangle request , stream observer < feature > response observer ) { int left = min ( request get lo ( ) get longitude ( ) , request get hi ( ) get longitude ( ) ) ; int right = max ( request get lo ( ) get longitude ( ) , request get hi ( ) get longitude ( ) ) ; int top = max ( request get lo ( ) get latitude ( ) , request get hi ( ) get latitude ( ) ) ; int bottom = min ( request get lo ( ) get latitude ( ) , request get hi ( ) get latitude ( ) ) ; for ( feature feature : features ) { if ( ! route guide util exists ( feature ) ) { continue ; } int lat = feature get location ( ) get latitude ( ) ; int lon = feature get location ( ) get longitude ( ) ; if ( lon > = left & & lon < = right & & lat > = bottom & & lat < = top ) { response observer on next ( feature ) ; } } response observer on completed ( ) ; }


determine whether the specified bean definition qualifies as an autowire candidate , to be injected into other beans which declare a dependency of matching type

protected boolean is autowire candidate ( string bean name , dependency descriptor descriptor , autowire candidate resolver resolver ) throws no such bean definition exception { string bd name = bean factory utils transformed bean name ( bean name ) ; if ( contains bean definition ( bd name ) ) { return is autowire candidate ( bean name , get merged local bean definition ( bd name ) , descriptor , resolver ) ; } else if ( contains singleton ( bean name ) ) { return is autowire candidate ( bean name , new root bean definition ( get type ( bean name ) ) , descriptor , resolver ) ; } bean factory parent = get parent bean factory ( ) ; if ( parent instanceof default listable bean factory ) { / / no bean definition found in this factory - > delegate to parent return ( ( default listable bean factory ) parent ) is autowire candidate ( bean name , descriptor , resolver ) ; } else if ( parent instanceof configurable listable bean factory ) { / / if no default listable bean factory , can ' t pass the resolver along return ( ( configurable listable bean factory ) parent ) is autowire candidate ( bean name , descriptor ) ; } else { return true ; } }


puts an utf8 string into this byte vector the byte vector is automatically enlarged if necessary the string length is encoded in two bytes before the encoded characters , if there is space for that ( i e if this length - offset - 2 & gt ; = 0 )

final byte vector encode utf 8 ( final string string value , final int offset , final int max byte length ) { int char length = string value length ( ) ; int byte length = offset ; for ( int i = offset ; i < char length ; + + i ) { char char value = string value char at ( i ) ; if ( char value > = 0x 0 0 0 1 & & char value < = 0x 0 0 7 f ) { byte length + + ; } else if ( char value < = 0x 0 7 f f ) { byte length + = 2 ; } else { byte length + = 3 ; } } if ( byte length > max byte length ) { throw new illegal argument exception ( " utf8 string too large " ) ; } / / compute where ' byte length ' must be stored in ' data ' , and store it at this location int byte length offset = length - offset - 2 ; if ( byte length offset > = 0 ) { data [ byte length offset ] = ( byte ) ( byte length > > > 8 ) ; data [ byte length offset + 1 ] = ( byte ) byte length ; } if ( length + byte length - offset > data length ) { enlarge ( byte length - offset ) ; } int current length = length ; for ( int i = offset ; i < char length ; + + i ) { char char value = string value char at ( i ) ; if ( char value > = 0x 0 0 0 1 & & char value < = 0x 0 0 7 f ) { data [ current length + + ] = ( byte ) char value ; } else if ( char value < = 0x 0 7 f f ) { data [ current length + + ] = ( byte ) ( 0x c 0 | char value > > 6 & 0x 1 f ) ; data [ current length + + ] = ( byte ) ( 0x 8 0 | char value & 0x 3 f ) ; } else { data [ current length + + ] = ( byte ) ( 0x e 0 | char value > > 12 & 0x f ) ; data [ current length + + ] = ( byte ) ( 0x 8 0 | char value > > 6 & 0x 3 f ) ; data [ current length + + ] = ( byte ) ( 0x 8 0 | char value & 0x 3 f ) ; } } length = current length ; return this ; }


write the given long value as a 4 byte unsigned integer overflow is ignored

public static void write unsigned int ( byte buffer buffer , long value ) { buffer put int ( ( int ) ( value & 0xffffffff l ) ) ; }


this lets rollover highlighting happen when over the tab container

private void forward mouse motion event ( mouse event e ) { e consume ( ) ; mouse event new event = swing utilities convert mouse event ( e get component ( ) , e , tabbed pane ) ; tabbed pane dispatch event ( new event ) ; }


test the property ' array and items nullable prop '

public void array and items nullable prop test ( ) { / / todo : test array and items nullable prop }


throws an { @ code illegal argument exception } if { @ code condition } is false

public static void check argument ( boolean condition ) { check argument ( condition , null , null ) ; }


gets whether the method being translated is static

private boolean is static ( ) { int access flags = method get access flags ( ) ; return ( access flags & access flags acc static ) ! = 0 ; }


creates an answer from a functional interface - allows for a strongly typed answer to be created idiomatically in java 8

public static < t , a , b , c , d , e , f > answer < t > answer ( answer 6 < t , a , b , c , d , e , f > answer ) { return to answer ( answer ) ; }


returns the offset of the first byte within the backing byte array of this buffer


{ @ inherit doc } because a { @ code set multimap } has unique values for a given key , this method returns a { @ link set } , instead of the { @ link collection } specified in the { @ link multimap } interface

public set < v > get ( @ nullable decl k key ) { return ( set < v > ) super get ( key ) ; }


public synchronized void start ( ) throws exception { if ( simple kdc ! = null ) { throw new runtime exception ( " already started " ) ; } simple kdc = new simple kdc server ( ) ; prepare kdc server ( ) ; simple kdc init ( ) ; reset default realm ( ) ; simple kdc start ( ) ; log info ( " mini kdc started " ) ; }


given a set of top - level targets and a configuration collection , evaluate top level transitions , resolve configurations and return the appropriate < target , configuration > pair for each target preserves the original input ordering

public static top level targets and configs result get targets with configs ( build configuration collection configurations , collection < target > targets , extended event handler event handler , configured rule class provider rule class provider , configurations collector configurations collector ) throws invalid configuration exception , interrupted exception { / / we use a hash set here to remove duplicate nodes ; this can happen for input files and package / / groups linked hash set < target and configuration > nodes = new linked hash set < > ( targets size ( ) ) ; for ( build configuration config : configurations get target configurations ( ) ) { for ( target target : targets ) { nodes add ( new target and configuration ( target , config ) ) ; } } / / we ' ll get the configs from configurations collector # get configurations , which gets / / configurations for deps including transitions multimap < build configuration , dependency key > as deps = targets to deps ( nodes , rule class provider ) ; return configuration resolver get configurations from executor ( nodes , as deps , event handler , configurations collector ) ; }


public void trim payload ( ) { if ( packet array get data ( ) length = = ogg page header max page payload ) { return ; } packet array reset ( arrays copy of ( packet array get data ( ) , max ( ogg page header max page payload , packet array limit ( ) ) ) , / * limit = * / packet array limit ( ) ) ; }


returns whether the instruction at the given offset is popping a simple enum class

private boolean is popping simple enum ( int offset , int stack entry index ) { reference value reference value = partial evaluator get stack before ( offset ) get top ( stack entry index ) reference value ( ) ; return is simple enum ( reference value get referenced class ( ) ) & & ! class util is internal array type ( reference value get type ( ) ) ; }


public void test keyed process function side output ( ) throws exception { final output tag < string > side output tag = new output tag < string > ( " side " ) { } ; test list result sink < string > side output result sink = new test list result sink < > ( ) ; test list result sink < integer > result sink = new test list result sink < > ( ) ; stream execution environment see = stream execution environment get execution environment ( ) ; see set parallelism ( 3 ) ; data stream < integer > data stream = see from collection ( elements ) ; single output stream operator < integer > pass throught stream = data stream key by ( new key selector < integer , integer > ( ) { private static final long serial version u i d = 1l ; @ override public integer get key ( integer value ) throws exception { return value ; } } ) process ( new process function < integer , integer > ( ) { private static final long serial version u i d = 1l ; @ override public void process element ( integer value , context ctx , collector < integer > out ) throws exception { out collect ( value ) ; ctx output ( side output tag , " sideout - " + string value of ( value ) ) ; } } ) ; pass throught stream get side output ( side output tag ) add sink ( side output result sink ) ; pass throught stream add sink ( result sink ) ; see execute ( ) ; assert equals ( arrays as list ( " sideout - 1 " , " sideout - 2 " , " sideout - 3 " , " sideout - 4 " , " sideout - 5 " ) , side output result sink get sorted result ( ) ) ; assert equals ( arrays as list ( 1 , 2 , 3 , 4 , 5 ) , result sink get sorted result ( ) ) ; }


public string get remote host ( ) { return remote address = = null ? null : remote address get address ( ) = = null ? remote address get host name ( ) : net utils filter local host ( remote address get address ( ) get host address ( ) ) ; }


take the next { @ link runnable } from the task queue and so will block if no task is currently present

runnable take task ( ) { blocking queue < runnable > task queue = this task queue ; for ( ; ; ) { scheduled future task < ? > scheduled task = peek scheduled task ( ) ; if ( scheduled task = = null ) { runnable task = null ; try { task = task queue take ( ) ; } catch ( interrupted exception e ) { / / ignore } return task ; } else { long delay nanos = scheduled task delay nanos ( ) ; runnable task = null ; if ( delay nanos > 0 ) { try { task = task queue poll ( delay nanos , time unit nanoseconds ) ; } catch ( interrupted exception e ) { / / waken up return null ; } } if ( task = = null ) { / / we need to fetch the scheduled tasks now as otherwise there may be a chance that / / scheduled tasks are never executed if there is always one task in the task queue / / this is for example true for the read task of oio transport / / see https : / / github com / netty / netty / issues / 1614 fetch from scheduled task queue ( ) ; task = task queue poll ( ) ; } if ( task ! = null ) { return task ; } } } }


public static void put value data ( memory segment memory segment , int offset , byte [ ] value ) { memory segment value segment = memory segment factory wrap ( value ) ; value segment copy to ( 0 , memory segment , offset + get value meta len ( ) , value length ) ; }


retrieve the id of the activity that is currently running

public string get current id ( ) { return m resumed ! = null ? m resumed id : null ; }


decorrelates a subquery this is the main entry point to { @ code sub query decorrelator }

public static result decorrelate query ( rel node root rel ) { int max cnf node count = flink rel opt util get max cnf node count ( root rel ) ; final corel map builder builder = new corel map builder ( max cnf node count ) ; final corel map corel map = builder build ( root rel ) ; if ( builder has nested cor scope | | builder has unsupported cor condition ) { return null ; } if ( ! corel map has correlation ( ) ) { return result empty ; } rel opt cluster cluster = root rel get cluster ( ) ; rel builder rel builder = new flink rel builder ( cluster get planner ( ) get context ( ) , cluster , null ) ; rex builder rex builder = cluster get rex builder ( ) ; final sub query decorrelator decorrelator = new sub query decorrelator ( new sub query rel decorrelator ( corel map , rel builder , rex builder , max cnf node count ) , rel builder ) ; root rel accept ( decorrelator ) ; return new result ( decorrelator sub query map ) ; }


an inlined private copy of { @ link uninterruptibles # get uninterruptibly } used to break an internal dependency on other utilconcurrent classes

private static < v > v get uninterruptibly ( future < v > future ) throws execution exception { boolean interrupted = false ; try { while ( true ) { try { return future get ( ) ; } catch ( interrupted exception e ) { interrupted = true ; } } } finally { if ( interrupted ) { thread current thread ( ) interrupt ( ) ; } } }


returns the probability that { @ linkplain # might contain ( object ) } will erroneously return { @ code true } for an object that has not actually been put in the { @ code bloom filter } ideally , this number should be close to the { @ code fpp } parameter passed in { @ linkplain # create ( funnel , int , double ) } , or smaller if it is significantly higher , it is usually the case that too many elements ( more than expected ) have been put in the { @ code bloom filter } , degenerating it

public double expected fpp ( ) { return math pow ( ( double ) bits bit count ( ) / bit size ( ) , num hash functions ) ; }


find a { @ code content negotiation strategy } of the given type

public < t extends content negotiation strategy > t get strategy ( class < t > strategy type ) { for ( content negotiation strategy strategy : get strategies ( ) ) { if ( strategy type is instance ( strategy ) ) { return ( t ) strategy ; } } return null ; }


returns the appropriate { @ code invoke - super } rop for the given type the result is typically a newly - allocated instance

public static rop op invoke super ( prototype meth ) { return new rop ( reg ops invoke super , meth get parameter frame types ( ) , std type list throwable ) ; }


exit a parse tree produced by the { @ code show tables } labeled alternative in { @ link sql base parser # statement }

void exit show tables ( sql base parser show tables context ctx ) ;


gets the next temp file and stream to temp file this creates the temp file atomically , making sure no previous file is overwritten this method is safe against concurrent use

public ref counted file with stream apply ( file file ) throws i o exception { final file directory = temp directories [ next index ( ) ] ; while ( true ) { try { if ( file = = null ) { final file new file = new file ( directory , " tmp " + uuid random u u i d ( ) ) ; final output stream out = files new output stream ( new file to path ( ) , standard open option create new ) ; return ref counted file with stream new file ( new file , out ) ; } else { final output stream out = files new output stream ( file to path ( ) , standard open option append ) ; return ref counted file with stream restored file ( file , out , file length ( ) ) ; } } catch ( file already exists exception ignored ) { / / fall through the loop and retry } } }


rejects the update for the given resource type and sends an nack request ( request with last accepted version ) to the management server

protected final void nack response ( resource type type , string nonce , string error detail ) { string version info = get current version ( type ) ; logger log ( xds log level info , " sending nack for { 0 } update , nonce : { 1 } , current version : { 2 } " , type , nonce , version info ) ; collection < string > resources = get subscribed resources ( type ) ; if ( resources = = null ) { resources = collections empty list ( ) ; } ads stream send discovery request ( type , version info , resources , nonce , error detail ) ; }


public map < string , list < integer > > get map array integer ( ) { return map array integer ; }


tests the resettable iterator with enough memory so that all data is kept locally in memory

public void test resettable iterator in memory ( ) { try { final abstract invokable mem owner = new dummy invokable ( ) ; / / create the resettable iterator spilling resettable mutable object iterator < record > iterator = new spilling resettable mutable object iterator < record > ( this reader , this serializer , this memman , this ioman , 20 , mem owner ) ; / / open the iterator iterator open ( ) ; / / now test walking through the iterator int count = 0 ; record target = new record ( ) ; while ( ( target = iterator next ( target ) ) ! = null ) { assert assert equals ( " in initial run , element " + count + " does not match expected value ! " , count + + , target get field ( 0 , int value class ) get value ( ) ) ; } assert assert equals ( " too few elements were deserialzied in initial run ! " , num testrecords , count ) ; / / test resetting the iterator a few times for ( int j = 0 ; j < 10 ; + + j ) { count = 0 ; iterator reset ( ) ; target = new record ( ) ; / / now we should get the same results while ( ( target = iterator next ( target ) ) ! = null ) { assert assert equals ( " after reset nr " + j + 1 + " element " + count + " does not match expected value ! " , count + + , target get field ( 0 , int value class ) get value ( ) ) ; } assert assert equals ( " too few elements were deserialzied after reset nr " + j + 1 + " ! " , num testrecords , count ) ; } / / close the iterator iterator close ( ) ; } catch ( exception ex ) { ex print stack trace ( ) ; assert fail ( " test encountered an exception " ) ; } }


configure the filter by checking the configuration

public void set conf ( configuration conf ) { pf set conf ( conf ) ; }


public void code test ( ) { / / todo : test code }


determines where the output of this { @ link task thread } goes subclass can override this to send the output to a file , for example

protected listener and text create listener ( ) throws i o exception { return listener and text for memory ( ) ; }


get the view ' s name should never be { @ code null } if the view was correctly configured

public string get bean name ( ) { return this bean name ; }


get the possible locations of a path in the federated cluster during the get operation , it will do the quota verification

protected list < remote location > get locations for path ( string path , boolean fail if locked ) throws i o exception { return get locations for path ( path , fail if locked , true ) ; }


return the configured { @ link jms template }

public jms template get jms template ( ) { return this jms template ; }


check if an address that is a possible reference falls within a defined function , pointing at a symbol

boolean check offcut func ref ( program program , address addr ) { instruction instr = program get listing ( ) get instruction containing ( addr ) ; / / no instruction , not offcut if ( instr = = null ) { return false ; } / / in the middle of an instruction , offcut if ( ! instr get min address ( ) equals ( addr ) ) { return true ; } / / in the middle of a function body , offcut function func = program get function manager ( ) get function containing ( addr ) ; if ( func ! = null ) { if ( ! func get entry point ( ) equals ( addr ) ) { return true ; } } return false ; }


public void skip bits ( int num bits ) { int num bytes = num bits / 8 ; byte offset + = num bytes ; bit offset + = num bits - ( num bytes * 8 ) ; if ( bit offset > 7 ) { byte offset + + ; bit offset - = 8 ; } assert valid offset ( ) ; }


public void pet id test ( ) { / / todo : test pet id }


get the number of samples for the given field = = doc count - num missing

public long get field count ( string field ) { if ( results = = null ) { return 0 ; } return results get field count ( field ) ; }


inspect the middle of the byte stream accumulated so far

public int get byte ( int streampos ) { return out [ streampos ] ; }


returns whether it may be possible to adapt to playing a different format when the codec is configured to play media in the specified { @ code format } for adaptation to succeed , the codec must also be configured with appropriate maximum values and { @ link # is seamless adaptation supported ( format , format , boolean ) } must return { @ code true } for the oldnew formats

public boolean is seamless adaptation supported ( format format ) { if ( is video ) { return adaptive ; } else { pair < integer , integer > codec profile level = media codec util get codec profile and level ( format ) ; return codec profile level ! = null & & codec profile level first = = codec profile level a a c object x h e ; } }


set the current listener for the { @ link g l profiler } to { @ code error listener }

public void set listener ( g l error listener error listener ) { this listener = error listener ; }


parses a list versions response xml document from an input stream

public list versions handler parse list versions response ( input stream input stream , final boolean should s d k decode response ) throws i o exception { list versions handler handler = new list versions handler ( should s d k decode response ) ; parse xml input stream ( handler , sanitize xml document ( handler , input stream ) ) ; return handler ; }


for a given transition , find all starlark build settings that are inputoutput while applying it , then return a map of their label to their default values if the build setting is referenced by an { @ link com google devtools build lib rules alias } , the returned map entry is still keyed by the alias

public static immutable map < label , object > get default values ( map < package value key , package value > build setting packages , configuration transition root ) throws transition exception { hash map < label , object > default values = new hash map < > ( ) ; root visit ( ( starlark transition visitor ) transition - > { immutable set < label > settings = get relevant starlark settings from transition ( transition , settings inputs and outputs ) ; for ( label setting : settings ) { default values compute if absent ( setting , ( label setting label ) - > get actual ( build setting packages , setting label ) get associated rule ( ) get attr ( starlark build setting default attr name ) ) ; } } ) ; return immutable map copy of ( default values ) ; }


public list < integer > get wrapped array ( ) { return wrapped array ; }


public void send stop ( ) { stdin print stream println ( " stop " ) ; }


look up groups using posix groups semantics use posix giduid to find groups of the user

private naming enumeration < search result > lookup posix group ( search result result , dir context c ) throws naming exception { string gid number = null ; string uid number = null ; attribute gid attribute = result get attributes ( ) get ( posix gid attr ) ; attribute uid attribute = result get attributes ( ) get ( posix uid attr ) ; string reason = " " ; if ( gid attribute = = null ) { reason = " can ' t find attribute ' " + posix gid attr + " ' " ; } else { gid number = gid attribute get ( ) to string ( ) ; } if ( uid attribute = = null ) { reason = " can ' t find attribute ' " + posix uid attr + " ' " ; } else { uid number = uid attribute get ( ) to string ( ) ; } if ( uid number ! = null & & gid number ! = null ) { return c search ( groupbase d n , " ( & " + group search filter + " ( | ( " + posix gid attr + " = { 0 } ) " + " ( " + group member attr + " = { 1 } ) ) ) " , new object [ ] { gid number , uid number } , search controls ) ; } throw new naming exception ( " the server does not support posix groups " + " semantics reason : " + reason + " returned user object : " + result to string ( ) ) ; }


public locals array set merge with subroutine caller ( locals array other , int pred label ) { locals array mine = get secondary for label ( pred label ) ; locals array new secondary ; one locals array new primary ; new primary = primary merge ( other get primary ( ) ) ; if ( mine = = other ) { new secondary = mine ; } else if ( mine = = null ) { new secondary = other ; } else { new secondary = mine merge ( other ) ; } if ( ( new secondary = = mine ) & & ( new primary = = primary ) ) { return this ; } else { / * * we ' re going to re - build a primary as a merge of all the * secondaries * / new primary = null ; int sz secondaries = secondaries size ( ) ; int sz = math max ( pred label + 1 , sz secondaries ) ; array list < locals array > new secondaries = new array list ( sz ) ; for ( int i = 0 ; i < sz ; i + + ) { locals array la = null ; if ( i = = pred label ) { / * * this locals array always replaces any existing one , * since this is the result of a refined iteration * / la = new secondary ; } else if ( i < sz secondaries ) { la = secondaries get ( i ) ; } if ( la ! = null ) { if ( new primary = = null ) { new primary = la get primary ( ) ; } else { new primary = new primary merge ( la get primary ( ) ) ; } } new secondaries add ( la ) ; } locals array set result = new locals array set ( new primary , new secondaries ) ; result set immutable ( ) ; return result ; } }


sets the group and sub - group for the action in the menu bar actions in the same group will appear next to other actions in the same group and actions in different groups will be separated by menu dividers the sub - group is used to order the actions within the group

public b menu group ( string group , string sub group ) { menu group = group ; menu sub group = sub group ; return self ( ) ; }


used for plugging in a generic writer for a class , for example , an example implementation : { @ code map < class < ? > , x content builder writer > addl writers = new hash map < > ( ) ; addl writers put ( bytes ref class , ( builder , value ) - > b value ( ( ( bytes ref ) value ) utf 8 string ( ) ) ) ; return addl writers ; }

map < class < ? > , x content builder writer > get x content writers ( ) ;


set the color of the foreground or background of the terminal

public void set background color ( color color ) throws i o exception { write bytes ( color background escape seq ) ; }


step through all characters of the provided string , and return the resulting state , or - 1 if that did not lead to a valid state

private static int step ( character run automaton automaton , string key , int state ) { for ( int i = 0 ; state ! = - 1 & & i < key length ( ) ; + + i ) { state = automaton step ( state , key char at ( i ) ) ; } return state ; }


return the same value as { @ link float # hash code ( float ) } }

public static int hash code ( float flt ) { return float hash code ( flt ) ; }


returns type information for typed subclasses of flink ' s { @ link org apache flink api java tuple tuple } typed subclassed are classes that extend { @ link org apache flink api java tuple tuple 0 } till { @ link org apache flink api java tuple tuple 2 5 } to provide types for all fields and might add additional getters and setters for better readability additional member fields must not be added a tuple must not be null a tuple is a fixed - length composite type for storing multiple values in a deterministic field order fields of a tuple are typed tuples are the most efficient composite type ; a tuple does not support null - valued fields unless the type of the field supports nullability the generic types for all fields of the tuple can be defined in a hierarchy of subclasses if flink ' s type analyzer is unable to extract a tuple type information with type information for all fields , an { @ link org apache flink api common functions invalid types exception } is thrown example use : { @ code class my tuple extends tuple 2 < integer , string > { public int get id ( ) { return f 0 ; } public string get name ( ) { return f 1 ; } } } types tuple ( my tuple class )

public static < t extends tuple > type information < t > tuple ( class < t > tuple subclass ) { final type information < t > ti = type extractor create type info ( tuple subclass ) ; if ( ti instanceof tuple type info ) { return ti ; } throw new invalid types exception ( " tuple type expected but was : " + ti ) ; }


public void integer item test ( ) { / / todo : test integer item }


returns the human readable description of this filter for example : " jpeg and gif image files ( jpg , gif ) "

public string get description ( ) { if ( full description = = null ) { full description = " " ; if ( description = = null | | is extension list in description ( ) ) { if ( description ! = null ) { full description = description ; } full description + = " ( " ; / / build the description from the extension list if ( filters size ( ) = = 0 ) { full description + = " * * " ; } else { boolean first ext = true ; enumeration < string > extensions = filters keys ( ) ; if ( extensions ! = null ) { while ( extensions has more elements ( ) ) { if ( ! first ext ) { full description + = " , " ; } else { first ext = false ; } full description + = " * " + extensions next element ( ) ; } } } full description + = " ) " ; } else { full description = description ; } } return full description ; }


tests to verify that sps should runstop automatically when nn state changes between standby and active

public void test when n n h a state changes ( ) throws i o exception { try { create cluster ( ) ; / / nn transits from active to standby cluster transition to standby ( 0 ) ; cluster wait active ( ) ; try { cluster get name node ( 0 ) reconfigure property impl ( d f s config keys dfs storage policy satisfier mode key , storage policy satisfier mode none to string ( ) ) ; assert fail ( " it ' s not allowed to enable or disable " + " storage policy satisfier on standby name node " ) ; } catch ( reconfiguration exception e ) { generic test utils assert exception contains ( " could not change property " + d f s config keys dfs storage policy satisfier mode key + " from ' external ' to ' none ' " , e ) ; generic test utils assert exception contains ( " enabling or disabling storage policy satisfier service on " + " standby name node is not allowed " , e get cause ( ) ) ; } } finally { cluster shutdown ( ) ; } }


public single < model api response > rx upload file with required file ( long pet id , async file required file , string additional metadata , api client auth info auth info ) { return single create ( new io vertx rx java single on subscribe adapter < > ( fut - > delegate upload file with required file ( pet id , required file , additional metadata , auth info , fut ) ) ) ; }


configures the value as weak or soft references

void record stats ( @ nullable string value ) { require argument ( value = = null , " record stats does not take a value " ) ; require argument ( ! record stats , " record stats was already set " ) ; record stats = true ; }


this test checks that the rocks d b native code loader still responds to resetting the init flag

public void test reset init flag ( ) throws exception { rocks d b state backend reset rocks d b loaded flag ( ) ; }


declares that this transformation contains certain operator scope managed memory use case

public optional < integer > declare managed memory use case at operator scope ( managed memory use case managed memory use case , int weight ) { preconditions check not null ( managed memory use case ) ; preconditions check argument ( managed memory use case scope = = managed memory use case scope operator , " use case is not operator scope " ) ; preconditions check argument ( weight > 0 , " weights for operator scope use cases must be greater than 0 " ) ; return optional of nullable ( managed memory operator scope use case weights put ( managed memory use case , weight ) ) ; }


fixup name issues , such as package parts in the name and inner class names this method can handle names with or without ' java ' at the end ; names with ' $ ' ( inner classes ) and names with ' ' characters for package separators

static string fixup name ( string name ) { if ( name ends with ( " java " ) ) { name = name substring ( 0 , name length ( ) - 5 ) ; } string path = name replace ( ' ' , ' / ' ) ; int inner class index = path index of ( ' $ ' ) ; if ( inner class index ! = - 1 ) { path = path substring ( 0 , inner class index ) ; } return path + " java " ; }


force the data node to report missing blocks immediately

private static void trigger delete report ( data node datanode ) throws i o exception { datanode schedule all block report ( 0 ) ; data node test utils trigger deletion report ( datanode ) ; }


creates a new ratio with the given numerator and denominator

public static ratio of ( double numerator , double denominator ) { return new ratio ( numerator , denominator ) ; }


async observable and semaphore isolation with functioning request context use hystrix context scheduler to make the user provided scheduler capture context

public void test rejection with fallback request context with thread isolated asynchronous observable and captured context scheduler ( ) { request context test results results = test request context on rejection with fallback ( execution isolation strategy thread , new hystrix context scheduler ( schedulers new thread ( ) ) ) ; assert true ( results is context initialized get ( ) ) ; / / the user scheduler captures context assert true ( results origin thread get ( ) get name ( ) starts with ( " rx new thread " ) ) ; / / the user provided thread / scheduler assert true ( results is context initialized observe on get ( ) ) ; / / the user scheduler captures context assert true ( results observe on thread get ( ) get name ( ) starts with ( " rx new thread " ) ) ; / / the user provided thread / scheduler for get fallback / / thread isolated , but rejected , so this is false assert false ( results command is executed in thread ( ) ) ; }


provides functionality to clear the cache for a certain view this can be handy in case developer are able to modify views ( e g free marker templates ) at runtime after which you ' d need to clear the cache for the specified view

public void remove from cache ( string view name , locale locale ) { if ( ! is cache ( ) ) { logger warn ( " caching is off ( removal not necessary ) " ) ; } else { object cache key = get cache key ( view name , locale ) ; object cached view ; synchronized ( this view creation cache ) { this view access cache remove ( cache key ) ; cached view = this view creation cache remove ( cache key ) ; } if ( logger is debug enabled ( ) ) { / / some debug output might be useful logger debug ( format key ( cache key ) + ( cached view ! = null ? " cleared from cache " : " not found in the cache " ) ) ; } } }


protected static float distance ( float event x , float start x , float event y , float start y ) { float dx = event x - start x ; float dy = event y - start y ; return ( float ) math sqrt ( dx * dx + dy * dy ) ; }


legacy compatible addition to specify is a r m

public build target set a r m ( boolean is a r m ) { this is a r m = is a r m ; return this ; }


public void string item test ( ) { / / todo : test string item }


notify all peers of the shutdown and restart ' datanode should run ' should still be true and ' datanode restarting ' should be set true before calling this method

void restart notify peers ( ) { assert ( datanode should run & & datanode shutdown for upgrade ) ; lock lock ( ) ; try { / / interrupt each and every data xceiver thread peers values ( ) for each ( t - > t interrupt ( ) ) ; } finally { lock unlock ( ) ; } }


find the fields constant that matches field id , or null if its not found

public static fields find by thrift id ( int field id ) { switch ( field id ) { case 1 : / / file return file ; default : return null ; } }


public void map map of string test ( ) { / / todo : test map map of string }


called for every file that disappeared in the watched directory

default void on directory deleted ( path file ) { }


fetch data from which a resource can be decoded this will always be called on background thread so it is safe to perform long running tasks here any third party libraries called must be thread safe ( or move the work to another thread ) since this method will be called from a thread in a { @ link java util concurrent executor service } that may have more than one background thread you < b > must < b > use the { @ link data callback } once the request is complete you are free to move the fetch work to another thread and call the callback from there this method will only be called when the corresponding resource is not in the cache note - this method will be run on a background thread so blocking io is safe

void load data ( @ non null priority priority , @ non null data callback < ? super t > callback ) ;


for the given option , returns the correct type of option value description , to which unparsed values can be added the categories of option types are non - overlapping , an invariant checked by the option processor at compile time

public static option value description create option value description ( option definition option , options data options data ) { if ( option is expansion option ( ) ) { return new expansion option value description ( option , options data ) ; } else if ( option allows multiple ( ) ) { return new repeatable option value description ( option ) ; } else if ( option has implicit requirements ( ) ) { return new option with implicit requirements value description ( option ) ; } else { return new single option value description ( option ) ; } }


return a { @ link function } to create or associate a new { @ link transaction context } interaction with transactional resources through { @ link transaction synchronization manager } requires a transaction context to be registered in the subscriber context

public static function < context , context > get or create context ( ) { return context - > { transaction context holder holder = context get ( transaction context holder class ) ; if ( holder has context ( ) ) { return context put ( transaction context class , holder current context ( ) ) ; } return context put ( transaction context class , holder create context ( ) ) ; } ; }


gets the address , if there is one , of the type descriptor address in the handler type entry indicated by the ordinal otherwise , this returns null

public address get type descriptor address ( int catch handler ordinal ) throws invalid data type exception { check validity ( catch handler ordinal ) ; data type catch handler dt = get data type ( ) ; mem buffer specific mem buffer = get specific mem buffer ( catch handler ordinal , catch handler dt ) ; / / component 1 is action pointer or displacement address ref address = e h data type utilities get address ( catch handler dt , type descriptor ordinal , specific mem buffer ) ; return get adjusted address ( ref address , 0 ) ; }


returns the segment for the given index , creating it and recording in segment table ( via cas ) if not already present

private segment < k , v > ensure segment ( int k ) { final segment < k , v > [ ] ss = this segments ; long u = ( k < < sshift ) + sbase ; / / raw offset segment < k , v > seg ; if ( ( seg = ( segment < k , v > ) unsafe get object volatile ( ss , u ) ) = = null ) { segment < k , v > proto = ss [ 0 ] ; / / use segment 0 as prototype int cap = proto table length ; float lf = proto load factor ; int threshold = ( int ) ( cap * lf ) ; hash entry < k , v > [ ] tab = new hash entry [ cap ] ; if ( ( seg = ( segment < k , v > ) unsafe get object volatile ( ss , u ) ) = = null ) { / / recheck segment < k , v > s = new segment < k , v > ( lf , threshold , tab ) ; while ( ( seg = ( segment < k , v > ) unsafe get object volatile ( ss , u ) ) = = null ) { if ( unsafe compare and swap object ( ss , u , null , seg = s ) ) { break ; } } } } return seg ; }


poke into the cache internals to simulate garbage collection of the given key this assumes that the given entry is a weak or soft reference , and throws an illegal state exception if that assumption does not hold

static < k , v > void simulate key reclamation ( cache < k , v > cache , k key ) { reference entry < k , v > entry = get reference entry ( cache , key ) ; preconditions check state ( entry instanceof reference ) ; reference < ? > ref = ( reference < ? > ) entry ; if ( ref ! = null ) { ref clear ( ) ; } }


calls { @ link # apply ( boolean ) } with false

public void apply ( ) { apply ( false ) ; }


create user this can only be done by the logged in user

public completable future < void > create user ( user body ) throws api exception { try { http request builder local var request builder = create user request builder ( body ) ; return member var http client send async ( local var request builder build ( ) , http response body handlers of string ( ) ) then compose async ( local var response - > { if ( local var response status code ( ) / 100 ! = 2 ) { return completable future failed future ( get api exception ( " create user " , local var response ) ) ; } return completable future completed future ( null ) ; } ) ; } catch ( api exception e ) { return completable future failed future ( e ) ; } }


the path part of the uri ( without the query string ) , decoded

public final string path ( ) { return rest utils decode component ( raw path ( ) ) ; }


resolves the return type of a method , in particular if the generic return type ( { @ link method # get generic return type ( ) } ) is a type variable ( { @ link type variable } ) , by checking all super - classes and directly implemented interfaces the method m must be defined by the given type or by its raw class type

public static type get actual return type ( type type , method method ) { type return type = method get generic return type ( ) ; if ( return type instanceof class < ? > ) { return return type ; } else if ( return type instanceof parameterized type ) { return return type ; } else if ( return type instanceof type variable < ? > ) { type variable < ? > variable = ( type variable < ? > ) return type ; while ( type ! = null ) { type candidate = match type variable ( type , variable ) ; if ( candidate ! = null ) { return candidate ; } class < ? > raw type = get raw type ( type ) ; for ( type interface type : raw type get generic interfaces ( ) ) { candidate = match type variable ( interface type , variable ) ; if ( candidate ! = null ) { return candidate ; } } type = raw type get generic superclass ( ) ; } } throw new assertion error ( " the type " + return type + " is not a class , parameterized type , or type variable " ) ; }


returns an element less than the { @ link # samples ( ) } and less than { @ link # below samples greater ( ) }


invoke to notify all registered listeners of an updated global checkpoint

synchronized void global checkpoint updated ( final long global checkpoint ) { assert global checkpoint > = no ops performed ; assert global checkpoint > last known global checkpoint : " updated global checkpoint [ " + global checkpoint + " ] " + " is not more than the last known global checkpoint [ " + last known global checkpoint + " ] " ; last known global checkpoint = global checkpoint ; notify listeners ( global checkpoint , null ) ; }


test the property ' quadrilateral type '

public void quadrilateral type test ( ) { / / todo : test quadrilateral type }


sets the logger that is used for the encoder and decoder

protected b frame logger ( http 2 frame logger frame logger ) { enforce non codec constraints ( " frame logger " ) ; this frame logger = check not null ( frame logger , " frame logger " ) ; return self ( ) ; }


public void binary test ( ) { / / todo : test binary }


key to be used for request caching by default this returns null which means " do not cache " to enable caching override this method and return a string key uniquely representing the state of a command instance if multiple command instances in the same request scope match keys then only the first will be executed and all others returned from cache

protected string get cache key ( ) { return null ; }


returns the unique range from this range set that { @ linkplain range # contains contains } { @ code value } , or { @ code null } if this range set does not contain { @ code value }

range < c > range containing ( c value ) ;


public string get application id ( ) { string application id = null ; if ( proto has application id ( ) ) { application id = proto get application id ( ) ; } return application id ; }


public static void main ( string [ ] args ) throws i o exception { framework uploader uploader = new framework uploader ( ) ; if ( uploader parse arguments ( args ) ) { uploader run ( ) ; } }


public void kind test ( ) { / / todo : test kind }


find instances of state store that are accepted by { @ link queryable store type # accepts } and have the provided store name

< t > list < t > stores ( string store name , queryable store type < t > queryable store type ) ;


public void test enum test ( ) { / / todo : test enum test }


removes the given window from the set of in - flight windows

public void retire window ( w window ) { w removed = this mapping remove ( window ) ; if ( removed = = null ) { throw new illegal state exception ( " window " + window + " is not in in - flight window set " ) ; } }


public okhttp 3 call get user by name call ( string username , final api callback callback ) throws api exception { object local var post body = null ; / / create path and map variables string local var path = " / user / { username } " replace all ( " \ \ { " + " username " + " \ \ } " , local var api client escape string ( username to string ( ) ) ) ; 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 > ( ) ; final string [ ] local var accepts = { " application / xml " , " 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 = { } ; 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 [ ] { } ; return local var api client build call ( local var path , " get " , 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 ) ; }


check if identity is allowed to rename the specified schema in a catalog

default void check can rename schema ( identity identity , access control context context , catalog schema name schema , string new schema name ) { deny rename schema ( schema to string ( ) , new schema name ) ; }


wrap the given store value with a { @ link simple value wrapper } , also going through { @ link # from store value } conversion useful for { @ link # get ( object ) } and { @ link # put if absent ( object , object ) } implementations

protected cache value wrapper to value wrapper ( @ nullable object store value ) { return ( store value ! = null ? new simple value wrapper ( from store value ( store value ) ) : null ) ; }


return if the queue has pending resource on given node partition and scheduling mode

boolean has pending resource request ( string node partition , resource cluster , scheduling mode scheduling mode ) { return scheduler utils has pending resource request ( resource calculator , queue usage , node partition , cluster , scheduling mode ) ; }


returns if the trace supplies the hitmiss penalty for this entry

public boolean is penalty aware ( ) { return false ; }


for a lexer , a string is a sequence of char to match that is , " fog " is treated as ' f ' ' o ' ' g ' not as a single transition in the dfa machine = = o - ' f ' - & gt ; o - ' o ' - & gt ; o - ' g ' - & gt ; o and has n + 1 states for n characters

public handle string literal ( terminal a s t string literal a s t ) { string chars = string literal a s t get text ( ) ; a t n state left = new state ( string literal a s t ) ; a t n state right ; string s = char support get string from grammar string literal ( chars ) ; if ( s = = null ) { / / the lexer will already have given an error return new handle ( left , left ) ; } int n = s length ( ) ; a t n state prev = left ; right = null ; for ( int i = 0 ; i < n ; ) { right = new state ( string literal a s t ) ; int code point = s code point at ( i ) ; prev add transition ( code point transitions create with code point ( right , code point ) ) ; prev = right ; i + = character char count ( code point ) ; } string literal a s t atn state = left ; return new handle ( left , right ) ; }


for template expressions , return the prefix that identifies the end of an expression block within a string for example : " } "


returns true if all the { @ link fsrl } s in the specified list are from the filesystem

public static boolean is same f s ( list < fsrl > fsrls ) { if ( fsrls is empty ( ) ) { return true ; } f s r l root fs f s r l = fsrls get ( 0 ) get f s ( ) ; for ( fsrl fsrl : fsrls ) { if ( ! fs f s r l equals ( fsrl get f s ( ) ) ) { return false ; } } return true ; }


update switch information from new switch domain

public void update ( switch domain new switch domain ) { switch domain set masters ( new switch domain get masters ( ) ) ; switch domain set ad weight map ( new switch domain get ad weight map ( ) ) ; switch domain set default push cache millis ( new switch domain get default push cache millis ( ) ) ; switch domain set client beat interval ( new switch domain get client beat interval ( ) ) ; switch domain set default cache millis ( new switch domain get default cache millis ( ) ) ; switch domain set distro threshold ( new switch domain get distro threshold ( ) ) ; switch domain set health check enabled ( new switch domain is health check enabled ( ) ) ; switch domain set auto change health check enabled ( new switch domain is auto change health check enabled ( ) ) ; switch domain set distro enabled ( new switch domain is distro enabled ( ) ) ; switch domain set push enabled ( new switch domain is push enabled ( ) ) ; switch domain set enable standalone ( new switch domain is enable standalone ( ) ) ; switch domain set check times ( new switch domain get check times ( ) ) ; switch domain set http health params ( new switch domain get http health params ( ) ) ; switch domain set tcp health params ( new switch domain get tcp health params ( ) ) ; switch domain set mysql health params ( new switch domain get mysql health params ( ) ) ; switch domain set incremental list ( new switch domain get incremental list ( ) ) ; switch domain set server status synchronization period millis ( new switch domain get server status synchronization period millis ( ) ) ; switch domain set service status synchronization period millis ( new switch domain get service status synchronization period millis ( ) ) ; switch domain set disable add i p ( new switch domain is disable add i p ( ) ) ; switch domain set send beat only ( new switch domain is send beat only ( ) ) ; switch domain set limited url map ( new switch domain get limited url map ( ) ) ; switch domain set distro server expired millis ( new switch domain get distro server expired millis ( ) ) ; switch domain set push go version ( new switch domain get push go version ( ) ) ; switch domain set push java version ( new switch domain get push java version ( ) ) ; switch domain set push python version ( new switch domain get push python version ( ) ) ; switch domain set push c version ( new switch domain get push c version ( ) ) ; switch domain set enable authentication ( new switch domain is enable authentication ( ) ) ; switch domain set overridden server status ( new switch domain get overridden server status ( ) ) ; switch domain set default instance ephemeral ( new switch domain is default instance ephemeral ( ) ) ; switch domain set light beat enabled ( new switch domain is light beat enabled ( ) ) ; }


returns top n hot - threads samples per node the hot - threads are only sampled for the node ids specified in the request

void nodes hot threads ( nodes hot threads request request , action listener < nodes hot threads response > listener ) ;


public string name ( ) { return name ; }


grant a { @ link service ticket } that may be used to access the given service by authenticating the given credentials the details of the security policy around credential authentication and the definition of authentication success are dependent on the implementation , but it should be safe to assume that at least one credential must be authenticated for ticket creation to succeed the principal that is resolved from the authenticated credentials must be the same as that to which the given ticket - granting ticket was issued

service ticket grant service ticket ( string ticket granting ticket id , service service , authentication result authentication result ) throws authentication exception , abstract ticket exception ;


public void name test ( ) { / / todo : test name }


returns { @ code true } if the specified { @ link byte buf } starting at { @ code index } with { @ code length } is valid ascii text , otherwise return { @ code false }

private static boolean is ascii ( byte buf buf , int index , int length ) { return buf for each byte ( index , length , find non ascii ) = = - 1 ; }


creates edit policies and associates these with roles

protected void create edit policies ( ) { final boolean edit enabled = is edit enabled ( ) ; if ( edit enabled ) { install edit policy ( edit policy graphical node role , new entity connection edit policy ( ) ) ; / / install edit policy ( edit policy layout role , new entity layout edit policy ( ) ) ; / / install edit policy ( edit policy container role , new entity container edit policy ( ) ) ; install edit policy ( edit policy component role , new note edit policy ( ) ) ; install edit policy ( edit policy direct edit role , new note direct edit policy ( ) ) ; / / install edit policy ( edit policy component role , new note direct edit policy ( ) ) ; / / install edit policy ( edit policy selection feedback role , new resizable edit policy ( ) ) ; } }


return whether this value has been marked as dynamic

public boolean is dynamic ( ) { return this dynamic ; }


public int get connect to learner master limit ( ) { return connect to learner master limit ; }


attempts to execute all the listeners in { @ link # listeners }

void dispatch listener events ( ) { check state ( ! monitor is occupied by current thread ( ) , " it is incorrect to execute listeners with the monitor held " ) ; listeners dispatch ( ) ; }


this tests that the action responds correctly when the userrole has none of the privileges being checked

public void test match nothing ( ) throws exception { user user = new user ( random alpha of length between ( 4 , 12 ) ) ; authentication authentication = mock ( authentication class ) ; when ( authentication get user ( ) ) then return ( user ) ; role role = role builder ( " test 3 " ) cluster ( set of ( " monitor " ) , set of ( ) ) build ( ) ; r b a c authorization info authz info = new r b a c authorization info ( role , null ) ; final has privileges response response = has privileges ( role descriptor indices privileges builder ( ) indices ( " academy " ) privileges ( " read " , " write " ) build ( ) , authentication , authz info , collections empty list ( ) , strings empty array ) ; assert that ( response get username ( ) , is ( user principal ( ) ) ) ; assert that ( response is complete match ( ) , is ( false ) ) ; assert that ( response get index privileges ( ) , matchers iterable with size ( 1 ) ) ; final resource privileges result = response get index privileges ( ) iterator ( ) next ( ) ; assert that ( result get resource ( ) , equal to ( " academy " ) ) ; assert that ( result get privileges ( ) size ( ) , equal to ( 2 ) ) ; assert that ( result get privileges ( ) get ( " read " ) , equal to ( false ) ) ; assert that ( result get privileges ( ) get ( " write " ) , equal to ( false ) ) ; }


returns the udptcp source port of this { @ link h a proxy message }

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


ghidra python interpreter get interpreter ( ) { return interpreter ; }


public void write ( short u 0 , short u 1 , short u 2 , short u 3 ) { write ( u 0 ) ; write ( u 1 ) ; write ( u 2 ) ; write ( u 3 ) ; }


public big decimal get name number ( ) { return name number ; }


return the default html escape setting , differentiating between no default specified and an explicit value

public boolean get default html escape ( ) { return this default html escape ; }


returns the used percentage of a disk this is useful in debugging disk usage

public float compute used percentage ( ) { return ( float ) ( get used ( ) ) / ( float ) ( get capacity ( ) ) ; }


populates the project views data tree panel ( s ) whenever a project is made active if no project views are open , the tabbed pane is not visible

private void populate read only views ( project project ) { / / read only tab set border ( border factory create titled border ( read only border ) ) ; if ( project = = null ) { set views visible ( false ) ; return ; } project locator [ ] views = project get project views ( ) ; help location help location = new help location ( front end plugin get name ( ) , " read only project data panel " ) ; for ( project locator view : views ) { try { project data project data = project get project data ( view ) ; project locator project locator = project data get project locator ( ) ; string view name = project locator get name ( ) ; final project data tree panel dtp = new project data tree panel ( view name , false , front end plugin , null ) ; / / not active , no filter dtp set project data ( view name , project data ) ; dtp set help location ( help location ) ; read only tab add tab ( view name , dtp ) ; int index = read only tab index of component ( dtp ) ; read only tab set tab component at ( index , new docking tab renderer ( read only tab , view name , view name , e - > view removed ( dtp , get project u r l ( dtp ) , true ) ) ) ; read only views put ( view , dtp ) ; } catch ( exception e ) { msg show error ( this , null , " error " , " cannot restore project view " , e ) ; } } / / update the close views menu and set the views pane visible / / if we have open views set views visible ( views length > 0 ) ; }


making a { @ link bean factory } available is optional ; if not set , { @ link scheduling configurer } beans won ' t get autodetected and a { @ link # set scheduler scheduler } has to be explicitly configured

public void set bean factory ( bean factory bean factory ) { this bean factory = bean factory ; }


retrieves the { @ link py runtime info } object in the given field of the given { @ link toolchain info } if the field holds { @ code none } , null is returned instead if the field does not exist on the given { @ code toolchain info } , or is not a { @ code py runtime info } and not { @ code none } , an error is reported on the { @ code rule context } and null is returned if the { @ code py runtime info } does not have { @ code expected version } as its python version , an error is reported on the { @ code rule context } ( but the provider is still returned )

private static py runtime info parse runtime field ( rule context rule context , python version expected version , toolchain info toolchain info , string field ) { object field value ; try { field value = toolchain info get value ( field ) ; } catch ( eval exception e ) { rule context rule error ( string format ( " error parsing the python toolchain ' s toolchain info : could not retrieve field " + " ' % s ' : % s " , field , e get message ( ) ) ) ; return null ; } if ( field value = = null ) { rule context rule error ( string format ( " error parsing the python toolchain ' s toolchain info : field ' % s ' is missing " , field ) ) ; return null ; } if ( field value = = none ) { return null ; } if ( ! ( field value instanceof py runtime info ) ) { rule context rule error ( string format ( " error parsing the python toolchain ' s toolchain info : expected a py runtime info in " + " field ' % s ' , but got ' % s ' " , field , starlark type ( field value ) ) ) ; return null ; } py runtime info py runtime info = ( py runtime info ) field value ; if ( py runtime info get python version ( ) ! = expected version ) { rule context rule error ( string format ( " error retrieving the python runtime from the toolchain : expected field ' % s ' to have " + " a runtime with python version = ' % s ' , but got python version = ' % s ' " , field , expected version name ( ) , py runtime info get python version ( ) name ( ) ) ) ; } return py runtime info ; }


check consistency of the storage directory

public storage state analyze storage ( startup option start opt , storage storage , boolean check current is empty ) throws i o exception { if ( location ! = null & & location get storage type ( ) = = storage type provided ) { / / currently we assume that provided storages are always normal return storage state normal ; } assert root ! = null : " root is null " ; boolean had mkdirs = false ; string root path = root get canonical path ( ) ; try { / / check that storage exists if ( ! root exists ( ) ) { / / storage directory does not exist if ( start opt ! = startup option format & & start opt ! = startup option hotswap ) { log warn ( " storage directory { } does not exist " , root path ) ; return storage state non existent ; } log info ( " { } does not exist creating " , root path ) ; if ( ! root mkdirs ( ) ) { throw new i o exception ( " cannot create directory " + root path ) ; } had mkdirs = true ; } / / or is inaccessible if ( ! root is directory ( ) ) { log warn ( " { } is not a directory " , root path ) ; return storage state non existent ; } if ( ! file util can write ( root ) ) { log warn ( " cannot access storage directory { } " , root path ) ; return storage state non existent ; } } catch ( security exception ex ) { log warn ( " cannot access storage directory { } " , root path , ex ) ; return storage state non existent ; } this lock ( ) ; / / lock storage if it exists / / if start opt is hotswap , it returns not formatted for empty directory , / / while it also checks the layout version if ( start opt = = hdfs server constants startup option format | | ( start opt = = startup option hotswap & & had mkdirs ) ) { if ( check current is empty ) { check empty current ( ) ; } return storage state not formatted ; } if ( start opt ! = hdfs server constants startup option import ) { storage check old layout storage ( this ) ; } / / check whether current directory is valid file version file = get version file ( ) ; boolean has current = version file exists ( ) ; / / check which directories exist boolean has previous = get previous dir ( ) exists ( ) ; boolean has previous tmp = get previous tmp ( ) exists ( ) ; boolean has removed tmp = get removed tmp ( ) exists ( ) ; boolean has finalized tmp = get finalized tmp ( ) exists ( ) ; boolean has checkpoint tmp = get last checkpoint tmp ( ) exists ( ) ; if ( ! ( has previous tmp | | has removed tmp | | has finalized tmp | | has checkpoint tmp ) ) { / / no temp dirs - no recovery if ( has current ) return storage state normal ; if ( has previous ) throw new inconsistent f s state exception ( root , " version file in current directory is missing " ) ; if ( check current is empty ) { check empty current ( ) ; } return storage state not formatted ; } if ( ( has previous tmp ? 1 : 0 ) + ( has removed tmp ? 1 : 0 ) + ( has finalized tmp ? 1 : 0 ) + ( has checkpoint tmp ? 1 : 0 ) > 1 ) / / more than one temp dirs throw new inconsistent f s state exception ( root , " too many temporary directories " ) ; / / # of temp dirs = = 1 should either recover or complete a transition if ( has checkpoint tmp ) { return has current ? storage state complete checkpoint : storage state recover checkpoint ; } if ( has finalized tmp ) { if ( has previous ) throw new inconsistent f s state exception ( root , storage dir previous + " and " + storage tmp finalized + " cannot exist together " ) ; return storage state complete finalize ; } if ( has previous tmp ) { if ( has previous ) throw new inconsistent f s state exception ( root , storage dir previous + " and " + storage tmp previous + " cannot exist together " ) ; if ( has current ) return storage state complete upgrade ; return storage state recover upgrade ; } assert has removed tmp : " has removed tmp must be true " ; if ( ! ( has current ^ has previous ) ) throw new inconsistent f s state exception ( root , " one and only one directory " + storage dir current + " or " + storage dir previous + " must be present when " + storage tmp removed + " exists " ) ; if ( has current ) return storage state complete rollback ; return storage state recover rollback ; }


returns a list of the " or - able " constraints configured for this column

public list < dialog filter condition < ? > > get filter conditions ( ) { return new array list < > ( column condition set get filter conditions ( ) ) ; }


releases resources before task exits we should also fail the partition to release if the task has failed , is canceled , or is being canceled at the moment

private void release resources ( ) { log debug ( " release task { } network resources ( state : { } ) " , task name with subtask , get execution state ( ) ) ; for ( result partition writer partition writer : consumable notifying partition writers ) { task event dispatcher unregister partition ( partition writer get partition id ( ) ) ; if ( is canceled or failed ( ) ) { partition writer fail ( get failure cause ( ) ) ; } } close network resources ( ) ; try { task state manager close ( ) ; } catch ( exception e ) { log error ( " failed to close task state manager for task { } " , task name with subtask , e ) ; } }


this test makes sure that failures properly manifest when the state backend could not be loaded

public void test loading fails ( ) throws exception { final configuration config = new configuration ( ) ; / / try a value that is neither recognized as a name , nor corresponds to a class config set string ( backend key , " does not exist " ) ; try { state backend loader from application or config or default ( null , config , cl , null ) ; fail ( " should fail with an exception " ) ; } catch ( dynamic code loading exception ignored ) { / / expected } / / try a class that is not a factory config set string ( backend key , java io file class get name ( ) ) ; try { state backend loader from application or config or default ( null , config , cl , null ) ; fail ( " should fail with an exception " ) ; } catch ( dynamic code loading exception ignored ) { / / expected } / / a factory that fails config set string ( backend key , failing factory class get name ( ) ) ; try { state backend loader from application or config or default ( null , config , cl , null ) ; fail ( " should fail with an exception " ) ; } catch ( i o exception ignored ) { / / expected } }


the response resources wrapped in the common mcp resource message these are typed resources that match the type url in the request resources message when ` incremental ` is true , this contains an array of resources to addupdate for the specified collection this modifies the existing collection at the sink when ` incremental ` is false , this contains the full set of resources for the specified collection this replaces any previously delivered resources < code > repeated istio mcp v 1alpha 1 resource resources = 3 ; < code >

public builder add resources ( int index , com alibaba nacos istio model mcp resource value ) { if ( resources builder = = null ) { if ( value = = null ) { throw new null pointer exception ( ) ; } ensure resources is mutable ( ) ; resources add ( index , value ) ; on changed ( ) ; } else { resources builder add message ( index , value ) ; } return this ; }


randomly choose one node from scope with the given storage type 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 this call would make up to two calls it first tries to get a random node ( with old method ) and check if it satisfies if yes , simply return it otherwise , it make a second call ( with the new method ) by passing in a storage type this is for better performance reason put in short , the key note is that the old method is faster but may take several runs , while the new method is somewhat slower , and always succeed in one trial see hdfs - 11535 for more detail

public node choose random with storage type two trial ( final string scope , final collection < node > excluded nodes , storage type type ) { netlock read lock ( ) lock ( ) ; try { string search scope ; string excluded scope ; if ( scope starts with ( " ~ " ) ) { search scope = node base root ; excluded scope = scope substring ( 1 ) ; } else { search scope = scope ; excluded scope = null ; } / / next do a two - trial search / / first trial , call the old method , inherited from network topology node n = choose random ( search scope , excluded scope , excluded nodes ) ; if ( n = = null ) { if ( log is debug enabled ( ) ) { log debug ( " no node to choose " ) ; } / / this means there is simply no node to choose from return null ; } preconditions check argument ( n instanceof datanode descriptor ) ; datanode descriptor dn descriptor = ( datanode descriptor ) n ; if ( dn descriptor has storage type ( type ) ) { / / the first trial succeeded , just return return dn descriptor ; } else { / / otherwise , make the second trial by calling the new method log debug ( " first trial failed , node has no type { } , " + " making second trial carrying this type " , type ) ; return choose random with storage type ( search scope , excluded scope , excluded nodes , type ) ; } } finally { netlock read lock ( ) unlock ( ) ; } }


returns an { @ link list ordered list } of the application extensions installation directories

public final list < resource file > get extension installation dirs ( ) { return extension installation dirs ; }


public void prefix string test ( ) { / / todo : test prefix string }


boolean encode gk ( ) { / / ' gingko ' if ( char at ( m current + 1 ) = = ' k ' ) { metaph add ( " k " ) ; m current + = 2 ; return true ; } return false ; }


public void select all enabled instances clusters ( ) throws exception { string service name = random domain name ( ) ; system out println ( service name ) ; naming register instance ( service name , " 127 0 0 1 " , test port , " c 1 " ) ; naming register instance ( service name , " 1 1 1 1 " , 9090 , " c 2 " ) ; time unit seconds sleep ( 5 ) ; list < instance > instances = naming get all instances ( service name ) ; assert assert equals ( instances size ( ) , 2 ) ; instances = naming select instances ( service name , arrays as list ( " c 1 " , " c 2 " ) , true ) ; assert assert equals ( 2 , instances size ( ) ) ; instances get ( 0 ) set enabled ( false ) ; instances = naming select instances ( service name , arrays as list ( " c 1 " , " c 2 " ) , true ) ; time unit seconds sleep ( 5 ) ; assert assert equals ( 1 , instances size ( ) ) ; instance instance not h = null ; list < instance > instances get = naming get all instances ( service name ) ; for ( instance instance : instances get ) { if ( ! instance is healthy ( ) | | ! instance is enabled ( ) | | instance get weight ( ) < = 0 ) { instance not h = instance ; } } instances get remove ( instance not h ) ; assert assert true ( verify instance list ( instances , instances get ) ) ; }


test verifies that the server shouldn ' t be affected but runtime errors on stop ( )

public void test faulty metrics provider on stop ( ) throws exception { client base setup test env ( ) ; final int client port = port assignment unique ( ) ; metrics provider with error in stop stop called set ( false ) ; final string configs = " metrics provider class name = " + metrics provider with error in stop class get name ( ) + " \ n " ; main thread main = new main thread ( client port , true , configs ) ; main start ( ) ; assert true ( client base wait for server up ( " 127 0 0 1 : " + client port , connection timeout ) , " waiting for server being up " ) ; client connected = new count down latch ( 1 ) ; zoo keeper zk = new zoo keeper ( " 127 0 0 1 : " + client port , client base connection timeout , this ) ; assert true ( client connected await ( connection timeout , time unit milliseconds ) , " failed to establish zkclient connection ! " ) ; zk create ( " / foo " , " foobar " get bytes ( ) , ids open acl unsafe , create mode persistent ) ; assert equals ( new string ( zk get data ( " / foo " , null , null ) ) , " foobar " ) ; zk close ( ) ; main shutdown ( ) ; main join ( ) ; main delete dirs ( ) ; assert true ( client base wait for server down ( " 127 0 0 1 : " + client port , client base connection timeout ) , " waiting for server down " ) ; assert true ( metrics provider with error in stop stop called get ( ) ) ; }


return the prefix to prepend to the request url filename

protected string get prefix ( ) { return this prefix ; }


find the one and only { @ code order by } in a plan

private order by order by ( logical plan plan ) { list < logical plan > l = plan children ( ) stream ( ) filter ( c - > c instanceof order by ) collect ( to list ( ) ) ; assert that ( " expected only one order by " , l , has size ( 1 ) ) ; return ( order by ) l get ( 0 ) ; }


sets the query to get a score explanation for

public explain request builder set query ( query builder query ) { request query ( query ) ; return this ; }


tests if clearing quota per heterogeneous storage doesn ' t result in clearing quota for another storage

public void test storage space quota per quota clear ( ) throws i o exception { final path test dir = new path ( dir , generic test utils get method name ( ) ) ; assert true ( dfs mkdirs ( test dir ) ) ; final long disk space quota = blocksize * 1 ; final long ssd space quota = blocksize * 2 ; / * set space quota * / dfs set quota by storage type ( test dir , storage type disk , disk space quota ) ; dfs set quota by storage type ( test dir , storage type ssd , ssd space quota ) ; final i node test dir node = fsdir get i node 4 write ( test dir to string ( ) ) ; assert true ( test dir node is directory ( ) ) ; assert true ( test dir node is quota set ( ) ) ; / * verify space quota by storage type * / assert equals ( disk space quota , test dir node as directory ( ) get directory with quota feature ( ) get quota ( ) get type space ( storage type disk ) ) ; assert equals ( ssd space quota , test dir node as directory ( ) get directory with quota feature ( ) get quota ( ) get type space ( storage type ssd ) ) ; / * clear disk space quota * / dfs set quota by storage type ( test dir , storage type disk , hdfs constants quota reset ) ; / * verify space quota by storage type after clearing disk ' s * / assert equals ( - 1 , test dir node as directory ( ) get directory with quota feature ( ) get quota ( ) get type space ( storage type disk ) ) ; assert equals ( ssd space quota , test dir node as directory ( ) get directory with quota feature ( ) get quota ( ) get type space ( storage type ssd ) ) ; }


public collection < recovering block > get recovering blocks ( ) { return recovering blocks ; }


determine whether the specified property is readable returns { @ code false } if the property doesn ' t exist

boolean is readable property ( string property name ) ;


temporary path for writing to the partition , unpartitioned table or the query it may be the same as { @ code target path }

public path get write path ( ) { return write path ; }