process any dynamic name conflict and determine if there is any direct name conflict note : this method eliminates any conflict between a defined function name and a dynamic , fun , function name

private boolean has unresolved function name conflict ( function [ ] functions , task monitor monitor ) { string original name = ( functions [ original ] ! = null ) ? functions [ original ] get name ( ) : " " ; string latest name = ( functions [ latest ] ! = null ) ? functions [ latest ] get name ( ) : " " ; string my name = ( functions [ my ] ! = null ) ? functions [ my ] get name ( ) : " " ; boolean original is default = is default name ( functions [ original ] ) ; boolean latest is default = is default name ( functions [ latest ] ) ; boolean my is default = is default name ( functions [ my ] ) ; boolean latest and my are same = latest name equals ( my name ) | | ( latest is default & & my is default ) ; boolean original and latest are same = original name equals ( latest name ) | | ( original is default & & latest is default ) ; boolean original and my are same = original name equals ( my name ) | | ( original is default & & my is default ) ; if ( latest and my are same ) { return false ; / / latest & my are same result is already latest so leave alone } if ( original and my are same ) { return false ; / / want latest result is already latest so leave alone } if ( original and latest are same ) { / / want my address my entry point = functions [ my ] get entry point ( ) ; merge function detail ( func name , my entry point , get merge my ( ) , monitor ) ; return false ; } / / otherwise both changed the name if latest or my is a default then keep the other name if ( latest is default ) { / / keep my address my entry point = functions [ my ] get entry point ( ) ; merge function detail ( func name , my entry point , get merge my ( ) , monitor ) ; return false ; } if ( my is default ) { / / keep latest return false ; } return true ; / / latest & my aren ' t defaults and were changed , so they conflict }


get the effective permission for the acl entry

public fs action get effective permission ( acl entry entry ) { return get effective permission ( entry , permission ) ; }


public final annotation get annotation ( ) { return annotation strategy get annotation ( ) ; }


uploads a ( different ) byte array for each of the given jobs and verifies that deleting one of them ( via the { @ link blob cache service } ) does not influence the other

private void test delete ( @ nullable job i d job id 1 , @ nullable job i d job id 2 ) throws i o exception { final configuration config = new configuration ( ) ; config set string ( blob server options storage directory , temporary folder new folder ( ) get absolute path ( ) ) ; try ( blob server server = new blob server ( config , new void blob store ( ) ) ; blob cache service cache = new blob cache service ( config , new void blob store ( ) , new inet socket address ( " localhost " , server get port ( ) ) ) ) { server start ( ) ; byte [ ] data = new byte [ 2000000 ] ; rnd next bytes ( data ) ; byte [ ] data 2 = arrays copy of ( data , data length ) ; data 2 [ 0 ] ^ = 1 ; / / put first blob transient blob key key 1 = ( transient blob key ) put ( server , job id 1 , data , transient blob ) ; assert not null ( key 1 ) ; / / put two more b l o bs ( same key , other key ) for another job id transient blob key key 2a = ( transient blob key ) put ( server , job id 2 , data , transient blob ) ; assert not null ( key 2a ) ; blob key test verify key different hash equals ( key 1 , key 2a ) ; transient blob key key 2b = ( transient blob key ) put ( server , job id 2 , data 2 , transient blob ) ; assert not null ( key 2b ) ; blob key test verify key different hash different ( key 1 , key 2b ) ; / / issue a delete request assert true ( delete ( cache , job id 1 , key 1 ) ) ; / / delete only works on local cache ! assert true ( server get storage location ( job id 1 , key 1 ) exists ( ) ) ; / / delete on server so that the cache cannot re - download assert true ( server delete internal ( job id 1 , key 1 ) ) ; verify deleted ( cache , job id 1 , key 1 ) ; / / deleting one blob should not affect another blob with a different key / / ( and keys are always different now ) verify contents ( server , job id 2 , key 2a , data ) ; verify contents ( server , job id 2 , key 2b , data 2 ) ; / / delete first file of second job assert true ( delete ( cache , job id 2 , key 2a ) ) ; / / delete only works on local cache assert true ( server get storage location ( job id 2 , key 2a ) exists ( ) ) ; / / delete on server so that the cache cannot re - download assert true ( server delete internal ( job id 2 , key 2a ) ) ; verify deleted ( cache , job id 2 , key 2a ) ; verify contents ( server , job id 2 , key 2b , data 2 ) ; / / delete second file of second job assert true ( delete ( cache , job id 2 , key 2b ) ) ; / / delete only works on local cache assert true ( server get storage location ( job id 2 , key 2b ) exists ( ) ) ; / / delete on server so that the cache cannot re - download assert true ( server delete internal ( job id 2 , key 2b ) ) ; verify deleted ( cache , job id 2 , key 2b ) ; } }


exit a parse tree produced by the { @ code constant default } labeled alternative in { @ link eql base parser # primary expression }

void exit constant default ( eql base parser constant default context ctx ) ;


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

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


public void initialize ( ) throws i o exception { try { src pattern = pattern compile ( src path regex ) ; } catch ( pattern syntax exception ex ) { throw new i o exception ( " failed to initialized mount point due to bad src path regex : " + src path regex + " , dst path : " + dst path , ex ) ; } var in dest path map = get var list in string ( dst path ) ; initialize interceptors ( ) ; }


filter a bean - defined listener early through checking its generically declared event type before trying to instantiate it if this method returns { @ code true } for a given listener as a first pass , the listener instance will get retrieved and fully evaluated through a { @ link # supports event ( application listener , resolvable type , class ) } call afterwards

private boolean supports event ( configurable bean factory bean factory , string listener bean name , resolvable type event type ) { class < ? > listener type = bean factory get type ( listener bean name ) ; if ( listener type = = null | | generic application listener class is assignable from ( listener type ) | | smart application listener class is assignable from ( listener type ) ) { return true ; } if ( ! supports event ( listener type , event type ) ) { return false ; } try { bean definition bd = bean factory get merged bean definition ( listener bean name ) ; resolvable type generic event type = bd get resolvable type ( ) as ( application listener class ) get generic ( ) ; return ( generic event type = = resolvable type none | | generic event type is assignable from ( event type ) ) ; } catch ( no such bean definition exception ex ) { / / ignore - no need to check resolvable type for manually registered singleton return true ; } }


root object mapper root ( ) { return root ; }


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

public static fields find by name ( string name ) { return by name get ( name ) ; }


loads and parses the groovy script via the groovy class loader

public object get scripted object ( script source script source , @ nullable class < ? > actual interfaces ) throws i o exception , script compilation exception { synchronized ( this script class monitor ) { try { class < ? > script class to execute ; this was modified for type check = false ; if ( this cached result ! = null ) { object result = this cached result object ; this cached result = null ; return result ; } if ( this script class = = null | | script source is modified ( ) ) { / / new script content this script class = get groovy class loader ( ) parse class ( script source get script as string ( ) , script source suggested class name ( ) ) ; if ( script class is assignable from ( this script class ) ) { / / a groovy script , probably creating an instance : let ' s execute it object result = execute script ( script source , this script class ) ; this script result class = ( result ! = null ? result get class ( ) : null ) ; return result ; } else { this script result class = this script class ; } } script class to execute = this script class ; / / process re - execution outside of the synchronized block return execute script ( script source , script class to execute ) ; } catch ( compilation failed exception ex ) { this script class = null ; this script result class = null ; throw new script compilation exception ( script source , ex ) ; } } }


callback when ping ack was not received in keepalive timeout should shutdown the transport


client invoked methods are invoked over rpc and will be in rpc call context even if the client exits

boolean is external invocation ( ) { return server is rpc invocation ( ) ; }


returns the existing { @ link s s l context holder } for the configuration

s s l context holder ssl context holder ( s s l configuration ssl configuration ) { s s l context holder holder = ssl contexts get ( ssl configuration ) ; if ( holder = = null ) { / / normally we ' d throw here but let ' s create a new one that is not cached and will not be monitored for changes ! holder = create ssl context ( ssl configuration ) ; } return holder ; }


get a filename for a temp file the generated file is deleted

protected file temp audit file ( ) throws i o exception { final file audit = file create temp file ( " audit " , " txt " ) ; audit delete ( ) ; return audit ; }


validates the parameters and creates an { @ link stored script source }

private stored script source build ( boolean ignore empty ) { if ( lang = = null ) { throw new illegal argument exception ( " must specify lang for stored script " ) ; } else if ( lang is empty ( ) ) { throw new illegal argument exception ( " lang cannot be empty " ) ; } if ( source = = null ) { if ( ignore empty | | script default template lang equals ( lang ) ) { if ( script default template lang equals ( lang ) ) { deprecation logger deprecate ( " empty templates " , " empty templates should no longer be used " ) ; } else { deprecation logger deprecate ( " empty scripts " , " empty scripts should no longer be used " ) ; } } else { throw new illegal argument exception ( " must specify source for stored script " ) ; } } else if ( source is empty ( ) ) { if ( ignore empty | | script default template lang equals ( lang ) ) { if ( script default template lang equals ( lang ) ) { deprecation logger deprecate ( " empty templates " , " empty templates should no longer be used " ) ; } else { deprecation logger deprecate ( " empty scripts " , " empty scripts should no longer be used " ) ; } } else { throw new illegal argument exception ( " source cannot be empty " ) ; } } if ( options size ( ) > 1 | | options size ( ) = = 1 & & options get ( script content type option ) = = null ) { throw new illegal argument exception ( " illegal compiler options [ " + options + " ] specified " ) ; } return new stored script source ( lang , source , options ) ; }


compute the first offset of the given slice

private static long start offset ( int level , long slice ) { return slice < < level ; }


test with null location its unclear whenif this happens , see https : bugs openjdk java netbrowse j d k - 8129972

public void test null location ( ) throws exception { assume true ( " test cannot run with security manager " , system get security manager ( ) = = null ) ; permission collection no permissions = new permissions ( ) ; e s policy policy = new e s policy ( test codebases , no permissions , collections empty map ( ) , true , new permissions ( ) ) ; assert false ( policy implies ( new protection domain ( new code source ( null , ( certificate [ ] ) null ) , no permissions ) , new file permission ( " foo " , " read " ) ) ) ; }


deselects all selected items in the receiver if cell selection is enabled , all cells are deselected

public void deselect all ( ) { check widget ( ) ; selected cells clear ( ) ; update selection cache ( ) ; redraw ( ) ; }


returns all nodes in this graph adjacent to { @ code node } which can be reached by traversing { @ code node } ' s incoming edges against the direction ( if any ) of the edge some algorithms that operate on a { @ code predecessors function } may produce undesired results if the returned { @ link iterable } contains duplicate elements implementations of such algorithms should document their behavior in the presence of duplicates the elements of the returned { @ code iterable } must each be : non - null usable as { @ code map } keys ( see the guava user guide ' s section on < a href = " https : github comgoogleguavawiki graphs explained # graph - elements - nodes - and - edges " > graph elements for details )

iterable < ? extends n > predecessors ( n node ) ;


returns a { @ link list } of active shards

public list < shard routing > active shards ( ) { return this active shards ; }


tracks when some work is ready to offered for continuation

object on offer work for continuation ( string tag ) ;


binary operators don ' t yet adopt the return value with compound assignment

public void test binary compound assignment postfix ( ) { assert equals ( ( byte ) 5 , exec ( " def x = 5l ; return ( byte ) ( x + + ) ; " ) ) ; assert equals ( ( short ) 5 , exec ( " def x = 5l ; return ( short ) ( x + + ) ; " ) ) ; assert equals ( ( char ) 5 , exec ( " def x = 5l ; return ( char ) ( x + + ) ; " ) ) ; assert equals ( 5 , exec ( " def x = 5l ; return ( int ) ( x + + ) ; " ) ) ; assert equals ( 5f , exec ( " def x = 5l ; return ( float ) ( x + + ) ; " ) ) ; assert equals ( 5l , exec ( " def x = 5l ; return ( long ) ( x + + ) ; " ) ) ; assert equals ( 5d , exec ( " def x = 5l ; return ( double ) ( x + + ) ; " ) ) ; }


returns a json containing all parameters in this params the json should be human - readable if possible

public string to json ( ) { assert mapper inited ( ) ; try { return mapper write value as string ( params ) ; } catch ( json processing exception e ) { throw new runtime exception ( " failed to serialize params to json " , e ) ; } }


assert that when we abort a multipart upload , the resulting file does not show up

public void test multipart upload abort ( ) throws exception { describe ( " upload and then abort it before completing " ) ; path file = method path ( ) ; upload handle upload handle = start upload ( file ) ; map < integer , part handle > part handles = new hash map < > ( ) ; for ( int i = 12 ; i > 10 ; i - - ) { part handles put ( i , build and put part ( file , upload handle , i , null ) ) ; } abort upload ( upload handle , file ) ; string contents = " this is part 4 9 \ n " ; int len = contents get bytes ( charsets utf 8 ) length ; input stream is = i o utils to input stream ( contents , " utf - 8 " ) ; intercept ( i o exception class , ( ) - > await future ( uploader 0 put part ( upload handle , 49 , file , is , len ) ) ) ; intercept ( i o exception class , ( ) - > complete ( uploader 0 , upload handle , file , part handles ) ) ; assert path does not exist ( " uploaded file should not exist " , file ) ; / / a second abort should be an file not found exception if the upload handle is / / consumed by finalization operations ( complete , abort ) if ( finalize consumes upload id immediately ( ) ) { intercept ( file not found exception class , ( ) - > abort upload ( upload handle , file ) ) ; } else { abort upload ( upload handle , file ) ; } }


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


pop elements from the end of the operand stack , and return the last popped element

private inferred type pop ( int count ) { check argument ( count > = 1 , " the count should be at least one : % s ( in % s ) " , count , method signature ) ; check state ( operand stack size ( ) > = count , " there are no enough elements in the stack count = % s , stack = % s ( in % s ) " , count , operand stack , method signature ) ; int expected last index = operand stack size ( ) - count - 1 ; inferred type last popped = null ; for ( int i = operand stack size ( ) - 1 ; i > expected last index ; - - i ) { last popped = operand stack remove ( i ) ; } return last popped ; }


removes the item at the given key and returns the removed item if present , and null otherwise

public synchronized y remove ( @ non null t key ) { entry < y > entry = cache remove ( key ) ; if ( entry = = null ) { return null ; } current size - = entry size ; return entry value ; }


reads the full contents of this byte source as a byte array

byte [ ] read ( ) throws i o exception ;


adds an entry to the program tree for this mach - o

public void add to program tree ( dyld cache macho info next ) throws exception { program fragment fragment = listing get default root module ( ) create fragment ( path ) ; if ( next ! = null ) { fragment move ( header addr , next header addr subtract ( 1 ) ) ; } else { / / this is the last mach - o , so we ' ll assume it ends where the mapping that contains / / it ends for ( dyld cache mapping info mapping info : dyld cache header get mapping infos ( ) ) { address mapping addr = space get address ( mapping info get address ( ) ) ; if ( header addr compare to ( mapping addr ) > = 0 & & header addr compare to ( mapping addr add ( mapping info get size ( ) - 1 ) ) < = 0 ) { fragment move ( header addr , mapping addr add ( mapping info get size ( ) - 1 ) ) ; } } } }


returns an unmodifiable list containing the specified first element and backed by the specified array of additional elements changes to the { @ code rest } array will be reflected in the returned list unlike { @ link arrays # as list } , the returned list is unmodifiable this is useful when a varargs method needs to use a signature such as { @ code ( foo first foo , foo more foos ) } , in order to avoid overload ambiguity or to enforce a minimum argument count the returned list is serializable and implements { @ link random access }

public static < e > list < e > as list ( @ nullable decl e first , e [ ] rest ) { return new one plus array list < > ( first , rest ) ; }


default response entity < void > update pet ( @ api param ( value = " pet object that needs to be added to the store " , required = true ) @ valid @ request body pet body ) { return new response entity < > ( http status not implemented ) ; }


called before the azure storage sdk sends a request client - side throttling uses this to suspend the request , if necessary , to minimize errors and maximize throughput

public void event occurred ( sending request event event ) { singleton sending request ( event ) ; }


returns time when this plan started executing

public long get start time ( ) { return 0 ; }


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


returns the function defined before the specified address

public final function get function before ( address address ) { function iterator iterator = current program get listing ( ) get functions ( address , false ) ; / / skip over this function / / this is weird , but if you have multiple overlay spaces or address spaces , / / you will miss functions by not using the iterator and doing address math yourself if ( ! iterator has next ( ) ) { return null ; } function func = iterator next ( ) ; / / if the function found starts at the start addres , go to the next one if ( address equals ( func get entry point ( ) ) ) { func = null ; if ( iterator has next ( ) ) { func = iterator next ( ) ; } } return func ; }


attempt to satisfy this read in an optimized fashion using { @ code stream for sequential reads ref }

private int read optimized ( int part , long pos , byte buffer b , int length ) throws i o exception { if ( sequential read size = = no sequential read optimization ) { return 0 ; } int read = 0 ; if ( stream for sequential reads = = null ) { / / starting a new sequential read read = read from new sequential stream ( part , pos , b , length ) ; } else if ( stream for sequential reads can continue sequential read ( part , pos ) ) { / / continuing a sequential read that we started previously read = stream for sequential reads read ( b , length ) ; if ( stream for sequential reads is fully read ( ) ) { / / the current stream was exhausted by this read , so it should be closed stream for sequential reads close ( ) ; stream for sequential reads = null ; } else { / / the current stream contained enough data for this read and more besides , so we leave it in place assert read = = length : length + " remaining " ; } if ( read < length ) { / / the current stream didn ' t contain enough data for this read , so we must read more read + = read from new sequential stream ( part , pos + read , b , length - read ) ; } } else { / / not a sequential read , so stop optimizing for this usage pattern and fall through to the unoptimized behaviour assert stream for sequential reads is fully read ( ) = = false ; sequential read size = no sequential read optimization ; close stream for sequential reads ( ) ; } return read ; }


creates a memory with the provided attributes the block we wish to create may reside inside an already - created block if this is the case , we split the outer block ( s ) that encompass our desired new block this is the nature of mach - o segments and sections ( sections are contained in segments )

private memory block create memory block ( string name , address start , long data offset , long data length , string comment , string source , boolean r , boolean w , boolean x , boolean zero fill ) throws exception { / / i o s 12 chained pointer address fixup ( does not apply to x 8 6 ) if ( ! program get language i d ( ) get id as string ( ) starts with ( " x 8 6 " ) & & ( start get offset ( ) & 0xfff 0 0 0 0 0 0 0 0 0 l ) ! = 0 ) { start = space get address ( start get offset ( ) | 0xffff 0 0 0 0 0 0 0 0 0 0 0 0 l ) ; } / / get a list of all blocks that intersect with the block we wish to create there may be / / more that one if the containing memory has both initialized and uninitialized pieces list < memory block > intersecting blocks = new array list < > ( ) ; address set range = new address set ( start , start add ( data length - 1 ) ) ; for ( memory block block : memory get blocks ( ) ) { if ( range intersects ( block get start ( ) , block get end ( ) ) ) { intersecting blocks add ( block ) ; } } / / if we have no intersecting blocks , create a new block we are assuming that if we do / / intersect with at least one block , we will be completely contained in that block ( s ) / / if that assumption is wrong , the mach - o headers may be malformed ( or we don ' t fully / / understand them ) if ( intersecting blocks is empty ( ) ) { if ( zero fill ) { / / treat zero - fill blocks as uninitialized to save space return memory block utils create uninitialized block ( program , false , name , start , data length , comment , source , r , w , x , log ) ; } return memory block utils create initialized block ( program , false , name , start , file bytes , data offset , data length , comment , source , r , w , x , log ) ; } / / split the starting block ( if necessary ) splitting is not necessary if the start of our / / new block begins exactly where the starting block begins memory block starting block = intersecting blocks get ( 0 ) ; if ( start compare to ( starting block get start ( ) ) > 0 ) { memory split ( starting block , start ) ; } / / split the ending block ( if necessary ) splitting is not necessary if the end of our new / / block ends exactly where the ending block ends we need to fix up the name of the split / / block so it doesn ' t end in " split " memory block ending block = intersecting blocks get ( intersecting blocks size ( ) - 1 ) ; if ( start add ( data length - 1 ) compare to ( ending block get end ( ) ) < 0 ) { memory split ( ending block , start add ( data length ) ) ; memory block new ending block = memory get block ( start add ( data length ) ) ; new ending block set name ( ending block get name ( ) ) ; new ending block set source name ( ending block get source name ( ) ) ; new ending block set comment ( ending block get comment ( ) ) ; } / / change the attributes of all the blocks that intersect with the block we wish to create for ( memory block block : memory get blocks ( ) ) { if ( range intersects ( block get start ( ) , block get end ( ) ) ) { block set name ( name ) ; block set permissions ( r , w , x ) ; block set source name ( source ) ; block set comment ( comment ) ; } } return memory get block ( start ) ; }


set the key of an application context reference to expose in the job data map , for example " application context " default is none only applicable when running in a spring application context in case of a quartz job bean , the reference will be applied to the job instance as bean property an " application context " attribute will correspond to a " set application context " method in that scenario note that bean factory callback interfaces like application context aware are not automatically applied to quartz job instances , because quartz itself is responsible for the lifecycle of its jobs < b > note : when using persistent job stores where job detail contents will be kept in the database , do not put an application context reference into the job data map but rather into the scheduler context < b >

public void set application context job data key ( string application context job data key ) { this application context job data key = application context job data key ; }


converts a constant string binding to the required type

private < t > binding impl < t > convert constant string binding ( key < t > key , errors errors ) throws errors exception { / / find a constant string binding key < string > string key = key of type ( string class ) ; binding impl < string > string binding = state get explicit binding ( string key ) ; if ( string binding = = null | | ! string binding is constant ( ) ) { return null ; } string string value = string binding get provider ( ) get ( ) ; object source = string binding get source ( ) ; / / find a matching type converter type literal < t > type = key get type literal ( ) ; matcher and converter matching converter = state get converter ( string value , type , errors , source ) ; if ( matching converter = = null ) { / / no converter can handle the given type return null ; } / / try to convert the string a failed conversion results in an error try { @ suppress warnings ( " unchecked " ) / / this cast is safe because we double check below t converted = ( t ) matching converter get type converter ( ) convert ( string value , type ) ; if ( converted = = null ) { throw errors converter returned null ( string value , source , type , matching converter ) to exception ( ) ; } if ( ! type get raw type ( ) is instance ( converted ) ) { throw errors conversion type error ( string value , source , type , matching converter , converted ) to exception ( ) ; } return new converted constant binding impl < > ( this , key , converted , string binding ) ; } catch ( errors exception e ) { throw e ; } catch ( runtime exception e ) { throw errors conversion error ( string value , source , type , matching converter , e ) to exception ( ) ; } }


from a string , take a suffix of at most the given length

static string suffix ( string s , int len ) { if ( len < = 0 ) { return " " ; } int start pos = s length ( ) - len ; if ( start pos < = 0 ) { return s ; } return s substring ( start pos ) ; }


public integer get int 3 2 ( ) { return int 3 2 ; }


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


strip indirect pointer data type from a parameter

private static variable revert indirect parameter ( variable param , boolean create ) { data type dt = param get data type ( ) ; if ( dt instanceof pointer ) { try { dt = ( ( pointer ) dt ) get data type ( ) ; if ( create ) { param = new parameter impl ( param get name ( ) , dt , param get program ( ) ) ; } else { param set data type ( dt , variable storage unassigned storage , false , param get source ( ) ) ; } } catch ( invalid input exception e ) { throw new assert exception ( e ) ; / / unexpected } } return param ; }


print the productions of this grammar to the given stream

public void print ( print stream out ) { for ( p prod : prod list ) { out println ( prod ) ; } }


remove the array of plugins from the tool

public void remove plugins ( plugin [ ] plugins ) { system utilities run swing now ( ( ) - > { try { plugin mgr remove plugins ( plugins ) ; } finally { set config changed ( true ) ; } } ) ; }


build credential for metadata signature validation basic credential

private static basic credential build credential for metadata signature validation ( final resource resource ) throws exception { try { val x 5 0 9 factory bean = new basic x 5 0 9 credential factory bean ( ) ; x 5 0 9 factory bean set certificate resources ( collection utils wrap ( resource ) ) ; return x 5 0 9 factory bean get object ( ) ; } catch ( final exception e ) { logger trace ( e get message ( ) , e ) ; logger debug ( " credential cannot be extracted from [ { } ] via x 509 treating it as a public key to locate credential " , resource ) ; val credential factory bean = new basic resource credential factory bean ( ) ; credential factory bean set public key info ( resource ) ; return credential factory bean get object ( ) ; } }


get the prop defaults from the given { @ link type element }

public static immutable list < prop default model > get prop defaults ( type element type element ) { final list < prop default model > prop defaults = new array list < > ( ) ; final list < ? extends element > enclosed elements = type element get enclosed elements ( ) ; for ( element enclosed element : enclosed elements ) { prop defaults add all ( extract from field ( enclosed element ) ) ; prop defaults add all ( extract from method ( enclosed element ) ) ; } return immutable list copy of ( prop defaults ) ; }


returns the array of base relocations defined in this base relocation data directory

public base relocation [ ] get base relocations ( ) { return relocs ; }


method that returns whether we can rollup from inner time unit to outer time unit

private static boolean can roll up ( time unit outer , time unit inner ) { / / special handling for quarter as it is not in the expected / / order in time unit switch ( outer ) { case year : case month : case day : case hour : case minute : case second : case millisecond : case microsecond : switch ( inner ) { case year : case quarter : case month : case day : case hour : case minute : case second : case millisecond : case microsecond : if ( inner = = time unit quarter ) { return outer = = time unit year ; } return outer ordinal ( ) < = inner ordinal ( ) ; } break ; case quarter : switch ( inner ) { case quarter : case month : case day : case hour : case minute : case second : case millisecond : case microsecond : return true ; } } return false ; }


construct the mqtt client impl with additional config this config can also be changed using the { @ link # get client config ( ) } function

static mqtt client create ( mqtt client config config , mqtt handler default handler ) { return new mqtt client impl ( config , default handler ) ; }


for this test , the body for this request much reference a schema named & # x 6 0 ; file & # x 6 0 ;

public void test body with file schema test ( ) throws api exception { file schema test class body = null ; api test body with file schema ( body ) ; / / todo : test validations }


will always keep this guy alive so that it can function as a fallback to execute { @ link flyweight task } s see jenkins - 7291

protected boolean is alive ( ) { return true ; }


applies the given visitor to all referenced classes

public void referenced classes accept ( class visitor class visitor ) { if ( referenced classes ! = null ) { for ( int index = 0 ; index < referenced classes length ; index + + ) { clazz referenced class = referenced classes [ index ] ; if ( referenced class ! = null ) { referenced class accept ( class visitor ) ; } } } }


is authorized to release credential password ?

default boolean is authorized to release credential password ( ) { return false ; }


run this command commands take a zoo keeper server and string - valued keyword arguments and return a map containing any information constituting the response to the command commands are responsible for parsing keyword arguments and performing any error handling if necessary errors should be reported by setting the " error " entry of the returned map with an appropriate message rather than throwing an exception

command response run ( zoo keeper server zk server , map < string , string > kwargs ) ;


public resize response split ( resize request resize request , request options options ) throws i o exception { return rest high level client perform request and parse entity ( resize request , indices request converters : : split , options , resize response : : from x content , empty set ( ) ) ; }


set an eh cache { @ link net sf ehcache bootstrap bootstrap cache loader } for this cache , if any

public void set bootstrap cache loader ( bootstrap cache loader bootstrap cache loader ) { this bootstrap cache loader = bootstrap cache loader ; }


creates a new tuple and assigns the given values to the tuple ' s fields this is more convenient than using the constructor , because the compiler can infer the generic type arguments implicitly for example : { @ code tuple 3 of ( n , x , s ) } instead of { @ code new tuple 3 < integer , double , string > ( n , x , s ) }


a factory method for { @ link local channel } s users may override it to create custom instances of { @ link local channel } s

protected local channel new local channel ( local channel peer ) { return new local channel ( this , peer ) ; }


set the name to use for the join processor and the repartition topic ( s ) if required

public stream joined < k , v1 , v2 > with name ( final string name ) { return new stream joined < > ( key serde , value serde , other value serde , this store supplier , other store supplier , name , store name , logging enabled , topic config ) ; }


create the model m bean info for the given managed resource

model m bean info get m bean info ( object managed bean , string bean key ) throws j m exception ;


returns { @ code true } if a header with the { @ code name } exists , { @ code false } otherwise


returns a pretty - printed representation of this syntax tree this function returns the canonical source code corresponding to a syntax tree generally , the output can be round - tripped : pretty - printing a syntax tree then parsing the result should yield an equivalent syntax tree the pretty - printed form of a syntax tree may be used as a proxy for equality in tests however , different trees may have the same printed form in particular , { @ link starlark file } includes comments that are not reflected in the string

public final string pretty print ( ) { string builder buf = new string builder ( ) ; new node printer ( buf ) print node ( this ) ; return buf to string ( ) ; }


public static byte [ ] decrypt r s a ( final byte [ ] data , final byte [ ] private key , final int key size , final string transformation ) { return rsa template ( data , private key , key size , transformation , false ) ; }


creates a new builder for the given target that will be resolved by { @ link io grpc name resolver }

public static ok http channel builder for target ( string target , channel credentials creds ) { ssl socket factory result result = ssl socket factory from ( creds ) ; if ( result error ! = null ) { throw new illegal argument exception ( result error ) ; } return new ok http channel builder ( target , result factory , result call credentials ) ; }


iterator has data if it is either is the initial iteration , or the last listing obtained was incomplete

public boolean has next ( ) throws i o exception { if ( listing = = null ) { / / shouldn ' t happen , but don ' t trust aws sdk return false ; } else { return first listing | | listing is truncated ( ) ; } }


void on track selection changed ( boolean is disabled , list < selection override > overrides ) ;


public boolean is empty ( ) { return size = = 0 ; }


get a stored checkpoint , requires the transform id as well as the checkpoint id

void get transform checkpoint ( string transform id , long checkpoint , action listener < transform checkpoint > result listener ) ;


expectation for the url to match a specific regular expression

public static expected condition < boolean > url matches ( final string regex ) { return new expected condition < boolean > ( ) { private final pattern pattern = pattern compile ( regex ) ; private string current url ; @ override public boolean apply ( web driver driver ) { current url = driver get current url ( ) ; return pattern matcher ( current url ) find ( ) ; } @ override public string to string ( ) { return string format ( " url to match the regex \ " % s \ " current url : \ " % s \ " " , regex , current url ) ; } } ; }


update component ordinal , offset and length during alignment

void update ( int ordinal , int offset , int length ) ;


reads one chunk from the end of the file this is useful when scrolling to the bottom of the viewport

public synchronized list < string > read last chunk ( ) throws i o exception { if ( raf = = null ) { return new array list < > ( ) ; } raf seek ( raf length ( ) ) ; return read chunk in reverse ( raf get file pointer ( ) ) ; }


returns the number of distinct ordinals in this builder

public long get value count ( ) { return current ord + 1 ; }


matches to any tree of nodes with children matching to given source matchers any node tree ( table scan node ( " nation " ) ) - will match to any plan which all leafs contain any node containing table scan from nation table @ note any tree does not match zero nodes e g output ( any tree ( table scan ) ) will not match table scan node followed by output node

public static plan match pattern any tree ( plan match pattern sources ) { return any ( sources ) match to any node tree ( ) ; }


a bad block need to be handled , either to add to block scanner suspect queue or report to name node directly if the method is called by scanner , then the block must be a bad block , we report it to name node directly otherwise if we judge it as a bad block according to exception type , then we try to add the bad block to block scanner suspect queue if block scanner is enabled , or report to name node directly otherwise

void handle bad block ( extended block block , i o exception e , boolean from scanner ) { boolean is bad block = from scanner | | ( e instanceof disk file corrupt exception | | e instanceof corrupt meta header exception ) ; if ( ! is bad block ) { return ; } if ( ! from scanner & & block scanner is enabled ( ) ) { block scanner mark suspect block ( data get volume ( block ) get storage i d ( ) , block ) ; } else { try { report bad blocks ( block ) ; } catch ( i o exception ie ) { log warn ( " report bad block { } failed " , block , ie ) ; } } }


verify that the iteration completes with a given size

protected < t > void verify invoked ( final remote iterator < t > it , int length , consumer raising i o e < t > consumer ) throws i o exception { assert that ( foreach ( it , consumer ) ) described as ( " scan through iterator % s " , it ) is equal to ( length ) ; }


public okhttp 3 call build call ( final api callback callback ) throws api exception { return test group parameters call ( required string group , required boolean group , required int 6 4 group , string group , boolean group , int 6 4 group , callback ) ; }


get the offset to use when rounding , which is a number of milliseconds

public long offset ( ) { return offset ; }


concurrently add and remove watch , make sure the watches left + the watches removed are equal to the total added watches

public void test remove watcher on path ( string class name ) throws i o exception { i watch manager manager = get watch manager ( class name ) ; int paths = 10 ; int watchers = 10000 ; / / 1 start 5 workers to remove watchers on those path / / record the watchers have been removed atomic integer watches removed = new atomic integer ( ) ; list < remove watcher worker > remove workers = new array list < remove watcher worker > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { remove watcher worker worker = new remove watcher worker ( manager , paths , watchers , watches removed ) ; remove workers add ( worker ) ; worker start ( ) ; } / / 2 start 5 workers to add different watchers on different path / / record the watchers have been added atomic integer watches added = new atomic integer ( ) ; list < add watcher worker > add workers = new array list < add watcher worker > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { add watcher worker worker = new add watcher worker ( manager , paths , watchers , watches added ) ; add workers add ( worker ) ; worker start ( ) ; } while ( watches added get ( ) < 100000 ) { try { thread sleep ( 100 ) ; } catch ( interrupted exception e ) { } } / / 3 stop all workers for ( remove watcher worker worker : remove workers ) { worker shutdown ( ) ; } for ( add watcher worker worker : add workers ) { worker shutdown ( ) ; } / / 4 sleep for a while to make sure all the thread exited try { thread sleep ( 500 ) ; } catch ( interrupted exception e ) { } / / 5 make sure left watches + removed watches = added watches assert true ( watches added get ( ) > 0 ) ; assert true ( watches removed get ( ) > 0 ) ; assert true ( manager size ( ) > 0 ) ; assert equals ( watches added get ( ) , watches removed get ( ) + manager size ( ) ) ; }


returns the memory size for the entries residing in block cache

public void enable block cache usage ( ) { this properties add ( rocks d b property block cache usage get rocks d b property ( ) ) ; }


return the vendor - specific entity manager factory interface that the entity manager factory proxy is supposed to implement if the provider does not offer any entity manager factory extensions , the adapter should simply return the standard { @ link javax persistence entity manager factory } class here

default class < ? extends entity manager factory > get entity manager factory interface ( ) { return entity manager factory class ; }


private void setup audit logs ( ) throws i o exception { logger logger = ( ( log 4 j logger ) f s namesystem audit log ) get logger ( ) ; / / enable logging now that the test is ready to run logger set level ( level info ) ; }


public static void main ( string [ ] args ) { if ( args length = = 0 ) { system out println ( version ) ; system out println ( " usage : java proguard pro guard [ options ] " ) ; system exit ( 1 ) ; } / / create the default options configuration configuration = new configuration ( ) ; try { / / parse the options specified in the command line arguments configuration parser parser = new configuration parser ( args , system get properties ( ) ) ; try { parser parse ( configuration ) ; } finally { parser close ( ) ; } / / execute pro guard with these options new pro guard ( configuration ) execute ( ) ; } catch ( exception ex ) { if ( configuration verbose ) { / / print a verbose stack trace ex print stack trace ( ) ; } else { / / print just the stack trace message system err println ( " error : " + ex get message ( ) ) ; } system exit ( 1 ) ; } system exit ( 0 ) ; }


public < t > f with operator ( string uid , bootstrap transformation < t > transformation ) { metadata add operator ( uid , transformation ) ; return ( f ) this ; }


set whether or not this definition is abstract

public bean definition builder set abstract ( boolean flag ) { this bean definition set abstract ( flag ) ; return this ; }


test case for data corruption during data transmission for createwrite to recover from corruption while writing , at least two replicas are needed

public void test corruption during wrt ( ) throws exception { configuration conf = new hdfs configuration ( ) ; / / set short retry timeouts so this test runs faster conf set int ( hdfs client config keys retry window base key , 10 ) ; mini d f s cluster cluster = null ; try { cluster = new mini d f s cluster builder ( conf ) num data nodes ( 10 ) build ( ) ; cluster wait active ( ) ; file system fs = cluster get file system ( ) ; path file = new path ( " / test corruption file " ) ; f s data output stream out = fs create ( file , true , 8192 , ( short ) 3 , ( long ) ( 128 * 1024 * 1024 ) ) ; byte [ ] data = new byte [ 65536 ] ; for ( int i = 0 ; i < 65536 ; i + + ) { data [ i ] = ( byte ) ( i % 256 ) ; } for ( int i = 0 ; i < 5 ; i + + ) { out write ( data , 0 , 65535 ) ; } out hflush ( ) ; / / corrupt the packet once mockito when ( fault injector corrupt packet ( ) ) then return ( true , false ) ; mockito when ( fault injector uncorrupt packet ( ) ) then return ( true , false ) ; for ( int i = 0 ; i < 5 ; i + + ) { out write ( data , 0 , 65535 ) ; } out close ( ) ; / / read should succeed f s data input stream in = fs open ( file ) ; for ( int c ; ( c = in read ( ) ) ! = - 1 ; ) ; in close ( ) ; / / test the retry limit out = fs create ( file , true , 8192 , ( short ) 3 , ( long ) ( 128 * 1024 * 1024 ) ) ; / / corrupt the packet once and never fix it mockito when ( fault injector corrupt packet ( ) ) then return ( true , false ) ; mockito when ( fault injector uncorrupt packet ( ) ) then return ( false ) ; / / the client should give up pipeline reconstruction after retries try { for ( int i = 0 ; i < 5 ; i + + ) { out write ( data , 0 , 65535 ) ; } out close ( ) ; fail ( " write did not fail " ) ; } catch ( i o exception ioe ) { / / we should get an ioe d f s client log info ( " got expected exception " , ioe ) ; } } finally { if ( cluster ! = null ) { cluster shutdown ( ) ; } mockito when ( fault injector corrupt packet ( ) ) then return ( false ) ; mockito when ( fault injector uncorrupt packet ( ) ) then return ( false ) ; } }


called from the dialog when the " apply " button is hit ; call the current merge resolver ' s apply ( ) method , and wake up the merge thread waiting on user input

synchronized void apply ( ) { merge resolvers [ current index ] apply ( ) ; input received = true ; notify ( ) ; prompting = false ; }


the desired minimum time between checks by the background login refresh thread , in seconds

public short login refresh min period seconds ( ) { return login refresh min period seconds ; }


public int get num active connections ( ) { int total = 0 ; read lock lock ( ) ; try { for ( connection pool pool : this pools values ( ) ) { total + = pool get num active connections ( ) ; } } finally { read lock unlock ( ) ; } return total ; }


encodes a collection of query parameters according to the swagger collection format of the various collection formats defined by swagger ( " csv " , " tsv " , etc ) , feign only natively supports " multi " this utility generates the other format types so it will be properly processed by feign note , as part of reformatting , it url encodes the parameters as well

public static object encode collection ( collection < ? > parameters , string collection format ) { if ( parameters = = null ) { return parameters ; } list < string > string values = new array list < > ( parameters size ( ) ) ; for ( object parameter : parameters ) { / / ignore null values ( same behavior as feign ) if ( parameter ! = null ) { string values add ( encode ( parameter ) ) ; } } / / feign natively handles single - element lists and the " multi " format if ( string values size ( ) < 2 | | " multi " equals ( collection format ) ) { return string values ; } / / otherwise return a formatted string string [ ] string array = string values to array ( new string [ 0 ] ) ; switch ( collection format ) { case " csv " : default : return string util join ( string array , " , " ) ; case " ssv " : return string util join ( string array , " " ) ; case " tsv " : return string util join ( string array , " \ t " ) ; case " pipes " : return string util join ( string array , " | " ) ; } }


sets the alignment of the actor within the container set to { @ link align # center } , { @ link align # top } , { @ link align # bottom } , { @ link align # left } , { @ link align # right } , or any combination of those

public container < t > align ( int align ) { this align = align ; return this ; }


public string to string ( ) { return buffer to string ( ) ; }


returns the number of instantiated sections instantiated sections contain code or data that are required for execution

public short get instantiated section count ( ) { return inst section count ; }


sets the uniform matrix with the given name the { @ link shader program } must be bound for this to work

public void set uniform matrix ( string name , matrix 4 matrix ) { set uniform matrix ( name , matrix , false ) ; }


returns an exception don ' t forget to throw it

private query syntax exception syntax error ( lexer token token ) { string message = " premature end of input " ; if ( token kind ! = token kind eof ) { string builder buf = new string builder ( " syntax error at ' " ) ; string sep = " " ; for ( int index = tokens index of ( token ) , max = math min ( tokens size ( ) - 1 , index + 3 ) ; / / 3 tokens of context index < max ; + + index ) { buf append ( sep ) append ( tokens get ( index ) ) ; sep = " " ; } buf append ( " ' " ) ; message = buf to string ( ) ; } return new query syntax exception ( message ) ; }


public boolean equals ( final object o ) { if ( this = = o ) { return true ; } if ( o = = null | | get class ( ) ! = o get class ( ) ) { return false ; } key path key path = ( key path ) o ; return key equals ( key path key ) ; }


assigns timestamps to the elements in the data stream and periodically creates watermarks to signal event time progress this method uses the deprecated watermark generator interfaces please switch to { @ link # assign timestamps and watermarks ( watermark strategy ) } to use the new interfaces instead the new interfaces support watermark idleness and no longer need to differentiate between " periodic " and " punctuated " watermarks

public single output stream operator < t > assign timestamps and watermarks ( assigner with periodic watermarks < t > timestamp and watermark assigner ) { final assigner with periodic watermarks < t > cleaned assigner = clean ( timestamp and watermark assigner ) ; final watermark strategy < t > wms = new assigner with periodic watermarks adapter strategy < > ( cleaned assigner ) ; return assign timestamps and watermarks ( wms ) ; }


serialize a response into a { @ link byte buffer } this is used when the response will be encapsulated in an { @ link envelope response } the buffer will contain both the serialized { @ link response header } as well as the bytes from the response there is no ` size ` prefix unlike the output from { @ link # build response send ( abstract response ) } note that envelope requests are reserved only for a p is which have set the { @ link api keys # forwardable } flag notably the ` fetch ` api cannot be forwarded , so we do not lose the benefit of " zero copy " transfers from disk

public byte buffer build response envelope payload ( abstract response body ) { return body serialize with header ( header to response header ( ) , api version ( ) ) ; }


get the underlying base subroutine model this is generally the mult ent sub model ( m - model )

public subroutine block model get base subroutine model ( ) ;


return the configured { @ link forwarded header transformer }

public forwarded header transformer get forwarded header transformer ( ) { return this forwarded header transformer ; }


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

public static fields find by name ( string name ) { return by name get ( name ) ; }


to test enum parameters to test enum parameters

public void test enum parameters ( list < string > enum header string array , string enum header string , list < string > enum query string array , string enum query string , integer enum query integer , double enum query double , list < string > enum form string array , string enum form string ) throws api exception { object local var post body = null ; / / create path and map variables string local var path = " / fake " ; / / query params list < pair > local var query params = new array list < pair > ( ) ; list < pair > local var collection query params = new array list < pair > ( ) ; map < string , string > local var header params = new hash map < string , string > ( ) ; map < string , string > local var cookie params = new hash map < string , string > ( ) ; map < string , object > local var form params = new hash map < string , object > ( ) ; local var collection query params add all ( api client parameter to pairs ( " csv " , " enum query string array " , enum query string array ) ) ; local var query params add all ( api client parameter to pair ( " enum query string " , enum query string ) ) ; local var query params add all ( api client parameter to pair ( " enum query integer " , enum query integer ) ) ; local var query params add all ( api client parameter to pair ( " enum query double " , enum query double ) ) ; if ( enum header string array ! = null ) local var header params put ( " enum header string array " , api client parameter to string ( enum header string array ) ) ; if ( enum header string ! = null ) local var header params put ( " enum header string " , api client parameter to string ( enum header string ) ) ; if ( enum form string array ! = null ) local var form params put ( " enum form string array " , enum form string array ) ; if ( enum form string ! = null ) local var form params put ( " enum form string " , enum form string ) ; final string [ ] local var accepts = { } ; final string local var accept = api client select header accept ( local var accepts ) ; final string [ ] local var content types = { " application / x - www - form - urlencoded " } ; final string local var content type = api client select header content type ( local var content types ) ; string [ ] local var auth names = new string [ ] { } ; api client invoke a p i ( local var path , " get " , local var query params , local var collection query params , local var post body , local var header params , local var cookie params , local var form params , local var accept , local var content type , local var auth names , null ) ; }


determine whether this context currently holds a bean factory , i e has been refreshed at least once and not been closed yet

protected final boolean has bean factory ( ) { return ( this bean factory ! = null ) ; }


gets action that invokes cache key method , the result of execution is used as cache key

public method execution action get cache key method ( ) { return cache key method ; }


returns the value keys that have changed between the two versions

diff get diff ( walkable graph from graph , version from version , version to version ) throws interrupted exception ;


test { @ link d f s util # get secondary name service id ( configuration ) } to ensure nameservice id for backup node is determined based on matching the address with local node ' s address

public void get secondary name service id ( ) { configuration conf = setup address ( dfs namenode secondary http address key ) ; assert equals ( " nn 1 " , d f s util get secondary name service id ( conf ) ) ; }


creates a { @ link char stream } given an opened { @ link readable byte channel } and the charset of the bytes contained in the channel reads the entire contents of the { @ code channel } into the result before returning , then closes the { @ code channel }

public static char stream from channel ( readable byte channel channel , charset charset ) throws i o exception { return from channel ( channel , default buffer size , coding error action replace , int stream unknown source name ) ; }


makes adjustments as necessary to any annotations in the given text

public static string fixup annoations ( string raw comment text , program program ) { if ( raw comment text = = null ) { return null ; } attributed string prototype = create prototype ( ) ; / / this function will take any given symbol annotations and change the text , replacing / / the symbol name with the address of the symbol function < annotation , annotation > symbol fixer = annotation - > { annotated string handler handler = annotation get handler ( ) ; if ( ! ( handler instanceof symbol annotated string handler ) ) { return annotation ; / / nothing to change } string raw text = annotation get annotation text ( ) ; string [ ] annotation parts = annotation get annotation parts ( ) ; string updated text = symbol annotated string handler convert annotation symbol to address ( annotation parts , raw text , program ) ; if ( updated text = = null ) { return annotation ; / / nothing to change } return new annotation ( updated text , prototype , program ) ; } ; string builder buffy = new string builder ( ) ; list < object > parts = do parse text into text and annotations ( raw comment text , symbol fixer , program , prototype ) ; for ( object part : parts ) { if ( part instanceof string ) { string s = ( string ) part ; buffy append ( s ) ; } else if ( part instanceof annotation ) { annotation a = ( annotation ) part ; buffy append ( a get annotation text ( ) ) ; } else { throw new assert exception ( " unhandled annotation piece : " + part ) ; } } return buffy to string ( ) ; }


all registered { @ link extension filter } instances

public static extension list < extension filter > all ( ) { return extension list lookup ( extension filter class ) ; }


public void set cache size ( int cache size ) { this cache size = cache size ; }


this namespace destroys all thread pool resources under the grouping

public void destroy ( final string namespace , final string group ) { final object monitor = lockers get ( namespace ) ; if ( monitor = = null ) { return ; } synchronized ( monitor ) { map < string , set < executor service > > sub resource = resources manager get ( namespace ) ; if ( sub resource = = null ) { return ; } set < executor service > wait destroy = sub resource get ( group ) ; for ( executor service executor : wait destroy ) { thread utils shutdown thread pool ( executor ) ; } resources manager get ( namespace ) remove ( group ) ; } }


the set of xml attributevalue pairs for this style < code > repeated aapt pb style entry entry = 3 ; < code >

public builder add entry ( int index , com android aapt resources style entry value ) { copy on write ( ) ; instance add entry ( index , value ) ; return this ; }


return the holder for resources that have been suspended for this transaction , if any


returns the { @ link track output provider } to be used by the wrapped extractor

protected track output provider get track output provider ( base media chunk output base media chunk output ) { return base media chunk output ; }


update the shown foreground service notification after making any changes that affect it

void update notification ( ) { if ( m wake lock = = null & & m terminal sessions is empty ( ) & & m background tasks is empty ( ) ) { / / exit if we are updating after the user disabled all locks with no sessions or tasks running stop self ( ) ; } else { ( ( notification manager ) get system service ( context notification service ) ) notify ( notification id , build notification ( ) ) ; } }


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

public void create user test ( ) { user user = null ; api create user ( user ) block ( ) ; / / todo : test validations }


resolve the given index names to index ids

public list < index id > resolve indices ( final list < string > indices ) { list < index id > resolved indices = new array list < > ( indices size ( ) ) ; for ( final string index name : indices ) { resolved indices add ( resolve index id ( index name ) ) ; } return resolved indices ; }


get routed invokers from result of script rule evaluation

protected < t > list < invoker < t > > get routed invokers ( object obj ) { if ( obj instanceof invoker [ ] ) { return arrays as list ( ( invoker < t > [ ] ) obj ) ; } else if ( obj instanceof object [ ] ) { return arrays stream ( ( object [ ] ) obj ) map ( item - > ( invoker < t > ) item ) collect ( collectors to list ( ) ) ; } else { return ( list < invoker < t > > ) obj ; } }


create a test file by repeating the characters in the alphabet

private void create test file and set length ( ) throws i o exception { file system fs = account using input stream v 1 get file system ( ) ; / / to reduce test run time , the test file can be reused if ( fs exists ( test file path ) ) { test file status = fs get file status ( test file path ) ; test file length = test file status get len ( ) ; log info ( " reusing test file : { } " , test file status ) ; return ; } int size of alphabet = ( ' z ' - ' a ' + 1 ) ; byte [ ] buffer = new byte [ 26 * kilobyte ] ; char character = ' a ' ; for ( int i = 0 ; i < buffer length ; i + + ) { buffer [ i ] = ( byte ) character ; character = ( character = = ' z ' ) ? ' a ' : ( char ) ( ( int ) character + 1 ) ; } log info ( " creating test file { } of size : { } " , test file path , test file size ) ; contract test utils nano timer timer = new contract test utils nano timer ( ) ; try ( f s data output stream output stream = fs create ( test file path ) ) { int bytes written = 0 ; while ( bytes written < test file size ) { output stream write ( buffer ) ; bytes written + = buffer length ; } log info ( " closing stream { } " , output stream ) ; contract test utils nano timer close timer = new contract test utils nano timer ( ) ; output stream close ( ) ; close timer end ( " time to close ( ) output stream " ) ; } timer end ( " time to write % d kb " , test file size / 1024 ) ; test file length = fs get file status ( test file path ) get len ( ) ; }


return the threshold in bytes after which read data in the buffer should be discarded

public int get discard threshold ( ) { return discard threshold ; }


public static void drop table ( database db , boolean if exists ) { string sql = " drop table " + ( if exists ? " if exists " : " " ) + " \ " keep entity \ " " ; db exec s q l ( sql ) ; }


verify that state of separate windows does not leak into other windows

public void test window separation and firing ( ) throws exception { trigger test harness < object , time window > test harness = new trigger test harness < > ( count trigger < time window > of ( 3 ) , new time window serializer ( ) ) ; assert equals ( trigger result continue , test harness process element ( new stream record < object > ( 1 ) , new time window ( 0 , 2 ) ) ) ; assert equals ( trigger result continue , test harness process element ( new stream record < object > ( 1 ) , new time window ( 2 , 4 ) ) ) ; / / shouldn ' t have any timers assert equals ( 0 , test harness num processing time timers ( ) ) ; assert equals ( 0 , test harness num event time timers ( ) ) ; assert equals ( 2 , test harness num state entries ( ) ) ; assert equals ( 1 , test harness num state entries ( new time window ( 0 , 2 ) ) ) ; assert equals ( 1 , test harness num state entries ( new time window ( 2 , 4 ) ) ) ; assert equals ( trigger result continue , test harness process element ( new stream record < object > ( 1 ) , new time window ( 0 , 2 ) ) ) ; assert equals ( trigger result fire , test harness process element ( new stream record < object > ( 1 ) , new time window ( 0 , 2 ) ) ) ; assert equals ( trigger result continue , test harness process element ( new stream record < object > ( 1 ) , new time window ( 2 , 4 ) ) ) ; / / right now , count trigger will clear it ' s state in on element when firing / / ideally , this should be moved to on fire ( ) assert equals ( 1 , test harness num state entries ( ) ) ; assert equals ( 0 , test harness num state entries ( new time window ( 0 , 2 ) ) ) ; assert equals ( 1 , test harness num state entries ( new time window ( 2 , 4 ) ) ) ; assert equals ( trigger result fire , test harness process element ( new stream record < object > ( 1 ) , new time window ( 2 , 4 ) ) ) ; / / now all state should be gone assert equals ( 0 , test harness num state entries ( ) ) ; }


tests that the send operation is being retried

public void test retriable send operation if connection error or service unavailable ( ) throws exception { final ping rest handler ping rest handler = new ping rest handler ( future utils completed exceptionally ( new rest handler exception ( " test exception " , http response status service unavailable ) ) , completable future completed future ( empty response body get instance ( ) ) ) ; try ( final test rest server endpoint rest server endpoint = create rest server endpoint ( ping rest handler ) ) { rest cluster client < ? > rest cluster client = create rest cluster client ( rest server endpoint get server address ( ) get port ( ) ) ; try { final atomic boolean first poll failed = new atomic boolean ( ) ; fail http request = ( message headers , message parameters , request body ) - > message headers instanceof ping rest handler headers & & ! first poll failed get and set ( true ) ; rest cluster client send request ( ping rest handler headers instance ) get ( ) ; } finally { rest cluster client close ( ) ; } } }


checks whether this string value starts with the given prefix string

public boolean starts with ( char sequence prefix ) { return starts with ( prefix , 0 ) ; }


get the package id for the manifest file

public static string get application id ( file manifest file ) { s a x reader reader = new s a x reader ( ) ; if ( manifest file exists ( ) ) { document document = null ; / / read the xml file try { document = reader read ( manifest file ) ; element root = document get root element ( ) ; / / get the root node string package name = root attribute value ( " package " ) ; return package name ; } catch ( document exception e ) { e print stack trace ( ) ; } } return null ; } / / / /


if set , this node is an elementtag < code > optional aapt pb xml element element = 1 ; < code >

public builder set element ( com android aapt resources xml element builder builder for value ) { copy on write ( ) ; instance set element ( builder for value ) ; return this ; }


sets the tragic exception or if the tragic exception is already set adds passed exception as suppressed exception

public void set tragic exception ( exception ex ) { assert ex ! = null ; if ( tragedy compare and set ( null , ex ) ) { return ; / / first exception } final exception tragedy = this tragedy get ( ) ; / / ensure no circular reference if ( exceptions helper unwrap causes and suppressed ( ex , e - > e = = tragedy ) is empty ( ) ) { tragedy add suppressed ( ex ) ; } else { assert ex = = tragedy | | ex instanceof already closed exception : new assertion error ( " must be ace or tragic exception " , ex ) ; } }


public time value get time ( ) { return time value ; }


this method always returns an { @ linkplain collections # empty map empty map }

public map < string , ? extends servlet registration > get servlet registrations ( ) { return collections empty map ( ) ; }


tells whether there are overloaded operators

public boolean has overloaded operators ( ) { return overloaded operators present ; }


refreshes the list of hosts and excluded hosts from the configured files

public void refresh nodes ( ) throws i o exception { dfs refresh nodes ( ) ; }


sets the bounds on the given view if the view doesn ' t already have those bounds ( or if ' force ' is supplied )

private static void apply bounds to view ( view view , int left , int top , int right , int bottom , @ nullable rect padding , boolean force ) { final int width = right - left ; final int height = bottom - top ; if ( padding ! = null & & ! ( view instanceof host ) ) { view set padding ( padding left , padding top , padding right , padding bottom ) ; } if ( force | | view get measured height ( ) ! = height | | view get measured width ( ) ! = width ) { view measure ( make measure spec ( width , view measure spec exactly ) , make measure spec ( height , view measure spec exactly ) ) ; } if ( force | | view get left ( ) ! = left | | view get top ( ) ! = top | | view get right ( ) ! = right | | view get bottom ( ) ! = bottom ) { view layout ( left , top , right , bottom ) ; } }


sorts x , y pairs of values by the x value , then the y value and stores unsorted original indices

private void sort with indices ( float [ ] values , int count , boolean y down ) { int point count = count / 2 ; original indices clear ( ) ; original indices ensure capacity ( point count ) ; short [ ] original indices array = original indices items ; for ( short i = 0 ; i < point count ; i + + ) original indices array [ i ] = i ; int lower = 0 ; int upper = count - 1 ; int array stack = quicksort stack ; stack add ( lower ) ; stack add ( upper - 1 ) ; while ( stack size > 0 ) { upper = stack pop ( ) ; lower = stack pop ( ) ; if ( upper < = lower ) continue ; int i = quicksort partition with indices ( values , lower , upper , y down , original indices array ) ; if ( i - lower > upper - i ) { stack add ( lower ) ; stack add ( i - 2 ) ; } stack add ( i + 2 ) ; stack add ( upper ) ; if ( upper - i > = i - lower ) { stack add ( lower ) ; stack add ( i - 2 ) ; } } }


starts a cluster with the given configuration

private void start cluster ( hdfs configuration conf ) throws i o exception { cluster = new mini d f s cluster builder ( conf ) num data nodes ( 3 ) build ( ) ; cluster wait active ( ) ; }


test for task inclusionexclusion ( no other filters , no sort )

public void test query exclude subtasks ( ) throws exception { / / query all tasks , including subtasks task query query = task service create task query ( ) ; assert that ( query count ( ) ) is equal to ( 10 ) ; assert that ( query list ( ) ) has size ( 10 ) ; / / query only parent tasks ( exclude subtasks ) query = task service create task query ( ) exclude subtasks ( ) ; assert that ( query count ( ) ) is equal to ( 3 ) ; assert that ( query list ( ) ) has size ( 3 ) ; }


returns the product of this float value and the given particular float value

public float value multiply ( particular float value other ) { return multiply ( ( specific float value ) other ) ; }


get the aggregated value for a method for all nameservices

private int get nameservice aggregated int ( to int function < membership stats > f ) { try { return get active namenode registrations ( ) stream ( ) map ( membership state : : get stats ) collect ( collectors summing int ( f ) ) ; } catch ( i o exception e ) { log error ( " unable to extract metrics : { } " , e get message ( ) ) ; return 0 ; } }


public user get user by name ( string username ) { / / todo : implement return null ; }


resets the internal state of the aggregator this must bring the aggregator into the same state as if it was newly initialized


ensures that the result of multiplying individual numbers can fit into the size limit of an integer

private static boolean is safe to multiply ( int a , int b ) { return a > = 0 & & b > = 0 & & ! ( b > 0 & & a > = integer max value / b ) ; }


returns the default description for the given { @ code detector }

public static string of ( detector detector ) { string builder sb = new string builder ( ) ; append on ( detector , sb ) ; return sb to string ( ) ; }


given a collection of exceptions , returns a { @ link runtime exception } , with the following rules : if { @ code exceptions } has a single exception and that exception is a { @ link runtime exception } , return it if { @ code exceptions } has a single exceptions and that exceptions is not a { @ link runtime exception } , return a simple { @ code runtime exception } that wraps it otherwise , return an instance of { @ link cluster exception } that wraps the first exception in the { @ code exceptions } collection though this method takes any { @ link collection } , it often makes most sense to pass a { @ link java util list } or some other collection that preserves the order in which the exceptions got added

public static runtime exception create ( collection < ? extends throwable > exceptions ) { if ( exceptions size ( ) = = 0 ) { throw new illegal argument exception ( " can ' t create an exception collection with no exceptions " ) ; } if ( exceptions size ( ) = = 1 ) { throwable temp = exceptions iterator ( ) next ( ) ; if ( temp instanceof runtime exception ) { return ( runtime exception ) temp ; } else { return new runtime exception ( temp ) ; } } return new cluster exception ( exceptions ) ; }


protected void build parser ( ) { try ( dbg ctx dc = dbg start ( " building parser " ) ) { parser = new assembly parser ( grammar ) ; } }


assert the response status code is { @ code http status permanent redirect } ( 308 )

public result matcher is permanent redirect ( ) { return matcher ( http status value of ( 308 ) ) ; }


verifies normal operation of the strings analyzer - - that these specific strings are created by the analyzer when default options are checked !

public void test default strings creation ( ) throws exception { program test program = build program ( " libopencoreplayer so " , false ) ; data data here ; string string here ; listing listing = test program get listing ( ) ; address space space = test program get language ( ) get address factory ( ) get default address space ( ) ; string [ ] existing strings = new string [ ] { " drm / duration " , " p v f m video m i o " , " set to invalid mode ( % d ) " , " device " , " height " , " player quit " , " video / decoder " } ; int [ ] offsets = new int [ ] { 0xa 7 1 9 8 1 2 0 , 0xa 7 1 9 5fd 4 , 0xa 7 1 9 6ee 8 , 0xa 7 1 7fa 4 8 , 0xa 7 1 9 5 6a 0 , 0xa 7 1 9 7 3 0 4 , 0xa 7 1 8 0 2 5c } ; address [ ] existing addresses = new address [ offsets length ] ; for ( int i = 0 ; i < offsets length ; i + + ) { existing addresses [ i ] = addr ( space , offsets [ i ] ) ; } / / verify strings aren ' t already there for ( address existing addresse : existing addresses ) { data here = listing get defined data at ( existing addresse ) ; assert null ( data here ) ; } auto analysis manager manager = auto analysis manager get analysis manager ( test program ) ; / / run strings analyzer that shouldn ' t make the bigger string around this one strings analyzer analyzer = new strings analyzer ( ) ; analyzer set create string over existing string ( false ) ; analyzer set string end alignment ( 1 ) ; analyzer added ( test program , null , monitor , manager get message log ( ) ) ; for ( int i = 0 ; i < existing strings length ; i + + ) { / / verify string is actually there data here = listing get defined data at ( existing addresses [ i ] ) ; assert not null ( data here ) ; string here = data here get default value representation ( ) ; assert equals ( " \ " " + existing strings [ i ] + " \ " " , string here ) ; } }


returns this long value , shifted left by the given integer value

public long value shift left ( integer value other ) { return other shift left of ( this ) ; }


returns the max inactive interval time of the generated tokens

protected long get max inactive interval ( ) { return max inactive interval / 1000 ; }


tests that pending slot requests are tried to be fulfilled upon new slot registrations

public void test fulfilling pending slot request ( ) throws exception { final resource manager id resource manager id = resource manager id generate ( ) ; final resource i d resource i d = resource i d generate ( ) ; final job i d job id = new job i d ( ) ; final slot i d slot id = new slot i d ( resource i d , 0 ) ; final string target address = " localhost " ; final allocation i d allocation id = new allocation i d ( ) ; final resource profile resource profile = resource profile unknown ; final slot request slot request = new slot request ( job id , allocation id , resource profile , target address ) ; final atomic integer number allocate resource calls = new atomic integer ( 0 ) ; resource actions resource manager actions = new testing resource actions builder ( ) set allocate resource consumer ( ignored - > number allocate resource calls increment and get ( ) ) build ( ) ; final completable future < tuple 6 < slot i d , job i d , allocation i d , resource profile , string , resource manager id > > request future = new completable future < > ( ) ; / / accept an incoming slot request final task executor gateway task executor gateway = new testing task executor gateway builder ( ) set request slot function ( tuple 6 - > { request future complete ( tuple 6 of ( tuple 6 f 0 , tuple 6 f 1 , tuple 6 f 2 , tuple 6 f 3 , tuple 6 f 4 , tuple 6 f 5 ) ) ; return completable future completed future ( acknowledge get ( ) ) ; } ) create testing task executor gateway ( ) ; final task executor connection task executor connection = new task executor connection ( resource i d , task executor gateway ) ; final slot status slot status = new slot status ( slot id , resource profile any ) ; final slot report slot report = new slot report ( slot status ) ; try ( slot manager impl slot manager = create slot manager ( resource manager id , resource manager actions ) ) { assert true ( " the slot request should be accepted " , slot manager register slot request ( slot request ) ) ; assert that ( number allocate resource calls get ( ) , is ( 1 ) ) ; slot manager register task manager ( task executor connection , slot report , resource profile any , resource profile any ) ; assert that ( request future get ( ) , is ( equal to ( tuple 6 of ( slot id , job id , allocation id , resource profile , target address , resource manager id ) ) ) ) ; task manager slot slot = slot manager get slot ( slot id ) ; assert equals ( " the slot has not been allocated to the expected allocation id " , allocation id , slot get allocation id ( ) ) ; } }


creates a new { @ code watermark strategy } that wraps this strategy but instead uses the given { @ link serializable timestamp assigner } you can use this in case you want to specify a { @ link timestamp assigner } via a lambda function { @ code watermark strategy < custom object > wm strategy = watermark strategy < custom object > for monotonous timestamps ( ) with timestamp assigner ( ( event , timestamp ) - > event get timestamp ( ) ) ; }

default watermark strategy < t > with timestamp assigner ( serializable timestamp assigner < t > timestamp assigner ) { check not null ( timestamp assigner , " timestamp assigner " ) ; return new watermark strategy with timestamp assigner < > ( this , timestamp assigner supplier of ( timestamp assigner ) ) ; }


required : service discovery mode for the hosts care must be taken when setting the resolution mode to none for a tcp port without accompanying ip addresses in such cases , traffic to any ip on said port will be allowed ( i e 0 0 0 0 : & lt ; port & gt ; ) < code > istio networking v 1alpha 3 service entry resolution resolution = 5 ; < code >

public builder set resolution ( com alibaba nacos istio model naming service entry resolution value ) { if ( value = = null ) { throw new null pointer exception ( ) ; } resolution = value get number ( ) ; on changed ( ) ; return this ; }


determine the appropriate heap size for the given role and available system memory

public int heap ( long system memory ) { return formula apply ( system memory ) ; }


public void write ( data output out ) throws i o exception { out write long ( offset ) ; out write int ( size ) ; }


< code > repeated io netty example worldclock local time local time = 1 ; < code >

io netty example worldclock world clock protocol local time or builder get local time or builder ( int index ) ;


public void test nested exception ( ) { throwable throwable = assertions assert throws ( framework exception class , ( ) - > { message print ( ) ; } ) ; assert that ( throwable ) has message ( " " ) ; }


add the passed { @ link user } to the paid user group list

public static void add user to paid group ( final user user ) throws illegal argument exception { if ( free group contains ( user ) ) { throw new illegal argument exception ( " user all ready member of free group " ) ; } else { if ( ! paid group contains ( user ) ) { paid group add ( user ) ; } } }


records a miss when the hot and cold set are full

private void on full miss ( node node ) { if ( node status = = status cold non res ) { on non resident full miss ( node ) ; } else if ( node status = = status out of clock ) { on out of clock full miss ( node ) ; } else { throw new illegal state exception ( ) ; } }


tries to retrieve healthy channel from the pool if any or creates a new channel otherwise

private future < channel > acquire healthy from pool or new ( final promise < channel > promise ) { try { final channel ch = poll channel ( ) ; if ( ch = = null ) { / / no channel left in the pool bootstrap a new channel bootstrap bs = bootstrap clone ( ) ; bs attr ( pool key , this ) ; channel future f = connect channel ( bs ) ; if ( f is done ( ) ) { notify connect ( f , promise ) ; } else { f add listener ( new channel future listener ( ) { @ override public void operation complete ( channel future future ) throws exception { notify connect ( future , promise ) ; } } ) ; } return promise ; } event loop loop = ch event loop ( ) ; if ( loop in event loop ( ) ) { do health check ( ch , promise ) ; } else { loop execute ( new runnable ( ) { @ override public void run ( ) { do health check ( ch , promise ) ; } } ) ; } } catch ( throwable cause ) { promise try failure ( cause ) ; } return promise ; }


writes the portion of the file header that refers to this instance

public void write header part ( annotated output out ) { throw if not prepared ( ) ; int sz = type ids size ( ) ; int offset = ( sz = = 0 ) ? 0 : get file offset ( ) ; if ( sz > dex format max type idx + 1 ) { throw new dex index overflow exception ( " too many type references : " + sz + " ; max is " + ( dex format max type idx + 1 ) + " \ n " + new main ( ) get too many ids error message ( ) ) ; } if ( out annotates ( ) ) { out annotate ( 4 , " type ids size : " + hex u 4 ( sz ) ) ; out annotate ( 4 , " type ids off : " + hex u 4 ( offset ) ) ; } out write int ( sz ) ; out write int ( offset ) ; }


sets the maximum age of this { @ link cookie } in seconds if an age of { @ code 0 } is specified , this { @ link cookie } will be automatically removed by browser because it will expire immediately if { @ link long # min value } is specified , this { @ link cookie } will be removed when the browser is closed


public polygon builder hole ( line string builder hole ) { return this hole ( hole , false ) ; }


returns an unmodifiable list of the factories tried when creating a { @ linkplain # request body converter ( type , annotation [ ] , annotation [ ] ) request body converter } , a { @ linkplain # response body converter ( type , annotation [ ] ) response body converter } , or a { @ linkplain # string converter ( type , annotation [ ] ) string converter }

public list < converter factory > converter factories ( ) { return converter factories ; }


obtain the active operation count , or { @ link index shard # operations blocked } if all permits are held

int get active operations count ( ) { int available permits = semaphore available permits ( ) ; if ( available permits = = 0 ) { return index shard operations blocked ; / / this occurs when block operations ( ) has acquired all the permits } else { return total permits - available permits ; } }


protected int compare data node ( final datanode descriptor a , final datanode descriptor b ) { if ( a equals ( b ) | | math abs ( a get dfs used percent ( ) - b get dfs used percent ( ) ) < 5 ) { return 0 ; } return a get dfs used percent ( ) < b get dfs used percent ( ) ? - 1 : 1 ; }


the list of array elements < code > repeated aapt pb array element element = 1 ; < code >

public java util list < ? extends com android aapt resources array element or builder > get element or builder list ( ) { return element ; }


returns { @ link # get pad top ( ) } plus { @ link # get pad bottom ( ) }

public float get pad y ( ) { return pad top get ( this ) + pad bottom get ( this ) ; }


creates a bitmap of the specified width and height

public closeable reference < bitmap > create bitmap internal ( int width , int height , bitmap config bitmap config ) { int size in bytes = bitmap util get size in byte for bitmap ( width , height , bitmap config ) ; bitmap bitmap = m bitmap pool get ( size in bytes ) ; preconditions check argument ( bitmap get allocation byte count ( ) > = width * height * bitmap util get pixel size for bitmap config ( bitmap config ) ) ; bitmap reconfigure ( width , height , bitmap config ) ; return m closeable reference factory create ( bitmap , m bitmap pool ) ; }


test the config value separated by delimiter

@ test public void test delimiter conf ( ) { string filename = get test filename ( " test - metrics 2 - delimiter " ) ; new config builder ( ) add ( " p 1 foo " , " p 1foo 1 , p 1foo 2 , p 1foo 3 " ) save ( filename ) ; metrics config mc = metrics config create ( " p 1 " , filename ) ; configuration expected = new config builder ( ) add ( " foo " , " p 1foo 1 " ) add ( " foo " , " p 1foo 2 " ) add ( " foo " , " p 1foo 3 " ) config ; assert eq ( expected , mc ) ; }


total number of successfully processed documents

default long get successfully processed ( ) { return get updated ( ) + get created ( ) + get deleted ( ) ; }


this method tries to find the marker ( passed to it as the first parameter ) in the stream it can find bit patterns of length & lt ; = 63 bits specifically this method is used in c b zip 2 input stream to find the end of block ( eob ) delimiter in the stream , starting from the current position of the stream if marker is found , the stream position will be at the byte containing the starting bit of the marker

public boolean skip to next marker ( long marker , int marker bit length ) throws i o exception , illegal argument exception { try { if ( marker bit length > 63 ) { throw new illegal argument exception ( " skip to next marker can not find patterns greater than 63 bits " ) ; } / / pick next market bit length bits in the stream long bytes = 0 ; bytes = this bs r ( marker bit length ) ; if ( bytes = = - 1 ) { this reported bytes read from compressed stream = this bytes read from compressed stream ; return false ; } while ( true ) { if ( bytes = = marker ) { / / report the byte position where the marker starts long marker bytes read = ( marker bit length + this bs live + 7 ) / 8 ; this reported bytes read from compressed stream = this bytes read from compressed stream - marker bytes read ; return true ; } else { bytes = bytes < < 1 ; bytes = bytes & ( ( 1l < < marker bit length ) - 1 ) ; int one bit = ( int ) this bs r ( 1 ) ; if ( one bit ! = - 1 ) { bytes = bytes | one bit ; } else { this reported bytes read from compressed stream = this bytes read from compressed stream ; return false ; } } } } catch ( i o exception ex ) { this reported bytes read from compressed stream = this bytes read from compressed stream ; return false ; } }


returns the target of the current invocation , ie java delegate , value expression


< code > optional aapt pb raw string raw str = 3 ; < code >

private void set raw str ( com android aapt resources raw string builder builder for value ) { raw str = builder for value build ( ) ; bit field 0 | = 0x 0 0 0 0 0 0 0 4 ; }


public datanode command [ ] handle heartbeat ( datanode registration node reg , storage report [ ] reports , final string block pool id , long cache capacity , long cache used , int xceiver count , int max transfers , int failed volumes , volume failure summary volume failure summary , @ nonnull slow peer reports slow peers , @ nonnull slow disk reports slow disks ) throws i o exception { final datanode descriptor nodeinfo ; try { nodeinfo = get datanode ( node reg ) ; } catch ( unregistered node exception e ) { return new datanode command [ ] { register command register } ; } / / check if this datanode should actually be shutdown instead if ( nodeinfo ! = null & & nodeinfo is disallowed ( ) ) { set datanode dead ( nodeinfo ) ; throw new disallowed datanode exception ( nodeinfo ) ; } if ( nodeinfo = = null | | ! nodeinfo is registered ( ) ) { return new datanode command [ ] { register command register } ; } heartbeat manager update heartbeat ( nodeinfo , reports , cache capacity , cache used , xceiver count , failed volumes , volume failure summary ) ; / / if we are in safemode , do not send back any recovery / replication / / requests don ' t even drain the existing queue of work if ( namesystem is in safe mode ( ) ) { return new datanode command [ 0 ] ; } / / block recovery command final block recovery command br command = get block recovery command ( block pool id , nodeinfo ) ; if ( br command ! = null ) { return new datanode command [ ] { br command } ; } final list < datanode command > cmds = new array list < > ( ) ; / / allocate approximately max transfers pending tasks to data node / / nn chooses pending tasks based on the ratio between the lengths of / / replication and erasure - coded block queues int total replicate blocks = nodeinfo get number of replicate blocks ( ) ; int total e c blocks = nodeinfo get number of blocks to be erasure coded ( ) ; int total blocks = total replicate blocks + total e c blocks ; if ( total blocks > 0 ) { int num replication tasks = ( int ) math ceil ( ( double ) ( total replicate blocks * max transfers ) / total blocks ) ; int num e c tasks = ( int ) math ceil ( ( double ) ( total e c blocks * max transfers ) / total blocks ) ; if ( log is debug enabled ( ) ) { log debug ( " pending replication tasks : " + num replication tasks + " erasure - coded tasks : " + num e c tasks ) ; } / / check pending replication tasks list < block target pair > pending list = nodeinfo get replication command ( num replication tasks ) ; if ( pending list ! = null & & ! pending list is empty ( ) ) { / / if the block is deleted , the block size will become / / block command no ack ( long max value ) this kind of block we don ' t / / need / / to send for replication or reconstruction iterator < block target pair > iterator = pending list iterator ( ) ; while ( iterator has next ( ) ) { block target pair cmd = iterator next ( ) ; if ( cmd block ! = null & & cmd block get num bytes ( ) = = block command no ack ) { / / block deleted datanode storage info decrement blocks scheduled ( cmd targets ) ; iterator remove ( ) ; } } if ( ! pending list is empty ( ) ) { cmds add ( new block command ( datanode protocol dna transfer , block pool id , pending list ) ) ; } } / / check pending erasure coding tasks list < block e c reconstruction info > pending e c list = nodeinfo get erasure code command ( num e c tasks ) ; if ( pending e c list ! = null & & ! pending e c list is empty ( ) ) { cmds add ( new block e c reconstruction command ( dna erasure coding reconstruction , pending e c list ) ) ; } } / / check block invalidation block [ ] blks = nodeinfo get invalidate blocks ( block invalidate limit ) ; if ( blks ! = null ) { cmds add ( new block command ( datanode protocol dna invalidate , block pool id , blks ) ) ; } / / cache commands add cache commands ( block pool id , nodeinfo , cmds ) ; / / key update command block manager add key update command ( cmds , nodeinfo ) ; / / check for balancer bandwidth update if ( nodeinfo get balancer bandwidth ( ) > 0 ) { cmds add ( new balancer bandwidth command ( nodeinfo get balancer bandwidth ( ) ) ) ; / / set back to 0 to indicate that datanode has been sent the new value nodeinfo set balancer bandwidth ( 0 ) ; } if ( slow peer tracker ! = null ) { final map < string , double > slow peers map = slow peers get slow peers ( ) ; if ( ! slow peers map is empty ( ) ) { if ( log is debug enabled ( ) ) { log debug ( " data node " + node reg + " reported slow peers : " + slow peers map ) ; } for ( string slow node id : slow peers map key set ( ) ) { slow peer tracker add report ( slow node id , node reg get ipc addr ( false ) ) ; } } } if ( slow disk tracker ! = null ) { if ( ! slow disks get slow disks ( ) is empty ( ) ) { if ( log is debug enabled ( ) ) { log debug ( " data node " + node reg + " reported slow disks : " + slow disks get slow disks ( ) ) ; } slow disk tracker add slow disk report ( node reg get ipc addr ( false ) , slow disks ) ; } slow disk tracker check and update report if necessary ( ) ; } if ( ! cmds is empty ( ) ) { return cmds to array ( new datanode command [ cmds size ( ) ] ) ; } return new datanode command [ 0 ] ; }


a callback that should never be invoked directly

public void get size ( @ non null size ready callback cb ) { cb on size ready ( width , height ) ; }


test that accept z value parameter correctly parses

public void test ignore z value ( ) throws i o exception { document mapper mapper = create document mapper ( field mapping ( b - > b field ( " type " , " geo shape " ) field ( " ignore z value " , true ) ) ) ; mapper field mapper = mapper mappers ( ) get mapper ( " field " ) ; assert that ( field mapper , instance of ( geo shape field mapper class ) ) ; boolean ignore z value = ( ( geo shape field mapper ) field mapper ) ignore z value ( ) ; assert that ( ignore z value , equal to ( true ) ) ; / / explicit false accept z value test mapper = create document mapper ( field mapping ( b - > b field ( " type " , " geo shape " ) field ( " ignore z value " , false ) ) ) ; field mapper = mapper mappers ( ) get mapper ( " field " ) ; assert that ( field mapper , instance of ( geo shape field mapper class ) ) ; ignore z value = ( ( geo shape field mapper ) field mapper ) ignore z value ( ) ; assert that ( ignore z value , equal to ( false ) ) ; }


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

public static fields find by thrift id ( int field id ) { switch ( field id ) { case 1 : / / name return name ; case 2 : / / uploaded jar location return uploaded jar location ; case 3 : / / json conf return json conf ; case 4 : / / topology return topology ; default : return null ; } }


helper function to merge dictionaries of terms to override or provide

private static void merge single term maps ( map < string , monolingual text value > current terms , map < string , monolingual text value > current terms if new , set < monolingual text value > new terms , set < monolingual text value > new terms if new ) { for ( monolingual text value other label : new terms ) { string language code = other label get language code ( ) ; current terms put ( language code , other label ) ; if ( current terms if new contains key ( language code ) ) { current terms if new remove ( language code ) ; } } for ( monolingual text value other label : new terms if new ) { string language code = other label get language code ( ) ; if ( ! current terms if new contains key ( language code ) & & ! current terms contains key ( language code ) ) { current terms if new put ( language code , other label ) ; } } }


regression test for bug : " illegal argument exception in path package locator create ( ) "

public void test dollar signs ( ) throws exception { path workspace = scratch dir ( " / some / path / to / workspace $ 1 " ) ; path package locator create ( null , immutable list of ( " % workspace % / blabla " ) , reporter , workspace , workspace get relative ( " foo " ) , bazel skyframe executor constants build files by priority ) ; }


evaluate the next { @ link statement statement } in the execution chain ( typically an instance of { @ link spring repeat } ) and throw a { @ link timeout exception } if the next { @ code statement } executes longer than the specified { @ code timeout }

public void evaluate ( ) throws throwable { if ( this timeout = = 0 ) { this next evaluate ( ) ; } else { long start time = system current time millis ( ) ; this next evaluate ( ) ; long elapsed = system current time millis ( ) - start time ; if ( elapsed > this timeout ) { throw new timeout exception ( string format ( " test took % s ms ; limit was % s ms " , elapsed , this timeout ) ) ; } } }


to simplify computation , use weights instead of fair shares to calculate fair share usage

private int compare fair share usage ( schedulable s 1 , schedulable s 2 , resource resource usage 1 , resource resource usage 2 ) { double weight 1 = s 1 get weight ( ) ; double weight 2 = s 2 get weight ( ) ; double use to weight ratio 1 ; double use to weight ratio 2 ; if ( weight 1 > 0 0 & & weight 2 > 0 0 ) { use to weight ratio 1 = resource usage 1 get memory size ( ) / weight 1 ; use to weight ratio 2 = resource usage 2 get memory size ( ) / weight 2 ; } else if ( weight 1 = = weight 2 ) { / / either weight 1 or weight 2 equals to 0 / / if they have same weight , just compare usage use to weight ratio 1 = resource usage 1 get memory size ( ) ; use to weight ratio 2 = resource usage 2 get memory size ( ) ; } else { / / by setting use to weight ratios to negative weights , we give the / / zero - weight one less priority , so the non - zero weight one will / / be given slots use to weight ratio 1 = - weight 1 ; use to weight ratio 2 = - weight 2 ; } return ( int ) math signum ( use to weight ratio 1 - use to weight ratio 2 ) ; }


separate the job ids into open and closing job ids and validate if a job is failed it is will not be closed unless the force parameter in request is true it is an error if the datafeed the job uses is not stopped

void validate ( collection < string > expanded job ids , boolean force close , persistent tasks custom metadata tasks metadata , action listener < open and closing ids > listener ) { check datafeeds have stopped ( expanded job ids , tasks metadata , action listener wrap ( response - > { open and closing ids ids = new open and closing ids ( ) ; list < string > failed jobs = new array list < > ( ) ; for ( string job id : expanded job ids ) { add job according to state ( job id , tasks metadata , ids open job ids , ids closing job ids , failed jobs ) ; } if ( force close = = false & & failed jobs size ( ) > 0 ) { if ( expanded job ids size ( ) = = 1 ) { listener on failure ( exceptions helper conflict status exception ( " cannot close job [ { } ] because it failed , use force close " , expanded job ids iterator ( ) next ( ) ) ) ; return ; } listener on failure ( exceptions helper conflict status exception ( " one or more jobs have state failed , use force close " ) ) ; return ; } / / if there are failed jobs force close is true ids open job ids add all ( failed jobs ) ; listener on response ( ids ) ; } , listener : : on failure ) ) ; }


creates list of users with given input array ( asynchronously )

public okhttp 3 call create users with array input async ( list < user > body , final api callback < void > callback ) throws api exception { okhttp 3 call local var call = create users with array input validate before call ( body , callback ) ; local var api client execute async ( local var call , callback ) ; return local var call ; }


returns the last checkpoint id ( current - 1 )

public long get last ( ) { return checkpoint id counter get ( ) - 1 ; }