continues a read from the provided { @ code source } into a given { @ code target } it ' s assumed that the data should be written into { @ code target } starting from an offset of zero

private boolean continue read ( parsable byte array source , byte [ ] target , int target length ) { int bytes to read = min ( source bytes left ( ) , target length - bytes read ) ; source read bytes ( target , bytes read , bytes to read ) ; bytes read + = bytes to read ; return bytes read = = target length ; }


get the progress of the job ' s cleanup - tasks , as a float between 0 0 and 1 0 when all cleanup tasks have completed , the function returns 1 0

public float cleanup progress ( ) throws i o exception , interrupted exception { ensure state ( job state running ) ; ensure fresh status ( ) ; return status get cleanup progress ( ) ; }


public raw comparable get last key ( ) throws i o exception { check t file data index ( ) ; return tfile index get last key ( ) ; }


constructs a map from new process definition entities to the previous version by key and tenant if no previous version exists , no map entry is created

protected map < process definition entity , process definition entity > get previous versions of process definitions ( parsed deployment parsed deployment ) { map < process definition entity , process definition entity > result = new linked hash map < process definition entity , process definition entity > ( ) ; for ( process definition entity new definition : parsed deployment get all process definitions ( ) ) { process definition entity existing definition = bpmn deployment helper get most recent version of process definition ( new definition ) ; if ( existing definition ! = null ) { result put ( new definition , existing definition ) ; } } return result ; }


tests that we can actually recover from a corruption on the primary given that we have replica shards around

public void test corrupt file and recover ( ) throws execution exception , interrupted exception , i o exception { int num docs = scaled random int between ( 100 , 1000 ) ; / / have enough space for 3 copies internal cluster ( ) ensure at least num data nodes ( 3 ) ; if ( cluster ( ) num data nodes ( ) = = 3 ) { logger info ( " - - > cluster has [ 3 ] data nodes , corrupted primary will be overwritten " ) ; } assert that ( cluster ( ) num data nodes ( ) , greater than or equal to ( 3 ) ) ; assert acked ( prepare create ( " test " ) set settings ( settings builder ( ) put ( index metadata setting number of shards , " 1 " ) put ( index metadata setting number of replicas , " 1 " ) put ( merge policy config index merge enabled , false ) / / no checkindex - we corrupt shards on purpose put ( mock f s index store index check index on close setting get key ( ) , false ) / / no translog based flush - it might change the liv / segments n files put ( index settings index translog flush threshold size setting get key ( ) , new byte size value ( 1 , byte size unit pb ) ) ) ) ; ensure green ( ) ; disable allocation ( " test " ) ; index request builder [ ] builders = new index request builder [ num docs ] ; for ( int i = 0 ; i < builders length ; i + + ) { builders [ i ] = client ( ) prepare index ( " test " ) set source ( " field " , " value " ) ; } index random ( true , builders ) ; ensure green ( ) ; / / double flush to create safe commit in case of async durability assert all successful ( client ( ) admin ( ) indices ( ) prepare flush ( ) set force ( true ) get ( ) ) ; assert all successful ( client ( ) admin ( ) indices ( ) prepare flush ( ) set force ( true ) get ( ) ) ; / / we have to flush at least once here since we don ' t corrupt the translog search response count response = client ( ) prepare search ( ) set size ( 0 ) get ( ) ; assert hit count ( count response , num docs ) ; final int num shards = num shards ( " test " ) ; shard routing corrupted shard routing = corrupt random primary file ( ) ; logger info ( " - - > { } corrupted " , corrupted shard routing ) ; enable allocation ( " test " ) ; / * * we corrupted the primary shard - now lets make sure we never recover from it successfully * / settings build = settings builder ( ) put ( index metadata setting number of replicas , " 2 " ) build ( ) ; client ( ) admin ( ) indices ( ) prepare update settings ( " test " ) set settings ( build ) get ( ) ; cluster health response health = client ( ) admin ( ) cluster ( ) health ( requests cluster health request ( " test " ) wait for green status ( ) timeout ( " 5m " ) / / sometimes due to cluster rebalacing and random settings default timeout is just not enough wait for no relocating shards ( true ) ) action get ( ) ; if ( health is timed out ( ) ) { logger info ( " cluster state : \ n { } \ n { } " , client ( ) admin ( ) cluster ( ) prepare state ( ) get ( ) get state ( ) , client ( ) admin ( ) cluster ( ) prepare pending cluster tasks ( ) get ( ) ) ; assert that ( " timed out waiting for green state " , health is timed out ( ) , equal to ( false ) ) ; } assert that ( health get status ( ) , equal to ( cluster health status green ) ) ; final int num iterations = scaled random int between ( 5 , 20 ) ; for ( int i = 0 ; i < num iterations ; i + + ) { search response response = client ( ) prepare search ( ) set size ( num docs ) get ( ) ; assert hit count ( response , num docs ) ; } / * * now hook into the indices service and register a close listener to * run the checkindex if the corruption is still there we will catch it * / final count down latch latch = new count down latch ( num shards * 3 ) ; / / primary + 2 replicas final copy on write array list < exception > exception = new copy on write array list < > ( ) ; final index event listener listener = new index event listener ( ) { @ override public void after index shard closed ( shard id sid , @ nullable index shard index shard , settings index settings ) { if ( index shard ! = null ) { store store = index shard store ( ) ; store inc ref ( ) ; try { if ( ! lucene index exists ( store directory ( ) ) & & index shard state ( ) = = index shard state started ) { return ; } bytes stream output os = new bytes stream output ( ) ; print stream out = new print stream ( os , false , standard charsets utf 8 name ( ) ) ; check index status status = store check index ( out ) ; out flush ( ) ; if ( ! status clean ) { logger warn ( " check index [ failure ] \ n { } " , os bytes ( ) utf 8 to string ( ) ) ; throw new i o exception ( " index check failure " ) ; } } catch ( exception e ) { exception add ( e ) ; } finally { store dec ref ( ) ; latch count down ( ) ; } } } } ; for ( mock index event listener test event listener event listener : internal cluster ( ) get data node instances ( mock index event listener test event listener class ) ) { event listener set new delegate ( listener ) ; } try { client ( ) admin ( ) indices ( ) prepare delete ( " test " ) get ( ) ; latch await ( ) ; assert that ( exception , empty ( ) ) ; } finally { for ( mock index event listener test event listener event listener : internal cluster ( ) get data node instances ( mock index event listener test event listener class ) ) { event listener set new delegate ( null ) ; } } }


return true if this aggregation is mapped , and can lead a reduction if this agg returns false , it should return itself if asked to lead a reduction

public boolean is mapped ( ) { return true ; }


public void get config ( watcher watcher , data callback cb , object ctx ) { final string config znode = zoo defs config node ; / / the watch contains the un - chroot path watch registration wcb = null ; if ( watcher ! = null ) { wcb = new data watch registration ( watcher , config znode ) ; } request header h = new request header ( ) ; h set type ( zoo defs op code get data ) ; get data request request = new get data request ( ) ; request set path ( config znode ) ; request set watch ( watcher ! = null ) ; get data response response = new get data response ( ) ; cnxn queue packet ( h , new reply header ( ) , request , response , cb , config znode , config znode , ctx , wcb ) ; }


loads settings from { @ link preferences }

public static void load from preferences ( ) { boolean use historical value = true ; string laf = preferences get property ( last look and feel key , get default look and feel name ( ) , use historical value ) ; set look and feel ( laf ) ; boolean use inverted colors = get use inverted colors preference ( ) ; set use inverted colors ( use inverted colors ) ; / / / / users can change this via the system utilities font size override property name / / system property / / integer font override = system utilities get font size override value ( ) ; if ( font override ! = null ) { set global font size override ( font override ) ; } }


public static int hash bytes ( byte [ ] bytes , int length ) { return hash bytes ( bytes , 0 , length ) ; }


invalidates the cached data and force retrieval

public http response do invalidate data ( ) { jenkins get ( ) check permission ( jenkins administer ) ; data timestamp = 0 ; data = null ; return http responses ok ( ) ; }


write the contents of this property file

public void write state ( ) throws i o exception { print writer writer = new print writer ( property file ) ; try { writer println ( " < ? xml version = \ " 1 0 \ " encoding = \ " utf - 8 \ " ? > " ) ; writer println ( " < file info > " ) ; writer println ( " < basic info > " ) ; for ( entry < string , pair < property entry type , string > > entry : map entry set ( ) ) { string property name = entry get key ( ) ; string property type = entry get value ( ) first rep ; string property value = entry get value ( ) second ; writer print ( " < state name = \ " " ) ; writer print ( xml utilities escape element entities ( property name ) ) ; writer print ( " \ " type = \ " " ) ; writer print ( xml utilities escape element entities ( property type ) ) ; writer print ( " \ " value = \ " " ) ; writer print ( xml utilities escape element entities ( property value ) ) ; writer println ( " \ " / > " ) ; } writer println ( " < / basic info > " ) ; writer println ( " < / file info > " ) ; } finally { writer close ( ) ; } }


public user get user by name ( string username ) throws timeout exception , execution exception , interrupted exception , api exception { object post body = null ; / / verify the required parameter ' username ' is set if ( username = = null ) { volley error error = new volley error ( " missing the required parameter ' username ' when calling get user by name " , new api exception ( 400 , " missing the required parameter ' username ' when calling get user by name " ) ) ; } / / create path and map variables string path = " / user / { username } " replace all ( " \ \ { " + " username " + " \ \ } " , api invoker escape string ( username to string ( ) ) ) ; / / query params list < pair > query params = new array list < pair > ( ) ; / / header params map < string , string > header params = new hash map < string , string > ( ) ; / / form params map < string , string > form params = new hash map < string , string > ( ) ; string [ ] content types = { } ; string content type = content types length > 0 ? content types [ 0 ] : " application / json " ; if ( content type starts with ( " multipart / form - data " ) ) { / / file uploading multipart entity builder local var builder = multipart entity builder create ( ) ; http entity http entity = local var builder build ( ) ; post body = http entity ; } else { / / normal form params } string [ ] auth names = new string [ ] { } ; try { string local var response = api invoker invoke a p i ( base path , path , " get " , query params , post body , header params , form params , content type , auth names ) ; if ( local var response ! = null ) { return ( user ) api invoker deserialize ( local var response , " " , user class ) ; } else { return null ; } } catch ( api exception ex ) { throw ex ; } catch ( interrupted exception ex ) { throw ex ; } catch ( execution exception ex ) { if ( ex get cause ( ) instanceof volley error ) { volley error volley error = ( volley error ) ex get cause ( ) ; if ( volley error network response ! = null ) { throw new api exception ( volley error network response status code , volley error get message ( ) ) ; } } throw ex ; } catch ( timeout exception ex ) { throw ex ; } }


sets the minimum and maximum vector to zeros

public bounding box clr ( ) { return this set ( min set ( 0 , 0 , 0 ) , max set ( 0 , 0 , 0 ) ) ; }


set an optional formatted message message formatting follows the same rules as { @ link string # format ( string , object ) }

public result builder with message ( string message , object args ) { return with message ( string format ( message , args ) ) ; }


specify the uri for the desired { @ code cache manager } default is { @ code null } ( i e j cache ' s default )

public void set cache manager uri ( @ nullable uri cache manager uri ) { this cache manager uri = cache manager uri ; }


explicitly set the analyzer to use defaults to use explicit mapping config for the field , or , if not set , the default search analyzer

public match query builder analyzer ( string analyzer ) { this analyzer = analyzer ; return this ; }


try many deletes in parallel ; this will create tombstones

public void test 090 delete ( ) throws throwable { path path = new path ( " s 3a : / / example org / delete " ) ; s 3 a file status status = new s 3 a file status ( true , path , " alice " ) ; path metadata metadata = new path metadata ( status ) ; ddbms put ( metadata , null ) ; i ttl time provider time = check not null ( get ttl time provider ( ) , " time provider " ) ; try ( duration info ignored = new duration info ( log , true , " delete " ) ) { execute ( " delete " , operations per thread , expect throttling ( ) , ( ) - > { ddbms delete ( path , null ) ; } ) ; } }


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


synchronous call to retrieve the last calculated bucket without waiting for any emissions

public output get latest ( ) { start caching stream values if unstarted ( ) ; if ( counter subject has value ( ) ) { return counter subject get value ( ) ; } else { return get empty output value ( ) ; } }


connect to the specified node with the default connection profile

public static void connect to node ( transport service service , discovery node node ) throws connect transport exception { connect to node ( service , node , null ) ; }


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

@ override public t visit dereference ( eql base parser dereference context ctx ) { return visit children ( ctx ) ; }


notification that the g task manager has been suspended or resumed

public void suspended state changed ( boolean suspended ) ;


equivalent to { @ link sql parser # create ( reader , sql parser config ) } the only difference is we do not wrap the { @ link flink sql parser impl } with { @ link sql parser } it is so that we can access specific parsing methods not accessible through the { @ code sql parser }

private sql abstract parser impl create flink parser ( string expr ) { source string reader reader = new source string reader ( expr ) ; sql abstract parser impl parser = config parser factory ( ) get parser ( reader ) ; parser set tab size ( 1 ) ; parser set quoted casing ( config quoted casing ( ) ) ; parser set unquoted casing ( config unquoted casing ( ) ) ; parser set identifier max length ( config identifier max length ( ) ) ; parser set conformance ( config conformance ( ) ) ; switch ( config quoting ( ) ) { case double quote : parser switch to ( sql abstract parser impl lexical state dqid ) ; break ; case back tick : parser switch to ( sql abstract parser impl lexical state btid ) ; break ; case bracket : parser switch to ( sql abstract parser impl lexical state default ) ; break ; } return parser ; }


public void finish ( ) { finished = true ; }


this method can be called after get match for returned null it inserts the given record to the hash table important : the given record should have the same key as the record that was given to get match for ! warning ; don ' t do any modifications to the table between get match for and insert after no match !

public void insert after no match ( t record ) throws i o exception { if ( closed ) { return ; } / / create new link long pointer to appended ; try { pointer to appended = record area append pointer and record ( end of list , record ) ; } catch ( e o f exception ex ) { compact or throw ( ) ; insert ( record ) ; return ; } / / add new link to the end of the list if ( prev elem ptr = = invalid prev pointer ) { / / list was empty bucket segments [ bucket segment index ] put long ( bucket offset , pointer to appended ) ; } else { / / update the pointer of the last element of the list record area overwrite pointer at ( prev elem ptr , pointer to appended ) ; } num elements + + ; resize table if necessary ( ) ; }


marks this step as the last step in the { @ code closing future } pipeline when this step is done , { @ code receiver } will be called with an object that contains the result of the operation the receiver can store the { @ link value and closer } outside the receiver for later synchronous use after calling this method , you may not call { @ link # finish to future ( ) } , this method again , or any other derivation method on this { @ code closing future }

public void finish to value and closer ( final value and closer consumer < ? super v > consumer , executor executor ) { check not null ( consumer ) ; if ( ! compare and update state ( open , will create value and closer ) ) { switch ( state get ( ) ) { case subsumed : throw new illegal state exception ( " cannot call finish to value and closer ( ) after deriving another step " ) ; case will close : case closing : case closed : throw new illegal state exception ( " cannot call finish to value and closer ( ) after calling finish to future ( ) " ) ; case will create value and closer : throw new illegal state exception ( " cannot call finish to value and closer ( ) twice " ) ; case open : break ; } throw new assertion error ( state ) ; } future add listener ( new runnable ( ) { @ override public void run ( ) { provide value and closer ( consumer , closing future this ) ; } } , executor ) ; }


public string get volume set i d ( ) { return volume set i d ; }


check a { @ link rounding prepared # next rounding value } that was difficult to build well with the java time a p is

public void test hard next rounding value ( ) { rounding rounding = new rounding time interval rounding ( 960000 , zone id of ( " europe / minsk " ) ) ; long rounded = rounding prepare for unknown ( ) round ( 877824908400l ) ; long next = rounding prepare for unknown ( ) next rounding value ( rounded ) ; assert that ( next , greater than ( rounded ) ) ; }


public static void drop table ( database db , boolean if exists ) { string sql = " drop table " + ( if exists ? " if exists " : " " ) + " \ " custom type entity \ " " ; db exec s q l ( sql ) ; }


closes the given stream the same as calling { @ link output stream # close ( ) } , but errors while closing are silently ignored

public static void close silently ( output stream output stream ) { try { if ( output stream ! = null ) { output stream close ( ) ; } } catch ( i o exception ignore ) { / / exception is silently ignored } }


multiplies this vector by the transpose of the first three columns of the matrix note : only works for translation and rotation , does not work for scaling for those , use { @ link # rot ( matrix 4 ) } with { @ link matrix 4 # inv ( ) }

public vector 3 unrotate ( final matrix 4 matrix ) { final float l mat [ ] = matrix val ; return this set ( x * l mat [ matrix 4 m00 ] + y * l mat [ matrix 4 m10 ] + z * l mat [ matrix 4 m20 ] , x * l mat [ matrix 4 m01 ] + y * l mat [ matrix 4 m11 ] + z * l mat [ matrix 4 m21 ] , x * l mat [ matrix 4 m02 ] + y * l mat [ matrix 4 m12 ] + z * l mat [ matrix 4 m22 ] ) ; }


the error from the user provided observer is not handled by the subscribe method trycatch it is handled by the atomic observer that wraps the provided observer result : passes ( if atomic observer functionality exists )

public void custom observable with error in observer asynchronous ( ) throws interrupted exception { final count down latch latch = new count down latch ( 1 ) ; final atomic integer count = new atomic integer ( ) ; final atomic reference < throwable > error = new atomic reference < > ( ) ; / / fixme custom built ? ? ? observable just ( " 1 " , " 2 " , " three " , " 4 " ) subscribe on ( schedulers new thread ( ) ) safe subscribe ( new default observer < string > ( ) { @ override public void on complete ( ) { system out println ( " completed " ) ; latch count down ( ) ; } @ override public void on error ( throwable e ) { error set ( e ) ; system out println ( " error " ) ; e print stack trace ( ) ; latch count down ( ) ; } @ override public void on next ( string v ) { int num = integer parse int ( v ) ; system out println ( num ) ; / / do something ( num ) ; count increment and get ( ) ; } } ) ; / / wait for async sequence to complete latch await ( ) ; assert equals ( 2 , count get ( ) ) ; assert not null ( error get ( ) ) ; if ( ! ( error get ( ) instanceof number format exception ) ) { fail ( " it should be a number format exception " ) ; } }


defensive approach to avoid involuntary change since the u u i ds are generated at startup only for ui and so between restart they change

public synchronized void reconfigure ( @ non null map < string , j s o n object > token store data map ) { token list for each ( hashed token - > { j s o n object received token data = token store data map get ( hashed token uuid ) ; if ( received token data = = null ) { logger log ( level info , " no token received for { 0 } " , hashed token uuid ) ; return ; } string name = received token data get string ( " token name " ) ; if ( string utils is blank ( name ) ) { logger log ( level info , " empty name received for { 0 } , we do not care about it " , hashed token uuid ) ; return ; } hashed token set name ( name ) ; } ) ; }


make next set of down - converted records

protected converted records make next ( ) { / / if we have cached the first down - converted batch , return that now if ( first converted batch ! = null ) { converted records converted batch = first converted batch ; first converted batch = null ; return converted batch ; } while ( batch iterator has next ( ) ) { final list < record batch > batches = new array list < > ( ) ; boolean is first batch = true ; long size so far = 0 ; / / figure out batches we should down - convert based on the size constraints while ( batch iterator has next ( ) & & ( is first batch | | ( batch iterator peek ( ) size in bytes ( ) + size so far ) < = maximum read size ) ) { record batch current batch = batch iterator next ( ) ; batches add ( current batch ) ; size so far + = current batch size in bytes ( ) ; is first batch = false ; } converted records converted records = records util down convert ( batches , to magic , first offset , time ) ; / / during conversion , it is possible that we drop certain batches because they do not have an equivalent / / representation in the message format we want to convert to for example , v0 and v1 message formats / / have no notion of transaction markers which were introduced in v2 so they get dropped during conversion / / we return converted records only when we have at least one valid batch of messages after conversion if ( converted records records ( ) size in bytes ( ) > 0 ) return converted records ; } return all done ( ) ; }


< code > required string message = 1 ; < code >

public string get message ( ) { object ref = message ; if ( ref instanceof string ) { return ( string ) ref ; } else { com google protobuf byte string bs = ( com google protobuf byte string ) ref ; string s = bs to string utf 8 ( ) ; if ( bs is valid utf 8 ( ) ) { message = s ; } return s ; } }


public boolean matches ( method description target ) { parameter list < ? > parameters = target get parameters ( ) ; if ( parameters size ( ) > index ) { return parameters get ( index ) get type ( ) as erasure ( ) get name ( ) equals ( argument type name ) ; } return false ; }


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


reads a signed long value in this { @ link class reader } this method is intended for { @ link attribute } sub classes , and is normally not needed by class generators or adapters

public long read long ( final int offset ) { long l 1 = read int ( offset ) ; long l 0 = read int ( offset + 4 ) & 0x f f f f f f f f l ; return ( l 1 < < 32 ) | l 0 ; }


sets a new address correlation for associating addresses between the left and right sides the field panels can then be coordinated by locking the layouts together whenever the current location on one side can be correlated with a location on the other side

public void set correlation ( listing address correlation address correlation ) { this address correlation = address correlation ; reset locked lines ( ) ; }


fetch database host ( s ) from connection url

protected string fetch database hosts from u r l ( ) { u r l location hosts location = fetch database hosts index range ( ) ; return url substring ( hosts location start index ( ) , hosts location end index ( ) ) ; }


queue maintenance move projects between { @ link # waiting list } , { @ link # blocked projects } , { @ link # buildables } , and { @ link # pendings } appropriately jenkins internally invokes this method by itself whenever there ' s a change that can affect the scheduling ( such as new node becoming online , # of executors change , a task completes execution , etc ) , and it also gets invoked periodically ( see { @ link queue maintain task } )

public void maintain ( ) { jenkins jenkins = jenkins get instance or null ( ) ; if ( jenkins = = null ) { return ; } lock lock ( ) ; try { try { logger log ( level fine , " queue maintenance started on { 0 } with { 1 } " , new object [ ] { this , snapshot } ) ; / / the executors that are currently waiting for a job to run map < executor , job offer > parked = new hash map < > ( ) ; { / / update parked ( and identify any pending items whose executor has disappeared ) list < buildable item > lost pendings = new array list < > ( pendings ) ; for ( computer c : jenkins get computers ( ) ) { for ( executor e : c get all executors ( ) ) { if ( e is interrupted ( ) ) { / / jenkins - 28840 we will deadlock if we try to touch this executor while interrupt flag set / / we need to clear lost pendings as we cannot know what work unit was on this executor / / while it is interrupted ( all this dancing is a result of executor extending thread ) lost pendings clear ( ) ; / / we ' ll get them next time around when the flag is cleared logger log ( level finest , " interrupt thread for executor { 0 } is set and we do not know what work unit was on the executor " , e get display name ( ) ) ; continue ; } if ( e is parking ( ) ) { logger log ( level finest , " { 0 } is parking and is waiting for a job to execute " , e get display name ( ) ) ; parked put ( e , new job offer ( e ) ) ; } final work unit work unit = e get current work unit ( ) ; if ( work unit ! = null ) { lost pendings remove ( work unit context item ) ; } } } / / pending - > buildable for ( buildable item p : lost pendings ) { if ( logger is loggable ( level fine ) ) { logger log ( level fine , " buildable item { 0 } : pending - > buildable as the assigned executor disappeared " , p task get full display name ( ) ) ; } p is pending = false ; pendings remove ( p ) ; make buildable ( p ) ; / / todo whatever this is for , the return value is being ignored , so this does nothing at all } } final queue sorter s = sorter ; { / / blocked - > buildable / / copy as we ' ll mutate the list and we want to process in a potentially different order list < blocked item > blocked items = new array list < > ( blocked projects values ( ) ) ; / / if facing a cycle of blocked tasks , ensure we process in the desired sort order if ( s ! = null ) { s sort blocked items ( blocked items ) ; } else { blocked items sort ( queue sorter default blocked item comparator ) ; } for ( blocked item p : blocked items ) { string task display name = logger is loggable ( level finest ) ? p task get full display name ( ) : null ; logger log ( level finest , " current blocked item : { 0 } " , task display name ) ; cause of blockage cause of blockage = get cause of blockage for item ( p ) ; if ( cause of blockage = = null ) { logger log ( level finest , " blocked item { 0 } : blocked - > buildable as the build is not blocked and new tasks are allowed " , task display name ) ; / / ready to be executed runnable r = make buildable ( new buildable item ( p ) ) ; if ( r ! = null ) { p leave ( this ) ; r run ( ) ; / / jenkins - 28926 we have removed a task from the blocked projects and added to building / / thus we should update the snapshot so that subsequent blocked projects can correctly / / determine if they are blocked by the lucky winner update snapshot ( ) ; } } else { p set cause of blockage ( cause of blockage ) ; } } } / / waiting list - > buildable / blocked while ( ! waiting list is empty ( ) ) { waiting item top = peek ( ) ; if ( top timestamp compare to ( new gregorian calendar ( ) ) > 0 ) { logger log ( level finest , " finished moving all ready items from queue " ) ; break ; / / finished moving all ready items from queue } top leave ( this ) ; cause of blockage cause of blockage = get cause of blockage for item ( top ) ; if ( cause of blockage = = null ) { / / ready to be executed immediately runnable r = make buildable ( new buildable item ( top ) ) ; string top task display name = logger is loggable ( level finest ) ? top task get full display name ( ) : null ; if ( r ! = null ) { logger log ( level finest , " executing runnable { 0 } " , top task display name ) ; r run ( ) ; } else { logger log ( level finest , " item { 0 } was unable to be made a buildable and is now a blocked item " , top task display name ) ; new blocked item ( top , cause of blockage from message ( messages queue hudson is about to shut down ( ) ) ) enter ( this ) ; } } else { / / this can ' t be built now because another build is in progress / / set this project aside new blocked item ( top , cause of blockage ) enter ( this ) ; } } if ( s ! = null ) { try { s sort buildable items ( buildables ) ; } catch ( throwable e ) { / / we don ' t really care if the sort doesn ' t sort anything , we still should / / continue to do our job we ' ll complain about it and continue logger log ( level warning , " s sort buildable items ( ) threw throwable : { 0 } " , e ) ; } } / / ensure that identification of blocked tasks is using the live state : jenkins - 27708 & jenkins - 27871 update snapshot ( ) ; / / allocate buildable jobs to executors for ( buildable item p : new array list < > ( buildables ) ) { / / copy as we ' ll mutate the list in the loop / / one last check to make sure this build is not blocked cause of blockage cause of blockage = get cause of blockage for item ( p ) ; if ( cause of blockage ! = null ) { p leave ( this ) ; new blocked item ( p , cause of blockage ) enter ( this ) ; logger log ( level fine , " catching that { 0 } is blocked in the last minute " , p ) ; / / jenkins - 28926 we have moved an unblocked task into the blocked state , update snapshot / / so that other buildables which might have been blocked by this can see the state change update snapshot ( ) ; continue ; } string task display name = logger is loggable ( level finest ) ? p task get full display name ( ) : null ; if ( p task instanceof flyweight task ) { runnable r = make fly weight task buildable ( new buildable item ( p ) ) ; if ( r ! = null ) { p leave ( this ) ; logger log ( level finest , " executing flyweight task { 0 } " , task display name ) ; r run ( ) ; update snapshot ( ) ; } } else { list < job offer > candidates = new array list < > ( parked size ( ) ) ; map < node , cause of blockage > reason map = new hash map < > ( ) ; for ( job offer j : parked values ( ) ) { node offer node = j get node ( ) ; cause of blockage reason ; if ( reason map contains key ( offer node ) ) { reason = reason map get ( offer node ) ; } else { reason = j get cause of blockage ( p ) ; reason map put ( offer node , reason ) ; } if ( reason = = null ) { logger log ( level finest , " { 0 } is a potential candidate for task { 1 } " , new object [ ] { j , task display name } ) ; candidates add ( j ) ; } else { logger log ( level finest , " { 0 } rejected { 1 } : { 2 } " , new object [ ] { j , task display name , reason } ) ; } } mapping worksheet ws = new mapping worksheet ( p , candidates ) ; mapping m = load balancer map ( p task , ws ) ; if ( m = = null ) { / / if we couldn ' t find the executor that fits , / / just leave it in the buildables list and / / check if we can execute other projects logger log ( level finer , " failed to map { 0 } to executors candidates = { 1 } parked = { 2 } " , new object [ ] { p , candidates , parked values ( ) } ) ; list < cause of blockage > reasons = reason map values ( ) stream ( ) filter ( objects : : non null ) collect ( collectors to list ( ) ) ; p transient causes of blockage = reasons is empty ( ) ? null : reasons ; continue ; } / / found a matching executor use it work unit context wuc = new work unit context ( p ) ; logger log ( level finest , " found a matching executor for { 0 } using it " , task display name ) ; m execute ( wuc ) ; p leave ( this ) ; if ( ! wuc get work units ( ) is empty ( ) ) { logger log ( level finest , " buildable item { 0 } marked as pending " , task display name ) ; make pending ( p ) ; } else logger log ( level finest , " buildable item { 0 } with empty work units ! ? " , p ) ; / / ensure that identification of blocked tasks is using the live state : jenkins - 27708 & jenkins - 27871 / / the creation of a snapshot itself should be relatively cheap given the expected rate of / / job execution you probably would need 100 ' s of jobs starting execution every iteration / / of maintain ( ) before this could even start to become an issue and likely the calculation / / of get cause of blockage for item ( p ) will become a bottleneck before update snapshot ( ) will additionally / / since the snapshot itself only ever has at most one reference originating outside of the stack / / it should remain in the eden space and thus be cheap to gc / / see https : / / jenkins - ci org / issue / 27708 ? focused comment id = 225819 & page = com atlassian jira plugin system issuetabpanels : comment - tabpanel # comment - 225819 / / or https : / / jenkins - ci org / issue / 27708 ? focused comment id = 225906 & page = com atlassian jira plugin system issuetabpanels : comment - tabpanel # comment - 225906 / / for alternative fixes of this issue update snapshot ( ) ; } } } finally { update snapshot ( ) ; } } finally { lock unlock ( ) ; } }


get the paritition number for a given key ( hence record ) given the total number of partitions i e number of reduce - tasks for the job typically a hash function on a all or a subset of the key

int get partition ( k2 key , v2 value , int num partitions ) ;


load extra data from a doc implementers should grow their underlying storage to fit the { @ code index }

void load from doc ( long index , int doc ) throws i o exception ;


sets the negotiation type for the http2 connection to tls ( this is the default ) with tls enabled , a default { @ link s s l socket factory } is created using the best { @ link java security provider } available and is not based on { @ link s s l socket factory # get default } to more precisely control the tls configuration call { @ link # ssl socket factory ( s s l socket factory ) } to override the socket factory used

public ok http channel builder use transport security ( ) { preconditions check state ( ! freeze security configuration , " cannot change security when using channel credentials " ) ; negotiation type = negotiation type tls ; return this ; }


truncate this buffer file this method has no affect if the specified new buffer cnt is greater than the current buffer count

boolean truncate ( int new index cnt ) { if ( new index cnt > = next index ) { return false ; } next index = new index cnt ; / / remove free indexes which have been lost int cnt = free index stack size ( ) ; for ( int i = cnt - 1 ; i > = 0 ; - - i ) { int free index = free index stack get ( i ) int value ( ) ; if ( free index > = new index cnt ) { free index stack remove ( i ) ; } } return true ; }


determine whether an annotation of the specified { @ code annotation type } is declared locally ( i e directly present ) on the supplied { @ code clazz } the supplied { @ link class } may represent any type meta - annotations will not be searched note : this method does not determine if the annotation is { @ linkplain java lang annotation inherited inherited }

public static boolean is annotation declared locally ( class < ? extends annotation > annotation type , class < ? > clazz ) { return merged annotations from ( clazz ) get ( annotation type ) is directly present ( ) ; }


returns the scope annotation on { @ code type } , or null if none is specified

public static class < ? extends annotation > find scope annotation ( errors errors , class < ? > implementation ) { return find scope annotation ( errors , implementation get annotations ( ) ) ; }


constructs an array of injectable constants for a specific { @ link painless method } derived from an { @ link org elasticsearch painless spi annotation inject constant annotation }

public static object [ ] build injections ( painless method painless method , map < string , object > constants ) { if ( painless method annotations contains key ( inject constant annotation class ) = = false ) { return new object [ 0 ] ; } list < string > names = ( ( inject constant annotation ) painless method annotations get ( inject constant annotation class ) ) injects ; object [ ] injections = new object [ names size ( ) ] ; for ( int i = 0 ; i < names size ( ) ; i + + ) { string name = names get ( i ) ; object constant = constants get ( name ) ; if ( constant = = null ) { throw new illegal state exception ( " constant [ " + name + " ] not found for injection into method " + " [ " + build painless method key ( painless method java method get name ( ) , painless method type parameters size ( ) ) + " ] " ) ; } injections [ i ] = constant ; } return injections ; }


returns dependency links derived from spans in an interval contained by ( end ts - lookback ) or empty if none are found implementations may bucket aggregated data , for example daily when this is the case , end ts may be floored to align with that bucket , for example midnight if daily lookback applies to the original end ts , even when bucketed using the daily example , if end ts was 1 1pm and lookback was 25 hours , the implementation would query against 2 buckets some implementations parse spans from storage and call { @ link dependency linker } to aggregate links the reason is certain graph logic , such as skipping up the tree is difficult to implement as a storage query spans are grouped by the right - most 16 characters of the trace id this ensures call counts are not incremented twice due to one hop downgrading from 128 to 64 - bit trace i ds

call < list < dependency link > > get dependencies ( long end ts , long lookback ) ;


visit a parse tree produced by the { @ code true } labeled alternative in { @ link painless parser # primary }

t visit true ( painless parser true context ctx ) ;


returns the metric store containing all stored metrics

public metric store get metric store ( ) { return metrics ; }


finds a table factory of the given class , property map , and classloader

public static < t extends table factory > t find ( class < t > factory class , map < string , string > property map , class loader class loader ) { preconditions check not null ( class loader ) ; return find single internal ( factory class , property map , optional of ( class loader ) ) ; }


the loop in run ( ) checks this before fetching next batch of records since this runnable will be executed by the executor service { @ code kinesis data fetcher # shard consumers executor } , the only way to close down this thread would be by calling shutdown now ( ) on { @ code kinesis data fetcher # shard consumers executor } and let the executor service interrupt all currently running { @ link shard consumer } s

private boolean is running ( ) { return ! thread interrupted ( ) ; }


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

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


returns the number of unprocessed mangled characters note that demangle ( ) has a flag controlling whether remaining characters causes an error

public int get num chars remaining ( ) { return num chars remaining ; }


return the contained media type expressions

public set < media type expression > get expressions ( ) { return new linked hash set < > ( this expressions ) ; }


determine whether the provided bean definition is an autowire candidate to be considered a candidate the bean ' s autowire - candidate attribute must not have been set to ' false ' also , if an annotation on the field or parameter to be autowired is recognized by this bean factory as a qualifier , the bean must ' match ' against the annotation as well as any attributes it may contain the bean definition must contain the same qualifier or match by meta attributes a " value " attribute will fallback to match against the bean name or an alias if a qualifier or attribute does not match

public boolean is autowire candidate ( bean definition holder bd holder , dependency descriptor descriptor ) { boolean match = super is autowire candidate ( bd holder , descriptor ) ; if ( match ) { match = check qualifiers ( bd holder , descriptor get annotations ( ) ) ; if ( match ) { method parameter method param = descriptor get method parameter ( ) ; if ( method param ! = null ) { method method = method param get method ( ) ; if ( method = = null | | void class = = method get return type ( ) ) { match = check qualifiers ( bd holder , method param get method annotations ( ) ) ; } } } } return match ; }


can override to add preconditions for dynamic matching this implementation always returns true

public boolean matches ( method method , class < ? > target class ) { return true ; }


patch a configuration to declare this the dt provider for a filesystem built off the given configuration the abfs filesystem still needs to come up with security enabled

public static configuration use stub d t manager ( configuration conf ) { conf set boolean ( fs azure enable delegation token , true ) ; conf set ( fs azure delegation token provider type , stub delegation token manager name ) ; return conf ; }


copies the 4x 3 upper - left sub - matrix into float array the destination array is supposed to be a column major matrix


mangle given local java keystore file uri to allow use as a local java key store provider

public static uri nest u r i for local java key store provider ( final uri local file ) throws u r i syntax exception { if ( ! ( " file " equals ( local file get scheme ( ) ) ) ) { throw new illegal argument exception ( " passed uri had a scheme other than " + " file " ) ; } if ( local file get authority ( ) ! = null ) { throw new illegal argument exception ( " passed uri must not have an " + " authority component for non - local keystores , please use " + java key store provider class get name ( ) ) ; } return new uri ( local java key store provider scheme name , " / / file " + local file get scheme specific part ( ) , local file get fragment ( ) ) ; }


creates a view from the given { @ link data set } in a given path with specified field names registered views can be referenced in sql queries there are two modes for mapping original fields to the fields of the view : 1 reference input fields by name : all fields in the schema definition are referenced by name ( and possibly renamed using an alias ( as ) in this mode , fields can be reordered and projected out this mode can be used for any input type , including p o j os example : { @ code data set < tuple 2 < string , long > > set = use the original ' f 0 ' field and give a better name to the ' f 1 ' field table env create temporary view ( " cat db my table " , set , " f 0 , f 1 as name " ) ; } 2 reference input fields by position : in this mode , fields are simply renamed this mode can only be used if the input type has a defined field order ( tuple , case class , row ) and none of the { @ code fields } references a field of the input type example : { @ code data set < tuple 2 < string , long > > set = renames the original fields as ' a ' and ' b ' table env create temporary view ( " cat db my table " , set , " a , b " ) ; } temporary objects can shadow permanent ones if a permanent object in a given path exists , it will be inaccessible in the current session to make the permanent object available again you can drop the corresponding temporary object

< t > void create temporary view ( string path , data set < t > data set , string fields ) ;


validate that the provided application name is valid , and throws an exception otherwise

public static void validate application name ( string application ) { validate application name ( application , false ) ; }


checks whether there are entries with absent keys or values

public boolean has absent keys or values ( ) { for ( entry < string , key value < k , v > > entry : underlying map entry set ( ) ) { if ( key or value is absent ( entry ) ) { return true ; } } return false ; }


expose the object to synchronize on for the underlying session

public object get session mutex ( ) { object mutex = this attributes get ( session mutex name ) ; if ( mutex = = null ) { mutex = this attributes ; } return mutex ; }


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


instantiate and invoke all registered bean factory post processor beans , respecting explicit order if given must be called before singleton instantiation

protected void invoke bean factory post processors ( configurable listable bean factory bean factory ) { post processor registration delegate invoke bean factory post processors ( bean factory , get bean factory post processors ( ) ) ; / / detect a load time weaver and prepare for weaving , if found in the meantime / / ( e g through an @ bean method registered by configuration class post processor ) if ( ! in native image & & bean factory get temp class loader ( ) = = null & & bean factory contains bean ( load time weaver bean name ) ) { bean factory add bean post processor ( new load time weaver aware processor ( bean factory ) ) ; bean factory set temp class loader ( new context type match class loader ( bean factory get bean class loader ( ) ) ) ; } }


create a builder with a { @ linkplain http status # see other 303 see other } status and a location header set to the given uri

static body builder see other ( uri location ) { body builder builder = status ( http status see other ) ; return builder location ( location ) ; }


method to get the window start for a timestamp

public static long get window start with offset ( long timestamp , long offset , long window size ) { return timestamp - ( timestamp - offset + window size ) % window size ; }


loads a built - in index lifecycle policy and returns its source

public static lifecycle policy load policy ( string name , string resource , named x content registry x content registry ) { try { bytes reference source = load ( resource ) ; validate ( source ) ; try ( x content parser parser = x content type json x content ( ) create parser ( x content registry , logging deprecation handler throw unsupported operation , source utf 8 to string ( ) ) ) { return lifecycle policy parse ( parser , name ) ; } } catch ( exception e ) { throw new illegal argument exception ( " unable to load policy [ " + name + " ] from [ " + resource + " ] " , e ) ; } }


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

public static fields find by name ( string name ) { return by name get ( name ) ; }


returns a { @ code starlark list } with the given items and the { @ link mutability } if { @ code mutability } is null , the list is immutable

public static < t > starlark list < t > of ( @ nullable mutability mutability , t elems ) { if ( elems length = = 0 ) { return new list ( mutability ) ; } check elems valid ( elems ) ; return wrap ( mutability , arrays copy of ( elems , elems length , object [ ] class ) ) ; }


sets whether to use # ext - x - session - key tags provided in the master playlist if enabled , it ' s assumed that any single session key declared in the master playlist can be used to obtain all of the keys required for playback for media where this is not true , this option should not be enabled

public factory set use session keys ( boolean use session keys ) { this use session keys = use session keys ; return this ; }


create a { @ link consumer record } with the given topic name , key , and value the timestamp will be generated based on the constructor provided start time and time will auto advance

public consumer record < byte [ ] , byte [ ] > create ( final string topic name , final k key , final v value ) { final long timestamp = time ms ; time ms + = advance ms ; return create ( topic name , key , value , new record headers ( ) , timestamp ) ; }


calculates a single black point for each block of pixels and saves it away see the following thread for a discussion of this algorithm : http : groups google comgroupzxingbrowse threadthreadd 0 6efa 2c 3 5a 7ddc 0

private static int [ ] [ ] calculate black points ( byte [ ] luminances , int sub width , int sub height , int width , int height ) { int max y offset = height - block size ; int max x offset = width - block size ; int [ ] [ ] black points = new int [ sub height ] [ sub width ] ; for ( int y = 0 ; y < sub height ; y + + ) { int yoffset = y < < block size power ; if ( yoffset > max y offset ) { yoffset = max y offset ; } for ( int x = 0 ; x < sub width ; x + + ) { int xoffset = x < < block size power ; if ( xoffset > max x offset ) { xoffset = max x offset ; } int sum = 0 ; int min = 0x f f ; int max = 0 ; for ( int yy = 0 , offset = yoffset * width + xoffset ; yy < block size ; yy + + , offset + = width ) { for ( int xx = 0 ; xx < block size ; xx + + ) { int pixel = luminances [ offset + xx ] & 0x f f ; sum + = pixel ; / / still looking for good contrast if ( pixel < min ) { min = pixel ; } if ( pixel > max ) { max = pixel ; } } / / short - circuit min / max tests once dynamic range is met if ( max - min > min dynamic range ) { / / finish the rest of the rows quickly for ( yy + + , offset + = width ; yy < block size ; yy + + , offset + = width ) { for ( int xx = 0 ; xx < block size ; xx + + ) { sum + = luminances [ offset + xx ] & 0x f f ; } } } } / / the default estimate is the average of the values in the block int average = sum > > ( block size power * 2 ) ; if ( max - min < = min dynamic range ) { / / if variation within the block is low , assume this is a block with only light or only / / dark pixels in that case we do not want to use the average , as it would divide this / / low contrast area into black and white pixels , essentially creating data out of noise / / / / the default assumption is that the block is light / background since no estimate for / / the level of dark pixels exists locally , use half the min for the block average = min / 2 ; if ( y > 0 & & x > 0 ) { / / correct the " white background " assumption for blocks that have neighbors by comparing / / the pixels in this block to the previously calculated black points this is based on / / the fact that dark barcode symbology is always surrounded by some amount of light / / background for which reasonable black point estimates were made the bp estimated at / / the boundaries is used for the interior / / the ( min < bp ) is arbitrary but works better than other heuristics that were tried int average neighbor black point = ( black points [ y - 1 ] [ x ] + ( 2 * black points [ y ] [ x - 1 ] ) + black points [ y - 1 ] [ x - 1 ] ) / 4 ; if ( min < average neighbor black point ) { average = average neighbor black point ; } } } black points [ y ] [ x ] = average ; } } return black points ; }


private short find key ( short key ) { short hashcode = ( short ) ( ( key & 0x 7fff ) % capacity ) ; short p = indexer first ( hashcode ) ; while ( p ! = - 1 ) { if ( keys [ p ] = = key ) { return p ; } p = indexer next ( p ) ; } return - 1 ; }


parses the given text into a key stroke this method relies upon { @ link key stroke # get key stroke ( string ) } for parsing before making that call , this method will perform fixup on the given text for added flexibility for example , the given text may contain spaces or dashes as the separators between parts in the string also , the text is converted such that it is not case - sensitive so , the following example formats are allowed : alt - f alt p ctrl - alt - z ctrl z

public static key stroke parse key stroke ( string key stroke ) { list < string > pieces = new array list < > ( ) ; string tokenizer tokenizer = new string tokenizer ( key stroke , " - " ) ; while ( tokenizer has more tokens ( ) ) { string token = tokenizer next token ( ) ; if ( ! pieces contains ( token ) ) { pieces add ( token ) ; } } string builder buffy = new string builder ( ) ; for ( iterator < string > iterator = pieces iterator ( ) ; iterator has next ( ) ; ) { string piece = iterator next ( ) ; if ( index of ignore case ( piece , shift ) ! = - 1 ) { buffy append ( " shift " ) ; iterator remove ( ) ; } else if ( index of ignore case ( piece , ctrl ) ! = - 1 ) { buffy append ( " ctrl " ) ; iterator remove ( ) ; } else if ( index of ignore case ( piece , control ) ! = - 1 ) { buffy append ( " ctrl " ) ; iterator remove ( ) ; } else if ( index of ignore case ( piece , alt ) ! = - 1 ) { buffy append ( " alt " ) ; iterator remove ( ) ; } else if ( index of ignore case ( piece , meta ) ! = - 1 ) { buffy append ( " meta " ) ; iterator remove ( ) ; } else if ( index of ignore case ( piece , pressed ) ! = - 1 ) { iterator remove ( ) ; } else if ( index of ignore case ( piece , typed ) ! = - 1 ) { iterator remove ( ) ; } else if ( index of ignore case ( piece , released ) ! = - 1 ) { iterator remove ( ) ; } } buffy append ( pressed ) append ( ' ' ) ; / / at this point we should only have left one piece - - the key id int leftover = pieces size ( ) ; if ( leftover > 1 | | leftover = = 0 ) { msg warn ( key binding utils class , " invalid keystroke string found expected " + " format of ' [ modifier ] key ' found : ' " + key stroke + " ' " ) ; if ( leftover = = 0 ) { return null ; / / nothing to do } } string key = pieces get ( 0 ) ; buffy append ( key to upper case ( ) ) ; return key stroke get key stroke ( buffy to string ( ) ) ; }


this method doesn ' t apply to the global symbol , since a program always has a global symbol and it can ' t be renamed therefore calling it will throw an unsupported operation exception return source the source of this symbol : default , imported , analysis , or user defined

public source type get source ( ) { throw new unsupported operation exception ( " getting the source of the global symbol is not allowed " ) ; }


executed once for every { @ link shard id } that failed on all available shard routing

protected void on shard group failure ( int shard index , search shard target shard target , exception exc ) { }


returns whether checkpoints should be persisted externally

public boolean is externalized checkpoints enabled ( ) { return externalized checkpoint cleanup ! = null ; }


creates a { @ link default leader retrieval service } instance with { @ link zoo keeper leader retrieval driver }

public static default leader retrieval service create leader retrieval service ( final curator framework client , final configuration configuration ) { return create leader retrieval service ( client , configuration , " " ) ; }


public list iterator < t > list iterator ( ) { throw new unsupported operation exception ( ) ; }


asserts the given number of subscriptions happened

public void assert subscriptions ( int n ) { assert assert equals ( n , get ( ) ) ; }


test serialization of object with outer number type

outer composite fake outer composite serialize ( outer composite body ) ;


private void create main panel ( ) { tabbed pane = new j tabbed pane ( ) ; tabbed pane add change listener ( this ) ; set layout ( new border layout ( ) ) ; add ( tabbed pane , border layout center ) ; set preferred size ( new dimension ( 200 , 300 ) ) ; for ( code comparison panel < ? extends field panel coordinator > code comparison panel : code comparison panels ) { code comparison panel load functions ( left comparison data get function ( ) , right comparison data get function ( ) ) ; j component component = code comparison panel get component ( ) ; tabbed pane add ( code comparison panel get title ( ) , component ) ; tab name to component map put ( code comparison panel get title ( ) , component ) ; } }


creates new dummy file included in the scope

static virtual file create dummy file ( project project ) { final psi file dummy file = psi file factory get instance ( project ) create file from text ( " dummy java " , std file types java , " class dummy { } " ) ; return include ( dummy file ) ; }


return mock invoker contract ： directory list ( ) will return a list of normal invokers if constants invocation need mock is present in invocation , otherwise , a list of mock invokers will return if directory list ( ) returns more than one mock invoker , only one of them will be used

private list < invoker < t > > select mock invoker ( invocation invocation ) { list < invoker < t > > invokers = null ; / / todo generic invoker ？ if ( invocation instanceof rpc invocation ) { / / note the implicit contract ( although the description is added to the interface declaration , but extensibility is a problem the practice placed in the attachment needs to be improved ) ( ( rpc invocation ) invocation ) set attachment ( invocation need mock , boolean true to string ( ) ) ; / / directory will return a list of normal invokers if constants invocation need mock is present in invocation , otherwise , a list of mock invokers will return try { invokers = directory list ( invocation ) ; } catch ( rpc exception e ) { if ( logger is info enabled ( ) ) { logger info ( " exception when try to invoke mock get mock invokers error for service : " + get url ( ) get service interface ( ) + " , method : " + invocation get method name ( ) + " , will construct a new mock with ' new mock invoker ( ) ' " , e ) ; } } } return invokers ; }


free all objects obtained using one of the ` obtain x x ` methods

protected static void free all ( ) { vector pool flush ( ) ; matrices 4 pool flush ( ) ; }


returns { @ link type information } about the operands of the evaluation method with a given signature

public type information < ? > [ ] get parameter types ( class < ? > [ ] signature ) { final type information < ? > [ ] types = new type information < ? > [ signature length ] ; for ( int i = 0 ; i < signature length ; i + + ) { try { types [ i ] = type extractor get for class ( signature [ i ] ) ; } catch ( invalid types exception e ) { throw new validation exception ( " parameter types of table function " + this get class ( ) get canonical name ( ) + " cannot be automatically determined please provide type information manually " ) ; } } return types ; }


tests that we can correctly recognize multiple conflicts with both the tag merger and the tag listing merger in this case we do the following : 1 add tags a , b and c to both programs 2 rename a in latest , and delete b 3 rename a and c in my , and add b to a function 4 verify we have 2 conflicts ( the edit of a , and the add of a deleted tag - b , in my )

public void test multiple tag and listing conflicts ( ) throws exception { mtf initialize ( notepad , new original program modifier listener ( ) { @ override public void modify latest ( program d b program ) throws exception { int transaction i d = program start transaction ( " latest " ) ; try { edit tag name ( program , tag name a , tag name a latest ) ; delete tag ( program , tag name b ) ; } finally { program end transaction ( transaction i d , true ) ; } } @ override public void modify private ( program d b program ) throws exception { int transaction i d = program start transaction ( " my " ) ; try { edit tag name ( program , tag name a , tag name a my ) ; add tag to function ( tag name b , program , " 1 0 0 1 9 4b " ) ; } finally { program end transaction ( transaction i d , true ) ; } } @ override public void modify original ( program d b program ) throws exception { int transaction i d = program start transaction ( " original " ) ; try { function tag manager tag manager = get tag manager ( program ) ; tag manager create function tag ( tag name a , " " ) ; tag manager create function tag ( tag name b , " " ) ; tag manager create function tag ( tag name c , " " ) ; } finally { program end transaction ( transaction i d , true ) ; } } } ) ; execute merge ( ask user ) ; choose function tag button ( my button , true ) ; choose listing function tag button ( my button , addr ( " 1 0 0 1 9 4b " ) , false ) ; wait for merge completion ( ) ; assert true ( is tag in program ( tag name a my , mtf get result program ( ) ) ) ; assert true ( is tag in program ( tag name b , mtf get result program ( ) ) ) ; assert true ( is tag in program ( tag name c , mtf get result program ( ) ) ) ; assert true ( is tag in function ( tag name b , mtf get result program ( ) , " 1 0 0 1 9 4b " ) ) ; }


returns the actual set of artifacts that need to be built

public nested set < artifact > get all artifacts ( ) { nested set builder < artifact > builder = new nested set builder < > ( artifacts get order ( ) ) ; for ( artifacts in output group artifacts in output group : artifacts to list ( ) ) { builder add transitive ( artifacts in output group get artifacts ( ) ) ; } return builder build ( ) ; }


process incoming message this should only be called from the event loop thread note that this method does not call < code > buf release ( ) < code > the caller is responsible for making sure the buf is released after this method returns

void process message ( byte buf buf ) { check is in event loop ( " process message " ) ; log debug ( " 0x { } queued buffer : { } " , long to hex string ( session id ) , queued buffer ) ; if ( log is trace enabled ( ) ) { log trace ( " 0x { } buf { } " , long to hex string ( session id ) , byte buf util hex dump ( buf ) ) ; } if ( throttled get ( ) ) { log debug ( " received message while throttled " ) ; / / we are throttled , so we need to queue if ( queued buffer = = null ) { log debug ( " allocating queue " ) ; queued buffer = channel alloc ( ) composite buffer ( ) ; } append to queued buffer ( buf retained duplicate ( ) ) ; if ( log is trace enabled ( ) ) { log trace ( " 0x { } queued buffer { } " , long to hex string ( session id ) , byte buf util hex dump ( queued buffer ) ) ; } } else { log debug ( " not throttled " ) ; if ( queued buffer ! = null ) { append to queued buffer ( buf retained duplicate ( ) ) ; process queued buffer ( ) ; } else { receive message ( buf ) ; / / have to check ! closing channel , because an error in / / receive message ( ) could have led to close ( ) being called if ( ! closing channel & & buf is readable ( ) ) { if ( log is trace enabled ( ) ) { log trace ( " before copy { } " , buf ) ; } if ( queued buffer = = null ) { queued buffer = channel alloc ( ) composite buffer ( ) ; } append to queued buffer ( buf retained slice ( buf reader index ( ) , buf readable bytes ( ) ) ) ; if ( log is trace enabled ( ) ) { log trace ( " copy is { } " , queued buffer ) ; log trace ( " 0x { } queued buffer { } " , long to hex string ( session id ) , byte buf util hex dump ( queued buffer ) ) ; } } } } }


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


set the maximum size of the dynamic table entries are evicted from the dynamic table until the size of the table is less than or equal to the maximum size

public void set capacity ( long capacity ) { if ( capacity < min header table size | | capacity > max header table size ) { throw new illegal argument exception ( " capacity is invalid : " + capacity ) ; } / / initially capacity will be - 1 so init won ' t return here if ( this capacity = = capacity ) { return ; } this capacity = capacity ; if ( capacity = = 0 ) { clear ( ) ; } else { / / initially size will be 0 so remove won ' t be called while ( size > capacity ) { remove ( ) ; } } int max entries = ( int ) ( capacity / hpack header field header entry overhead ) ; if ( capacity % hpack header field header entry overhead ! = 0 ) { max entries + + ; } / / check if capacity change requires us to reallocate the array if ( hpack header fields ! = null & & hpack header fields length = = max entries ) { return ; } hpack header field [ ] tmp = new hpack header field [ max entries ] ; / / initially length will be 0 so there will be no copy int len = length ( ) ; if ( hpack header fields ! = null ) { int cursor = tail ; for ( int i = 0 ; i < len ; i + + ) { hpack header field entry = hpack header fields [ cursor + + ] ; tmp [ i ] = entry ; if ( cursor = = hpack header fields length ) { cursor = 0 ; } } } tail = 0 ; head = tail + len ; hpack header fields = tmp ; }


private data find component ( data data , address addr ) { while ( addr compare to ( data get min address ( ) ) > = 0 ) { long offset = addr subtract ( data get min address ( ) ) ; data d = data get component at ( ( int ) offset ) ; if ( d = = null ) { break ; } data = d ; } return data ; }


return all the properties that can be changed at run time

collection < string > get reconfigurable properties ( ) ;


public void init cluster ( ) throws exception { hdfs configuration conf = create secure config ( " authentication , privacy " ) ; rolling file system sink has flushed = false ; rolling file system sink supplied conf = conf ; cluster = new mini d f s cluster builder ( conf ) num data nodes ( num datanodes ) build ( ) ; cluster wait active ( ) ; create directories securely ( ) ; }


verifies that { @ link remote input channel # on error ( throwable ) } is called when a { @ link buffer response } is received but no available buffer in input channel

public void test throw exception for no available buffer ( ) throws exception { final single input gate input gate = create single input gate ( 1 ) ; final remote input channel input channel = spy ( input channel builder new builder ( ) build remote channel ( input gate ) ) ; final credit based partition request client handler handler = new credit based partition request client handler ( ) ; handler add input channel ( input channel ) ; assert equals ( " there should be no buffers available in the channel " , 0 , input channel get number of available buffers ( ) ) ; final buffer response buffer response = create buffer response ( test buffer factory create buffer ( test buffer factory buffer size ) , 0 , input channel get input channel id ( ) , 2 , new network buffer allocator ( handler ) ) ; assert null ( buffer response get buffer ( ) ) ; handler channel read ( mock ( channel handler context class ) , buffer response ) ; verify ( input channel , times ( 1 ) ) on error ( any ( illegal state exception class ) ) ; }


allocate a new slot and register it this function chooses an empty slot , initializes it , and then returns the relevant slot object

synchronized public final slot alloc and register slot ( extended block id block id ) { int idx = allocated slots next clear bit ( 0 ) ; if ( idx > = slots length ) { throw new runtime exception ( this + " : no more slots are available " ) ; } allocated slots set ( idx , true ) ; slot slot = new slot ( calculate slot address ( idx ) , block id ) ; slot clear ( ) ; slot make valid ( ) ; slots [ idx ] = slot ; if ( log is trace enabled ( ) ) { log trace ( this + " : alloc and register slot " + idx + " : allocated slots = " + allocated slots + string utils get stack trace ( thread current thread ( ) ) ) ; } return slot ; }


public static void set short ( memory segment [ ] segments , int offset , short value ) { if ( in first segment ( segments , offset , 2 ) ) { segments [ 0 ] put short ( offset , value ) ; } else { set short multi segments ( segments , offset , value ) ; } }


variant of { @ link # to entity ( class ) } with a { @ link parameterized type reference }

< t > mono < response entity < list < t > > > to entity list ( parameterized type reference < t > element type ref ) ;


private void test t c 7 ( boolean append to new block ) throws exception { final short repl = 2 ; final path p = new path ( " / tc7 / foo " + ( append to new block ? " 0 " : " 1 " ) ) ; system out println ( " p = " + p ) ; / / a create file with replication factor of 2 write half block of data close file final int len 1 = ( int ) ( block size / 2 ) ; { f s data output stream out = fs create ( p , false , buffersize , repl , block size ) ; append test util write ( out , 0 , len 1 ) ; out close ( ) ; } d f s test util wait replication ( fs , p , repl ) ; / / b log into one datanode that has one replica of this block / / find the block file on this datanode and truncate it to zero size final located blocks locatedblocks = fs dfs get namenode ( ) get block locations ( p to string ( ) , 0l , len 1 ) ; assert equals ( 1 , locatedblocks located block count ( ) ) ; final located block lb = locatedblocks get ( 0 ) ; final extended block blk = lb get block ( ) ; assert equals ( len 1 , lb get block size ( ) ) ; datanode info [ ] datanodeinfos = lb get locations ( ) ; assert equals ( repl , datanodeinfos length ) ; final data node dn = cluster get data node ( datanodeinfos [ 0 ] get ipc port ( ) ) ; cluster get materialized replica ( dn , blk ) truncate data ( 0 ) ; / / c open file in " append mode " append a new block worth of data close file final int len 2 = ( int ) block size ; { f s data output stream out = append to new block ? fs append ( p , enum set of ( create flag append , create flag new block ) , 4096 , null ) : fs append ( p ) ; append test util write ( out , len 1 , len 2 ) ; out close ( ) ; } / / d reopen file and read two blocks worth of data append test util check ( fs , p , len 1 + len 2 ) ; }


returns a transition that sets the version to { @ link python options # get default python version }

public static python version transition to default ( ) { return to default instance ; }


< code > optional aapt pb file reference file = 5 ; < code >

public builder set file ( com android aapt resources file reference value ) { copy on write ( ) ; instance set file ( value ) ; return this ; }


the actual response ( { @ link index response } or { @ link delete response } ) { @ code null } in case of failure

public < t extends doc write response > t get response ( ) { return ( t ) response ; }


verify the selection count is within a given range ; return the original list if there ' s a mismatch , the whole list is logged at error , then an assertion raised

protected list < string > verify selection count ( final int min , final int max , final string expression , final list < string > selection ) { int size = selection size ( ) ; if ( size < min | | ( max > - 1 & & size > max ) ) { / / mismatch : log and then fail string listing = prepare to print ( selection ) ; log error ( " \ n { } = > \ n { } " , expression , listing ) ; fail ( " row count from select call " + expression + " is out of range " + min + " to " + max + " : " + size + " \ n " + listing ) ; } return selection ; }


public api client add default cookie ( string key , string value ) { default cookie map put ( key , value ) ; return this ; }


set a custom x stream { @ link converter lookup } to use also used as { @ link converter registry } if the given reference implements it as well

public void set converter lookup ( converter lookup converter lookup ) { this converter lookup = converter lookup ; if ( converter lookup instanceof converter registry ) { this converter registry = ( converter registry ) converter lookup ; } }


spin - waits up to the specified number of milliseconds for the given thread to enter a wait state : blocked , waiting , or timed waiting

void wait for thread to enter wait state ( thread thread , long timeout millis ) { long start time = system nano time ( ) ; for ( ; ; ) { thread state s = thread get state ( ) ; if ( s = = thread state blocked | | s = = thread state waiting | | s = = thread state timed waiting ) { return ; } else if ( s = = thread state terminated ) { fail ( " unexpected thread termination " ) ; } else if ( millis elapsed since ( start time ) > timeout millis ) { thread assert true ( thread is alive ( ) ) ; return ; } thread yield ( ) ; } }


verify that the encoding implemented by { @ link com google devtools build lib vfs file system utils # write content as latin 1 ( path , string ) } really is 8859 - 1 ( latin 1 )

public void test verify latin 1 ( ) throws i o exception { char [ ] all latin 1 chars = new char [ 256 ] ; for ( int i = 0 ; i < 256 ; i + + ) { all latin 1 chars [ i ] = ( char ) i ; } path path = fs get path ( a file get path ( ) ) ; string latin 1 string = new string ( all latin 1 chars ) ; file system utils write content as latin 1 ( path , latin 1 string ) ; byte [ ] bytes = file system utils read content ( path ) ; assert that ( latin 1 string ) is equal to ( new string ( bytes , " iso - 8859 - 1 " ) ) ; }


public static void main ( string [ ] args ) { / / initialize creatures list var creatures = list of ( new goblin ( ) , new octopus ( ) , new dragon ( ) , new shark ( ) , new troll ( ) , new killer bee ( ) ) ; / / so - called " hard - coded " specification logger info ( " demonstrating hard - coded specification : " ) ; / / find all walking creatures logger info ( " find all walking creatures " ) ; print ( creatures , new movement selector ( movement walking ) ) ; / / find all dark creatures logger info ( " find all dark creatures " ) ; print ( creatures , new color selector ( color dark ) ) ; logger info ( " \ n " ) ; / / so - called " parameterized " specification logger info ( " demonstrating parameterized specification : " ) ; / / find all creatures heavier than 5 0 0kg logger info ( " find all creatures heavier than 6 0 0kg " ) ; print ( creatures , new mass greater than selector ( 600 0 ) ) ; / / find all creatures heavier than 5 0 0kg logger info ( " find all creatures lighter than or weighing exactly 5 0 0kg " ) ; print ( creatures , new mass smaller than or eq selector ( 500 0 ) ) ; logger info ( " \ n " ) ; / / so - called " composite " specification logger info ( " demonstrating composite specification : " ) ; / / find all red and flying creatures logger info ( " find all red and flying creatures " ) ; var red and flying = new color selector ( color red ) and ( new movement selector ( movement flying ) ) ; print ( creatures , red and flying ) ; / / find all creatures dark or red , non - swimming , and heavier than or equal to 4 0 0kg logger info ( " find all scary creatures " ) ; var scary creatures selector = new color selector ( color dark ) or ( new color selector ( color red ) ) and ( new movement selector ( movement swimming ) not ( ) ) and ( new mass greater than selector ( 400 0 ) or ( new mass equal selector ( 400 0 ) ) ) ; print ( creatures , scary creatures selector ) ; }


send the stream termination footer bytes over the socket

protected void write stream end ( socket socket ) throws i o exception { output stream out = socket get output stream ( ) ; out write ( get stream terminator ( ) get bytes ( ) ) ; out flush ( ) ; }


checks the behavior of { @ link config setting # is under tools package }

public void is under tools package ( ) throws exception { repository name tools repo = repository name create ( " @ tools " ) ; / / subpackage of the tools package assert that ( config setting is under tools package ( label parse absolute unchecked ( " @ tools / / tools / subpkg : foo " ) , tools repo ) ) is true ( ) ; / / the tools package itself assert that ( config setting is under tools package ( label parse absolute unchecked ( " @ tools / / tools : foo " ) , tools repo ) ) is true ( ) ; / / the tools repo , but wrong package assert that ( config setting is under tools package ( label parse absolute unchecked ( " @ tools / / nottools : foo " ) , tools repo ) ) is false ( ) ; / / not even the tools repo assert that ( config setting is under tools package ( label parse absolute unchecked ( " @ nottools / / nottools : foo " ) , tools repo ) ) is false ( ) ; / / a tools package but in the wrong repo assert that ( config setting is under tools package ( label parse absolute unchecked ( " @ nottools / / tools : foo " ) , tools repo ) ) is false ( ) ; }


obtain a " shortcut " non - singleton factory bean instance to use for a { @ code get object type ( ) } call , without full initialization of the factory bean

private factory bean < ? > get non singleton factory bean for type check ( string bean name , root bean definition mbd ) { if ( is prototype currently in creation ( bean name ) ) { return null ; } object instance ; try { / / mark this bean as currently in creation , even if just partially before prototype creation ( bean name ) ; / / give bean post processors a chance to return a proxy instead of the target bean instance instance = resolve before instantiation ( bean name , mbd ) ; if ( instance = = null ) { bean wrapper bw = create bean instance ( bean name , mbd , null ) ; instance = bw get wrapped instance ( ) ; } } catch ( unsatisfied dependency exception ex ) { / / don ' t swallow , probably misconfiguration throw ex ; } catch ( bean creation exception ex ) { / / instantiation failure , maybe too early if ( logger is debug enabled ( ) ) { logger debug ( " bean creation exception on non - singleton factory bean type check : " + ex ) ; } on suppressed exception ( ex ) ; return null ; } finally { / / finished partial creation of this bean after prototype creation ( bean name ) ; } return get factory bean ( bean name , instance ) ; }


returns the configured target for the specified file label , configured for the " host " configuration

protected file configured target get host file configured target ( string label ) throws label syntax exception { return ( file configured target ) get host configured target ( label ) ; }


tests sending a bunch of async requests works well ( e g no timeout exception from the leased pool ) see https : github comelasticelasticsearchissues 2 4 0 6 9

public void test many async requests ( ) throws exception { int iters = random int between ( 500 , 1000 ) ; final count down latch latch = new count down latch ( iters ) ; final list < exception > exceptions = new copy on write array list < > ( ) ; for ( int i = 0 ; i < iters ; i + + ) { request request = new request ( " put " , " / 200 " ) ; request set entity ( new n string entity ( " { } " , content type application json ) ) ; rest client perform request async ( request , new response listener ( ) { @ override public void on success ( response response ) { latch count down ( ) ; } @ override public void on failure ( exception exception ) { exceptions add ( exception ) ; latch count down ( ) ; } } ) ; } assert true ( " timeout waiting for requests to be sent " , latch await ( 10 , time unit seconds ) ) ; if ( exceptions is empty ( ) = = false ) { assertion error error = new assertion error ( " expected no failures but got some see suppressed for first 10 of [ " + exceptions size ( ) + " ] failures " ) ; for ( exception exception : exceptions sub list ( 0 , math min ( 10 , exceptions size ( ) ) ) ) { error add suppressed ( exception ) ; } throw error ; } }


called when bazel initializes the action execution subsystem this is called once per build if action execution is enabled modules can override this method to affect how execution is performed

public void executor init ( command environment env , build request request , executor builder builder ) throws abrupt exit exception { }


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


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


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


close spring ' s web application context for the given servlet context if overriding { @ link # load parent context ( servlet context ) } , you may have to override this method as well

public void close web application context ( servlet context servlet context ) { servlet context log ( " closing spring root web application context " ) ; try { if ( this context instanceof configurable web application context ) { ( ( configurable web application context ) this context ) close ( ) ; } } finally { class loader ccl = thread current thread ( ) get context class loader ( ) ; if ( ccl = = context loader class get class loader ( ) ) { current context = null ; } else if ( ccl ! = null ) { current context per thread remove ( ccl ) ; } servlet context remove attribute ( web application context root web application context attribute ) ; } }


called when an audio renderer is disabled

default void on audio disabled ( event time event time , decoder counters counters ) { }


constructs a new parent id query that returns all child documents of the specified type that point to the specified id

public static parent id query builder parent id ( string type , string id ) { return new parent id query builder ( type , id ) ; }


public static void set int ( memory segment [ ] segments , int offset , int value ) { if ( in first segment ( segments , offset , 4 ) ) { segments [ 0 ] put int ( offset , value ) ; } else { set int multi segments ( segments , offset , value ) ; } }


public void seek ( long desired ) throws i o exception { ( ( seekable ) in ) seek ( desired ) ; }


returns the slot sharing group of this transformation

public string get slot sharing group ( ) { return slot sharing group ; }


actually close the given { @ link connection } , obtained from the given { @ link connection factory } same as { @ link # release connection } , but preserving the original exception

public static mono < void > do release connection ( connection connection , connection factory connection factory ) { return transaction synchronization manager for current transaction ( ) flat map ( synchronization manager - > { connection holder con holder = ( connection holder ) synchronization manager get resource ( connection factory ) ; if ( con holder ! = null & & connection equals ( con holder , connection ) ) { / / it ' s the transactional connection : don ' t close it con holder released ( ) ; } return mono from ( connection close ( ) ) ; } ) on error resume ( no transaction exception class , e - > mono from ( connection close ( ) ) ) ; }


returns a rule class name suitable for log messages , including an aspect name if applicable

public string get rule class name for logging ( ) { if ( aspects is empty ( ) ) { return target get associated rule ( ) get rule class ( ) ; } return joiner on ( " , " ) join ( aspects stream ( ) map ( a - > a get descriptor ( ) ) collect ( collectors to list ( ) ) ) + " aspect on " + target get associated rule ( ) get rule class ( ) ; }


static void write u d pv 4 ( byte buf byte buf , byte buf payload , int src address , int dst address ) { write packetv 4 ( byte buf , payload , udp , src address , dst address ) ; }


try to establish a connection with each server if one doesn ' t exist

public void connect all ( ) { long sid ; for ( enumeration < long > en = queue send map keys ( ) ; en has more elements ( ) ; ) { sid = en next element ( ) ; connect one ( sid ) ; } }


creates a ( network ) buffer with default size , i e { @ link # buffer size } , and unspecified data of the given size

public static buffer create buffer ( int data size ) { return create buffer ( buffer size , data size ) ; }


public void service init ( configuration conf ) throws i o exception { init storage ( conf ) ; }


appends { @ link rule info } protos to a { @ link module info builder }

public proto renderer append rule infos ( collection < rule info > rule infos ) { for ( rule info rule info : rule infos ) { module info add rule info ( rule info ) ; } return this ; }


returns the scale of all types that define a scale implicitly or explicitly

public static int get scale ( logical type logical type ) { return logical type accept ( scale extractor ) ; }


returns the mean time spent per foreground playback from the start of a seek until playback is ready again , in milliseconds , or { @ link c # time unset } if no playback has been in foreground

public long get mean seek time ms ( ) { return foreground playback count = = 0 ? c time unset : get total seek time ms ( ) / foreground playback count ; }


returns whether a period described by { @ code old info } can be kept for playing the media period described by { @ code new info }

private boolean can keep media period holder ( media period info old info , media period info new info ) { return old info start position us = = new info start position us & & old info id equals ( new info id ) ; }


check if the latest snapshot diff exists if not , add it

final d check and add latest snapshot diff ( int latest snapshot id , n current i node ) { final d last = get last ( ) ; return ( last ! = null & & snapshot id integer comparator compare ( last get snapshot id ( ) , latest snapshot id ) > = 0 ) ? last : add diff ( latest snapshot id , current i node ) ; }


deserializing the zxid digest from the input stream and update the digest from loaded snapshot

public boolean deserialize zxid digest ( input archive ia , long start zxid of snapshot ) throws i o exception { if ( ! zoo keeper server is digest enabled ( ) ) { return false ; } try { zxid digest zxid digest = new zxid digest ( ) ; zxid digest deserialize ( ia ) ; if ( zxid digest zxid > 0 ) { digest from loaded snapshot = zxid digest ; log info ( " the digest in the snapshot has digest version of { } , " + " , with zxid as 0x { } , and digest value as { } " , digest from loaded snapshot digest version , long to hex string ( digest from loaded snapshot zxid ) , digest from loaded snapshot digest ) ; } else { digest from loaded snapshot = null ; log info ( " the digest value is empty in snapshot " ) ; } / / there is possibility that the start zxid of a snapshot might / / be larger than the digest zxid in snapshot / / / / known cases : / / / / the new leader set the last processed zxid to be the new / / epoch + 0 , which is not mapping to any txn , and it uses / / this to take snapshot , which is possible if we don ' t / / clean database before switching to looking in this case / / the current zxid digest will be the zxid of last epoch and / / it ' s smaller than the zxid of the snapshot file / / / / it ' s safe to reset the target zxid digest to null and start / / to compare digest when replaying the first txn , since it ' s / / a non fuzzy snapshot if ( digest from loaded snapshot ! = null & & digest from loaded snapshot zxid < start zxid of snapshot ) { log info ( " the zxid of snapshot digest 0x { } is smaller " + " than the known snapshot highest zxid , the snapshot " + " started with zxid 0x { } it will be invalid to use " + " this snapshot digest associated with this zxid , will " + " ignore comparing it " , long to hex string ( digest from loaded snapshot zxid ) , long to hex string ( start zxid of snapshot ) ) ; digest from loaded snapshot = null ; } return true ; } catch ( e o f exception e ) { log warn ( " got eof exception while reading the digest , likely due to the reading an older snapshot " ) ; return false ; } }


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


allow sub - classes to associate a hint with the data buffer if it is a pooled buffer and supports leak tracking

protected void touch data buffer ( data buffer buffer ) { }


< code > optional string foo = 1 ; < code >


return true if this dog object is equal to o

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


removes the default acl for the given file

public void remove default acl ( path path ) throws i o exception { map < string , string > params = new hash map < string , string > ( ) ; params put ( op param , operation removedefaultacl to string ( ) ) ; http u r l connection conn = get connection ( operation removedefaultacl get method ( ) , params , path , true ) ; http exception utils validate response ( conn , http u r l connection http ok ) ; }


use the { @ linkplain # set database populator database populator } to set up the database

public void after properties set ( ) { execute ( this database populator ) ; }


public string message ( ) { return raw response message ( ) ; }


from a set of statements , create a policy

public static policy policy ( statement statements ) { return new policy ( statements ) ; }


set the { @ link async uncaught exception handler } to use to handle uncaught exceptions thrown by asynchronous method executions

public void set exception handler ( async uncaught exception handler exception handler ) { this exception handler = singleton supplier of ( exception handler ) ; }


escapes a single character using the replacement array and safe range values if the given character does not have an explicit replacement and lies outside the safe range then { @ link # escape unsafe } is called

protected final char [ ] escape ( char c ) { if ( c < replacements length ) { char [ ] chars = replacements [ c ] ; if ( chars ! = null ) { return chars ; } } if ( c > = safe min & & c < = safe max ) { return null ; } return escape unsafe ( c ) ; }


public okhttp 3 call build call ( final api callback callback ) throws api exception { return test group parameters call ( required string group , required boolean group , required int 6 4 group , string group , boolean group , int 6 4 group , callback ) ; }


public reader get n character stream ( string column label ) throws s q l exception { return null ; }


public geo location request get geo location ( ) { val request = new geo location request ( ) ; request set accuracy ( get ( field geo accuracy ) ) ; request set timestamp ( get ( field geo timestamp ) ) ; request set longitude ( get ( field geo longitude ) ) ; request set latitude ( get ( field geo latitude ) ) ; return request ; }


tracks whether any changes to file content are permitted

public boolean allow change ( ) { return allow changed ; }


merge this bindings with an other { @ link bindings } object and create a new merged { @ link bindings } object

public static bindings merge ( bindings left , bindings right ) { assert not null ( left , " left side bindings must not be null " ) ; assert not null ( right , " right side bindings must not be null " ) ; list < binding > result = new array list < > ( left get bindings ( ) size ( ) + right get bindings ( ) size ( ) ) ; result add all ( left get bindings ( ) values ( ) ) ; result add all ( right get bindings ( ) values ( ) ) ; return new bindings ( result ) ; }


adds a given exception to the exceptions attribute

public void add exception ( int exception index ) { int exception index table length = target exceptions attribute u 2exception index table length ; int [ ] exception index table = target exceptions attribute u 2exception index table ; / / make sure there is enough space for the new exception if ( exception index table length < = exception index table length ) { target exceptions attribute u 2exception index table = new int [ exception index table length + 1 ] ; system arraycopy ( exception index table , 0 , target exceptions attribute u 2exception index table , 0 , exception index table length ) ; exception index table = target exceptions attribute u 2exception index table ; } / / add the exception exception index table [ target exceptions attribute u 2exception index table length + + ] = exception index ; }


paint an 8 - bitpixel code string , as defined by etsi en 300 743 7 2 5 2 , to a canvas

private static int paint 8 bit pixel code string ( parsable bit array data , int [ ] clut entries , @ nullable byte [ ] clut map table , int column , int line , @ nullable paint paint , canvas canvas ) { boolean end of pixel code string = false ; do { int run length = 0 ; int clut index = 0 ; int peek = data read bits ( 8 ) ; if ( peek ! = 0x 0 0 ) { run length = 1 ; clut index = peek ; } else { if ( ! data read bit ( ) ) { peek = data read bits ( 7 ) ; if ( peek ! = 0x 0 0 ) { run length = peek ; clut index = 0x 0 0 ; } else { end of pixel code string = true ; } } else { run length = data read bits ( 7 ) ; clut index = data read bits ( 8 ) ; } } if ( run length ! = 0 & & paint ! = null ) { paint set color ( clut entries [ clut map table ! = null ? clut map table [ clut index ] : clut index ] ) ; canvas draw rect ( column , line , column + run length , line + 1 , paint ) ; } column + = run length ; } while ( ! end of pixel code string ) ; return column ; }


type - inferring factory method for creating a { @ link queuing removal listener }

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


returns the sum of weights of evicted entries this total does not include manual { @ linkplain cache # invalidate invalidations }

public long eviction weight ( ) { return eviction weight ; }


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


public boolean get attribute boolean ( ) { return attribute boolean ; }


returns true if this build should be kept and not deleted ( despite the name , this refers to the entire build , not merely the log file ) this is used as a signal to the { @ link build discarder }

public final boolean is keep log ( ) { return get why keep log ( ) ! = null ; }


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


this method is called by when the parser successfully matches an input symbol

void report match ( parser recognizer ) ;


visit a parse tree produced by the { @ code arithmetic unary } labeled alternative in { @ link eql base parser # operator expression }

t visit arithmetic unary ( eql base parser arithmetic unary context ctx ) ;


creates a projection that adds computed columns and finalizes the the table schema

private void push generated projection ( flink context context , flink rel builder rel builder , table schema schema ) { final sql expr to rex converter factory factory = context get sql expr to rex converter factory ( ) ; final sql expr to rex converter converter = factory create ( rel builder peek ( ) get row type ( ) ) ; final list < rex node > projection = schema get table columns ( ) stream ( ) map ( c - > { if ( c instanceof computed column ) { final computed column computed column = ( computed column ) c ; return converter convert to rex node ( computed column get expression ( ) ) ; } else { return rel builder field ( c get name ( ) ) ; } } ) collect ( collectors to list ( ) ) ; rel builder project named ( projection , arrays as list ( schema get field names ( ) ) , true ) ; }


protected void maybe ignore ( boolean suppress , string action , i o exception ex ) throws i o exception { if ( suppress ) { log debug ( action , ex ) ; } else { throw ex ; } }


string extract local username from uri ( string uri ) ;


instantiates a { @ link user defined function } assuming a jvm function with default constructor

public static user defined function instantiate function ( class < ? extends user defined function > function class ) { validate class ( function class , true ) ; try { return function class new instance ( ) ; } catch ( exception e ) { throw new validation exception ( string format ( " cannot instantiate user - defined function class ' % s ' " , function class get name ( ) ) , e ) ; } }


private pair < integer , integer > read web p image size ( ) { final pair < integer , integer > dimensions = webp util get size ( get input stream ( ) ) ; if ( dimensions ! = null ) { m width = dimensions first ; m height = dimensions second ; } return dimensions ; }


public static result trend get result trend ( run < ? , ? > run ) { result result = run get result ( ) ; if ( result = = result aborted ) { return aborted ; } else if ( result = = result not built ) { return not built ; } if ( result = = result success ) { if ( is fix ( run ) ) { return fixed ; } else { return success ; } } run < ? , ? > previous build = get previous non aborted build ( run ) ; if ( result = = result unstable ) { if ( previous build = = null ) { return unstable ; } if ( previous build get result ( ) = = result unstable ) { return still unstable ; } else if ( previous build get result ( ) = = result failure ) { return now unstable ; } else { return unstable ; } } else if ( result = = result failure ) { if ( previous build ! = null & & previous build get result ( ) = = result failure ) { return still failing ; } else { return failure ; } } throw new illegal argument exception ( " unknown result : ' " + result + " ' for build : " + run ) ; }


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


process the search response and return a stream of index requests as well as the cursor

tuple < stream < index request > , map < string , object > > process search response ( search response search response , string destination index , string destination pipeline , map < string , string > field mappings , transform indexer stats stats ) ;


vibrate must hold { @ code < uses - permission android : name = " android permission vibrate " > }

public static void vibrate ( final long milliseconds ) { vibrator vibrator = get vibrator ( ) ; if ( vibrator = = null ) return ; vibrator vibrate ( milliseconds ) ; }


default response entity < void > update pet ( @ api param ( value = " pet object that needs to be added to the store " , required = true ) @ valid @ request body pet body ) { return new response entity < > ( http status not implemented ) ; }