sets the title for the right side ' s listing

public void set right title ( string right title ) { this right title = right title ; set title ( title panels [ right ] , right title prefix , right title ) ; }


tests that java info java annotation processing returned from java common compile looks as expected , and specifically , looks as if java library was used instead

public void test java common compile exposes annotation processing info ( ) throws exception { / / set up a starlark rule that uses java common compile and supports annotation processing in / / the same way as java library , then use a helper method to test that the custom rule produces / / the same annotation processing information as java library would write build file for java toolchain ( ) ; scratch file ( " java / test / custom rule bzl " , " def impl ( ctx ) : " , " output jar = ctx actions declare file ( ' lib ' + ctx label name + ' jar ' ) " , " return java common compile ( " , " ctx , " , " source files = ctx files srcs , " , " deps = [ d [ java info ] for d in ctx attr deps ] , " , " exports = [ e [ java info ] for e in ctx attr exports ] , " , " plugins = [ p [ java info ] for p in ctx attr plugins ] , " , " output = output jar , " , " java toolchain = ctx attr java toolchain [ java common java toolchain info ] , " , " ) " , " java custom library = rule ( " , " implementation = impl , " , " outputs = { " , " ' my output ' : ' lib % { name } jar ' " , " } , " , " attrs = { " , " ' srcs ' : attr label list ( allow files = [ ' java ' ] ) , " , " ' deps ' : attr label list ( ) , " , " ' exports ' : attr label list ( ) , " , " ' plugins ' : attr label list ( ) , " , " ' java toolchain ' : attr label ( default = label ( ' / / java / com / google / test : toolchain ' ) ) , " , " } , " , " fragments = [ ' java ' ] " , " ) " ) ; test annotation processing info is starlark accessible ( / * to be processed rule name = * / " java custom library " , / * extra load = * / " load ( ' : custom rule bzl ' , ' java custom library ' ) " ) ; }


creates principal with given name and password

protected void create principal ( final string principal name , final char [ ] password ) throws exception { simple kdc ldap server create principal ( principal name , new string ( password ) ) ; }


compile this jdbc insert using provided parameters and meta - data plus other settings this finalizes the configuration for this object and subsequent attempts to compile are ignored this will be implicitly called the first time an un - compiled insert is executed

public final synchronized void compile ( ) throws invalid data access api usage exception { if ( ! is compiled ( ) ) { if ( get table name ( ) = = null ) { throw new invalid data access api usage exception ( " table name is required " ) ; } try { this jdbc template after properties set ( ) ; } catch ( illegal argument exception ex ) { throw new invalid data access api usage exception ( ex get message ( ) ) ; } compile internal ( ) ; this compiled = true ; if ( logger is debug enabled ( ) ) { logger debug ( " jdbc insert for table [ " + get table name ( ) + " ] compiled " ) ; } } }


returns the transformer object used for transforming the axis values

public transformer get transformer ( ) { return m trans ; }


check if the specified command code is from a known command

public static boolean is known ( int command ) { return cmd 2 string contains key ( command ) ; }


runs the given { @ code supplier with exception } ( a piece of code producing a result ) if an exception happens during that , the given closable is quietly closed

public static < e > e do with cleanup on exception ( final closeable to clean up , final supplier with exception < e , i o exception > code ) throws i o exception { try { return code get ( ) ; } catch ( throwable t ) { i o utils close quietly ( to clean up ) ; exception utils rethrow i o exception ( t ) ; return null ; / / silence the compiler } }


restores the array of objects from the configuration

public static < k > k [ ] load array ( configuration conf , string key name , class < k > item class ) throws i o exception { default stringifier < k > stringifier = new default stringifier < k > ( conf , item class ) ; try { string item str = conf get ( key name ) ; array list < k > list = new array list < k > ( ) ; string [ ] parts = item str split ( separator ) ; for ( string part : parts ) { if ( ! part is empty ( ) ) list add ( stringifier from string ( part ) ) ; } return generics util to array ( item class , list ) ; } finally { stringifier close ( ) ; } }


check if the replica has an associated mmap that has been fully loaded must be called with the cache lock held

public boolean has mmap ( ) { return ( ( mmap data ! = null ) & & ( mmap data instanceof mapped byte buffer ) ) ; }


returns the values from each provided array combined into a single array for example , { @ code concat ( new short [ ] { a , b } , new short [ ] { } , new short [ ] { c } } returns the array { @ code { a , b , c } }

public static short [ ] concat ( short [ ] arrays ) { int length = 0 ; for ( short [ ] array : arrays ) { length + = array length ; } short [ ] result = new short [ length ] ; int pos = 0 ; for ( short [ ] array : arrays ) { system arraycopy ( array , 0 , result , pos , array length ) ; pos + = array length ; } return result ; }


checks the given runtime dependencies , and emits errors if there is a problem also called by { @ link # init common ( ) } for the current target ' s runtime dependencies

public static void check runtime deps ( rule context rule context , list < transitive info collection > runtime dep info ) { for ( transitive info collection c : runtime dep info ) { java info java info = ( java info ) c get ( java info provider get key ( ) ) ; if ( java info = = null ) { continue ; } boolean report error = ! rule context get fragment ( java configuration class ) get allow runtime deps on never link ( ) ; if ( java info is neverlink ( ) ) { string msg = string format ( " neverlink dep % s not allowed in runtime deps " , c get label ( ) ) ; if ( report error ) { rule context attribute error ( " runtime deps " , msg ) ; } else { rule context attribute warning ( " runtime deps " , msg ) ; } } } }


get the comment as an array where each element is a single line for the given type

public string [ ] get comment as array ( int comment type ) { string comment = comments get ( comment type ) ; if ( comment = = null ) return new string [ 0 ] ; string [ ] retvals = new string [ 1 ] ; retvals [ 0 ] = comment ; return retvals ; / / throw new unsupported operation exception ( ) ; }


sets whether this session manager should attach { @ link drm session drm sessions } to the clear sections of the media content using { @ link drm session drm sessions } for clear content avoids the recreation of decoders when transitioning between clear and encrypted sections of content

public builder set use drm sessions for clear content ( int use drm sessions for clear content track types ) { for ( int track type : use drm sessions for clear content track types ) { assertions check argument ( track type = = c track type video | | track type = = c track type audio ) ; } this use drm sessions for clear content track types = use drm sessions for clear content track types clone ( ) ; return this ; }


inner logic of { @ link # get qualified bin ( string ) } , accessible for tests

static file get qualified bin inner ( file hadoop home dir , string executable ) throws file not found exception { string bin dir text = " hadoop bin directory " ; file bin = new file ( hadoop home dir , " bin " ) ; if ( ! bin exists ( ) ) { throw new file not found exception ( add os text ( bin dir text + e does not exist + " : " + bin ) ) ; } if ( ! bin is directory ( ) ) { throw new file not found exception ( add os text ( bin dir text + e not directory + " : " + bin ) ) ; } file exe file = new file ( bin , executable ) ; if ( ! exe file exists ( ) ) { throw new file not found exception ( add os text ( e no executable + " : " + exe file ) ) ; } if ( ! exe file is file ( ) ) { throw new file not found exception ( add os text ( e not executable file + " : " + exe file ) ) ; } try { return exe file get canonical file ( ) ; } catch ( i o exception e ) { / / this isn ' t going to happen , because of all the upfront checks / / so if it does , it gets converted to a fnfe and rethrown throw file not found exception ( e to string ( ) , e ) ; } }


test that we don ' t check block - level md5 if we specify that in the configuration

public void test dont check block md 5 ( ) throws exception { configuration conf = new configuration ( ) ; conf set boolean ( key check block md5 , false ) ; test account = azure blob storage test account create ( conf ) ; test check block md 5 ( false ) ; }


process the uri and return the cluster with nodes setup this is used in all commands

protected disk balancer cluster read cluster info ( command line cmd ) throws exception { preconditions check not null ( cmd ) ; set cluster u r i ( file system get default uri ( get conf ( ) ) ) ; log debug ( " using name node uri : { } " , this get cluster u r i ( ) ) ; cluster connector connector = connector factory get cluster ( this cluster u r i , get conf ( ) ) ; cluster = new disk balancer cluster ( connector ) ; log debug ( " reading cluster info " ) ; cluster read cluster info ( ) ; return cluster ; }


public static utils task < command result > exec cmd async ( final string [ ] commands , final boolean is rooted , final utils consumer < command result > consumer ) { return exec cmd async ( commands , is rooted , true , consumer ) ; }


sending a request to a node without an existing connection should result in an exception

public void test send without connecting ( ) { assert throws ( illegal state exception class , ( ) - > selector send ( create send ( " 0 " , " test " ) ) ) ; }


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

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


copies data in this { @ link sort buffer } to the target { @ link memory segment } in channel index order and returns { @ link buffer with channel } which contains the copied data and the corresponding channel index

buffer with channel copy into segment ( memory segment target ) ;


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


the set of arityplural mappings < code > repeated aapt pb plural entry entry = 1 ; < code >

private void add entry ( int index , com android aapt resources plural entry builder builder for value ) { ensure entry is mutable ( ) ; entry add ( index , builder for value build ( ) ) ; }


validate that the given { @ link spec method model } is static

public static list < spec model validation error > validate method is static ( spec model spec model , spec method model < ? , ? > method model ) { list < spec model validation error > validation errors = new array list < > ( ) ; if ( spec model get spec element type ( ) = = spec element type java class & & ! method model modifiers contains ( modifier static ) ) { validation errors add ( new spec model validation error ( method model represented object , " methods in a spec must be static " ) ) ; } return validation errors ; }


return a new path parent iterator that iterates from the given path to all parents

public static path parent iterator for all ( string path ) { return new path parent iterator ( path , integer max value ) ; }


initializes the array with the provided number of bytes

private void initialize ( int bytes ) { int capacity = bytes / element length in bytes ; preconditions check argument ( capacity > 0 , " requested array with zero capacity " ) ; preconditions check argument ( capacity < = max array size , " requested capacity exceeds limit of " + max array size ) ; data = new byte [ capacity ] ; }


this covers a bug where if a listener was installed that would stop the manager if any service fails and something failed during startup before service start was called on all the services , then await stopped would deadlock due to an illegal state exception that was thrown when trying to stop the timer ( ! )

public void test fail start stop others ( ) throws timeout exception { service a = new fail start service ( ) ; service b = new no op service ( ) ; final service manager manager = new service manager ( as list ( a , b ) ) ; manager add listener ( new listener ( ) { @ override public void failure ( service service ) { manager stop async ( ) ; } } , direct executor ( ) ) ; manager start async ( ) ; manager await stopped ( 10 , time unit milliseconds ) ; }


test decode method with initialized parameter

public void test decode more less than four with zero ( ) { bb clear ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { bb write zero ( i ) ; } try { seata serializer deserialize ( bb array ( ) ) ; assertions fail ( ) ; } catch ( exception e ) { assertions assert true ( e get message ( ) contains ( " not support " ) , " error data " ) ; } }


decide if { @ link windows installer link } should show up in ui , and if so , register it

public static windows installer link register if applicable ( ) { if ( ! functions is windows ( ) ) return null ; / / this is a windows only feature if ( lifecycle get ( ) instanceof windows service lifecycle ) return null ; / / already installed as windows service / / this system property is set by the launcher when we run " java - jar jenkins war " / / and this is how we know where is jenkins war string war = system properties get string ( " executable - war " ) ; if ( war ! = null & & new file ( war ) exists ( ) ) { windows installer link link = new windows installer link ( new file ( war ) ) ; / / todo possibly now unused ( jnlp installation mode is long gone ) : if ( system properties get string ( windows installer link class get name ( ) + " prominent " ) ! = null ) jenkins get ( ) get actions ( ) add ( link ) ; return link ; } return null ; }


the failed number of shards the search was executed on

public int get failed shards ( ) { return shard failures length ; }


called when skipping silences is enabled or disabled in the audio stream

default void on skip silence enabled changed ( boolean skip silence enabled ) { }


removes all keys from this cache , resetting it to its empty state this is equivalent to calling { @ link # remove ( key t ) } on every key which had ever been passed to { @ link # put if absent ( key t , configuration t ) }

public void clear ( ) { / / getting a brand new instance lets the old map be garbage collected , reducing its memory / / footprint from its previous expansions this descriptors = new cache map ( ) ; }


resolves a pattern to one ( potentially compound meaning that spawns multiple indices ) mapping

public void resolve as merged mapping ( string index wildcard , string java regex , boolean include frozen , action listener < index resolution > listener ) { field capabilities request field request = create field caps request ( index wildcard , include frozen ) ; client field caps ( field request , action listener wrap ( response - > listener on response ( merged mappings ( type registry , index wildcard , response get indices ( ) , response get ( ) ) ) , listener : : on failure ) ) ; }


used for synchronous execution if { @ link scope # request } is being used then synchronous execution will only result in collapsing if other threads are running within the same scope

public response type execute ( ) { try { return queue ( ) get ( ) ; } catch ( throwable e ) { if ( e instanceof hystrix runtime exception ) { throw ( hystrix runtime exception ) e ; } / / if we have an exception we know about we ' ll throw it directly without the threading wrapper exception if ( e get cause ( ) instanceof hystrix runtime exception ) { throw ( hystrix runtime exception ) e get cause ( ) ; } / / we don ' t know what kind of exception this is so create a generic message and throw a new hystrix runtime exception string message = get class ( ) get simple name ( ) + " hystrix collapser failed while executing " ; logger debug ( message , e ) ; / / debug only since we ' re throwing the exception and someone higher will do something with it / / todo should this be made a hystrix runtime exception ? throw new runtime exception ( message , e ) ; } }


creates a generic action context with the given provider , with the given context object


cancels the download with the { @ code id } and removes all downloaded data

public void remove download ( string id ) { pending messages + + ; internal handler obtain message ( msg remove download , id ) send to target ( ) ; }


returns whether { @ link # lazy stack trace } will use the special implementation described in its documentation

public static boolean lazy stack trace is lazy ( ) { return get stack trace element method ! = null & & get stack trace depth method ! = null ; }


appends a named { @ code double } array value to the stream

public u b json writer set ( string name , double [ ] value ) throws i o exception { return name ( name ) value ( value ) ; }


exposing { @ link node monitor # all ( ) } for jelly binding

public descriptor extension list < node monitor , descriptor < node monitor > > get node monitor descriptors ( ) { return node monitor all ( ) ; }


fully process { @ code entry } if it is dirty but verified to be clean this can only happen in rare circumstances where a node with a cycle is invalidated at the same version returns true if the entry was successfully processed , meaning that its value has been set and all reverse deps signaled

private static boolean maybe handle verified clean node ( sky key key , node entry entry , parallel evaluator context evaluator context , list < sky key > graph path for debugging ) throws interrupted exception { if ( entry get dirty state ( ) ! = node entry dirty state verified clean ) { return false ; } set < sky key > rdeps = entry mark clean ( ) get rdeps to signal ( ) ; evaluator context signal values and enqueue if ready ( key , rdeps , entry get version ( ) , enqueue parent behavior signal ) ; error info error = entry get error info ( ) ; if ( error get cycle info ( ) is empty ( ) ) { bug report send bug report ( new illegal state exception ( " entry was unchanged from last build , but cycle was found this time and not " + " last time : " + key + " , " + entry + " , " + graph path for debugging ) ) ; } return true ; }


creates a directory for the snapshot cache lucene index

private static path create cache index folder ( node environment node path node path ) throws i o exception { / / " snapshot cache " directory at the root of the specified data path final path snapshot cache root dir = resolve cache index folder ( node path ) ; if ( files exists ( snapshot cache root dir ) = = false ) { logger debug ( " creating new persistent cache index directory [ { } ] " , snapshot cache root dir ) ; files create directories ( snapshot cache root dir ) ; } return snapshot cache root dir ; }


returns the < a href = " http : en wikipedia orgwiki variance # sample variance " > unbiased sample variance of the values if this dataset is a sample drawn from a population , this is an unbiased estimator of the population variance of the population the count must be greater than one this is not guaranteed to return zero when the dataset consists of the same value multiple times , due to numerical errors however , it is guaranteed never to return a negative result < h 3 > non - finite values < h 3 > if the dataset contains any non - finite values ( { @ link double # positive infinity } , { @ link double # negative infinity } , or { @ link double # na n } ) then the result is { @ link double # na n }

public final double sample variance ( ) { check state ( count > 1 ) ; if ( is na n ( sum of squares of deltas ) ) { return na n ; } return ensure non negative ( sum of squares of deltas ) / ( count - 1 ) ; }


single - writer reset of completed counter

public void reset completed ( ) { / / we can avoid the full barrier cost of a volatile set given that / / the counter can be reset from a single thread and it should be reset / / only after any submitted tasks are completed done updater lazy set ( this , 0 ) ; }


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

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


returns a panel containing the widgets displayed on the left side of the main panel

private component build left panel ( ) { j panel panel = new j panel ( ) ; panel set layout ( new border layout ( ) ) ; panel add ( build options panel left ( ) , border layout north ) ; panel add ( box create vertical strut ( 15 ) , border layout center ) ; panel add ( build memory blocks panel ( ) , border layout south ) ; return panel ; }


parse the elements at the root level in the document : " import " , " alias " , " bean "

protected void parse bean definitions ( element root , bean definition parser delegate delegate ) { if ( delegate is default namespace ( root ) ) { node list nl = root get child nodes ( ) ; for ( int i = 0 ; i < nl get length ( ) ; i + + ) { node node = nl item ( i ) ; if ( node instanceof element ) { element ele = ( element ) node ; if ( delegate is default namespace ( ele ) ) { parse default element ( ele , delegate ) ; } else { delegate parse custom element ( ele ) ; } } } } else { delegate parse custom element ( root ) ; } }


public token kind get operator ( ) { return op ; }


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


adds an unnamed value to the formatted output it is strongly encouraged to use { @ link # add ( string , char ) } instead and give value a readable name

public to string helper add value ( char value ) { return add holder ( string value of ( value ) ) ; }


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

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


public item type item type ( ) { return item type ; }


auxiliary method to read a blob key from an input stream

static blob key read from input stream ( input stream input stream ) throws i o exception { final byte [ ] key = new byte [ blob key size ] ; final byte [ ] random = new byte [ abstract i d size ] ; int bytes read = 0 ; / / read key while ( bytes read < key length ) { final int read = input stream read ( key , bytes read , key length - bytes read ) ; if ( read < 0 ) { throw new e o f exception ( " read an incomplete blob key " ) ; } bytes read + = read ; } / / read blob type final blob type blob type ; { final int read = input stream read ( ) ; if ( read < 0 ) { throw new e o f exception ( " read an incomplete blob type " ) ; } else if ( read = = transient blob ordinal ( ) ) { blob type = transient blob ; } else if ( read = = permanent blob ordinal ( ) ) { blob type = permanent blob ; } else { throw new i o exception ( " invalid data received for the blob type : " + read ) ; } } / / read random component bytes read = 0 ; while ( bytes read < abstract i d size ) { final int read = input stream read ( random , bytes read , abstract i d size - bytes read ) ; if ( read < 0 ) { throw new e o f exception ( " read an incomplete blob key " ) ; } bytes read + = read ; } return create key ( blob type , key , random ) ; }


private void set glob paths ( string pattern , boolean exclude directories , future < list < path > > result ) { glob cache put ( pair of ( pattern , exclude directories ) , result ) ; }


test the property ' map of enum string '

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


reads the next four bytes as a signed value

public int read int ( ) { return ( data [ position + + ] & 0x f f ) < < 24 | ( data [ position + + ] & 0x f f ) < < 16 | ( data [ position + + ] & 0x f f ) < < 8 | ( data [ position + + ] & 0x f f ) ; }


public expiration policy to ticket expiration policy ( ) { val oauth = cas properties get authn ( ) get oauth ( ) get access token ( ) ; if ( cas properties get logout ( ) is remove descendant tickets ( ) ) { return new o auth 2 0 access token expiration policy ( beans new duration ( oauth get max time to live in seconds ( ) ) get seconds ( ) , beans new duration ( oauth get time to kill in seconds ( ) ) get seconds ( ) ) ; } return new o auth 2 0 access token expiration policy o auth access token sovereign expiration policy ( beans new duration ( oauth get max time to live in seconds ( ) ) get seconds ( ) , beans new duration ( oauth get time to kill in seconds ( ) ) get seconds ( ) ) ; }


find the nth occurrence of the given byte b in a utf - 8 encoded string

public static int find nth byte ( byte [ ] utf , byte b , int n ) { return find nth byte ( utf , 0 , utf length , b , n ) ; }


apply the given method matcher to the given method , supporting an { @ link org springframework aop introduction aware method matcher } ( if applicable )

public static boolean matches ( method matcher mm , method method , class < ? > target class , boolean has introductions ) { assert not null ( mm , " method matcher must not be null " ) ; return ( mm instanceof introduction aware method matcher ? ( ( introduction aware method matcher ) mm ) matches ( method , target class , has introductions ) : mm matches ( method , target class ) ) ; }


when using the highlighter type { @ code fvh } this setting controls how far to look for boundary characters , and defaults to 20

public hb boundary max scan ( integer boundary max scan ) { this boundary max scan = boundary max scan ; return ( hb ) this ; }


get fakejson form data : test json serialization of form data

default response entity < void > test json form data ( @ api param ( value = " field 1 " , required = true ) @ valid @ request part ( value = " param " , required = true ) string param , @ api param ( value = " field 2 " , required = true ) @ valid @ request part ( value = " param 2 " , required = true ) string param 2 ) { return new response entity < > ( http status not implemented ) ; }


if the associated model of self model is null , the fk value in database should be cleared if it exists when updating

protected void might clear f k value ( lite pal support base obj , associations info association info ) { base obj add f k name to clear self ( get foreign key name ( association info ) ) ; }


public void get pet by id test ( ) throws api exception { / / long pet id = null ; / / pet response = api get pet by id ( pet id ) ; / / todo : test validations }


finds pets by tags multiple tags can be provided with comma separated strings use tag 1 , tag 2 , tag 3 for testing < b > 200 < b > - successful operation < b > 400 < b > - invalid tag value

public set < pet > find pets by tags ( set < string > tags ) throws rest client exception { return find pets by tags with http info ( tags ) get body ( ) ; }


add all constructors from the passed class node ' s methods {

private void add all new constructors ( map < string , method node > methods , class node class node , boolean keep private constructors ) { / / noinspection unchecked for ( method node method : ( list < method node > ) class node methods ) { if ( ! method name equals ( byte code utils constructor ) ) { continue ; } if ( ! is access compatible with instant run ( method access ) ) { continue ; } if ( ! keep private constructors & & ( method access & opcodes acc private ) ! = 0 ) { continue ; } if ( ! class node name equals ( visited class name ) & & ! class node name equals ( visited super name ) ) { continue ; } string key = class node name + " " + method desc ; if ( methods contains key ( key ) ) { continue ; } methods put ( key , method ) ; } }


determine if the specified data type is either a default data type , an undefined data - type , or an array of undefined data - types

public static boolean is undefined ( data type data type ) { if ( data type instanceof default data type ) return true ; if ( data type instanceof undefined ) return true ; return is undefined array ( data type ) ; }


public string get status ( ) { if ( status = = null ) { return null ; } return status value ( ) ; }


void log set permissions ( string src , fs permission permissions ) { set permissions op op = set permissions op get instance ( cache get ( ) ) set source ( src ) set permissions ( permissions ) ; log edit ( op ) ; }


tests that snapshot director behaves correct for delete calls completed snapshots should not be deleted , only ongoing snapshots can

public void delete if not compelted snapshot ( ) throws exception { file folder root = temporary folder get root ( ) ; file folder a = new file ( folder root , string value of ( uuid random u u i d ( ) ) ) ; file folder b = new file ( folder a , string value of ( uuid random u u i d ( ) ) ) ; assert assert true ( folder b mkdirs ( ) ) ; file file = new file ( folder a , " test txt " ) ; assert assert true ( file create new file ( ) ) ; path folder a path = folder a to path ( ) ; snapshot directory snapshot directory = snapshot directory permanent ( folder a path ) ; assert assert true ( snapshot directory cleanup ( ) ) ; assert assert false ( folder a is directory ( ) ) ; assert assert true ( folder a mkdirs ( ) ) ; assert assert true ( file create new file ( ) ) ; snapshot directory = snapshot directory permanent ( folder a path ) ; snapshot directory complete snapshot and get handle ( ) ; assert assert true ( snapshot directory cleanup ( ) ) ; assert assert true ( folder a is directory ( ) ) ; assert assert true ( file exists ( ) ) ; }


decodes a byte from the burrows - wheeler transform stage if the block has randomisation applied , reverses the randomisation

private int decode next b w t byte ( ) { int merged pointer = bwt current merged pointer ; int next decoded byte = merged pointer & 0xff ; bwt current merged pointer = bwt merged pointers [ merged pointer > > > 8 ] ; if ( block randomised ) { if ( - - random count = = 0 ) { next decoded byte ^ = 1 ; random index = ( random index + 1 ) % 512 ; random count = bzip 2 rand r nums ( random index ) ; } } bwt bytes decoded + + ; return next decoded byte ; }


returns the number of rows that are visible in the viewport

public int get num rows in viewport ( ) { return viewport get height ( ) / table get row height ( ) ; }


public void set ( register spec spec ) { set ( spec get reg ( ) , spec ) ; }


public processor new search processor ( ) { return new processor ( needle , jump table ) ; }


identify any path under the directory which begins with the { @ code " part - m - 00000 " } sequence there ' s some compensation for eventual consistency here

private path get part 0 0 0 0 immediately ( file system fs , path dir ) throws i o exception { file status [ ] statuses = fs list status ( dir , path - > path get name ( ) starts with ( part 00000 ) ) ; if ( statuses length ! = 1 ) { / / fail , with a listing of the parent dir contract test utils assert path exists ( fs , " output file " , new path ( dir , part 00000 ) ) ; } return statuses [ 0 ] get path ( ) ; }


get the list of parent model names from the schemas ( all of , any of , one of )

public static list < string > get all parents name ( composed schema composed schema , map < string , schema > all schemas , boolean include ancestors ) { list < schema > interfaces = get interfaces ( composed schema ) ; list < string > names = new array list < string > ( ) ; if ( interfaces ! = null & & ! interfaces is empty ( ) ) { for ( schema schema : interfaces ) { / / get the actual schema if ( string utils is not empty ( schema get $ ref ( ) ) ) { string parent name = get simple ref ( schema get $ ref ( ) ) ; schema s = all schemas get ( parent name ) ; if ( s = = null ) { logger error ( " failed to obtain schema from { } " , parent name ) ; names add ( " unknown parent name " ) ; } else if ( has or inherits discriminator ( s , all schemas ) ) { / / discriminator property name is used names add ( parent name ) ; if ( include ancestors & & s instanceof composed schema ) { names add all ( get all parents name ( ( composed schema ) s , all schemas , true ) ) ; } } else { / / not a parent since discriminator property name is not set } } else { / / not a ref , doing nothing } } } / / ensure ` all parents ` always includes ` parent ` / / this is more robust than keeping logic in get parent name ( ) and get all parents name ( ) in sync string parent name = get parent name ( composed schema , all schemas ) ; if ( parent name ! = null & & ! names contains ( parent name ) ) { names add ( parent name ) ; } return names ; }


void register and connect ( socket channel sock , inet socket address addr ) throws i o exception { sock key = sock register ( selector , selection key op connect ) ; boolean immediate connect = sock connect ( addr ) ; if ( immediate connect ) { send thread prime connection ( ) ; } }


get the number of maps in the { @ link job story }


gets the { @ link resource } that represents the workspace of this project useful for locking and mutual exclusion control

public resource get workspace resource ( ) { return new resource ( get full display name ( ) + " workspace " ) ; }


adds the { @ code flag } to this buffer ' s flags

public final void add flag ( @ c buffer flags int flag ) { flags | = flag ; }


get a copy of the filter that indicates which parts of the program should be merged

public program merge filter get merge filter ( ) { return merge engine get merge filter ( ) ; }


returns a class value with the given class name

private static < t > flink kafka partitioner < t > initialize partitioner ( string name , class loader class loader ) { try { class < ? > clazz = class for name ( name , true , class loader ) ; if ( ! flink kafka partitioner class is assignable from ( clazz ) ) { throw new validation exception ( string format ( " sink partitioner class ' % s ' should extend from the required class % s " , name , flink kafka partitioner class get name ( ) ) ) ; } @ suppress warnings ( " unchecked " ) final flink kafka partitioner < t > kafka partitioner = instantiation util instantiate ( name , flink kafka partitioner class , class loader ) ; return kafka partitioner ; } catch ( class not found exception | flink exception e ) { throw new validation exception ( string format ( " could not find and instantiate partitioner class ' % s ' " , name ) , e ) ; } }


gets the next smallest element , with respect to the definition of order implied by the { @ link type serializer } provided to this iterator

public e next ( ) throws i o exception { if ( this heap size ( ) > 0 ) { / / get the smallest element final head stream < e > top = this heap peek ( ) ; e result = top get head ( ) ; / / read an element if ( ! top next head ( ) ) { this heap poll ( ) ; } else { this heap adjust top ( ) ; } return result ; } else { return null ; } }


tries to parse a list of labels into a { @ link package groups rule visibility }

public static package groups rule visibility try parse ( label rule label , list < label > labels ) { return new package groups rule visibility ( rule label , labels ) ; }


creates a < code > key provider crypto extension < code > using a given { @ link key provider } if the given < code > key provider < code > implements the { @ link crypto extension } interface the < code > key provider < code > itself will provide the extension functionality if the given < code > key provider < code > implements the { @ link key provider extension } interface and the key provider being extended by the < code > key provider < code > implements the { @ link crypto extension } interface , the key provider being extended will provide the extension functionality otherwise , a default extension implementation will be used

public static key provider crypto extension create key provider crypto extension ( key provider key provider ) { crypto extension crypto extension = null ; if ( key provider instanceof crypto extension ) { crypto extension = ( crypto extension ) key provider ; } else if ( key provider instanceof key provider extension & & ( ( key provider extension ) key provider ) get key provider ( ) instanceof key provider crypto extension crypto extension ) { key provider extension key provider extension = ( key provider extension ) key provider ; crypto extension = ( crypto extension ) key provider extension get key provider ( ) ; } else { crypto extension = new default crypto extension ( key provider ) ; } return new key provider crypto extension ( key provider , crypto extension ) ; }


attaches the tool tip from the gui resources that corresponds to the given key , to the given component

private static j component tip ( j component component , string message key ) { component set tool tip text ( msg ( message key ) ) ; return component ; }


returns the product of { @ code a } and { @ code b } unless it would overflow or underflow in which case { @ code integer max value } or { @ code integer min value } is returned , respectively

public static int saturated multiply ( int a , int b ) { return ints saturated cast ( ( long ) a * b ) ; }


check if this type is assignable from the given type

public boolean is assignable from ( type from ) { if ( from = = null ) { return false ; } if ( type equals ( from ) ) { return true ; } if ( type instanceof class < ? > ) { return raw type is assignable from ( $ gson $ types get raw type ( from ) ) ; } else if ( type instanceof parameterized type ) { return is assignable from ( from , ( parameterized type ) type , new hash map < string , type > ( ) ) ; } else if ( type instanceof generic array type ) { return raw type is assignable from ( $ gson $ types get raw type ( from ) ) & & is assignable from ( from , ( generic array type ) type ) ; } else { throw build unexpected type error ( type , class class , parameterized type class , generic array type class ) ; } }


static public scale to action scale to ( float x , float y ) { return scale to ( x , y , 0 , null ) ; }


parse the dense vector from a formatted string the format of a dense vector is space separated values such as " 1 2 3 4 "

public static dense vector parse dense ( string str ) { if ( org apache flink util string utils is null or whitespace only ( str ) ) { return new dense vector ( ) ; } int len = str length ( ) ; int in data buff pos = 0 ; boolean is in buff = false ; for ( int i = 0 ; i < len ; + + i ) { char c = str char at ( i ) ; if ( c = = element delimiter / / to be compatible with previous delimiter | | c = = ' , ' ) { if ( is in buff ) { in data buff pos + + ; } is in buff = false ; } else { is in buff = true ; } } if ( is in buff ) { in data buff pos + + ; } double [ ] data = new double [ in data buff pos ] ; int lastest in char buff pos = 0 ; in data buff pos = 0 ; is in buff = false ; for ( int i = 0 ; i < len ; + + i ) { char c = str char at ( i ) ; if ( c = = element delimiter ) { if ( is in buff ) { data [ in data buff pos + + ] = double parse double ( string utils substring ( str , lastest in char buff pos , i ) trim ( ) ) ; lastest in char buff pos = i + 1 ; } is in buff = false ; } else { is in buff = true ; } } if ( is in buff ) { data [ in data buff pos ] = double value of ( string utils substring ( str , lastest in char buff pos ) trim ( ) ) ; } return new dense vector ( data ) ; }


set the desired orientation of this activity

public selection creator restrict orientation ( @ screen orientation int orientation ) { m selection spec orientation = orientation ; return this ; }


returns the file offset to the relocations for this section

public int get pointer to relocations ( ) { return s relptr ; }


delete purchase order by id for valid response try integer i ds with value & lt ; 1000 anything above 1000 or nonintegers will generate api errors

public void delete order ( string order id ) throws api exception { delete order with http info ( order id ) ; }


get a m r m proxy policy from state store , using default queue and configuration as fallback

public static federation a m r m proxy policy load a m r m policy ( string queue , federation a m r m proxy policy old policy , configuration conf , federation state store facade federation facade , sub cluster id home sub cluster id ) throws federation policy initialization exception { / / local policy and its configuration sub cluster policy configuration configuration = load policy configuration ( queue , conf , federation facade ) ; / / instantiate the policy manager and get policy federation policy initialization context context = new federation policy initialization context ( configuration , federation facade get sub cluster resolver ( ) , federation facade , home sub cluster id ) ; log info ( " creating policy manager of type : " + configuration get type ( ) ) ; federation policy manager federation policy manager = instantiate policy manager ( configuration get type ( ) ) ; / / set queue , reinit policy if required ( implementation lazily check / / content of conf ) , and cache it federation policy manager set queue ( configuration get queue ( ) ) ; return federation policy manager get a m r m policy ( context , old policy ) ; }


walk through all regex mount points to see whether the path match any regex expressions e g link : ^ user ( ? < username > \ \ w + ) = > s 3 : $ user apache com $ { user } src path : is userhadoopdir 1 resolve last component : true then return value is s 3 : hadoop apache com hadoop

protected resolve result < t > try resolve in regex mountpoint ( final string src path , final boolean resolve last component ) { for ( regex mount point regex mount point : regex mount point list ) { resolve result resolve result = regex mount point resolve ( src path , resolve last component ) ; if ( resolve result ! = null ) { return resolve result ; } } return null ; }


public expression parsing context parse ( ) { try ( expression parsing context ctx = expression parsing context create ( ) ) { result r = run ( immutable map of ( ) ) ; if ( ! r is success ( ) & & r is throwable ( ) ) { throw new expression parsing exception ( " failed to parse expression : " + literal + " , error : " + r get error ( ) ) ; } if ( log is debug enabled ( ) ) { log debug ( " \ " { } \ " is parsed " , literal ) ; } ctx validate ( literal ) ; return ctx ; } }


public long get data slot ( ) { return ( ( data high level shader language symbol internals 3 2 ) internals ) get data slot ( ) ; }


sets the < code > anytype 3 < code > property

public void set anytype 3 ( object anytype 3 ) { this anytype 3 = anytype 3 ; }


returns a snapshot of the entry named { @ code key } , or null if it doesn ' t exist is not currently readable if a value is returned , it is moved to the head of the lru queue

public synchronized snapshot get ( string key ) throws i o exception { check not closed ( ) ; validate key ( key ) ; entry entry = lru entries get ( key ) ; if ( entry = = null ) { return null ; } if ( ! entry readable ) { return null ; } / / open all streams eagerly to guarantee that we see a single published / / snapshot if we opened streams lazily then the streams could come / / from different edits file [ ] files = new file [ value count ] ; input stream [ ] ins = new input stream [ value count ] ; try { file file ; for ( int i = 0 ; i < value count ; i + + ) { file = entry get clean file ( i ) ; files [ i ] = file ; ins [ i ] = new file input stream ( file ) ; } } catch ( file not found exception e ) { / / a file must have been deleted manually ! for ( int i = 0 ; i < value count ; i + + ) { if ( ins [ i ] ! = null ) { util close quietly ( ins [ i ] ) ; } else { break ; } } return null ; } redundant op count + + ; journal writer append ( read + ' ' + key + ' \ n ' ) ; if ( journal rebuild required ( ) ) { executor service submit ( cleanup callable ) ; } return new snapshot ( key , entry sequence number , files , ins , entry lengths ) ; }


public static abstract resource get resource from ( final string location ) throws i o exception { val resource = get raw resource from ( location ) ; if ( ! resource exists ( ) | | ! resource is readable ( ) ) { throw new file not found exception ( " resource " + location + " does not exist or is unreadable " ) ; } return resource ; }


shutdown handler query the service hook reference - if it is still valid the { @ link service # stop ( ) } operation is invoked


by default , does just the same as reset ( ) used to add special behaviour in ogg music


we only check boolean value at this moment

public static boolean is type match ( class < ? > type , string value ) { return class utils is type match ( type , value ) ; }


it enforces the the kerberos spnego authentication sequence returning an { @ link authentication token } only after the kerberos spnego sequence has completed successfully ( in the case of java access ) and only after the custom authentication implemented by the subclass in alternate authenticate has completed successfully ( in the case of browser access )

public authentication token authenticate ( http servlet request request , http servlet response response ) throws i o exception , authentication exception { authentication token token ; if ( is browser ( request get header ( " user - agent " ) ) ) { token = alternate authenticate ( request , response ) ; } else { token = super authenticate ( request , response ) ; } return token ; }


scale down the value for 1 0ten scale ( this : = this 5ten scale ) this method rounds - up , eg 4410 = 4 , 4410 = 5

private static void scale down ten round up ( slice decimal , int ten scale , slice result ) { boolean round ; do { int power ten = math min ( ten scale , max power of ten int ) ; ten scale - = power ten ; int divisor = powers of ten int [ power ten ] ; round = divide check round ( decimal , divisor , result ) ; decimal = result ; } while ( ten scale > 0 ) ; if ( round ) { increment unsafe ( decimal ) ; } }


actually builder the desired instance of the pub sub sink

public pub sub sink < in > build ( ) throws i o exception { if ( credentials = = null ) { if ( host and port = = null ) { / / no host and port is the normal scenario so we use the default credentials credentials = default credentials provider builder ( ) build ( ) get credentials ( ) ; } else { / / with host and port the pub sub emulator is used so we do not have credentials credentials = emulator credentials get instance ( ) ; } } return new pub sub sink < > ( credentials , serialization schema , project name , topic name , host and port ) ; }


tests concurrent increment and get calls from multiple threads and verifies that the numbers counts strictly increasing

public void test concurrent get and increment ( ) throws exception { / / config final int num threads = 8 ; / / setup final count down latch start latch = new count down latch ( 1 ) ; final checkpoint i d counter counter = create checkpoint id counter ( ) ; counter start ( ) ; executor service executor = null ; try { executor = executors new fixed thread pool ( num threads ) ; list < future < list < long > > > result futures = new array list < > ( num threads ) ; for ( int i = 0 ; i < num threads ; i + + ) { result futures add ( executor submit ( new incrementer ( start latch , counter ) ) ) ; } / / kick off the incrementing start latch count down ( ) ; final int expected total = num threads * incrementer num increments ; list < long > all = new array list < > ( expected total ) ; / / get the counts for ( future < list < long > > result : result futures ) { list < long > counts = result get ( ) ; all add all ( counts ) ; } / / verify collections sort ( all ) ; assert equals ( expected total , all size ( ) ) ; long current = 0 ; for ( long val : all ) { / / incrementing counts assert equals ( + + current , val ) ; } / / the final count assert equals ( expected total + 1 , counter get ( ) ) ; assert equals ( expected total + 1 , counter get and increment ( ) ) ; } finally { if ( executor ! = null ) { executor shutdown ( ) ; } counter shutdown ( job status finished ) ; } }


generates a string form of a request to be written to the logs , filtering the user environment to remove anything that looks private the current filter criteria removes any variable whose name includes " auth " , " pass " , or " cookie "

public static string get request log string ( list < string > request strings ) { string builder buf = new string builder ( ) ; buf append ( ' [ ' ) ; string sep = " " ; matcher m = suppress from log matcher ( " " ) ; for ( string s : request strings ) { buf append ( sep ) ; m reset ( s ) ; if ( m looking at ( ) ) { buf append ( m group ( ) ) ; buf append ( " private value removed " ) ; } else { buf append ( s ) ; } sep = " , " ; } buf append ( ' ] ' ) ; return buf to string ( ) ; }


create a { @ link subscriber } with the given parameters

public static < t , r > subscriber < t > subscribe ( subscriber < ? super r > downstream , function < ? super t , ? extends stream < ? extends r > > mapper , int prefetch ) { return new flat map stream subscriber < > ( downstream , mapper , prefetch ) ; }


configure a base url for requests effectively a shortcut for : < pre class = " code " > string base url = " https : abc go comv 1 " ; default uri builder factory factory = new default uri builder factory ( base url ) ; web client client = web client builder ( ) uri builder factory ( factory ) build ( ) ; the { @ code default uri builder factory } is used to prepare the url for every request with the given base url , unless the url request for a given url is absolute in which case the base url is ignored note : this method is mutually exclusive with { @ link # uri builder factory ( uri builder factory ) } if both are used , the base url value provided here will be ignored

builder base url ( string base url ) ; / * * * configure default uri variable values that will be used when expanding * uri templates using a { @ link map } * @ param default uri variables the default values to use * @ see # base url ( string ) * @ see # uri builder factory ( uri builder factory ) * /


< code > optional bytes data = 1 ; < code >

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


public void register all ( string prefix , metric set metrics ) throws illegal argument exception { / / nop }


return true if this cat object is equal to o

public boolean equals ( object o ) { if ( this = = o ) { return true ; } if ( o = = null | | get class ( ) ! = o get class ( ) ) { return false ; } cat cat = ( cat ) o ; return objects equals ( this declawed , cat declawed ) & & super equals ( o ) ; }


unset an erasure coding policy from the given path

void unset erasure coding policy ( final string src arg , final boolean log retry cache ) throws i o exception , unresolved link exception , safe mode exception , access control exception { final string operation name = " unset erasure coding policy " ; check operation ( operation category write ) ; check erasure coding supported ( operation name ) ; file status resulting stat = null ; final f s permission checker pc = get permission checker ( ) ; f s permission checker set operation type ( operation name ) ; write lock ( ) ; try { check operation ( operation category write ) ; check name node safe mode ( " cannot unset erasure coding policy on " + src arg ) ; resulting stat = f s dir erasure coding op unset erasure coding policy ( this , src arg , pc , log retry cache ) ; } finally { write unlock ( operation name , get lock report info supplier ( src arg , null , resulting stat ) ) ; } get edit log ( ) log sync ( ) ; log audit event ( true , operation name , src arg , null , resulting stat ) ; }


return a proxy invoked when clients obtain beans from this factory bean create an instance of the aop proxy to be returned by this factory the instance will be cached for a singleton , and create on each call to { @ code get object ( ) } for a proxy

public object get object ( ) throws beans exception { initialize advisor chain ( ) ; if ( is singleton ( ) ) { return get singleton instance ( ) ; } else { if ( this target name = = null ) { logger info ( " using non - singleton proxies with singleton targets is often undesirable " + " enable prototype proxies by setting the ' target name ' property " ) ; } return new prototype instance ( ) ; } }


auth info for the cnxn , returns an unmodifyable list

public list < id > get auth info ( ) { return collections unmodifiable list ( new array list < > ( auth info ) ) ; }


saves the current chart state with the given name to the given path on the sdcard leaving the path empty " " will put the saved file directly on the sd card chart is saved as a png image , example : save to path ( " myfilename " , " foldername 1foldername 2 " ) ;

public boolean save to path ( string title , string path on s d ) { bitmap b = get chart bitmap ( ) ; output stream stream = null ; try { stream = new file output stream ( environment get external storage directory ( ) get path ( ) + path on s d + " / " + title + " png " ) ; / * * write bitmap to file using jpeg or png and 40 % quality hint for * jpeg * / b compress ( compress format png , 40 , stream ) ; stream close ( ) ; } catch ( exception e ) { e print stack trace ( ) ; return false ; } return true ; }


returns true if the edges in this network are directed directed edges connect a { @ link endpoint pair # source ( ) source node } to a { @ link endpoint pair # target ( ) target node } , while undirected edges connect a pair of nodes to each other


public void test rename dir and delete snapshot 7 ( ) throws exception { fsn get snapshot manager ( ) set allow nested snapshots ( true ) ; final path test = new path ( " / test " ) ; final path dir 1 = new path ( test , " dir 1 " ) ; final path dir 2 = new path ( test , " dir 2 " ) ; hdfs mkdirs ( dir 1 ) ; hdfs mkdirs ( dir 2 ) ; final path foo = new path ( dir 2 , " foo " ) ; final path bar = new path ( foo , " bar " ) ; final path file = new path ( bar , " file " ) ; d f s test util create file ( hdfs , file , blocksize , repl , seed ) ; / / take a snapshot s 0 and s 1 on / test snapshot test helper create snapshot ( hdfs , test , " s 0 " ) ; snapshot test helper create snapshot ( hdfs , test , " s 1 " ) ; / / delete file so we have a snapshot copy for s 1 in bar hdfs delete ( file , true ) ; / / create another snapshot on dir 2 snapshot test helper create snapshot ( hdfs , dir 2 , " s 2 " ) ; / / rename foo from dir 2 to dir 1 final path newfoo = new path ( dir 1 , foo get name ( ) ) ; hdfs rename ( foo , newfoo ) ; / / delete snapshot s 1 hdfs delete snapshot ( test , " s 1 " ) ; / / make sure the snapshot copy of file in s 1 is merged to s 0 for / / hdfs - 4842 , we need to make sure that we do not wrongly use s 2 as the / / prior snapshot of s 1 final path file s 2 = snapshot test helper get snapshot path ( dir 2 , " s 2 " , " foo / bar / file " ) ; assert false ( hdfs exists ( file s 2 ) ) ; final path file s 0 = snapshot test helper get snapshot path ( test , " s 0 " , " dir 2 / foo / bar / file " ) ; assert true ( hdfs exists ( file s 0 ) ) ; / / check dir 1 : foo should be in the created list of s 0 i node directory dir 1 node = fsdir get i node 4 write ( dir 1 to string ( ) ) as directory ( ) ; diff list < directory diff > dir 1 diff list = dir 1 node get diffs ( ) as list ( ) ; assert equals ( 1 , dir 1 diff list size ( ) ) ; final children diff children diff = dir 1 diff list get ( 0 ) get children diff ( ) ; assert sizes ( 1 , 0 , children diff ) ; i node c node = children diff get created unmodifiable ( ) get ( 0 ) ; i node foo node = fsdir get i node 4 write ( newfoo to string ( ) ) ; assert same ( c node , foo node ) ; / / check foo and its subtree final path newbar = new path ( newfoo , bar get name ( ) ) ; i node directory bar node = fsdir get i node 4 write ( newbar to string ( ) ) as directory ( ) ; assert same ( foo node as directory ( ) , bar node get parent ( ) ) ; / / bar should only have a snapshot diff for s 0 diff list < directory diff > bar diff list = bar node get diffs ( ) as list ( ) ; assert equals ( 1 , bar diff list size ( ) ) ; directory diff diff = bar diff list get ( 0 ) ; i node directory test node = fsdir get i node 4 write ( test to string ( ) ) as directory ( ) ; snapshot s 0 = test node get snapshot ( d f s util string 2 bytes ( " s 0 " ) ) ; assert equals ( s 0 get id ( ) , diff get snapshot id ( ) ) ; / / and file should be stored in the deleted list of this snapshot diff assert equals ( " file " , diff get children diff ( ) get deleted unmodifiable ( ) get ( 0 ) get local name ( ) ) ; / / check dir 2 : a with name instance for foo should be in the deleted list / / of the snapshot diff for s 2 i node directory dir 2 node = fsdir get i node 4 write ( dir 2 to string ( ) ) as directory ( ) ; diff list < directory diff > dir 2 diff list = dir 2 node get diffs ( ) as list ( ) ; / / dir 2 node should contain 1 snapshot diffs for s 2 assert equals ( 1 , dir 2 diff list size ( ) ) ; final list < i node > d list = dir 2 diff list get ( 0 ) get children diff ( ) get deleted unmodifiable ( ) ; assert equals ( 1 , d list size ( ) ) ; final path foo s 2 = snapshot test helper get snapshot path ( dir 2 , " s 2 " , foo get name ( ) ) ; i node reference with name foo node s 2 = ( i node reference with name ) fsdir get i node ( foo s 2 to string ( ) ) ; assert same ( d list get ( 0 ) , foo node s 2 ) ; assert same ( foo node as reference ( ) get referred i node ( ) , foo node s 2 get referred i node ( ) ) ; restart cluster and check image ( true ) ; }


returns the class value - using validator , or falls back to the " weak set " implementation if unable to do so

static get checked type validator get best validator ( ) { try { class < ? > the class = class for name ( class value validator name ) ; return ( get checked type validator ) the class get enum constants ( ) [ 0 ] ; } catch ( throwable t ) { / / ensure we really catch * everything * return weak set validator ( ) ; } }


write headers via { @ link http 2 frame writer } if { @ code has priority } is { @ code false } it will ignore the { @ code stream dependency } , { @ code weight } and { @ code exclusive } parameters

private static channel future send headers ( http 2 frame writer frame writer , channel handler context ctx , int stream id , http 2 headers headers , final boolean has priority , int stream dependency , final short weight , boolean exclusive , final int padding , boolean end of stream , channel promise promise ) { if ( has priority ) { return frame writer write headers ( ctx , stream id , headers , stream dependency , weight , exclusive , padding , end of stream , promise ) ; } return frame writer write headers ( ctx , stream id , headers , padding , end of stream , promise ) ; }


public file system ref dup ( ) { return fs get ref manager ( ) create ( ) ; }


forces a reset of the private queue counter could make changes to queue to make that easier , but decided against that

private void reset queue state ( ) throws i o exception { file queue file = r jenkins get queue ( ) get x m l queue file ( ) ; xml file xml file = new xml file ( queue xstream , queue file ) ; xml file write ( new queue state ( ) ) ; r jenkins get queue ( ) load ( ) ; }


processes a single program , adding it to the library

private void populate library from program ( program program ) throws cancelled exception { fid hasher hasher = service get hasher ( program ) ; array list < function > the functions = new array list < > ( ) ; map < function , function row > record map = new hash map < > ( ) ; / / 1 ) hash all the functions , create function rows for them hash all the functions ( program , hasher , the functions , record map ) ; / / 3 ) add all the forward ( child ) call relatives for ( entry < function , function row > entry : record map entry set ( ) ) { monitor check canceled ( ) ; function function = entry get key ( ) ; function row function row = entry get value ( ) ; if ( function row ! = null ) { function row children = new array list < > ( ) ; add child relations ( function , hasher , record map , function row children ) ; collections sort ( function row children ) ; long hash = function row generate hash ( ) ; if ( global unique function add ( hash ) ) { function row commit ( fid db , library ) ; / / create the database record } else { exclude ( program get domain file ( ) , function , fid populate result disposition duplicate info ) ; } } } for ( entry < function , function row > entry : record map entry set ( ) ) { monitor check canceled ( ) ; function row function row = entry get value ( ) ; function record function record = function row function record ; if ( function record = = null ) { continue ; / / function exists but was excluded as a duplicate } for ( child row child row : function row children ) { if ( child row is very common ) { continue ; / / so common , don ' t use parent / child as distinguisher } if ( child row to row = = null ) { if ( child row symbol name ! = null ) { add unresolved symbol ( function record , child row symbol name , null ) ; } } else if ( child row to row function record = = null ) { / / this child was removed locally as a duplicate / / we need to convert this to unresolved symbol , but in this case we know the hash add unresolved symbol ( function record , child row to row name , child row to row hash quad ) ; } else { fid db create relation ( function record , child row to row function record , relation type direct call ) ; } } } }


public binary reader get reader ( ) { return reader ; }


returns the next character without incrementing the current index

public char peek ( ) { debug check ( 0 ) ; return iter peek ( ) ; }


creates a channel for the specified recipient

public static synchronized @ nullable string create channel for ( @ non null context context , @ non null recipient recipient ) { if ( recipient get id ( ) is unknown ( ) ) return null ; vibrate state vibrate state = recipient get message vibrate ( ) ; boolean vibration enabled = vibrate state = = vibrate state default ? text secure preferences is notification vibrate enabled ( context ) : vibrate state = = vibrate state enabled ; uri message ringtone = recipient get message ringtone ( ) ! = null ? recipient get message ringtone ( ) : get message ringtone ( context ) ; string display name = recipient get display name ( context ) ; return create channel for ( context , generate channel id for ( recipient ) , display name , message ringtone , vibration enabled ) ; }


turns a keyvalue pair into a javac annotation processor flag received by data binding

private static string create processor flag ( string flag , string value ) { return string format ( " - aandroid databinding % s = % s " , flag , value ) ; }


create the { @ linkplain aggregator } when any of the configured fields can be resolved to a { @ link values source }

protected abstract aggregator do create internal ( map < string , values source > values sources , aggregator parent , cardinality upper bound cardinality , map < string , object > metadata ) throws i o exception ;


invoke this to delegate an error signal to the subscriber

public void publish error ( throwable t ) { if ( rs write result logger is trace enabled ( ) ) { rs write result logger trace ( this log prefix + this state + " publish error : " + t ) ; } this state get ( ) publish error ( this , t ) ; }


public static list < file > unzip file ( final file zip file , final file dest dir ) throws i o exception { return unzip file by keyword ( zip file , dest dir , null ) ; }


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


public boolean remove ( runnable runnable ) { return delta queue remove ( runnable ) ; }


postmultiplies this matrix with a ( counter - clockwise ) rotation matrix

public affine 2 rotate rad ( float radians ) { if ( radians = = 0 ) return this ; float cos = math utils cos ( radians ) ; float sin = math utils sin ( radians ) ; float tmp 0 0 = m 0 0 * cos + m 0 1 * sin ; float tmp 0 1 = m 0 0 * - sin + m 0 1 * cos ; float tmp 1 0 = m 1 0 * cos + m 1 1 * sin ; float tmp 1 1 = m 1 0 * - sin + m 1 1 * cos ; m 0 0 = tmp 0 0 ; m 0 1 = tmp 0 1 ; m 1 0 = tmp 1 0 ; m 1 1 = tmp 1 1 ; return this ; }


see value ( type ) above this method is only meant for starlark usage

public builder < type > default value ( object default value ) throws conversion exception { return default value ( default value , null , null ) ; }


test that even with a cast , some things aren ' t allowed

public void test illegal explicit conversions ( ) { expect script throws ( class cast exception class , ( ) - > { exec ( " boolean x = true ; int y = ( int ) + x ; return y " ) ; } ) ; expect script throws ( class cast exception class , ( ) - > { exec ( " boolean x = true ; int y = ( int ) ( x ^ false ) ; return y " ) ; } ) ; expect script throws ( class cast exception class , ( ) - > { exec ( " long x = 5l ; boolean y = ( boolean ) + x ; return y " ) ; } ) ; expect script throws ( class cast exception class , ( ) - > { exec ( " long x = 5l ; boolean y = ( boolean ) ( x + x ) ; return y " ) ; } ) ; }


void op ( byte trie node ifc < t > node ) ;


helper method to set username for the first http basic authentication

public api client set username ( string username ) { for ( authentication auth : authentications values ( ) ) { if ( auth instanceof http basic auth ) { ( ( http basic auth ) auth ) set username ( username ) ; return this ; } } throw new runtime exception ( " no http basic authentication configured ! " ) ; }


convert the given value for the specified target property

private object convert for property ( @ nullable object value , string property name , bean wrapper bw , type converter converter ) { if ( converter instanceof bean wrapper impl ) { return ( ( bean wrapper impl ) converter ) convert for property ( value , property name ) ; } else { property descriptor pd = bw get property descriptor ( property name ) ; method parameter method param = bean utils get write method parameter ( pd ) ; return converter convert if necessary ( value , pd get property type ( ) , method param ) ; } }


emits { @ link string } output of this class into the provided { @ link string builder }

public void emit ( string builder builder ) { builder append ( this get class ( ) get simple name ( ) ) ; }


creates a new request builder instance for a local resource image only image resources can be used with the image pipeline ( png , jpg , gif ) other resource types such as strings or xml drawables make no sense in the context of the image pipeline and so cannot be supported attempts to do so will throw an { @ link java lang illegal argument exception } when the pipeline tries to decode the resource one potentially confusing case is drawable declared in xml ( e g shape drawable ) this is not an image if you want to display an xml drawable as the main image , then set it as a placeholder and do not set a uri

public static image request builder new builder with resource id ( int res id ) { return new builder with source ( uri util get uri for resource id ( res id ) ) ; }


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


sets the versioning type defaults to { @ link version type # internal }

t version type ( version type version type ) ;


public status new status ( final q name code value , final string status message ) { val status = saml utils new saml object ( status class ) ; val code = saml utils new saml object ( status code class ) ; code set value ( code value ) ; status set status code ( code ) ; if ( string utils is not blank ( status message ) ) { val message = saml utils new saml object ( status message class ) ; message set value ( status message ) ; status set status message ( message ) ; } return status ; }


pulls a { @ link project } above a { @ link correlate } from its rhs input enforces nullability for join output

private rel node aggregate correlator output ( correlate correlate , project project , set < integer > is count ) { final rel node left = correlate get left ( ) ; final join rel type join type = correlate get join type ( ) ; / / now create the new project final list < pair < rex node , string > > new projects = new array list < > ( ) ; / / project everything from the lhs and then those from the original / / project final list < rel data type field > left input fields = left get row type ( ) get field list ( ) ; for ( int i = 0 ; i < left input fields size ( ) ; i + + ) { new projects add ( rex input ref of 2 ( i , left input fields ) ) ; } / / marked where the projected expr is coming from so that the types will / / become nullable for the original projections which are now coming out / / of the nullable side of the oj boolean project pulled above left correlator = join type generates nulls on right ( ) ; for ( pair < rex node , string > pair : project get named projects ( ) ) { rex node new proj expr = remove correlation expr ( pair left , project pulled above left correlator , is count ) ; new projects add ( pair of ( new proj expr , pair right ) ) ; } return rel builder push ( correlate ) project named ( pair left ( new projects ) , pair right ( new projects ) , true ) build ( ) ; }


return the configured proxy class loader for this processor

protected class loader get proxy class loader ( ) { return this proxy class loader ; }


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


returns the record number of the underlying type

public record number get modified record number ( ) { return underlying record number ; }


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


public void put ( @ non null final string key , final long value , final boolean is commit ) { if ( is commit ) { sp edit ( ) put long ( key , value ) commit ( ) ; } else { sp edit ( ) put long ( key , value ) apply ( ) ; } }


identifier used to encode this strategy , when marshalled as part of a bloom filter only values in the [ - 128 , 127 ] range are valid for the compact serial form non - negative values are reserved for enums defined in bloom filter strategies ; negative values are reserved for any custom , stateful strategy we may define ( e g any kind of strategy that would depend on user input )


start the work , dispatch tasks and stop the thread pool at last

private static void execute ( work center work center , task set task set ) throws interrupted exception { var workers = work center get workers ( ) ; var exec = executors new fixed thread pool ( workers size ( ) ) ; workers for each ( exec : : submit ) ; thread sleep ( 1000 ) ; add tasks ( task set ) ; exec await termination ( 2 , time unit seconds ) ; exec shutdown now ( ) ; }


delete user this can only be done by the logged in user < b > 400 < b > - invalid username supplied < b > 404 < b > - user not found

public void delete user ( string username ) throws i o exception { delete user for http response ( username ) ; }


associate the given hint with the data buffer if it is a pooled buffer and supports leak tracking

public static < t extends data buffer > t touch ( t data buffer , object hint ) { if ( data buffer instanceof pooled data buffer ) { return ( t ) ( ( pooled data buffer ) data buffer ) touch ( hint ) ; } else { return data buffer ; } }


create a new record whose value is in the center portion of the valid values range for byte , short , int , or long only use with long key tables

static d b record create mid range record ( table table , field key , int var data size , boolean do insert ) throws i o exception , duplicate key exception { / / check for duplicate key if ( do insert ) { d b record old rec = table get record ( key ) ; if ( old rec ! = null ) { throw new duplicate key exception ( ) ; } } / / create record and fill with data d b record rec = table get schema ( ) create record ( key ) ; fill mid range record ( rec , var data size ) ; / / insert record if requested if ( do insert ) { int cnt = table get record count ( ) ; table put record ( rec ) ; assert assert equals ( 1 , table get record count ( ) - cnt ) ; } return rec ; }


public static void main ( string [ ] argv ) throws exception { if ( argv length < 2 ) { system err println ( " usage : test map reduce < range > < counts > " ) ; system err println ( ) ; system err println ( " note : a good test will have a < counts > value " + " that is substantially larger than the < range > " ) ; return ; } int i = 0 ; range = integer parse int ( argv [ i + + ] ) ; counts = integer parse int ( argv [ i + + ] ) ; try { launch ( ) ; } finally { file util fully delete ( test dir ) ; } }


wraps the given drawable with a new { @ link matrix drawable } if the provided drawable or matrix is null , the given drawable is returned without being wrapped

static drawable maybe wrap with matrix ( @ nullable drawable drawable , @ nullable matrix matrix ) { if ( drawable = = null | | matrix = = null ) { return drawable ; } return new matrix drawable ( drawable , matrix ) ; }


replaces the instruction at a given offset by a given push instruction of a constant

private void replace constant push instruction ( clazz clazz , int offset , instruction instruction , byte replacement opcode , int value ) { instruction replacement instruction = new simple instruction ( replacement opcode , value ) ; replace instruction ( clazz , offset , instruction , replacement instruction ) ; }


this test validates the correctness of { @ link r m web service protocol # get app queue ( ) } inside router

public void test app queue x m l ( ) throws exception { string app id = submit application ( ) ; list < app queue > responses = perform get calls ( rm web service path + format ( apps appid queue , app id ) , app queue class , null , null ) ; app queue router response = responses get ( 0 ) ; app queue rm response = responses get ( 1 ) ; assert not null ( router response ) ; assert not null ( rm response ) ; assert equals ( rm response get queue ( ) , router response get queue ( ) ) ; }


the implementing class must define this method , which must at least flush the bytes in { @ code buffer [ 0 ] - buffer [ len - 1 ] } , and reset { @ code len = 0 } don ' t forget to synchronized the implementation of this method on whatever underlying object it writes to !

protected abstract void flushing hook ( ) throws i o exception ;


public void get pet by id test ( ) { long pet id = null ; pet response = api get pet by id ( pet id ) ; / / todo : test validations }


public void update pet test ( ) { pet body = null ; / / api update pet ( body ) ; / / todo : test validations }


return the sanitized variable name for enum

public string to enum var name ( string value , string datatype ) { / / our enum var names are keys in a python dict , so change spaces to underscores if ( value length ( ) = = 0 ) { return " empty " ; } string var = value replace all ( " \ \ s + " , " " ) to upper case ( locale root ) ; return var ; }


void unregister store ( string bucket name , configuration store conf , delegation token provider dt provider , user group information store ugi ) ;


clears the currently set job in case the currently set job has been scheduled but not started yet , the job won ' t be executed

public void clear job ( ) { encoded image old encoded image ; synchronized ( this ) { old encoded image = m encoded image ; m encoded image = null ; m status = 0 ; } encoded image close safely ( old encoded image ) ; }


sets the field value at the given position note : the given field value must be an internal data structures otherwise the { @ link generic row data } is corrupted and may throw exception when processing see { @ link row data } for more information about internal data structures the field value can be null for representing nullability

public void set field ( int pos , object value ) { this fields [ pos ] = value ; }


public static void skip ( data input stream in ) throws i o exception { byte [ ] preamble = new byte [ preamble length ] ; in read fully ( preamble ) ; if ( ! arrays equals ( preamble , preamble ) ) return ; / / not a valid preamble data input stream decoded = new data input stream ( base 6 4 get decoder ( ) wrap ( in ) ) ; int mac sz = - decoded read int ( ) ; if ( mac sz > 0 ) { / / new format i o utils skip ( decoded , mac sz ) ; int sz = decoded read int ( ) ; i o utils skip ( decoded , sz ) ; } else { / / old format int sz = - mac sz ; i o utils skip ( decoded , sz ) ; } byte [ ] postamble = new byte [ postamble length ] ; in read fully ( postamble ) ; }


find the common element type of the given collection , if any

public static class < ? > find common element type ( collection < ? > collection ) { if ( is empty ( collection ) ) { return null ; } class < ? > candidate = null ; for ( object val : collection ) { if ( val ! = null ) { if ( candidate = = null ) { candidate = val get class ( ) ; } else if ( candidate ! = val get class ( ) ) { return null ; } } } return candidate ; }


test case for enter safemode in standby namenode , when it is already in startup safemode it is a regression test for hdfs - 2747

public void test enter safe mode in s b n should not throw n p e ( ) throws exception { banner ( " starting with nn0 active and nn1 standby , creating some blocks " ) ; d f s test util create file ( fs , new path ( " / test " ) , 3 * block size , ( short ) 3 , 1l ) ; / / roll edit log so that , when the sbn restarts , it will load / / the namespace during startup and enter safemode nn 0 get rpc server ( ) roll edit log ( ) ; banner ( " creating some blocks that won ' t be in the edit log " ) ; d f s test util create file ( fs , new path ( " / test 2 " ) , 5 * block size , ( short ) 3 , 1l ) ; banner ( " deleting the original blocks " ) ; fs delete ( new path ( " / test " ) , true ) ; banner ( " restarting standby " ) ; restart standby ( ) ; f s namesystem namesystem = nn 1 get namesystem ( ) ; string status = namesystem get safemode ( ) ; assert true ( " bad safemode status : ' " + status + " ' " , status starts with ( " safe mode is on " ) ) ; name node adapter enter safe mode ( nn 1 , false ) ; assert true ( " failed to enter into safemode in standby " , namesystem is in safe mode ( ) ) ; name node adapter enter safe mode ( nn 1 , false ) ; assert true ( " failed to enter into safemode in standby " , namesystem is in safe mode ( ) ) ; }


returns the index of a binding within its function ' s frame ( localcell ) , freevars ( free ) , or module ( global )

public int get index ( ) { return index ; }


public int get overlay color ( ) { return m overlay color ; }


set current context register value keep in mind that any non - flowing context values will be stripped

public void set context register ( register value ctx reg value ) { emulator set context register value ( ctx reg value ) ; }


tests that events are distributed to any subscribers to their type or any supertype , including interfaces and superclasses also checks delivery ordering in such cases

public void test polymorphic distribution ( ) { / / three catchers for related types string , object , and comparable < ? > / / string isa object / / string isa comparable < ? > / / comparable < ? > isa object string catcher string catcher = new string catcher ( ) ; final list < object > object events = lists new array list ( ) ; object obj catcher = new object ( ) { @ suppress warnings ( " unused " ) @ subscribe public void eat ( object food ) { object events add ( food ) ; } } ; final list < comparable < ? > > comp events = lists new array list ( ) ; object comp catcher = new object ( ) { @ suppress warnings ( " unused " ) @ subscribe public void eat ( comparable < ? > food ) { comp events add ( food ) ; } } ; bus register ( string catcher ) ; bus register ( obj catcher ) ; bus register ( comp catcher ) ; / / two additional event types : object and comparable < ? > ( played by integer ) object obj event = new object ( ) ; object comp event = new integer ( 6 ) ; bus post ( event ) ; bus post ( obj event ) ; bus post ( comp event ) ; / / check the string catcher list < string > string events = string catcher get events ( ) ; assert equals ( " only one string should be delivered " , 1 , string events size ( ) ) ; assert equals ( " correct string should be delivered " , event , string events get ( 0 ) ) ; / / check the catcher < object > assert equals ( " three objects should be delivered " , 3 , object events size ( ) ) ; assert equals ( " string fixture must be first object delivered " , event , object events get ( 0 ) ) ; assert equals ( " object fixture must be second object delivered " , obj event , object events get ( 1 ) ) ; assert equals ( " comparable fixture must be thirdobject delivered " , comp event , object events get ( 2 ) ) ; / / check the catcher < comparable < ? > > assert equals ( " two comparable < ? > s should be delivered " , 2 , comp events size ( ) ) ; assert equals ( " string fixture must be first comparable delivered " , event , comp events get ( 0 ) ) ; assert equals ( " comparable fixture must be second comparable delivered " , comp event , comp events get ( 1 ) ) ; }


generate a string to be used as the key for the given priority in the lb policy config

private static string priority name ( int priority ) { return " priority " + priority ; }


test to verify that mover can ' t move pinned blocks

public void test mover with pinned blocks ( ) throws exception { final configuration conf = new hdfs configuration ( ) ; init conf ( conf ) ; / / sets bigger retry max attempts value so that test case will timed out if / / block pinning errors are not handled properly during block movement conf set int ( d f s config keys dfs mover retry max attempts key , 10000 ) ; final mini d f s cluster cluster = new mini d f s cluster builder ( conf ) num data nodes ( 3 ) build ( ) ; try { cluster wait active ( ) ; final distributed file system dfs = cluster get file system ( ) ; final string file = " / test mover with pinned blocks / file " ; path dir = new path ( " / test mover with pinned blocks " ) ; dfs mkdirs ( dir ) ; / / write to disk dfs set storage policy ( dir , " hot " ) ; final f s data output stream out = dfs create ( new path ( file ) ) ; byte [ ] file data = striped file test util generate bytes ( default block size * 3 ) ; out write ( file data ) ; out close ( ) ; / / verify before movement located block lb = dfs get client ( ) get located blocks ( file , 0 ) get ( 0 ) ; storage type [ ] storage types = lb get storage types ( ) ; for ( storage type storage type : storage types ) { assert assert true ( storage type disk = = storage type ) ; } / / adding one ssd based data node to the cluster storage type [ ] [ ] newtypes = new storage type [ ] [ ] { { storage type ssd } } ; start additional d ns ( conf , 1 , newtypes , cluster ) ; / / mock fs dataset spi # get pinning to show that the block is pinned for ( int i = 0 ; i < cluster get data nodes ( ) size ( ) ; i + + ) { data node dn = cluster get data nodes ( ) get ( i ) ; log info ( " simulate block pinning in datanode { } " , dn ) ; internal data node test utils mock datanode blk pinning ( dn , true ) ; } / / move file blocks to one ssd policy dfs set storage policy ( dir , " one ssd " ) ; int rc = tool runner run ( conf , new mover cli ( ) , new string [ ] { " - p " , dir to string ( ) } ) ; int exitcode = exit status no move block get exit code ( ) ; assert assert equals ( " movement should fail " , exitcode , rc ) ; } finally { cluster shutdown ( ) ; } }


compare and verify if erased chunks are equal to recovered chunks

protected void compare and verify ( e c chunk [ ] erased chunks , e c chunk [ ] recovered chunks ) { byte [ ] [ ] erased = to arrays ( erased chunks ) ; byte [ ] [ ] recovered = to arrays ( recovered chunks ) ; boolean result = arrays deep equals ( erased , recovered ) ; if ( ! result ) { assert true ( " decoding and comparing failed " , result ) ; } }


returns whether { @ link freezable } s having this { @ code mutability } allow the { @ link # unsafe shallow freeze } operation

public boolean allows unsafe shallow freeze ( ) { return allows unsafe shallow freeze ; }


scenario : we got a lot of jobs all of the sudden , and we need to fire up a few nodes

@ test public void load spike ( ) throws exception { try ( bulk change bc = new bulk change ( r jenkins ) ) { dummy cloud impl cloud = init hudson ( 0 ) ; verify successful completion ( build all ( create 5 slow jobs ( new latch ( 5 ) ) ) ) ; / / the time it takes to complete a job is eternally long compared to the time it takes to launch / / a new slave , so in this scenario we end up allocating 5 slaves for 5 jobs assert equals ( 5 , cloud num provisioned ) ; } }


flush the output only valid in the state { @ code writing } in the base class , this is a no - op

void flush ( ) throws i o exception { verify state ( dest state writing ) ; }


public void visit ( nested set < e > nested set ) throws interrupted exception { preconditions check argument ( nested set get order ( ) = = order stable order ) ; / / we can short - circuit empty nested set visitation here , avoiding load on the shared map / / visited state # seen nodes if ( ! nested set is empty ( ) ) { visit raw ( nested set get children interruptibly ( ) ) ; } }


get the contents of a file internally using an in memory output stream

public string get file contents as string ( source manifest action manifest ) throws i o exception { byte array output stream stream = new byte array output stream ( ) ; manifest write output file ( stream , reporter ) ; return stream to string ( ) ; }


returns { @ code true } if this multimap contains at least one key - value pair with the key { @ code key }

boolean contains key ( @ compatible with ( " k " ) @ nullable decl object key ) ;


protected void parse managed classes ( element persistence unit , spring persistence unit info unit info ) { list < element > classes = dom utils get child elements by tag name ( persistence unit , managed class name ) ; for ( element element : classes ) { string value = dom utils get text value ( element ) trim ( ) ; if ( string utils has text ( value ) ) { unit info add managed class name ( value ) ; } } }


returns the number of elements between the limit and capacity

private static int available capacity ( buffer buffer ) { return buffer capacity ( ) - buffer limit ( ) ; }


get the http status when using the default block page you can set the status code with the { @ code - dcsp sentinel web servlet block status } property when the property is empty or invalid , sentinel will use 429 ( too many requests ) as the default status code

public static int get block page http status ( ) { string value = sentinel config get config ( block page http status conf key ) ; if ( string util is empty ( value ) ) { return http status too many requests ; } try { int s = integer parse int ( value ) ; if ( s < = 0 ) { throw new illegal argument exception ( " invalid status code : " + s ) ; } return s ; } catch ( exception e ) { record log warn ( " [ web servlet config ] invalid block http status ( " + value + " ) , using default 429 " ) ; set block page http status ( http status too many requests ) ; } return http status too many requests ; }


sets the continuation option for this script the continuation option specifies whether to continue or abort follow - on processing , and whether to delete or keep the current program

public void set headless continuation option ( headless continuation option option ) { script set option = option ; }


gets the number of items in the queue this returns in constant time


sets the data spec of the ad tag to load

void set ad tag data spec ( data spec ad tag data spec ) ;


registers this object as an active listener so that it can start getting callbacks invoked

public void register ( ) { all ( ) add ( this ) ; }


returns an index that will always be associated to the given key as long as the key remains in the table if the key already exists , then the index where that key is stored is returned if the key is new , then a new index is allocated , the key is stored at that index , and the new index is returned

public short put ( short key ) { / / check if the key already exists short index = find key ( key ) ; / / if not , then we need to add it if ( index = = - 1 ) { / / make sure there is enough room if ( indexer get size ( ) > = capacity ) { / / if not enough room , grow the key capacity grow ( ) ; } / / now use the hashcode as the list i d and get a new index / / to put on that list then store the key at the new index short hashcode = ( short ) ( ( key & 0x 7fff ) % capacity ) ; index = indexer add ( hashcode ) ; if ( index < 0 ) { throw new index out of bounds exception ( " maximum capacity reached " ) ; } keys [ index ] = key ; } / / return the index associated with the given key return index ; }


protected int directories in path ( path path ) { return path is root ( ) ? 0 : 1 + directories in path ( path get parent ( ) ) ; }


sets the content of the system clipboard for web g l app , clipboard content might not be set if user denied permission , setting clipboard is not synchronous so you can ' t rely on getting same content just after setting it

public void set contents ( string content ) ;


public string get string item ( ) { return string item ; }


initializes the output reader this method has to be called before calling any of the other methods

public void initialize ( pipe map red pipe map red ) throws i o exception { / / nothing here yet , but that might change in the future }


protected map < computer , t > monitor ( ) throws interrupted exception { / / bridge method to offer original constrained interface return monitor detailed ( ) get monitoring data ( ) ; }


returns the greatest value present in { @ code array }

public static int max ( int array ) { preconditions check argument ( array length > 0 ) ; int max = array [ 0 ] ; for ( int i = 1 ; i < array length ; i + + ) { if ( array [ i ] > max ) { max = array [ i ] ; } } return max ; }


called after we read the whole line of plain text , which is stored in { @ link # buf } this method performs annotations and send the result to { @ link # out }

protected void eol ( byte [ ] in , int sz ) throws i o exception { line reset ( ) ; final string buffer str buf = line get string buffer ( ) ; int next = console note find preamble ( in , 0 , sz ) ; list < console annotator < t > > annotators = null ; { / / perform byte [ ] - > char [ ] while figuring out the char positions of the b l o bs int written = 0 ; while ( next > = 0 ) { if ( next > written ) { line out write ( in , written , next - written ) ; line out flush ( ) ; written = next ; } else { assert next = = written ; } / / character position of this annotation in this line final int char pos = str buf length ( ) ; int rest = sz - next ; byte array input stream b = new byte array input stream ( in , next , rest ) ; try { final console note a = console note read from ( new data input stream ( b ) ) ; if ( a ! = null ) { if ( annotators = = null ) annotators = new array list < > ( ) ; annotators add ( new console annotator < t > ( ) { @ override public console annotator < t > annotate ( t context , markup text text ) { return a annotate ( context , text , char pos ) ; } } ) ; } } catch ( i o exception | class not found exception e ) { / / if we failed to resurrect an annotation , ignore it logger log ( level fine , " failed to resurrect annotation from \ " " + string escape utils escape java ( new string ( in , next , rest ) ) + " \ " " , e ) ; } int bytes used = rest - b available ( ) ; / / bytes consumed by annotations written + = bytes used ; next = console note find preamble ( in , written , sz - written ) ; } / / finish the remaining bytes - > chars conversion line out write ( in , written , sz - written ) ; if ( annotators ! = null ) { / / aggregate newly retrieved console annotators into the current one if ( ann ! = null ) annotators add ( ann ) ; ann = console annotator combine ( annotators ) ; } } line out flush ( ) ; markup text mt = new markup text ( str buf to string ( ) ) ; if ( ann ! = null ) ann = ann annotate ( context , mt ) ; out write ( mt to string ( true ) ) ; / / this perform escapes }


returns { @ link cc toolchain variables } instance with build variables that only depend on the toolchain

static cc toolchain variables get build variables ( build options build options , cpp configuration cpp configuration , path fragment sysroot , additional build variables computer additional build variables computer ) { cc toolchain variables builder variables = cc toolchain variables builder ( ) ; string min os version = cpp configuration get minimum os version ( ) ; if ( min os version ! = null ) { variables add string variable ( cc common minimum os version variable name , min os version ) ; } if ( sysroot ! = null ) { variables add string variable ( cc common sysroot variable name , sysroot get path string ( ) ) ; } variables add all non transitive ( additional build variables computer apply ( build options ) ) ; return variables build ( ) ; }


boolean is root ( ) { return null = = parent ; }


returns true , if and only if the given package identifier corresponds to a package , i e , a file with the name { @ code package name b u i l d } exists in the appropriate repository

public abstract boolean is package ( package identifier package identifier ) throws interrupted exception ;


returns a string representation of x , where x is treated as unsigned < b > java 8 users : < b > use { @ link long # to unsigned string ( long ) } instead

public static string to string ( long x ) { return to string ( x , 10 ) ; }


returns a normalizer mapped to the given name or < code > null < code > if not present

public named analyzer get normalizer ( string name ) { return normalizers get ( name ) ; }


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


generates a go to event and handles any history state that needs to be saved this method will attempt to find the program that contains the given program location

public boolean go to ( program location loc ) ;


ensure that we are allowed to manually manage the ha state of the target service if automatic failover is configured , then the automatic failover controllers should be doing state management , and it is generally an error to use the h a admin command line to do so

protected boolean check manual state management o k ( h a service target target ) { if ( target is auto failover enabled ( ) ) { if ( request source ! = request source request by user forced ) { err out println ( " automatic failover is enabled for " + target + " \ n " + " refusing to manually manage ha state , since it may cause \ n " + " a split - brain scenario or other incorrect state \ n " + " if you are very sure you know what you are doing , please \ n " + " specify the - - " + forcemanual + " flag " ) ; return false ; } else { log warn ( " proceeding with manual ha state management even though \ n " + " automatic failover is enabled for " + target ) ; return true ; } } return true ; }


we have two running guarantee containers , neither of which is out of limit we should kill the later launched one

public void test no guaranteed container over limit o o m ( ) throws exception { concurrent hash map < container id , container > containers = new concurrent hash map < > ( ) ; container c 1 = create container ( 1 , true , 1l , true ) ; containers put ( c 1 get container id ( ) , c 1 ) ; container c 2 = create container ( 2 , true , 2l , true ) ; containers put ( c 2 get container id ( ) , c 2 ) ; container executor ex = create container executor ( containers ) ; context context = mock ( context class ) ; when ( context get containers ( ) ) then return ( containers ) ; when ( context get container executor ( ) ) then return ( ex ) ; c groups handler c groups handler = mock ( c groups handler class ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , " " , cgroup param memory oom control ) ) then return ( " under oom 1 " ) then return ( " under oom 0 " ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 1 get container id ( ) to string ( ) , cgroup procs file ) ) then return ( " 1234 " ) then return ( " " ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 1 get container id ( ) to string ( ) , cgroup param memory usage bytes ) ) then return ( get m b ( 9 ) ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 1 get container id ( ) to string ( ) , cgroup param memory memsw usage bytes ) ) then return ( get m b ( 9 ) ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 2 get container id ( ) to string ( ) , cgroup procs file ) ) then return ( " 1235 " ) then return ( " " ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 2 get container id ( ) to string ( ) , cgroup param memory usage bytes ) ) then return ( get m b ( 9 ) ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 2 get container id ( ) to string ( ) , cgroup param memory memsw usage bytes ) ) then return ( get m b ( 9 ) ) ; default o o m handler handler = new default o o m handler ( context , false ) { @ override protected c groups handler get c groups handler ( ) { return c groups handler ; } } ; handler run ( ) ; verify ( ex , times ( 1 ) ) signal container ( new container signal context builder ( ) set pid ( " 1235 " ) set container ( c 2 ) set signal ( container executor signal kill ) build ( ) ) ; verify ( ex , times ( 1 ) ) signal container ( any ( ) ) ; }


https : jira spring iobrowse s p r - 2645

public void xss exploit when action is resolved from query string ( ) throws exception { string xss query string = query string + " & stuff = \ " > < script > alert ( ' xss ! ' ) < / script > " ; request set query string ( xss query string ) ; tag do start tag ( ) ; assert that ( get output ( ) ) is equal to ( ( " < form id = \ " command \ " action = \ " / my / form ? foo = bar & amp ; stuff = & quot ; & gt ; & lt ; " + " script & gt ; alert ( & # 39 ; xss ! & # 39 ; ) & lt ; / script & gt ; \ " method = \ " post \ " > " ) ) ; }


public list < timeline entity > get entities ( ) { return entities ; }


reads data from the front of the rolling buffer

private void read data ( long absolute position , byte buffer target , int length ) { advance read to ( absolute position ) ; int remaining = length ; while ( remaining > 0 ) { int to copy = min ( remaining , ( int ) ( read allocation node end position - absolute position ) ) ; allocation allocation = read allocation node allocation ; target put ( allocation data , read allocation node translate offset ( absolute position ) , to copy ) ; remaining - = to copy ; absolute position + = to copy ; if ( absolute position = = read allocation node end position ) { read allocation node = read allocation node next ; } } }