public static void main ( string [ ] args ) { var commands = new command service impl ( ) ; / / create authors and books using command service commands author created ( app constants e evans , " eric evans " , " evans @ email com " ) ; commands author created ( app constants j bloch , " joshua bloch " , " j bloch @ email com " ) ; commands author created ( app constants m fowler , " martin fowler " , " m fowler @ email com " ) ; commands book added to author ( " domain - driven design " , 60 08 , app constants e evans ) ; commands book added to author ( " effective java " , 40 54 , app constants j bloch ) ; commands book added to author ( " java puzzlers " , 39 99 , app constants j bloch ) ; commands book added to author ( " java concurrency in practice " , 29 40 , app constants j bloch ) ; commands book added to author ( " patterns of enterprise " + " application architecture " , 54 01 , app constants m fowler ) ; commands book added to author ( " domain specific languages " , 48 89 , app constants m fowler ) ; commands author name updated ( app constants e evans , " eric j evans " ) ; var queries = new query service impl ( ) ; / / query the database using query service var null author = queries get author by username ( " username " ) ; var evans = queries get author by username ( app constants e evans ) ; var bloch books count = queries get author books count ( app constants j bloch ) ; var authors count = queries get authors count ( ) ; var ddd book = queries get book ( " domain - driven design " ) ; var bloch books = queries get author books ( app constants j bloch ) ; logger info ( " author username : { } " , null author ) ; logger info ( " author evans : { } " , evans ) ; logger info ( " j bloch number of books : { } " , bloch books count ) ; logger info ( " number of authors : { } " , authors count ) ; logger info ( " ddd book : { } " , ddd book ) ; logger info ( " j bloch books : { } " , bloch books ) ; hibernate util get session factory ( ) close ( ) ; }


initializes the staging directory and returns the path it also keeps track of all necessary ownership and permissions

public static path get staging dir ( cluster cluster , configuration conf ) throws i o exception , interrupted exception { user group information user = user group information get login user ( ) ; return get staging dir ( cluster , conf , user ) ; }


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

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


add the given , single header value under the given name

public void add ( string header name , @ nullable string header value ) { this headers add ( header name , header value ) ; }


failure recovery after data is repartitioned with time characteristic : ingestion time producer parallelism = 2 ; kafka partition # = 3 ; consumer parallelism = 3

public void test assigned to partition failure recovery ingestion time ( ) throws exception { test assigned to partition failure recovery ( 500 , ingestion time ) ; }


rename a file under a snapshottable directory , file exists in a snapshot

public void test rename file in snapshot ( ) throws exception { hdfs mkdirs ( sub 1 ) ; hdfs allow snapshot ( sub 1 ) ; d f s test util create file ( hdfs , file 1 , blocksize , repl , seed ) ; hdfs create snapshot ( sub 1 , snap 1 ) ; hdfs rename ( file 1 , file 2 ) ; / / query the diff report and make sure it looks as expected snapshot diff report diff report = hdfs get snapshot diff report ( sub 1 , snap 1 , " " ) ; system out println ( " diff list is " + diff report to string ( ) ) ; list < diff report entry > entries = diff report get diff list ( ) ; assert true ( entries size ( ) = = 2 ) ; assert true ( exists in diff report ( entries , diff type modify , " " , null ) ) ; assert true ( exists in diff report ( entries , diff type rename , file 1 get name ( ) , file 2 get name ( ) ) ) ; }


test serialization of object with outer number type

public void fake outer composite serialize ( outer composite body , handler < async result < outer composite > > result handler ) { fake outer composite serialize ( body , null , result handler ) ; }


construct a j v m id object from given string

public static j v m id for name ( string str ) throws illegal argument exception { if ( str = = null ) return null ; try { string [ ] parts = str split ( " " ) ; if ( parts length = = 5 ) { if ( parts [ 0 ] equals ( jvm ) ) { boolean is map = false ; if ( parts [ 3 ] equals ( " m " ) ) is map = true ; else if ( parts [ 3 ] equals ( " r " ) ) is map = false ; else throw new exception ( ) ; return new j v m id ( parts [ 1 ] , integer parse int ( parts [ 2 ] ) , is map , integer parse int ( parts [ 4 ] ) ) ; } } } catch ( exception ex ) { / / fall below } throw new illegal argument exception ( " task id string : " + str + " is not properly formed " ) ; }


public string get user provided node hash ( ) { return user provided node hash ; }


returns the source location where this info ( provider instance ) was created , or builtin if it was instantiated by java code

default location get creation location ( ) { return location builtin ; }


private static map < string , attribute value > build table attribute values map ( final cas event record ) { val values = new hash map < string , attribute value > ( ) ; values put ( column names principal get column name ( ) , attribute value builder ( ) s ( record get principal id ( ) ) build ( ) ) ; values put ( column names id get column name ( ) , attribute value builder ( ) n ( string value of ( record get id ( ) ) ) build ( ) ) ; values put ( column names creation time get column name ( ) , attribute value builder ( ) s ( record get creation time ( ) ) build ( ) ) ; values put ( column names type get column name ( ) , attribute value builder ( ) s ( record get type ( ) ) build ( ) ) ; val properties = mapper write value as string ( record get properties ( ) ) ; values put ( column names properties get column name ( ) , attribute value builder ( ) s ( properties ) build ( ) ) ; logger debug ( " created attribute values [ { } ] based on [ { } ] " , values , record ) ; return values ; }


perform the " enhanced key schedule " step described by provos and mazieres in " a future - adaptable password scheme " http : www openbsd orgpapersbcrypt - paper ps

private void ekskey ( byte data [ ] , byte key [ ] ) { int i ; int koffp [ ] = { 0 } , doffp [ ] = { 0 } ; int lr [ ] = { 0 , 0 } ; int plen = p length , slen = s length ; for ( i = 0 ; i < plen ; i + + ) p [ i ] = p [ i ] ^ streamtoword ( key , koffp ) ; for ( i = 0 ; i < plen ; i + = 2 ) { lr [ 0 ] ^ = streamtoword ( data , doffp ) ; lr [ 1 ] ^ = streamtoword ( data , doffp ) ; encipher ( lr , 0 ) ; p [ i ] = lr [ 0 ] ; p [ i + 1 ] = lr [ 1 ] ; } for ( i = 0 ; i < slen ; i + = 2 ) { lr [ 0 ] ^ = streamtoword ( data , doffp ) ; lr [ 1 ] ^ = streamtoword ( data , doffp ) ; encipher ( lr , 0 ) ; s [ i ] = lr [ 0 ] ; s [ i + 1 ] = lr [ 1 ] ; } }


look up the given bean metadata attribute in this accessor ' s set of attributes

public bean metadata attribute get metadata attribute ( string name ) { return ( bean metadata attribute ) super get attribute ( name ) ; }


return the class loader that this resource will be obtained from

public final class loader get class loader ( ) { return ( this clazz ! = null ? this clazz get class loader ( ) : this class loader ) ; }


gets a 64 - bit integer at the current { @ code reader index } in the little endian byte order and increases the { @ code reader index } by { @ code 8 } in this buffer

public abstract long read long l e ( ) ;


write a long value to disk atomically either succeeds or an exception is thrown

void write long to file ( string name , final long value ) throws i o exception { file file = new file ( log factory get snap dir ( ) , name ) ; new atomic file writing idiom ( file , new writer statement ( ) { @ override public void write ( writer bw ) throws i o exception { bw write ( long to string ( value ) ) ; } } ) ; }


read a json object from a command - line argument this can take the form of a path to a file containing the json object , or simply the raw json object itself we will assume that if the string is a valid json object , the latter is true if you want to specify a file name containing an open brace , you can force it to be interpreted as a file name be prefixing a or full path

public static < t > t object from command line argument ( string argument , class < t > clazz ) throws exception { if ( open brace comes first ( argument ) ) { return json serde read value ( argument , clazz ) ; } else { return json serde read value ( new file ( argument ) , clazz ) ; } }


returns the program selection contained in this event

public program selection get selection ( ) { return selection ; }


guesses the content type based on the provided bytes

public static x content type x content type ( byte [ ] bytes ) { return x content type ( bytes , 0 , bytes length ) ; }


get the compile directory of the compile unit

public string get compile directory ( ) { return this comp dir ; }


parse and store a key - value pair first one is considered to be the cookie namevalue unknown attribute names are silently discarded

void append attribute ( int key start , int key end , int value start , int value end ) { int length = key end - key start ; if ( length = = 4 ) { parse 4 ( key start , value start , value end ) ; } else if ( length = = 6 ) { parse 6 ( key start , value start , value end ) ; } else if ( length = = 7 ) { parse 7 ( key start , value start , value end ) ; } else if ( length = = 8 ) { parse 8 ( key start , value start , value end ) ; } }


this method is here to keep backwards compatibility with the test code written before observers

void start servers ( ) throws exception { start servers ( false ) ; }


public void set crumb salt ( string salt ) { if ( util fix empty and trim ( salt ) = = null ) { crumb salt = " hudson crumb " ; } else { crumb salt = salt ; } }


returns a hash function implementing the < a href = " https : 131002 netsiphash " > 64 - bit sip hash - 2 - 4 algorithm using a seed value of { @ code k = 00 01 02 }

public static hash function sip hash 2 4 ( ) { return sip hash function sip hash 24 ; }


sets the max width and max height to the specified value if the max size is 0 , no maximum size is used

public cell < t > max size ( value size ) { if ( size = = null ) throw new illegal argument exception ( " size cannot be null " ) ; max width = size ; max height = size ; return this ; }


returns { @ link symbol records } component for this database interface

public symbol records get symbol records ( ) { return symbol records ; }


get the record with the minimum key value which is greater than the specified key

public d b record get record after ( long key ) throws i o exception { synchronized ( db ) { if ( root buffer id < 0 ) { return null ; } try { long key record node leaf = node mgr get long key node ( root buffer id ) get leaf node ( key ) ; return leaf get record after ( key , schema ) ; } finally { node mgr release nodes ( ) ; } } }


writes b length bytes from the specified byte array to this output stream the general contract for write ( b ) is that it should have exactly the same effect as the call write ( b , 0 , b length )

public void write ( byte [ ] b ) throws i o exception { check open ( ) ; try { out write ( b ) ; } catch ( i o exception e ) { if ( e get cause ( ) instanceof storage exception ) { storage exception storage excp = ( storage exception ) e get cause ( ) ; log error ( " encountered storage exception for write on blob : { } " + " exception details : { } error code : { } " , key , e get message ( ) , storage excp get error code ( ) ) ; } throw e ; } }


examine the path metadata , declare whether it should be queued for recursive scanning

private boolean is directory ( path metadata md ) { return ! md get file status ( ) is file ( ) ; }


privileged wrapper that invokes action with subject do as to perform work as given subject

static < t > t do as privileged wrapper ( final subject subject , final privileged exception action < t > action , final access control context acc ) throws privileged action exception { try { return access controller do privileged ( ( privileged exception action < t > ) ( ) - > subject do as privileged ( subject , action , acc ) ) ; } catch ( privileged action exception pae ) { if ( pae get cause ( ) instanceof privileged action exception ) { throw ( privileged action exception ) pae get cause ( ) ; } throw pae ; } }


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


adjusts the data type and source archive info for an associated source archive if its sync state is incorrect it makes sure that a data type that is the same as the associated archive one is in - sync it also makes sure that a data type that differs from the archive one can be committed or updated

public void re sync data types ( ) { if ( source d t m = = null ) { msg info ( get class ( ) , " can ' t access the data types for the " + source archive get name ( ) + " archive " ) ; return ; } int transaction i d = data type manager start transaction ( " re - sync ' " + source archive get name ( ) + " ' data types " ) ; try { re sync out of sync in time only data types ( ) ; fix sync for differing data types ( ) ; } finally { data type manager end transaction ( transaction i d , true ) ; } }


get the { @ link analysis mode } this filter is allowed to be used in the default is { @ link analysis mode # all } instances need to override this method to define their own restrictions

default analysis mode get analysis mode ( ) { return analysis mode all ; }


verify correct container request events sent to localizer

public void test localization request ( ) throws exception { wrapped container wc = null ; try { wc = new wrapped container ( 7 , 314159265358979l , 4344 , " yak " ) ; assert equals ( container state new , wc c get container state ( ) ) ; wc init container ( ) ; / / verify request for public / private resources to localizer resources requested matcher matches req = new resources requested matcher ( wc local resources , enum set of ( local resource visibility public , local resource visibility private , local resource visibility application ) ) ; verify ( wc localizer bus ) handle ( arg that ( matches req ) ) ; assert equals ( container state localizing , wc c get container state ( ) ) ; } finally { if ( wc ! = null ) { wc finished ( ) ; } } }


includes the defined { @ link schema support feature } to the newexisting set of supported features

public builder include schema support features ( schema support feature schema support feature ) { this schema support features add all ( arrays stream ( schema support feature ) collect ( collectors to list ( ) ) ) ; return this ; }


returns { @ link set multimap # as map multimap as map ( ) } , with its type corrected from { @ code map < k , collection < v > > } to { @ code map < k , set < v > > }

public static < k , v > map < k , set < v > > as map ( set multimap < k , v > multimap ) { return ( map < k , set < v > > ) ( map < k , ? > ) multimap as map ( ) ; }


customize the strategies configured via { @ link # exchange strategies ( exchange strategies ) } this method is designed for use in scenarios where multiple parties wish to update the { @ code exchange strategies }

builder exchange strategies ( consumer < exchange strategies builder > configurer ) ;


byte buffer implementation of { @ link # decode list ( byte [ ] ) } note : only use this when it is ok to modify the underlying { @ link byte buffer # array ( ) }

public abstract list < span > decode list ( byte buffer spans ) ;


{ @ inherit doc } the default implementation does nothing

@ override public void enter sequence term ( eql base parser sequence term context ctx ) { }


public void remove all method proxies ( ) { m internal method proxies clear ( ) ; }


can we preempt enough resource for given :

private boolean can preempt enough resource for asked ( resource required resource , string demanding queue , fi ca scheduler node scheduler node , boolean looking for new reservation placement , list < r m container > newly selected containers ) { / / do not check touched nodes again if ( touched nodes contains ( scheduler node get node i d ( ) ) ) { return false ; } temp scheduler node node = temp scheduler node map get ( scheduler node get node i d ( ) ) ; if ( null = = node ) { node = temp scheduler node from scheduler node ( scheduler node ) ; temp scheduler node map put ( scheduler node get node i d ( ) , node ) ; } if ( null ! = scheduler node get reserved container ( ) & & looking for new reservation placement ) { / / node reserved by the others , skip this node / / we will not try to move the reservation to node which reserved already return false ; } / / need to preemption = asked - ( node total - node allocated ) resource lacking = resources subtract ( required resource , resources subtract ( node get total resource ( ) , node get allocated resource ( ) ) ) ; / / on each host , simply check if we could preempt containers from / / lower - prioritized queues or not list < r m container > running containers = node get running containers ( ) ; collections sort ( running containers , container creation time comparator ) ; / / first of all , consider already selected containers for ( r m container running container : running containers ) { if ( capacity scheduler preemption utils is container already selected ( running container , selected candidates ) ) { resources subtract from ( lacking , running container get allocated resource ( ) ) ; } } / / if we already can allocate the reserved container after preemption , / / skip following steps if ( resources fits in ( rc , lacking , resources none ( ) ) ) { return true ; } resource allowed = resources clone ( total preemption allowed ) ; resource selected = resources create resource ( 0 ) ; for ( r m container running container : running containers ) { if ( capacity scheduler preemption utils is container already selected ( running container , selected candidates ) ) { / / ignore selected containers continue ; } / / only preempt resource from queue with lower priority if ( ! preemption allowed ( demanding queue , running container get queue name ( ) ) ) { continue ; } / / don ' t preempt am container if ( running container is a m container ( ) ) { continue ; } / / not allow to preempt more than limit if ( resources greater than or equal ( rc , cluster resource , allowed , running container get allocated resource ( ) ) ) { resources subtract from ( allowed , running container get allocated resource ( ) ) ; resources subtract from ( lacking , running container get allocated resource ( ) ) ; resources add to ( selected , running container get allocated resource ( ) ) ; if ( null ! = newly selected containers ) { newly selected containers add ( running container ) ; } } / / lacking < = 0 means we can allocate the reserved container if ( resources fits in ( rc , lacking , resources none ( ) ) ) { return true ; } } return false ; }


find purchase order by id for valid response try integer i ds with value & lt ; & # x 3 d ; 5 or & gt ; 10 other values will generated exceptions

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


return { @ code true } if the script needs { @ code score } calculated , or { @ code false } otherwise


returns whether any partitions are being tracked for the given key

public boolean has tracked partitions ( k key ) { return tracked partitions per key contains key ( key ) ; }


public void get a c l ( final string path , stat stat , a c l callback cb , object ctx ) { final string client path = path ; path utils validate path ( client path ) ; final string server path = prepend chroot ( client path ) ; request header h = new request header ( ) ; h set type ( zoo defs op code get a c l ) ; get a c l request request = new get a c l request ( ) ; request set path ( server path ) ; get a c l response response = new get a c l response ( ) ; cnxn queue packet ( h , new reply header ( ) , request , response , cb , client path , server path , ctx , null ) ; }


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


adds all the newly allocated containers to the allocate response additionally , in case the n m token for one of the nodes does not exist , it generates one and adds it to the response

private void update allocate response ( allocate response response , list < n m token > nm tokens , list < container > allocated containers ) { list < n m token > new tokens = new array list < > ( ) ; if ( allocated containers size ( ) > 0 ) { response get allocated containers ( ) add all ( allocated containers ) ; for ( container alloc : allocated containers ) { if ( ! node tokens contains key ( alloc get node id ( ) ) ) { new tokens add ( nm secret manager generate n m token ( app submitter , alloc ) ) ; } } list < n m token > ret tokens = new array list < > ( nm tokens ) ; ret tokens add all ( new tokens ) ; response set n m tokens ( ret tokens ) ; } }


regression test for hdfs - 7045 if deadlock happen , the test will time out

public void test read reserved path ( ) throws exception { configuration conf = new configuration ( ) ; mini d f s cluster cluster = new mini d f s cluster builder ( conf ) num data nodes ( 1 ) format ( true ) build ( ) ; try { file system fs = cluster get file system ( ) ; fs open ( new path ( " / reserved / inodes / file " ) ) ; assert fail ( " open a non existing file should fail " ) ; } catch ( file not found exception e ) { / / expected } finally { cluster shutdown ( ) ; } }


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


returns the address of an existing symbol for the query address , where the mapping is derived by using a the address of a pdb symbol as the key and finding the address of a symbol in the program of the same " unique " name this is accomplished using public mangled symbols if the program symbol came from the pdb , then it maps to itself

address get remap address by address ( address address ) { return remap address by address get or default ( address , address ) ; }


returns the text color that is set for the labels

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


return one or more object - media type pairs to write via { @ link # send ( object , media type ) }

set < data with media type > build ( ) ;


clear all the data in { @ link # list to clear self f k }

private void clear f k name list ( ) { get list to clear self f k ( ) clear ( ) ; get list to clear associated f k ( ) clear ( ) ; }


returns < code > true < code > if a context type id specifies a valid context type or if no context type registry is present

private boolean context exists ( string context type id ) { return context type id ! = null & & ( get registry ( ) = = null | | get registry ( ) get context type ( context type id ) ! = null ) ; }


returns the repository name of the target pattern

public abstract repository name get repository ( ) ;


test the property ' $ special property name '

public void $ special property name test ( ) { / / todo : test $ special property name }


public builder sleep interval ms ( long value ) { this sleep interval ms = value ; return this ; }


format the given parameter object into string

public string parameter to string ( object param ) { if ( param = = null ) { return " " ; } else if ( param instanceof date ) { return format date ( ( date ) param ) ; } else if ( param instanceof offset date time ) { return format offset date time ( ( offset date time ) param ) ; } else if ( param instanceof collection ) { string builder b = new string builder ( ) ; for ( object o : ( collection ) param ) { if ( b length ( ) > 0 ) { b append ( ' , ' ) ; } b append ( string value of ( o ) ) ; } return b to string ( ) ; } else { return string value of ( param ) ; } } / * * format to { @ code pair }


the array type codes can be found in the jvm documentation for the " newarray " instruction

public static string get primitive array token ( int code ) { switch ( code ) { case java class constants t boolean : return " boolean " ; case java class constants t char : return " char " ; case java class constants t float : return " float " ; case java class constants t double : return " double " ; case java class constants t byte : return " byte " ; case java class constants t short : return " short " ; case java class constants t int : return " int " ; case java class constants t long : return " long " ; default : throw new illegal argument exception ( " invalid primitive type code : " + code ) ; } }


simpler variant of { @ link # expected output ( string [ ] , string ) } that converts the { @ link checksum } to a string and ignores leading and trailing newlines

protected void expected checksum ( string [ ] parameters , long expected count , long expected checksum ) throws exception { checksum checksum = new checksum ( expected count , expected checksum ) ; expected output ( parameters , " \ n * " + checksum to string ( ) + " \ n * " ) ; }


returns an immutable list containing all the non - bazel specific javac flags

public static immutable list < string > remove bazel specific flags ( string [ ] javacopts ) { return remove bazel specific flags ( arrays as list ( javacopts ) ) ; }


public static void set status bar color ( @ non null final view fake status bar , @ color int final int color ) { if ( build version sdk int < build version codes kitkat ) return ; activity activity = utils bridge get activity by context ( fake status bar get context ( ) ) ; if ( activity = = null ) return ; transparent status bar ( activity ) ; fake status bar set visibility ( view visible ) ; view group layout params layout params = fake status bar get layout params ( ) ; layout params width = view group layout params match parent ; layout params height = get status bar height ( ) ; fake status bar set background color ( color ) ; }


{ @ inherit doc } file licenses are strange , and require some special handling when you ask " what license covers this file ? " in a query , the answer should be the license declared for the enclosing package on the other hand , if the file is a source for a rule target , and the rule ' s license declares more exceptions than the default inherited by the file , the rule ' s more liberal target should override the stricter license of the file in other words , the license of the rule always overrides the license of the non - rule file targets that are inputs to that rule

public license get license ( ) { return get package ( ) get default license ( ) ; }


check if the given array contains the given value ( with case - insensitive comparison )

public static boolean contains ignore case ( string [ ] array , string value ) { for ( string str : array ) { if ( value = = null & & str = = null ) { return true ; } if ( value ! = null & & value equals ignore case ( str ) ) { return true ; } } return false ; }


get a thread - local typed bytes writable input for the supplied { @ link data input }

public static typed bytes writable input get ( data input in ) { return get ( typed bytes input get ( in ) ) ; }


this method implements the new interface by calling the old method note that the input types are different between the new and old apis and this is a bridge between the two

public final boolean is recovery supported ( org apache hadoop mapreduce job context context ) throws i o exception { return is recovery supported ( ( job context ) context ) ; }


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


starts the web server so it can accept requests on the listening port

public void start ( ) { this worker thread = new thread ( this worker , " mock web server worker " ) ; this worker thread start ( ) ; }


public static string date format ( timestamp data ts , string format , zone id zone id ) { date time formatter formatter = datetime formatter cache get ( format ) ; instant instant = ts to instant ( ) ; return local date time of instant ( instant , zone id ) format ( formatter ) ; }


the list of top metrics , in sorted order

public list < top metrics > get top metrics ( ) { return top metrics ; }


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

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


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

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


public void set max force ( float force ) { jni set max force ( addr , force ) ; }


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


public void set savepoint restore settings ( savepoint restore settings settings ) { this savepoint restore settings = check not null ( settings , " savepoint restore settings " ) ; }


this is a regression test for antlrantlr 4 # 507 " null pointer exception when generating code from grammar " https : github comantlrantlr 4issues 5 0 7

@ test public void test invalid escape sequences ( ) { string grammar = " lexer grammar a ; \ n " + " rule : ' foo \ \ u a a b g \ \ x \ \ u ' ; \ n " ; string expected = " warning ( " + error type invalid escape sequence code + " ) : a g 4 : 2 : 12 : invalid escape sequence \ \ u a a b g \ n " + " warning ( " + error type invalid escape sequence code + " ) : a g 4 : 2 : 19 : invalid escape sequence \ \ x \ n " + " warning ( " + error type invalid escape sequence code + " ) : a g 4 : 2 : 22 : invalid escape sequence \ \ u \ n " + " warning ( " + error type epsilon token code + " ) : a g 4 : 2 : 0 : non - fragment lexer rule rule can match the empty string \ n " ; string [ ] pair = new string [ ] { grammar , expected } ; super test errors ( pair , true ) ; }


an option indicating whether or not to follow references to other data and validate those too if this is set to true then the data is only valid if its referred to data is also valid < br > default is true

public boolean should validate referred to data ( ) { return validate referred to data ; }


returns a { @ code map < package identifier , long > } of num targets this may contain only a subset of all packages loaded based on the implementation

map < package identifier , long > get num targets ( ) ;


helper method to configure the oauth access codeimplicit flow parameters

public api client configure authorization flow ( string client id , string client secret , string redirect u r i ) { for ( interceptor api authorization : api authorizations values ( ) ) { if ( api authorization instanceof o auth ) { o auth oauth = ( o auth ) api authorization ; oauth get token request builder ( ) set client id ( client id ) set client secret ( client secret ) set redirect u r i ( redirect u r i ) ; oauth get authentication request builder ( ) set client id ( client id ) set redirect u r i ( redirect u r i ) ; return this ; } } return this ; }


returns an empty { @ link prioritized operator subtask state } singleton for an empty , not - restored operator state

public static prioritized operator subtask state empty not restored ( ) { return empty non restored instance ; }


< code > optional double money = 1 ; < code >


returns true if the corresponding reference is to an offcut address

public boolean is offcut reference ( ) { return is offcut reference ; }


gets the value of the bit at the given index

public static boolean get ( int [ ] bits , int idx ) { int array idx = idx > > 5 ; int bit = 1 < < ( idx & 0x 1f ) ; return ( bits [ array idx ] & bit ) ! = 0 ; }


request to flush all pending messages via this channel outbound invoker


get the current motor torque given the inverse time step , usually in n - m

public float get motor torque ( float inv dt ) { return jni get motor torque ( addr , inv dt ) ; }


returns project lock file to prevent multiple accesses to the same project at once

public file get project lock file ( ) { return new file ( location , name + lock file suffix ) ; }


public int get connect timeout ( ) { return connection timeout ; }


remove the job from scheduler if it finishes

public balance job remove ( balance job job ) { balance job inner = find job ( job ) ; if ( inner = = null ) { return null ; } else if ( job is job done ( ) ) { synchronized ( this ) { return job set remove ( inner ) ; } } return null ; }


construct a { @ code session windowed serde } object for the specified inner class type

static public < t > serde < windowed < t > > session windowed serde from ( final class < t > type ) { return new session windowed serde < > ( serdes serde from ( type ) ) ; }


gets called to updatevalidate the current editable location in the table

protected boolean field edited ( object value , int row index , int column index ) { if ( applying field edit ) { return true ; / / the one in progress will indicate any errors } try { applying field edit = true ; switch ( column index ) { case datatype : set component data type ( row index , value ) ; break ; case fieldname : set component name ( row index , ( ( string ) value ) trim ( ) ) ; break ; case comment : set component comment ( row index , ( string ) value ) ; break ; default : return false ; } return true ; } catch ( usr exception e ) { set status ( e get message ( ) ) ; return false ; } finally { applying field edit = false ; } }


returns the collection of string values for the given key if the key does not exist it will return null

public collection < string > get multi parameter ( string key ) { add to defaults ( key , null ) ; unrequested parameters remove ( key ) ; return data get or default ( key , null ) ; }


public long get modified time ( ) { return modified time ; }


get the current sub - process executing the given command

public process process ( ) { return process ; }


set the user data use this to store your application specific data

public void set user data ( object data ) { m user data = data ; }


registers a watcher for a listener with the given port

void watch listener data ( int port , listener watcher watcher ) { }


public static void start activity ( @ non null final string pkg , @ non null final string cls , @ anim res final int enter anim , @ anim res final int exit anim ) { context context = get top activity or app ( ) ; start activity ( context , null , pkg , cls , get options bundle ( context , enter anim , exit anim ) ) ; if ( build version sdk int < build version codes jelly bean & & context instanceof activity ) { ( ( activity ) context ) override pending transition ( enter anim , exit anim ) ; } }


set movement method ( link movement method get instance ( ) )

public builder set url ( @ non null string url ) { this url = url ; return this ; }


called when the animation is complete useful for e g adjusting the pip ' s final location to make sure it is respecting the screen space available


adds a rule that will cause every send request to fail , and each new connect since the rule is added to fail as well

public void add fail to send no connect rule ( transport service transport service ) { for ( transport address transport address : extract transport addresses ( transport service ) ) { add fail to send no connect rule ( transport address ) ; } }


check that the transformer doesn ' t explode when given an empty file

public void test transform empty config ( ) { run test ( list of ( ) , list of ( ) ) ; }


returns a color string of the format rrrgggbbb as an example , { @ link color # red } would be returned as 255000000 ( the values are padded with 0s to make to fill up 3 digits per component )

public static string to r g b string ( color color ) { string builder buffy = new string builder ( ) ; buffy append ( string utilities pad ( integer to string ( color get red ( ) ) , ' 0 ' , 3 ) ) ; buffy append ( string utilities pad ( integer to string ( color get green ( ) ) , ' 0 ' , 3 ) ) ; buffy append ( string utilities pad ( integer to string ( color get blue ( ) ) , ' 0 ' , 3 ) ) ; return buffy to string ( ) ; }


public string get small snake ( ) { return small snake ; }


if this is a compiled xml file , this is the root node < code > optional aapt pb xml node xml root = 5 ; < code >

private void clear xml root ( ) { xml root = null ; bit field 0 = ( bit field 0 & ~ 0x 0 0 0 0 0 0 0 8 ) ; }


test keyed keyed co process function side output

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


check if a given user is configured to bypass external attribute provider

private boolean is user bypassing ext attr provider ( final string user ) { return ( users to bypass ext attr provider ! = null ) & & users to bypass ext attr provider contains ( user ) ; }


public void update by xml ( source source ) throws i o exception { check permission ( configure ) ; xml file config xml file = get config file ( ) ; final atomic file writer out = new atomic file writer ( config xml file get file ( ) ) ; try { try { x m l utils safe transform ( source , new stream result ( out ) ) ; out close ( ) ; } catch ( transformer exception | s a x exception e ) { throw new i o exception ( " failed to persist config xml " , e ) ; } / / try to reflect the changes by reloading object o = new xml file ( items xstream , out get temporary file ( ) ) unmarshal nulling out ( this ) ; if ( o ! = this ) { / / ensure that we ' ve got the same job type extending this code to support updating / / to different job type requires destroying & creating a new job type throw new i o exception ( " expecting " + this get class ( ) + " but got " + o get class ( ) + " instead " ) ; } items while updating by xml ( new not really role sensitive callable < void , i o exception > ( ) { @ override public void call ( ) throws i o exception { on load ( get parent ( ) , get root dir ( ) get name ( ) ) ; return null ; } } ) ; jenkins get ( ) rebuild dependency graph async ( ) ; / / if everything went well , commit this new version out commit ( ) ; saveable listener fire on change ( this , get config file ( ) ) ; } finally { out abort ( ) ; / / don ' t leave anything behind } }


ensure that set storage policy throws i o exception when dfs storage policy enabled is set to false

public void test config key disabled ( ) throws i o exception { configuration conf = new hdfs configuration ( ) ; conf set boolean ( d f s config keys dfs storage policy enabled key , false ) ; mini d f s cluster cluster = new mini d f s cluster builder ( conf ) num data nodes ( 1 ) build ( ) ; try { cluster wait active ( ) ; cluster get file system ( ) set storage policy ( new path ( " / " ) , hdfs constants cold storage policy name ) ; } finally { cluster shutdown ( ) ; } }


returns true if the current user has the given permission

public static boolean has permission ( permission permission ) throws i o exception , servlet exception { return has permission ( jenkins get ( ) , permission ) ; }


private boolean exclude playlist ( long exclusion duration ms ) { exclude until ms = system clock elapsed realtime ( ) + exclusion duration ms ; return playlist url equals ( primary media playlist url ) & & ! maybe select new primary url ( ) ; }


return the default { @ link toast utils } instance

public static toast utils get default maker ( ) { return default maker ; }


same as byte to hex string ( bytes , 0 , bytes length )

public static string byte to hex string ( byte bytes [ ] ) { return byte to hex string ( bytes , 0 , bytes length ) ; }


public long get write buffer manager capacity ( ) { if ( shared resources = = null ) { return null ; } return shared resources get resource handle ( ) get write buffer manager capacity ( ) ; }


proxy uses the hash code of the target source

public int hash code ( ) { return jdk dynamic aop proxy class hash code ( ) * 13 + this advised get target source ( ) hash code ( ) ; }


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


public i build stage name ( string name ) ;


iterate over all primary keys sorted based upon the associated index key the iterator is initially positioned before the first index buffer whose index key is greater than or equal to the specified start field value

public d b field iterator index key iterator before ( int column index , field start field ) 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 key iterator before ( start field ) ; } }


public static int dp to px ( float dp , resources resources ) { float px = typed value apply dimension ( typed value complex unit dip , dp , resources get display metrics ( ) ) ; return ( int ) px ; }


scenario : schedule a build and see if one slave is provisioned

@ test public void auto provision ( ) throws exception { try ( bulk change bc = new bulk change ( r jenkins ) ) { dummy cloud impl cloud = init hudson ( 10 ) ; free style project p = create job ( new sleep builder ( 10 ) ) ; future < free style build > f = p schedule build 2 ( 0 ) ; f get ( 30 , time unit seconds ) ; / / if it ' s taking too long , abort / / since there ' s only one job , we expect there to be just one slave assert equals ( 1 , cloud num provisioned ) ; } }


check all events for tasks not related to a process - instance

public void test standalone task events ( ) throws exception { task task = null ; try { task = task service new task ( ) ; task set category ( " 123 " ) ; task set description ( " description " ) ; task service save task ( task ) ; assert that ( listener get events received ( ) ) has size ( 3 ) ; activiti entity event event = ( activiti entity event ) listener get events received ( ) get ( 0 ) ; assert that ( event get type ( ) ) is equal to ( activiti event type entity created ) ; assert that ( event get entity ( ) ) is instance of ( task class ) ; task task from event = ( task ) event get entity ( ) ; assert that ( task from event get id ( ) ) is equal to ( task get id ( ) ) ; assert that ( event get process definition id ( ) ) is null ( ) ; assert that ( event get process instance id ( ) ) is null ( ) ; assert that ( event get execution id ( ) ) is null ( ) ; event = ( activiti entity event ) listener get events received ( ) get ( 1 ) ; assert that ( event get type ( ) ) is equal to ( activiti event type entity initialized ) ; event = ( activiti entity event ) listener get events received ( ) get ( 2 ) ; assert that ( event get type ( ) ) is equal to ( activiti event type task created ) ; listener clear events received ( ) ; / / update task task service set owner ( task get id ( ) , " owner " ) ; assert that ( listener get events received ( ) ) has size ( 1 ) ; event = ( activiti entity event ) listener get events received ( ) get ( 0 ) ; assert that ( event get type ( ) ) is equal to ( activiti event type entity updated ) ; assert that ( event get entity ( ) ) is instance of ( task class ) ; task from event = ( task ) event get entity ( ) ; assert that ( task from event get id ( ) ) is equal to ( task get id ( ) ) ; assert that ( task from event get owner ( ) ) is equal to ( " owner " ) ; assert that ( event get process definition id ( ) ) is null ( ) ; assert that ( event get process instance id ( ) ) is null ( ) ; assert that ( event get execution id ( ) ) is null ( ) ; listener clear events received ( ) ; / / assign task task service set assignee ( task get id ( ) , " kermit " ) ; assert that ( listener get events received ( ) ) has size ( 2 ) ; event = ( activiti entity event ) listener get events received ( ) get ( 0 ) ; assert that ( event get type ( ) ) is equal to ( activiti event type task assigned ) ; assert that ( event get entity ( ) ) is instance of ( task class ) ; task from event = ( task ) event get entity ( ) ; assert that ( task from event get id ( ) ) is equal to ( task get id ( ) ) ; assert that ( task from event get assignee ( ) ) is equal to ( " kermit " ) ; assert that ( event get process definition id ( ) ) is null ( ) ; assert that ( event get process instance id ( ) ) is null ( ) ; assert that ( event get execution id ( ) ) is null ( ) ; event = ( activiti entity event ) listener get events received ( ) get ( 1 ) ; assert that ( event get type ( ) ) is equal to ( activiti event type entity updated ) ; assert that ( event get entity ( ) ) is instance of ( task class ) ; task from event = ( task ) event get entity ( ) ; assert that ( task from event get id ( ) ) is equal to ( task get id ( ) ) ; assert that ( event get process definition id ( ) ) is null ( ) ; assert that ( event get process instance id ( ) ) is null ( ) ; assert that ( event get execution id ( ) ) is null ( ) ; listener clear events received ( ) ; / / complete task task service complete ( task get id ( ) ) ; assert that ( listener get events received ( ) ) has size ( 2 ) ; event = ( activiti entity event ) listener get events received ( ) get ( 0 ) ; assert that ( event get type ( ) ) is equal to ( activiti event type task completed ) ; assert that ( event get entity ( ) ) is instance of ( task class ) ; task from event = ( task ) event get entity ( ) ; assert that ( task from event get id ( ) ) is equal to ( task get id ( ) ) ; assert that ( event get process definition id ( ) ) is null ( ) ; assert that ( event get process instance id ( ) ) is null ( ) ; assert that ( event get execution id ( ) ) is null ( ) ; event = ( activiti entity event ) listener get events received ( ) get ( 1 ) ; assert that ( event get type ( ) ) is equal to ( activiti event type entity deleted ) ; assert that ( event get entity ( ) ) is instance of ( task class ) ; task from event = ( task ) event get entity ( ) ; assert that ( task from event get id ( ) ) is equal to ( task get id ( ) ) ; assert that ( event get process definition id ( ) ) is null ( ) ; assert that ( event get process instance id ( ) ) is null ( ) ; assert that ( event get execution id ( ) ) is null ( ) ; } finally { if ( task ! = null ) { string task id = task get id ( ) ; task = task service create task query ( ) task id ( task id ) single result ( ) ; if ( task ! = null ) { / / if task still exists , delete it to have a clean db after / / test task service delete task ( task id ) ; } history service delete historic task instance ( task id ) ; } } }


add a { @ link sequence } into this aggregate this should only be used during initialisation use { @ link sequence group # add while running ( cursored , sequence ) }

public void add ( final sequence sequence ) { sequence [ ] old sequences ; sequence [ ] new sequences ; do { old sequences = sequences ; final int old size = old sequences length ; new sequences = new sequence [ old size + 1 ] ; system arraycopy ( old sequences , 0 , new sequences , 0 , old size ) ; new sequences [ old size ] = sequence ; } while ( ! sequence updater compare and set ( this , old sequences , new sequences ) ) ; }


public final void set identity ( ) { p set zero ( ) ; q set identity ( ) ; }


convert backslash - escaped comma - delimited string into string array as described in src - cdp spec section 5 2 1 2 , these strings are comma - delimited , but commas can be escaped with a backslash " \ " backslashes can also be escaped as a double - backslash

public static string [ ] parse c s v ( string input ) { list < string > output = new array list < > ( ) ; string buffer sb = new string buffer ( ) ; for ( int i = 0 ; i < input length ( ) ; i + + ) { char c = input char at ( i ) ; switch ( c ) { case ' , ' : output add ( sb to string ( ) ) ; sb = new string buffer ( ) ; continue ; case ' \ \ ' : i + + ; c = input char at ( i ) ; / / fall through to : default : sb append ( c ) ; } } output add ( sb to string ( ) ) ; return output to array ( new string [ output size ( ) ] ) ; }


public void set override paint ( paint paint ) { this override paint = paint ; graphics set paint ( paint ! = null ? paint : this paint ) ; }


default string get name ( ) { return this get class ( ) get simple name ( ) ; }


order by duedate ( needs to be followed by { @ link # asc ( ) } or { @ link # desc ( ) } )

dead letter job query order by job duedate ( ) ;


public void visit any target info ( clazz clazz , type annotation type annotation , target info target info ) { throw new unsupported operation exception ( " method must be overridden in [ " + this get class ( ) get name ( ) + " ] if ever called " ) ; }


check that at least one shard is on the set of nodes if they are all unallocated , we do not want to make any prediction to not hit the wrong policy

private boolean data stream allocated to nodes ( list < index metadata > indices ) { for ( int i = 0 ; i < indices size ( ) ; + + i ) { index metadata index metadata = indices get ( indices size ( ) - i - 1 ) ; set < boolean > in nodes = state get routing table ( ) all shards ( index metadata get index ( ) get name ( ) ) stream ( ) map ( shard routing : : current node id ) filter ( objects : : non null ) map ( node ids : : contains ) collect ( collectors to set ( ) ) ; if ( in nodes contains ( false ) ) { return false ; } if ( in nodes contains ( true ) ) { return true ; } } return false ; }


set the fallback protocol negotiator pass null to unset a previously set value

public xds channel builder fallback protocol negotiator ( internal protocol negotiator protocol negotiator fallback protocol negotiator ) { this fallback protocol negotiator = fallback protocol negotiator ; return this ; }


sets a new { @ link asset loader } for the given type

public synchronized < t , p extends asset loader parameters < t > > void set loader ( class < t > type , string suffix , asset loader < t , p > loader ) { if ( type = = null ) throw new illegal argument exception ( " type cannot be null " ) ; if ( loader = = null ) throw new illegal argument exception ( " loader cannot be null " ) ; log debug ( " loader set : " + class reflection get simple name ( type ) + " - > " + class reflection get simple name ( loader get class ( ) ) ) ; object map < string , asset loader > loaders = this loaders get ( type ) ; if ( loaders = = null ) this loaders put ( type , loaders = new object map < string , asset loader > ( ) ) ; loaders put ( suffix = = null ? " " : suffix , loader ) ; }


public void allow snapshot ( string snapshot root ) throws i o exception { check open ( ) ; try ( trace scope ignored = tracer new scope ( " allow snapshot " ) ) { namenode allow snapshot ( snapshot root ) ; } catch ( remote exception re ) { throw re unwrap remote exception ( ) ; } }


public static string get u s week ( final date date ) { return new simple date format ( " eeee " , locale us ) format ( date ) ; }


public static @ non null caffeine spec parse ( @ non null string specification ) { caffeine spec spec = new caffeine spec ( specification ) ; for ( string option : specification split ( split options ) ) { spec parse option ( option trim ( ) ) ; } return spec ; }


public void capital camel test ( ) { / / todo : test capital camel }


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

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


check that the root of the nested tree we are going to use , has valid layout directions with its main tree holder node

static boolean has valid layout direction in nested tree ( internal node holder , internal node nested tree ) { return nested tree is layout direction inherit ( ) | | ( nested tree get resolved layout direction ( ) = = holder get resolved layout direction ( ) ) ; }


set a single value for the specified http parameter if there are already one or more values registered for the given parameter name , they will be replaced

public void set parameter ( string name , string value ) { set parameter ( name , new string [ ] { value } ) ; }


configure the { @ link exchange strategies } to use for most cases , prefer using { @ link # codecs ( consumer ) } which allows customizing the codecs in the { @ code exchange strategies } rather than replace them that ensures multiple parties can contribute to codecs configuration by default this is set to { @ link exchange strategies # with defaults ( ) }

builder exchange strategies ( exchange strategies strategies ) ;


gets the system properties of the jvm on this computer if this is the master , it returns the system property of the master computer

public map < object , object > get system properties ( ) throws i o exception , interrupted exception { return remoting diagnostics get system properties ( get channel ( ) ) ; }


create a new sequence number from xml sax tree element

public static sequence number read x m l ( xml pull parser parser , address factory factory ) { xml element el = parser start ( " seqnum " ) ; string attrstring = el get attribute ( " uniq " ) ; int uniq ; if ( attrstring ! = null ) uniq = spec xml utils decode int ( attrstring ) ; else uniq = - 1 ; / / should fill in with something from factory string space = el get attribute ( " space " ) ; address space spc = factory get address space ( space ) ; long offset = spec xml utils decode long ( el get attribute ( " offset " ) ) ; parser end ( el ) ; return new sequence number ( spc get address ( offset ) , uniq ) ; }


check that when dangling indices are discovered , then they can be listed via the rest api

public void test dangling indices can be listed ( ) throws exception { internal cluster ( ) set bootstrap master node index ( 1 ) ; internal cluster ( ) start nodes ( 3 , build settings ( 0 ) ) ; final dangling index details dangling index details = create dangling indices ( index name ) ; final string stopped node id = map node name to id ( dangling index details stopped node name ) ; final rest client rest client = get rest client ( ) ; final response list response = rest client perform request ( new request ( " get " , " / dangling " ) ) ; assert o k ( list response ) ; final x content test utils json map view map view = create json map view ( list response get entity ( ) get content ( ) ) ; assert that ( map view get ( " nodes total " ) , equal to ( 3 ) ) ; assert that ( map view get ( " nodes successful " ) , equal to ( 3 ) ) ; assert that ( map view get ( " nodes failed " ) , equal to ( 0 ) ) ; list < object > indices = map view get ( " dangling indices " ) ; assert that ( indices , has size ( 1 ) ) ; assert that ( map view get ( " dangling indices 0 index name " ) , equal to ( index name ) ) ; assert that ( map view get ( " dangling indices 0 index uuid " ) , equal to ( dangling index details index to u u i d get ( index name ) ) ) ; assert that ( map view get ( " dangling indices 0 creation date millis " ) , instance of ( long class ) ) ; assert that ( map view get ( " dangling indices 0 node ids 0 " ) , equal to ( stopped node id ) ) ; }


resets variables maintaining the sum to zero this method may be a useful alternative to creating a new adder , but is only effective if there are no concurrent updates because this method is intrinsically racy , it should only be used when it is known that no threads are concurrently updating

public void reset ( ) { internal reset ( 0l ) ; }


return true if this order object is equal to o

public boolean equals ( object o ) { if ( this = = o ) { return true ; } if ( o = = null | | get class ( ) ! = o get class ( ) ) { return false ; } order order = ( order ) o ; return objects equals ( this id , order id ) & & objects equals ( this pet id , order pet id ) & & objects equals ( this quantity , order quantity ) & & objects equals ( this ship date , order ship date ) & & objects equals ( this status , order status ) & & objects equals ( this complete , order complete ) ; }


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


public int get socket write timeout ( ) { return socket write timeout ; }


returns an input stream starting at offset into the byte provider note : do not use this method if you have called set data ( )

public input stream get data stream ( ) throws i o exception { if ( reader = = null ) { throw new unsupported operation exception ( " this elf section header does not have a reader " ) ; } return reader get byte provider ( ) get input stream ( sh offset ) ; }


public static starlark int xor ( starlark int x , starlark int y ) { try { long xl = x to long fast ( ) ; long yl = y to long fast ( ) ; return starlark int of ( xl ^ yl ) ; } catch ( overflow unused ) { / * fall through * / } big integer xbig = x to big integer ( ) ; big integer ybig = y to big integer ( ) ; big integer zbig = xbig xor ( ybig ) ; return starlark int of ( zbig ) ; }


set a { @ link multi tenant connection provider } to be passed on to the session factory

public local session factory builder set multi tenant connection provider ( multi tenant connection provider multi tenant connection provider ) { get properties ( ) put ( available settings multi tenant connection provider , multi tenant connection provider ) ; return this ; }


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 ; }


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

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


decsc save cursor - http : www vt 1 0 0 netdocsvt 5 1 0 - rm d e c s c see { @ link # restore cursor ( ) }

private void save cursor ( ) { saved screen state state = ( m screen = = m main buffer ) ? m saved state main : m saved state alt ; state m saved cursor row = m cursor row ; state m saved cursor col = m cursor col ; state m saved effect = m effect ; state m saved fore color = m fore color ; state m saved back color = m back color ; state m saved dec flags = m current dec set flags ; state m use line drawing g 0 = m use line drawing g 0 ; state m use line drawing g 1 = m use line drawing g 1 ; state m use line drawing uses g 0 = m use line drawing uses g 0 ; }


allows to iterate over all currently active streams this method may only be called from the eventloop thread

protected final void for each active stream ( http 2 frame stream visitor stream visitor ) throws http 2 exception { frame codec for each active stream ( stream visitor ) ; }


specifies whether query parsing should be lenient defaults to false

public simple query string builder lenient ( boolean lenient ) { this settings lenient ( lenient ) ; this lenient set = true ; return this ; }


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


provided a pool , this will initialize it with view counts that make sense

static void initialize pool ( @ non null recycler view recycled view pool pool ) { pool set max recycled views ( message type incoming text , 15 ) ; pool set max recycled views ( message type incoming multimedia , 15 ) ; pool set max recycled views ( message type outgoing text , 15 ) ; pool set max recycled views ( message type outgoing multimedia , 15 ) ; pool set max recycled views ( message type placeholder , 15 ) ; pool set max recycled views ( message type header , 1 ) ; pool set max recycled views ( message type footer , 1 ) ; pool set max recycled views ( message type update , 5 ) ; }


reports a progress update to the spawn strategy

void report ( progress status state , string name ) ;


tests the file length when we sync the file and restart the cluster and datanodes not report to namenode yet

public void test file length with h sync and cluster restart with out d ns register ( ) throws exception { final configuration conf = new hdfs configuration ( ) ; / / create cluster conf set int ( d f s config keys dfs block size key , 512 ) ; final mini d f s cluster cluster = new mini d f s cluster builder ( conf ) num data nodes ( 2 ) build ( ) ; hdfs data input stream in = null ; try { path path = new path ( " / tmp / test file length on cluster restart " , " test " ) ; distributed file system dfs = cluster get file system ( ) ; f s data output stream out = dfs create ( path ) ; int file length = 1030 ; out write ( new byte [ file length ] ) ; out hsync ( ) ; cluster restart name node ( ) ; cluster wait active ( ) ; in = ( hdfs data input stream ) dfs open ( path , 1024 ) ; / / verify the length when we just restart nn d ns will register / / immediately assert assert equals ( file length , in get visible length ( ) ) ; cluster shutdown data nodes ( ) ; cluster restart name node ( false ) ; / / this is just for ensuring nn started verify n n is in safe mode ( dfs ) ; try { in = ( hdfs data input stream ) dfs open ( path ) ; assert fail ( " expected i o exception " ) ; } catch ( i o exception e ) { assert assert true ( e get localized message ( ) index of ( " name node is in safe mode " ) > = 0 ) ; } } finally { if ( null ! = in ) { in close ( ) ; } cluster shutdown ( ) ; } }


get the value of the ' { @ code disabled } ' attribute

protected boolean is disabled ( ) { return this disabled ; }


public string get ftp proxy ( ) { return ftp proxy ; }


returns a new { @ link class name } instance for the specified { @ code name } as nested inside this class

public class name nested class ( string name ) { return new class name ( package name , this , name ) ; }


sets the model ' s current selection to the indicated selection if the selection is empty , it gets adjusted to the empty last line

public void set selection ( field selection selection ) { if ( updating selection ) { return ; } if ( this selection equals ( selection ) ) { return ; } end field editing ( ) ; this selection clear ( ) ; int num ranges = selection get num ranges ( ) ; for ( int i = 0 ; i < num ranges ; i + + ) { field range range = selection get field range ( i ) ; this selection add range ( range get start ( ) get index ( ) int value ( ) , range get end ( ) get index ( ) int value ( ) ) ; } fix selection ( ) ; adjust current row ( ) ; selection changed ( ) ; }


sets { @ link { @ link collector component builder # sampler ( collector sampler ) } }

public builder sampler ( collector sampler sampler ) { if ( sampler = = null ) throw new null pointer exception ( " sampler = = null " ) ; this sampler = sampler ; return this ; }


returns the spec in this set that ' s currently associated with a given local ( name and signature ) , or { @ code null } if there is none

public register spec local item to spec ( local item local ) { int length = specs length ; for ( int reg = 0 ; reg < length ; reg + + ) { register spec spec = specs [ reg ] ; if ( ( spec ! = null ) & & local equals ( spec get local item ( ) ) ) { return spec ; } } return null ; }


adds a painter that will be called when this pane ' s { @ link # paint component ( graphics ) } method is called

public void add painter ( g glass pane painter painter ) { painters add ( painter ) ; repaint ( ) ; }


bind the configuration ' s { @ code assumed role policy } option to the given policy

public static configuration bind role policy ( final configuration conf , final policy policy ) throws json processing exception { string p = model to json ( policy ) ; log info ( " setting role policy to policy of size { } : \ n { } " , p length ( ) , p ) ; conf set ( assumed role policy , p ) ; return conf ; }


void test stable serialization ( ) throws exception { for ( t subject : subjects ) { byte [ ] serialized = to bytes ( subject ) ; t deserialized = from bytes ( serialized ) ; byte [ ] reserialized = to bytes ( deserialized ) ; assert that ( reserialized ) is equal to ( serialized ) ; } }


read the length of the next serialized { @ code string value }

private static int read string length ( data input view source ) throws i o exception { int len = source read byte ( ) & 0x f f ; if ( len > = high bit ) { int shift = 7 ; int curr ; len = len & 0x 7 f ; while ( ( curr = source read byte ( ) & 0x f f ) > = high bit ) { len | = ( curr & 0x 7 f ) < < shift ; shift + = 7 ; } len | = curr < < shift ; } return len ; }


auto - discovers { @ link option handler } s and add them to the given command line parser

protected void register option handlers ( ) { try { for ( class c : index list ( option handler extension class , jenkins get ( ) plugin manager uber class loader , class class ) ) { type t = types get base class ( c , option handler class ) ; cmd line parser register handler ( types erasure ( types get type argument ( t , 0 ) ) , c ) ; } } catch ( i o exception e ) { throw new error ( e ) ; } }


verifies that inter - broker listener with validation of truststore against keystore works with configs including mutual authentication and hostname verification

public void test inter broker ssl config validation ( args args ) throws exception { security protocol security protocol = security protocol ssl ; args ssl server configs put ( broker security configs ssl client auth config , " required " ) ; args ssl server configs put ( ssl configs ssl endpoint identification algorithm config , " https " ) ; args ssl server configs put all ( args server cert stores key store props ( ) ) ; args ssl server configs put all ( args server cert stores trust store props ( ) ) ; args ssl client configs put all ( args server cert stores key store props ( ) ) ; args ssl client configs put all ( args server cert stores trust store props ( ) ) ; test security config config = new test security config ( args ssl server configs ) ; listener name listener name = listener name for security protocol ( security protocol ) ; channel builder server channel builder = channel builders server channel builder ( listener name , true , security protocol , config , null , null , time , new log context ( ) ) ; server = new nio echo server ( listener name , security protocol , config , " localhost " , server channel builder , null , time ) ; server start ( ) ; this selector = create selector ( args ssl client configs , null , null , null ) ; inet socket address addr = new inet socket address ( " localhost " , server port ( ) ) ; selector connect ( " 0 " , addr , buffer size , buffer size ) ; network test utils check client connection ( selector , " 0 " , 100 , 10 ) ; }


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

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


customize the list of client - side http message readers and writers

builder codecs ( consumer < client codec configurer > consumer ) ;


void set successful aspects ( immutable set < aspect key > successful aspects ) { this successful aspects = successful aspects ; }


async http put from create a new resource by p u tting the given map { @ code body values } to http request , http header content type default ' applicationx - www - form - urlencoded ; charset = utf - 8 ' { @ code response type } can be an rest result or rest result data { @ code t } type { @ code callback } result callback execution , if you need response headers , you can convert the received rest result to http rest result

public < t > void put form ( string url , header header , map < string , string > body values , type response type , callback < t > callback ) { execute ( url , http method put , new request http entity ( header set content type ( media type application form urlencoded ) , body values ) , response type , callback ) ; }


crypt given byte array be aware , that you must init key , before using

private byte [ ] crypt ( final byte [ ] message ) { s box = init s box ( key ) ; byte [ ] result = new byte [ message length ] ; int i = 0 ; int j = 0 ; for ( int n = 0 ; n < message length ; n + + ) { i = ( i + 1 ) % sbox length ; j = ( j + s box [ i ] ) % sbox length ; swap ( i , j , s box ) ; int rand = s box [ ( s box [ i ] + s box [ j ] ) % sbox length ] ; result [ n ] = ( byte ) ( rand ^ message [ n ] ) ; } return result ; }


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

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


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

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


tests that the java port of farm hash fingerprint 6 4 provides the same results on buffers up to 800 bytes long as the c + + reference implementation

public void test multiple lengths ( ) { int iterations = 800 ; byte [ ] buf = new byte [ iterations * 4 ] ; int buf len = 0 ; long h = 0 ; for ( int i = 0 ; i < iterations ; + + i ) { h ^ = fingerprint ( buf , i ) ; h = remix ( h ) ; buf [ buf len + + ] = get char ( h ) ; h ^ = fingerprint ( buf , i * i % buf len ) ; h = remix ( h ) ; buf [ buf len + + ] = get char ( h ) ; h ^ = fingerprint ( buf , i * i * i % buf len ) ; h = remix ( h ) ; buf [ buf len + + ] = get char ( h ) ; h ^ = fingerprint ( buf , buf len ) ; h = remix ( h ) ; buf [ buf len + + ] = get char ( h ) ; int x 0 = buf [ buf len - 1 ] & 0xff ; int x 1 = buf [ buf len - 2 ] & 0xff ; int x 2 = buf [ buf len - 3 ] & 0xff ; int x 3 = buf [ buf len / 2 ] & 0xff ; buf [ ( ( x 0 < < 16 ) + ( x 1 < < 8 ) + x 2 ) % buf len ] ^ = x 3 ; buf [ ( ( x 1 < < 16 ) + ( x 2 < < 8 ) + x 3 ) % buf len ] ^ = i % 256 ; } assert equals ( 0x 7a 1d 6 7c 5 0ec 7e 1 6 7 l , h ) ; }


like { @ link # get output artifacts ( ) } but for a singular output item reports an error if the " out " attribute is not a singleton

public artifact get output artifact ( ) { list < artifact > outs = get output artifacts ( ) ; if ( outs size ( ) ! = 1 ) { attribute error ( " out " , " exactly one output file required " ) ; if ( outs is empty ( ) ) { return null ; } } return outs get ( 0 ) ; }


checks the user exists with the given password

void assert user ( string username , string password ) throws i o exception { list < string > lines = files read all lines ( conf dir resolve ( " users " ) , standard charsets utf 8 ) ; for ( string line : lines ) { string [ ] username hash = line split ( " : " , 2 ) ; if ( username hash length ! = 2 ) { fail ( " corrupted users file , line : " + line ) ; } if ( username equals ( username hash [ 0 ] ) = = false ) { continue ; } string got hash = username hash [ 1 ] ; secure string expected hash = new secure string ( password to char array ( ) ) ; assert true ( " could not validate password for user " , hasher verify ( expected hash , got hash to char array ( ) ) ) ; return ; } fail ( " could not find username " + username + " in users file : \ n " + lines to string ( ) ) ; }


set the { @ linkplain media type media type } of the body , as specified by the { @ code content - type } header

body builder content type ( media type content type ) ;


adds the contents of a directory to the jar file all files below this directory will be added to the jar file using the name relative to the directory as the name for the jar entry

public void add directory ( path directory ) { if ( ! files exists ( directory ) ) { throw new illegal argument exception ( " directory does not exist : " + directory ) ; } try { files walk file tree ( directory , new simple file visitor < path > ( ) { @ override public file visit result pre visit directory ( path path , basic file attributes attrs ) throws i o exception { if ( ! path equals ( directory ) ) { / / for consistency with legacy behaviour , include entries for directories except for / / the root add entry ( path , / * is directory = * / true ) ; } return file visit result continue ; } @ override public file visit result visit file ( path path , basic file attributes attrs ) throws i o exception { add entry ( path , / * is directory = * / false ) ; return file visit result continue ; } void add entry ( path path , boolean is directory ) { string builder sb = new string builder ( ) ; boolean first = true ; for ( path entry : directory relativize ( path ) ) { if ( ! first ) { / / use ` / ` as the directory separator for jar paths , even on windows sb append ( ' / ' ) ; } sb append ( entry get file name ( ) ) ; first = false ; } if ( is directory ) { sb append ( ' / ' ) ; } jar entries put ( sb to string ( ) , path ) ; } } ) ; } catch ( i o exception e ) { throw new unchecked i o exception ( e ) ; } }


computes and caches any information needed for drawing and , if this actor has children , positions and sizes each child , calls { @ link # invalidate ( ) } on any each child whose width or height has changed , and calls { @ link # validate ( ) } on each child this method should almost never be called directly , instead { @ link # validate ( ) } should be used


calculate the size of the given { @ link object } this implementation supports { @ link byte buf } , { @ link byte buf holder } and { @ link file region } sub - classes may override this

protected long calculate size ( object msg ) { if ( msg instanceof byte buf ) { return ( ( byte buf ) msg ) readable bytes ( ) ; } if ( msg instanceof byte buf holder ) { return ( ( byte buf holder ) msg ) content ( ) readable bytes ( ) ; } if ( msg instanceof file region ) { return ( ( file region ) msg ) count ( ) ; } return - 1 ; }


enqueue the job to be submitted per the deadline associated with it

public void add ( final gridmix job job ) throws interrupted exception { final boolean add to queue = ! shutdown ; if ( add to queue ) { final submit task task = new submit task ( job ) ; log info ( " total number of queued jobs : " + ( queue depth - sem available permits ( ) ) ) ; sem acquire ( ) ; try { sched execute ( task ) ; } catch ( rejected execution exception e ) { sem release ( ) ; } } }


public int run ( arguments arguments ) throws i o exception { / / reset the error count to start fresh errors set ( 0 ) ; / / empty the list , so that tools that load dx and keep it around / / for multiple runs don ' t reuse older buffers library dex buffers clear ( ) ; args = arguments ; args make options objects ( ) ; output stream human out raw = null ; if ( args human out name ! = null ) { human out raw = open output ( args human out name ) ; human out writer = new output stream writer ( human out raw ) ; } try { if ( args multi dex ) { return run multi dex ( ) ; } else { return run mono dex ( ) ; } } finally { close output ( human out raw ) ; } }


public void capital camel test ( ) { / / todo : test capital camel }


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


returns pet inventories by status returns a map of status codes to quantities < b > 200 < b > - successful operation

public response entity < map < string , integer > > get inventory with http info ( ) throws rest client exception { object post body = null ; string path = api client expand path ( " / store / inventory " , collections < string , object > empty map ( ) ) ; final multi value map < string , string > query params = new linked multi value map < string , string > ( ) ; final http headers header params = new http headers ( ) ; final multi value map < string , string > cookie params = new linked multi value map < string , string > ( ) ; final multi value map < string , object > form params = new linked multi value map < string , object > ( ) ; final string [ ] local var accepts = { " application / json " } ; final list < media type > local var accept = api client select header accept ( local var accepts ) ; final string [ ] content types = { } ; final media type content type = api client select header content type ( content types ) ; string [ ] auth names = new string [ ] { " api key " } ; parameterized type reference < map < string , integer > > return type = new parameterized type reference < map < string , integer > > ( ) { } ; return api client invoke a p i ( path , http method get , query params , post body , header params , cookie params , form params , local var accept , content type , auth names , return type ) ; }


same as resizable queue test , but in reverse

public void resizable deque test ( ) { final queue < integer > q = new queue < integer > ( 8 ) ; assert true ( " new deque is not empty ! " , q size = = 0 ) ; for ( int i = 0 ; i < 100 ; i + + ) { for ( int j = 0 ; j < i ; j + + ) { try { q add first ( j ) ; } catch ( illegal state exception e ) { fail ( " failed to add element " + j + " ( " + i + " ) " ) ; } final integer peeked = q first ( ) ; assert true ( " peek shows " + peeked + " , should be " + j + " ( " + i + " ) " , peeked equals ( j ) ) ; final int size = q size ; assert true ( " size should be " + ( j + 1 ) + " but is " + size + " ( " + i + " ) " , size = = j + 1 ) ; } if ( i ! = 0 ) { final integer peek = q last ( ) ; assert true ( " last thing is not zero but " + peek + " ( " + i + " ) " , peek = = 0 ) ; } for ( int j = 0 ; j < i ; j + + ) { final integer pop = q remove last ( ) ; assert true ( " popped should be " + j + " but is " + pop + " ( " + i + " ) " , pop = = j ) ; final int size = q size ; assert true ( " size should be " + ( i - 1 - j ) + " but is " + size + " ( " + i + " ) " , size = = i - 1 - j ) ; } assert true ( " not empty after cycle " + i , q size = = 0 ) ; } for ( int i = 0 ; i < 56 ; i + + ) { q add first ( 42 ) ; } q clear ( ) ; assert true ( " clear did not clear properly " , q size = = 0 ) ; }


returns the quotient of the given specific float value and this float value

public float value divide of ( specific float value other ) { return divide of ( ( float value ) other ) ; }


notification the a data type has changed

public void data type changed ( long data type i d , int type , object old value , object new value ) { if ( record changes ) { ( ( data type archive d b change set ) change set ) data type changed ( data type i d ) ; } changed = true ; fire event ( new program change record ( type , null , null , null , old value , new value ) ) ; }


this optional operation is not yet supported

public f s data output stream append ( path f , int buffer size , progressable progress ) throws i o exception { throw new unsupported operation exception ( " append is not supported " + " by f t p file system " ) ; }


returns a buffered stream for reading this file as bytes @ throw gdx runtime exception if the file handle represents a directory , doesn ' t exist , or could not be read

public buffered input stream read ( int buffer size ) { return new buffered input stream ( read ( ) , buffer size ) ; }


public int get register count ( ) { return 0 ; }


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


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

default response entity < void > create user ( @ api param ( value = " created user object " , required = true ) @ valid @ request body user body ) { return new response entity < > ( http status not implemented ) ; }


retrieve list of { @ link com facebook litho annotations on bind dynamic value } methods this method is a not included into { @ link com facebook litho annotations mount spec } interface , since only { @ link com facebook litho annotations mount spec } s may declare such methods for now this method is present here , because { @ link spec model impl } needs to be aware of these methods to extract { @ link com facebook litho annotations prop } s from them

public immutable list < spec method model < bind dynamic value method , void > > get bind dynamic value methods ( ) { return m bind dynamic value methods ; }


finds pets by tags multiple tags can be provided with comma separated strings use tag 1 , tag 2 , tag 3 for testing

completion stage < response < set < pet > > > find pets by tags ( @ retrofit 2 http query ( " tags " ) c s v params tags ) ;


testing transactions since last checkpoint need a new cluster as the other tests in here don ' t use ha see hdfs - 7501

public void test transaction since last checkpoint metrics ( ) throws exception { random random = new random ( ) ; int retry count = 0 ; while ( retry count < 5 ) { try { int base port = 10060 + random next int ( 100 ) * 2 ; mini d f s n n topology topology = new mini d f s n n topology ( ) add nameservice ( new mini d f s n n topology n s conf ( " ns 1 " ) add n n ( new mini d f s n n topology n n conf ( " nn 1 " ) set http port ( base port ) ) add n n ( new mini d f s n n topology n n conf ( " nn 2 " ) set http port ( base port + 1 ) ) ) ; hdfs configuration conf 2 = new hdfs configuration ( ) ; / / lower the checkpoint condition for purpose of testing conf 2 set int ( d f s config keys dfs namenode checkpoint txns key , 100 ) ; / / check for checkpoint condition very often , for purpose of testing conf 2 set int ( d f s config keys dfs namenode checkpoint check period key , 1 ) ; / / poll and follow ann txns very often , for purpose of testing conf 2 set int ( d f s config keys dfs ha tailedits period key , 1 ) ; mini d f s cluster cluster 2 = new mini d f s cluster builder ( conf 2 ) nn topology ( topology ) num data nodes ( 1 ) build ( ) ; cluster 2 wait active ( ) ; distributed file system fs 2 = cluster 2 get file system ( 0 ) ; name node nn 0 = cluster 2 get name node ( 0 ) ; name node nn 1 = cluster 2 get name node ( 1 ) ; cluster 2 transition to active ( 0 ) ; fs 2 mkdirs ( new path ( " / tmp - t 1 " ) ) ; fs 2 mkdirs ( new path ( " / tmp - t 2 " ) ) ; h a test util wait for standby to catch up ( nn 0 , nn 1 ) ; / / test to ensure tracking works before the first - ever / / checkpoint assert equals ( " sbn failed to track 2 transactions pre - checkpoint " , 4l , / / 2 txns added further when catch - up is called cluster 2 get name node ( 1 ) get namesystem ( ) get transactions since last checkpoint ( ) ) ; / / complete up to the boundary required for / / an auto - checkpoint using 94 to expect fsimage / / rounded at 100 , as 4 + 94 + 2 ( catch - up call ) = 100 for ( int i = 1 ; i < = 94 ; i + + ) { fs 2 mkdirs ( new path ( " / tmp - " + i ) ) ; } h a test util wait for standby to catch up ( nn 0 , nn 1 ) ; / / assert 100 transactions in checkpoint h a test util wait for checkpoint ( cluster 2 , 1 , immutable list of ( 100 ) ) ; / / test to ensure number tracks the right state of / / uncheckpointed edits , and does not go negative / / ( as fixed in hdfs - 7501 ) assert equals ( " should be zero right after the checkpoint " , 0l , cluster 2 get name node ( 1 ) get namesystem ( ) get transactions since last checkpoint ( ) ) ; fs 2 mkdirs ( new path ( " / tmp - t 3 " ) ) ; fs 2 mkdirs ( new path ( " / tmp - t 4 " ) ) ; h a test util wait for standby to catch up ( nn 0 , nn 1 ) ; / / test to ensure we track the right numbers after / / the checkpoint resets it to zero again assert equals ( " sbn failed to track 2 added txns after the ckpt " , 4l , cluster 2 get name node ( 1 ) get namesystem ( ) get transactions since last checkpoint ( ) ) ; cluster 2 shutdown ( ) ; break ; } catch ( exception e ) { log warn ( " unable to set up ha cluster , exception thrown : " + e ) ; retry count + + ; } } }


{ @ linkplan # call count count of calls } known to be errors ( having one { @ linkplain span # tags ( ) tag } named " error " )

public long error count ( ) { return error count ; }


public static sky key key ( ) { return key create ( repository name main ) ; }


create ticket registry bean with all necessary caches using the spring ehcache wrapper bean so it can be initialized after the caches are built

public ticket registry ticket registry ( @ qualifier ( " eh cache cache manager " ) final eh cache cache manager manager , @ qualifier ( " ticket catalog " ) final ticket catalog ticket catalog ) { val eh cache manager = objects require non null ( manager get cache manager ( ) ) ; val crypto = cas properties get ticket ( ) get registry ( ) get ehcache ( ) get crypto ( ) ; val definitions = ticket catalog find all ( ) ; definitions for each ( t - > { val ehcache = build cache ( t ) ; if ( logger is debug enabled ( ) ) { logger debug ( " created ehcache cache [ { } ] for [ { } ] " , ehcache get name ( ) , t ) ; val config = ehcache get cache configuration ( ) ; logger debug ( " [ { } ] max entries local heap = [ { } ] " , ehcache get name ( ) , config get max entries local heap ( ) ) ; logger debug ( " [ { } ] max entries local disk = [ { } ] " , ehcache get name ( ) , config get max entries local disk ( ) ) ; logger debug ( " [ { } ] max entries in cache = [ { } ] " , ehcache get name ( ) , config get max entries in cache ( ) ) ; logger debug ( " [ { } ] persistence configuration = [ { } ] " , ehcache get name ( ) , config get persistence configuration ( ) get strategy ( ) ) ; logger debug ( " [ { } ] synchronous writes = [ { } ] " , ehcache get name ( ) , config get persistence configuration ( ) get synchronous writes ( ) ) ; logger debug ( " [ { } ] time to live = [ { } ] " , ehcache get name ( ) , config get time to live seconds ( ) ) ; logger debug ( " [ { } ] time to idle = [ { } ] " , ehcache get name ( ) , config get time to idle seconds ( ) ) ; logger debug ( " [ { } ] cache manager = [ { } ] " , ehcache get name ( ) , ehcache get cache manager ( ) get name ( ) ) ; } eh cache manager add decorated cache if absent ( ehcache ) ; } ) ; manager initialize caches ( ) ; logger debug ( " the following caches are available : [ { } ] " , manager get cache names ( ) ) ; return new eh cache ticket registry ( ticket catalog , eh cache manager , core ticket utils new ticket registry cipher executor ( crypto , " ehcache " ) ) ; }


trying to post to config xml by a different job type should fail

public void config dot xml submission to different type ( ) throws exception { test plugin manager tpm = ( test plugin manager ) j jenkins plugin manager ; tpm install detached plugin ( " structs " ) ; tpm install detached plugin ( " workflow - step - api " ) ; tpm install detached plugin ( " scm - api " ) ; tpm install detached plugin ( " workflow - api " ) ; tpm install detached plugin ( " junit " ) ; tpm install detached plugin ( " matrix - project " ) ; j jenkins set crumb issuer ( null ) ; free style project p = j create free style project ( ) ; http u r l connection con = post config dot xml ( p , " < matrix - project / > " ) ; / / this should fail with a type mismatch error / / the error message should report both what was submitted and what was expected assert equals ( 500 , con get response code ( ) ) ; string msg = i o utils to string ( con get error stream ( ) , standard charsets utf 8 ) ; system out println ( msg ) ; assert that ( msg , all of ( contains string ( free style project class get name ( ) ) , contains string ( matrix project class get name ( ) ) ) ) ; / / control this should work con = post config dot xml ( p , " < project / > " ) ; assert equals ( 200 , con get response code ( ) ) ; }


run the scm trigger with additional build actions used by subversion repository status to trigger a build at a specific revision number

public void run ( action [ ] additional actions ) { if ( job = = null ) { return ; } descriptor impl d = get descriptor ( ) ; logger fine ( " scheduling a polling for " + job ) ; if ( d synchronous polling ) { logger fine ( " running the trigger directly without threading , " + " as it ' s already taken care of by trigger cron " ) ; new runner ( additional actions ) run ( ) ; } else { / / schedule the polling / / even if we end up submitting this too many times , that ' s ok / / the real exclusion control happens inside runner logger fine ( " scheduling the trigger to ( asynchronously ) run " ) ; d queue execute ( new runner ( additional actions ) ) ; d clog check ( ) ; } }


patch fake : to test \ & quot ; client \ & quot ; model to test \ & quot ; client \ & quot ; model

default response entity < client > test client model ( @ api param ( value = " client model " , required = true ) @ valid @ request body client body ) { 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 = " { \ " client \ " : \ " client \ " } " ; api util set example response ( request , " application / json " , example string ) ; break ; } } } ) ; return new response entity < > ( http status not implemented ) ; }


check whether there are any batches which need to be drained now

public boolean needs drain ( long current time ms ) { return time until drain ( current time ms ) < = 0 ; }


public void resume ( ) { switch ( state ( ) ) { case created : case running : case restoring : / / no need to do anything , just let them continue running / restoring / closing log trace ( " skip resuming since state is { } " , state ( ) ) ; break ; case suspended : / / just transit the state without any logical changes : suspended and restoring states / / are not actually any different for inner modules / / deleting checkpoint file before transition to restoring state ( kafka - 10362 ) try { state mgr delete check point file if e o s enabled ( ) ; log debug ( " deleted check point file upon resuming with eos enabled " ) ; } catch ( final i o exception ioe ) { log error ( " encountered error while deleting the checkpoint file due to this exception " , ioe ) ; } transition to ( state restoring ) ; log info ( " resumed to restoring state " ) ; break ; case closed : throw new illegal state exception ( " illegal state " + state ( ) + " while resuming active task " + id ) ; default : throw new illegal state exception ( " unknown state " + state ( ) + " while resuming active task " + id ) ; } }


resumes downloads if the { @ link # set requirements ( requirements ) requirements } are met up to { @ link # get max parallel downloads ( ) max parallel downloads } will be started , excluding those with non - zero { @ link download # stop reason stop reasons }

public void resume downloads ( ) { set downloads paused ( / * downloads paused = * / false ) ; }


register the one ofany of descendants of the model class

public static void register descendants ( class < ? > model class , map < string , generic type > descendants ) { model descendants put ( model class , descendants ) ; }


randomly choose one node from scope if scope starts with ~ , choose one from the all nodes except for the ones in scope ; otherwise , choose one from scope if excluded nodes is given , choose a node that ' s not in excluded nodes

public node choose random ( final string scope , final collection < node > excluded nodes ) { netlock read lock ( ) lock ( ) ; try { if ( scope starts with ( " ~ " ) ) { return choose random ( node base root , scope substring ( 1 ) , excluded nodes ) ; } else { return choose random ( scope , null , excluded nodes ) ; } } finally { netlock read lock ( ) unlock ( ) ; } }


private void add volumes ( int num new volumes ) throws interrupted exception , i o exception , reconfiguration exception { add volumes ( num new volumes , new count down latch ( 0 ) ) ; }


tests that { @ link event sample stream # skip data ( long ) } will skip until the given position , and the next { @ link event sample stream # read data ( format holder , decoder input buffer , boolean ) } call will return sample data from that position

public void skip data then read data return data from skipped position ( ) { long presentation time us 1 = 1000000 ; long presentation time us 2 = 2000000 ; event message event message 1 = new event message with id ( 1 ) ; event message event message 2 = new event message with id ( 2 ) ; event stream event stream = new event stream ( scheme id , value , time scale , new long [ ] { presentation time us 1 , presentation time us 2 } , new event message [ ] { event message 1 , event message 2 } ) ; event sample stream sample stream = new event sample stream ( event stream , format , false ) ; / / first read - read format read data ( sample stream ) ; int skipped = sample stream skip data ( presentation time us 2 ) ; int result = read data ( sample stream ) ; assert that ( skipped ) is equal to ( 1 ) ; assert that ( result ) is equal to ( c result buffer read ) ; assert that ( input buffer data array ( ) ) is equal to ( get encoded message ( event message 2 ) ) ; }


creates a compressed url style representation of an inet 6 address this method copies and adopts code from google ' s guava library we re - implement this here in order to reduce dependency on guava the guava library has frequently caused dependency conflicts in the past

private static string get i pv 6 url representation ( byte [ ] address bytes ) { / / first , convert bytes to 16 bit chunks int [ ] hextets = new int [ 8 ] ; for ( int i = 0 ; i < hextets length ; i + + ) { hextets [ i ] = ( address bytes [ 2 * i ] & 0x f f ) < < 8 | ( address bytes [ 2 * i + 1 ] & 0x f f ) ; } / / now , find the sequence of zeros that should be compressed int best run start = - 1 ; int best run length = - 1 ; int run start = - 1 ; for ( int i = 0 ; i < hextets length + 1 ; i + + ) { if ( i < hextets length & & hextets [ i ] = = 0 ) { if ( run start < 0 ) { run start = i ; } } else if ( run start > = 0 ) { int run length = i - run start ; if ( run length > best run length ) { best run start = run start ; best run length = run length ; } run start = - 1 ; } } if ( best run length > = 2 ) { arrays fill ( hextets , best run start , best run start + best run length , - 1 ) ; } / / convert into text form string builder buf = new string builder ( 40 ) ; buf append ( ' [ ' ) ; boolean last was number = false ; for ( int i = 0 ; i < hextets length ; i + + ) { boolean this is number = hextets [ i ] > = 0 ; if ( this is number ) { if ( last was number ) { buf append ( ' : ' ) ; } buf append ( integer to hex string ( hextets [ i ] ) ) ; } else { if ( i = = 0 | | last was number ) { buf append ( " : : " ) ; } } last was number = this is number ; } buf append ( ' ] ' ) ; return buf to string ( ) ; }


gets the set of annotations contained in this instance the result is always unmodifiable

public collection < annotation > get annotations ( ) { return collections unmodifiable collection ( annotations values ( ) ) ; }