return an array of { @ link resolvable type resolvable types } representing the generic parameters of this type if no generics are available an empty array is returned if you need to access a specific generic consider using the { @ link # get generic ( int ) } method as it allows access to nested generics and protects against { @ code index out of bounds exceptions }

public resolvable type [ ] get generics ( ) { if ( this = = none ) { return empty types array ; } resolvable type [ ] generics = this generics ; if ( generics = = null ) { if ( this type instanceof class ) { type [ ] type params = ( ( class < ? > ) this type ) get type parameters ( ) ; generics = new resolvable type [ type params length ] ; for ( int i = 0 ; i < generics length ; i + + ) { generics [ i ] = resolvable type for type ( type params [ i ] , this ) ; } } else if ( this type instanceof parameterized type ) { type [ ] actual type arguments = ( ( parameterized type ) this type ) get actual type arguments ( ) ; generics = new resolvable type [ actual type arguments length ] ; for ( int i = 0 ; i < actual type arguments length ; i + + ) { generics [ i ] = for type ( actual type arguments [ i ] , this variable resolver ) ; } } else { generics = resolve type ( ) get generics ( ) ; } this generics = generics ; } return generics ; }


lookup offsets without any known min or max time this will generally fail if the provided zone isn ' t fixed

public static local time offset fixed offset ( zone id zone ) { return check for fixed zone ( zone , zone get rules ( ) ) ; }


paths variable is a sequence of text and variable references until space , newline , eof or | symbol

private ninja variable value parse path variable value ( ) { ninja variable value builder var builder = ninja variable value builder ( ) ; int previous = - 1 ; while ( lexer has next token ( ) ) { lexer set expected text kind ( text kind path ) ; ninja token token = lexer next token ( ) ; if ( previous > = 0 & & lexer get last start ( ) ! = previous ) { / / no spaces lexer undo ( ) ; break ; } if ( ninja token variable equals ( token ) ) { var builder add variable ( normalize variable name ( as string ( lexer get token bytes ( ) ) ) ) ; } else if ( ninja token text equals ( token ) | | ninja token escaped text equals ( token ) ) { string raw text = as string ( lexer get token bytes ( ) ) ; var builder add text ( unescape text ( raw text ) ) ; } else { lexer undo ( ) ; break ; } previous = lexer get last end ( ) ; } if ( previous = = - 1 ) { / / we read no value return null ; } return var builder build ( ) ; }


register a listener that will be called when this model visibility has changed the listener will contribute to this model ' s hash code state per the { @ link com airbnb epoxy epoxy attribute option # do not hash } rules

public model without hash on visibility changed ( on model visibility changed listener < model without hash , object > listener ) { on mutation ( ) ; this on model visibility changed listener epoxy generated model = listener ; return this ; }


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

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


checks the get operation fails when the downloaded file ( from { @ link blob server } or ha store ) is corrupt , i e its content ' s hash does not match the { @ link blob key } ' s hash

public void test get fails from corrupt file ( ) throws i o exception { final configuration config = new configuration ( ) ; config set string ( high availability options ha mode , " zookeeper " ) ; config set string ( blob server options storage directory , temporary folder new folder ( ) get absolute path ( ) ) ; config set string ( high availability options ha storage path , temporary folder new folder ( ) get path ( ) ) ; blob store service blob store service = null ; try { blob store service = blob utils create blob store from config ( config ) ; test get fails from corrupt file ( config , blob store service , exception ) ; } finally { if ( blob store service ! = null ) { blob store service close and cleanup all data ( ) ; } } }


verify that , when the callback fails to enter active state , after a zk disconnect ( i e from the stat callback ) , that the elector rejoins the election after sleeping for a short period

public void test fail to become active after z k disconnect ( ) throws exception { mock no prior active ( ) ; elector join election ( data ) ; assert assert equals ( 0 , elector slept for ) ; elector process result ( code connectionloss int value ( ) , zk lock name , mock z k , zk lock name ) ; mockito verify ( mock z k , mockito times ( 2 ) ) create ( zk lock name , data , ids open acl unsafe , create mode ephemeral , elector , mock z k ) ; elector process result ( code nodeexists int value ( ) , zk lock name , mock z k , zk lock name ) ; verify exist call ( 1 ) ; stat stat = new stat ( ) ; stat set ephemeral owner ( 1l ) ; mockito when ( mock z k get session id ( ) ) then return ( 1l ) ; / / fake failure to become active from within the stat callback mockito do throw ( new service failed exception ( " fail to become active " ) ) when ( mock app ) become active ( ) ; elector process result ( code ok int value ( ) , zk lock name , mock z k , stat ) ; mockito verify ( mock app , mockito times ( 1 ) ) become active ( ) ; / / should re - join mockito verify ( mock z k , mockito times ( 3 ) ) create ( zk lock name , data , ids open acl unsafe , create mode ephemeral , elector , mock z k ) ; assert assert equals ( 2 , count ) ; assert assert true ( elector slept for > 0 ) ; }


protected string get table name ( ) { return table name ; }


given all of the thread pool configuration , what is the actual maximum size applied to the thread pool cases : 1 ) allow maximum size to diverge from core size = = false : maximum size is set to core size 2 ) allow maximum size to diverge from core size = = true , maximum size > = core size : thread pool has different coremax sizes , so return the configured max 3 ) allow maximum size to diverge from core size = = true , maximum size < core size : threadpool incorrectly configured , use core size for max size

public int get actual maximum size ( ) { return this actual maximum size ; }


make sure a label doesn ' t conflict with another symbol labels must not conflict with : rules , tokens , scope names , return values , parameters , and rule - scope dynamic attributes defined in surrounding rule also they must have same type for repeated defs

public void check for label conflicts ( collection < rule > rules ) { for ( rule r : rules ) { check for attribute conflicts ( r ) ; map < string , label element pair > label name space = new hash map < > ( ) ; for ( int i = 1 ; i < = r number of alts ; i + + ) { alternative a = r alt [ i ] ; for ( list < label element pair > pairs : a label defs values ( ) ) { if ( r has alt specific contexts ( ) ) { / / collect label name - labeled rules map for rule with alternative labels map < string , list < label element pair > > label pairs = new hash map < > ( ) ; for ( label element pair p : pairs ) { string label name = find alt label name ( p label ) ; if ( label name ! = null ) { list < label element pair > list ; if ( label pairs contains key ( label name ) ) { list = label pairs get ( label name ) ; } else { list = new array list < > ( ) ; label pairs put ( label name , list ) ; } list add ( p ) ; } } for ( list < label element pair > internal pairs : label pairs values ( ) ) { label name space clear ( ) ; check label pairs ( r , label name space , internal pairs ) ; } } else { check label pairs ( r , label name space , pairs ) ; } } } } }


add a niceness level to the process that will be executed adds { @ code - n < nice > } to the given command the niceness level will be taken from the { @ link yarn configuration # nm container executor sched priority } property

protected void add sched priority command ( list < string > command ) { if ( container sched priority is set ) { command add all ( arrays as list ( " nice " , " - n " , integer to string ( container sched priority adjustment ) ) ) ; } }


private memory block add block ( string name , long offset , int length ) throws exception { memory memory = program get memory ( ) ; address start = get addr ( offset ) ; return memory create initialized block ( name , start , length , ( byte ) 0 , task monitor adapter dummy monitor , false ) ; }


optional , name of the column used for partitioning the input

public builder set partition column name ( string partition column name ) { this partition column name = partition column name ; return this ; }


checks that the given blob will be deleted at the { @ link blob server } eventually ( waits at most 3 0s )

static void verify deleted eventually ( blob server server , @ nullable job i d job id , blob key keys ) throws i o exception , interrupted exception { long deadline = system current time millis ( ) + 30 000l ; do { thread sleep ( 10 ) ; } while ( check files exist ( job id , arrays as list ( keys ) , server , false ) ! = 0 & & system current time millis ( ) < deadline ) ; for ( blob key key : keys ) { verify deleted ( server , job id , key ) ; } }


gets the class describing this sinks output format

public user code wrapper < ? extends output format < in > > get format wrapper ( ) { return this format wrapper ; }


create the most appropriate collection for the given collection type warning : since the parameterized type { @ code e } is not bound to the supplied { @ code element type } , type safety cannot be guaranteed if the desired { @ code collection type } is { @ link enum set } in such scenarios , the caller is responsible for ensuring that the supplied { @ code element type } is an enum type matching type { @ code e } as an alternative , the caller may wish to treat the return value as a raw collection or collection of { @ link object }

public static < e > collection < e > create collection ( class < ? > collection type , @ nullable class < ? > element type , int capacity ) { assert not null ( collection type , " collection type must not be null " ) ; if ( collection type is interface ( ) ) { if ( set class = = collection type | | collection class = = collection type ) { return new linked hash set < > ( capacity ) ; } else if ( list class = = collection type ) { return new array list < > ( capacity ) ; } else if ( sorted set class = = collection type | | navigable set class = = collection type ) { return new tree set < > ( ) ; } else { throw new illegal argument exception ( " unsupported collection interface : " + collection type get name ( ) ) ; } } else if ( enum set class is assignable from ( collection type ) ) { assert not null ( element type , " cannot create enum set for unknown element type " ) ; / / cast is necessary for compilation in eclipse 4 4 1 return ( collection < e > ) enum set none of ( as enum type ( element type ) ) ; } else { if ( ! collection class is assignable from ( collection type ) ) { throw new illegal argument exception ( " unsupported collection type : " + collection type get name ( ) ) ; } try { return ( collection < e > ) reflection utils accessible constructor ( collection type ) new instance ( ) ; } catch ( throwable ex ) { throw new illegal argument exception ( " could not instantiate collection type : " + collection type get name ( ) , ex ) ; } } }


the maximum number of refresh listeners allows on this shard

public int get max refresh listeners ( ) { return max refresh listeners ; }


determine the names of candidate beans in the application context

protected string [ ] get candidate bean names ( ) { return ( this detect handler methods in ancestor contexts ? bean factory utils bean names for type including ancestors ( obtain application context ( ) , object class ) : obtain application context ( ) get bean names for type ( object class ) ) ; }


creates a new { @ link d w a r f compilation unit } by reading a compilation unit ' s header data from the debug info section and the debug abbr section and its compile unit die ( ie the first die right after the header ) returns null if there was an ignorable error while reading the compilation unit ( and leaves the input stream at the next compilation unit to read ) , otherwise throws an i o exception if there was an unrecoverable error

public static d w a r f compilation unit read compilation unit ( d w a r f program dwarf program , binary reader debug info b r , binary reader debug abbr b r , int cu number , task monitor monitor ) throws d w a r f exception , i o exception , cancelled exception { long start offset = debug info b r get pointer index ( ) ; long length = debug info b r read next unsigned int ( ) ; int format ; if ( length = = 0xffffffff l ) { / / length of 0xffffffff implies 64 - bit dwarf format / / mostly untested as there is no easy way to force the compiler / / to generate this length = debug info b r read next long ( ) ; format = dwarf 64 ; } else if ( length > = 0xfffffff 0 l ) { / / length of 0xfffffff 0 or greater is reserved for dwarf throw new d w a r f exception ( " reserved dwarf length value : " + long to hex string ( length ) + " unknown extension " ) ; } else if ( length = = 0 ) { throw new d w a r f exception ( " invalid length 0 for dwarf compilation unit at 0x " + long to hex string ( start offset ) ) ; } else { format = dwarf 32 ; } long end offset = ( debug info b r get pointer index ( ) + length ) ; short version = debug info b r read next short ( ) ; long abbreviation offset = d w a r f util read offset by d w a r fformat ( debug info b r , format ) ; byte pointer size = debug info b r read next byte ( ) ; long first d i e offset = debug info b r get pointer index ( ) ; if ( version < 2 | | version > 4 ) { throw new d w a r f exception ( " only dwarf version 2 , 3 , or 4 information is currently supported " ) ; } if ( first d i e offset > end offset ) { throw new i o exception ( " invalid length " + ( end offset - start offset ) + " for dwarf compilation unit at 0x " + long to hex string ( start offset ) ) ; } else if ( first d i e offset = = end offset ) { / / silently skip this empty compunit return null ; } debug abbr b r set pointer index ( abbreviation offset ) ; map < integer , d w a r f abbreviation > abbr map = d w a r f abbreviation read abbreviations ( debug abbr b r , dwarf program , monitor ) ; d w a r f compilation unit cu = new d w a r f compilation unit ( dwarf program , start offset , end offset , length , format , version , abbreviation offset , pointer size , cu number , first d i e offset , abbr map ) ; try { debug info entry compile unit d i e = debug info entry read ( debug info b r , cu , dwarf program get attribute factory ( ) ) ; d w a r f compile unit comp unit = d w a r f compile unit read ( d i e aggregate create single ( compile unit d i e ) , dwarf program get debug line ( ) ) ; cu set compile unit ( comp unit ) ; return cu ; } catch ( i o exception ioe ) { msg error ( null , " failed to parse the dw tag compile unit die at the start of compilation unit " + cu number + " at offset " + start offset + " ( 0x " + long to hex string ( start offset ) + " ) , skipping entire compilation unit " , ioe ) ; debug info b r set pointer index ( cu get end offset ( ) ) ; return null ; } }


checks if a byte value is whitespace or not whitespace is taken to mean : space , tab , cr , lf

protected static boolean is white space ( final byte byte to check ) { switch ( byte to check ) { case ' ' : case ' \ n ' : case ' \ r ' : case ' \ t ' : return true ; default : return false ; } }


get the number of occupied reduce slots in the cluster

public int get occupied reduce slots ( ) { return occupied reduce slots ; }


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

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


return the point in the northwest corner of the tile

static point tile x y to latitude longitude ( int tile x , int tile y , int zoom level ) { return new point ( tile x to longitude ( tile x , zoom level ) , tile y to latitude ( tile y , zoom level ) ) ; }


get a cci connection , either from the current transaction or a new one

protected final connection get connection ( ) throws org springframework jca cci cannot get cci connection exception { connection factory connection factory = get connection factory ( ) ; assert state ( connection factory ! = null , " no connection factory set " ) ; return org springframework jca cci connection connection factory utils get connection ( connection factory ) ; }


public void set comment ( int comment type , string [ ] comment ) { switch ( comment type ) { case code unit plate comment : plate comment = comment ; break ; case code unit pre comment : pre comment = comment ; break ; case code unit post comment : post comment = comment ; break ; case code unit repeatable comment : repeatable comment = comment ; break ; case code unit eol comment : eol comment = comment ; } }


this test verifies that state is correctly assigned to key groups and that restore restores the relevant key groups in the backend we have 128 key groups initially , two backends with different states are responsible for all the key groups equally different backends for the same operator may contains different states if we create the state in runtime ( such as { @ link delta trigger # on element } then we snapshot , split up the state and restore into 2 backends where each is responsible for 64 key groups then we make sure that the state is only available in the correct backend

public void test key groups snapshot restore no rescale ( ) throws exception { test key group snapshot restore ( 2 , 2 , 128 ) ; }


to test class name in snake case to test class name in snake case

public client test classname ( client body ) throws api exception { api response < client > local var response = test classname with http info ( body ) ; return local var response get data ( ) ; }


tests if the file regions provided by the file region provider can belong to the providevolume

public void test provided volume contents ( ) throws i o exception { int expected blocks = 5 ; int min id = 0 ; / / use a path which has the same prefix as provided base path / / all these blocks can belong to the provided volume int blocks found = get blocks in provided volumes ( provided base path + " / test 1 / " , expected blocks , min id ) ; assert equals ( " number of blocks in provided volumes should be " + expected blocks , expected blocks , blocks found ) ; blocks found = get blocks in provided volumes ( " file : / " + provided base path + " / test 1 / " , expected blocks , min id ) ; assert equals ( " number of blocks in provided volumes should be " + expected blocks , expected blocks , blocks found ) ; / / use a path that is entirely different from the provided base path / / none of these blocks can belong to the volume blocks found = get blocks in provided volumes ( " randomtest 1 / " , expected blocks , min id ) ; assert equals ( " number of blocks in provided volumes should be 0 " , 0 , blocks found ) ; }


gets the root cause of a provided { @ link throwable } if there is no cause for the { @ link throwable } provided into this function , the original { @ link throwable } is returned

private throwable get root cause ( throwable throwable ) { if ( throwable = = null ) { throw new illegal argument exception ( " throwable can not be null " ) ; } throwable result = throwable ; while ( result get cause ( ) ! = null ) { result = result get cause ( ) ; } return result ; }


< code > show < code > displays the dialog , gets the user input

public boolean show ( ) { docking window manager show dialog ( this ) ; return ! was cancelled ; }


reads bytes from input , parsing them into a frame returns false if and only if more data is needed to obtain a full frame this method must be called repeatedly until it returns true

boolean read bytes ( byte buffer input ) throws general security exception { preconditions check not null ( input ) ; if ( is complete ) { return true ; } copy ( buffer , input ) ; if ( ! buffer has remaining ( ) ) { flush ( ) ; } return is complete ; }


like { @ link # terminate ( int , throwable ) } without a message

public static void terminate ( int status ) throws exit exception { terminate ( status , exit exception message ) ; }


public void update pet ( pet body , api client auth info auth info , handler < async result < void > > result handler ) { delegate update pet ( body , auth info , result handler ) ; }


co - optimise the selector list and the alternative huffman table code lengths this method is called repeatedly in the hope that the total encoded size of the selectors , the huffman code lengths and the block data encoded with them will converge towards a minimum < br > if the data is highly incompressible , it is possible that the total encoded size will instead diverge ( increase ) slightly < br >

private void optimise selectors and huffman tables ( final boolean store selectors ) { final char [ ] mtf block = this mtf block ; final byte [ ] selectors = this selectors ; final int [ ] [ ] huffman code lengths = this huffman code lengths ; final int mtf length = this mtf length ; final int mtf alphabet size = this mtf alphabet size ; final int total tables = huffman code lengths length ; final int [ ] [ ] table frequencies = new int [ total tables ] [ mtf alphabet size ] ; int selector index = 0 ; / / find the best table for each group of 50 block bytes based on the current huffman code lengths for ( int group start = 0 ; group start < mtf length ; ) { final int group end = math min ( group start + huffman group run length , mtf length ) - 1 ; / / calculate the cost of this group when encoded by each table int [ ] cost = new int [ total tables ] ; for ( int i = group start ; i < = group end ; i + + ) { final int value = mtf block [ i ] ; for ( int j = 0 ; j < total tables ; j + + ) { cost [ j ] + = huffman code lengths [ j ] [ value ] ; } } / / find the table with the least cost for this group byte best table = 0 ; int best cost = cost [ 0 ] ; for ( byte i = 1 ; i < total tables ; i + + ) { final int table cost = cost [ i ] ; if ( table cost < best cost ) { best cost = table cost ; best table = i ; } } / / accumulate symbol frequencies for the table chosen for this block final int [ ] best group frequencies = table frequencies [ best table ] ; for ( int i = group start ; i < = group end ; i + + ) { best group frequencies [ mtf block [ i ] ] + + ; } / / store a selector indicating the table chosen for this block if ( store selectors ) { selectors [ selector index + + ] = best table ; } group start = group end + 1 ; } / / generate new huffman code lengths based on the frequencies for each table accumulated in this iteration for ( int i = 0 ; i < total tables ; i + + ) { generate huffman code lengths ( mtf alphabet size , table frequencies [ i ] , huffman code lengths [ i ] ) ; } }


hashes { @ link string } , using unsigned 3 2 bit mod , which the user should ensure is < = 0xffffffff returns an unsigned short value ( 16 - bit ) stored in a long

public long hash ( string string , long unsigned 3 2 bit mod ) throws pdb exception { return hash string 3 2 ( string , unsigned 3 2 bit mod ) & 0xffff ; }


public void set symbol data 1 ( long value ) { lock acquire ( ) ; try { check deleted ( ) ; if ( record ! = null ) { record set long value ( symbol database adapter symbol data1 col , value ) ; update record ( ) ; symbol mgr symbol data changed ( this ) ; } } finally { lock release ( ) ; } }


gets the list of " local variable " entries associated with this instance

public final local variable list get local variables ( ) { return local variables ; }


public final term vectors response termvectors ( term vectors request request , request options options ) throws i o exception { return perform request and parse entity ( request , request converters : : term vectors , options , term vectors response : : from x content , empty set ( ) ) ; }


private static void delete ( file file ) throws i o exception { check file ( file ) ; files delete ( file to path ( ) ) ; }


returns a rex simplify the same as this but with a specified { @ link # default unknown as } value

public rex simplify with unknown as false ( boolean unknown as false ) { final rex unknown as default unknown as = rex unknown as false if ( unknown as false ) ; return default unknown as = = this default unknown as ? this : new rex simplify ( rex builder , predicates , default unknown as , predicate elimination , paranoid , executor ) ; }


{ @ link abstract project } subtypes can override this method to veto some { @ link descriptor } s from showing up on their configuration screen this is often useful when you are building a workflowcompany specific project type , where you want to limit the number of choices given to the users some { @ link descriptor } s define their own schemes for controlling applicability ( such as { @ link build step descriptor # is applicable ( class ) } ) , this method works like and in conjunction with them ; both this method and that method need to return true in order for a given { @ link descriptor } to show up for the given { @ link project } the default implementation returns true for everything

public boolean is applicable ( descriptor descriptor ) { return true ; }


private void assert cues equal ( cue expected , cue actual ) { expect with message ( " cue line " ) that ( actual line ) is equal to ( expected line ) ; expect with message ( " cue line anchor " ) that ( actual line anchor ) is equal to ( expected line anchor ) ; expect with message ( " cue line type " ) that ( actual line type ) is equal to ( expected line type ) ; expect with message ( " cue position " ) that ( actual position ) is equal to ( expected position ) ; expect with message ( " cue position anchor " ) that ( actual position anchor ) is equal to ( expected position anchor ) ; expect with message ( " cue size " ) that ( actual size ) is equal to ( expected size ) ; expect with message ( " cue text " ) that ( actual text to string ( ) ) is equal to ( expected text to string ( ) ) ; expect with message ( " cue text alignment " ) that ( actual text alignment ) is equal to ( expected text alignment ) ; assert that ( expect has failures ( ) ) is false ( ) ; }


check that loading url str results in a non - zero length response

private void query admin server ( string url str , boolean encrypted ) throws i o exception , s s l context exception { url url = new url ( url str ) ; buffered reader dis ; if ( ! encrypted ) { dis = new buffered reader ( new input stream reader ( ( url open stream ( ) ) ) ) ; } else { https u r l connection conn = ( https u r l connection ) url open connection ( ) ; dis = new buffered reader ( new input stream reader ( conn get input stream ( ) ) ) ; } string line = dis read line ( ) ; assert true ( line length ( ) > 0 ) ; }


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


sets the color components using the specified float value in the format abgr8888


since message headers are immutable , the call to this method will result in { @ link unsupported operation exception }

public void clear ( ) { throw new unsupported operation exception ( " message headers is immutable " ) ; }


public string consumer id ( ) { return member id ; }


public void print help ( ) { string header = " \ n disk balancer distributes data evenly between " + " different disks on a datanode " + " disk balancer operates by generating a plan , that tells datanode " + " how to move data between disks users can execute a plan by " + " submitting it to the datanode \ n to get specific help on a " + " particular command please run \ n \ n hdfs diskbalancer - help < command > " ; help formatter help formatter = new help formatter ( ) ; help formatter print help ( " hdfs diskbalancer [ command ] [ options ] " , header , disk balancer c l i get help options ( ) , " " ) ; }


returns a { @ link rejected execution handler } that will always just throw a { @ link rejected execution exception }

public static rejected execution handler reject ( ) { return reject ; }


{ @ inherit doc } the default implementation does nothing

@ override public void exit join criteria ( sql base parser join criteria context ctx ) { }


find the original access code for the owner of the class member

final int find owner access code ( class member key < ? > member key ) { if ( reasons ( ) contains key ( member key ) ) { return reasons ( ) get ( member key ) owner access ( ) ; } throw new illegal state exception ( string format ( " class member key not found : % s " , member key ) ) ; }


gets type literal for the given { @ code type } instance

public static type literal < ? > get ( type type ) { return new type literal < object > ( type ) ; }


allows to run the specified { @ link runnable } if the shard represented by the triplet ( { @ link snapshot id } , { @ link index id } , { @ link snapshot id } ) is still marked as evicted at the time this method is executed the @ link runnable } will be executed while the current thread is holding the lock associated to the shard

public void run if shard marked as evicted in cache ( snapshot id snapshot id , index id index id , shard id shard id , runnable runnable ) { run if shard marked as evicted in cache ( new shard eviction ( snapshot id get u u i d ( ) , index id get name ( ) , shard id ) , runnable ) ; }


splits this string using the supplied regular expression { @ code expr } the parameter { @ code max } controls the behavior how many times the pattern is applied to the string

public ascii string [ ] split ( string expr , int max ) { return to ascii string array ( pattern compile ( expr ) split ( this , max ) ) ; }


loads a resource from the classpath and returns it as a { @ link bytes reference }

public static string load ( string name ) throws i o exception { return streams read fully ( template utils class get resource as stream ( name ) ) utf 8 to string ( ) ; }


assigns a timestamp to an element , in milliseconds since the epoch the method is passed the previously assigned timestamp of the element that previous timestamp may have been assigned from a previous assigner , by ingestion time if the element did not carry a timestamp before , this value is { @ code long min value }

long extract timestamp ( t element , long record timestamp ) ;


test replication number calculation for a normal file without snapshots

public void test replication without snapshot ( ) throws exception { / / create file 1 , set its replication to replication d f s test util create file ( hdfs , file 1 , blocksize , replication , seed ) ; / / check the replication of file 1 check file replication ( file 1 , replication , replication ) ; / / change the replication factor of file 1 from 3 to 2 hdfs set replication ( file 1 , ( short ) ( replication - 1 ) ) ; / / check the replication again check file replication ( file 1 , ( short ) ( replication - 1 ) , ( short ) ( replication - 1 ) ) ; }


get the last zxid that was logged in the transaction logs

public long get last logged zxid ( ) { file [ ] files = get log files ( log dir list files ( ) , 0 ) ; long max log = files length > 0 ? util get zxid from name ( files [ files length - 1 ] get name ( ) , log file prefix ) : - 1 ; / / if a log file is more recent we must scan it to find / / the highest zxid long zxid = max log ; try ( file txn log txn = new file txn log ( log dir ) ; txn iterator itr = txn read ( max log ) ) { while ( true ) { if ( ! itr next ( ) ) { break ; } txn header hdr = itr get header ( ) ; zxid = hdr get zxid ( ) ; } } catch ( i o exception e ) { log warn ( " unexpected exception " , e ) ; } return zxid ; }


returns the { @ link socks version } that corresponds to the specified version field value , as defined in the protocol specification

public static socks version value of ( byte b ) { if ( b = = s o c k s 4a byte value ( ) ) { return s o c k s 4a ; } if ( b = = socks5 byte value ( ) ) { return socks5 ; } return unknown ; }


some don ' t propagate the server ' s parent id which creates a race condition try to unwind it see https : github comopenzipkinzipkinpull 1 7 4 5

@ test public void backfills missing parent id on shared span ( ) { list < span > trace = as list ( span ( " a " , null , " a " , kind server , " frontend " , null , false ) , span ( " a " , " a " , " b " , kind client , " frontend " , null , false ) , / / below the parent id is null as it wasn ' t propagated span ( " a " , null , " b " , kind server , " backend " , null , true ) ) ; assert that ( trace merge ( trace ) ) using field by field element comparator ( ) contains exactly in any order ( span ( " a " , null , " a " , kind server , " frontend " , null , false ) , span ( " a " , " a " , " b " , kind client , " frontend " , null , false ) , span ( " a " , " a " , " b " , kind server , " backend " , null , true ) ) ; }


prevent the actual completion action from taking place further listeners may still process this event , though

public void cancel ( ) { this cancelled = true ; }


print a table for the phase overview with runtime and runtime percentage per phase and total

private void print phase summary statistics ( ) { ln print ( " = = = phase summary information = = = \ n " ) ; for ( profile phase phase : phase summary stats ) { long phase duration in ms = duration of nanos ( phase summary stats get duration nanos ( phase ) ) to millis ( ) ; double relative duration = phase summary stats get relative duration ( phase ) ; ln printf ( three column format , " total " + phase nick + " phase time " , string format ( " % 3f s " , phase duration in ms / 1000 0 ) , pretty percentage ( relative duration ) ) ; } ln printf ( " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " ) ; long total duration in ms = duration of nanos ( phase summary stats get total duration ( ) ) to millis ( ) ; ln printf ( three column format , " total run time " , string format ( " % 3f s " , total duration in ms / 1000 0 ) , " 100 00 % " ) ; print ln ( ) ; }


adds a to - one relationship to the given target entity using the given given foreign key property ( which belongs to this entity )

public to one add to one ( entity target , property fk property ) { if ( protobuf ) { throw new illegal state exception ( " protobuf entities do not support realtions , currently " ) ; } property [ ] fk properties = { fk property } ; to one to one = new to one ( schema , this , target , fk properties , true ) ; to one relations add ( to one ) ; return to one ; }


returns an instance with the specified ad marked as skipped

public ad playback state with skipped ad ( int ad group index , int ad index in ad group ) { ad group [ ] ad groups = util null safe array copy ( this ad groups , this ad groups length ) ; ad groups [ ad group index ] = ad groups [ ad group index ] with ad state ( ad state skipped , ad index in ad group ) ; return new ad playback state ( ad group times us , ad groups , ad resume position us , content duration us ) ; }


returns the current session associated with this request , or if the request does not have a session , creates one

public session session ( ) { if ( session = = null | | ! valid session ) { valid session ( true ) ; session = new session ( servlet request get session ( ) , this ) ; } return session ; }


public void test chunked response ( ) throws exception { kv state registry registry = new kv state registry ( ) ; kv state request stats stats = new atomic kv state request stats ( ) ; message serializer < kv state internal request , kv state response > serializer = new message serializer < > ( new kv state internal request kv state internal request deserializer ( ) , new kv state response kv state response deserializer ( ) ) ; kv state server handler handler = new kv state server handler ( test server , registry , serializer , stats ) ; embedded channel channel = new embedded channel ( get frame decoder ( ) , handler ) ; int num key groups = 1 ; abstract state backend abstract backend = new memory state backend ( ) ; dummy environment dummy env = new dummy environment ( " test " , 1 , 0 ) ; dummy env set kv state registry ( registry ) ; abstract keyed state backend < integer > backend = create keyed state backend ( registry , num key groups , abstract backend , dummy env ) ; final test registry listener registry listener = new test registry listener ( ) ; registry register listener ( dummy env get job i d ( ) , registry listener ) ; / / register state value state descriptor < byte [ ] > desc = new value state descriptor < > ( " any " , byte primitive array serializer instance ) ; desc set queryable ( " vanilla " ) ; value state < byte [ ] > state = backend get partitioned state ( void namespace instance , void namespace serializer instance , desc ) ; / / update kv state byte [ ] bytes = new byte [ 2 * channel config ( ) get write buffer high water mark ( ) ] ; byte current = 0 ; for ( int i = 0 ; i < bytes length ; i + + ) { bytes [ i ] = current + + ; } int key = 99812822 ; backend set current key ( key ) ; state update ( bytes ) ; / / request byte [ ] serialized key and namespace = kv state serializer serialize key and namespace ( key , int serializer instance , void namespace instance , void namespace serializer instance ) ; long request id = integer max value + 182828l ; assert true ( registry listener registration name equals ( " vanilla " ) ) ; kv state internal request request = new kv state internal request ( registry listener kv state id , serialized key and namespace ) ; byte buf ser request = message serializer serialize request ( channel alloc ( ) , request id , request ) ; / / write the request and wait for the response channel write inbound ( ser request ) ; object msg = read inbound blocking ( channel ) ; assert true ( " not chunked byte buf " , msg instanceof chunked byte buf ) ; ( ( chunked byte buf ) msg ) close ( ) ; }


public void set name ( string name ) { this demangled name = name ; this name = name ; if ( name ! = null ) { / / use safe name and omit common spaces where they are unwanted in names / / trim leading / trailing whitespace which may have been improperly included by demangler this name = demangler util strip superfluous signature spaces ( name ) trim ( ) replace ( ' ' , ' ' ) ; } }


rewrites a class ' s static field with a new value by field

public static void set final static ( final field field , final object new value ) throws no such field exception , illegal access exception { field set accessible ( true ) ; final field modifiers field = field class get declared field ( " modifiers " ) ; modifiers field set accessible ( true ) ; modifiers field set int ( field , field get modifiers ( ) & ~ modifier final ) ; field set ( null , new value ) ; modifiers field set int ( field , field get modifiers ( ) | modifier final ) ; modifiers field set accessible ( false ) ; field set accessible ( false ) ; }


public int shard id ( ) { return this shard id ; }


public immutable list < type > get argument types ( ) { return immutable list copy of ( get argument type array ( ) ) ; }


returns table entry value as pointer for specified case index value

address get case address ( int case index value ) throws memory access exception , address out of bounds exception { return get table entry as address ( case index value , 1 , false ) ; }


zipkin trace finished by the expired rule

public void on removal ( @ nullable string key , @ nullable zipkin trace trace , @ nonnull removal cause cause ) { if ( trace instanceof zipkin trace trigger trace ) { return ; } try { zipkin 2 sky walking transfer instance transfer ( trace ) ; } catch ( exception e ) { logger error ( e get message ( ) , e ) ; logger warn ( " zipkin trace : " + trace ) ; } }


factory method to instantiate the remote rpc service

protected rpc service create remote rpc service ( configuration configuration , string bind address , int bind port ) throws exception { return akka rpc service utils remote service builder ( configuration , bind address , string value of ( bind port ) ) with bind address ( bind address ) with bind port ( bind port ) with custom config ( akka utils test dispatcher config ( ) ) create and start ( ) ; }


returns an iterable view of { @ code x } if it is an iterable starlark value ; throws eval exception otherwise whereas the interpreter temporarily freezes the iterable value by bracketing { @ code for } loops and comprehensions in calls to { @ link freezable # update iterator count } , iteration using this method does not freeze the value callers should exercise care not to mutate the underlying object during iteration

public static iterable < ? > to iterable ( object x ) throws eval exception { if ( x instanceof starlark iterable ) { return ( iterable < ? > ) x ; } throw errorf ( " type ' % s ' is not iterable " , type ( x ) ) ; }


helper method to pre - set the oauth access token of the first oauth found in the api authorizations ( there should be only one )

public void set access token ( string access token , long expires in ) { for ( request interceptor api authorization : api authorizations values ( ) ) { if ( api authorization instanceof o auth ) { o auth oauth = ( o auth ) api authorization ; oauth set access token ( access token , expires in ) ; return ; } } }


returns the fields of a class for a { @ link structured type }

static list < field > collect structured fields ( class < ? > clazz ) { final list < field > fields = new array list < > ( ) ; while ( clazz ! = object class ) { final field [ ] declared fields = clazz get declared fields ( ) ; stream of ( declared fields ) filter ( field - > { final int m = field get modifiers ( ) ; return ! modifier is static ( m ) & & ! modifier is transient ( m ) ; } ) for each ( fields : : add ) ; clazz = clazz get superclass ( ) ; } return fields ; }


initialize the bodies , anchors , and length using the world anchors

public void initialize ( body body a , body body b , vector 2 anchor a , vector 2 anchor b ) { this body a = body a ; this body b = body b ; this local anchor a set ( body a get local point ( anchor a ) ) ; this local anchor b set ( body b get local point ( anchor b ) ) ; this length = anchor a dst ( anchor b ) ; }


set the character set to use for part headers such as " content - disposition " ( and its filename parameter ) by default this is set to " utf - 8 " if changed from this default , the " content - type " header will have a " charset " parameter that specifies the character set used

public void set charset ( charset charset ) { assert not null ( charset , " charset must not be null " ) ; this charset = charset ; }


creates the consumer that does the " field just arrived " behavior if the target object hasn ' t been built then it queues the value otherwise it just applies the value just like { @ linkplain object parser } does

private < t > bi consumer < target , t > queueing consumer ( bi consumer < value , t > consumer , parse field parse field ) { return ( target , v ) - > { if ( target target object ! = null ) { / / the target has already been built just apply the consumer now consumer accept ( target target object , v ) ; return ; } / * * the target hasn ' t been built queue the consumer the next two lines are the only allocations that constructing object parser * does during parsing other than the boxing the object parser might do the first one is to preserve a snapshot of the current * location so we can add it to the error message if parsing fails the second one ( the lambda ) is the actual operation being * queued note that we don ' t do any of this if the target object has already been built * / x content location location = target parser get token location ( ) ; target queue ( target object - > { try { consumer accept ( target object , v ) ; } catch ( exception e ) { throw new x content parse exception ( location , " [ " + object parser get name ( ) + " ] failed to parse field [ " + parse field get preferred name ( ) + " ] " , e ) ; } } ) ; } ; }


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

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


public void check disk error ( ) throws i o exception { set < fs volume spi > unhealthy volumes ; try { unhealthy volumes = volume checker check all volumes ( data ) ; last disk error check = time monotonic now ( ) ; } catch ( interrupted exception e ) { log error ( " interrupted while running disk check " , e ) ; throw new i o exception ( " interrupted while running disk check " , e ) ; } if ( unhealthy volumes size ( ) > 0 ) { log warn ( " check disk error got { } failed volumes - { } " , unhealthy volumes size ( ) , unhealthy volumes ) ; handle volume failures ( unhealthy volumes ) ; } else { log debug ( " check disk error encountered no failures " ) ; } }


get properties by id some properties ( subscription id and user properties ) may occur multiple times , this method returns all their values in order

public list < ? extends mqtt property > get properties ( int property id ) { if ( property id = = mqtt property type user property value ) { return user properties = = null ? collections < mqtt property > empty list ( ) : user properties ; } if ( property id = = mqtt property type subscription identifier value ) { return subscription ids = = null ? collections < mqtt property > empty list ( ) : subscription ids ; } int object hash map < mqtt property > props = this props ; return ( props = = null | | ! props contains key ( property id ) ) ? collections < mqtt property > empty list ( ) : collections singleton list ( props get ( property id ) ) ; }


assign the value to a portion of this register value

public register value assign ( register sub register , register value value ) { check base register ( sub register ) ; register value other value = new register value ( sub register , value get unsigned value ignore mask ( ) , value get value mask ( ) ) ; return combine values ( other value ) ; }


returns the { @ link list } of the handler names


add this constraint value to the given fingerprint

public void add to ( fingerprint fp ) { this constraint add to ( fp ) ; fp add string ( label get canonical form ( ) ) ; }


checks that the current page is actually the page this page object represents


lazy initialization of param file name to content map

private map < string , iterable < string > > get param file name to content map ( ) { if ( param file name to content map = = null ) { param file name to content map = new hash map < > ( ) ; } return param file name to content map ; }


compares the { @ link authentication } that was used to create the { @ link async execution id } with the current authentication

boolean ensure authenticated user is same ( authentication original , authentication current ) { final boolean same principal = original get user ( ) principal ( ) equals ( current get user ( ) principal ( ) ) ; final boolean same realm type ; if ( original get user ( ) is run as ( ) ) { if ( current get user ( ) is run as ( ) ) { same realm type = original get looked up by ( ) get type ( ) equals ( current get looked up by ( ) get type ( ) ) ; } else { same realm type = original get looked up by ( ) get type ( ) equals ( current get authenticated by ( ) get type ( ) ) ; } } else if ( current get user ( ) is run as ( ) ) { same realm type = original get authenticated by ( ) get type ( ) equals ( current get looked up by ( ) get type ( ) ) ; } else { same realm type = original get authenticated by ( ) get type ( ) equals ( current get authenticated by ( ) get type ( ) ) ; } return same principal & & same realm type ; }


sets the source object for this action context this method is used internally by the docking window manager component provider and action developers should only use this method for testing

public action context set source object ( object source object ) { this source object = source object ; return this ; }


prepare a record and hand it over to the { @ link record emitter } , which may collect it asynchronously this method is called by { @ link shard consumer } s

protected void emit record and update state ( t record , long record timestamp , int shard state index , sequence number last sequence number ) { shard watermark state sws = shard watermarks get ( shard state index ) ; preconditions check not null ( sws , " shard watermark state initialized in register new subscribed shard state " ) ; watermark watermark = null ; if ( sws periodic watermark assigner ! = null ) { record timestamp = sws periodic watermark assigner extract timestamp ( record , sws last record timestamp ) ; / / track watermark per record since extract timestamp has side effect watermark = sws periodic watermark assigner get current watermark ( ) ; } sws last record timestamp = record timestamp ; sws last updated = get current time millis ( ) ; record wrapper < t > record wrapper = new record wrapper < > ( record , record timestamp ) ; record wrapper shard state index = shard state index ; record wrapper last sequence number = last sequence number ; record wrapper watermark = watermark ; try { sws emit queue put ( record wrapper ) ; } catch ( interrupted exception e ) { throw new runtime exception ( e ) ; } }


returns the number of bytes one can read from the buffer


public void set previous offset ( int offset ) { / / do nothing }


public close index request builder set indices ( string indices ) { request indices ( indices ) ; return this ; }


return whether this holder currently has a { @ link connection }

protected boolean has connection ( ) { return ( this current connection ! = null ) ; }


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

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


public synchronized http response do reload ( ) throws i o exception { check permission ( manage ) ; logger log ( level warning , " reloading jenkins as requested by { 0 } " , get authentication 2 ( ) get name ( ) ) ; / / engage " loading " ui and then run the actual task in a separate thread web app get ( servlet context ) set app ( new hudson is loading ( ) ) ; new thread ( " jenkins config reload thread " ) { @ override public void run ( ) { try ( a c l context ctx = acl as 2 ( acl system2 ) ) { reload ( ) ; } catch ( exception e ) { logger log ( severe , " failed to reload jenkins config " , e ) ; new jenkins reload failed ( e ) publish ( servlet context , root ) ; } } } start ( ) ; return http responses redirect via context path ( " / " ) ; }


set the promise { @ link http 2 frame stream } object for this frame

http 2 stream frame push stream ( http 2 frame stream stream ) ;


public void date time test ( ) { / / todo : test date time }


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


public string get sc a e t h flow points ( ) { return sc a e t h flow points ; }


public static string build type source path ( final string source path , final string type ) { val new name = type replace ( " " , file separator ) ; return source path + " / src / main / java / " + new name + " java " ; }


post fake : fake endpoint for testing various parameters 가짜 엔드 포인트 fake endpoint for testing various parameters 가짜 엔드 포인트

default mono < response entity < void > > test endpoint parameters ( big decimal number , double double , string pattern without delimiter , byte [ ] byte , integer integer , integer int 3 2 , long int 6 4 , float float , string string , flux < part > binary , local date date , offset date time date time , string password , string param callback , server web exchange exchange ) { mono < void > result = mono empty ( ) ; exchange get response ( ) set status code ( http status not implemented ) ; return result then ( mono empty ( ) ) ; }


add a callback to be invoked on processing within transaction synchronization , i e when { @ link # process event } is being triggered during actual transactions

void add callback ( synchronization callback callback ) ;


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


receive a message synchronously from the specified destination , but only wait up to a specified time for delivery convert the message into an object with a configured message converter this method should be used carefully , since it will block the thread until the message becomes available or until the timeout value is exceeded

object receive and convert ( destination destination ) throws jms exception ;


public string type name ( ) { return " char " ; }


void write ( object msg , channel promise promise ) ;


type url for resources wrapped in the provided resources ( s ) this must be consistent with the type url in the wrapper messages if resources is non - empty < code > string type url = 3 ; < code >

public com google protobuf byte string get type url bytes ( ) { java lang object ref = type url ; if ( ref instanceof string ) { com google protobuf byte string b = com google protobuf byte string copy from utf 8 ( ( java lang string ) ref ) ; type url = b ; return b ; } else { return ( com google protobuf byte string ) ref ; } }


allow the scanner to scan the given block pool

public synchronized void enable block pool id ( string bpid ) { for ( block iterator iter : block iters ) { if ( iter get block pool id ( ) equals ( bpid ) ) { log warn ( " { } : already enabled scanning on block pool { } " , this , bpid ) ; return ; } } block iterator iter = null ; try { / / load a block iterator for the next block pool on the volume iter = volume load block iterator ( bpid , block iterator name ) ; log trace ( " { } : loaded block iterator for { } " , this , bpid ) ; } catch ( file not found exception e ) { log debug ( " { } : failed to load block iterator : " + e get message ( ) , this ) ; } catch ( i o exception e ) { log warn ( " { } : failed to load block iterator " , this , e ) ; } if ( iter = = null ) { iter = volume new block iterator ( bpid , block iterator name ) ; log trace ( " { } : created new block iterator for { } " , this , bpid ) ; } iter set max staleness ms ( conf max staleness ms ) ; block iters add ( iter ) ; notify ( ) ; }


informs the decoder of the current playback position must be called prior to each attempt to dequeue output buffers from the decoder

void set position us ( long position us ) ;


generates a xml response that describe the ec2 instances

private byte [ ] generate describe instances response ( ) { final x m l output factory xml output factory = x m l output factory new factory ( ) ; xml output factory set property ( x m l output factory is repairing namespaces , true ) ; final string writer out = new string writer ( ) ; x m l stream writer sw ; try { sw = xml output factory create x m l stream writer ( out ) ; sw write start document ( ) ; string namespace = " http : / / ec 2 amazonaws com / doc / 2013 - 02 - 01 / " ; sw set default namespace ( namespace ) ; sw write start element ( x m l constants default ns prefix , " describe instances response " , namespace ) ; { sw write start element ( " request id " ) ; sw write characters ( uuid random u u i d ( ) to string ( ) ) ; sw write end element ( ) ; sw write start element ( " reservation set " ) ; { if ( files exists ( nodes ) ) { for ( string address : files read all lines ( nodes ) ) { sw write start element ( " item " ) ; { sw write start element ( " reservation id " ) ; sw write characters ( uuid random u u i d ( ) to string ( ) ) ; sw write end element ( ) ; sw write start element ( " instances set " ) ; { sw write start element ( " item " ) ; { sw write start element ( " instance id " ) ; sw write characters ( uuid random u u i d ( ) to string ( ) ) ; sw write end element ( ) ; sw write start element ( " image id " ) ; sw write characters ( uuid random u u i d ( ) to string ( ) ) ; sw write end element ( ) ; sw write start element ( " instance state " ) ; { sw write start element ( " code " ) ; sw write characters ( " 16 " ) ; sw write end element ( ) ; sw write start element ( " name " ) ; sw write characters ( " running " ) ; sw write end element ( ) ; } sw write end element ( ) ; sw write start element ( " private dns name " ) ; sw write characters ( address ) ; sw write end element ( ) ; sw write start element ( " dns name " ) ; sw write characters ( address ) ; sw write end element ( ) ; sw write start element ( " instance type " ) ; sw write characters ( " m 1 medium " ) ; sw write end element ( ) ; sw write start element ( " placement " ) ; { sw write start element ( " availability zone " ) ; sw write characters ( " use - east - 1e " ) ; sw write end element ( ) ; sw write empty element ( " group name " ) ; sw write start element ( " tenancy " ) ; sw write characters ( " default " ) ; sw write end element ( ) ; } sw write end element ( ) ; sw write start element ( " private ip address " ) ; sw write characters ( address ) ; sw write end element ( ) ; sw write start element ( " ip address " ) ; sw write characters ( address ) ; sw write end element ( ) ; } sw write end element ( ) ; } sw write end element ( ) ; } sw write end element ( ) ; } } sw write end element ( ) ; } sw write end element ( ) ; sw write end document ( ) ; sw flush ( ) ; } } catch ( exception e ) { throw new runtime exception ( e ) ; } return out to string ( ) get bytes ( utf 8 ) ; }


obtains a list of builds , in the descending order , that are within the specified time range [ start , end )

public run list < run t > get builds by timestamp ( long start , long end ) { return get builds ( ) by timestamp ( start , end ) ; }


checks the found applications and returns true if only a single binary was found , even if multiple loaders claim it

public boolean is single app ( ) { set < string > found loaders = new hash set < > ( ) ; for ( batch group group : groups by criteria values ( ) ) { for ( batch load config batch load config : group get batch load config ( ) ) { string loader i d = batch load config get load specs ( ) iterator ( ) next ( ) get loader ( ) get name ( ) ; if ( ! found loaders add ( loader i d ) ) { return false ; } } } return true ; }


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


returns all nodes in this network adjacent to { @ code node } which can be reached by traversing { @ code node } ' s outgoing edges in the direction ( if any ) of the edge in an undirected network , this is equivalent to { @ link # adjacent nodes ( object ) } this is not the same as " all nodes reachable from { @ code node } by following outgoing edges " for that functionality , see { @ link graphs # reachable nodes ( graph , object ) }


helper method that sets the cache size limit to be either a high , or a low limit if there is not enough free space to satisfy the high limit , it is set to the low limit

private void update file cache size limit ( ) { / / test if m cache size limit can be set to the high limit boolean is available space lower than high limit ; stat fs helper storage type storage type = m storage is external ( ) ? stat fs helper storage type external : stat fs helper storage type internal ; is available space lower than high limit = m stat fs helper test low disk space ( storage type , m default cache size limit - m cache stats get size ( ) ) ; if ( is available space lower than high limit ) { m cache size limit = m low disk space cache size limit ; } else { m cache size limit = m default cache size limit ; } }


get an iterator over the long address keys which contain a property value

public address key iterator get address key iterator ( address start , address end , boolean at start ) throws i o exception { if ( property table = = null ) { return new address key iterator ( ) ; } if ( at start ) { return new address key iterator ( property table , addr map , start , end , start , true ) ; } return new address key iterator ( property table , addr map , start , end , end , false ) ; }


return true if this pig object is equal to o

public boolean equals ( object o ) { return super equals ( o ) & & objects equals ( this additional properties , ( ( pig ) o ) additional properties ) ; }


b context path ( string context path ) ;


close the filesystem this shuts down all transfers

public void close ( ) throws i o exception { if ( closed get and set ( true ) ) { / / already closed return ; } is closed = true ; log debug ( " filesystem { } is closed " , uri ) ; try { super close ( ) ; } finally { stop all services ( ) ; } }


removes the given preference from this preferences object

public static string remove property ( string name ) { return ( string ) properties remove ( name ) ; }


enable the action when a program location event comes in ; disable it if either the location is null , or if the address in the location is null

protected void enable on location ( docking action action ) { if ( program action list contains ( action ) ) { throw new illegal argument exception ( " action already added to program action list " ) ; } if ( selection action list contains ( action ) ) { throw new illegal argument exception ( " action already added to selection action list " ) ; } if ( highlight action list contains ( action ) ) { throw new illegal argument exception ( " action already added to highlight action list " ) ; } location action list add ( action ) ; action set enabled ( current location ! = null ) ; }


void close all peers ( ) { log info ( " closing all peers " ) ; lock lock ( ) ; try { peers key set ( ) for each ( p - > i o utils close quietly ( p ) ) ; peers clear ( ) ; peers xceiver clear ( ) ; datanode metrics set data node active xceivers count ( 0 ) ; this no peers signal all ( ) ; } finally { lock unlock ( ) ; } }


escapes a reserved word as defined in the ` reserved words ` array handle escaping those terms here this logic is only called if a variable matches the reserved words

public string escape reserved word ( string name ) { if ( this reserved words mappings ( ) contains key ( name ) ) { return this reserved words mappings ( ) get ( name ) ; } return " " + name ; }


called for all correlators that are run by this command except the duplicate function instruction match correlator

private boolean apply matches ( collection < v t match > matches , string correlator name , task monitor monitor ) throws cancelled exception { / / if this value gets set to true then there are some markup errors in the whole set of / / matches boolean some matches have markup errors = false ; / / note : no need to check score / confidence because they are passed into the correlator / / ahead of time so correlator only returns matches higher than given score / threshold for ( v t match match : matches ) { monitor check canceled ( ) ; v t association association = match get association ( ) ; if ( ! association get status ( ) can apply ( ) ) { continue ; } if ( ! try to set accepted ( association ) ) { continue ; } match info match info = controller get match info ( match ) ; collection < v t markup item > markup items = match info get appliable markup items ( monitor ) ; if ( markup items = = null | | markup items size ( ) = = 0 ) { continue ; } apply markup item task markup task = new apply markup item task ( controller get session ( ) , markup items , apply options ) ; markup task run ( monitor ) ; boolean current match has errors = markup task has errors ( ) ; if ( current match has errors ) { some matches have markup errors = true ; } } return some matches have markup errors ; }


the id of the type this may be 0 , which indicates no id is set < code > optional uint 3 2 id = 1 ; < code >


returns the type of the relocation to perform

public int get type ( ) { return type ; }


set queue that the entry resides in ( window , probation , or protected )

public void set queue type ( int queue type ) { throw new unsupported operation exception ( ) ; }


set owner of a path ( i e a file or a directory ) the parameters owner and group cannot both be null

public void set owner ( final path path , final string owner , final string group ) throws i o exception { statistics increment write ops ( 1 ) ; adl client set owner ( to relative file path ( path ) , owner , group ) ; }


validates the implementation of seekable seek to new source , which should return false for version 2 of the block blob input stream

public void test 0306 seek to new source v 2 ( ) throws i o exception { validate seek to new source ( account using input stream v 2 get file system ( ) ) ; }


returns a reserved set of action mnemonics these cannot be used from a starlark action

public immutable set < string > get reserved action mnemonics ( ) { return reserved action mnemonics ; }


manipulate this entity ' s headers with the given consumer the headers provided to the consumer are " live " , so that the consumer can be used to { @ linkplain http headers # set ( string , string ) overwrite } existing header values , { @ linkplain http headers # remove ( object ) remove } values , or use any of the other { @ link http headers } methods

b headers ( consumer < http headers > headers consumer ) ;


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

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


writes lines to file using the given encoding , ending every line with a line break ' \ n ' character

public static void write lines as ( path file , charset charset , string lines ) throws i o exception { write lines as ( file , charset , arrays as list ( lines ) ) ; }


method to form a string of all abfs output stream statistics and their values


returns a field location for the given block , offset

field location get field location ( byte block block , big integer offset , field factory [ ] factorys ) { for ( block info block info : block info map values ( ) ) { if ( block info block = = block ) { big integer byte index = block info block start add ( offset ) ; big integer index = byte index divide ( bytes in line ) ; int line offset = byte index remainder ( bytes in line ) int value ( ) ; / / int field offset = line offset / fields length ; int nbytes per field = bytes in line int value ( ) / factorys length ; int field offset = ( line offset / nbytes per field ) * nbytes per field ; int byte offset = line offset % nbytes per field ; int field num = get field num ( index , field offset , factorys ) ; int col = factorys [ field num ] get column position ( block , byte offset ) ; return new field location ( index , field num , 0 , col ) ; } } return null ; }


used for asynchronous execution this will queue up the command and return a future to get the result once it completes

public future < response type > queue ( ) { return to observable ( ) to blocking ( ) to future ( ) ; }


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


waits for all tasks to complete if the { @ link quiescing executor } owns its own { @ link java util concurrent executor service } , the service will also be shutdown throws ( the same ) unchecked exception if any worker thread failed unexpectedly if the main thread is interrupted and a worker also throws an unchecked exception , the unchecked exception is rethrown , since it may indicate a programming bug if callers handle the unchecked exception , they may check the interrupted bit to see if the pool was interrupted

void await quiescence ( boolean interrupt workers ) throws interrupted exception ;


get the configuration key for the service

public string get service key ( ) { return key ; }


clear the awaiting validation state and enter fetching

private void complete validation ( ) { if ( has position ( ) ) { transition state ( fetch states fetching , ( ) - > this next retry time ms = null ) ; } }


set an implementation of the { @ code org xml sax error handler } interface for custom handling of xml parsing errors and warnings if not set , a default simple sax error handler is used that simply logs warnings using the logger instance of the view class , and rethrows errors to discontinue the xml transformation

public void set error handler ( error handler error handler ) { this error handler = error handler ; }


iterate over all the unique index field values index values are returned in an ascending sorted order with the initial iterator position set to the minimum index value

public d b field iterator index field iterator ( int column index ) throws i o exception { synchronized ( db ) { index table index table = secondary indexes get ( column index ) ; if ( index table = = null ) { throw new i o exception ( " index required ( " + get name ( ) + " , " + column index + " ) " ) ; } return index table index iterator ( ) ; } }


actually set the nested path delegated to by set nested path and push nested path

protected void do set nested path ( @ nullable string nested path ) { if ( nested path = = null ) { nested path = " " ; } nested path = canonical field name ( nested path ) ; if ( nested path length ( ) > 0 & & ! nested path ends with ( errors nested path separator ) ) { nested path + = errors nested path separator ; } this nested path = nested path ; }


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

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


returns whether the given properties match the properties of this method the given properties may be null wildcards

private boolean matches ( int obfuscated line number , string original type , string original arguments ) { return ( obfuscated line number = = 0 ? obfuscated last line number = = 0 : obfuscated first line number < = obfuscated line number & & obfuscated line number < = obfuscated last line number ) & & ( original type = = null | | original type equals ( this original type ) ) & & ( original arguments = = null | | original arguments equals ( this original arguments ) ) ; }


obtains the { @ link template file type } for an input string

public static template file type for template type ( string template type ) { for ( template file type value : values ( ) ) { if ( value template type equals ( template type ) ) { return value ; } } throw new illegal argument exception ( " template type not found in the available values " ) ; }


returns the { @ code z } ( reserved for future use ) field of this dns message


returns the value of { @ link # get url ( ) } if it is non - null otherwise , this class will attempt to create a temporary file containing the image of this class in order to return a url for that temp file if a temporary file could not be created , then the url returned from this class will point to the { @ link resource manager # get default icon ( ) default icon }

public url get or create url ( ) { if ( url ! = null ) { return url ; } create temp url as needed ( ) ; return temp url ; }


constructs all the necessary information to start the mr am

public application submission context create application submission context ( configuration job conf , string job submit dir , credentials ts ) throws i o exception { application id application id = res mgr delegate get application id ( ) ; / / setup local resources map < string , local resource > local resources = setup local resources ( job conf , job submit dir ) ; / / setup security tokens data output buffer dob = new data output buffer ( ) ; ts write token storage to stream ( dob ) ; byte buffer security tokens = byte buffer wrap ( dob get data ( ) , 0 , dob get length ( ) ) ; / / setup container launch context for am container list < string > vargs = setup a m command ( job conf ) ; container launch context am container = setup container launch context for a m ( job conf , local resources , security tokens , vargs ) ; string regex = conf get ( m r job config mr job send token conf ) ; if ( regex ! = null & & ! regex is empty ( ) ) { set token renewer conf ( am container , conf , regex ) ; } collection < string > tags from conf = job conf get trimmed string collection ( m r job config job tags ) ; / / set up the application submission context application submission context app context = record factory new record instance ( application submission context class ) ; app context set application id ( application id ) ; / / application id app context set queue ( / / queue name job conf get ( job context queue name , yarn configuration default queue name ) ) ; / / add reservation i d if present reservation id reservation i d = null ; try { reservation i d = reservation id parse reservation id ( job conf get ( job context reservation id ) ) ; } catch ( number format exception e ) { / / throw exception as reservationid as is invalid string err msg = " invalid reservation id : " + job conf get ( job context reservation id ) + " specified for the app : " + application id ; log warn ( err msg ) ; throw new i o exception ( err msg ) ; } if ( reservation i d ! = null ) { app context set reservation i d ( reservation i d ) ; log info ( " submitting application submission context app : " + application id + " to queue : " + app context get queue ( ) + " with reservation id : " + app context get reservation i d ( ) ) ; } app context set application name ( / / job name job conf get ( job context job name , yarn configuration default application name ) ) ; app context set cancel tokens when complete ( conf get boolean ( m r job config job cancel delegation token , true ) ) ; app context set a m container spec ( am container ) ; / / am container app context set max app attempts ( conf get int ( m r job config mr am max attempts , m r job config default mr am max attempts ) ) ; / / setup the am resource requests list < resource request > am resource requests = generate resource requests ( ) ; app context set a m container resource requests ( am resource requests ) ; / / set labels for the am container requests if present string am nodelabel expression = conf get ( m r job config am node label exp ) ; if ( null ! = am nodelabel expression & & am nodelabel expression trim ( ) length ( ) ! = 0 ) { for ( resource request am resource request : am resource requests ) { am resource request set node label expression ( am nodelabel expression trim ( ) ) ; } } / / set labels for the job containers app context set node label expression ( job conf get ( job context job node label exp ) ) ; app context set application type ( m r job config mr application type ) ; if ( tags from conf ! = null & & ! tags from conf is empty ( ) ) { app context set application tags ( new hash set < > ( tags from conf ) ) ; } string job priority = job conf get ( m r job config priority ) ; if ( job priority ! = null ) { int i priority ; try { i priority = type converter to yarn application priority ( job priority ) ; } catch ( illegal argument exception e ) { i priority = integer parse int ( job priority ) ; } app context set priority ( priority new instance ( i priority ) ) ; } return app context ; }


creates { @ link confluent registry avro deserialization schema } that produces { @ link generic record } using provided reader schema and looks up writer schema in confluent schema registry

public static confluent registry avro deserialization schema < generic record > for generic ( schema schema , string url ) { return for generic ( schema , url , default identity map capacity ) ; }


gets the launch configuration with the given name

public static i launch configuration get launch config ( string name ) throws core exception { i launch manager launch manager = debug plugin get default ( ) get launch manager ( ) ; for ( i launch configuration lc : launch manager get launch configurations ( ) ) { if ( lc get name ( ) equals ( name ) ) { return lc ; } } return null ; }


writes an attribute to the currently open xml element

public void write attribute ( string name , string value ) throws i o exception { if ( value ! = null ) { value = xml escapers xml attribute escaper ( ) escape ( value ) ; } write attribute without escaping ( name , value ) ; }


waits until the given predicate returns true , invoking the garbage collector as necessary to try to ensure that this will happen

public static void await done ( finalization predicate predicate ) { if ( predicate is done ( ) ) { return ; } final long timeout seconds = timeout seconds ( ) ; final long deadline = system nano time ( ) + seconds to nanos ( timeout seconds ) ; do { system run finalization ( ) ; if ( predicate is done ( ) ) { return ; } count down latch done = new count down latch ( 1 ) ; create unreachable latch finalizer ( done ) ; await ( done ) ; if ( predicate is done ( ) ) { return ; } } while ( system nano time ( ) - deadline < 0 ) ; throw format runtime exception ( " predicate did not become true within % d second timeout " , timeout seconds ) ; }


handler for watch events that let us know a file we may care about has changed on disk

private void handle watch event ( path file path , watch event < ? > event ) { boolean should reset context = false ; path dir path = file path get parent ( ) ; if ( event kind ( ) equals ( standard watch event kinds overflow ) ) { / / if we get notified about possibly missed events , reload the key store / trust store just to be sure should reset context = true ; } else if ( event kind ( ) equals ( standard watch event kinds entry modify ) | | event kind ( ) equals ( standard watch event kinds entry create ) ) { path event file path = dir path resolve ( ( path ) event context ( ) ) ; if ( file path equals ( event file path ) ) { should reset context = true ; } } / / note : we don ' t care about delete events if ( should reset context ) { log debug ( " attempting to reset default ssl context after receiving watch event : { } with context : { } " , event kind ( ) , event context ( ) ) ; try { this reset default s s l context and options ( ) ; } catch ( s s l context exception e ) { throw new runtime exception ( e ) ; } } else { log debug ( " ignoring watch event and keeping previous default ssl context event kind : { } with context : { } " , event kind ( ) , event context ( ) ) ; } }


modifies a function instance by removing any reference to outer classes this enables non - static inner function classes

private static void clean function ( readable config config , user defined function function ) { final closure cleaner level level = config get ( pipeline options closure cleaner level ) ; try { closure cleaner clean ( function , level , true ) ; } catch ( throwable t ) { throw new validation exception ( string format ( " function class ' % s ' is not serializable make sure that the class is self - contained " + " ( i e no references to outer classes ) and all inner fields are serializable as well " , function get class ( ) ) , t ) ; } }


load the implementation of unix operating system m x bean for sun jvm and runs the desired method

private long get o s unix m x bean method ( string m bean method name ) { object unixos ; class < ? > class ref ; method m bean method ; try { class ref = class for name ( " com sun management unix operating system m x bean " ) ; if ( class ref is instance ( os mbean ) ) { m bean method = class ref get declared method ( m bean method name ) ; unixos = class ref cast ( os mbean ) ; return ( long ) m bean method invoke ( unixos ) ; } } catch ( exception e ) { log warn ( " not able to load class or method for com sun managment unix operating system m x bean " , e ) ; } return null ; }


sets the window size for this aggregation

public void set window ( int window ) { if ( window < = 0 ) { throw new illegal argument exception ( " [ " + window get preferred name ( ) + " ] must be a positive , non - zero integer " ) ; } this window = window ; }


get petfind by status : finds pets by status multiple status values can be provided with comma separated strings

default response entity < list < pet > > find pets by status ( @ not null @ api param ( value = " status values that need to be considered for filter " , required = true , allowable values = " available , pending , sold " ) @ valid @ request param ( value = " status " , required = true ) list < string > status ) { get request ( ) if present ( request - > { for ( media type media type : media type parse media types ( request get header ( " accept " ) ) ) { if ( media type is compatible with ( media type value of ( " application / json " ) ) ) { string example string = " { \ " photo urls \ " : [ \ " photo urls \ " , \ " photo urls \ " ] , \ " name \ " : \ " doggie \ " , \ " id \ " : 0 , \ " category \ " : { \ " name \ " : \ " default - name \ " , \ " id \ " : 6 } , \ " tags \ " : [ { \ " name \ " : \ " name \ " , \ " id \ " : 1 } , { \ " name \ " : \ " name \ " , \ " id \ " : 1 } ] , \ " status \ " : \ " available \ " } " ; api util set example response ( request , " application / json " , example string ) ; break ; } if ( media type is compatible with ( media type value of ( " application / xml " ) ) ) { string example string = " < pet > < id > 123456789 < / id > < name > doggie < / name > < photo urls > < photo urls > aeiou < / photo urls > < / photo urls > < tags > < / tags > < status > aeiou < / status > < / pet > " ; api util set example response ( request , " application / xml " , example string ) ; break ; } } } ) ; return new response entity < > ( http status not implemented ) ; }


optional sets the number of shard results that should be reduced at once on the coordinating node this value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large defaults to 5

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


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


returns all the registered { @ link views tab bar } descriptors

public static descriptor extension list < views tab bar , descriptor < views tab bar > > all ( ) { return jenkins get ( ) get descriptor list ( views tab bar class ) ; }


decode mysql json binary data to json string

public static serializable decode ( final byte buf byte buf ) { int value type = byte buf read unsigned byte ( ) & 0xff ; string builder result = new string builder ( ) ; decode value ( value type , 1 , byte buf , result ) ; return result to string ( ) ; }


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

public boolean is set success ( ) { return this success ! = null ; }


public string encode int as char escape ( int v ) { if ( v < character min value | | v > character max value ) { throw new illegal argument exception ( string format ( " cannot encode the specified value : % d " , v ) ) ; } if ( v > = 0 & & v < target char value escape length & & target char value escape [ v ] ! = null ) { return target char value escape [ v ] ; } if ( v > = 0x 2 0 & & v < 127 & & ( ! character is digit ( v ) | | v = = ' 8 ' | | v = = ' 9 ' ) ) { return string value of ( ( char ) v ) ; } if ( v > = 0 & & v < = 127 ) { string oct = integer to octal string ( v ) ; return " \ \ " + oct ; } string hex = integer to hex string ( v | 0x 1 0 0 0 0 ) substring ( 1 , 5 ) ; return " \ \ u " + hex ; }


gets the number of characters required to display a unit

public int get data unit symbol size ( ) { return symbol size ; }


register a listener that will be called when this model visibility state has changed the listener will contribute to this model ' s hash code state per the { @ link com airbnb epoxy epoxy attribute option # do not hash } rules

public model view with paris model on visibility state changed ( on model visibility state changed listener < model view with paris model , model view with paris > listener ) { on mutation ( ) ; this on model visibility state changed listener epoxy generated model = listener ; return this ; }


public boolean replace value ( byte block block , big integer index , int char position , char c ) throws byte block access exception { if ( char position < 0 | | char position > symbol size - 1 ) { return false ; } char [ ] char array = { c } ; string s = new string ( char array ) ; try { integer parse int ( s , 16 ) ; } catch ( exception e ) { return false ; } byte cb = byte parse byte ( new string ( char array ) , 16 ) ; / / get the correct byte offset based on position int byte offset = get byte offset ( block , char position ) ; big integer save index = index ; index = index add ( big integer value of ( byte offset ) ) ; byte b = block get byte ( index ) ; b = adjust byte ( b , cb , char position ) ; int int value = get int ( block , save index , b , byte offset ) ; block set int ( save index , int value ) ; return true ; }


tests basic single threaded set permission scenario

public void test single threaded block blob set permission scenario ( ) throws throwable { create empty file ( create test account ( ) , test path ) ; fs delete ( test path , true ) ; fs set permission ( test path , new fs permission ( fs action execute , fs action read , fs action read ) ) ; }


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

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


creates a string matcher that matches any type ( class or primitive type , array or non - array ) and then the given matcher

private variable string matcher create any type matcher ( string matcher next matcher ) { return new variable string matcher ( new char [ ] { class constants type array } , null , 0 , 255 , new or matcher ( new variable string matcher ( internal primitive types , null , 1 , 1 , next matcher ) , new variable string matcher ( new char [ ] { class constants type class start } , null , 1 , 1 , new variable string matcher ( null , new char [ ] { class constants type class end } , 0 , integer max value , new variable string matcher ( new char [ ] { class constants type class end } , null , 1 , 1 , next matcher ) ) ) ) ) ; }


this will parse x content into a { @ link stored script source } the following format is what will be parsed : { @ code { " script " : { " lang " : " < lang > " , " source " : " < source > " , " options " : { " option 0 " : " < option 0 > " , " option 1 " : " < option 1 > " , } } } } note that the " source " parameter can also handle template parsing including from a complex json object

public static stored script source from x content ( x content parser parser , boolean ignore empty ) { return parser apply ( parser , null ) build ( ignore empty ) ; }


deregisters a provider no - op if the provider is not in the registry if there are more than one providers with the same policy name as the deregistered one in the registry , one of them will become the effective provider for that policy , per the rule documented in { @ link # register }

public synchronized void deregister ( load balancer provider provider ) { all providers remove ( provider ) ; refresh provider map ( ) ; }


the nonce provides a way to explicitly ack a specific mesh config response in a following mesh config request additional messages may have been sent by client to the management server for the previous version on the stream prior to this mesh config response , that were unprocessed at response send time the nonce allows the management server to ignore any further mesh config requests for the previous version until a mesh config request bearing the nonce < code > string nonce = 4 ; < code >

com google protobuf byte string get nonce bytes ( ) ;


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


public void shutdown ( final boolean interrupt ) { super shutdown ( interrupt ) ; try { this server socket channel close ( ) ; this selector close ( ) ; } catch ( i o exception e ) { log error ( " accept socket service shutdown exception " , e ) ; } }


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


just like assert same ( x , y ) , but additionally recording ( using thread record failure ) any assertion failed error thrown , so that the current testcase will fail

public void thread assert same ( object x , object y ) { try { assert same ( x , y ) ; } catch ( assertion failed error t ) { thread record failure ( t ) ; throw t ; } }


performs a search and returns the match , or null if no match was found or more than one match was found

public static suggested item find ( search index index , string query , searchable model object search context ) { list < suggested item > r = find ( mode find , index , query , search context ) ; if ( r is empty ( ) ) { return null ; } else if ( 1 = = r size ( ) ) { return r get ( 0 ) ; } else { / / we have more than one suggested item , so return the item who ' s url / / contains the query as this is probably the job ' s name return find closest suggested item ( r , query ) ; } }


public synchronized void on transport started ( ) { if ( keep alive during transport idle ) { on transport active ( ) ; } }


sets the encapsulated byte to the specified value

public void set value ( byte value ) { this value = value ; }


this test validates the correctness of { @ link file util # sym link ( string , string ) } in case of null pointer inputs

public void test symlink with null input ( ) throws i o exception { file file = new file ( del , file ) ; file link = new file ( del , " link " ) ; / / create the same symbolic link / / the operation should fail and returns 1 int result = file util sym link ( null , null ) ; assert assert equals ( 1 , result ) ; / / create the same symbolic link / / the operation should fail and returns 1 result = file util sym link ( file get absolute path ( ) , null ) ; assert assert equals ( 1 , result ) ; / / create the same symbolic link / / the operation should fail and returns 1 result = file util sym link ( null , link get absolute path ( ) ) ; assert assert equals ( 1 , result ) ; }


adds a text button to the button table the dialog must have been constructed with a skin to use this method

public dialog button ( @ null string text , @ null object object ) { if ( skin = = null ) throw new illegal state exception ( " this method may only be used if the dialog was constructed with a skin " ) ; return button ( text , object , skin get ( text button style class ) ) ; }


ensure a cluster is formed with all published nodes

public synchronized void validate cluster formed ( ) { final set < discovery node > expected nodes = new hash set < > ( ) ; for ( node and client node and client : nodes values ( ) ) { expected nodes add ( get instance from node ( cluster service class , node and client node ( ) ) local node ( ) ) ; } logger trace ( " validating cluster formed , expecting { } " , expected nodes ) ; try { assert busy ( ( ) - > { final list < cluster state > states = nodes values ( ) stream ( ) map ( node - > get instance from node ( cluster service class , node node ( ) ) ) map ( cluster service : : state ) collect ( collectors to list ( ) ) ; final string debug string = " , expected nodes : " + expected nodes + " and actual cluster states " + states ; / / all nodes have a master assert true ( " missing master " + debug string , states stream ( ) all match ( cs - > cs nodes ( ) get master node id ( ) ! = null ) ) ; / / all nodes have the same master ( in same term ) assert equals ( " not all masters in same term " + debug string , 1 , states stream ( ) map to long ( cluster state : : term ) distinct ( ) count ( ) ) ; / / all nodes know about all other nodes states for each ( cs - > { discovery nodes discovery nodes = cs nodes ( ) ; assert equals ( " node size mismatch " + debug string , expected nodes size ( ) , discovery nodes get size ( ) ) ; for ( discovery node expected node : expected nodes ) { assert true ( " expected node to exist : " + expected node + debug string , discovery nodes node exists ( expected node ) ) ; } } ) ; } , 30 , time unit seconds ) ; } catch ( assertion error ae ) { throw new illegal state exception ( " cluster failed to form " , ae ) ; } catch ( exception e ) { throw new illegal state exception ( e ) ; } }


corrupt the cache of a { @ link journal } to simulate some corrupt entries being present

public static void corrupt journaled edits cache ( long txid , journal journal ) { journaled edits cache cache = journal get journaled edits cache ( ) ; byte [ ] buf = cache get raw data for tests ( txid ) ; / / change a few arbitrary bytes in the buffer for ( int i = 0 ; i < buf length ; i + = 9 ) { buf [ i ] = 0 ; } for ( int i = 3 ; i < buf length ; i + = 9 ) { buf [ i ] + = 10 ; } for ( int i = 6 ; i < buf length ; i + = 9 ) { buf [ i ] - = 10 ; } }


public void add diagnostic ( string key , string value ) { diagnostics put ( key , value ) ; }


public synchronized void save ( ) throws i o exception { init milestone current milestone = init level ; if ( ! config loaded ) { / / someone is trying to save the config before all extensions are loaded ( and possibly after as the task / / may run in parallel with other tasks omg ! ! ! this is generally very bad and can lead to dataloss logger log ( level severe , " an attempt to save jenkins ' ' global configuration before it has been loaded has been " + " made during milestone " + current milestone + " this is indicative of a bug in the caller and may lead to full or partial loss of " + " configuration " , new illegal state exception ( " call trace " ) ) ; / / at this point we may want to terminate but the save may be called from a different thread and we / / can not call system halt ( ) because we could be running in a container : ( / / for now just deny the save ( the data will be replaced when we do load anyway throw new illegal state exception ( " an attempt to save the global configuration was made before it was loaded " ) ; } if ( bulk change contains ( this ) ) { return ; } if ( current milestone = = init milestone completed ) { logger log ( fine , " setting version { 0 } to { 1 } " , new object [ ] { version , version } ) ; version = version ; } else { logger log ( fine , " refusing to set version { 0 } to { 1 } during { 2 } " , new object [ ] { version , version , current milestone } ) ; } get config file ( ) write ( this ) ; saveable listener fire on change ( this , get config file ( ) ) ; }


return a child adapter position pair object for a given global position

public child adapter position pair get local position ( final int global position ) { int count = 0 ; for ( child adapter child adapter : adapters ) { int new count = count + child adapter adapter get item count ( ) ; if ( global position < new count ) { return new child adapter position pair ( child adapter , global position - count ) ; } count = new count ; } throw new assertion error ( " position out of range " ) ; }


undo the quoting done in { @ link com sun jndi dns resource record # decode txt }

static string unquote ( string txt record ) { string builder sb = new string builder ( txt record length ( ) ) ; boolean inquote = false ; for ( int i = 0 ; i < txt record length ( ) ; i + + ) { char c = txt record char at ( i ) ; if ( ! inquote ) { if ( c = = ' ' ) { continue ; } else if ( c = = ' " ' ) { inquote = true ; continue ; } } else { if ( c = = ' " ' ) { inquote = false ; continue ; } else if ( c = = ' \ \ ' ) { c = txt record char at ( + + i ) ; assert c = = ' " ' | | c = = ' \ \ ' ; } } sb append ( c ) ; } return sb to string ( ) ; }


polls the first priority element or non - priority element if the former does not exist

public t poll ( ) { final t polled = deque poll ( ) ; if ( polled ! = null & & num priority elements > 0 ) { num priority elements - - ; } return polled ; }


appends the specified bytes to the fingerprint message same as { @ link # add bytes ( byte [ ] ) } , but faster when only a { @ link byte string } is available the fingerprint directly injects the bytes with no framing or tags added thus , not guaranteed to be unambiguous ; especially if input length is data - dependent

public fingerprint add bytes ( byte string bytes ) { try { coded out write raw bytes ( bytes ) ; } catch ( i o exception e ) { throw new illegal state exception ( " failed to write bytes " , e ) ; } return this ; }


issue : add at least one assertion to this test case solution : inserted assertion to check whether the execution of the main method in { @ link app # main ( string [ ] ) } throws an exception

void should execute application without exception ( ) { assert does not throw ( ( ) - > app main ( new string [ ] { } ) ) ; }


debug method for dumping the symbols from a symbol map


creates a { @ code striped < lock > } with eagerly initialized , strongly referenced locks every lock is reentrant

public static striped < lock > lock ( int stripes ) { return custom ( stripes , new supplier < lock > ( ) { @ override public lock get ( ) { return new padded lock ( ) ; } } ) ; }


return the configured send - time limit ( milliseconds )

public int get send time limit ( ) { return this send time limit ; }


redirects any http request of type delete on ' from path ' to ' to path ' with the provided redirect ' status ' code

public void delete ( string from path , string to path , status status ) { http delete ( from path , redirect route ( to path , status ) ) ; }


public string to string ( ) { string builder sb = new string builder ( get class ( ) get name ( ) ) ; sb append ( " : " ) append ( this interfaces size ( ) ) append ( " interfaces " ) ; sb append ( class utils class names to string ( this interfaces ) ) append ( " ; " ) ; sb append ( this advisors size ( ) ) append ( " advisors " ) ; sb append ( this advisors ) append ( " ; " ) ; sb append ( " target source [ " ) append ( this target source ) append ( " ] ; " ) ; sb append ( super to string ( ) ) ; return sb to string ( ) ; }