this method is called when a channel signals it is ready for be read all of the read logic should occur in this call

protected void handle read ( socket channel context context ) throws i o exception { context read ( ) ; }


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

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


randomly choose num of replicas targets from the given scope except that 1st replica prefer local storage

private node choose once ( int num of replicas , node writer , final set < node > excluded nodes , final long blocksize , final int max nodes per rack , final list < datanode storage info > results , final boolean avoid stale nodes , enum map < storage type , integer > storage types ) throws not enough replicas exception { if ( num of replicas = = 0 ) { return writer ; } writer = choose local storage ( writer , excluded nodes , blocksize , max nodes per rack , results , avoid stale nodes , storage types , true ) get datanode descriptor ( ) ; if ( - - num of replicas = = 0 ) { return writer ; } choose random ( num of replicas , node base root , excluded nodes , blocksize , max nodes per rack , results , avoid stale nodes , storage types ) ; return writer ; }


add a starved application if it is not already added

void add starved app ( f s app attempt app ) { if ( ! app equals ( app being processed ) & & ! apps to process contains ( app ) ) { apps to process add ( app ) ; } }


returns the number of { @ code zip entries } in this { @ code zip file }

public int size ( ) { check not closed ( ) ; return entries size ( ) ; }


public static void save ( tree t , list < string > rule names , string file name ) throws i o exception , print exception { write p s ( t , rule names , file name ) ; }


get the memory use for the indicated node returns null if not available ( new , fetching or failed )


return the socket addresses to use with each configured local interface local interfaces may be specified by ip address , ip address range using cidr notation , interface name ( e g eth 0 ) or sub - interface name ( e g eth 0 : 0 ) the socket addresses consist of the i ps for the interfaces and the ephemeral port ( port 0 ) if an ip , ip range , or interface name matches an interface with sub - interfaces only the ip of the interface is used sub - interfaces can be used by specifying them explicitly ( by ip or name )

private static socket address [ ] get local interface addrs ( string interface names [ ] ) throws unknown host exception { list < socket address > local addrs = new array list < > ( ) ; for ( string interface name : interface names ) { if ( inet addresses is inet address ( interface name ) ) { local addrs add ( new inet socket address ( interface name , 0 ) ) ; } else if ( net utils is valid subnet ( interface name ) ) { for ( inet address addr : net utils get i ps ( interface name , false ) ) { local addrs add ( new inet socket address ( addr , 0 ) ) ; } } else { for ( string ip : dns get i ps ( interface name , false ) ) { local addrs add ( new inet socket address ( ip , 0 ) ) ; } } } return local addrs to array ( new socket address [ local addrs size ( ) ] ) ; }


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


verify space quota by storage type is violated once quota is set relevant method { @ link directory with quota feature # verify quota by storage type }

public void verify quota by storage type ( ) throws d s quota exceeded exception { for ( storage type t : storage type get types supporting quota ( ) ) { long type quota = get type quota ( t ) ; if ( type quota = = hdfs constants quota reset ) { continue ; } long type consumed = get type consumed ( t ) ; if ( quota is violated ( type quota , type consumed ) ) { throw new d s quota exceeded exception ( type quota , type consumed ) ; } } }


uses the significant terms aggregation to find the keywords in text fields

public void test significance ( ) throws i o exception { text field type text field type = new text field type ( " text " ) ; text field type set fielddata ( true ) ; index writer config index writer config = new index writer config ( new standard analyzer ( ) ) ; index writer config set max buffered docs ( 100 ) ; index writer config set r a m buffer size m b ( 100 ) ; / / flush on open to have a single segment try ( directory dir = new directory ( ) ; index writer w = new index writer ( dir , index writer config ) ) { add mixed text docs ( w ) ; significant terms aggregation builder sig agg = new significant terms aggregation builder ( " sig text " ) field ( " text " ) ; sig agg execution hint ( random execution hint ( ) ) ; if ( random boolean ( ) ) { / / use a background filter which just happens to be same scope as whole - index sig agg background filter ( query builders terms query ( " text " , " common " ) ) ; } significant terms aggregation builder sig num agg = new significant terms aggregation builder ( " sig number " ) field ( " long field " ) ; sig num agg execution hint ( random execution hint ( ) ) ; try ( index reader reader = directory reader open ( w ) ) { assert equals ( " test expects a single segment " , 1 , reader leaves ( ) size ( ) ) ; index searcher searcher = new index searcher ( reader ) ; / / search " odd " significant string terms terms = search and reduce ( searcher , new term query ( new term ( " text " , " odd " ) ) , sig agg , text field type ) ; assert that ( terms get subset size ( ) , equal to ( 5l ) ) ; assert equals ( 1 , terms get buckets ( ) size ( ) ) ; assert null ( terms get bucket by key ( " even " ) ) ; assert null ( terms get bucket by key ( " common " ) ) ; assert not null ( terms get bucket by key ( " odd " ) ) ; / / search even terms = search and reduce ( searcher , new term query ( new term ( " text " , " even " ) ) , sig agg , text field type ) ; assert that ( terms get subset size ( ) , equal to ( 5l ) ) ; assert equals ( 1 , terms get buckets ( ) size ( ) ) ; assert null ( terms get bucket by key ( " odd " ) ) ; assert null ( terms get bucket by key ( " common " ) ) ; assert not null ( terms get bucket by key ( " even " ) ) ; / / search odd with regex includeexcludes sig agg include exclude ( new include exclude ( " o d " , null ) ) ; terms = search and reduce ( searcher , new term query ( new term ( " text " , " odd " ) ) , sig agg , text field type ) ; assert that ( terms get subset size ( ) , equal to ( 5l ) ) ; assert equals ( 1 , terms get buckets ( ) size ( ) ) ; assert not null ( terms get bucket by key ( " odd " ) ) ; assert null ( terms get bucket by key ( " common " ) ) ; assert null ( terms get bucket by key ( " even " ) ) ; / / search with string - based includeexcludes string odd strings [ ] = new string [ ] { " odd " , " weird " } ; string even strings [ ] = new string [ ] { " even " , " regular " } ; sig agg include exclude ( new include exclude ( odd strings , even strings ) ) ; sig agg significance heuristic ( significance heuristic tests get random significanceheuristic ( ) ) ; terms = search and reduce ( searcher , new term query ( new term ( " text " , " odd " ) ) , sig agg , text field type ) ; assert that ( terms get subset size ( ) , equal to ( 5l ) ) ; assert equals ( 1 , terms get buckets ( ) size ( ) ) ; assert not null ( terms get bucket by key ( " odd " ) ) ; assert null ( terms get bucket by key ( " weird " ) ) ; assert null ( terms get bucket by key ( " common " ) ) ; assert null ( terms get bucket by key ( " even " ) ) ; assert null ( terms get bucket by key ( " regular " ) ) ; sig agg include exclude ( new include exclude ( even strings , odd strings ) ) ; terms = search and reduce ( searcher , new term query ( new term ( " text " , " odd " ) ) , sig agg , text field type ) ; assert that ( terms get subset size ( ) , equal to ( 5l ) ) ; assert equals ( 0 , terms get buckets ( ) size ( ) ) ; assert null ( terms get bucket by key ( " odd " ) ) ; assert null ( terms get bucket by key ( " weird " ) ) ; assert null ( terms get bucket by key ( " common " ) ) ; assert null ( terms get bucket by key ( " even " ) ) ; assert null ( terms get bucket by key ( " regular " ) ) ; } } }


public fs permission get unmasked ( ) { return null ; }


helper method for tests to check if a queue is starved for min share

private boolean is starved for min share ( ) { return ! resources is none ( min share starvation ( ) ) ; }


randomly expire the zk sessions of the two z k f cs this differs from the above test in that it is not a controlled failover - we just do random expirations and expect neither one to ever generate fatal exceptions

public void test random expirations ( ) throws exception { cluster start ( ) ; long st = time now ( ) ; long run for = stress runtime secs * 1000 ; random r = new random ( ) ; while ( time now ( ) - st < run for ) { cluster get test context ( ) check exception ( ) ; int target idx = r next int ( 2 ) ; active standby elector target = cluster get elector ( target idx ) ; long sess id = target get z k session id for tests ( ) ; if ( sess id ! = - 1 ) { log info ( string format ( " expiring session % x for svc % d " , sess id , target idx ) ) ; get server ( server factory ) close session ( sess id ) ; } thread sleep ( r next int ( 300 ) ) ; } }


get the time in nanos passed since a previous time

public static long time since nanos ( long prev time ) { return nano time ( ) - prev time ; }


precondition tester for { @ code iterator remove ( ) } that throws an exception with a consistent error message

static void check remove ( boolean can remove ) { check state ( can remove , " no calls to next ( ) since the last call to remove ( ) " ) ; }


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


private void dragged ( int x , int y ) { int delta x = x - anchor x ; int delta y = y - anchor y ; anchor x = x ; anchor y = y ; switch ( state ) { case near edge : resize ( delta x ) ; break ; case over field : moving move floating ( delta x , delta y ) ; repaint ( ) ; break ; default : } }


public long get multi part threshold ( ) { return multi part threshold ; }


given a search item , builds a suggested item hierarchy by looking up parent items ( if applicable ) this allows search results for items not contained within the same { @ link item group } to be distinguished if provided search context is null , results will be interpreted from the root { @ link jenkins model jenkins } object

public static suggested item build ( searchable model object search context , search item si ) { if ( si instanceof item ) { return build ( search context , ( item ) si ) ; } return new suggested item ( si ) ; }


public user get user by name ( string username ) throws api exception { api response < user > local var response = get user by name with http info ( username ) ; return local var response get data ( ) ; }


returns whether all known children of this node have signaled that they are done

boolean is ready ( int num direct deps ) { / / avoids calling preconditions check state because it showed up in garbage profiles due to / / boxing of the int format args if ( signaled deps > num direct deps + external deps ) { throw new illegal state exception ( string format ( " % s % s % s " , num direct deps , external deps , this ) ) ; } return signaled deps = = num direct deps + external deps ; }


returns the symbol object with the given name in the specified library

public symbol get symbol ( string symbol name , imported library library ) { map < string , symbol > map = library symbols map get ( library ) ; return map get ( symbol name ) ; }


get the delegate methods from the given { @ link type element }

public static immutable list < spec method model < bind dynamic value method , void > > get on bind dynamic values methods ( type element type element , messager messager ) { final list < spec method model < bind dynamic value method , void > > methods = new array list < > ( ) ; for ( element enclosed element : type element get enclosed elements ( ) ) { if ( enclosed element get kind ( ) ! = element kind method ) { continue ; } final annotation annotation = enclosed element get annotation ( on bind dynamic value class ) ; if ( annotation = = null ) { continue ; } final executable element method = ( executable element ) enclosed element ; final list < method param model > method params = get method params ( method , messager , collections singleton list ( prop class ) , collections empty list ( ) , collections empty list ( ) ) ; final spec method model < bind dynamic value method , void > method model = spec method model < bind dynamic value method , void > builder ( ) annotations ( immutable list of ( annotation ) ) modifiers ( copy of ( new array list < > ( method get modifiers ( ) ) ) ) name ( method get simple name ( ) ) return type spec ( generate type spec ( method get return type ( ) ) ) type variables ( immutable list of ( ) ) method params ( copy of ( method params ) ) represented object ( method ) type model ( null ) build ( ) ; methods add ( method model ) ; } return immutable list copy of ( methods ) ; }


this is populated when the previous incremental mesh config responses failed to update configuration the message field in error details provides the client internal exception related to the failure < code > google rpc status error detail = 5 ; < code >

private com google protobuf single field builder v 3 < com google rpc status , com google rpc status builder , com google rpc status or builder > get error detail field builder ( ) { if ( error detail builder = = null ) { error detail builder = new com google protobuf single field builder v 3 < com google rpc status , com google rpc status builder , com google rpc status or builder > ( get error detail ( ) , get parent for children ( ) , is clean ( ) ) ; error detail = null ; } return error detail builder ; }


awaits shutdown of this thread , waiting up to the timeout

public boolean await shutdown ( long timeout , time unit unit ) throws interrupted exception { return shutdown latch await ( timeout , unit ) ; }


returns true if any coordinated { @ link request } has successfully completed


encode the url this extends { @ link u r l encoder # encode ( string , string ) } with a replacement of + with % 20

private static string encode url ( string url ) throws swift exception { if ( url matches ( " * \ \ s + * " ) ) { try { url = u r l encoder encode ( url , " utf - 8 " ) ; url = url replace ( " + " , " % 20 " ) ; } catch ( unsupported encoding exception e ) { throw new swift exception ( " failed to encode uri " , e ) ; } } return url ; }


returns whether this cache notifies a writer when an entry is modified

protected boolean has writer ( ) { return ( writer ! = cache writer disabled writer ( ) ) ; }


sets the percentage of the desired amount of time spent for io in the child event loops the default value is { @ code 50 } , which means the event loop will try to spend the same amount of time for io as for non - io tasks

public void set io ratio ( int io ratio ) { for ( event executor e : this ) { ( ( k queue event loop ) e ) set io ratio ( io ratio ) ; } }


returns whether to use the output directories used by the top - level targets for convenience symlinks if true , then symlinks use the actual output directories of the top - level targets the symlinks will be created iff all top - level targets share the same output directory otherwise , any stale symlinks from previous invocations will be deleted to avoid ambiguity if false , then symlinks use the output directory implied by command - line flags , regardless of whether top - level targets have transitions which change them ( or even have any output directories at all , as in the case of a build with no targets or one which only builds source files )

public boolean use top level targets for symlinks ( ) { return use top level targets for symlinks ; } @ option ( name = " experimental create py symlinks " , default value = " false " , documentation category = option documentation category undocumented , effect tags = { option effect tag affects outputs }


creates a new { @ code sliding event time windows } { @ link org apache flink streaming api windowing assigners window assigner } that assigns elements to sliding time windows based on the element timestamp

public static sliding window assigner of ( duration size , duration slide ) { return new sliding window assigner ( size to millis ( ) , slide to millis ( ) , 0 , true ) ; }


returns an immutable cell with the specified row key , column key , and value the returned cell is serializable

public static < r , c , v > cell < r , c , v > immutable cell ( @ nullable decl r row key , @ nullable decl c column key , @ nullable decl v value ) { return new immutable cell < > ( row key , column key , value ) ; }


sets the value of this data source this method will return { @ code true } if the value was successfully set , or { @ code false } if the data source has already been set , failed or closed passed closeable reference is cloned , caller of this method still owns passed reference after the method returns

public boolean set ( @ nullable closeable reference < t > value ref ) { closeable reference < t > cloned ref = closeable reference clone or null ( value ref ) ; return super set result ( cloned ref , / * is last * / true , null ) ; }


returns the string of the utf 8 constant at the specified index in the reusable constant pool

private string get string ( int constant index ) { return ( ( utf 8 constant ) constant pool [ constant index ] ) get string ( ) ; }


specifies the order of iteration for the elements of { @ link value graph # edges ( ) } , { @ link value graph # adjacent nodes ( object ) } , { @ link value graph # predecessors ( object ) } , { @ link value graph # successors ( object ) } and { @ link value graph # incident edges ( object ) } the default value is { @ link element order # unordered ( ) unordered } for mutable graphs for immutable graphs , this value is ignored ; they always have a { @ link element order # stable ( ) stable } order

public < n1 extends n > value graph builder < n1 , v > incident edge order ( element order < n1 > incident edge order ) { check argument ( incident edge order type ( ) = = element order type unordered | | incident edge order type ( ) = = element order type stable , " the given element order ( % s ) is unsupported incident edge order ( ) only supports " + " element order unordered ( ) and element order stable ( ) " , incident edge order ) ; value graph builder < n1 , v > new builder = cast ( ) ; new builder incident edge order = check not null ( incident edge order ) ; return new builder ; }


public static void start activity ( @ non null final class < ? extends activity > clz , @ anim res final int enter anim , @ anim res final int exit anim ) { context context = get top activity or app ( ) ; start activity ( context , null , context get package name ( ) , clz get name ( ) , 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 ) ; } }


test a cluster with even distribution , then three nodes are added to the cluster , runs balancer with two of the nodes in the include list

public void test balancer cli with include list in a file ( ) throws exception { final configuration conf = new hdfs configuration ( ) ; init conf ( conf ) ; set < string > include hosts = new hash set < string > ( ) ; include hosts add ( " datanode y " ) ; do test ( conf , new long [ ] { capacity , capacity } , new string [ ] { rack0 , rack1 } , capacity , rack2 , new host name based nodes ( new string [ ] { " datanode x " , " datanode y " , " datanode z " } , balancer parameters default get excluded nodes ( ) , include hosts ) , true , true ) ; }


public void set base resource ( resource base resource ) { handler set base resource ( base resource ) ; }


sets a linked binary generated by this rule to be propagated to dependers

builder set linked binary ( artifact linked binary ) { this linked binary = optional of ( linked binary ) ; return this ; }


set the value of the ' { @ code onsubmit } ' attribute may be a runtime expression

public void set onsubmit ( string onsubmit ) { this onsubmit = onsubmit ; }


remove the given component template from the cluster state the component template name supports simple regex wildcards for removing multiple component templates at a time

public void remove component template ( final string name , final time value master timeout , final action listener < acknowledged response > listener ) { validate not in use ( cluster service state ( ) metadata ( ) , name ) ; cluster service submit state update task ( " remove - component - template [ " + name + " ] " , new cluster state update task ( priority urgent , master timeout ) { @ override public void on failure ( string source , exception e ) { listener on failure ( e ) ; } @ override public cluster state execute ( cluster state current state ) { set < string > template names = new hash set < > ( ) ; for ( string template name : current state metadata ( ) component templates ( ) key set ( ) ) { if ( regex simple match ( name , template name ) ) { template names add ( template name ) ; } } if ( template names is empty ( ) ) { / / if its a match all pattern , and no templates are found ( we have none ) , don ' t / / fail with index missing if ( regex is match all pattern ( name ) ) { return current state ; } / / todo : perhaps introduce a component template missing exception ? throw new index template missing exception ( name ) ; } metadata builder metadata = metadata builder ( current state metadata ( ) ) ; for ( string template name : template names ) { logger info ( " removing component template [ { } ] " , template name ) ; metadata remove component template ( template name ) ; } return cluster state builder ( current state ) metadata ( metadata ) build ( ) ; } @ override public void cluster state processed ( string source , cluster state old state , cluster state new state ) { listener on response ( acknowledged response true ) ; } } ) ; }


replace every subsequence of the input sequence that matches the pattern with the given replacement string

public static string get replace all ( final string input , final string regex , final string replacement ) { if ( input = = null ) return " " ; return pattern compile ( regex ) matcher ( input ) replace all ( replacement ) ; }


update the addresses in all records to reflect the movement of a memory block

abstract void move address range ( address from addr , address to addr , long length , task monitor monitor ) throws cancelled exception , i o exception ;


allocate storage for more buckets and store the " next gather offset " for those new buckets

private void grow ( long min size ) { long old max = values ( ) size ( ) - 1 ; grow values ( min size ) ; / / set the next gather offsets for all newly allocated buckets set next gather offsets ( old max - ( old max % get bucket size ( ) ) + get bucket size ( ) ) ; }


remembers the value ' n ' in the cache for future { @ link # resolve ( job ) }

protected void update cache ( @ non null job < ? , ? > job , @ check for null run < ? , ? > b ) { file build dir = job get build dir ( ) ; map < string , integer > cache = cache for ( build dir ) ; synchronized ( cache ) { cache put ( get id ( ) , b = = null ? resolves to none : b get number ( ) ) ; file storage = storage for ( build dir ) ; logger fine ( ( ) - > " saving to " + storage + " : " + cache ) ; try ( atomic file writer cw = new atomic file writer ( storage ) ) { try { for ( map entry < string , integer > entry : cache entry set ( ) ) { cw write ( entry get key ( ) ) ; cw write ( ' ' ) ; cw write ( integer to string ( entry get value ( ) ) ) ; cw write ( ' \ n ' ) ; } cw commit ( ) ; } finally { cw abort ( ) ; } } catch ( i o exception x ) { logger log ( level warning , " failed to update " + storage , x ) ; } } }


stop executiontriggering of watches on this node , do not try to reload anything , just sit still

public synchronized void pause execution ( ) { engines values ( ) for each ( trigger engine : : pause execution ) ; per watch stats clear ( ) ; }


get a collection of the cache names known by this manager

collection < string > get cache names ( ) ;


public void set path ( string vol path ) { this path = vol path ; }


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


returns whether to preserve the rollup jobs of this test defaults to not preserving them only runs at all if xpack is installed on the cluster being tested

protected boolean preserve rollup jobs upon completion ( ) { return false ; }


gets the result program merge changes are applied to this program

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


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

public model do not use in to string on visibility state changed ( on model visibility state changed listener < model do not use in to string , object > listener ) { on mutation ( ) ; this on model visibility state changed listener epoxy generated model = listener ; return this ; }


convert a working dir + environment map + arg list into a bourne shell command

public static string as shell command ( collection < string > arguments , path working directory , map < string , string > environment , boolean pretty print args ) { / / we print this command out in such a way that it can safely be / / copied + pasted as a bourne shell command this is extremely valuable for / / debugging return command failure utils describe command ( command description form complete , pretty print args , arguments , environment , working directory get path string ( ) ) ; }


returns the logical or of this long value and the given long value

public long value or ( long value other ) { return other or ( this ) ; }


return true if the location in the event is draggable

public boolean is start drag ok ( drag gesture event e ) { synchronized ( root ) { point p = e get drag origin ( ) ; program node node = get tree node ( p ) ; if ( node = = null | | node equals ( root ) ) { return false ; } if ( is editing ( ) ) { stop editing ( ) ; } return true ; } }


returns the value reference of the entry if it should be closed , null otherwise

private synchronized closeable reference < v > reference to close ( entry < k , v > entry ) { preconditions check not null ( entry ) ; return ( entry is orphan & & entry client count = = 0 ) ? entry value ref : null ; }


adds interceptors that will be called before the channel performs its real work this is functionally equivalent to using { @ link client interceptors # intercept ( channel , client interceptor ) } , but while still having access to the original { @ code managed channel } interceptors run in the reverse order in which they are added , just as with consecutive calls to { @ code client interceptors intercept ( ) }

public abstract t intercept ( client interceptor interceptors ) ;


public static iteration aggregator broker instance ( ) { return instance ; }


returns a { @ code file } object for the given path parts

private static file file ( string first , string more ) { return file ( new file ( first ) , more ) ; }


https : jira spring iobrowse s p r - 2788

public void as body tag with no errors and existing messages attribute in application scope are not clobbered ( ) throws exception { assert when no errors existing messages in scope are not clobbered ( page context application scope ) ; }


set category path if name conflict occurs within new category the specified dt will remain within its current category

private void set category path ( data type dt , category path new path ) { if ( dt get category path ( ) equals ( new path ) ) { return ; } try { dt set category path ( new path ) ; } catch ( duplicate name exception e ) { / / ignore - no change made } }


http get url request params are expanded using the given query { @ link query } { @ code response type } can be an http rest result or http rest result data { @ code t } type { @ code config } specify the request config via { @ link http client config }

public < t > http rest result < t > get ( string url , http client config config , header header , query query , type response type ) throws exception { request http entity request http entity = new request http entity ( config , header , query ) ; return execute ( url , http method get , request http entity , response type ) ; }


test verifies null watcher with watcher type any - remove all the watchers data , child , exists

public void test remove all watchers ( boolean use async ) throws i o exception , interrupted exception , keeper exception { zk 1 create ( " / node 1 " , null , ids open acl unsafe , create mode persistent ) ; my watcher w 1 = new my watcher ( " / node 1 " , 2 ) ; my watcher w 2 = new my watcher ( " / node 1 " , 2 ) ; log info ( " adding data watcher { } on path { } " , w 1 , " / node 1 " ) ; assert not null ( zk 2 exists ( " / node 1 " , w 1 ) , " didn ' t set data watches " ) ; log info ( " adding data watcher { } on path { } " , w 2 , " / node 1 " ) ; assert not null ( zk 2 exists ( " / node 1 " , w 2 ) , " didn ' t set data watches " ) ; log info ( " adding child watcher { } on path { } " , w 1 , " / node 1 " ) ; zk 2 get children ( " / node 1 " , w 1 ) ; log info ( " adding child watcher { } on path { } " , w 2 , " / node 1 " ) ; zk 2 get children ( " / node 1 " , w 2 ) ; remove watches ( zk 2 , " / node 1 " , w 1 , watcher type any , false , code ok , use async ) ; remove watches ( zk 2 , " / node 1 " , w 2 , watcher type any , false , code ok , use async ) ; zk 1 create ( " / node 1 / child " , null , ids open acl unsafe , create mode ephemeral ) ; assert true ( w 1 matches ( ) , " didn ' t remove data watcher " ) ; assert true ( w 2 matches ( ) , " didn ' t remove child watcher " ) ; }


deregisters a provider no - op if the provider is not in the registry

public synchronized void deregister ( certificate provider provider certificate provider provider ) { check not null ( certificate provider provider , " certificate provider provider " ) ; providers remove ( certificate provider provider get name ( ) ) ; }


get the last saved jenkins instance version

public static @ non null string get last exec version ( ) { file last exec version file = get last exec version file ( ) ; if ( last exec version file exists ( ) ) { try { string version = file utils read file to string ( last exec version file , charset default charset ( ) ) ; / / jenkins - 37438 blank will force the setup / / wizard regardless of current state of the system if ( string utils is blank ( version ) ) { return force new install version to string ( ) ; } return version ; } catch ( i o exception e ) { logger log ( severe , " unexpected error unable to read " + last exec version file get absolute path ( ) , e ) ; logger log ( warning , " unable to determine the last running version ( see error above ) treating this as a restart no plugins will be updated " ) ; return get current exec version ( ) ; } } else { / / backward compatibility use the last version stored in the top level config xml / / going to read the value directly from the config xml file vs hoping that the / / jenkins startup sequence has moved far enough along that it has loaded the / / global config it can ' t load the global config until well into the startup / / sequence because the unmarshal requires numerous objects to be created e g / / it requires the plugin manager it happens too late and it ' s too risky to / / change how it currently works file config file = get config file ( ) ; if ( config file exists ( ) ) { try { string last version = x m l utils get value ( " / hudson / version " , config file ) ; if ( last version length ( ) > 0 ) { logger log ( level fine , " discovered serialized last version { 0 } " , last version ) ; return last version ; } } catch ( exception e ) { logger log ( severe , " unexpected error reading global config xml " , e ) ; } } return new install version to string ( ) ; } }


returns the node identifier to be included in x d s requests

public node get node ( ) { return node ; }


protected void ok callback ( ) { if ( model execute ( ) ) { close ( ) ; } else { set status text ( model get message ( ) ) ; set ok enabled ( false ) ; } }


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


public string get name ( ) { return name ; }


return true if this foo 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 ; } foo foo = ( foo ) o ; return objects equals ( this bar , foo bar ) ; }


writes the given entry names and data to a jar archive at the given path

private static void write entries ( path output , map < string , input stream > entries ) throws i o exception { if ( ! entries contains key ( " java / lang / object class " ) ) { throw new assertion error ( " \ n could not find java lang object on bootclasspath ; something has gone terribly wrong \ n " + " please file a bug : https : / / github com / bazelbuild / bazel / issues " ) ; } try ( output stream os = files new output stream ( output ) ; buffered output stream bos = new buffered output stream ( os , 65536 ) ; jar output stream jos = new jar output stream ( bos ) ) { entries entry set ( ) stream ( ) for each ordered ( entry - > { try { add entry ( jos , entry get key ( ) , entry get value ( ) ) ; } catch ( i o exception e ) { throw new unchecked i o exception ( e ) ; } } ) ; } }


specify the jca work manager to use for bootstrapping the resource adapter

public void set work manager ( work manager work manager ) { this work manager = work manager ; }


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

@ override public t visit primordefcast ( painless parser primordefcast context ctx ) { return visit children ( ctx ) ; }


public void close ( ) throws i o exception { txn log txn log to close = txn log ; if ( txn log to close ! = null ) { txn log to close close ( ) ; } txn log = null ; snap shot snap slog to close = snap log ; if ( snap slog to close ! = null ) { snap slog to close close ( ) ; } snap log = null ; }


public int get minor ( ) { return minor ; }


returns an immutable list containing a single element this list behaves and performs comparably to { @ link collections # singleton list } , but will not accept a null element it is preferable mainly for consistency and maintainability of your code

public static < e > immutable list < e > of ( e element ) { return construct ( element ) ; }


checks whether or not a region id is valid

public static boolean is valid region ( string region ) { try { regions from name ( region to lower case ( ) ) ; } catch ( illegal argument exception e ) { return false ; } return true ; }


the specification of this method matches that of { @ link file context # create symlink ( path , path , boolean ) } ;

public void create symlink ( final path target , final path link , final boolean create parent ) throws i o exception , unresolved link exception { throw new i o exception ( " file system does not support symlinks " ) ; }


return the offset of the last appended record this is updated after every append and can be used after the batch has been built to obtain the last offset

public long last offset ( ) { return next offset - 1 ; }


boolean is category 2 ( ) { string descriptor = descriptor ( ) ; return descriptor equals ( " j " ) | | descriptor equals ( " d " ) ; }


set the entity tag of the body , as specified by the { @ code e tag } header


returns a buffered reader that reads from a file using the given character set < b > { @ link java nio file path } equivalent : < b > { @ link java nio file files # new buffered reader ( java nio file path , charset ) }

public static buffered reader new reader ( file file , charset charset ) throws file not found exception { check not null ( file ) ; check not null ( charset ) ; return new buffered reader ( new input stream reader ( new file input stream ( file ) , charset ) ) ; }


stop the disconnect timer any running tasks will be allowed to complete

private void cancel disconnect timer ( ) { synchronized ( zk disconnect lock ) { if ( zk disconnect timer ! = null ) { zk disconnect timer cancel ( ) ; zk disconnect timer = null ; } } }


gets the originating " x - forwarded - " header from the request if there are multiple headers the originating header is the first header if the originating header contains a comma separated list , the originating entry is the first one

private static string get x forwarded header ( stapler request req , string header , string default value ) { string value = req get header ( header ) ; if ( value ! = null ) { int index = value index of ( ' , ' ) ; return index = = - 1 ? value trim ( ) : value substring ( 0 , index ) trim ( ) ; } return default value ; }


computes the bzl load value for all given keys by reusing this instance of the bzl load function , bypassing traditional skyframe evaluation { @ code program loads } provides the locations of the load statements in source order , for error reporting

private list < bzl load value > compute bzl loads with inlining ( environment env , list < bzl load value key > keys , list < pair < string , location > > program loads , inlining state inlining state ) throws bzl load failed exception , interrupted exception { / / it is an invariant of bzl load function inlining that we are recording dep requests environment stripped env = ( ( recording sky function environment ) env ) get delegate ( ) ; list < bzl load value > bzl loads = lists new array list with expected size ( keys size ( ) ) ; / / for the sake of ensuring the graph structure is deterministic , we need to request all of our / / deps , even if some of them yield errors the first exception that is seen gets deferred , to / / be raised after the loop all other exceptions are swallowed / / / / to see how immediately returning the first error leads to non - determinism , consider the case / / of two dependencies a and b , where a is in error and appears in a load statement above b / / if a has completed at the time we request it , and if we were to immediately propagate that / / error , we never request b on the other hand , if a is missing ( null return ) , we do request b / / in the meantime for the sake of parallelism / / / / this approach assumes - - keep going ; determinism is not guaranteed otherwise it also assumes / / interrupted exception does not occur , since we don ' t catch and defer it bzl load failed exception deferred exception = null ; boolean values missing = false ; for ( int i = 0 ; i < keys size ( ) ; i + + ) { cached bzl load data cached data ; try { cached data = compute inline cached data ( keys get ( i ) , stripped env , inlining state ) ; } catch ( bzl load failed exception e ) { if ( deferred exception = = null ) { deferred exception = bzl load failed exception while loading dep ( program loads get ( i ) second , e ) ; } continue ; } if ( cached data = = null ) { / / a null value for ` cached data ` can occur when it ( or its transitive loads ) has a skyframe / / dep that is missing or in error it can also occur if there ' s a transitive load on a bzl / / that was already seen by inlining state and which returned null ( note : in this case , it ' s / / not necessarily true that there are missing skyframe deps because this bzl could have / / already been visited unsuccessfully ) in both these cases , we want to continue making our / / inline calls , so as to maximize the number of dependent ( non - inlined ) sky functions that / / are requested and avoid a quadratic number of restarts values missing = true ; } else { bzl loads add ( cached data get value ( ) ) ; } } if ( deferred exception ! = null ) { throw deferred exception ; } return values missing ? null : bzl loads ; }


a filter to filter only documents where a field exists in them

public static exists query builder exists query ( string name ) { return new exists query builder ( name ) ; }


evaluate the x path and assert the number of nodes found with the given hamcrest { @ link matcher }

public result matcher node count ( matcher < ? super integer > matcher ) { return result - > { mock http servlet response response = result get response ( ) ; this xpath helper assert node count ( response get content as byte array ( ) , get defined encoding ( response ) , matcher ) ; } ; }


getter for the connection type ( based on url + user + password )

public int get connection type code ( ) { return connection type code ; }


protected abstract tab highlight positions get position ( ) ;


two objects are considered equal if they are the same type and have the same id

public boolean equals ( object o ) { if ( this = = o ) return true ; if ( ! ( o instanceof warning ) ) return false ; warning warning = ( warning ) o ; return id equals ( warning id ) ; }


build resolve result here ' s an example mountpoint : fs viewfs mounttable mt link regex replaceresolveddstpath : : - # ^ user ( ? < username > \ w + ) value : target test root $ username dir path to test : viewfs : mtuserhadoop user 1hadoop dir 1 expect path : target test roothadoop - user 1hadoop dir 1 resolved path str : userhadoop user 1 target of resolved path str : target test roothadoop - user 1 remaining path : hadoop dir 1

protected resolve result < t > build resolve result for regex mount point ( result kind result kind , string resolved path str , string target of resolved path str , path remaining path ) { try { t target fs = get target file system ( new uri ( target of resolved path str ) ) ; return new resolve result < t > ( result kind , target fs , resolved path str , remaining path , true ) ; } catch ( i o exception ex ) { logger error ( string format ( " got exception while build resolve result " + " result kind : % s , resolved path str : % s , " + " target of resolved path str : % s , remaining path : % s , " + " will return null " , result kind , resolved path str , target of resolved path str , remaining path ) , ex ) ; return null ; } catch ( u r i syntax exception uex ) { logger error ( string format ( " got exception while build resolve result " + " result kind : % s , resolved path str : % s , " + " target of resolved path str : % s , remaining path : % s , " + " will return null " , result kind , resolved path str , target of resolved path str , remaining path ) , uex ) ; return null ; } }


private synchronized void start thread ( ) { if ( ! update thread is alive ( ) ) { update thread start ( ) ; head index = 0 ; tail index = 0 ; } }


returns the actual instance of a fragment options class

public < t extends fragment options > t get ( class < t > options class ) { fragment options options = fragment options map get ( options class ) ; preconditions check not null ( options , " fragment options unavailable : " + options class get name ( ) ) ; return options class cast ( options ) ; }


public void accept ( visitor visitor ) { visitor visit throwing insn ( this ) ; }


sets the number of shard copies that must be active before proceeding with the write see { @ link replication request # wait for active shards ( active shard count ) } for details

public bulk request builder set wait for active shards ( active shard count wait for active shards ) { request wait for active shards ( wait for active shards ) ; return this ; }


handles a single uri that may be local or external

void get resolved ( @ nullable uri uri , @ nullable string mime type , @ non null callback < optional < share data > > callback ) { signal executors bounded execute ( ( ) - > { try { callback on result ( optional of ( get resolved internal ( uri , mime type ) ) ) ; } catch ( i o exception e ) { log w ( tag , " failed to resolve ! " , e ) ; callback on result ( optional absent ( ) ) ; } } ) ; }


this method resets the internal map of mock objects

public static void reset ( ) { if ( get mocks ( ) ! = null ) { get mocks ( ) clear ( ) ; } }


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

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


void log slow rpc calls ( string method name , call call , processing details details ) { final int deviation = 3 ; / / 1024 for min sample size just a guess - - not a number computed based on / / sample size analysis it is chosen with the hope that this / / number is high enough to avoid spurious logging , yet useful / / in practice final int min sample size = 1024 ; final double three sigma = rpc metrics get processing mean ( ) + ( rpc metrics get processing std dev ( ) * deviation ) ; long processing time = details get ( timing processing , rpc metrics timeunit ) ; if ( ( rpc metrics get processing sample count ( ) > min sample size ) & & ( processing time > three sigma ) ) { log warn ( " slow rpc : { } took { } { } to process from client { } , " + " the processing detail is { } " , method name , processing time , rpc metrics timeunit , call , details to string ( ) ) ; rpc metrics incr slow rpc ( ) ; } }


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


changes the names of the parameters in the array to unique names that won ' t conflict with any other names in the function ' s namespace when the parameters are used to replace the existing parameters in the function appends an integer number to the base name if necessary to create a unique name in the function ' s namespace

private void set unique parameter names ( function function , parameter [ ] parameters ) throws duplicate name exception , invalid input exception { symbol table symbol table = current program get symbol table ( ) ; / / create a set containing all the unique parameter names determined so far so they can / / be avoided as additional parameter names are determined set < string > names so far = new hash set < > ( ) ; for ( int ordinal = 0 ; ordinal < parameters length ; ordinal + + ) { parameter parameter = parameters [ ordinal ] ; string base name = parameter get name ( ) ; if ( ordinal = = 0 & & function this param name equals ( base name ) ) { continue ; } string unique name = get unique replacement parameter name ( symbol table , function , base name , names so far ) ; names so far add ( unique name ) ; parameter set name ( unique name , source type imported ) ; } }


adds the given value to the configuration object the main key of the config option will be used to map the value

public void set string ( config option < string > key , string value ) { set value internal ( key key ( ) , value ) ; }


notifies that an error has occurred that the process cannot proceed


check if there are any expired heartbeats , and if so , whether any blocks have to be re - replicated while removing dead datanodes , make sure that only one datanode is marked dead at a time within the synchronized section otherwise , a cascading effect causes more datanodes to be declared dead check if there are any failed storage and if so , remove all the blocks on the storage it also covers the following less common scenarios after datanode storage is marked failed , it is still possible to receive ibr for this storage 1 ) dn could deliver ibr for failed storage due to its implementation a ) dn queues a pending ibr request b ) the storage of the block fails c ) dn first sends hb , nn will mark the storage failed d ) dn then sends the pending ibr request 2 ) sbn processes block request from pending d n messages it is possible to have messages in pending d n messages that refer to some failed storage a ) sbn receives a ibr and put it in pending d n messages b ) the storage of the block fails c ) edit log replay get the ibr from pending d n messages alternatively , we can resolve these scenarios with the following approaches a make sure dn don ' t deliver ibr for failed storage b remove all blocks in pending data node messages for the failed storage when we remove all blocks from blocks map for that storage

void heartbeat check ( ) { final datanode manager dm = block manager get datanode manager ( ) ; / / it ' s ok to check safe mode w / o taking the lock here , we re - check / / for safe mode after taking the lock before removing a datanode if ( namesystem is in startup safe mode ( ) ) { return ; } boolean all alive = false ; while ( ! all alive ) { / / locate the first dead node datanode descriptor dead = null ; / / locate the first failed storage that isn ' t on a dead node datanode storage info failed storage = null ; / / check the number of stale storages int num of stale storages = 0 ; list < datanode descriptor > stale nodes = new array list < > ( ) ; synchronized ( this ) { for ( datanode descriptor d : datanodes ) { / / check if an excessive gc pause has occurred if ( should abort heartbeat check ( 0 ) ) { return ; } if ( dead = = null & & dm is datanode dead ( d ) ) { stats incr expired heartbeats ( ) ; dead = d ; / / remove the node from stale list to adjust the stale list size / / before setting the stale count of the datanode manager remove node from stale list ( d ) ; } else { if ( d is stale ( dm get stale interval ( ) ) ) { if ( stale data nodes add ( d ) ) { / / the node is n stale nodes add ( d ) ; } } else { / / remove the node if it is no longer stale remove node from stale list ( d , false ) ; } } datanode storage info [ ] storage infos = d get storage infos ( ) ; for ( datanode storage info storage info : storage infos ) { if ( storage info are block contents stale ( ) ) { num of stale storages + + ; } if ( failed storage = = null & & storage info are blocks on failed storage ( ) & & d ! = dead ) { failed storage = storage info ; } } } / / set the number of stale nodes in the datanode manager dm set num stale nodes ( stale data nodes size ( ) ) ; dm set num stale storages ( num of stale storages ) ; } / / log nodes detected as stale since last heart beat dump stale nodes ( stale nodes ) ; all alive = dead = = null & & failed storage = = null ; if ( ! all alive & & namesystem is in startup safe mode ( ) ) { return ; } if ( dead ! = null ) { / / acquire the fsnamesystem lock , and then remove the dead node namesystem write lock ( ) ; try { dm remove dead datanode ( dead , ! dead is maintenance ( ) ) ; } finally { namesystem write unlock ( ) ; } } if ( failed storage ! = null ) { / / acquire the fsnamesystem lock , and remove blocks on the storage namesystem write lock ( ) ; try { block manager remove blocks associated to ( failed storage ) ; } finally { namesystem write unlock ( ) ; } } } }


the following are the step of the diff test : 1 ) initialize the previous list and add s elements to it , where s = start size 2 ) initialize the current list by coping all elements from the previous list 3 ) initialize an empty diff object 4 ) make m modifications to the current list , where m = num modifications record the modifications in diff at the same time 5 ) test if current = = previous + diff and previous = = current - diff 6 ) test access previous and access current

void run diff test ( int start size , int num modifications ) { final int width = find width ( start size + num modifications ) ; system out println ( " \ nstart size = " + start size + " , num modifications = " + num modifications + " , width = " + width ) ; / / initialize previous final list < i node > previous = new array list < i node > ( ) ; int n = 0 ; for ( ; n < start size ; n + + ) { previous add ( new i node ( n , width ) ) ; } / / make modifications to current and record the diff final list < i node > current = new array list < i node > ( previous ) ; final list < diff < byte [ ] , i node > > diffs = new array list < diff < byte [ ] , i node > > ( ) ; for ( int j = 0 ; j < 5 ; j + + ) { diffs add ( new diff < byte [ ] , i node > ( ) ) ; } for ( int m = 0 ; m < num modifications ; m + + ) { final int j = m * diffs size ( ) / num modifications ; / / if current is empty , the next operation must be create ; / / otherwise , randomly pick an operation final int next operation = current is empty ( ) ? 1 : random next int ( 3 ) + 1 ; switch ( next operation ) { case 1 : / / create { final i node i = new i node ( n + + , width ) ; create ( i , current , diffs get ( j ) ) ; break ; } case 2 : / / delete { final i node i = current get ( random next int ( current size ( ) ) ) ; delete ( i , current , diffs get ( j ) ) ; break ; } case 3 : / / modify { final i node i = current get ( random next int ( current size ( ) ) ) ; modify ( i , current , diffs get ( j ) ) ; break ; } } } { / / check if current = = previous + diffs list < i node > c = previous ; for ( int i = 0 ; i < diffs size ( ) ; i + + ) { c = diffs get ( i ) apply 2 previous ( c ) ; } if ( ! has identical elements ( current , c ) ) { system out println ( " previous = " + previous ) ; system out println ( ) ; system out println ( " current = " + current ) ; system out println ( " c = " + c ) ; throw new assertion error ( " current and c are not identical " ) ; } / / check if previous = = current - diffs list < i node > p = current ; for ( int i = diffs size ( ) - 1 ; i > = 0 ; i - - ) { p = diffs get ( i ) apply 2 current ( p ) ; } if ( ! has identical elements ( previous , p ) ) { system out println ( " previous = " + previous ) ; system out println ( " p = " + p ) ; system out println ( ) ; system out println ( " current = " + current ) ; throw new assertion error ( " previous and p are not identical " ) ; } } / / combine all diffs final diff < byte [ ] , i node > combined = diffs get ( 0 ) ; for ( int i = 1 ; i < diffs size ( ) ; i + + ) { combined combine posterior ( diffs get ( i ) , null ) ; } { / / check if current = = previous + combined final list < i node > c = combined apply 2 previous ( previous ) ; if ( ! has identical elements ( current , c ) ) { system out println ( " previous = " + previous ) ; system out println ( ) ; system out println ( " current = " + current ) ; system out println ( " c = " + c ) ; throw new assertion error ( " current and c are not identical " ) ; } / / check if previous = = current - combined final list < i node > p = combined apply 2 current ( current ) ; if ( ! has identical elements ( previous , p ) ) { system out println ( " previous = " + previous ) ; system out println ( " p = " + p ) ; system out println ( ) ; system out println ( " current = " + current ) ; throw new assertion error ( " previous and p are not identical " ) ; } } { for ( int m = 0 ; m < n ; m + + ) { final i node inode = new i node ( m , width ) ; { / / test access previous final container < i node > r = combined access previous ( inode get key ( ) ) ; final i node computed ; if ( r ! = null ) { computed = r get element ( ) ; } else { final int i = diff search ( current , inode get key ( ) ) ; computed = i < 0 ? null : current get ( i ) ; } final int j = diff search ( previous , inode get key ( ) ) ; final i node expected = j < 0 ? null : previous get ( j ) ; / / must be the same object ( equals is not enough ) assert assert true ( computed = = expected ) ; } { / / test access current final container < i node > r = combined access current ( inode get key ( ) ) ; final i node computed ; if ( r ! = null ) { computed = r get element ( ) ; } else { final int i = diff search ( previous , inode get key ( ) ) ; computed = i < 0 ? null : previous get ( i ) ; } final int j = diff search ( current , inode get key ( ) ) ; final i node expected = j < 0 ? null : current get ( j ) ; / / must be the same object ( equals is not enough ) assert assert true ( computed = = expected ) ; } } } }


this method will return an array of { @ link byte buffer } representing the bytes from the index passed through the end of this buffer the buffers will be duplicates of the internal buffers , so any modifications to the markers { @ link byte buffer # position ( ) } , { @ link byte buffer # limit ( ) } , etc will not modify the this class

public byte buffer [ ] slice buffers from ( long from ) { if ( from > capacity ) { throw new index out of bounds exception ( " can ' t slice a channel buffer with capacity [ " + capacity + " ] , with slice parameters from [ " + from + " ] " ) ; } else if ( from = = capacity ) { return empty byte buffer array ; } long index with offset = from + offset ; int page index = page index ( index with offset ) ; int index in page = index in page ( index with offset ) ; byte buffer [ ] buffers = new byte buffer [ pages size ( ) - page index ] ; iterator < page > page iterator = pages descending iterator ( ) ; for ( int i = buffers length - 1 ; i > 0 ; - - i ) { buffers [ i ] = page iterator next ( ) byte buffer ( ) duplicate ( ) ; } byte buffer first post index buffer = page iterator next ( ) byte buffer ( ) duplicate ( ) ; first post index buffer position ( first post index buffer position ( ) + index in page ) ; buffers [ 0 ] = first post index buffer ; return buffers ; }


create the target url and , if necessary , pre - pend the context path , expand uri template variables , append the current request query , and apply the configured { @ link # get request data value processor ( ) request data value processor }

protected final string create target url ( map < string , object > model , server web exchange exchange ) { string url = get url ( ) ; assert state ( url ! = null , " ' url ' not set " ) ; server http request request = exchange get request ( ) ; string builder target url = new string builder ( ) ; if ( is context relative ( ) & & url starts with ( " / " ) ) { target url append ( request get path ( ) context path ( ) value ( ) ) ; } target url append ( url ) ; if ( string utils has text ( target url ) ) { map < string , string > uri vars = get current uri variables ( exchange ) ; target url = expand target url template ( target url to string ( ) , model , uri vars ) ; } if ( is propagate query ( ) ) { target url = append current request query ( target url to string ( ) , request ) ; } string result = target url to string ( ) ; request data value processor processor = get request data value processor ( ) ; return ( processor ! = null ? processor process url ( exchange , result ) : result ) ; }


peek data from { @ code input } , respecting { @ code quiet } return true if the peek is successful if { @ code quiet = false } then encountering the end of the input ( whether before or after reading some data ) will throw { @ link e o f exception } if { @ code quiet = true } then encountering the end of the input ( even after reading some data ) will return { @ code false } this is slightly different to the behaviour of { @ link extractor input # peek fully ( byte [ ] , int , int , boolean ) } , where { @ code allow end of input = true } only returns false ( and suppresses the exception ) if the end of the input is reached before reading any data

private static boolean peek safely ( extractor input input , byte [ ] output , int offset , int length , boolean quiet ) throws i o exception { try { return input peek fully ( output , offset , length , / * allow end of input = * / quiet ) ; } catch ( e o f exception e ) { if ( quiet ) { return false ; } else { throw e ; } } }


called to allow plugins to initialize themselves this method is called after { @ link # set servlet context ( servlet context ) } is invoked you can also use { @ link jenkins model jenkins # get instance ( ) } to access the singleton hudson instance , although the plugin start up happens relatively early in the initialization stage and not all the data are loaded in hudson if a plugin wants to run an initialization step after all plugins and extension points are registered , a good place to do that is { @ link # post initialize ( ) } if a plugin wants to run an initialization step after all the jobs are loaded , { @ link item listener # on loaded ( ) } is a good place

public void start ( ) throws exception { }


public void get gauge ( io grpc testing integration metrics gauge request request , io grpc stub stream observer < io grpc testing integration metrics gauge response > response observer ) { io grpc stub server calls async unimplemented unary call ( get get gauge method ( ) , response observer ) ; }


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


gets a file path using the given configuration provided total files and files per directory

path get file ( ) { int file limit = config get total files ( ) ; int dir limit = config get dir size ( ) ; int start point = 1 + rnd next int ( file limit ) ; return get path ( start point , dir limit , type file ) ; }


quick validation on the input to check some obvious fail conditions ( fail fast ) the input and returns the appropriate { @ link plan } associated with the specified { @ link queue } or throws an exception message illustrating the details of any validation check failures

public plan validate reservation submission request ( reservation system reservation system , reservation submission request request , reservation id reservation id ) throws yarn exception { string message ; if ( reservation id = = null ) { message = " reservation id cannot be null please try again specifying " + " a valid reservation id by creating a new reservation id " ; throw r p c util get remote exception ( message ) ; } / / check if it is a managed queue string queue = request get queue ( ) ; plan plan = get plan from queue ( reservation system , queue , audit constants submit reservation request ) ; validate reservation definition ( reservation id , request get reservation definition ( ) , plan , audit constants submit reservation request ) ; return plan ; }


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


public static double next double ( final double min , final double max ) { return next double ( thread local random current ( ) , min , max ) ; }


public set < string > get photo urls ( ) { return photo urls ; }


key to be used for request caching < p > by default this returns null which means " do not cache " < p > to enable caching override this method and return a string key uniquely representing the state of a command instance < p > if multiple command instances in the same request scope match keys then only the first will be executed and all others returned from cache


internal method to set the generate to schema parameter basically we ' re generating to schema instances ( generically ) for all schemas however , if any of the contained datatypes doesn ' t have the to schema instance , we cannot generate it for its " ancestor " type this is the case with the " data aeson value " type : it doesn ' t ( and cannot ) have a swagger - compatible to schema instance so we have to detect its presence " downstream " the current schema , and if we find it we just don ' t generate any to schema instance

private void set generate to schema ( codegen model model ) { for ( codegen property var : model vars ) { if ( var data type content equals ( " value " ) | | var data type contains ( " value " ) ) { additional properties put ( " generate to schema " , false ) ; } if ( var items ! = null ) { if ( var items data type content equals ( " value " ) | | var data type contains ( " value " ) ) { additional properties put ( " generate to schema " , false ) ; } } } list < codegen model > children = model get children ( ) ; if ( children ! = null ) { for ( codegen model child : children ) { set generate to schema ( child ) ; } } }


create a set with all ints within range [ a b ] ( inclusive )

public static interval set of ( int a , int b ) { interval set s = new interval set ( ) ; s add ( a , b ) ; return s ; }


initialize the specified service ' s { @ link service rest metadata }

protected void init dubbo rest service metadata repository ( string service name ) { if ( dubbo rest service metadata repository contains key ( service name ) ) { if ( logger is debug enabled ( ) ) { logger debug ( " the metadata of dubbo service [ name : { } ] has been initialized " , service name ) ; } return ; } set < service rest metadata > service rest metadata set = get service rest metadata set ( service name ) ; if ( is empty ( service rest metadata set ) ) { if ( logger is warn enabled ( ) ) { logger warn ( " the spring application [ name : { } ] does not expose the rest metadata in the dubbo services " , service name ) ; } return ; } map < request metadata matcher , dubbo rest service metadata > metadata map = get metadata map ( service name ) ; for ( service rest metadata service rest metadata : service rest metadata set ) { service rest metadata get meta ( ) for each ( rest method metadata - > { request metadata request metadata = rest method metadata get request ( ) ; request metadata matcher matcher = new request metadata matcher ( request metadata ) ; dubbo rest service metadata metadata = new dubbo rest service metadata ( service rest metadata , rest method metadata ) ; metadata map put ( matcher , metadata ) ; } ) ; } if ( logger is info enabled ( ) ) { logger info ( " the rest metadata in the dubbo services has been loaded in the spring application [ name : { } ] " , service name ) ; } }


public void set up ( ) { flow method = method descriptor < string , integer > new builder ( ) set type ( method type unknown ) set full method name ( " basic / flow " ) set request marshaller ( request marshaller ) set response marshaller ( response marshaller ) build ( ) ; mockito when ( handler start call ( argument matchers < server call < string , integer > > any ( ) , argument matchers < metadata > any ( ) ) ) then return ( listener ) ; service definition = server service definition builder ( new service descriptor ( " basic " , flow method ) ) add method ( flow method , handler ) build ( ) ; }


links the ghidra layout to the given java project this effectively makes the project ' s build path " ghidra aware " if the project already has a ghidra installation directory linked to it , that link is deleted and the new ghidra installation directory is freshly linked back in

public static void link ghidra to project ( i java project java project , ghidra application layout ghidra layout , java config java config , string jython interpreter name , i progress monitor monitor ) throws core exception , i o exception { / / gets the ghidra installation directory to link to from the ghidra layout file ghidra install dir = ghidra layout get application installation dir ( ) get file ( false ) ; / / get the java vm used to launch the ghidra to link to i v m install vm = get ghidra vm ( java config ) ; i path vm path = new path ( java runtime jre container ) append ( vm get v m install type ( ) get id ( ) ) append ( vm get name ( ) ) ; / / get the project ' s existing linked ghidra installation folder and path ( it may not exist ) i folder ghidra folder = java project get project ( ) get folder ( ghidra project utils ghidra folder name ) ; i path old ghidra install path = ghidra folder exists ( ) ? new path ( ghidra folder get location ( ) to file ( ) get absolute path ( ) ) : null ; / / loop through the project ' s existing classpath to decide what to keep ( things that aren ' t / / related to ghidra ) , and things to not keep ( things that will be added fresh from the new / / ghidra ) i classpath entry vm entry candidate = null ; list < i classpath entry > classpath entries to keep = new array list < > ( ) ; for ( i classpath entry entry : java project get raw classpath ( ) ) { / / if the project is not linked to an old ghidra , save off the project ' s existing vm / / we ' ll decide whether or not to keep it later if ( entry get entry kind ( ) = = i classpath entry cpe container & & entry get path ( ) to string ( ) starts with ( java runtime jre container ) ) { if ( old ghidra install path = = null ) { vm entry candidate = entry ; } } else if ( entry get entry kind ( ) = = i classpath entry cpe container & & entry get path ( ) to string ( ) starts with ( j unit core junit container id ) ) { / / keep existing j unit classpath entries to keep add ( entry ) ; } else if ( entry get entry kind ( ) = = i classpath entry cpe project ) { / / keep all project dependencies classpath entries to keep add ( entry ) ; } else { / / if the project is linked to an old ghidra , keep the list of source folders that are / / linked to the ghidra installation ( after updating their paths to point to the new / / ghidra installation ) i folder entry folder = resources plugin get workspace ( ) get root ( ) get folder ( entry get path ( ) ) ; if ( entry get entry kind ( ) = = i classpath entry cpe source & & entry folder is linked ( ) & & old ghidra install path ! = null & & old ghidra install path is prefix of ( entry folder get location ( ) ) ) { string orig path = entry folder get location ( ) to string ( ) ; string new path = ghidra install dir get absolute path ( ) + orig path substring ( old ghidra install path to string ( ) length ( ) ) ; entry folder create link ( new path ( new path ) , i resource replace , monitor ) ; classpath entries to keep add ( java core new source entry ( entry folder get full path ( ) ) ) ; } / / if it ' s anything else that doesn ' t live in the old ghidra installation , keep it else if ( old ghidra install path = = null | | ! old ghidra install path is prefix of ( entry get path ( ) ) ) { classpath entries to keep add ( entry ) ; } } } / / if we detected a vm to potentially keep , we should ask the user if they are ok with using / / the vm that ghidra wants to use changing it automatically might cause problems for their / / existing java project if ( vm entry candidate = = null | | ( ! vm entry candidate get path ( ) equals ( vm path ) & & eclipse message utils show confirm dialog ( " java conflict " , " current java : " + java runtime get v m install ( java project ) get name ( ) + " \ n ghidra java : " + vm get name ( ) + " \ n \ n press ok to use ghidra ' s java , or cancel to keep current java " ) ) ) { classpath entries to keep add ( java core new container entry ( vm path ) ) ; } else { classpath entries to keep add ( vm entry candidate ) ; } / / add the ghidra libraries from the new ghidra installation directory to the classpath list < i classpath entry > library classpath entries = get ghidra library classpath entries ( ghidra layout ) ; classpath entries to keep add all ( library classpath entries ) ; / / set classpath java project set raw classpath ( classpath entries to keep to array ( new i classpath entry [ classpath entries to keep size ( ) ] ) , null ) ; / / update link to the ghidra installation directory ghidra folder create link ( new path ( ghidra install dir get absolute path ( ) ) , i resource replace , monitor ) ; / / update language ant properties file , if applicable ghidra module utils write ant properties ( java project get project ( ) , ghidra layout ) ; / / setup python for the project if ( py dev utils is supported py dev installed ( ) ) { try { py dev utils setup python for project ( java project , library classpath entries , jython interpreter name , monitor ) ; } catch ( operation not supported exception e ) { eclipse message utils show error dialog ( " py dev error " , " failed to setup python for the project py dev version is not supported " ) ; } } }


starts building a new { @ link config option }


{ @ inherit doc } the default implementation does nothing

@ override public void enter current date time function ( sql base parser current date time function context ctx ) { }


helper method to build upstream tls context for above tests called from other classes as well

static envoy server proto data upstream tls context build upstream tls context ( common tls context common tls context ) { upstream tls context upstream tls context = upstream tls context new builder ( ) set common tls context ( common tls context ) build ( ) ; return envoy server proto data upstream tls context from envoy proto upstream tls context ( upstream tls context ) ; }


packs the color components into a 32 - bit integer with the format abgr note that no range checking is performed for higher performance

public static int to int bits ( int r , int g , int b , int a ) { return ( a < < 24 ) | ( b < < 16 ) | ( g < < 8 ) | r ; }


int get parameter ( string name ) throws no such element exception { return cache file get parameter ( name ) ; }


applies the given visitor to all class annotations

public void annotations accept ( clazz clazz , annotation visitor annotation visitor ) { for ( int index = 0 ; index < u 2annotations count ; index + + ) { / / we don ' t need double dispatching here , since there is only one / / type of annotation annotation visitor visit annotation ( clazz , annotations [ index ] ) ; } }


public jdbc template get jdbc template ( ) { return this data source service get jdbc template ( ) ; }


returns true if field corresponding to field i d is set ( has been assigned a value ) and false otherwise

public boolean is set ( fields field ) { if ( field = = null ) { throw new illegal argument exception ( ) ; } switch ( field ) { } throw new illegal state exception ( ) ; }


access the input stream statistics this is for internal testing and may be removed without warning

public s 3 a input stream statistics get s 3 a stream statistics ( ) { return stream statistics ; }


set the { @ link # command options } field to the result of { @ link # create options ( ) } ; protected for subclasses and test access

protected void bind command options ( ) { command options = create options ( ) ; }


create a { @ link request mapping info } from the supplied { @ link request mapping @ request mapping } annotation , which is either a directly declared annotation , a meta - annotation , or the synthesized result of merging annotation attributes within an annotation hierarchy

protected request mapping info create request mapping info ( request mapping request mapping , @ nullable request condition < ? > custom condition ) { request mapping info builder builder = request mapping info paths ( resolve embedded values in patterns ( request mapping path ( ) ) ) methods ( request mapping method ( ) ) params ( request mapping params ( ) ) headers ( request mapping headers ( ) ) consumes ( request mapping consumes ( ) ) produces ( request mapping produces ( ) ) mapping name ( request mapping name ( ) ) ; if ( custom condition ! = null ) { builder custom condition ( custom condition ) ; } return builder options ( this config ) build ( ) ; }


sets the formatter to be used for formatting the axis labels if no formatter is set , the chart will automatically determine a reasonable formatting ( concerning decimals ) for all the values that are drawn inside the chart use chart get default value formatter ( ) to use the formatter calculated by the chart

public void set value formatter ( i axis value formatter f ) { if ( f = = null ) m axis value formatter = new default axis value formatter ( m decimals ) ; else m axis value formatter = f ; }


get a list of possible resource ids from multi cache key or get single resource id from cache key

public static list < string > get resource ids ( final cache key key ) { try { final list < string > ids ; if ( key instanceof multi cache key ) { list < cache key > keys = ( ( multi cache key ) key ) get cache keys ( ) ; ids = new array list < > ( keys size ( ) ) ; for ( int i = 0 ; i < keys size ( ) ; i + + ) { ids add ( secure hash key ( keys get ( i ) ) ) ; } } else { ids = new array list < > ( 1 ) ; ids add ( key is resource id for debugging ( ) ? key get uri string ( ) : secure hash key ( key ) ) ; } return ids ; } catch ( unsupported encoding exception e ) { / / this should never happen all v ms support utf - 8 throw new runtime exception ( e ) ; } }


writes a d w a r fv 3 - style unsigned leb128 integer for details , see the " dalvik executable format " document or dwarf v 3 section 7 6

public int write uleb 1 2 8 ( int value ) ;


returns the objc provider for this target , or optional absent ( ) if there were no protos to generate

public optional < objc provider > get objc provider ( ) { return objc provider ; }


the { @ link executor } instance to be used when processing async method invocations

default executor get async executor ( ) { return null ; }


public long get next pointer ( ) { return internals get next pointer ( ) ; }


determines if the shard can be allocated on at least one node based on the allocation deciders returns the best allocation decision for allocating the shard on any node ( i e yes if at least one node decided yes , throttle if at least one node decided throttle , and no if none of the nodes decided yes or throttle ) if in explain mode , also returns the node - level explanations as the second element in the returned tuple

public static tuple < decision , map < string , node allocation result > > can be allocated to at least one node ( shard routing shard , routing allocation allocation ) { decision made decision = decision no ; final boolean explain = allocation debug decision ( ) ; map < string , node allocation result > node decisions = explain ? new hash map < > ( ) : null ; for ( object cursor < discovery node > cursor : allocation nodes ( ) get data nodes ( ) values ( ) ) { routing node node = allocation routing nodes ( ) node ( cursor value get id ( ) ) ; if ( node = = null ) { continue ; } / / if we can ' t allocate it on a node , ignore it , for example , this handles / / cases for only allocating a replica after a primary decision decision = allocation deciders ( ) can allocate ( shard , node , allocation ) ; if ( decision type ( ) = = decision type yes & & made decision type ( ) ! = decision type yes ) { if ( explain ) { made decision = decision ; } else { return tuple tuple ( decision , null ) ; } } else if ( made decision type ( ) = = decision type no & & decision type ( ) = = decision type throttle ) { made decision = decision ; } if ( explain ) { node decisions put ( node node id ( ) , new node allocation result ( node node ( ) , null , decision ) ) ; } } return tuple tuple ( made decision , node decisions ) ; }


extracts an integer argument with specified default value

private int int argument ( command line cli , string arg name , int default value ) { string o = cli get option value ( arg name ) ; try { if ( o ! = null ) { return integer parse int ( o ) ; } } catch ( number format exception ex ) { log error ( " couldn ' t parse value ( { } ) for option { } " + " using default : { } " , o , arg name , default value ) ; } return default value ; }


tests that we obtain the correct jobs overview

public void test stored jobs overview ( ) throws i o exception { final int number execution graphs = 10 ; final collection < archived execution graph > execution graphs = generate terminal execution graphs ( number execution graphs ) ; final list < job status > job statuses = execution graphs stream ( ) map ( archived execution graph : : get state ) collect ( collectors to list ( ) ) ; final jobs overview expected jobs overview = jobs overview create ( job statuses ) ; final file root dir = temporary folder new folder ( ) ; try ( final file archived execution graph store execution graph store = create default execution graph store ( root dir ) ) { for ( archived execution graph execution graph : execution graphs ) { execution graph store put ( execution graph ) ; } assert that ( execution graph store get stored jobs overview ( ) , matchers equal to ( expected jobs overview ) ) ; } }


determine whether alias overriding is allowed default is { @ code true }

protected boolean allow alias overriding ( ) { return true ; }


gets a string based on the array for a phase or sub - phase this string can then be used to identify the particular phase

private string get phase string ( string [ ] phase ) { string buffer buf = new string buffer ( ) ; buf append ( phase [ 0 ] ) ; for ( int i = 1 ; i < phase length ; i + + ) { buf append ( " : " + phase [ i ] ) ; } return buf to string ( ) ; }


< code > optional second msg blah = 2 ; < code >

public builder set blah ( org springframework protobuf second msg builder builder for value ) { if ( blah builder = = null ) { blah = builder for value build ( ) ; on changed ( ) ; } else { blah builder set message ( builder for value build ( ) ) ; } bit field 0 | = 0x 0 0 0 0 0 0 0 2 ; return this ; }


compute the path where the output of a given job attempt will be placed

protected abstract path get job attempt path ( int app attempt id ) ;


public void put ( @ non null final string key , final string value ) { put ( key , value , - 1 ) ; }


reset the state of the parser called as the very first method inside { @ link field parser # reset error state and parse ( byte [ ] , int , int , byte [ ] , object ) } , by default it just reset its error state

protected void reset parser state ( ) { this error state = parse error state none ; }


in this testcase , client is data nodes [ 0 ] , but data nodes [ 0 ] is not qualified to be chosen so the 1st replica should be placed on data nodes [ 1 ] , the 2nd replica should be placed on a different rack , the 3rd replica should be placed on the same rack as the 2nd replica , and the rest should be placed on the third rack

public void test choose target 3 ( ) throws exception { / / make data node 0 to be not qualified to choose update heartbeat with usage ( data nodes [ 0 ] , 2 * hdfs server constants min blocks for write * block size , 0l , ( hdfs server constants min blocks for write - 1 ) * block size , 0l , 0l , 0l , 0 , 0 ) ; / / no space datanode storage info [ ] targets ; targets = choose target ( 0 ) ; assert equals ( targets length , 0 ) ; targets = choose target ( 1 ) ; assert equals ( targets length , 1 ) ; assert equals ( storages [ 1 ] , targets [ 0 ] ) ; targets = choose target ( 2 ) ; assert equals ( targets length , 2 ) ; assert equals ( storages [ 1 ] , targets [ 0 ] ) ; assert false ( is on same rack ( targets [ 0 ] , targets [ 1 ] ) ) ; targets = choose target ( 3 ) ; assert equals ( targets length , 3 ) ; assert equals ( storages [ 1 ] , targets [ 0 ] ) ; assert true ( is on same rack ( targets [ 1 ] , targets [ 2 ] ) ) ; assert false ( is on same rack ( targets [ 0 ] , targets [ 1 ] ) ) ; targets = choose target ( 4 ) ; assert equals ( targets length , 4 ) ; assert equals ( storages [ 1 ] , targets [ 0 ] ) ; for ( int i = 1 ; i < 4 ; i + + ) { assert false ( is on same rack ( targets [ 0 ] , targets [ i ] ) ) ; } assert true ( is on same rack ( targets [ 1 ] , targets [ 2 ] ) | | is on same rack ( targets [ 2 ] , targets [ 3 ] ) ) ; assert false ( is on same rack ( targets [ 1 ] , targets [ 3 ] ) ) ; reset heartbeat for storages ( ) ; }


defer to { @ link abstract graph # edges ( ) } ( based on { @ link # successors ( object ) } ) for full edges ( ) implementation

protected long edge count ( ) { return delegate ( ) edges ( ) size ( ) ; }


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


schedules a clear media items action to be created

public builder clear media items ( ) { return apply ( new action clear media items ( tag ) ) ; }


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

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


sets a threshold that enforces a pre - filter roundtrip to pre - filter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold this filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie if date filters are mandatory to match but the shard bounds and the query are disjoint when unspecified , the pre - filter phase is executed if any of these conditions is met : the request targets more than 128 shards the request targets one or more read - only index the primary sort of the query targets an indexed field

public void set pre filter shard size ( int pre filter shard size ) { if ( pre filter shard size < 1 ) { throw new illegal argument exception ( " pre filter shard size must be > = 1 " ) ; } this pre filter shard size = pre filter shard size ; }


report a bad block which is hosted on the local dn

public void report bad blocks ( extended block block , fs volume spi volume ) throws i o exception { b p offer service bpos = get b p o s for block ( block ) ; bpos report bad blocks ( block , volume get storage i d ( ) , volume get storage type ( ) ) ; }


equivalent to { @ link # expect missing keys ( object [ ] ) expect missing keys } { @ code ( null ) } except that the call to { @ code contains ( null ) } is permitted to throw a { @ code null pointer exception }

protected void expect null key missing when null keys unsupported ( string message ) { try { assert false ( message , get map ( ) contains key ( null ) ) ; } catch ( null pointer exception tolerated ) { / / tolerated } }


deserializes the access control list object

public void read fields ( data input in ) throws i o exception { string acl string = text read string ( in ) ; build a c l ( acl string split ( " " , 2 ) ) ; }


public index request source ( x content builder source builder ) { return source ( bytes reference bytes ( source builder ) , source builder content type ( ) ) ; }


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


reports whether this thread is allowed to make recursive calls

public boolean is recursion allowed ( ) { return allow recursion ; }


returns a future that delegates to another but will finish early ( via a { @ link timeout exception } wrapped in an { @ link execution exception } ) if the specified duration expires the delegate future is interrupted and cancelled if it times out

public static < v > listenable future < v > with timeout ( listenable future < v > delegate , long time , time unit unit , scheduled executor service scheduled executor ) { if ( delegate is done ( ) ) { return delegate ; } return timeout future create ( delegate , time , unit , scheduled executor ) ; }


returns the next intercepter in the chain

r m admin request interceptor get next interceptor ( ) ;


witness classname list why need witness classname ? let ' s see like this : a library existed two released versions ( like 1 0 , 2 0 ) , which include the same target classes , but because of version iterator , they may have the same name , but different methods , or different method arguments list so , if i want to target the particular version ( let ' s say 1 0 for example ) , version number is obvious not an option , this is the moment you need " witness classes " you can add any classes only in this particular release version ( something like class com company 1 x a , only in 1 0 ) , and you can achieve the goal

protected string [ ] witness classes ( ) { return new string [ ] { } ; }


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

default response entity < void > test endpoint parameters ( @ api param ( value = " none " , required = true ) @ valid @ request part ( value = " number " , required = true ) big decimal number , @ api param ( value = " none " , required = true ) @ valid @ request part ( value = " double " , required = true ) double double , @ api param ( value = " none " , required = true ) @ valid @ request part ( value = " pattern without delimiter " , required = true ) string pattern without delimiter , @ api param ( value = " none " , required = true ) @ valid @ request part ( value = " byte " , required = true ) byte [ ] byte , @ api param ( value = " none " ) @ valid @ request part ( value = " integer " , required = false ) integer integer , @ api param ( value = " none " ) @ valid @ request part ( value = " int 3 2 " , required = false ) integer int 3 2 , @ api param ( value = " none " ) @ valid @ request part ( value = " int 6 4 " , required = false ) long int 6 4 , @ api param ( value = " none " ) @ valid @ request part ( value = " float " , required = false ) float float , @ api param ( value = " none " ) @ valid @ request part ( value = " string " , required = false ) string string , @ api param ( value = " none " ) @ valid @ request part ( value = " binary " , required = false ) multipart file binary , @ api param ( value = " none " ) @ valid @ request part ( value = " date " , required = false ) local date date , @ api param ( value = " none " ) @ valid @ request part ( value = " date time " , required = false ) offset date time date time , @ api param ( value = " none " ) @ valid @ request part ( value = " password " , required = false ) string password , @ api param ( value = " none " ) @ valid @ request part ( value = " callback " , required = false ) string param callback ) { return new response entity < > ( http status not implemented ) ; }


looks for a key with the same descriptor as the input key , which has a configuration that trimmed to a subset of the input key ' s note that this is not referring to a proper subset ; it ' s quite possible for a key to " trim " to a configuration equal to its configuration that is , without anything being removed if such a key has been added to this cache , it is returned in a present { @ link optional } invoking this key will produce the same result as invoking the input key if no such key has been added to this cache , or if a key has been added to the cache and subsequently been the subject of an { @ link # invalidate ( key t ) } , an absent optional will be returned instead no currently - valid key has trimmed to an equivalent configuration , and so the input key should be executed

public optional < key t > get ( key t input ) { descriptor t descriptor = get descriptor for ( input ) ; concurrent hash map < configuration t , key and state < key t > > trimmings of descriptor = descriptors get ( descriptor ) ; if ( trimmings of descriptor = = null ) { / / there are no entries at all for this descriptor return optional empty ( ) ; } configuration t candidate configuration = get configuration for ( input ) ; for ( entry < configuration t , key and state < key t > > entry : trimmings of descriptor entry set ( ) ) { configuration t trimmed config = entry get key ( ) ; key and state < key t > canonical key and state = entry get value ( ) ; if ( can substitute for ( candidate configuration , trimmed config , canonical key and state ) ) { return optional of ( canonical key and state get key ( ) ) ; } } return optional empty ( ) ; }


extends the amount of time after which the result will expire ( defaults to no extension )

public get async result request set keep alive ( time value time value ) { this keep alive = time value ; return this ; }


advances the position until after the next newline character if the line is terminated by " \ r \ n " , the ' \ n ' must be consumed as whitespace by the caller

private void skip to end of line ( ) throws i o exception { long index = source index of element ( linefeed or carriage return ) ; buffer skip ( index ! = - 1 ? index + 1 : buffer size ( ) ) ; }


void error ( location location , string message , throwable error ) ;


loads from a deflated ( ! ) input stream

public static void load ( input stream is , world context context ) throws save exception { try ( counter input stream counter = new counter input stream ( is ) ; data input stream stream = new data input stream ( counter ) ) { logic reset ( ) ; read header ( stream ) ; int version = stream read int ( ) ; save version ver = versions get ( version ) ; ver read ( stream , counter , context ) ; events fire ( new save load event ( ) ) ; } catch ( throwable e ) { throw new save exception ( e ) ; } finally { world set generating ( false ) ; content set temporary mapper ( null ) ; } }


public static drawable get activity icon ( @ non null final component name activity name ) { package manager pm = utils get app ( ) get package manager ( ) ; try { return pm get activity icon ( activity name ) ; } catch ( package manager name not found exception e ) { e print stack trace ( ) ; return null ; } }


makes a { @ link catch table # entry } for the given block range and handlers

private static catch table entry make entry ( basic block start , basic block end , catch handler list handlers , block addresses addresses ) { / * * we start at the * last * instruction of the start block , since * that ' s the instruction that can throw * / code address start address = addresses get last ( start ) ; / / and we end * after * the last instruction of the end block code address end address = addresses get end ( end ) ; return new catch table entry ( start address get address ( ) , end address get address ( ) , handlers ) ; }


public j s o n writer value ( long l ) throws j s o n exception { return this append ( long to string ( l ) ) ; }


get the namenode mapping from the subclusters from the membership store as the routers are usually co - located with namenodes , we also check for the local address for this router here

private map < string , string > get namenodes subcluster ( membership store membership store ) { / / manage requests from this hostname ( 127 0 0 1 ) string local ip = " 127 0 0 1 " ; string local hostname = local ip ; try { local hostname = inet address get local host ( ) get host name ( ) ; } catch ( unknown host exception e ) { log error ( " cannot get local host name " ) ; } map < string , string > ret = new hash map < > ( ) ; try { / / get the values from the store get namenode registrations request request = get namenode registrations request new instance ( ) ; get namenode registrations response response = membership store get namenode registrations ( request ) ; final list < membership state > nns = response get namenode memberships ( ) ; for ( membership state nn : nns ) { try { string ns id = nn get nameservice id ( ) ; string rpc address = nn get rpc address ( ) ; string hostname = host and port from string ( rpc address ) get host ( ) ; ret put ( hostname , ns id ) ; if ( hostname equals ( local hostname ) ) { ret put ( local ip , ns id ) ; } inet address addr = inet address get by name ( hostname ) ; string ip addr = addr get host address ( ) ; ret put ( ip addr , ns id ) ; } catch ( exception e ) { log error ( " cannot get address for { } : { } " , nn , e get message ( ) ) ; } } } catch ( i o exception ioe ) { log error ( " cannot get namenodes from the state store " , ioe ) ; } return ret ; }


disassemble an instruction , presumably the result of assembly

protected pseudo instruction disassemble ( long addr , byte [ ] ins , byte [ ] ctx ) throws insufficient bytes exception , unknown instruction exception , address overflow exception , memory access exception { address at = lang get default space ( ) get address ( addr ) ; context set context register ( ctx ) ; mem buffer buf = new byte mem buffer impl ( at , ins , lang is big endian ( ) ) ; sleigh debug logger logger = new sleigh debug logger ( buf , context , lang , sleigh debug mode verbose ) ; instruction prototype ip = lang parse ( buf , context , false ) ; if ( verbose dis ) { dbg println ( " sleigh log : \ n " + logger to string ( ) ) ; } return new pseudo instruction ( at , ip , buf , context ) ; }


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


gets all the { @ link buildable item } s that are waiting for an executor in the given { @ link computer }

public list < buildable item > get buildable items ( computer c ) { snapshot snapshot = this snapshot ; list < buildable item > result = new array list < > ( ) ; get buildable items ( c , snapshot buildables , result ) ; get buildable items ( c , snapshot pendings , result ) ; return result ; }


set the { @ link database populator } to execute during the bean destruction phase , cleaning up the database and leaving it in a known state for others

public void set database cleaner ( database populator database cleaner ) { this database cleaner = database cleaner ; }


returns an immutable set containing each of { @ code elements } , minus duplicates , in the order each appears first in the source iterable this method iterates over { @ code elements } only once < b > performance note : < b > this method will sometimes recognize that the actual copy operation is unnecessary ; for example , { @ code copy of ( copy of ( an array list ) ) } should copy the data only once this reduces the expense of habitually making defensive copies at api boundaries however , the precise conditions for skipping the copy operation are undefined

public static < e > immutable set < e > copy of ( iterable < ? extends e > elements ) { return ( elements instanceof collection ) ? copy of ( ( collection < ? extends e > ) elements ) : copy of ( elements iterator ( ) ) ; }


log the throwable , which occurs in dubbo rpc service

private void deal exception ( throwable throwable ) { abstract span span = context manager active span ( ) ; span log ( throwable ) ; }


hack to rethrow unknown exceptions from compile :

static < t extends throwable > void rethrow ( throwable t ) throws t { throw ( t ) t ; }


called when resource offers are made to the framework

private void resource offers ( resource offers message ) { launch coordinator tell ( message , self actor ) ; }


gets the maximum alignment value that is allowed by this data organization when getting an alignment for any data type it will not exceed this value if no maximum alignment is returned , the data organization isn ' t specifically limited

public int get absolute max alignment ( ) { return absolute max alignment ; }


create a metric name with the given name , group , description and tags , plus default tags specified in the metric configuration tag in tags takes precedence if the same tag key is specified in the default metric configuration

public metric name metric name ( string name , string group , string description , map < string , string > tags ) { map < string , string > combined tag = new linked hash map < > ( config tags ( ) ) ; combined tag put all ( tags ) ; return new metric name ( name , group , description , combined tag ) ; }


sets the < code > int 6 4 < code > property


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