save snapshot diff list for an i node directory with snapshot

private static < n extends i node , a extends i node attributes , d extends abstract i node diff < n , a , d > > void save i node diffs ( final abstract i node diff list < n , a , d > diffs , final data output out , reference map reference map ) throws i o exception { / / record the diffs in reversed order , so that we can find the correct / / reference for i nodes in the created list when loading the f s image if ( diffs = = null ) { out write int ( - 1 ) ; / / no diffs } else { final diff list < d > list = diffs as list ( ) ; final int size = list size ( ) ; out write int ( size ) ; for ( int i = size - 1 ; i > = 0 ; i - - ) { list get ( i ) write ( out , reference map ) ; } } }


declares that this aspect propagates along an { @ code attribute } on the target associated with this aspect specify multiple attributes by calling { @ link # propagate along attribute ( string ) } repeatedly aspect can also declare to propagate along all attributes with { @ link # propagate along attributes }

public final builder propagate along attribute ( string attribute ) { preconditions check not null ( attribute ) ; preconditions check state ( this propagate along attributes ! = null , " either propagate along all attributes , or along specific attributes , not both " ) ; this propagate along attributes add ( attribute ) ; return this ; }


checks and returns the status of the existing index in this store

public check index status check index ( print stream out ) throws i o exception { metadata lock write lock ( ) lock ( ) ; try ( check index check index = new check index ( directory ) ) { check index set info stream ( out ) ; return check index check index ( ) ; } finally { metadata lock write lock ( ) unlock ( ) ; } }


return and access condition for this lease , or else null if there ' s no lease

private access condition get lease condition ( self renewing lease lease ) { access condition lease condition = null ; if ( lease ! = null ) { lease condition = access condition generate lease condition ( lease get lease i d ( ) ) ; } return lease condition ; }


generate variable storage serialization string

public static string get serialization string ( varnode varnodes ) { if ( varnodes = = null | | varnodes length = = 0 ) { throw new illegal argument exception ( " varnodes may not be null or empty " ) ; } string builder str builder = new string builder ( ) ; for ( varnode v : varnodes ) { if ( str builder length ( ) ! = 0 ) { str builder append ( " , " ) ; } str builder append ( v get address ( ) to string ( true ) ) ; str builder append ( " : " ) ; str builder append ( integer to string ( v get size ( ) ) ) ; } return str builder to string ( ) ; }


test for the case when the scheduler minimum - allocation - vcores = = 0

public void test validate v cores invalid min v core ( ) { map < string , string > configs = new hash map ( ) ; configs put ( yarn configuration rm scheduler minimum allocation vcores , " 0 " ) ; configuration config = capacity scheduler config generator for test create configuration ( configs ) ; capacity scheduler config validator validate v cores ( config ) ; fail ( yarn configuration rm scheduler minimum allocation vcores + " should be > 0 " ) ; }


returns a normalized { @ code - werror : } flag

public string to string ( ) { if ( this werrors is empty ( ) ) { return " " ; } map < string , boolean > werrors = new linked hash map < > ( this werrors ) ; string builder sb = new string builder ( " - werror : " ) ; if ( werrors contains key ( " all " ) ) { boolean b = werrors remove ( " all " ) ; sb append ( b ? " " : " - " ) append ( " all , " ) ; } for ( string warning : werrors key set ( ) ) { boolean b = werrors get ( warning ) ; sb append ( b ? " " : " - " ) append ( warning ) append ( " , " ) ; } / / delete trailing " , " sb delete char at ( sb length ( ) - 1 ) ; return sb to string ( ) ; }


create a name for a lexical block , with " " separated numbers indicating nesting information of the lexical block

public static string get lexical block name ( d i e aggregate diea ) { return " lexical block " + get lexical block name worker ( diea get head fragment ( ) ) ; }


test method for { @ link org apache dubbo registry support abstract registry # unsubscribe ( url , notify listener ) }

public void test unsubscribe ( ) throws exception { / / check parameters try { abstract registry unsubscribe ( test url , null ) ; assertions fail ( ) ; } catch ( exception e ) { assertions assert true ( e instanceof illegal argument exception ) ; } / / check parameters try { abstract registry unsubscribe ( null , null ) ; assertions fail ( ) ; } catch ( exception e ) { assertions assert true ( e instanceof illegal argument exception ) ; } assertions assert null ( abstract registry get subscribed ( ) get ( test url ) ) ; / / check if unsubscribe successfully abstract registry subscribe ( test url , listener ) ; abstract registry unsubscribe ( test url , listener ) ; / / since we have subscribe test url , here should return a empty set instead of null assertions assert not null ( abstract registry get subscribed ( ) get ( test url ) ) ; assertions assert false ( abstract registry get subscribed ( ) get ( test url ) contains ( listener ) ) ; }


public void visit switch insn ( switch insn insn ) ;


public long long value ( ) { return sum ( ) ; }


get the single timeline entity that the given user has access to the meaning of each argument has been documented with { @ link timeline reader # get entity }

public timeline entity get entity ( string entity type , string entity id , enum set < field > fields , user group information caller u g i ) throws yarn exception , i o exception { long start time = time monotonic now ( ) ; metrics incr get entity ops ( ) ; try { return do get entity ( entity type , entity id , fields , caller u g i ) ; } finally { metrics add get entity time ( time monotonic now ( ) - start time ) ; } }


determine whether the given bean definition qualifies as an autowire candidate for the given dependency the default implementation checks { @ link org springframework beans factory config bean definition # is autowire candidate ( ) }

default boolean is autowire candidate ( bean definition holder bd holder , dependency descriptor descriptor ) { return bd holder get bean definition ( ) is autowire candidate ( ) ; }


convert the given object to string with each line indented by 4 spaces ( except the first line )

private string to indented string ( object o ) { if ( o = = null ) { return " null " ; } return o to string ( ) replace ( " \ n " , " \ n " ) ; }


public boolean has unique name ( ) { return has unique name ; }


returns the live view of the filesystem under the package path entry

view get current view ( options provider options ) throws broken diff awareness exception ;


public void start up ( ) { descriptor = method descriptor < string , integer > new builder ( ) set type ( method descriptor method type unknown ) set full method name ( " a service / method " ) set request marshaller ( string marshaller ) set response marshaller ( int marshaller ) build ( ) ; when ( channel new call ( same ( descriptor ) , any ( call options class ) ) ) then return ( call ) ; do return ( " localhost : 443 " ) when ( channel ) authority ( ) ; interceptor = new client auth interceptor ( credentials , executor ) ; }


schedules a periodic execution of the given task with the given initial time delay and repeat period the default implementation schedules and reschedules the { @ code runnable } task via the { @ link # schedule ( runnable , long , time unit ) } method over and over and at a fixed rate , that is , the first execution will be after the { @ code initial delay } , the second after { @ code initial delay + period } , the third after { @ code initial delay + 2 period } , and so on note to implementors : non - positive { @ code initial time } and { @ code period } should be regarded as non - delayed scheduling of the first and any subsequent executions in addition , a more specific { @ code worker } implementation should override this method if it can perform the periodic task execution with less overhead ( such as by avoiding the creation of the wrapper and tracker objects upon each periodic invocation of the common { @ link # schedule ( runnable , long , time unit ) } method )

public disposable schedule periodically ( @ non null runnable run , final long initial delay , final long period , @ non null final time unit unit ) { final sequential disposable first = new sequential disposable ( ) ; final sequential disposable sd = new sequential disposable ( first ) ; final runnable decorated run = rx java plugins on schedule ( run ) ; final long period in nanoseconds = unit to nanos ( period ) ; final long first now nanoseconds = now ( time unit nanoseconds ) ; final long first start in nanoseconds = first now nanoseconds + unit to nanos ( initial delay ) ; disposable d = schedule ( new periodic task ( first start in nanoseconds , decorated run , first now nanoseconds , sd , period in nanoseconds ) , initial delay , unit ) ; if ( d = = empty disposable instance ) { return d ; } first replace ( d ) ; return sd ; }


public static void finish activity ( @ non null final activity activity ) { finish activity ( activity , false ) ; }


builds the { @ link handler strategies }


performs a two argument substitution for the ' message pattern ' passed as parameter for example , message formatter format ( & quot ; hi { } my name is { } & quot ; , & quot ; alice & quot ; , & quot ; bob & quot ; ) ; will return the string " hi alice my name is bob "

final public static formatting tuple format ( final string message pattern , object arg 1 , object arg 2 ) { return array format ( message pattern , new object [ ] { arg 1 , arg 2 } ) ; }


calculates the final mask and value byte streams these streams can then be used to search through memory to look for similar assembly instructions

private mask value get final mask and value ( ) { list < byte [ ] > masks = new array list < > ( ) ; list < byte [ ] > values = new array list < > ( ) ; int total length = 0 ; for ( int i = 0 ; i < mnemonics size ( ) ; i + + ) { mask value result = build single instruction mask ( mnemonics get ( i ) ) ; byte [ ] mask = result get mask ( ) ; byte [ ] value = result get value ( ) ; if ( value length = = mask length ) { masks add ( mask ) ; values add ( value ) ; total length + = value length ; } } return combine instruction masks ( masks , values , total length ) ; }


returns true if the specified line is part of a paragraph and should be merged with the previous line

private boolean is comment line ( i document document , int line ) throws bad location exception { if ( document get number of lines ( ) < line ) return false ; int offset = document get line offset ( line ) ; int length = document get line length ( line ) ; int first char = find end of white space ( document , offset , offset + length ) ; length - = first char - offset ; string line contents = document get ( first char , length ) ; string prefix = line contents trim ( ) ; if ( ! prefix starts with ( " * " ) | | prefix starts with ( " * / " ) ) / / $ non - nls - 1 $ / / $ non - nls - 2 $ { return false ; } / / line contents = line contents substring ( 1 ) trim ( ) to lower case ( ) ; return true ; }


get the sql query to be executed to test the validity of connections

public string get connection test query ( ) { return connection test query ; }


sets the aliases that will be associated with the index when it gets created

public put index template request aliases ( string source ) { return aliases ( new bytes array ( source ) ) ; }


set the content negotiation manager to use for the produces request condition by default this is not set

public void set content type resolver ( requested content type resolver resolver ) { this content type resolver = resolver ; }


return if the there are no more path elements in the pattern

protected final boolean is no more pattern ( ) { return this next = = null ; }


sets the output stream to use for writing until this writer is closed for example : [ code ] writer writer = new u t f 8 stream writer ( ) set output stream ( out ) ; [ code ] is equivalent but writes faster than [ code ] writer writer = new java io output stream writer ( out , " utf - 8 " ) ; [ code ]

public u t f 8 stream writer set output ( output stream out ) { if ( output stream ! = null ) throw new illegal state exception ( " writer not closed or reset " ) ; output stream = out ; return this ; }


test if this { @ code profiles } instance matches against the given active profiles predicate

boolean matches ( predicate < string > active profiles ) ;


returns whether skipping silences in the audio stream is enabled


performs a state update and returns the new view

public litho view assert after state update ( ) { return litho view assert assert that ( state updates test helper get view after state update ( m component context , actual ) ) ; }


public pet get pet by id ( long pet id ) throws api exception { api response < pet > local var response = get pet by id with http info ( pet id ) ; return local var response get data ( ) ; }


wait until the bp is registered , upto the configured amount of time throws an exception if times out , which should fail the client request

void check and wait for b p ( final extended block block ) throws i o exception { string bp id = block get block pool id ( ) ; / / the registration is only missing in relatively short time window / / optimistically perform this first try { datanode get d n registration for b p ( bp id ) ; return ; } catch ( i o exception ioe ) { / / not registered } / / retry long bp ready timeout = dn conf get bp ready timeout ( ) ; stop watch sw = new stop watch ( ) ; sw start ( ) ; while ( sw now ( time unit seconds ) < = bp ready timeout ) { try { datanode get d n registration for b p ( bp id ) ; return ; } catch ( i o exception ioe ) { / / not registered } / / sleep before trying again try { thread sleep ( 1000 ) ; } catch ( interrupted exception ie ) { throw new i o exception ( " interrupted while serving request aborting " ) ; } } / / failed to obtain registration throw new i o exception ( " not ready to serve the block pool , " + bp id + " " ) ; }


updates a pet in the store with form data < b > 405 < b > - invalid input

public mono < void > update pet with form ( long pet id , string name , string status ) throws web client response exception { object post body = null ; / / verify the required parameter ' pet id ' is set if ( pet id = = null ) { throw new web client response exception ( " missing the required parameter ' pet id ' when calling update pet with form " , http status bad request value ( ) , http status bad request get reason phrase ( ) , null , null , null ) ; } / / create path and map variables final map < string , object > path params = new hash map < string , object > ( ) ; path params put ( " pet id " , pet id ) ; final multi value map < string , string > query params = new linked multi value map < string , string > ( ) ; final http headers header params = new http headers ( ) ; final multi value map < string , string > cookie params = new linked multi value map < string , string > ( ) ; final multi value map < string , object > form params = new linked multi value map < string , object > ( ) ; if ( name ! = null ) form params add ( " name " , name ) ; if ( status ! = null ) form params add ( " status " , status ) ; final string [ ] local var accepts = { } ; final list < media type > local var accept = api client select header accept ( local var accepts ) ; final string [ ] local var content types = { " application / x - www - form - urlencoded " } ; final media type local var content type = api client select header content type ( local var content types ) ; string [ ] local var auth names = new string [ ] { " petstore auth " } ; parameterized type reference < void > local var return type = new parameterized type reference < void > ( ) { } ; return api client invoke a p i ( " / pet / { pet id } " , http method post , path params , query params , post body , header params , cookie params , form params , local var accept , local var content type , local var auth names , local var return type ) ; }


returns a multimap containing the mappings in { @ code unfiltered } whose keys satisfy a predicate the returned multimap is a live view of { @ code unfiltered } ; changes to one affect the other the resulting multimap ' s views have iterators that don ' t support { @ code remove ( ) } , but all other methods are supported by the multimap and its views when adding a key that doesn ' t satisfy the predicate , the multimap ' s { @ code put ( ) } , { @ code put all ( ) } , and { @ code replace values ( ) } methods throw an { @ link illegal argument exception } when methods such as { @ code remove all ( ) } and { @ code clear ( ) } are called on the filtered multimap or its views , only mappings whose keys satisfy the filter will be removed from the underlying multimap the returned multimap isn ' t threadsafe or serializable , even if { @ code unfiltered } is many of the filtered multimap ' s methods , such as { @ code size ( ) } , iterate across every keyvalue mapping in the underlying multimap and determine which satisfy the filter when a live view is not needed , it may be faster to copy the filtered multimap and use the copy < b > warning : < b > { @ code key predicate } must be consistent with equals , as documented at { @ link predicate # apply } do not provide a predicate such as { @ code predicates instance of ( array list class ) } , which is inconsistent with equals

public static < k , v > set multimap < k , v > filter keys ( set multimap < k , v > unfiltered , final predicate < ? super k > key predicate ) { if ( unfiltered instanceof filtered key set multimap ) { filtered key set multimap < k , v > prev = ( filtered key set multimap < k , v > ) unfiltered ; return new filtered key set multimap < > ( prev unfiltered ( ) , predicates < k > and ( prev key predicate , key predicate ) ) ; } else if ( unfiltered instanceof filtered set multimap ) { filtered set multimap < k , v > prev = ( filtered set multimap < k , v > ) unfiltered ; return filter filtered ( prev , maps < k > key predicate on entries ( key predicate ) ) ; } else { return new filtered key set multimap < > ( unfiltered , key predicate ) ; } }


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 ] : " " ) ; }


returns the class to be invoked in order to send a notification after the job has completed ( successfailure )

public string get job end notification custom notifier class ( ) { return get ( job context mr job end notification custom notifier class ) ; }


converts a collection of { @ link path } to a collection of dynamo d b keys

static primary key [ ] path to key ( collection < path > paths ) { if ( paths = = null ) { return null ; } final primary key [ ] keys = new primary key [ paths size ( ) ] ; int i = 0 ; for ( path p : paths ) { keys [ i + + ] = path to key ( p ) ; } return keys ; }


public static void intercept ( @ this object obj , @ all arguments object [ ] all arguments ) { try { prepare ( ) ; enhanced instance target object = ( enhanced instance ) obj ; if ( interceptor = = null ) { return ; } interceptor on construct ( target object , all arguments ) ; } catch ( throwable t ) { logger error ( " constructor inter failure " , t ) ; } }


local span analysis is triggered with extension logic service tags

public void test parse span with logic endpoint tag ( ) { final mock receiver mock receiver = new mock receiver ( ) ; multi scopes analysis listener listener = new multi scopes analysis listener ( mock receiver , config , cache , naming control ) ; final long start time = system current time millis ( ) ; final json object logic span tag value = new json object ( ) ; logic span tag value add property ( " name " , " / graph q l - service " ) ; logic span tag value add property ( " latency " , 100 ) ; logic span tag value add property ( " status " , false ) ; span object span object = span object new builder ( ) set operation name ( " / logic - call " ) set start time ( start time ) set end time ( start time + 1000l ) set is error ( false ) set span type ( span type local ) add tags ( key string value pair new builder ( ) set key ( logic endpoint ) set value ( logic span tag value to string ( ) ) build ( ) ) build ( ) ; final segment object segment = segment object new builder ( ) set service ( " mock - service " ) set service instance ( " mock - instance " ) add spans ( span object ) build ( ) ; listener parse local ( span object , segment ) ; listener build ( ) ; final list < source > received sources = mock receiver get received sources ( ) ; assert assert equals ( 1 , received sources size ( ) ) ; final endpoint source = ( endpoint ) received sources get ( 0 ) ; assert assert equals ( " / graph q l - service " , source get name ( ) ) ; mock receiver clear ( ) ; }


private patch info process bundle patch ( patch info his patch info , list < bundle patch > bundle patchs , file cur t patch unzip folder ) throws i o exception , patch exception { string patch name = " patch - " + current build patch info get patch version ( ) + " @ " + his patch info get patch version ( ) ; patch info patch info = new patch info ( ) ; patch info set file name ( patch name + " tpatch " ) ; patch info set target version ( his patch info get patch version ( ) ) ; patch info set patch version ( current build patch info get patch version ( ) ) ; file his t patch file = new file ( t patch tmp folder , his patch info get patch version ( ) + " - download tpatch " ) ; file his t patch unzip folder = new file ( t patch tmp folder , his patch info get patch version ( ) ) ; file dest t path tmp folder = new file ( t patch tmp folder , patch name ) ; if ( ! dest t path tmp folder exists ( ) ) { dest t path tmp folder mkdirs ( ) ; } file info file = new file ( dest t path tmp folder , " patch info " ) ; file utils write string to file ( info file , patch name ) ; for ( bundle patch bundle patch : bundle patchs ) { boolean add to patch = true ; string bundle name = " lib " + bundle patch pkg name replace ( ' ' , ' ' ) ; if ( bundle patch main bundle ) { continue ; } else if ( no patch bundles contains ( bundle patch pkg name ) ) { file current bundle = new file ( cur t patch unzip folder , " lib " + bundle patch pkg name replace ( " " , " " ) + " so " ) ; if ( ! current bundle exists ( ) ) { continue ; } file utils copy file to directory ( current bundle , dest t path tmp folder ) ; patch bundle info patch bundle info = new patch bundle info ( ) ; patch bundle info set application name ( bundle patch application name ) ; patch bundle info set artifact id ( bundle patch artifact id ) ; patch bundle info set main bundle ( false ) ; patch bundle info set src unit tag ( bundle patch src unit tag ) ; patch bundle info set unit tag ( bundle patch unit tag ) ; patch bundle info set new bundle ( bundle patch new bundle ) ; patch bundle info set name ( bundle name ) ; patch bundle info set pkg name ( bundle patch pkg name ) ; patch bundle info set version ( bundle patch version ) ; patch bundle info set base version ( bundle patch base version ) ; patch bundle info set dependency ( bundle patch dependency ) ; patch info get bundles ( ) add ( patch bundle info ) ; continue ; } file cur bundle folder = new file ( cur t patch unzip folder , bundle name ) ; file bundle dest folder = new file ( dest t path tmp folder , bundle name ) ; patch bundle info patch bundle info = new patch bundle info ( ) ; patch bundle info set application name ( bundle patch application name ) ; patch bundle info set artifact id ( bundle patch artifact id ) ; patch bundle info set src unit tag ( bundle patch src unit tag ) ; patch bundle info set main bundle ( false ) ; patch bundle info set unit tag ( bundle patch unit tag ) ; patch bundle info set reset ( bundle patch reset ) ; patch bundle info set new bundle ( bundle patch new bundle ) ; patch bundle info set name ( bundle name ) ; patch bundle info set pkg name ( bundle patch pkg name ) ; patch bundle info set version ( bundle patch version ) ; patch bundle info set base version ( bundle patch base version ) ; patch bundle info set dependency ( bundle patch dependency ) ; switch ( bundle patch bundle policy ) { case add : if ( bundle patch new bundle ) { file current bundle = new file ( cur t patch unzip folder , " lib " + bundle patch pkg name replace ( " " , " " ) + " so " ) ; file utils copy file to directory ( current bundle , t patch tmp folder ) ; } else { bundle dest folder mkdirs ( ) ; file utils copy directory ( cur bundle folder , bundle dest folder ) ; } break ; case remove : add to patch = false ; break ; / / donothing case rollback : / / donothing break ; case merge : file his bundle folder = new file ( his t patch unzip folder , bundle name ) ; file his bundle = new file ( his t patch unzip folder , " lib " + bundle patch pkg name replace ( " " , " " ) + " so " ) ; if ( ! his t patch file exists ( ) ) { if ( string utils is blank ( his patch info get download url ( ) ) & & new file ( t patch tool his tpatch folder , his patch info get file name ( ) ) exists ( ) ) { file his patch file = new file ( t patch tool his tpatch folder , his patch info get file name ( ) ) ; system out println ( " his patch file : " + his patch file get absolute path ( ) ) ; if ( his patch file exists ( ) ) { file utils copy file ( new file ( t patch tool his tpatch folder , his patch info get file name ( ) ) , his t patch file ) ; command utils exec ( t patch tmp folder , " unzip " + his patch file + " - d " + his t patch unzip folder get absolute path ( ) ) ; / / zip utils unzip ( his t patch file , his t patch unzip folder / / get absolute path ( ) ) ; } } else { download t path and unzip ( his patch info get download url ( ) , his t patch file , his t patch unzip folder ) ; / / file main dex file = new file ( his t patch unzip folder , " libcom taobao maindex so " ) ; / / if ( main dex file exists ( ) ) { / / try { / / system out println ( " start put bundle infos for version : " + his patch info get patch version ( ) + " " ) ; / / t patch tool bundle infos put ( his patch info get patch version ( ) , new atlas framework properties reader ( / / new method reader ( / / new class reader ( / / new dex reader ( main dex file ) ) ) , t patch tool bundle infos get ( current build patch info get patch version ( ) ) ) read ( " landroid / taobao / atlas / framework / framework properties ; " , " < clinit > " ) ) ; / / } catch ( exception e ) { / / e print stack trace ( ) ; / / } / / } } } if ( ! his bundle folder exists ( ) & & ! his bundle exists ( ) ) { throw new i o exception ( his bundle folder get absolute path ( ) + " is not exist in history bundle ! " ) ; } else if ( his bundle exists ( ) & & bundle patch bundle policy = = bundle policy merge ) { file current bundle = new file ( cur t patch unzip folder , " lib " + bundle patch pkg name replace ( " " , " " ) + " so " ) ; if ( current bundle exists ( ) & & awb maps get ( bundle patch artifact id ) exists ( ) ) { file utils copy file to directory ( awb maps get ( bundle patch artifact id ) , dest t path tmp folder ) ; } } else { file full awb file = awb maps get ( bundle patch artifact id ) ; if ( full awb file = = null ) { system out println ( bundle patch artifact id + " is not exits ! " ) ; file utils copy directory ( cur bundle folder , bundle dest folder ) ; break ; } copy diff files ( full awb file , cur bundle folder , his bundle folder , bundle dest folder , patch bundle info get src unit tag ( ) equals ( patch bundle info get unit tag ( ) ) ) ; if ( ! bundle dest folder exists ( ) | | file utils list files ( bundle dest folder , null , true ) size ( ) = = 0 ) { if ( patch bundle info get unit tag ( ) equals ( patch bundle info get src unit tag ( ) ) ) { add to patch = false ; } else { / / throw new patch exception ( patch name + " : " + patch bundle info get pkg name ( ) + " , " + patch bundle info get unit tag ( ) + " , " + patch bundle info get src unit tag ( ) + " , ， ! " ) ; patch bundle info set inherit ( true ) ; } } } break ; } if ( add to patch & & patch bundle info get unit tag ( ) equals ( patch bundle info get src unit tag ( ) ) ) { if ( his patch info get patch version ( ) split ( " \ \ " ) length = = 3 ) { throw new patch exception ( patch name + patch bundle info get pkg name ( ) + " in patch srcunittag equals unittag , " + patch bundle info get unit tag ( ) + " , please upgrade bundle version and reintegration ! " ) ; } else { system err println ( patch name + patch bundle info get pkg name ( ) + " in patch srcunittag equals unittag , " + patch bundle info get unit tag ( ) + " , please upgrade bundle version and reintegration ! " ) ; } } else if ( add to patch ) { patch info get bundles ( ) add ( patch bundle info ) ; } } return patch info ; }


returns the first four bytes of { @ linkplain # as bytes ( ) this hashcode ' s bytes } , converted to an { @ code int } value in little - endian order


create the tree cache that monitors the registry for node addition , update , and deletion

public void monitor registry entries ( ) throws exception { string registry path = get config ( ) get ( registry constants key registry zk root , registry constants default zk registry root ) ; tree cache = new tree cache ( curator , registry path ) ; tree cache start ( ) ; }


atomically sets to the given value if this { @ link attribute } ' s value is { @ code null } if it was not possible to set the value as it contains a value it will just return the current value


public void start ( ) { logger info ( " start game " ) ; ai component manager start ( ) ; physics component manager start ( ) ; render component manager start ( ) ; }


deprecated in api level 23 , but must remain to allow compatibility with api < 23

public void on attach ( @ non null activity activity ) { super on attach ( activity ) ; m context = activity ; }


returns true if topology recovery is enabled , false otherwise

public boolean is topology recovery ( ) { return topology recovery ; }


marks a range of rop registers as " reserved for a local variable "

private void mark reserved ( int rop reg , int category ) { reserved rop regs set ( rop reg , rop reg + category , true ) ; }


this method is called in a finally block after successful execution or on a rejection

public void on after ( ) { / / nothing by default }


extracts application secondary dexes into files in the application data directory

static list < ? extends file > load ( context context , file source apk , file dex dir , string prefs key prefix , boolean force reload ) throws i o exception { log i ( tag , " multi dex extractor load ( " + source apk get path ( ) + " , " + force reload + " , " + prefs key prefix + " ) " ) ; long current crc = get zip crc ( source apk ) ; / / validity check and extraction must be done only while the lock file has been taken file lock file = new file ( dex dir , lock filename ) ; random access file lock raf = new random access file ( lock file , " rw " ) ; file channel lock channel = null ; file lock cache lock = null ; list < extracted dex > files ; i o exception release lock exception = null ; try { lock channel = lock raf get channel ( ) ; log i ( tag , " blocking on lock " + lock file get path ( ) ) ; cache lock = lock channel lock ( ) ; log i ( tag , lock file get path ( ) + " locked " ) ; if ( ! force reload & & ! is modified ( context , source apk , current crc , prefs key prefix ) ) { try { files = load existing extractions ( context , source apk , dex dir , prefs key prefix ) ; } catch ( i o exception ioe ) { log w ( tag , " failed to reload existing extracted secondary dex files , " + " falling back to fresh extraction " , ioe ) ; files = perform extractions ( source apk , dex dir ) ; put stored apk info ( context , prefs key prefix , get time stamp ( source apk ) , current crc , files ) ; } } else { log i ( tag , " detected that extraction must be performed " ) ; files = perform extractions ( source apk , dex dir ) ; put stored apk info ( context , prefs key prefix , get time stamp ( source apk ) , current crc , files ) ; } } finally { if ( cache lock ! = null ) { try { cache lock release ( ) ; } catch ( i o exception e ) { log e ( tag , " failed to release lock on " + lock file get path ( ) ) ; / / exception while releasing the lock is bad , we want to report it , but not at / / the price of overriding any already pending exception release lock exception = e ; } } if ( lock channel ! = null ) { close quietly ( lock channel ) ; } close quietly ( lock raf ) ; } if ( release lock exception ! = null ) { throw release lock exception ; } log i ( tag , " load found " + files size ( ) + " secondary dex files " ) ; return files ; }


notification the services changed subclasses should override this method if they care about service changes

public void services changed ( ) { / / for subclasses }


tests modifying xattrs on a directory that has been snapshotted

public void test modify reads current state ( ) throws exception { / / init file system mkdirs ( hdfs , path , fs permission create immutable ( ( short ) 0700 ) ) ; snapshot test helper create snapshot ( hdfs , path , snapshot name ) ; hdfs set x attr ( path , name 1 , value 1 ) ; hdfs set x attr ( path , name 2 , value 2 ) ; / / verify that current path reflects xattrs , snapshot doesn ' t map < string , byte [ ] > xattrs = hdfs get x attrs ( path ) ; assert equals ( xattrs size ( ) , 2 ) ; assert array equals ( value 1 , xattrs get ( name 1 ) ) ; assert array equals ( value 2 , xattrs get ( name 2 ) ) ; xattrs = hdfs get x attrs ( snapshot path ) ; assert equals ( xattrs size ( ) , 0 ) ; / / modify each xattr and make sure it ' s reflected hdfs set x attr ( path , name 1 , value 2 , enum set of ( x attr set flag replace ) ) ; xattrs = hdfs get x attrs ( path ) ; assert equals ( xattrs size ( ) , 2 ) ; assert array equals ( value 2 , xattrs get ( name 1 ) ) ; assert array equals ( value 2 , xattrs get ( name 2 ) ) ; hdfs set x attr ( path , name 2 , value 1 , enum set of ( x attr set flag replace ) ) ; xattrs = hdfs get x attrs ( path ) ; assert equals ( xattrs size ( ) , 2 ) ; assert array equals ( value 2 , xattrs get ( name 1 ) ) ; assert array equals ( value 1 , xattrs get ( name 2 ) ) ; / / paranoia checks xattrs = hdfs get x attrs ( snapshot path ) ; assert equals ( xattrs size ( ) , 0 ) ; hdfs remove x attr ( path , name 1 ) ; hdfs remove x attr ( path , name 2 ) ; xattrs = hdfs get x attrs ( path ) ; assert equals ( xattrs size ( ) , 0 ) ; }


tests that a server failure closes the connection and removes it from the established connections

public void test failure closes channel ( ) throws exception { deadline deadline = test timeout from now ( ) ; atomic kv state request stats stats = new atomic kv state request stats ( ) ; final message serializer < kv state internal request , kv state response > serializer = new message serializer < > ( new kv state internal request kv state internal request deserializer ( ) , new kv state response kv state response deserializer ( ) ) ; client < kv state internal request , kv state response > client = null ; channel server channel = null ; try { client = new client < > ( " test client " , 1 , serializer , stats ) ; final linked blocking queue < byte buf > received = new linked blocking queue < > ( ) ; final atomic reference < channel > channel = new atomic reference < > ( ) ; server channel = create server channel ( new channel inbound handler adapter ( ) { @ override public void channel active ( channel handler context ctx ) throws exception { channel set ( ctx channel ( ) ) ; } @ override public void channel read ( channel handler context ctx , object msg ) throws exception { received add ( ( byte buf ) msg ) ; } } ) ; inet socket address server address = get kv state server address ( server channel ) ; / / requests list < future < kv state response > > futures = new array list < > ( ) ; kv state internal request request = new kv state internal request ( new kv state i d ( ) , new byte [ 0 ] ) ; futures add ( client send request ( server address , request ) ) ; futures add ( client send request ( server address , request ) ) ; byte buf buf = received poll ( deadline time left ( ) to millis ( ) , time unit milliseconds ) ; assert not null ( " receive timed out " , buf ) ; buf release ( ) ; buf = received poll ( deadline time left ( ) to millis ( ) , time unit milliseconds ) ; assert not null ( " receive timed out " , buf ) ; buf release ( ) ; assert equals ( 1l , stats get num connections ( ) ) ; channel ch = channel get ( ) ; assert not null ( " channel not active " , ch ) ; / / respond with failure ch write and flush ( message serializer serialize server failure ( server channel alloc ( ) , new runtime exception ( " expected test server failure " ) ) ) ; try { futures remove ( 0 ) get ( deadline time left ( ) to millis ( ) , time unit milliseconds ) ; fail ( " did not throw expected server failure " ) ; } catch ( execution exception e ) { if ( ! ( e get cause ( ) instanceof runtime exception ) ) { fail ( " did not throw expected exception " ) ; } / / expected } try { futures remove ( 0 ) get ( deadline time left ( ) to millis ( ) , time unit milliseconds ) ; fail ( " did not throw expected server failure " ) ; } catch ( execution exception e ) { if ( ! ( e get cause ( ) instanceof runtime exception ) ) { fail ( " did not throw expected exception " ) ; } / / expected } assert equals ( 0l , stats get num connections ( ) ) ; / / counts can take some time to propagate while ( deadline has time left ( ) & & ( stats get num successful ( ) ! = 0l | | stats get num failed ( ) ! = 2l ) ) { thread sleep ( 100l ) ; } assert equals ( 2l , stats get num requests ( ) ) ; assert equals ( 0l , stats get num successful ( ) ) ; assert equals ( 2l , stats get num failed ( ) ) ; } finally { if ( client ! = null ) { try { client shutdown ( ) get ( 10l , time unit seconds ) ; } catch ( exception e ) { e print stack trace ( ) ; } assert assert true ( client is event group shutdown ( ) ) ; } if ( server channel ! = null ) { server channel close ( ) ; } assert equals ( " channel leak " , 0l , stats get num connections ( ) ) ; } }


validate the given token ' s scope against the required scope every required scope element ( if any ) must exist in the provided token ' s scope for the validation to succeed

public static o auth bearer validation result validate scope ( o auth bearer token token , list < string > required scope ) { final set < string > token scope = token scope ( ) ; if ( required scope = = null | | required scope is empty ( ) ) return o auth bearer validation result new success ( ) ; for ( string required scope element : required scope ) { if ( ! token scope contains ( required scope element ) ) return o auth bearer validation result new failure ( string format ( " the provided scope ( % s ) was mising a required scope ( % s ) all required scope elements : % s " , string value of ( token scope ) , required scope element , required scope to string ( ) ) , required scope to string ( ) , null ) ; } return o auth bearer validation result new success ( ) ; }


add the jvm system properties necessary to configure { @ link container log appender } or { @ link container rolling log appender }

public static void add log 4j system properties ( task task , list < string > vargs , configuration conf ) { string log 4j property file = conf get ( m r job config mapreduce job log4j properties file , " " ) ; if ( log 4j property file is empty ( ) ) { vargs add ( " - dlog 4j configuration = container - log 4j properties " ) ; } else { uri log 4j u r i = null ; try { log 4j u r i = new uri ( log 4j property file ) ; } catch ( u r i syntax exception e ) { throw new illegal argument exception ( e ) ; } path log 4j path = new path ( log 4j u r i ) ; vargs add ( " - dlog 4j configuration = " + log 4j path get name ( ) ) ; } long log size ; string log level ; int num backups ; if ( task = = null ) { log size = conf get long ( m r job config mr am log kb , m r job config default mr am log kb ) < < 10 ; log level = conf get ( m r job config mr am log level , m r job config default mr am log level ) ; num backups = conf get int ( m r job config mr am log backups , m r job config default mr am log backups ) ; } else { log size = task log get task log limit bytes ( conf ) ; log level = get child log level ( conf , task is map task ( ) ) ; num backups = conf get int ( m r job config task log backups , m r job config default task log backups ) ; } vargs add ( " - d " + yarn configuration yarn app container log dir + " = " + application constants log dir expansion var ) ; vargs add ( " - d " + yarn configuration yarn app container log size + " = " + log size ) ; if ( log size > 0l & & num backups > 0 ) { / / log should be rolled vargs add ( " - d " + yarn configuration yarn app container log backups + " = " + num backups ) ; vargs add ( " - dhadoop root logger = " + log level + " , crla " ) ; } else { vargs add ( " - dhadoop root logger = " + log level + " , cla " ) ; } vargs add ( " - dhadoop root logfile = " + task log log name syslog ) ; if ( task ! = null & & ! task is map task ( ) & & conf get boolean ( m r job config reduce separate shuffle log , m r job config default reduce separate shuffle log ) ) { final int num shuffle backups = conf get int ( m r job config shuffle log backups , m r job config default shuffle log backups ) ; final long shuffle log size = conf get long ( m r job config shuffle log kb , m r job config default shuffle log kb ) < < 10 ; final string shuffle logger = log level + ( shuffle log size > 0l & & num shuffle backups > 0 ? " , shuffle c r l a " : " , shuffle c l a " ) ; vargs add ( " - d " + m r job config mr prefix + " shuffle logger = " + shuffle logger ) ; vargs add ( " - d " + m r job config mr prefix + " shuffle logfile = " + task log log name syslog + " shuffle " ) ; vargs add ( " - d " + m r job config mr prefix + " shuffle log filesize = " + shuffle log size ) ; vargs add ( " - d " + m r job config mr prefix + " shuffle log backups = " + num shuffle backups ) ; } }


translates this node into a flink operator note : this method should return same translate result if called multiple times

transformation < t > translate to plan ( planner planner ) ;


convert the given key to a case - insensitive key the default implementation converts the key to lower - case according to this map ' s locale

protected string convert key ( string key ) { return key to lower case ( get locale ( ) ) ; }


public set < string > topic cleanup policy ( string topic ) { config topic config = describe topic config ( topic ) ; if ( topic config = = null ) { / / the topic must not exist log debug ( " unable to find topic ' { } ' when getting cleanup policy " , topic ) ; return collections empty set ( ) ; } config entry entry = topic config get ( cleanup policy config ) ; if ( entry ! = null & & entry value ( ) ! = null ) { string policy str = entry value ( ) ; log debug ( " found cleanup policy = { } for topic ' { } ' " , policy str , topic ) ; return arrays stream ( policy str split ( " , " ) ) map ( string : : trim ) filter ( s - > ! s is empty ( ) ) map ( string : : to lower case ) collect ( collectors to set ( ) ) ; } / / this is unexpected , as the topic config should include the cleanup policy even if / / the topic settings don ' t override the broker ' s log cleanup policy but just to be safe log debug ( " found no cleanup policy for topic ' { } ' " , topic ) ; return collections empty set ( ) ; }


adds { @ code headers } as public header files these files will be made visible to dependent rules they may be parsedpreprocessed or compiled into a header module depending on the configuration

public cc compilation helper add public headers ( artifact headers ) { add public headers ( arrays as list ( headers ) ) ; return this ; }


replaces the entire view ' s content with the content of the given { @ link list }

public void set list ( list < t > list ) { this list = list ; }


public index record get index ( int partition ) { final int pos = partition * map task map output index record length / 8 ; return new index record ( entries get ( pos ) , entries get ( pos + 1 ) , entries get ( pos + 2 ) ) ; }


private static string to normalized icon url ( string url ) { return icon to normalized icon url ( url ) ; }


makes sure that the given info collection has a { @ link cc toolchain provider } ( gives an error otherwise ) , and returns a reference to that { @ link cc toolchain provider } the method never returns { @ code null } , even if there is no toolchain

public static cc toolchain provider get toolchain ( rule context rule context , transitive info collection dep ) { label toolchain type = get toolchain type from rule class ( rule context ) ; return get toolchain ( rule context , dep , toolchain type ) ; }


we conflate v with change < v > in many places this will get fixed in the implementation of kip - 478 for now , i ' m just explicitly lying about the parameterized type

private < vr > processor parameters < k , vr , ? , ? > unsafe cast processor parameters to completely different type ( final processor parameters < k , change < v > , ? , ? > k object processor parameters ) { return ( processor parameters < k , vr , ? , ? > ) k object processor parameters ; }


as classloading is lazy , the classes referenced in this method will not be resolved until the first time the method is invoked , so we use this method to guard access to jenkins jvm only classes

private static list < process killing veto > all ( ) { return extension list lookup ( process killing veto class ) ; }


the interpretedcompiled version of the ` value ` string < code > optional aapt pb item compiled item = 6 ; < code >


add the supplied attribute to this { @ code map } using a { @ link org springframework core conventions # get variable name generated name } note : empty { @ link collection collections } are not added to the model when using this method because we cannot correctly determine the true convention name view code should check for { @ code null } rather than for empty collections as is already done by jstl tags

public concurrent model add attribute ( object attribute value ) { assert not null ( attribute value , " model attribute value must not be null " ) ; if ( attribute value instanceof collection & & ( ( collection < ? > ) attribute value ) is empty ( ) ) { return this ; } return add attribute ( conventions get variable name ( attribute value ) , attribute value ) ; }


calculates this buffer ' s hash code from the remaining chars the position , limit , capacity and mark don ' t affect the hash code

public int hash code ( ) { int my position = position ; int hash = 0 ; while ( my position < limit ) { hash = hash + get ( my position + + ) ; } return hash ; }


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 0 : / / success return success ; default : return null ; } }


confirm that replace values ( ) returns a list implementing random access

public void test replace values random access ( ) { multimap < string , integer > multimap = create ( ) ; multimap put ( " foo " , 1 ) ; multimap put ( " foo " , 3 ) ; assert true ( multimap replace values ( " foo " , as list ( 2 , 4 ) ) instanceof random access ) ; assert true ( multimap replace values ( " bar " , as list ( 2 , 4 ) ) instanceof random access ) ; }


implementation can choose to provide different acl for different views this can be used as a basis for more fine - grained access control the default implementation makes the view visible if any of the items are visible or the view is configurable

public @ non null acl get a c l ( final @ non null view item ) { return acl lambda 2 ( ( a , permission ) - > { acl base = item get owner ( ) get a c l ( ) ; boolean has permission = base has permission 2 ( a , permission ) ; if ( ! has permission & & permission = = view read ) { return base has permission 2 ( a , view configure ) | | ! item get items ( ) is empty ( ) ; } return has permission ; } ) ; }


int alloc arrays ( ) { preconditions check state ( needs alloc arrays ( ) , " arrays already allocated " ) ; int expected size = metadata ; int buckets = compact hashing table size ( expected size ) ; this table = compact hashing create table ( buckets ) ; set hash table mask ( buckets - 1 ) ; this entries = new int [ expected size ] ; this elements = new object [ expected size ] ; return expected size ; }


construct the full set of requirements for a tester method

static tester requirements build tester requirements ( method tester method ) throws conflicting requirements exception { tester requirements cloned class requirements = new tester requirements ( get tester requirements ( tester method get declaring class ( ) ) ) ; tester requirements declared requirements = build declared tester requirements ( tester method ) ; return incorporate requirements ( cloned class requirements , declared requirements , tester method ) ; }


assert that a multipart upload is successful when a single empty part is uploaded

public void test multipart upload empty part ( ) throws exception { file system fs = get file system ( ) ; path file = path ( " test multipart upload " ) ; try ( multipart uploader uploader = fs create multipart uploader ( file ) build ( ) ) { upload handle upload handle = uploader start upload ( file ) get ( ) ; map < integer , part handle > part handles = new hash map < > ( ) ; message digest orig digest = digest utils get md 5 digest ( ) ; byte [ ] payload = new byte [ 0 ] ; orig digest update ( payload ) ; input stream is = new byte array input stream ( payload ) ; part handle part handle = await future ( uploader put part ( upload handle , 1 , file , is , payload length ) ) ; part handles put ( 1 , part handle ) ; complete upload ( file , upload handle , part handles , orig digest , 0 ) ; } }


# simulates the behavior of a system restart : # the pid directory is deleted by the operating system # but it should not block es from starting # see https : github comelasticelasticsearchissues 1 1 5 9 4

public void test 8 0 delete p i d d i rand restart ( ) throws exception { assume true ( is systemd ( ) ) ; rm ( installation pid dir ) ; sh run ( " systemd - tmpfiles - - create " ) ; start elasticsearch ( ) ; final path pid file = installation pid dir resolve ( " elasticsearch pid " ) ; assert that ( pid file , file exists ( ) ) ; stop elasticsearch ( ) ; }


similar to { @ link # get variables ( collection , boolean ) } , but only for variables local to this scope

map < string , object > get variables local ( collection < string > variable names , boolean fetch all variables ) ;


public int get value ( ) { return this value ; }


sets the primary callback to be executed when this action is invoked this builder will throw an { @ link illegal state exception } if one of the build methods is called without providing this callback

public b on action ( consumer < c > action ) { action callback = action ; return self ( ) ; }


public m t config clone ( ) { return xml serializer util create copy ( this ) ; }


enable this to get merge path support for devices running kit kat ( 19 ) and above merge paths currently don ' t work if the the operand shape is entirely contained within the first shape if you need to cut out one shape from another shape , use an even - odd fill type instead of using merge paths

public void enable merge paths for kit kat and above ( boolean enable ) { lottie drawable enable merge paths for kit kat and above ( enable ) ; }


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


return the set of active profiles as explicitly set through { @ link # set active profiles } or if the current set of active profiles is empty , check for the presence of the { @ value # active profiles property name } property and assign its value to the set of active profiles

protected set < string > do get active profiles ( ) { synchronized ( this active profiles ) { if ( this active profiles is empty ( ) ) { string profiles = get property ( active profiles property name ) ; if ( string utils has text ( profiles ) ) { set active profiles ( string utils comma delimited list to string array ( string utils trim all whitespace ( profiles ) ) ) ; } } return this active profiles ; } }


translate overlay address spaces for a new language provider and initialize the new addr factory with the translated overlay spaces all non - overlay address spaces within the address factory should already have been mapped to the new language

void set language ( language new language , program address factory addr factory , language translator translator ) throws i o exception { table table = db get table ( table name ) ; if ( table ! = null ) { record iterator it = table iterator ( ) ; while ( it has next ( ) ) { d b record rec = it next ( ) ; string old underlying space name = rec get string ( ov space base col ) ; address space space = addr factory get address space ( old underlying space name ) ; if ( space ! = null & & space is non loaded memory space ( ) ) { / / skip overlays associated with non - loaded spaces such as other space continue ; } address space new space = translator get new address space ( old underlying space name ) ; if ( new space = = null ) { throw new i o exception ( " failed to map old address space : " + old underlying space name ) ; } rec set string ( ov space base col , new space get name ( ) ) ; table put record ( rec ) ; } } initialize overlay spaces ( addr factory ) ; }


public void my number test ( ) { / / todo : test my number }


we override equals so that if the same value is written to a { @ link node entry } twice , it can verify that the two values are equal , and avoid incrementing its version

public boolean equals ( object o ) { if ( this = = o ) { return true ; } if ( o = = null | | get class ( ) ! = o get class ( ) ) { return false ; } value with events that = ( value with events ) o ; / / shallow equals is a middle ground between using default equals , which might miss / / nested sets with the same elements , and deep equality checking , which would be expensive / / all three choices are sound , since shallow equals and default equals are more / / conservative than deep equals using shallow equals means that we may unnecessarily / / consider some values unequal that are actually equal , but this is still a net win over / / deep equals return value equals ( that value ) & & transitive events shallow equals ( that transitive events ) & & transitive postables shallow equals ( that transitive postables ) ; }


returns the reshaped the state handles to include only those key - group states in the local key - group range and the operator states that would be assigned to the local subtask

public static operator subtask state repartition operator state ( final operator subtask state operator state handles , final int num key groups , final int old parallelism , final int new parallelism , final int subtask index ) { preconditions check not null ( operator state handles , " the previous operator state handles should not be null " ) ; / / create a new operator state handles that only contains the state for our key - groups list < key group range > key group partitions = state assignment operation create key group partitions ( num key groups , new parallelism ) ; key group range local key group range = key group partitions get ( subtask index ) ; list < keyed state handle > local managed key group state = new array list < > ( ) ; state assignment operation extract intersecting state ( operator state handles get managed keyed state ( ) , local key group range , local managed key group state ) ; list < keyed state handle > local raw key group state = new array list < > ( ) ; state assignment operation extract intersecting state ( operator state handles get raw keyed state ( ) , local key group range , local raw key group state ) ; state object collection < operator state handle > managed operator states = operator state handles get managed operator state ( ) ; collection < operator state handle > local managed operator state ; if ( ! managed operator states is empty ( ) ) { list < list < operator state handle > > managed operator state = managed operator states stream ( ) map ( collections : : singleton list ) collect ( collectors to list ( ) ) ; local managed operator state = operator state repartitioner repartition state ( managed operator state , old parallelism , new parallelism ) get ( subtask index ) ; } else { local managed operator state = collections empty list ( ) ; } state object collection < operator state handle > raw operator states = operator state handles get raw operator state ( ) ; collection < operator state handle > local raw operator state ; if ( ! raw operator states is empty ( ) ) { list < list < operator state handle > > raw operator state = raw operator states stream ( ) map ( collections : : singleton list ) collect ( collectors to list ( ) ) ; local raw operator state = operator state repartitioner repartition state ( raw operator state , old parallelism , new parallelism ) get ( subtask index ) ; } else { local raw operator state = collections empty list ( ) ; } return operator subtask state builder ( ) set managed operator state ( new state object collection < > ( null to empty collection ( local managed operator state ) ) ) set raw operator state ( new state object collection < > ( null to empty collection ( local raw operator state ) ) ) set managed keyed state ( new state object collection < > ( null to empty collection ( local managed key group state ) ) ) set raw keyed state ( new state object collection < > ( null to empty collection ( local raw key group state ) ) ) build ( ) ; }


public static naming maintain service create maintain service ( string server list ) throws nacos exception { try { class < ? > driver impl class = class for name ( " com alibaba nacos client naming nacos naming maintain service " ) ; constructor constructor = driver impl class get constructor ( string class ) ; naming maintain service vendor impl = ( naming maintain service ) constructor new instance ( server list ) ; return vendor impl ; } catch ( throwable e ) { throw new nacos exception ( nacos exception client invalid param , e ) ; } }


public task unregister ( task task ) { logger trace ( " unregister task for id : { } " , task get id ( ) ) ; if ( task instanceof cancellable task ) { cancellable task holder holder = cancellable tasks remove ( task get id ( ) ) ; if ( holder ! = null ) { holder finish ( ) ; return holder get task ( ) ; } else { return null ; } } else { return tasks remove ( task get id ( ) ) ; } }


returns a reference to the super class or to an interface of the ' implements ' clause of a class

public static type reference new super type reference ( final int itf index ) { return new type reference ( ( class extends < < 24 ) | ( ( itf index & 0x f f f f ) < < 8 ) ) ; }


identifies all wait for xxx methods , which must be called while occupying the monitor

private static boolean is wait for ( method method ) { return method get name ( ) starts with ( " wait for " ) ; }


test an oom situation where there are no containers that can be killed

public void test exception thrown with no containers to kill ( ) throws exception { context context = mock ( context class ) ; when ( context get containers ( ) ) then return ( new concurrent hash map < > ( 0 ) ) ; c groups handler c groups handler = mock ( c groups handler class ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , " " , cgroup param memory oom control ) ) then return ( " under oom 1 " ) then return ( " under oom 0 " ) ; default o o m handler handler = new default o o m handler ( context , false ) { @ override protected c groups handler get c groups handler ( ) { return c groups handler ; } } ; handler run ( ) ; }


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


set the max number of bytes that can be buffered by this decoder this is either the size of the entire input when decoding as a whole , or when using async parsing with aalto xml , it is the size of one top - level xml tree when the limit is exceeded , { @ link data buffer limit exception } is raised by default this is set to 256k

public void set max in memory size ( int byte count ) { this max in memory size = byte count ; this xml event decoder set max in memory size ( byte count ) ; }


verifies that we can create multiple tls client transports from the same builder

public void creating multiple tls transports should succeed ( ) throws exception { start server ( ) ; / / create a couple client transports protocol negotiator negotiator = new negotiator ( ) ; for ( int index = 0 ; index < 2 ; + + index ) { netty client transport transport = new transport ( negotiator ) ; call me maybe ( transport start ( client transport listener ) ) ; } / / send a single rpc on each transport final list < rpc > rpcs = new array list < > ( transports size ( ) ) ; for ( netty client transport transport : transports ) { rpcs add ( new rpc ( transport ) half close ( ) ) ; } / / wait for the r p cs to complete for ( rpc rpc : rpcs ) { rpc wait for response ( ) ; } }


{ @ inherit doc } the default implementation returns the result of calling { @ link # visit children } on { @ code ctx }

@ override public t visit single expression ( sql base parser single expression context ctx ) { return visit children ( ctx ) ; }


public void write raw ( byte [ ] bytes ) throws i o exception { out write ( bytes ) ; }


returns the class reader from which this symbol table was constructed

class reader get source ( ) { return source class reader ; }


whether or not the memory at the address for this model appears to be a valid location for a function information data type

protected void validate model specific info ( ) throws invalid data type exception { if ( ! has valid magic num ( ) ) { throw new invalid data type exception ( get name ( ) + " data type must contain a valid magic number , but doesn ' t at " + get address ( ) + " " ) ; } / / does at least one of our maps have a count if ( ( get unwind count ( ) = = 0 ) & & ( get try block count ( ) = = 0 ) & & ( get i p to state count ( ) = = 0 ) ) { throw new invalid data type exception ( get name ( ) + " data type doesn ' t have any map data " ) ; } / / are the pointers or displacements to valid addresses if ( ! is valid map ( get unwind count ( ) , get unwind map address ( ) ) ) { throw new invalid data type exception ( get name ( ) + " data type at " + get address ( ) + " doesn ' t have a valid unwind map " ) ; } if ( ! is valid map ( get try block count ( ) , get try block map address ( ) ) ) { throw new invalid data type exception ( get name ( ) + " data type at " + get address ( ) + " doesn ' t have a valid try block map " ) ; } if ( ! is valid map ( get i p to state count ( ) , get i p to state map address ( ) ) ) { throw new invalid data type exception ( get name ( ) + " data type at " + get address ( ) + " doesn ' t have a valid ip to state map " ) ; } if ( is v 2 | | is v 3 ) { address es type list address ; try { es type list address = get e s type list address ( ) ; } catch ( undefined value exception e ) { throw new assert exception ( e ) ; / / shouldn ' t occur unless bug in this class ' s code } if ( es type list address ! = null & & ! is valid map ( 1 , es type list address ) ) { throw new invalid data type exception ( get name ( ) + " data type at " + get address ( ) + " doesn ' t have a valid type list reference " ) ; } } }


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


if the field type passed in is byte , it will change it into blob as column type

public string object 2 relation ( string field type ) { if ( field type ! = null ) { if ( field type equals ( " [ b " ) ) { return " blob " ; } } return null ; }


return http headers with an " accept " header , or an empty instance

public http headers get response headers ( ) { if ( collection utils is empty ( this supported media types ) ) { return http headers empty ; } http headers headers = new http headers ( ) ; headers set accept ( this supported media types ) ; return headers ; }


configure a { @ link message header initializer } to apply to the headers of all messages sent to the client outbound channel by default this property is not set

public void set header initializer ( @ nullable message header initializer header initializer ) { this header initializer = header initializer ; }


public void set client role ( netty pool key transaction role client role ) { this client role = client role ; }


create mount links as follows hdfs : localhost : xxx h d f s user - - > hdfs : localhost : xxx h d f s user hdfs : localhost : xxxlocal - - > file : test root d i rroot list status on should list the mount links

public void test list status on root should list all mount links ( ) throws exception { final path hdfs target path = new path ( default f s u r i + hdfs user folder ) ; add mount links ( default f s u r i get authority ( ) , new string [ ] { hdfs user folder , local folder } , new string [ ] { hdfs target path to uri ( ) to string ( ) , local target dir to u r i ( ) to string ( ) } , conf ) ; try ( distributed file system dfs = new distributed file system ( ) ) { dfs initialize ( default f s u r i , conf ) ; dfs mkdirs ( hdfs target path ) ; } try ( raw local file system lfs = new raw local file system ( ) ) { lfs initialize ( local target dir to u r i ( ) , conf ) ; lfs mkdirs ( new path ( local target dir to u r i ( ) ) ) ; } try ( file system fs = file system get ( conf ) ) { fs mkdirs ( hdfs target path ) ; file status [ ] ls = fs list status ( new path ( " / " ) ) ; assert assert equals ( 2 , ls length ) ; string ls path 1 = path get path without scheme and authority ( ls [ 0 ] get path ( ) ) to string ( ) ; string ls path 2 = path get path without scheme and authority ( ls [ 1 ] get path ( ) ) to string ( ) ; assert assert true ( hdfs user folder equals ( ls path 1 ) | | local folder equals ( ls path 1 ) ) ; assert assert true ( hdfs user folder equals ( ls path 2 ) | | local folder equals ( ls path 2 ) ) ; } }


check the class file with the given name , assuming the current path is part of the classpath

public class name subject with class ( string class name ) { if ( actual = = null ) { fail without actual ( simple fact ( " expected not to be null " ) ) ; } exists ( ) ; return check ( " class ( % s ) " , class name ) about ( class name subject class names ( actual ) ) that ( class name ) ; }


purges the snapshot and logs keeping the last num snapshots and the corresponding logs if logs are rolling or a new snapshot is created during this process , these newest n snapshots or any data logs will be excluded from current purging cycle

public static void purge ( file data dir , file snap dir , int num ) throws i o exception { if ( num < 3 ) { throw new illegal argument exception ( count err msg ) ; } file txn snap log txn log = new file txn snap log ( data dir , snap dir ) ; list < file > snaps = txn log find n valid snapshots ( num ) ; int num snaps = snaps size ( ) ; if ( num snaps > 0 ) { purge older snapshots ( txn log , snaps get ( num snaps - 1 ) ) ; } }


sets the number of directories to eagerly traverse on the first glob for a given package , in order to warm the filesystem - 1 means do no eager traversal see { @ link com google devtools build lib pkgcache package options # max directories to eagerly visit in globbing } - 2 means do the eager traversal using the regular globbing infrastructure , i e sharing the globbing threads and caching the actual glob results

public void set max directories to eagerly visit in globbing ( int max directories to eagerly visit in globbing ) { this max directories to eagerly visit in globbing = max directories to eagerly visit in globbing ; }


returns true if the relation exists , between an inferior ( callee ) function and a full hash representing the superior ( caller ) function

public boolean get inferior full relation ( fid hash quad superior function , function record inferior function ) { try { d b record library by i d = libraries table get library by i d ( inferior function get library i d ( ) ) ; if ( library by i d ! = null ) { return relations table get inferior full relation ( superior function , inferior function ) ; } } catch ( i o exception e ) { msg error ( this , " serious problem in get inferior full relation " , e ) ; } return false ; }


ignore the differences for the indicated address set

public void ignore ( address set view p 1 address set ) { program diff ignore ( p 1 address set ) ; }


public double get double ( ) { return double ; }


bind using single configured port if find port is true , we will try to bind after incrementing port till a free port is found

private void bind for single port ( server connector listener , int port ) throws exception { while ( true ) { try { bind listener ( listener ) ; break ; } catch ( i o exception ex ) { if ( port = = 0 | | ! find port ) { throw construct bind exception ( listener , ex ) ; } } / / try the next port number listener set port ( + + port ) ; thread sleep ( 100 ) ; } }


short - circuit integer : no threadsemaphore : thread thread pool full integer : no thread pool queue full integer : no timeout : no execution result : async hystrix runtime exception fallback : sync hystrix runtime exception

public void test execution hook thread async exception sync unsuccessful fallback ( ) { assert hooks on failure ( new func 0 < test hystrix observable command < integer > > ( ) { @ override public test hystrix observable command < integer > call ( ) { return get command ( execution isolation strategy thread , abstract test hystrix command execution result async failure , abstract test hystrix command fallback result failure ) ; } } , new action 1 < test hystrix observable command < integer > > ( ) { @ override public void call ( test hystrix observable command < integer > command ) { testable execution hook hook = command get builder ( ) execution hook ; assert true ( hook command emissions match ( 0 , 1 , 0 ) ) ; assert true ( hook execution events match ( 0 , 1 , 0 ) ) ; assert true ( hook fallback events match ( 0 , 1 , 0 ) ) ; assert equals ( runtime exception class , hook get command exception ( ) get class ( ) ) ; assert equals ( runtime exception class , hook get execution exception ( ) get class ( ) ) ; assert equals ( runtime exception class , hook get fallback exception ( ) get class ( ) ) ; assert equals ( " on start - on thread start - ! on run start - on execution start - on execution error - ! on run error - on thread complete - on fallback start - on fallback error - on error - " , command get builder ( ) execution hook execution sequence to string ( ) ) ; } } ) ; }


public long get long ( int select 1 , int select 2 ) { switch ( select 1 ) { case space : return space i d ; case offset : try { switch ( select 2 ) { case space : return ptr get space ( ) ; case offset : return ptr get offset ( ) ; case size : return ptr get size ( ) ; } return 0 ; / / should never occur } catch ( exception e ) { return 0 ; / / should never occur } case size : return size ; default : / / should never occur return 0 ; } }


private void records deleted ( final int count ) { instrumentation records deleted ( count ) ; }


returns the class of labels contained by this type , if any

public label class get label class ( ) { return label class none ; }


compare this location ' s address with another location ' s given that they are both within the same address space

private int compare address same space ( address based location other location ) { if ( address is external address ( ) | | address is variable address ( ) | | address is register address ( ) ) { / / these address types have meaningless address offsets return string representation compare to ( other location string representation ) ; } / / for most space types use space specific sort of address when space is the same int rc = address compare to ( other location address ) ; if ( rc = = 0 ) { / / for the same memory offset , after normal addresses and memory references / / are shifted references followed by offset references if ( is shifted address ( ) ) { if ( other location is offset address ( ) ) { rc = - 1 ; } else if ( other location is shifted address ( ) ) { rc = string representation compare to ( other location string representation ) ; } else { rc = 1 ; } } else if ( is offset address ( ) ) { if ( ! other location is offset address ( ) ) { rc = 1 ; } } else if ( other location is offset address ( ) | | other location is shifted address ( ) ) { rc = - 1 ; } } return rc ; }


public http response do snooze ( ) throws i o exception { jenkins get ( ) check permission ( jenkins administer ) ; file f = setup wizard get update state file ( ) ; file utils touch ( f ) ; f set last modified ( system current time millis ( ) + time unit days to millis ( 1 ) ) ; logger log ( fine , " snoozed the upgrade wizard notice " ) ; return http responses redirect to context root ( ) ; }


the default heuristic on whether we need to use whole - archive for the link

private static boolean need whole archive ( feature configuration feature configuration , linking mode linking mode , link target type type , collection < string > linkopts , cpp configuration cpp config ) { boolean shared linkopts = type is dynamic library ( ) | | linkopts contains ( " - shared " ) | | cpp config has shared link option ( ) ; / / fasten your seat belt , the logic below doesn ' t make perfect sense and it ' s full of obviously / / missed corner cases the world still stands and depends on this behavior , so ¯ \ ( ツ ) / ¯ if ( ! shared linkopts ) { / / we are not producing shared library , there is no reason to use - - whole - archive with / / executable ( if the executable doesn ' t use the symbols , nobody else will , so - - whole - archive / / is not needed ) return false ; } if ( cpp config remove legacy whole archive ( ) ) { / / - - incompatible remove legacy whole archive has been flipped , no - - whole - archive for the / / entire build return false ; } if ( linking mode ! = linking mode static ) { / / legacy whole archive only applies to static linking mode return false ; } if ( feature configuration get requested features ( ) contains ( cpp rule classes legacy whole archive ) ) { / / - - incompatible remove legacy whole archive has not been flipped , and this target requested / / - - whole - archive using features return true ; } if ( cpp config legacy whole archive ( ) ) { / / - - incompatible remove legacy whole archive has not been flipped , so whether to / / use - - whole - archive depends on - - legacy whole archive return true ; } / / hopefully future default return false ; }


like { @ link # peek ( byte [ ] , int , int ) } , but peeks the requested { @ code length } in full

boolean peek fully ( byte [ ] target , int offset , int length , boolean allow end of input ) throws i o exception ;


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


public final int length ( ) { return longs length ( ) ; }


get insufficient resource names via comparing required resource and capacity resource

public abstract set < string > get insufficient resource names ( resource required , resource available ) ;


convert word like { @ code } or { @ code id } or { @ code expr } to a path element { @ code anywhere } is { @ code true } if { @ code } precedes the word

protected x path element get x path element ( token word token , boolean anywhere ) { if ( word token get type ( ) = = token eof ) { throw new illegal argument exception ( " missing path element at end of path " ) ; } string word = word token get text ( ) ; int ttype = parser get token type ( word ) ; int rule index = parser get rule index ( word ) ; switch ( word token get type ( ) ) { case x path lexer wildcard : return anywhere ? new x path wildcard anywhere element ( ) : new x path wildcard element ( ) ; case x path lexer token ref : case x path lexer string : if ( ttype = = token invalid type ) { throw new illegal argument exception ( word + " at index " + word token get start index ( ) + " isn ' t a valid token name " ) ; } return anywhere ? new x path token anywhere element ( word , ttype ) : new x path token element ( word , ttype ) ; default : if ( rule index = = - 1 ) { throw new illegal argument exception ( word + " at index " + word token get start index ( ) + " isn ' t a valid rule name " ) ; } return anywhere ? new x path rule anywhere element ( word , rule index ) : new x path rule element ( word , rule index ) ; } }


creates a builder for new client - side { @ link ssl context }

public static ssl context builder for client ( ) { return new ssl context builder ( false ) ; }


public void test no record length ( ) throws i o exception { local fs delete ( work dir , true ) ; path file = new path ( work dir , new string ( " test format txt " ) ) ; create file ( file , null , 10 , 10 ) ; / / set the fixed length record length config property job conf job = new job conf ( default conf ) ; file input format set input paths ( job , work dir ) ; fixed length input format format = new fixed length input format ( ) ; format configure ( job ) ; input split splits [ ] = format get splits ( job , 1 ) ; boolean exception thrown = false ; for ( input split split : splits ) { try { record reader < long writable , bytes writable > reader = format get record reader ( split , job , void reporter ) ; } catch ( i o exception ioe ) { exception thrown = true ; log info ( " exception message : " + ioe get message ( ) ) ; } } assert true ( " exception for not setting record length : " , exception thrown ) ; }


creates a { @ link transaction } out of an existing connection

transaction new transaction ( connection conn ) ;


verify that at least one segment does not hit disk

public void test reduce from partial mem ( ) throws exception { final int map tasks = 7 ; job conf job = mr cluster create job conf ( ) ; job set num map tasks ( map tasks ) ; job set int ( job context reduce merge inmem threshold , 0 ) ; job set ( job context reduce input buffer percent , " 1 0 " ) ; job set int ( job context shuffle parallel copies , 1 ) ; job set int ( job context io sort mb , 10 ) ; job set ( job conf mapred reduce task java opts , " - xmx 1 2 8m " ) ; job set long ( job context reduce memory total bytes , 128 < < 20 ) ; job set ( job context shuffle input buffer percent , " 0 14 " ) ; job set ( job context shuffle merge percent , " 1 0 " ) ; counters c = run job ( job ) ; final long out = c find counter ( task counter map output records ) get counter ( ) ; final long spill = c find counter ( task counter spilled records ) get counter ( ) ; assert true ( " expected some records not spilled during reduce " + spill + " ) " , spill < 2 * out ) ; / / spilled map records , some records at the reduce }


< code > optional aapt pb array array = 4 ; < code >

private void set array ( com android aapt resources array builder builder for value ) { array = builder for value build ( ) ; bit field 0 | = 0x 0 0 0 0 0 0 0 8 ; }


returns the number of relocations pointed to by the pointer to relocations field

public short get number of relocations ( ) { return number of relocations ; }


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


gets all windows in the system ( including frames )

public static set < window > get all windows ( ) { set < window > set = new hash set < > ( ) ; frame shared owner frame = ( frame ) app context get app context ( ) get ( new string buffer ( " swing utilities shared owner frame " ) ) ; if ( shared owner frame ! = null ) { set add all ( get all windows ( shared owner frame ) ) ; } for ( frame frame : frame get frames ( ) ) { set add all ( get all windows ( frame ) ) ; } window [ ] windows = window get windows ( ) ; for ( window window : windows ) { set add ( window ) ; } return set ; }


set whether to let jackson find available modules via the jdk service loader , based on meta - inf metadata in the classpath requires jackson 2 2 or higher if this mode is not set , spring ' s jackson 2 object mapper factory bean itself will try to find the jsr - 310 and joda - time support modules on the classpath - provided that java 8 and joda - time themselves are available , respectively

public void set find modules via service loader ( boolean find modules ) { this builder find modules via service loader ( find modules ) ; }


public void proxy ( string server , string api , map < string , string > params , http method method ) throws exception { / / do proxy if ( ! i p util contains port ( server ) ) { server = server + i p util ip port spliter + env util get port ( ) ; } string url = " http : / / " + server + env util get context path ( ) + api ; rest result < string > result ; switch ( method ) { case get : result = http client http get ( url , null , params ) ; break ; case post : result = http client http post ( url , null , params ) ; break ; case delete : result = http client http delete ( url , null , params ) ; break ; default : throw new runtime exception ( " unsupported method : " + method ) ; } if ( ! result ok ( ) ) { throw new illegal state exception ( " leader failed , caused by : " + result get message ( ) ) ; } }


public static service info from key ( string key ) { service info service info = new service info ( ) ; int max seg count = 3 ; string [ ] segs = key split ( constants service info spliter ) ; if ( segs length = = max seg count - 1 ) { service info set group name ( segs [ 0 ] ) ; service info set name ( segs [ 1 ] ) ; } else if ( segs length = = max seg count ) { service info set group name ( segs [ 0 ] ) ; service info set name ( segs [ 1 ] ) ; service info set clusters ( segs [ 2 ] ) ; } return service info ; }


set the ordered list of scripts to execute immediately following import and and analysis of a program if import not performed , these scripts will execute once following any pre - scripts

public void set post scripts ( list < string > post scripts ) { list < pair < string , string [ ] > > post scripts empty args = new linked list < > ( ) ; for ( string post script : post scripts ) { post scripts empty args add ( new pair < > ( post script , new string [ 0 ] ) ) ; } set post scripts with args ( post scripts empty args ) ; }


return any i o statistics provided by the underlying stream

public i o statistics get i o statistics ( ) { return i o statistics support retrieve i o statistics ( in ) ; }


get { @ link file status } of filesdirectories in the given path if path corresponds to a file then { @ link file status } of that file is returned else if path represents a directory then { @ link file status } of all filesdirectories inside given path is returned

public file status [ ] list status ( path f ) throws i o exception { map < string , string > params = new hash map < string , string > ( ) ; params put ( op param , operation liststatus to string ( ) ) ; http u r l connection conn = get connection ( operation liststatus get method ( ) , params , f , true ) ; http exception utils validate response ( conn , http u r l connection http ok ) ; j s o n object json = ( j s o n object ) http f s utils json parse ( conn ) ; return to file statuses ( json , f ) ; }


tests that blocking request of multi local buffer pools can be fulfilled by recycled segments to the global network buffer pool

public void test blocking request from multi local buffer pool ( ) throws i o exception , interrupted exception { final int local pool required size = 5 ; final int local pool max size = 10 ; final int num local buffer pool = 2 ; final int number of segments to request = 10 ; final int num buffers = num local buffer pool * local pool max size ; final executor service executor service = executors new fixed thread pool ( num local buffer pool ) ; final network buffer pool global pool = new network buffer pool ( num buffers , 128 ) ; final list < buffer pool > local buffer pools = new array list < > ( num local buffer pool ) ; try { / / create local buffer pools for ( int i = 0 ; i < num local buffer pool ; + + i ) { final buffer pool local pool = global pool create buffer pool ( local pool required size , local pool max size ) ; local buffer pools add ( local pool ) ; assert true ( local pool get available future ( ) is done ( ) ) ; } / / request some segments from the global pool in two different ways final list < memory segment > segments = new array list < > ( number of segments to request - 1 ) ; for ( int i = 0 ; i < number of segments to request - 1 ; + + i ) { segments add ( global pool request memory segment ( ) ) ; } final list < memory segment > exclusive segments = global pool request memory segments ( global pool get number of available memory segments ( ) - 1 ) ; assert true ( global pool get available future ( ) is done ( ) ) ; for ( final buffer pool local pool : local buffer pools ) { assert true ( local pool get available future ( ) is done ( ) ) ; } / / blocking request buffers form local buffer pools final count down latch latch = new count down latch ( num local buffer pool ) ; final blocking queue < buffer builder > segments requested = new array blocking queue < > ( num buffers ) ; final atomic reference < throwable > cause = new atomic reference < > ( ) ; for ( final buffer pool local pool : local buffer pools ) { executor service submit ( ( ) - > { try { for ( int num = local pool max size ; num > 0 ; - - num ) { segments requested add ( local pool request buffer builder blocking ( ) ) ; } } catch ( exception e ) { cause set ( e ) ; } finally { latch count down ( ) ; } } ) ; } / / wait until all available buffers are requested while ( segments requested size ( ) + segments size ( ) + exclusive segments size ( ) < num buffers ) { thread sleep ( 100 ) ; assert null ( cause get ( ) ) ; } final completable future < ? > global pool available future = global pool get available future ( ) ; assert false ( global pool available future is done ( ) ) ; final list < completable future < ? > > local pool available futures = new array list < > ( num local buffer pool ) ; for ( buffer pool local pool : local buffer pools ) { completable future < ? > local pool available future = local pool get available future ( ) ; local pool available futures add ( local pool available future ) ; assert false ( local pool available future is done ( ) ) ; } / / recycle the previously requested segments for ( memory segment segment : segments ) { global pool recycle ( segment ) ; } global pool recycle memory segments ( exclusive segments ) ; assert true ( global pool available future is done ( ) ) ; for ( completable future < ? > local pool available future : local pool available futures ) { assert true ( local pool available future is done ( ) ) ; } / / wait until all blocking buffer requests finish latch await ( ) ; assert null ( cause get ( ) ) ; assert equals ( 0 , global pool get number of available memory segments ( ) ) ; assert false ( global pool get available future ( ) is done ( ) ) ; for ( buffer pool local pool : local buffer pools ) { assert false ( local pool get available future ( ) is done ( ) ) ; assert equals ( local pool max size , local pool best effort get num of used buffers ( ) ) ; } / / recycle all the requested buffers for ( buffer builder buffer builder : segments requested ) { buffer builder create buffer consumer ( ) close ( ) ; } } finally { for ( buffer pool buffer pool : local buffer pools ) { buffer pool lazy destroy ( ) ; } executor service shutdown ( ) ; global pool destroy ( ) ; } }


returns a { @ link config matching provider } that matches if the owning target ' s platform includes this constraint the { @ link com google devtools build lib rules platform constraint value } rule can ' t directly return a { @ link config matching provider } because , as part of a platform ' s definition , it doesn ' t have access to the platform during its analysis instead , a target with a < code > select ( ) < code > on a { @ link com google devtools build lib rules platform constraint value } passes its platform info to this method

public config matching provider config matching provider ( platform info platform info ) { return new config matching provider ( label , immutable multimap of ( ) , immutable map of ( ) , / / technically a select ( ) on a constraint value requires platform configuration , since that ' s / / used to build the platform this checks against but platform info ' s existence implies / / the owning target already depends on platform configuration and we can ' t reference / / platform configuration class here without a build dependency cycle immutable set of ( ) , platform info constraints ( ) has constraint value ( this ) ) ; }


public static starlark int add ( starlark int x , starlark int y ) { if ( x instanceof int 3 2 & & y instanceof int 3 2 ) { long xl = ( ( int 3 2 ) x ) v ; long yl = ( ( int 3 2 ) y ) v ; return starlark int of ( xl + yl ) ; } / / we avoid math add exact and its overheads of exception allocation try { long xl = x to long fast ( ) ; long yl = y to long fast ( ) ; long zl = xl + yl ; boolean overflow = ( ( xl ^ zl ) & ( yl ^ zl ) ) < 0 ; / / see hacker ' s delight , chapter 2 if ( ! overflow ) { return starlark int of ( zl ) ; } } catch ( overflow unused ) { / * fall through * / } big integer xbig = x to big integer ( ) ; big integer ybig = y to big integer ( ) ; big integer zbig = xbig add ( ybig ) ; return starlark int of ( zbig ) ; }


returns a new builder that initially holds the same keyvalue pairs as this starlark semantics

public builder to builder ( ) { return new builder ( new tree map < > ( map ) ) ; }


main function of the router fed balance program parses the input arguments and invokes the router fed balance : : run ( ) method , via the tool runner

public static void main ( string [ ] argv ) { configuration conf = get default conf ( ) ; router fed balance fed balance = new router fed balance ( ) ; fed balance set conf ( conf ) ; int exit code ; try { exit code = tool runner run ( fed balance , argv ) ; } catch ( exception e ) { log warn ( " couldn ' t complete router fed balance operation " , e ) ; exit code = - 1 ; } system exit ( exit code ) ; }


private void on hit ( node node ) { node move to tail ( head ) ; }


confirm that the shutdown if the instance should be done now !

protected boolean confirm shutdown ( ) { if ( ! is shutting down ( ) ) { return false ; } if ( ! in event loop ( ) ) { throw new illegal state exception ( " must be invoked from an event loop " ) ; } cancel scheduled tasks ( ) ; if ( graceful shutdown start time = = 0 ) { graceful shutdown start time = scheduled future task nano time ( ) ; } if ( run all tasks ( ) | | run shutdown hooks ( ) ) { if ( is shutdown ( ) ) { / / executor shut down - no new tasks anymore return true ; } / / there were tasks in the queue wait a little bit more until no tasks are queued for the quiet period or / / terminate if the quiet period is 0 / / see https : / / github com / netty / netty / issues / 4241 if ( graceful shutdown quiet period = = 0 ) { return true ; } task queue offer ( wakeup task ) ; return false ; } final long nano time = scheduled future task nano time ( ) ; if ( is shutdown ( ) | | nano time - graceful shutdown start time > graceful shutdown timeout ) { return true ; } if ( nano time - last execution time < = graceful shutdown quiet period ) { / / check if any tasks were added to the queue every 1 0 0ms / / todo : change the behavior of take task ( ) so that it returns on timeout task queue offer ( wakeup task ) ; try { thread sleep ( 100 ) ; } catch ( interrupted exception e ) { / / ignore } return false ; } / / no tasks were added for last quiet period - hopefully safe to shut down / / ( hopefully because we really cannot make a guarantee that there will be no execute ( ) calls by a user ) return true ; }


sets the maximum number of queued control frames that are allowed before the connection is closed this allows to protected against various attacks that can lead to high cpu memory usage if the remote - peer floods us with frames that would have us produce control frames , but stops to read from the underlying socket { @ code 0 } means no protection should be applied

protected b encoder enforce max queued control frames ( int max queued control frames ) { enforce non codec constraints ( " encoder enforce max queued control frames " ) ; this max queued control frames = object util check positive or zero ( max queued control frames , " max queued control frames " ) ; return self ( ) ; }


creates list of users with given input array

public void create users with list input test ( ) { list < user > body = null ; / / api create users with list input ( body ) ; / / todo : test validations }


group the records by their current key into a { @ link k grouped stream } while preserving the original values and using the serializers as defined by { @ link serialized } { @ link k grouped stream } can be further grouped with other streams to form a { @ link cogrouped k stream } grouping a stream on the record key is required before an aggregation operator can be applied to the data ( cf { @ link k grouped stream } ) if a record key is { @ code null } the record will not be included in the resulting { @ link k grouped stream } if a key changing operator was used before this operation ( e g , { @ link # select key ( key value mapper ) } , { @ link # map ( key value mapper ) } , { @ link # flat map ( key value mapper ) } or { @ link # transform ( transformer supplier , string ) } ) an internal repartitioning topic may need to be created in kafka if a later operator depends on the newly selected key this topic will be named " $ { application id } - & lt ; name & gt ; - repartition " , where " application id " is user - specified in { @ link streams config } via parameter { @ link streams config # application id config application id config } , " & lt ; name & gt ; " is an internally generated name , and " - repartition " is a fixed suffix you can retrieve all generated internal topic names via { @ link topology # describe ( ) } for this case , all data of this stream will be redistributed through the repartitioning topic by writing all records to it , and rereading all records from it , such that the resulting { @ link k grouped stream } is partitioned correctly on its key

k grouped stream < k , v > group by key ( final serialized < k , v > serialized ) ;


create a { @ code document builder } that this marshaller will use for creating dom documents when passed an empty { @ code d o m source } the resulting { @ code document builder factory } is cached , so this method will only be called once

protected document builder factory create document builder factory ( ) throws parser configuration exception { document builder factory factory = document builder factory new instance ( ) ; factory set validating ( false ) ; factory set namespace aware ( true ) ; factory set feature ( " http : / / apache org / xml / features / disallow - doctype - decl " , ! is support dtd ( ) ) ; factory set feature ( " http : / / xml org / sax / features / external - general - entities " , is process external entities ( ) ) ; return factory ; }


public map < string , object > get params ( ) { return params ; }


determine whether or not a parse tree matches this tree pattern

public boolean matches ( parse tree tree ) { return matcher match ( tree , this ) succeeded ( ) ; }


the series of types defined by the package < code > repeated aapt pb type type = 3 ; < code >

public com android aapt resources type or builder get type or builder ( int index ) { return type get ( index ) ; }


the exceptions below extend their parent classes in order to additionally store the error that caused them however , they must impersonate their parents to any outside callers , including in their to string ( ) method , which prints the class name followed by the exception method this method returns the same value as the to string ( ) method of a { @ link throwable } ' s parent would , so that the child class can have the same to string ( ) value

private static string parent throwable to string ( throwable obj ) { string s = obj get class ( ) get superclass ( ) get name ( ) ; string message = obj get localized message ( ) ; return ( message ! = null ) ? ( s + " : " + message ) : s ; }


creates an unicast subject with the given internal buffer capacity hint

public static < t > unicast subject < t > create ( int capacity hint ) { object helper verify positive ( capacity hint , " capacity hint " ) ; return new unicast subject < > ( capacity hint , null , true ) ; }


returns the artifact for the debug key for signing the apk

static immutable list < artifact > get apk debug signing keys ( rule context rule context ) { immutable list < artifact > keys = rule context get prerequisite artifacts ( " debug signing keys " ) list ( ) ; if ( ! keys is empty ( ) ) { return keys ; } return immutable list of ( rule context get host prerequisite artifact ( " debug key " ) ) ; }


get the number of partitions for the given topic

public integer partition count for topic ( string topic ) { list < partition info > partitions = this partitions by topic get ( topic ) ; return partitions = = null ? null : partitions size ( ) ; }


specify the { @ code resource } from which mappings are loaded needs to follow the { @ code mime types } file format , as specified by the java activation framework , containing lines such as : < br > { @ code texthtml html htm html htm }

public void set mapping location ( resource mapping location ) { this mapping location = mapping location ; }


public void move to tail ( ) { / / unlink prev next = next ; next prev = prev ; / / link next = sentinel ; prev = sentinel prev ; sentinel prev = this ; prev next = this ; }


this storage is considered equal if it consists of the same storage varnodes

public boolean equals ( object obj ) { if ( ! ( obj instanceof variable storage ) ) { return false ; } variable storage other v s = ( variable storage ) obj ; if ( is auto storage ( ) ! = other v s is auto storage ( ) ) { return false ; } if ( is forced indirect ( ) ! = other v s is forced indirect ( ) ) { return false ; } if ( is bad storage ( ) ! = other v s is bad storage ( ) ) { return false ; } if ( is unassigned storage ( ) ! = other v s is unassigned storage ( ) ) { return false ; } if ( is void storage ( ) ! = other v s is void storage ( ) ) { return false ; } return compare to ( other v s ) = = 0 ; }


convert the given object to string with each line indented by 4 spaces ( except the first line )

private string to indented string ( object o ) { if ( o = = null ) { return " null " ; } return o to string ( ) replace ( " \ n " , " \ n " ) ; }