mark this { @ link buffer builder } and associated { @ link buffer consumer } as finished - no new data writes will be allowed this method should be idempotent to handle failures and task interruptions check flink - 8948 for more details

public int finish ( ) { int written bytes = position marker mark finished ( ) ; commit ( ) ; return written bytes ; }


service startup : create the secret manager

protected void service start ( ) throws exception { super service start ( ) ; secret manager = create secret mananger ( ) ; }


determine preferred constructors to use for default construction , if any constructor arguments will be autowired if necessary

public constructor < ? > [ ] get preferred constructors ( ) { return null ; }


get the simple regular expression that can be used to identify timestamps of the selected format in almost any programming language

public pattern get simple pattern ( ) { if ( matched formats is empty ( ) ) { / / if error on no timestamp is set and we get here it means no samples have been added , which is likely a programmer mistake assert error on no timestamp = = false ; return null ; } return matched formats get ( 0 ) simple pattern ; }


public void put job ( put job action request request , analysis registry analysis registry , cluster state state , action listener < put job action response > action listener ) throws i o exception { job builder job builder = request get job builder ( ) ; job builder validate analysis limits and set defaults ( max model memory limit ) ; job builder validate model snapshot retention settings and set defaults ( ) ; validate categorization analyzer ( job builder , analysis registry ) ; job job = job builder build ( new date ( ) ) ; if ( job get data description ( ) ! = null & & job get data description ( ) get format ( ) = = data description data format delimited ) { deprecation logger deprecate ( " ml create job delimited data " , " creating jobs with delimited data format is deprecated please use xcontent instead " ) ; } / / check for the job in the cluster state first ml metadata current ml metadata = ml metadata get ml metadata ( state ) ; if ( current ml metadata get jobs ( ) contains key ( job get id ( ) ) ) { action listener on failure ( exceptions helper job already exists ( job get id ( ) ) ) ; return ; } action listener < boolean > put job listener = new action listener < > ( ) { @ override public void on response ( boolean mappings updated ) { job config provider put job ( job , action listener wrap ( response - > { auditor info ( job get id ( ) , messages get message ( messages job audit created ) ) ; action listener on response ( new put job action response ( job ) ) ; } , action listener : : on failure ) ) ; } @ override public void on failure ( exception e ) { if ( exceptions helper unwrap cause ( e ) instanceof illegal argument exception ) { / / the underlying error differs depending on which way around the clashing fields are seen matcher matcher = pattern compile ( " can ' t merge a non object mapping \ \ [ ( * ) \ \ ] with an object mapping " ) matcher ( e get message ( ) ) ; if ( matcher matches ( ) ) { string msg = messages get message ( messages job config mapping type clash , matcher group ( 1 ) ) ; action listener on failure ( exceptions helper bad request exception ( msg , e ) ) ; return ; } } action listener on failure ( e ) ; } } ; action listener < boolean > add doc mappings listener = action listener wrap ( indices created - > { if ( state = = null ) { logger warn ( " cannot update doc mapping because cluster state = = null " ) ; put job listener on response ( false ) ; return ; } elasticsearch mappings add doc mapping if missing ( ml config index index name ( ) , ml config index : : mapping , client , state , put job listener ) ; } , put job listener : : on failure ) ; action listener < list < string > > check for left over docs = action listener wrap ( matched ids - > { if ( matched ids is empty ( ) ) { job results provider create job result index ( job , state , add doc mappings listener ) ; } else { / / a job has the same id as one of the group names / / error with the first in the list action listener on failure ( new resource already exists exception ( messages get message ( messages job and group names must be unique , matched ids get ( 0 ) ) ) ) ; } } , action listener : : on failure ) ; action listener < boolean > check no jobs with group id = action listener wrap ( group exists - > { if ( group exists ) { action listener on failure ( new resource already exists exception ( messages get message ( messages job and group names must be unique , job get id ( ) ) ) ) ; return ; } if ( job get groups ( ) is empty ( ) ) { check for left over docs on response ( collections empty list ( ) ) ; } else { job config provider job id matches ( job get groups ( ) , check for left over docs ) ; } } , action listener : : on failure ) ; action listener < boolean > check no group with the job id = action listener wrap ( ok - > job config provider group exists ( job get id ( ) , check no jobs with group id ) , action listener : : on failure ) ; job config provider job exists ( job get id ( ) , false , action listener wrap ( job exists - > { if ( job exists ) { action listener on failure ( exceptions helper job already exists ( job get id ( ) ) ) ; } else { job results provider check for left over documents ( job , check no group with the job id ) ; } } , action listener : : on failure ) ) ; }


format an array of pcode op tpl objects as a multi - line string

public string to string ( program program , op tpl [ ] pcode op templates ) { boolean indent = has label ( pcode op templates ) ; string buffer buf = new string buffer ( ) ; for ( int i = 0 ; i < pcode op templates length ; i + + ) { if ( max display lines > 0 & & i > = max display lines ) { break ; } attributed string line = format op tpl ( program , pcode op templates [ i ] , indent ) ; if ( buf length ( ) ! = 0 ) { buf append ( eol ) ; } buf append ( line to string ( ) ) ; } return buf to string ( ) ; }


sets the ingest pipeline to be executed before indexing the document

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


public event type get event type ( ) { return event type job priority changed ; }


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


gets the address of the component containing the es type list address , if there is one otherwise , this returns null

public address get component address of e s type list address ( ) throws undefined value exception , invalid data type exception { check validity ( ) ; if ( is v 2 | | is v 3 ) { / / component 7 or 8 is e s type list pointer or displacement return e h data type utilities get component address ( get data type ( ) , ( is relative ( ) ? 8 : 7 ) , get mem buffer ( ) ) ; } throw new undefined value exception ( " no e s type list address , since not a version 2 or 3 func info structure " ) ; }


returns a multimap containing the mappings in { @ code unfiltered } whose keys satisfy a predicate the returned multimap is a live view of { @ code unfiltered } ; changes to one affect the other the resulting multimap ' s views have iterators that don ' t support { @ code remove ( ) } , but all other methods are supported by the multimap and its views when adding a key that doesn ' t satisfy the predicate , the multimap ' s { @ code put ( ) } , { @ code put all ( ) } , and { @ code replace values ( ) } methods throw an { @ link illegal argument exception } when methods such as { @ code remove all ( ) } and { @ code clear ( ) } are called on the filtered multimap or its views , only mappings whose keys satisfy the filter will be removed from the underlying multimap the returned multimap isn ' t threadsafe or serializable , even if { @ code unfiltered } is many of the filtered multimap ' s methods , such as { @ code size ( ) } , iterate across every keyvalue mapping in the underlying multimap and determine which satisfy the filter when a live view is not needed , it may be faster to copy the filtered multimap and use the copy < b > warning : < b > { @ code key predicate } must be consistent with equals , as documented at { @ link predicate # apply } do not provide a predicate such as { @ code predicates instance of ( array list class ) } , which is inconsistent with equals

public static < k , v > multimap < k , v > filter keys ( multimap < k , v > unfiltered , final predicate < ? super k > key predicate ) { if ( unfiltered instanceof set multimap ) { return filter keys ( ( set multimap < k , v > ) unfiltered , key predicate ) ; } else if ( unfiltered instanceof list multimap ) { return filter keys ( ( list multimap < k , v > ) unfiltered , key predicate ) ; } else if ( unfiltered instanceof filtered key multimap ) { filtered key multimap < k , v > prev = ( filtered key multimap < k , v > ) unfiltered ; return new filtered key multimap < > ( prev unfiltered , predicates < k > and ( prev key predicate , key predicate ) ) ; } else if ( unfiltered instanceof filtered multimap ) { filtered multimap < k , v > prev = ( filtered multimap < k , v > ) unfiltered ; return filter filtered ( prev , maps < k > key predicate on entries ( key predicate ) ) ; } else { return new filtered key multimap < > ( unfiltered , key predicate ) ; } }


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


returns whether this result is equivalent to { @ code other } for the renderer at the given index the results are equivalent if they have equal track selections and configurations for the renderer

public boolean is equivalent ( @ nullable track selector result other , int index ) { if ( other = = null ) { return false ; } return util are equal ( renderer configurations [ index ] , other renderer configurations [ index ] ) & & util are equal ( selections get ( index ) , other selections get ( index ) ) ; }


test correctness of successive snapshot creation and deletion on a system with encryption zones

public void test snapshots on encryption zones ( ) throws exception { final string test key2 = " testkey 2 " ; d f s test util create key ( test key2 , cluster , conf ) ; final int len = 8196 ; final path zone parent = new path ( " / zones " ) ; final path zone = new path ( zone parent , " zone " ) ; final path zone file = new path ( zone , " zone file " ) ; fs wrapper mkdir ( zone , fs permission get dir default ( ) , true ) ; dfs admin allow snapshot ( zone parent ) ; dfs admin create encryption zone ( zone , test key , no trash ) ; d f s test util create file ( fs , zone file , len , ( short ) 1 , 0x f e e d ) ; string contents = d f s test util read file ( fs , zone file ) ; final path snap 1 = fs create snapshot ( zone parent , " snap 1 " ) ; final path snap 1 zone = new path ( snap 1 , zone get name ( ) ) ; assert equals ( " got unexpected ez path " , zone to string ( ) , dfs admin get encryption zone for path ( snap 1 zone ) get path ( ) to string ( ) ) ; / / now delete the encryption zone , recreate the dir , and take another / / snapshot fs wrapper delete ( zone , true ) ; fs wrapper mkdir ( zone , fs permission get dir default ( ) , true ) ; final path snap 2 = fs create snapshot ( zone parent , " snap 2 " ) ; final path snap 2 zone = new path ( snap 2 , zone get name ( ) ) ; assert equals ( " got unexpected ez path " , zone to string ( ) , dfs admin get encryption zone for path ( snap 1 zone ) get path ( ) to string ( ) ) ; assert null ( " expected null ez path " , dfs admin get encryption zone for path ( snap 2 zone ) ) ; / / create the encryption zone again , and that shouldn ' t affect old snapshot dfs admin create encryption zone ( zone , test key2 , no trash ) ; encryption zone ez snap 1 = dfs admin get encryption zone for path ( snap 1 zone ) ; assert equals ( " got unexpected ez path " , zone to string ( ) , ez snap 1 get path ( ) to string ( ) ) ; assert equals ( " unexpected ez key " , test key , ez snap 1 get key name ( ) ) ; assert null ( " expected null ez path " , dfs admin get encryption zone for path ( snap 2 zone ) ) ; final path snap 3 = fs create snapshot ( zone parent , " snap 3 " ) ; final path snap 3 zone = new path ( snap 3 , zone get name ( ) ) ; / / check that snap 3 ' s ez has the correct settings encryption zone ez snap 3 = dfs admin get encryption zone for path ( snap 3 zone ) ; assert equals ( " got unexpected ez path " , zone to string ( ) , ez snap 3 get path ( ) to string ( ) ) ; assert equals ( " unexpected ez key " , test key2 , ez snap 3 get key name ( ) ) ; / / check that older snapshots still have the old ez settings ez snap 1 = dfs admin get encryption zone for path ( snap 1 zone ) ; assert equals ( " got unexpected ez path " , zone to string ( ) , ez snap 1 get path ( ) to string ( ) ) ; assert equals ( " unexpected ez key " , test key , ez snap 1 get key name ( ) ) ; assert null ( " expected null ez path " , dfs admin get encryption zone for path ( snap 2 zone ) ) ; / / check that list e zs only shows the current filesystem state array list < encryption zone > list zones = lists new array list ( ) ; remote iterator < encryption zone > it = dfs admin list encryption zones ( ) ; while ( it has next ( ) ) { list zones add ( it next ( ) ) ; } for ( encryption zone z : list zones ) { system out println ( z ) ; } assert equals ( " did not expect additional encryption zones ! " , 1 , list zones size ( ) ) ; encryption zone list zone = list zones get ( 0 ) ; assert equals ( " got unexpected ez path " , zone to string ( ) , list zone get path ( ) to string ( ) ) ; assert equals ( " unexpected ez key " , test key2 , list zone get key name ( ) ) ; / / verify contents of the snapshotted file final path snapshotted zone file = new path ( snap 1 to string ( ) + " / " + zone get name ( ) + " / " + zone file get name ( ) ) ; assert equals ( " contents of snapshotted file have changed unexpectedly " , contents , d f s test util read file ( fs , snapshotted zone file ) ) ; / / now delete the snapshots out of order and verify the zones are still / / correct fs delete snapshot ( zone parent , snap 2 get name ( ) ) ; assert equals ( " got unexpected ez path " , zone to string ( ) , dfs admin get encryption zone for path ( snap 1 zone ) get path ( ) to string ( ) ) ; assert equals ( " got unexpected ez path " , zone to string ( ) , dfs admin get encryption zone for path ( snap 3 zone ) get path ( ) to string ( ) ) ; fs delete snapshot ( zone parent , snap 1 get name ( ) ) ; assert equals ( " got unexpected ez path " , zone to string ( ) , dfs admin get encryption zone for path ( snap 3 zone ) get path ( ) to string ( ) ) ; }


returns a sequence of events where some items are more popular than others , according to a zipfian distribution unlike { @ link # zipfian } , the generated sequence scatters the " popular " items across the item space use if you don ' t want the head of the distribution ( the popular items ) clustered together

public static long stream scrambled zipfian ( int items , double constant , int events ) { return generate ( new scrambled zipfian generator ( 0 , items - 1 , constant ) , events ) ; }


public int get hit count ( ) { return this hit count get ( ) ; }


prepare the { @ code media type } to use by adding " boundary " and " charset " parameters to the given { @ code media type } or " mulitpartform - data " otherwise by default

protected media type get multipart media type ( @ nullable media type media type , byte [ ] boundary ) { map < string , string > params = new hash map < > ( ) ; if ( media type ! = null ) { params put all ( media type get parameters ( ) ) ; } params put ( " boundary " , new string ( boundary , standard charsets us ascii ) ) ; charset charset = get charset ( ) ; if ( ! charset equals ( standard charsets utf 8 ) & & ! charset equals ( standard charsets us ascii ) ) { params put ( " charset " , charset name ( ) ) ; } media type = ( media type ! = null ? media type : media type multipart form data ) ; media type = new media type ( media type , params ) ; return media type ; }


public void fade in all layers ( ) { m transition state = transition starting ; arrays fill ( m is layer on , true ) ; invalidate self ( ) ; }


filters all exceptions that match the predicate by applying the given response provider function for instance , the following example creates a filter that returns a 500 response status when an { @ code illegal state exception } occurs < pre class = " code " > router function & lt ; server response & gt ; filtered route = router functions route ( ) get ( " user " , this : : list users ) on error ( e - > e instanceof illegal state exception , ( e , request ) - > server response status ( http status internal server error ) build ( ) ) build ( ) ;

builder on error ( predicate < throwable > predicate , bi function < throwable , server request , server response > response provider ) ;


returns { @ code true } if this { @ link endpoint pair } is an ordered pair ( i e represents the endpoints of a directed edge )

public abstract boolean is ordered ( ) ;


returns the field ' s content using the specified field name note : the row must operate in name - based field mode this method avoids a lot of manual casting in the user implementation

public < t > t get field as ( string name ) { return ( t ) get field ( name ) ; }


this test validates that vertices with too many input streams do not have a location preference any more

public void test no locality input large all to all ( ) throws exception { final int parallelism = 100 ; final execution graph graph = create test graph ( parallelism , true ) ; / / set the location for all sources to a distinct location for ( int i = 0 ; i < parallelism ; i + + ) { execution vertex source = graph get all vertices ( ) get ( source vertex id ) get task vertices ( ) [ i ] ; task manager location location = new task manager location ( resource i d generate ( ) , inet address get loopback address ( ) , 10000 + i ) ; initialize location ( source , location ) ; } / / validate that the target vertices have no location preference for ( int i = 0 ; i < parallelism ; i + + ) { execution vertex target = graph get all vertices ( ) get ( target vertex id ) get task vertices ( ) [ i ] ; iterator < completable future < task manager location > > preference = target get preferred locations ( ) iterator ( ) ; assert false ( preference has next ( ) ) ; } }


create a new advisor that will expose the given bean name , with no introduction

public static advisor create advisor without introduction ( string bean name ) { return new default pointcut advisor ( new expose bean name interceptor ( bean name ) ) ; }


create an activation framework data source for the given input stream source

protected data source create data source ( final input stream source input stream source , final string content type , final string name ) { return new data source ( ) { @ override public input stream get input stream ( ) throws i o exception { return input stream source get input stream ( ) ; } @ override public output stream get output stream ( ) { throw new unsupported operation exception ( " read - only javax activation data source " ) ; } @ override public string get content type ( ) { return content type ; } @ override public string get name ( ) { return name ; } } ; }


called before a { @ link computer launcher } is asked to launch a connection with { @ link computer } this enables you to do some configurable checks to see if we want to bring this agent online or if there are considerations that would keep us from doing so throwing { @ link abort exception } would let you veto the launch operation other thrown exceptions will also have the same effect , but their stack trace will be dumped , so they are meant for error situation

public void pre launch ( computer c , task listener task listener ) throws i o exception , interrupted exception { }


returns the relatively qualified name for < var > file suffix < var > e g for a file suffix = ' foo xml ' , this method will return ' aspect j auto proxy creator tests - foo xml '

private string q name ( string file suffix ) { return string format ( " % s - % s " , get class ( ) get simple name ( ) , file suffix ) ; }


testing only ! ! ! really ! ! ! ! this is only here to test when the client disconnects from the server wo sending a session disconnect ( ie ending the session cleanly ) the server will eventually notice the client is no longer pinging and will timeout the session

public void disconnect ( ) throws i o exception { cnxn disconnect ( ) ; }


sets the list of index settings and index settings groups that shouldn ' t be restored from snapshot

public restore snapshot request ignore index settings ( string ignore index settings ) { this ignore index settings = ignore index settings ; return this ; }


returns how long after the last write to an entry the map will retain that entry

protected long expires after write nanos ( ) { throw new unsupported operation exception ( ) ; }


defines a field using a supplied predicate

public expression model define field ( string name , object value , predicate < field expression field value > predicate ) { this field values put ( name , value ) ; this field predicates put ( name , predicate ) ; return this ; }


public redis connection config builder with database ( int database ) { assert util is true ( database > = 0 , " invalid database number : " + database ) ; this database = database ; return this ; }


get the domain object for the selected version

public domain object get selected version ( object consumer , boolean read only ) { int row = table get selected row ( ) ; if ( row > = 0 ) { version version = table model get version at ( row ) ; return get versioned object ( consumer , version get version ( ) , read only ) ; } return null ; }


finalizes the configuration and checks validity

public jdbc output format finish ( ) { return new jdbc output format ( new simple jdbc connection provider ( build connection options ( ) ) , query , types array , batch size ) ; }


move all the source files that should be renamed or deleted to the tmp directory

private void move to tmp dir ( diff info [ ] diffs , distributed file system target fs , path tmp dir ) throws i o exception { / / sort the diffs based on their source paths to make sure the files and / / subdirs are moved before moving their parents / ancestors arrays sort ( diffs , diff info source comparator ) ; random random = new random ( ) ; for ( diff info diff : diffs ) { path tmp target = new path ( tmp dir , diff get source ( ) get name ( ) ) ; while ( target fs exists ( tmp target ) ) { tmp target = new path ( tmp dir , diff get source ( ) get name ( ) + random next int ( ) ) ; } diff set tmp ( tmp target ) ; target fs rename ( diff get source ( ) , tmp target ) ; } }


this function takes a { @ link completable future } and a handler function for the result of this future if the input future is already done , this function returns { @ link completable future # handle ( bi function ) } otherwise , the return value is { @ link completable future # handle async ( bi function , executor ) } with the given executor

public static < in , out > completable future < out > handle async if not done ( completable future < in > completable future , executor executor , bi function < ? super in , throwable , ? extends out > handler ) { return completable future is done ( ) ? completable future handle ( handler ) : completable future handle async ( handler , executor ) ; }


upgrades the enumeration data type values table from the old adapter ' s version to the current version

static enum value d b adapter upgrade ( d b handle handle , enum value d b adapter old adapter ) throws version exception , i o exception { return new enum value d b adapter v 0 ( handle , true ) ; }


public static options get cancel options ( ) { return cancel options ; }


loads bytes in a particular format as a new { @ link domain object } multiple { @ link domain object } s may end up getting created , depending on the nature of the format

public list < domain object > load ( byte provider provider , string name , domain folder folder , load spec load spec , list < option > options , message log message log , object consumer , task monitor monitor ) throws i o exception , cancelled exception , duplicate name exception , invalid name exception , version exception ;


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

public void delete user test ( ) { string username = null ; / / api delete user ( username ) ; / / todo : test validations }


public list < update container request > get demotion requests ( ) { return demotion requests ; }


ensure that we fetch the latest shard store from the primary when a new node joins so we won ' t cancel the current recovery for the copy on the newly joined node unless we can perform a noop recovery with that node

public void test recent primary information ( ) throws exception { string index name = " test " ; string node with primary = internal cluster ( ) start node ( ) ; assert acked ( client ( ) admin ( ) indices ( ) prepare create ( index name ) set settings ( settings builder ( ) put ( index metadata setting number of shards , 1 ) put ( index metadata setting number of replicas , 1 ) put ( index settings file based recovery threshold setting get key ( ) , 0 1f ) put ( index service global checkpoint sync interval setting get key ( ) , " 1 0 0ms " ) put ( index service retention lease sync interval setting get key ( ) , " 1 0 0ms " ) put ( unassigned info index delayed node left timeout setting get key ( ) , " 1ms " ) ) ) ; string node with replica = internal cluster ( ) start data only node ( ) ; discovery node disco node with replica = internal cluster ( ) get instance ( cluster service class , node with replica ) local node ( ) ; settings node with replica settings = internal cluster ( ) data path settings ( node with replica ) ; ensure green ( index name ) ; index random ( random boolean ( ) , false , random boolean ( ) , int stream range ( 0 , between ( 10 , 100 ) ) map to obj ( n - > client ( ) prepare index ( index name ) set source ( " f " , " v " ) ) collect ( collectors to list ( ) ) ) ; internal cluster ( ) stop random node ( internal test cluster name filter ( node with replica ) ) ; if ( random boolean ( ) ) { index random ( random boolean ( ) , false , random boolean ( ) , int stream range ( 0 , between ( 10 , 100 ) ) map to obj ( n - > client ( ) prepare index ( index name ) set source ( " f " , " v " ) ) collect ( collectors to list ( ) ) ) ; } count down latch block recovery = new count down latch ( 1 ) ; count down latch recovery started = new count down latch ( 1 ) ; mock transport service transport service on primary = ( mock transport service ) internal cluster ( ) get instance ( transport service class , node with primary ) ; transport service on primary add send behavior ( ( connection , request id , action , request , options ) - > { if ( peer recovery target service actions files info equals ( action ) ) { recovery started count down ( ) ; try { block recovery await ( ) ; } catch ( interrupted exception e ) { thread current thread ( ) interrupt ( ) ; } } connection send request ( request id , action , request , options ) ; } ) ; string new node = internal cluster ( ) start data only node ( ) ; recovery started await ( ) ; / / index more documents and flush to destroy sync id and remove the retention lease ( as file based recovery threshold reached ) index random ( random boolean ( ) , random boolean ( ) , random boolean ( ) , int stream range ( 0 , between ( 50 , 200 ) ) map to obj ( n - > client ( ) prepare index ( index name ) set source ( " f " , " v " ) ) collect ( collectors to list ( ) ) ) ; client ( ) admin ( ) indices ( ) prepare flush ( index name ) get ( ) ; assert busy ( ( ) - > { for ( shard stats shard stats : client ( ) admin ( ) indices ( ) prepare stats ( index name ) get ( ) get shards ( ) ) { for ( retention lease lease : shard stats get retention lease stats ( ) retention leases ( ) leases ( ) ) { assert that ( lease id ( ) , not ( equal to ( replication tracker get peer recovery retention lease id ( disco node with replica get id ( ) ) ) ) ) ; } } } ) ; / / allocation service only calls gateway allocator if there are unassigned shards assert acked ( client ( ) admin ( ) indices ( ) prepare create ( " dummy - index " ) set wait for active shards ( 0 ) set settings ( settings builder ( ) put ( " index routing allocation require attr " , " not - found " ) ) ) ; internal cluster ( ) start data only node ( node with replica settings ) ; / / need to wait for events to ensure the reroute has happened since we perform it async when a new node joins client ( ) admin ( ) cluster ( ) prepare health ( index name ) set wait for yellow status ( ) set wait for events ( priority languid ) get ( ) ; block recovery count down ( ) ; ensure green ( index name ) ; assert that ( internal cluster ( ) nodes include ( index name ) , has item ( new node ) ) ; for ( recovery state recovery : client ( ) admin ( ) indices ( ) prepare recoveries ( index name ) get ( ) shard recovery states ( ) get ( index name ) ) { if ( recovery get primary ( ) = = false ) { assert that ( recovery get index ( ) file details ( ) , not ( empty ( ) ) ) ; } } transport service on primary clear all rules ( ) ; }


this implementations expects the other object to be of type bean component definition as well , in addition to the superclass ' s equality requirements

public boolean equals ( @ nullable object other ) { return ( this = = other | | ( other instanceof bean component definition & & super equals ( other ) ) ) ; }


returns the name filter that is applied to ear files in this entry , if any

public list get ear filter ( ) { return ear filter ; }


public void test enum arrays ( ) { / / todo : test enum arrays }


sets the { @ link nodes sniffer } to be used to read hosts a default instance of { @ link elasticsearch nodes sniffer } is created when not provided this method can be used to change the configuration of the { @ link elasticsearch nodes sniffer } , or to provide a different implementation ( e g in case hosts need to taken from a different source )

public sniffer builder set nodes sniffer ( nodes sniffer nodes sniffer ) { objects require non null ( nodes sniffer , " nodes sniffer cannot be null " ) ; this nodes sniffer = nodes sniffer ; return this ; }


links a ( potentially multi - architecture ) binary targeting apple platforms this method comprises a bulk of the logic of the { @ code apple binary } rule , and is statically available so that it may be referenced by starlark a p is that replicate its functionality

public static apple binary output link multi arch binary ( rule context rule context , iterable < string > extra linkopts , iterable < artifact > extra link inputs , boolean is stamping enabled ) throws interrupted exception , rule error exception , action conflict exception { multi arch split transition provider validate minimum os ( rule context ) ; platform type platform type = multi arch split transition provider get platform type ( rule context ) ; apple configuration apple configuration = rule context get fragment ( apple configuration class ) ; apple platform platform = null ; try { platform = apple configuration get multi arch platform ( platform type ) ; } catch ( illegal argument exception e ) { rule context throw with rule error ( e ) ; } immutable list multimap < string , transitive info collection > cpu to deps collection map = multi arch binary support transform map ( rule context get prerequisites by configuration ( " deps " ) ) ; immutable list multimap < string , configured target and data > cpu to c t a t deps collection map = multi arch binary support transform map ( rule context get prerequisite cofigured target and targets by configuration ( " deps " ) ) ; immutable map < build configuration , cc toolchain provider > child configurations and toolchains = multi arch binary support get child configurations and toolchains ( rule context ) ; artifact output artifact = objc rule classes intermediate artifacts ( rule context ) combined architecture binary ( ) ; multi arch binary support multi arch binary support = new multi arch binary support ( rule context ) ; immutable set < dependency specific configuration > dependency specific configurations = multi arch binary support get dependency specific configurations ( child configurations and toolchains , cpu to deps collection map , cpu to c t a t deps collection map , get dylib provider targets ( rule context ) ) ; map < string , nested set < artifact > > output group collector = new tree map < > ( ) ; iterable < artifact > all link inputs = iterables concat ( get required link inputs ( rule context ) , extra link inputs ) ; extra link args all linkopts = new extra link args ( iterables concat ( get required linkopts ( rule context ) , extra linkopts ) ) ; nested set < artifact > binaries to lipo = multi arch binary support register actions ( all linkopts , dependency specific configurations , all link inputs , is stamping enabled , cpu to deps collection map , output group collector ) ; new lipo support ( rule context ) register combine architectures action ( binaries to lipo , output artifact , platform ) ; immutable list multimap < build configuration , output group info > build config to output group info map = rule context get prerequisites by configuration ( " deps " , output group info starlark constructor ) ; nested set builder < artifact > header tokens = nested set builder stable order ( ) ; for ( map entry < build configuration , output group info > entry : build config to output group info map entries ( ) ) { output group info dep = entry get value ( ) ; header tokens add transitive ( dep get output group ( cc compilation helper hidden header tokens ) ) ; } output group collector put ( output group info validation , header tokens build ( ) ) ; objc provider builder objc provider builder = new objc provider native builder ( rule context get analysis environment ( ) get starlark semantics ( ) ) ; for ( dependency specific configuration dependency specific configuration : dependency specific configurations ) { objc provider builder add transitive and propagate ( dependency specific configuration objc provider with dylib symbols ( ) ) ; } objc provider builder add ( multi arch linked binaries , output artifact ) ; objc provider objc provider = objc provider builder build ( ) ; native info binary info provider ; switch ( get binary type ( rule context ) ) { case executable : binary info provider = new apple executable binary info ( output artifact , objc provider ) ; break ; case dylib : binary info provider = new apple dylib binary info ( output artifact , objc provider ) ; break ; case loadable bundle : binary info provider = new apple loadable bundle binary info ( output artifact , objc provider ) ; break ; default : throw rule context throw with rule error ( " unhandled binary type " + get binary type ( rule context ) ) ; } apple debug outputs info builder builder = apple debug outputs info builder create ( ) ; for ( dependency specific configuration dependency specific configuration : dependency specific configurations ) { apple configuration child apple config = dependency specific configuration config ( ) get fragment ( apple configuration class ) ; objc configuration child objc config = dependency specific configuration config ( ) get fragment ( objc configuration class ) ; intermediate artifacts intermediate artifacts = new intermediate artifacts ( rule context , / * archive file name suffix * / " " , / * output prefix * / " " , dependency specific configuration config ( ) ) ; string arch = child apple config get single architecture ( ) ; if ( child apple config get bitcode mode ( ) = = apple bitcode mode embedded ) { artifact bitcode symbol = intermediate artifacts bitcode symbol map ( ) ; builder add output ( arch , output type bitcode symbols , bitcode symbol ) ; } if ( child objc config generate dsym ( ) ) { artifact dsym binary = child objc config should strip binary ( ) ? intermediate artifacts dsym symbol for unstripped binary ( ) : intermediate artifacts dsym symbol for stripped binary ( ) ; builder add output ( arch , output type dsym binary , dsym binary ) ; } if ( child objc config generate linkmap ( ) ) { artifact linkmap = intermediate artifacts linkmap ( ) ; builder add output ( arch , output type linkmap , linkmap ) ; } } return new apple binary output ( binary info provider , builder build ( ) , output group collector ) ; }


read a particular { @ link configuration class } , registering bean definitions for the class itself and all of its { @ link bean } methods

private void load bean definitions for configuration class ( configuration class config class , tracked condition evaluator tracked condition evaluator ) { if ( tracked condition evaluator should skip ( config class ) ) { string bean name = config class get bean name ( ) ; if ( string utils has length ( bean name ) & & this registry contains bean definition ( bean name ) ) { this registry remove bean definition ( bean name ) ; } this import registry remove importing class ( config class get metadata ( ) get class name ( ) ) ; return ; } if ( config class is imported ( ) ) { register bean definition for imported configuration class ( config class ) ; } for ( bean method bean method : config class get bean methods ( ) ) { load bean definitions for bean method ( bean method ) ; } load bean definitions from imported resources ( config class get imported resources ( ) ) ; load bean definitions from registrars ( config class get import bean definition registrars ( ) ) ; }


return the hex string of hmac s h a 2 2 4 encryption

public static string encrypt hmac s h a 2 2 4 to string ( final byte [ ] data , final byte [ ] key ) { return utils bridge bytes 2 hex string ( encrypt hmac s h a 2 2 4 ( data , key ) ) ; }


processes any remaining data { @ link # is ended ( ) } will return { @ code true } when no data remains

void play to end of stream ( ) throws write exception ;


sets the value that this dialog will display in it ' s editor when initially shown

public void set initial data type ( data type data type ) { editor set cell editor value ( data type ) ; }


copies special metadata hold by this instance to the provided instance

void copy meta ( abstract binary memcache message dst ) { dst magic = magic ; dst opcode = opcode ; dst key length = key length ; dst extras length = extras length ; dst data type = data type ; dst total body length = total body length ; dst opaque = opaque ; dst cas = cas ; }


to test special tags to test special tags and operation id starting with number

public void call 1 2 3test special tags test ( ) { client body = null ; / / client response = api call 1 2 3test special tags ( body ) ; / / todo : test validations }


returns true if the list selection is contiguous and only contains component rows

public boolean is contiguous component selection ( ) { return ( ( selection get num ranges ( ) = = 1 ) & & selection get field range ( 0 ) get start ( ) get index ( ) int value ( ) < get num components ( ) ) ; }


calculate the limit for a get request , based on input policy and state of object

static long calculate request limit ( final long target pos , final long length , final long content length , final long readahead ) { / / cannot read past the end of the object return math min ( content length , length < 0 ? content length : target pos + math max ( readahead , length ) ) ; }


add the record from the given source split

public void add ( source split split , e record ) { add ( split split id ( ) , record ) ; }


captures the end of the continuation for stolen work


gets the next address indicating the address after this action record

public address get next address ( ) { return next address ; }


converts name to valid database name produced name must be used with backticks only , eg ` database name `

public string to database name ( string name ) { string identifier = to identifier ( name , database name prefix , database name suffix ) ; if ( identifier length ( ) > identifier max length ) { logger warn ( " database name too long name ' " + name + " ' will be truncated " ) ; identifier = identifier substring ( 0 , identifier max length ) ; } return identifier ; }


performs the tasks necessary to reap the container

public boolean reap container ( container reap context ctx ) throws i o exception { container container = ctx get container ( ) ; string user = ctx get user ( ) ; string run as user = get run as user ( user ) ; container runtime context runtime context = new container runtime context builder ( container ) set execution attribute ( run as user , run as user ) set execution attribute ( user , user ) build ( ) ; try { linux container runtime reap container ( runtime context ) ; } catch ( container execution exception e ) { int ret code = e get exit code ( ) ; if ( ret code ! = 0 ) { return false ; } log warn ( " error in reaping container { } exit = { } " , container get container id ( ) , ret code , e ) ; log output ( e get output ( ) ) ; throw new i o exception ( " error in reaping container " + container get container id ( ) to string ( ) + " exit = " + ret code , e ) ; } finally { post complete ( container get container id ( ) ) ; } return true ; }


return the number of rows that should have been affected

public int get expected rows affected ( ) { return this expected ; }


get the current joint translation , usually in meters

public float get joint translation ( ) { return jni get joint translation ( addr ) ; }


gets the string that says how long since this build has started

public @ non null string get timestamp string ( ) { long duration = new gregorian calendar ( ) get time in millis ( ) - timestamp ; return util get time span string ( duration ) ; }


instructs the { @ link interner builder } to build a strong interner

public interner builder strong ( ) { this strong = true ; return this ; }


build redirect action for the client dynamically and configure the cas client accordingly based on the properties of the web context

optional < redirection action > build ( cas client cas client , web context context ) ;


returns the end offset of the line that contains the specified offset or if the offset is inside a line delimiter , the end offset of the next line

protected int end of line of ( int offset ) throws bad location exception { i region info = f document get line information of offset ( offset ) ; if ( offset < = info get offset ( ) + info get length ( ) ) return info get offset ( ) + info get length ( ) ; int line = f document get line of offset ( offset ) ; try { info = f document get line information ( line + 1 ) ; return info get offset ( ) + info get length ( ) ; } catch ( bad location exception x ) { return f document get length ( ) ; } }


return whether this a < b > prototype < b > , with an independent instance returned for each call

public boolean is prototype ( ) { return scope prototype equals ( this scope ) ; }


{ @ inherit doc } because a { @ code set multimap } has unique values for a given key , this method returns a { @ link set } , instead of the { @ link collection } specified in the { @ link multimap } interface

public set < v > get ( @ nullable decl k key ) { return ( set < v > ) super get ( key ) ; }


public final boolean is public ( ) { return modifier is public ( get modifiers ( ) ) ; }


called when the connectivity state changes

void on connectivity changed ( boolean is connected ) ;


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


sets the size - indicating how many term buckets should be returned ( defaults to 10 )

public significant terms aggregation builder size ( int size ) { if ( size < = 0 ) { throw new illegal argument exception ( " [ size ] must be greater than 0 found [ " + size + " ] in [ " + name + " ] " ) ; } bucket count thresholds set required size ( size ) ; return this ; }


public builder persist records ( list < anomaly record > records ) { for ( anomaly record record : records ) { logger trace ( " [ { } ] es bulk action : index record to index [ { } ] with id [ { } ] " , job id , index name , record get id ( ) ) ; index result ( record get id ( ) , record , " record " ) ; } return this ; }


public static boolean is empty ( final object obj ) { if ( obj = = null ) { return true ; } if ( obj get class ( ) is array ( ) & & array get length ( obj ) = = 0 ) { return true ; } if ( obj instanceof char sequence & & obj to string ( ) length ( ) = = 0 ) { return true ; } if ( obj instanceof collection & & ( ( collection ) obj ) is empty ( ) ) { return true ; } if ( obj instanceof map & & ( ( map ) obj ) is empty ( ) ) { return true ; } if ( obj instanceof simple array map & & ( ( simple array map ) obj ) is empty ( ) ) { return true ; } if ( obj instanceof sparse array & & ( ( sparse array ) obj ) size ( ) = = 0 ) { return true ; } if ( obj instanceof sparse boolean array & & ( ( sparse boolean array ) obj ) size ( ) = = 0 ) { return true ; } if ( obj instanceof sparse int array & & ( ( sparse int array ) obj ) size ( ) = = 0 ) { return true ; } if ( build version sdk int > = build version codes jelly bean mr2 ) { if ( obj instanceof sparse long array & & ( ( sparse long array ) obj ) size ( ) = = 0 ) { return true ; } } if ( obj instanceof long sparse array & & ( ( long sparse array ) obj ) size ( ) = = 0 ) { return true ; } if ( build version sdk int > = build version codes jelly bean ) { if ( obj instanceof android util long sparse array & & ( ( android util long sparse array ) obj ) size ( ) = = 0 ) { return true ; } } return false ; }


deletes this file or directory and all children , recursively @ throw gdx runtime exception if this file handle is a { @ link file type # classpath } or { @ link file type # internal } file

public boolean delete directory ( ) { if ( type = = file type classpath ) throw new gdx runtime exception ( " cannot delete a classpath file : " + file ) ; if ( type = = file type internal ) throw new gdx runtime exception ( " cannot delete an internal file : " + file ) ; return delete directory ( file ( ) ) ; }


subtract another vector from this one and return result - alters this vector

public final vec 2 sub local ( vec 2 v ) { x - = v x ; y - = v y ; return this ; }


returns a function that computes the options referenced by a rule

public function < ? super rule , ? extends set < string > > get option reference function ( ) { return option reference function ; }


get the count of " 0 2 1d " triads which have two unidirectional edges among the vertices , forming an open triplet ; both edges source the center vertex

public big integer get count 0 2 1d ( ) { return counts [ 3 ] ; }


public int compare to ( prototype other ) { if ( this = = other ) { return 0 ; } / * * the return type is the major order , and then args in order , * and then the shorter list comes first ( similar to string * sorting ) * / int result = return type compare to ( other return type ) ; if ( result ! = 0 ) { return result ; } int this size = parameter types size ( ) ; int other size = other parameter types size ( ) ; int size = math min ( this size , other size ) ; for ( int i = 0 ; i < size ; i + + ) { type this type = parameter types get ( i ) ; type other type = other parameter types get ( i ) ; result = this type compare to ( other type ) ; if ( result ! = 0 ) { return result ; } } if ( this size < other size ) { return - 1 ; } else if ( this size > other size ) { return 1 ; } else { return 0 ; } }


returns an immutable list with all alternative snapshots to restore the managed operator state , in the order in which we should attempt to restore

public list < state object collection < operator state handle > > get prioritized managed operator state ( ) { return prioritized managed operator state ; }


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


add rename record to edit log the destination should be the file name , not the destination directory

void log rename ( string src , string dst , long timestamp , boolean to log rpc ids , options rename options ) { rename op op = rename op get instance ( cache get ( ) ) set source ( src ) set destination ( dst ) set timestamp ( timestamp ) set options ( options ) ; log rpc ids ( op , to log rpc ids ) ; log edit ( op ) ; }


get the full path to a relative template file

public string get full template path ( string relative template file ) { return paths get ( " templating " , " templates " , relative template file ) to string ( ) ; }


draws a rectangle in the xy plane using { @ link shape type # line } or { @ link shape type # filled } the x and y specify the lower left corner the origin x and origin y specify the point about which to rotate the rectangle

public void rect ( float x , float y , float origin x , float origin y , float width , float height , float scale x , float scale y , float degrees ) { rect ( x , y , origin x , origin y , width , height , scale x , scale y , degrees , color , color , color , color ) ; }


assert request query parameter values with the given hamcrest matcher ( s )

public static request matcher query param ( string name , matcher < ? super string > matchers ) { return request - > { multi value map < string , string > params = get query params ( request ) ; assert value count ( " query param " , name , params , matchers length ) ; for ( int i = 0 ; i < matchers length ; i + + ) { assert that ( " query param " , params get ( name ) get ( i ) , matchers [ i ] ) ; } } ; }


marks the computer as temporarily offline this retains the underlying { @ link channel } connection , but prevent builds from executing

public void set temporarily offline ( boolean temporarily offline , offline cause cause ) { offline cause = temporarily offline ? cause : null ; this temporarily offline = temporarily offline ; node node = get node ( ) ; if ( node ! = null ) { node set temporary offline cause ( offline cause ) ; } synchronized ( status change lock ) { status change lock notify all ( ) ; } for ( computer listener cl : computer listener all ( ) ) { if ( temporarily offline ) cl on temporarily offline ( this , cause ) ; else cl on temporarily online ( this ) ; } }


returns all co - location groups in the job

set < co location group > get co location groups ( ) ;


reads this file from the specific offset

public input stream read from offset ( final long offset ) throws i o exception , interrupted exception { if ( channel = = null ) { final random access file raf = new random access file ( new file ( remote ) , " r " ) ; try { raf seek ( offset ) ; } catch ( i o exception e ) { try { raf close ( ) ; } catch ( i o exception e 1 ) { / / ignore } throw e ; } return new input stream ( ) { @ override public int read ( ) throws i o exception { return raf read ( ) ; } @ override public void close ( ) throws i o exception { raf close ( ) ; } @ override public int read ( byte [ ] b , int off , int len ) throws i o exception { return raf read ( b , off , len ) ; } @ override public int read ( byte [ ] b ) throws i o exception { return raf read ( b ) ; } } ; } final pipe p = pipe create remote to local ( ) ; act async ( new offset pipe secure file callable ( p , offset ) ) ; return new java util zip g z i p input stream ( p get in ( ) ) ; }


build a configuration - only copy of this advised support , replacing the target source

advised support get configuration only copy ( ) { advised support copy = new advised support ( ) ; copy copy from ( this ) ; copy target source = empty target source for class ( get target class ( ) , get target source ( ) is static ( ) ) ; copy advisor chain factory = this advisor chain factory ; copy interfaces = this interfaces ; copy advisors = this advisors ; return copy ; }


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


the time that the datafeed should end this value is exclusive if you do not specify an end time , the datafeed runs continuously

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


the attributes of this element < code > repeated aapt pb xml attribute attribute = 4 ; < code >

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


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

private com google protobuf single field builder < org springframework protobuf second msg , org springframework protobuf second msg builder , org springframework protobuf second msg or builder > get blah field builder ( ) { if ( blah builder = = null ) { blah builder = new com google protobuf single field builder < > ( blah , get parent for children ( ) , is clean ( ) ) ; blah = null ; } return blah builder ; }


public static void close i o ( final closeable closeables ) { if ( closeables = = null ) return ; for ( closeable closeable : closeables ) { if ( closeable ! = null ) { try { closeable close ( ) ; } catch ( i o exception e ) { e print stack trace ( ) ; } } } }


gets an { @ link allocation decision } from a { @ link allocation status }

public static allocation decision from allocation status ( allocation status allocation status ) { if ( allocation status = = null ) { return yes ; } else { switch ( allocation status ) { case deciders throttled : return throttled ; case fetching shard data : return awaiting info ; case delayed allocation : return allocation delayed ; case no valid shard copy : return no valid shard copy ; case no attempt : return no attempt ; default : assert allocation status = = allocation status deciders no : " unhandled allocation status type [ " + allocation status + " ] " ; return no ; } } }


try the dynamic load , remove existing to attempt to dynamic load disabled plugins

public void dynamic load ( file arc , boolean remove existing , @ check for null list < plugin wrapper > batch ) throws i o exception , interrupted exception , restart required exception { try ( a c l context context = acl as 2 ( acl system2 ) ) { logger log ( fine , " attempting to dynamic load { 0 } " , arc ) ; plugin wrapper p = null ; string sn ; try { sn = strategy get short name ( arc ) ; } catch ( abstract method error x ) { logger log ( warning , " jenkins - 12753 fix not active : { 0 } " , x get message ( ) ) ; p = strategy create plugin wrapper ( arc ) ; sn = p get short name ( ) ; } plugin wrapper pw = get plugin ( sn ) ; if ( pw ! = null ) { if ( remove existing ) { / / try to load disabled plugins for ( iterator < plugin wrapper > i = plugins iterator ( ) ; i has next ( ) ; ) { pw = i next ( ) ; if ( sn equals ( pw get short name ( ) ) ) { i remove ( ) ; break ; } } } else { throw new restart required exception ( messages plugin manager plugin is already installed restart required ( sn ) ) ; } } if ( p = = null ) { p = strategy create plugin wrapper ( arc ) ; } if ( p supports dynamic load ( ) = = yes no maybe no ) throw new restart required exception ( messages plugin manager plugin doesnt support dynamic load restart required ( sn ) ) ; / / there ' s no need to do cyclic dependency check , because we are deploying one at a time , / / so existing plugins can ' t be depending on this newly deployed one plugins add ( p ) ; if ( p is active ( ) ) active plugins add ( p ) ; synchronized ( ( ( uber class loader ) uber class loader ) loaded ) { ( ( uber class loader ) uber class loader ) loaded clear ( ) ; } / / todo antimodular ; perhaps should have a plugin listener to complement extension list listener ? custom class filter contributed load ( ) ; try { p resolve plugin dependencies ( ) ; strategy load ( p ) ; if ( batch ! = null ) { batch add ( p ) ; } else { start ( collections singleton list ( p ) ) ; } } catch ( exception e ) { failed plugins add ( new failed plugin ( sn , e ) ) ; active plugins remove ( p ) ; plugins remove ( p ) ; throw new i o exception ( " failed to install " + sn + " plugin " , e ) ; } logger log ( fine , " plugin { 0 } : { 1 } dynamically { 2 } " , new object [ ] { p get short name ( ) , p get version ( ) , batch ! = null ? " loaded but not yet started " : " installed " } ) ; } }


set the additional ( undeclared ) property with the specified name and value if the property does not already exist , create it otherwise replace it

public additional properties boolean put additional property ( string key , boolean value ) { if ( this additional properties = = null ) { this additional properties = new hash map < string , boolean > ( ) ; } this additional properties put ( key , value ) ; return this ; }


create { @ link test input topic } to be used for piping records to topic uses provided start timestamp and auto advance parameter for records

public final < k , v > test input topic < k , v > create input topic ( final string topic name , final serializer < k > key serializer , final serializer < v > value serializer , final instant start timestamp , final duration auto advance ) { return new test input topic < > ( this , topic name , key serializer , value serializer , start timestamp , auto advance ) ; }


returns the type value of the { @ link file system info } annotation attached to the specified class

public static string get filesystem type from class ( class < ? > clazz ) { file system info fsi = clazz get annotation ( file system info class ) ; return fsi ! = null ? fsi type ( ) : null ; }


get a handle on the unsafe instance , used for accessing low - level concurrency and memory constructs

public static unsafe get unsafe ( ) { return the unsafe ; }


returns the list of options to add to a command line

public list < string > get options ( ) { return options list ; }


in this scenario , we make sure that if a set root happens in the background followed by a second set root in the background before the first can commit on the main thread , that we still properly diff at mount time and don ' t unmount and remount and mount specs with @ should update ( on mount = true )

public void layout diffing multiple set roots in parallel with should update true for first layout mount content is remounted ( ) { final array list < lifecycle step > operations = new array list < > ( ) ; final object first object for should update = new object ( ) ; m litho view rule set root ( create root component ( m litho view rule get context ( ) , first object for should update , operations ) ) set size px ( 100 , 100 ) measure ( ) layout ( ) attach to window ( ) ; assert that ( operations ) contains exactly ( lifecycle step on mount ) ; operations clear ( ) ; final object second object for should update = new object ( ) ; / / do two prop updates sequentially without draining the main thread queue m litho view rule set root async ( create root component ( m litho view rule get context ( ) , second object for should update , operations ) ) ; m background layout looper rule run to end of tasks sync ( ) ; m litho view rule set root async ( create root component ( m litho view rule get context ( ) , second object for should update , operations ) ) ; m background layout looper rule run to end of tasks sync ( ) ; / / now drain the main thread queue and mount the result shadow looper idle main looper ( ) ; m litho view rule layout ( ) ; / / in this case , we did change the object for should update in layout 1 even though / / it was the same for layouts 2 we expect to see unmount and mount assert that ( operations ) contains exactly ( lifecycle step on unmount , lifecycle step on mount ) ; operations clear ( ) ; }


retrieve the theme message for the given code note that theme messages are never html - escaped , as they typically denote theme - specific resource paths and not client - visible messages

public string get theme message ( string code , @ nullable list < ? > args ) throws no such message exception { return get theme ( ) get message source ( ) get message ( code , ( args ! = null ? args to array ( ) : null ) , get locale ( ) ) ; }


public int get length ( address addr ) { return get length ( addr , a model ) ; }


set the rounding options to be used or null if the image should not be rounded

public t round ( @ nullable rounding options rounding options ) { m rounding options = rounding options ; return get this ( ) ; }


adds { @ link align # right } and clears { @ link align # left } for the alignment of each row of widgets when { @ link # wrap ( ) wrapping } is enabled

public horizontal group row right ( ) { row align | = align right ; row align & = ~ align left ; return this ; }


if set to true , all future compositions that are set will be cached so that they don ' t need to be parsed next time they are loaded this won ' t apply to compositions that have already been loaded defaults to true { @ link r attr # lottie cache composition }

public void set cache composition ( boolean cache composition ) { this cache composition = cache composition ; }


updates the current phase progress area in the default merge panel

public void update progress ( final int current progress percentage ) { if ( current progress percentage < 0 | | current progress percentage > 100 ) { system out println ( " invalid progress value ( " + current progress percentage + " ) must be from 0 to 100 " ) ; return ; } swing utilities invoke later ( ( ) - > { if ( ! is cancelled ) { merge plugin set current progress ( current progress percentage ) ; } } ) ; }


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


applies { @ link json path expectations helper # exists ( string ) }

public web test client body content spec exists ( ) { this path helper exists ( this content ) ; return this body spec ; }


public static long get long ( @ non null final string key , @ non null final s p utils sp utils ) { return sp utils get long ( key ) ; }


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

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


add a minimum statistic to dynamically return the latest value of the source

public dynamic i o statistics builder with atomic long minimum ( string key , atomic long source ) { with long function minimum ( key , s - > source get ( ) ) ; return this ; }


check that the non - symlink constructor works correctly

public void constructor no symlink ( ) throws i o exception { boolean isdir = true ; file status file status = new file status ( length , isdir , replication , blksize , mtime , atime , permission , owner , group , path ) ; validate accessors ( file status , length , isdir , replication , blksize , mtime , atime , permission , owner , group , null , path ) ; }


public list < list < big decimal > > get array array number ( ) { return array array number ; }


enter a parse tree produced by { @ link eql base parser # join term }

void enter join term ( eql base parser join term context ctx ) ;


accept the containing { @ link bean factory } , registering corresponding hibernate { @ link org hibernate resource beans container spi bean container } integration for it if possible this requires a spring { @ link configurable listable bean factory } and hibernate 5 3 or higher on the classpath

public void set bean factory ( bean factory bean factory ) { if ( bean factory instanceof configurable listable bean factory & & class utils is present ( " org hibernate resource beans container spi bean container " , get class ( ) get class loader ( ) ) ) { this bean factory = ( configurable listable bean factory ) bean factory ; } }


returns the { @ link android input } object associated with this { @ link android application base }


converts the given { @ link data stream } into a { @ link table } the field names of the { @ link table } are automatically derived from the type of the { @ link data stream }

< t > table from data stream ( data stream < t > data stream ) ;


the configuration of each class is put into the kernel

private void add context enhance class ( map < string , object > configuration ) { string key = customize util generate class desc ( method configuration get clz ( configuration ) , method configuration is static ( configuration ) ) ; hash map < string , element matcher > enhance classes = get enhance classes ( ) ; element matcher matcher = enhance classes get ( key ) ; enhance classes put ( key , matcher = = null ? parser methods matcher ( configuration ) : ( ( element matcher junction ) matcher ) or ( parser methods matcher ( configuration ) ) ) ; }


public void write optional int ( @ nullable integer integer ) throws i o exception { if ( integer = = null ) { write boolean ( false ) ; } else { write boolean ( true ) ; write int ( integer ) ; } }


boolean is snapshot in progress ( ) { return active file ! = null ; }


creates a link when there ' s a span missing , in this case 2l which is an rpc from web to app

@ test void missing span ( ) { list < span > single host spans = as list ( span ( " a " , null , " a " , kind server , " web " , null , false ) , span ( " a " , " a " , " b " , kind client , " app " , null , false ) ) ; assert that ( new dependency linker ( logger ) put trace ( single host spans ) link ( ) ) contains only ( dependency link new builder ( ) parent ( " web " ) child ( " app " ) call count ( 1l ) build ( ) ) ; assert that ( messages ) contains ( " detected missing link to client span " ) ; }


returns true if the user has selected one and only one range of instructions if there are multiple ranges , this could be for two reasons : 1 ) the user has ( via the mouse ) selected more than one set of address ranges , or 2 ) the user selects a single region but that region spans memory blocks ; this would be interpreted by the program as being 2 distinct selection ranges in both of these cases , we throw an exception with a message that the caller can log if desired

private boolean is selection range valid ( program selection selection ) throws invalid input exception { set < string > block names = new hash set < > ( ) ; address range iterator iter = selection get address ranges ( ) ; while ( iter has next ( ) ) { address range range = iter next ( ) ; address addr = range get min address ( ) ; memory block block = get current program ( ) get memory ( ) get block ( addr ) ; block names add ( block get name ( ) ) ; } if ( block names size ( ) > 1 ) { throw new invalid input exception ( " selection range cannot span memory blocks " ) ; } if ( selection get num address ranges ( ) > 1 ) { throw new invalid input exception ( " selection cannot contain multiple address ranges " ) ; } return selection get num address ranges ( ) = = 1 ; }


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


represents the upper bound in bytes for a set of headers before a { @ code go away } should be sent this will be { @ code < = } < a href = " https : tools ietf orghtmlrfc 7 5 4 0 # section - 6 5 2 " > settings max header list size


the response resources wrapped in the common mcp resource message these are typed resources that match the type url in the request resources message when ` incremental ` is true , this contains an array of resources to addupdate for the specified collection this modifies the existing collection at the sink when ` incremental ` is false , this contains the full set of resources for the specified collection this replaces any previously delivered resources < code > repeated istio mcp v 1alpha 1 resource resources = 3 ; < code >

public builder clear resources ( ) { if ( resources builder = = null ) { resources = java util collections empty list ( ) ; bit field 0 = ( bit field 0 & ~ 0x 0 0 0 0 0 0 0 1 ) ; on changed ( ) ; } else { resources builder clear ( ) ; } return this ; }


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


public void begin job loop ( ) { run on executor ( ( ) - > { int id = 0 ; for ( int i = 0 ; i < configuration get job thread count ( ) ; i + + ) { new job runner ( application , + + id , job controller , job predicate none ) start ( ) ; } for ( job predicate predicate : configuration get reserved job runners ( ) ) { new job runner ( application , + + id , job controller , predicate ) start ( ) ; } job controller wake up ( ) ; } ) ; }


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


public boolean show dialog ( ) { save selected = false ; tool show dialog ( this ) ; return save selected ; }


producing this empty message triggers auto - creation of the topic and gets things " warmed up " on the broker before the consumers subscribe without this , the topic is auto - created when the first consumer subscribes but there appears to be a race condition where the existence of the topic is not known to the partition assignor when the consumer group goes through its initial re - balance as a result , no partitions are assigned , there are no further changes to group membership to trigger another re - balance , and no messages are consumed this initial message is not necessary if the test broker is re - created for each test , but that increases execution time for the suite by a factor of 1 0x ( 2 - 3s to ~ 2 5s on my local machine )

void warm up topic ( string topic ) { produce spans ( new byte [ 0 ] , topic ) ; }


this isn ' t a test of what we " should " accept as a span , rather that characters that trip - up json don ' t fail in span parser

public void span special chars in json ( ) { / / service name is surrounded by control characters endpoint e = endpoint new builder ( ) service name ( new string ( new char [ ] { 0 , ' a ' , 1 } ) ) build ( ) ; span worst span in the world = span new builder ( ) trace id ( " 1 " ) id ( " 1 " ) / / name is terrible name ( new string ( new char [ ] { ' " ' , ' \ \ ' , ' \ t ' , ' \ b ' , ' \ n ' , ' \ r ' , ' \ f ' } ) ) local endpoint ( e ) / / annotation value includes some json newline characters add annotation ( 1l , " \ u 2 0 2 8 and \ u 2 0 2 9 " ) / / binary annotation key includes a quote and value newlines put tag ( " \ " foo " , " database error : ora - 00942 : \ u 2 0 2 8 and \ u 2 0 2 9 table or view does not exist \ n " ) build ( ) ; assert that ( parse ( span parser , new string ( span bytes encoder json v2 encode ( worst span in the world ) , utf 8 ) ) ) is equal to ( worst span in the world ) ; }


returns an sdk logger that logs using the currently configured default log factory , given the name

public static internal log api get log ( string name ) { return factory configured ? factory do get log ( name ) : new internal log ( name ) ; / / will look up actual logger per log }


variant of { @ link # get lookup path for request ( http servlet request ) } that automates checking for a previously computed lookup path saved as a request attribute the attribute is only used for lookup purposes

public string get lookup path for request ( http servlet request request , @ nullable string name ) { string result = null ; if ( name ! = null ) { result = ( string ) request get attribute ( name ) ; } return ( result ! = null ? result : get lookup path for request ( request ) ) ; }


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


returns acl bindings which match the provided filter this is a synchronous api designed for use with locally cached a c ls this method is invoked on the request thread while processing describe acls requests and should avoid time - consuming remote communication that may block request threads

iterable < acl binding > acls ( acl binding filter filter ) ;


constructs a new { @ code caffeine } instance with default settings , including strong keys , strong values , and no automatic eviction of any kind note that while this return type is { @ code caffeine < object , object > } , type parameters on the { @ link # build } methods allow you to create a cache of any key and value type desired

public static caffeine < object , object > new builder ( ) { return new caffeine < > ( ) ; }


initializes the array with the provided number of bytes

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


determine whether to use request dispatcher ' s { @ code include } or { @ code forward } method performs a check whether an include uri attribute is found in the request , indicating an include request , and whether the response has already been committed in both cases , an include will be performed , as a forward is not possible anymore

protected boolean use include ( http servlet request request , http servlet response response ) { return ( this always include | | web utils is include request ( request ) | | response is committed ( ) ) ; }


retrieves a map of { @ link path } s to the { @ link mapper } class that should be used for them

static map < path , class < ? extends mapper > > get mapper type map ( job conf conf ) { if ( conf get ( " mapreduce input multipleinputs dir mappers " ) = = null ) { return collections empty map ( ) ; } map < path , class < ? extends mapper > > m = new hash map < path , class < ? extends mapper > > ( ) ; string [ ] path mappings = conf get ( " mapreduce input multipleinputs dir mappers " ) split ( " , " ) ; for ( string path mapping : path mappings ) { string [ ] split = path mapping split ( " ; " ) ; class < ? extends mapper > map class ; try { map class = ( class < ? extends mapper > ) conf get class by name ( split [ 1 ] ) ; } catch ( class not found exception e ) { throw new runtime exception ( e ) ; } m put ( new path ( split [ 0 ] ) , map class ) ; } return m ; }


tests that when multiple conditions match but one condition is more specialized than the others , it is chosen and there is no error

public void multiple matches unambiguous ( ) throws exception { scratch file ( " conditions / build " , " config setting ( " , " name = ' a ' , " , " values = { ' define ' : ' a = 1 ' } ) " , " config setting ( " , " name = ' b ' , " , " values = { ' compilation mode ' : ' opt ' } ) " , " config setting ( " , " name = ' c ' , " , " values = { ' test arg ' : ' baz ' } ) " , " config setting ( " , " name = ' b a c ' , " , / / named to come alphabetically after a and b but before c " values = { ' define ' : ' a = 1 ' , ' test arg ' : ' baz ' , ' compilation mode ' : ' opt ' } ) " ) ; scratch file ( " java / a / build " , " java binary ( " , " name = ' binary ' , " , " srcs = [ ' binary java ' ] , " , " deps = select ( { " , " ' / / conditions : a ' : [ ' : a ' ] , " , " ' / / conditions : b ' : [ ' : b ' ] , " , " ' / / conditions : c ' : [ ' : c ' ] , " , " ' / / conditions : b a c ' : [ ' : b a c ' ] , " , " } ) ) " , " java library ( " , " name = ' a ' , " , " srcs = [ ' a java ' ] ) " , " java library ( " , " name = ' b ' , " , " srcs = [ ' b java ' ] ) " , " java library ( " , " name = ' c ' , " , " srcs = [ ' c java ' ] ) " , " java library ( " , " name = ' b a c ' , " , " srcs = [ ' b a c java ' ] ) " ) ; check rule ( " / / java / a : binary " , immutable list of ( " - - define " , " a = 1 " , " - - compilation mode " , " opt " , " - - test arg " , " baz " ) , / * expected : * / immutable list of ( " bin java / a / libb a c jar " ) , / * not expected : * / immutable list of ( " bin java / a / liba jar " , " bin java / a / libb jar " , " bin java / a / libc jar " ) ) ; }


traverses the json tree of the valid query provided as argument and mutates it one or more times by adding one object within each object encountered for instance given the following valid term query : { " term " : { " field " : { " value " : " foo " } } } the following two mutations will be generated , and an exception is expected when trying to parse them : { " term " : { " new field " : { " field " : { " value " : " foo " } } } } { " term " : { " field " : { " new field " : { " value " : " foo " } } } } every mutation is then added to the list of results with a boolean flag indicating if a parsing exception is expected or not for the mutation some specific objects do not cause any exception as they can hold arbitrary content ; they are passed using the arbitrary markers parameter

static list < tuple < string , boolean > > alterate queries ( set < string > queries , set < string > arbitrary markers ) throws i o exception { list < tuple < string , boolean > > results = new array list < > ( ) ; / / indicate if a part of the query can hold any arbitrary content boolean has arbitrary content = ( arbitrary markers ! = null & & arbitrary markers is empty ( ) = = false ) ; for ( string query : queries ) { / / track the number of query mutations int mutation = 0 ; while ( true ) { boolean expect exception = true ; bytes stream output out = new bytes stream output ( ) ; try ( x content generator generator = x content type json x content ( ) create generator ( out ) ; x content parser parser = json x content json x content create parser ( named x content registry empty , deprecation handler throw unsupported operation , query ) ; ) { int object index = - 1 ; deque < string > levels = new linked list < > ( ) ; / / parse the valid query and inserts a new object level called " new field " x content parser token token ; while ( ( token = parser next token ( ) ) ! = null ) { if ( token = = x content parser token start array ) { levels add last ( parser current name ( ) ) ; } else if ( token = = x content parser token start object ) { object index + + ; levels add last ( parser current name ( ) ) ; if ( object index = = mutation ) { / / we reached the place in the object tree where we want to insert a new object level generator write start object ( ) ; generator write field name ( " new field " ) ; generator copy current structure ( parser ) ; generator write end object ( ) ; if ( has arbitrary content ) { / / the query has one or more fields that hold arbitrary content if the current / / field is one ( or a child ) of those , no exception is expected when parsing the mutated query for ( string marker : arbitrary markers ) { if ( levels contains ( marker ) ) { expect exception = false ; break ; } } } / / jump to next token continue ; } } else if ( token = = x content parser token end object | | token = = x content parser token end array ) { levels remove last ( ) ; } / / we are walking through the object tree , so we can safely copy the current node generator copy current event ( parser ) ; } if ( object index < mutation ) { / / we did not reach the insertion point , there ' s no more mutations to try break ; } else { / / we reached the expected insertion point , so next time we ' ll try one step further mutation + + ; } } results add ( new tuple < > ( out bytes ( ) utf 8 to string ( ) , expect exception ) ) ; } } return results ; }


public final toast utils set duration is long ( boolean is long ) { this is long = is long ; return this ; }


returns a timestamp to use in { @ link monitoring doc }

protected static long timestamp ( ) { return system current time millis ( ) ; }


similar to { @ link # create proxy ( object ) } but adds an additional argument before the argument of type { @ code t } note that they may potentially be of the same time when invoked !

public static < t > t create named proxy ( string name , t object ) { return null ; }


create a parent dir and set default acl to allow foo readwrite access create a sub dir and set default acl to allow bar group readwrite access parent dirfile can not be viewedappended by bar group parent dirchild dirfile can be viewedappended by bar group

public void test grad subdir more access ( ) throws exception { path parent = new path ( " / test grad subdir more access " ) ; hdfs mkdirs ( parent ) ; list < acl entry > acls parent = lists new array list ( acl entry ( default , user , " foo " , read execute ) ) ; list < acl entry > acls child = lists new array list ( acl entry ( default , group , " bar " , read write ) ) ; hdfs set acl ( parent , acls parent ) ; acl entry [ ] parent dir expected acl = new acl entry [ ] { acl entry ( default , user , all ) , acl entry ( default , user , " foo " , read execute ) , acl entry ( default , group , read execute ) , acl entry ( default , mask , read execute ) , acl entry ( default , other , read execute ) } ; acl status parent acl = hdfs get acl status ( parent ) ; assert array equals ( parent dir expected acl , parent acl get entries ( ) to array ( ) ) ; path child dir = new path ( parent , " child dir " ) ; hdfs mkdirs ( child dir ) ; hdfs modify acl entries ( child dir , acls child ) ; / / child dir should inherit the default acls from parent , plus bar group acl entry [ ] child dir expected acl = new acl entry [ ] { acl entry ( access , user , " foo " , read execute ) , acl entry ( access , group , read execute ) , acl entry ( default , user , all ) , acl entry ( default , user , " foo " , read execute ) , acl entry ( default , group , read execute ) , acl entry ( default , group , " bar " , read write ) , acl entry ( default , mask , all ) , acl entry ( default , other , read execute ) } ; acl status child dir acl = hdfs get acl status ( child dir ) ; assert array equals ( child dir expected acl , child dir acl get entries ( ) to array ( ) ) ; path parent file = new path ( parent , " parent file " ) ; hdfs create ( parent file ) close ( ) ; hdfs set permission ( parent file , new fs permission ( ( short ) 0640 ) ) ; / / parent dir / parent file allows foo to access but not bar group acl entry [ ] parent file expected acl = new acl entry [ ] { acl entry ( access , user , " foo " , read execute ) , acl entry ( access , group , read execute ) } ; acl status parent file acl = hdfs get acl status ( parent file ) ; assert array equals ( parent file expected acl , parent file acl get entries ( ) to array ( ) ) ; path child file = new path ( child dir , " child file " ) ; hdfs create ( child file ) close ( ) ; hdfs set permission ( child file , new fs permission ( ( short ) 0640 ) ) ; / / child dir / child file allows foo user and bar group to access acl entry [ ] child file expected acl = new acl entry [ ] { acl entry ( access , user , " foo " , read execute ) , acl entry ( access , group , read execute ) , acl entry ( access , group , " bar " , read write ) } ; acl status child file acl = hdfs get acl status ( child file ) ; assert array equals ( child file expected acl , child file acl get entries ( ) to array ( ) ) ; / / parent file should not be accessible for bar group assert false ( try access ( parent file , " bar user " , new string [ ] { " bar " } , read ) ) ; / / child file should be accessible for bar group assert true ( try access ( child file , " bar user " , new string [ ] { " bar " } , read ) ) ; / / parent file should be accessible for foo user assert true ( try access ( parent file , " foo " , new string [ ] { " foo group " } , read ) ) ; / / child file should be accessible for foo user assert true ( try access ( child file , " foo " , new string [ ] { " foo group " } , read ) ) ; hdfs delete ( parent , true ) ; }


takes all jar files that are contained in this program ' s jar file and extracts them to the system ' s temp directory

public static list < file > extract contained libraries ( url jar file ) throws program invocation exception { try ( final jar file jar = new jar file ( new file ( jar file to u r i ( ) ) ) ) { final list < jar entry > contained jar file entries = get contained jar entries ( jar ) ; if ( contained jar file entries is empty ( ) ) { return collections empty list ( ) ; } final list < file > extracted temp libraries = new array list < > ( contained jar file entries size ( ) ) ; boolean incomplete = true ; try { final random rnd = new random ( ) ; final byte [ ] buffer = new byte [ 4096 ] ; for ( final jar entry entry : contained jar file entries ) { / / ' / ' as in case of zip , jar / / java util zip zip entry # is directory always looks only for ' / ' not for / / file separator final string name = entry get name ( ) replace ( ' / ' , ' ' ) ; final file temp file = copy lib to temp file ( name , rnd , jar , entry , buffer ) ; extracted temp libraries add ( temp file ) ; } incomplete = false ; } finally { if ( incomplete ) { delete extracted libraries ( extracted temp libraries ) ; } } return extracted temp libraries ; } catch ( throwable t ) { throw new program invocation exception ( " unknown i / o error while extracting contained jar files " , t ) ; } }


test the property ' sc a e t h flow points '

public void sc a e t h flow points test ( ) { / / todo : test sc a e t h flow points }


add the given { @ code response cookie }

void add cookie ( response cookie cookie ) ;


launch a new container with the given life time

public void add new container ( container container , long life time m s ) { log debug ( " node manager { } launches a new container ( { } ) " , node get node i d ( ) , container get id ( ) ) ; if ( life time m s ! = - 1 ) { / / normal container container simulator cs = new container simulator ( container get id ( ) , container get resource ( ) , life time m s + system current time millis ( ) , life time m s , container get allocation request id ( ) ) ; container queue add ( cs ) ; running containers put ( cs get id ( ) , cs ) ; } else { / / am container / / - 1 means a m container synchronized ( am container list ) { am container list add ( container get id ( ) ) ; } } }


read in the cached du value and return it if it is less than cached dfs used check time which is set by dfs datanode cached - dfsused check interval ms parameter slight imprecision of dfs used is not critical and skipping du can significantly shorten the startup time if the cached value is not available or too old , - 1 is returned

long load dfs used ( ) { long cached dfs used ; long mtime ; scanner sc ; try { sc = new scanner ( new file ( current dir , du cache file ) , " utf - 8 " ) ; } catch ( file not found exception fnfe ) { return - 1 ; } try { / / get the recorded dfs used from the file if ( sc has next long ( ) ) { cached dfs used = sc next long ( ) ; } else { return - 1 ; } / / get the recorded mtime from the file if ( sc has next long ( ) ) { mtime = sc next long ( ) ; } else { return - 1 ; } / / return the cached value if mtime is okay if ( mtime > 0 & & ( timer now ( ) - mtime < cached dfs used check time ) ) { fs dataset impl log info ( " cached dfs used found for " + current dir + " : " + cached dfs used ) ; return cached dfs used ; } return - 1 ; } finally { sc close ( ) ; } }


the configuration for which the resource is defined < code > optional aapt pb config description config = 2 ; < code >

public boolean has config ( ) { return instance has config ( ) ; }


check whether the requested resource has been modified given the supplied { @ code e tag } ( entity tag ) and last - modified timestamp , as determined by the application if not modified , this method returns a response with corresponding status code and headers , otherwise an empty result typical usage : < pre class = " code " > public server response my handle method ( server request request ) { instant last modified = application - specific calculation string e tag = application - specific calculation return request check not modified ( last modified , e tag ) or else get ( ( ) - > { further request processing , actually building content return server response ok ( ) body ( ) ; } ) ; } this method works with conditional gethead requests , but also with conditional postputdelete requests

default optional < server response > check not modified ( instant last modified , string etag ) { assert not null ( last modified , " last modified must not be null " ) ; assert not null ( etag , " etag must not be null " ) ; return default server request check not modified ( servlet request ( ) , last modified , etag ) ; } / / static methods


map field name to the new name subclasses can override

public string map field name ( string owner , string name , string desc ) { return name ; }


gets target output location for the file , relative to the output directory

public string get destination filename ( ) { return destination filename ; }


increment a named counter by a given value

private long increment ( string name , long value ) { return inc counter ( name , value ) ; }


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


transforms the subclass serializer registry structure , { @ code linked hash map < class < ? > , type serializer < ? > > } to 2 separate structures : a map containing with registered classes as key and their corresponding ids ( order in the original map ) as value , as well as a separate array of the corresponding subclass serializers

private static tuple 2 < linked hash map < class < ? > , integer > , type serializer < object > [ ] > decompose subclass serializer registry ( linked hash map < class < ? > , type serializer < ? > > subclass serializer registry ) { final linked hash map < class < ? > , integer > subclass ids = new linked hash map < > ( subclass serializer registry size ( ) ) ; final type serializer [ ] subclass serializers = new type serializer [ subclass serializer registry size ( ) ] ; subclass serializer registry for each ( ( registered subclass class , serializer ) - > { int id = subclass ids size ( ) ; subclass ids put ( registered subclass class , id ) ; subclass serializers [ id ] = serializer ; } ) ; return tuple 2 of ( subclass ids , subclass serializers ) ; }


returns the execution root directory associated with this blaze server process this is where all input and output files visible to the actual build reside

public path get exec root ( ) { preconditions check not null ( workspace name ) ; return get directories ( ) get exec root ( workspace name ) ; }


test that program diff can correctly determine which addresses are in common between program 1 and program 2


compare all the fields and embedded anomaly records ( if any )

public boolean equals ( object other ) { if ( this = = other ) { return true ; } if ( other instanceof overall bucket = = false ) { return false ; } overall bucket that = ( overall bucket ) other ; return objects equals ( this timestamp , that timestamp ) & & this bucket span = = that bucket span & & this overall score = = that overall score & & objects equals ( this jobs , that jobs ) & & this is interim = = that is interim ; }


returns whether or not any layers in this composition has masks

public boolean has masks ( ) { return composition layer ! = null & & composition layer has masks ( ) ; }


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


returns the ( designated ) physical storage location of the blob with the given key

static file get storage location ( file storage dir , @ nullable job i d job id , blob key key ) throws i o exception { file file = new file ( get storage location path ( storage dir get absolute path ( ) , job id , key ) ) ; files create directories ( file get parent file ( ) to path ( ) ) ; return file ; }


get the initial token in this context note that the range from start to stop is inclusive , so for rules that do not consume anything ( for example , zero length or error productions ) this token may exceed stop

public token get start ( ) { return start ; }


invoke the specified validators , if any , with the given validation hints note : validation hints may get ignored by the actual target validator

public void validate ( object validation hints ) { object target = get target ( ) ; assert state ( target ! = null , " no target to validate " ) ; binding result binding result = get binding result ( ) ; / / call each validator with the same binding result for ( validator validator : get validators ( ) ) { if ( ! object utils is empty ( validation hints ) & & validator instanceof smart validator ) { ( ( smart validator ) validator ) validate ( target , binding result , validation hints ) ; } else if ( validator ! = null ) { validator validate ( target , binding result ) ; } } }


public builder add defines ( iterable < string > defines ) { this defines add all ( defines ) ; return this ; }


verifies that the given rule supports the minimum os attribute , and adds compile and link args to set the minimum os appropriately , including compile args for dependencies

protected void check minimum os link and compile arg ( rule type rule type ) throws exception { rule type scratch target ( scratch , " deps " , " [ ' / / package : objc lib ' ] " , " minimum os version " , " ' 5 4 ' " ) ; scratch file ( " package / build " , " objc library ( name = ' objc lib ' , srcs = [ ' b m ' ] ) " ) ; use configuration ( " - - xcode version = 5 8 " ) ; command action link action = link action ( " / / x : x " ) ; command action objc lib archive action = ( command action ) get generating action ( get first artifact ending with ( link action get inputs ( ) , " libobjc lib a " ) ) ; command action objc lib compile action = ( command action ) get generating action ( get first artifact ending with ( objc lib archive action get inputs ( ) , " b o " ) ) ; string link args = joiner on ( " " ) join ( link action get arguments ( ) ) ; string compile args = joiner on ( " " ) join ( objc lib compile action get arguments ( ) ) ; assert that ( link args ) contains ( " - mios - simulator - version - min = 5 4 " ) ; assert that ( compile args ) contains ( " - mios - simulator - version - min = 5 4 " ) ; }


this function " breaks hardlinks " to the current replica file when doing a data node upgrade , we create a bunch of hardlinks to each block file this cleverly ensures that both the old and the new storage directories can contain the same block file , without using additional space for the data however , when we want to append to the replica file , we need to " break " the hardlink to ensure that the old snapshot continues to contain the old data length if we failed to do that , we could roll back to the previous directory during a downgrade , and find that the block contents were longer than they were at the time of upgrade

public boolean break hard links if needed ( ) throws i o exception { final file file = get block file ( ) ; final file io provider file io provider = get file io provider ( ) ; if ( file = = null | | get volume ( ) = = null ) { throw new i o exception ( " detach block : block not found " + this ) ; } file meta = get meta file ( ) ; int link count = file io provider get hard link count ( get volume ( ) , file ) ; if ( link count > 1 ) { data node log info ( " breaking hardlink for " + link count + " x - linked " + " block " + this ) ; break hardlinks ( file , this ) ; } if ( file io provider get hard link count ( get volume ( ) , meta ) > 1 ) { break hardlinks ( meta , this ) ; } return true ; }


public static string generate parent id ( state instance state instance ) { return state instance get machine instance id ( ) + domain constants seperator parent id + state instance get id ( ) ; }


private tuple 2 < org apache hadoop fs path , string > fill with data ( string base , string file name , int file idx , string sample line ) throws i o exception , interrupted exception { assert ( hdfs ! = null ) ; org apache hadoop fs path tmp = new org apache hadoop fs path ( base + " / " + file name + file idx ) ; f s data output stream stream = hdfs create ( tmp ) ; string builder str = new string builder ( ) ; for ( int i = 0 ; i < lines per file ; i + + ) { string line = file idx + " : " + sample line + " " + i + " \ n " ; str append ( line ) ; stream write ( line get bytes ( config constants default charset ) ) ; } stream close ( ) ; return new tuple 2 < > ( tmp , str to string ( ) ) ; }


sends model - change notifications to all subscribers the updated model is sent in the callback

private void fire model changed ( ) { listeners for each ( l - > l model changed ( comparisons ) ) ; }


returns an index > = 0 and < = { @ link # mask } for the specified { @ code item } the default implementation uses fibonacci hashing on the item ' s { @ link object # hash code ( ) } : the hashcode is multiplied by a long constant ( 2 to the 6 4th , divided by the golden ratio ) then the uppermost bits are shifted into the lowest positions to obtain an index in the desired range multiplication by a long may be slower than int ( eg on gwt ) but greatly improves rehashing , allowing even very poor hashcodes , such as those that only differ in their upper bits , to be used without high collision rates fibonacci hashing has increased collision rates when all or most hashcodes are multiples of larger fibonacci numbers ( see < a href = " https : probablydance com 2 0 1 8 0 6 1 6fibonacci - hashing - the - optimization - that - the - world - forgot - or - a - better - alternative - to - integer - modulo " > malte skarupke ' s blog post ) this method can be overriden to customizing hashing this may be useful eg in the unlikely event that most hashcodes are fibonacci numbers , if keys provide poor or incorrect hashcodes , or to simplify hashing if keys provide high quality hashcodes and don ' t need fibonacci hashing : { @ code return item hash code ( ) & mask ; }

protected int place ( long item ) { return ( int ) ( ( item ^ item > > > 32 ) * 0x 9 e 3 7 7 9 b 9 7 f 4 a 7 c 1 5 l > > > shift ) ; }


returns the data encapsulated in this { @ link transferable object } if the { @ link fetcher } constructor was used , then this is when the { @ link fetcher # get object get object ( ) } method will be called if the requested data flavor is not supported , then the { @ link fetcher # get object get object ( ) } method will not be called

public object get transfer data ( final java awt datatransfer data flavor flavor ) throws java awt datatransfer unsupported flavor exception , java io i o exception { / / native object if ( flavor equals ( data flavor ) ) return fetcher = = null ? data : fetcher get object ( ) ; / / string if ( flavor equals ( java awt datatransfer data flavor string flavor ) ) return fetcher = = null ? data to string ( ) : fetcher get object ( ) to string ( ) ; / / we can ' t do anything else throw new java awt datatransfer unsupported flavor exception ( flavor ) ; }


checks that the given options allow an insecure delete , throwing an exception if not

private static void check allows insecure ( path path , recursive delete option [ ] options ) throws insecure recursive delete exception { if ( ! arrays as list ( options ) contains ( recursive delete option allow insecure ) ) { throw new insecure recursive delete exception ( path to string ( ) ) ; } }


public type listener get listener ( ) { return listener ; }


get the headers for magic versions 1 and below , this always returns an empty array