returns a { @ link transition factory } that wraps a static split transition

public static < t > transition factory < t > split ( split transition split transition ) { return new auto value transition factories split transition factory < t > ( split transition ) ; }


get all the install state filters , in extension order

public static list < install state filter > all ( ) { return extension list lookup ( install state filter class ) ; }


test correctness of successive snapshot creation and deletion with erasure coding policies create snapshot of ec dir ' s parent directory

public void test snapshots on erasure coding dirs parent dir ( ) throws exception { final int len = 1024 ; final path ec dir parent = new path ( " / parent " ) ; final path ec dir = new path ( ec dir parent , " ecdir " ) ; final path ec file = new path ( ec dir , " ecfile " ) ; fs mkdirs ( ec dir ) ; fs allow snapshot ( ec dir parent ) ; / / set erasure coding policy fs set erasure coding policy ( ec dir , ec policy get name ( ) ) ; d f s test util create file ( fs , ec file , len , ( short ) 1 , 0x f e e d ) ; string contents = d f s test util read file ( fs , ec file ) ; final path snap 1 = fs create snapshot ( ec dir parent , " snap 1 " ) ; final path snap 1 e c dir = new path ( snap 1 , ec dir get name ( ) ) ; assert equals ( " got unexpected erasure coding policy " , ec policy , fs get erasure coding policy ( snap 1 e c dir ) ) ; / / now delete the dir which has erasure coding policy re - create the dir again , and / / take another snapshot fs delete ( ec dir , true ) ; fs mkdir ( ec dir , fs permission get dir default ( ) ) ; final path snap 2 = fs create snapshot ( ec dir parent , " snap 2 " ) ; final path snap 2 e c dir = new path ( snap 2 , ec dir get name ( ) ) ; assert null ( " expected null erasure coding policy " , fs get erasure coding policy ( snap 2 e c dir ) ) ; / / make dir again with system default ec policy fs set erasure coding policy ( ec dir , ec policy get name ( ) ) ; final path snap 3 = fs create snapshot ( ec dir parent , " snap 3 " ) ; final path snap 3 e c dir = new path ( snap 3 , ec dir get name ( ) ) ; / / check that snap 3 ' s e c policy has the correct settings erasure coding policy ez snap 3 = fs get erasure coding policy ( snap 3 e c dir ) ; assert equals ( " got unexpected erasure coding policy " , ec policy , ez snap 3 ) ; / / check that older snapshots still have the old e c policy settings assert equals ( " got unexpected erasure coding policy " , ec policy , fs get erasure coding policy ( snap 1 e c dir ) ) ; assert null ( " expected null erasure coding policy " , fs get erasure coding policy ( snap 2 e c dir ) ) ; / / verify contents of the snapshotted file final path snapshotted e c file = new path ( snap 1 to string ( ) + " / " + ec dir get name ( ) + " / " + ec file get name ( ) ) ; assert equals ( " contents of snapshotted file have changed unexpectedly " , contents , d f s test util read file ( fs , snapshotted e c file ) ) ; / / now delete the snapshots out of order and verify the ec policy / / correctness fs delete snapshot ( ec dir parent , snap 2 get name ( ) ) ; assert equals ( " got unexpected erasure coding policy " , ec policy , fs get erasure coding policy ( snap 1 e c dir ) ) ; assert equals ( " got unexpected erasure coding policy " , ec policy , fs get erasure coding policy ( snap 3 e c dir ) ) ; fs delete snapshot ( ec dir parent , snap 1 get name ( ) ) ; assert equals ( " got unexpected erasure coding policy " , ec policy , fs get erasure coding policy ( snap 3 e c dir ) ) ; }


convert a string representation to a pattern block

public static assembly pattern block from string ( string str ) { if ( " [ ] " equals ( str ) ) { return new assembly pattern block ( 0 , new byte [ 0 ] , new byte [ 0 ] ) ; } int pos = 0 ; int offset = 0 ; / / compute the offset , byte consuming ss : while ( str region matches ( pos , shift str , 0 , shift str length ( ) ) ) { pos + = shift str length ( ) ; offset + + ; } if ( str region matches ( pos , shift str end , 0 , shift str end length ( ) ) ) { return new assembly pattern block ( offset , new byte [ 0 ] , new byte [ 0 ] ) ; } / / compute the length by counting the colons int length = 1 ; for ( int p = pos ; p < str length ( ) ; ) { int newpos = str index of ( ' : ' , p ) ; if ( newpos = = - 1 ) { break ; } length + + ; p = newpos + 1 ; } / / convert the bytes / / todo : optimize this some byte [ ] mask = new byte [ length ] ; byte [ ] vals = new byte [ length ] ; atomic long msk = new atomic long ( ) ; atomic long val = new atomic long ( ) ; int i = 0 ; for ( string hex : str split ( " : " ) ) { numeric utilities convert hex string to masked value ( msk , val , hex , 2 , 0 , null ) ; mask [ i ] = ( byte ) msk get ( ) ; vals [ i ] = ( byte ) val get ( ) ; i + + ; } return new assembly pattern block ( offset , mask , vals ) ; }


implementation of completing a task either { @ code v } or { @ code t } will be set but not both the { @ code final state } is the state to change to from { @ link # running } if the state is not in the running state we return { @ code false } after waiting for the state to be set to a valid final state ( { @ link # completed } , { @ link # cancelled } , or { @ link # interrupted } )

private boolean complete ( @ nullable v v , @ nullable throwable t , int final state ) { boolean do completion = compare and set state ( running , completing ) ; if ( do completion ) { / / if this thread successfully transitioned to completing , set the value / / and exception and then release to the final state this value = v ; / / don ' t actually construct a cancellation exception until necessary this exception = ( ( final state & ( cancelled | interrupted ) ) ! = 0 ) ? new cancellation exception ( " future cancel ( ) was called " ) : t ; release shared ( final state ) ; } else if ( get state ( ) = = completing ) { / / if some other thread is currently completing the future , block until / / they are done so we can guarantee completion acquire shared ( - 1 ) ; } return do completion ; }


< code > optional org apache dubbo metadata definition protobuf model p b request type c dubbo p b request type = 3 ; < code >

public org apache dubbo metadata definition protobuf model google p b p b request type get c dubbo p b request type ( ) { return c dubbo p b request type = = null ? org apache dubbo metadata definition protobuf model google p b p b request type get default instance ( ) : c dubbo p b request type ; }


public static synchronized void write new line ( string filename , string line to write , boolean debug ) { print writer writer = null ; string original = filename ; int counter = 0 ; boolean saved = false ; while ( ! saved ) { try { writer = new print writer ( new buffered writer ( new file writer ( filename , true ) ) ) ; writer println ( line to write ) ; if ( debug ) system out println ( " saved " + filename + " > " + line to write + " to disk " ) ; saved = true ; } catch ( exception e ) { if ( debug ) system out println ( " failed saving , trying to save as " + filename ) ; if ( original contains ( " " ) ) { filename = insert file name ( original , " " + counter ) ; } else filename = original + counter ; counter + + ; } } writer close ( ) ; }


test verifies the multi create with invalid create mode flag

public void test invalid create mode flag ( boolean use async ) throws exception { list < integer > expected result codes = new array list < integer > ( ) ; expected result codes add ( keeper exception code runtimeinconsistency int value ( ) ) ; expected result codes add ( keeper exception code badarguments int value ( ) ) ; expected result codes add ( keeper exception code runtimeinconsistency int value ( ) ) ; int create mode flag = 6789 ; list < op > op list = arrays as list ( op create ( " / multi 0 " , new byte [ 0 ] , ids open acl unsafe , create mode persistent ) , op create ( " / multi 1 " , new byte [ 0 ] , ids open acl unsafe , create mode flag ) , op create ( " / multi 2 " , new byte [ 0 ] , ids open acl unsafe , create mode persistent ) ) ; string expected err = keeper exception code badarguments name ( ) ; multi having errors ( zk , op list , expected result codes , expected err , use async ) ; } @ parameterized test @ value source ( booleans = { true , false }


gets the proto representation of the python user - defined aggregate functions to be executed

public flink fn api user defined aggregate functions get user defined functions proto ( ) { flink fn api user defined aggregate functions builder builder = super get user defined functions proto ( ) to builder ( ) ; builder set count star inserted ( count star inserted ) ; return builder build ( ) ; }


test an oom situation where no containers are killed successfully we have two ' running ' containers , none of which are actually running as processes their cgroup procs file is not available , so kill them won ' t succeed

public void test exception thrown when no containers killed successfully ( ) throws exception { concurrent hash map < container id , container > containers = new concurrent hash map < > ( ) ; container c 1 = create container ( 1 , false , 1l , true ) ; containers put ( c 1 get container id ( ) , c 1 ) ; container c 2 = create container ( 2 , false , 2l , true ) ; containers put ( c 2 get container id ( ) , c 2 ) ; container executor ex = create container executor ( containers ) ; context context = mock ( context class ) ; when ( context get containers ( ) ) then return ( containers ) ; when ( context get container executor ( ) ) then return ( ex ) ; c groups handler c groups handler = mock ( c groups handler class ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , " " , cgroup param memory oom control ) ) then return ( " under oom 1 " ) then return ( " under oom 0 " ) ; / / c 1 process has not started , hence no cgroup procs file yet when ( c groups handler get c group param ( c groups handler c group controller memory , c 1 get container id ( ) to string ( ) , cgroup procs file ) ) then throw ( new resource handler exception ( cgroup procs file + " not found " ) ) ; / / c 2 process has not started , hence no cgroup procs file yet when ( c groups handler get c group param ( c groups handler c group controller memory , c 2 get container id ( ) to string ( ) , cgroup procs file ) ) then throw ( new resource handler exception ( cgroup procs file + " not found " ) ) ; default o o m handler handler = new default o o m handler ( context , false ) { @ override protected c groups handler get c groups handler ( ) { return c groups handler ; } } ; handler run ( ) ; }


public pet get pet by id ( @ path param ( " pet id " ) long pet id ) ;


copy the in stream to the to file the to file will be overwritten or created

public final static long copy stream to file ( input stream in , file to file , boolean append , task monitor monitor ) throws i o exception { try ( output stream out = new file output stream ( to file , append ) ) { return copy stream to stream ( in , out , monitor ) ; } }


returns the alpha value for all web lines

public int get web alpha ( ) { return m web alpha ; }


stores a byte value in the table at the given row and column note - all values in a given column must be of the same type

public void put byte ( int row , int col , byte value ) { if ( col > = data columns length ) { grow table ( col + 1 ) ; } byte array ba = null ; if ( data columns [ col ] = = null ) { ba = new byte array ( ) ; data columns [ col ] = ba ; } else { ba = ( byte array ) data columns [ col ] ; } ba put ( row , value ) ; }


asserts that two objects are equal if they are not , an { @ link assertion error } is thrown

protected void assert original equals to unmarshalled ( r expected , r actual ) { assert assert equals ( expected , actual ) ; }


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

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


decodes one or more stomp frames from the given { @ code byte buffer } into a list of { @ link message messages } if there was enough data to parse a " content - length " header , then the value is used to determine how much more data is needed before a new attempt to decode is made if there was not enough data to parse the " content - length " , or if there is " content - length " header , every subsequent call to decode attempts to parse again with all available data therefore the presence of a " content - length " header helps to optimize the decoding of large messages

public list < message < byte [ ] > > decode ( byte buffer new buffer ) { this chunks add ( new buffer ) ; check buffer limits ( ) ; integer content length = this expected content length ; if ( content length ! = null & & get buffer size ( ) < content length ) { return collections empty list ( ) ; } byte buffer buffer to decode = assemble chunks and reset ( ) ; multi value map < string , string > headers = new linked multi value map < > ( ) ; list < message < byte [ ] > > messages = this stomp decoder decode ( buffer to decode , headers ) ; if ( buffer to decode has remaining ( ) ) { this chunks add ( buffer to decode ) ; this expected content length = stomp header accessor get content length ( headers ) ; } return messages ; }


is the queue empty for more than the given time in millisecond ?

boolean is empty ( long time ) { return time monotonic now ( ) - empty start time get ( ) > time & & queue is empty ( ) ; }


opens an f s data input stream with the indicated file id extracted from the { @ link path handle }

public f s data input stream open ( path handle fd , int buffer size ) throws i o exception { statistics increment read ops ( 1 ) ; storage statistics increment op counter ( op type open ) ; if ( ! ( fd instanceof hdfs path handle ) ) { fd = new hdfs path handle ( fd bytes ( ) ) ; } hdfs path handle id = ( hdfs path handle ) fd ; final d f s input stream dfsis = dfs open ( id , buffer size , verify checksum ) ; return dfs create wrapped input stream ( dfsis ) ; }


gets headers for the given size and whether the keyvalues should be limited to ascii

static list < hpack header > headers ( hpack headers size size , boolean limit to ascii ) { return headers map get ( new headers key ( size , limit to ascii ) ) ; }


moves the entry to the mru position , if it falls outside of the fast - path threshold

private void on protected hit ( node node ) { node move to tail ( head protected ) ; }


public void enum form string test ( ) { / / todo : test enum form string }


return whether asynchronous request processing has been completed


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


public rpc context set local address ( string host , int port ) { if ( port < 0 ) { port = 0 ; } this local address = inet socket address create unresolved ( host , port ) ; return this ; }


begin building a blob for the provided data allows for the creation of in - memory blobs

public memory blob builder for data ( @ non null byte [ ] data ) { return new memory blob builder ( data ) ; }


visit a parse tree produced by the { @ code parenthesized expression } labeled alternative in { @ link sql base parser # primary expression }

t visit parenthesized expression ( sql base parser parenthesized expression context ctx ) ;


like { @ link # create stdout ( ) } , except it tags with the marker ' 3 ' to indicate control flow

public output stream create control ( ) { return new marking stream ( control marker ) ; }


public string get time zone ( ) { return time zone ; }


get the encoded length if an integer is stored in a variable - length format

public static int get v int size ( long i ) { if ( i > = - 112 & & i < = 127 ) { return 1 ; } if ( i < 0 ) { i ^ = - 1l ; / / take one ' s complement ' } / / find the number of bytes with non - leading zeros int data bits = long size - long number of leading zeros ( i ) ; / / find the number of data bytes + length byte return ( data bits + 7 ) / 8 + 1 ; }


if there is a breadcrumb node indicating that another node may need fencing , try to fence that node

private stat fence old active ( ) throws interrupted exception , keeper exception { final stat stat = new stat ( ) ; byte [ ] data ; log info ( " checking for any old active which needs to be fenced " ) ; try { data = zk do with retries ( new z k action < byte [ ] > ( ) { @ override public byte [ ] run ( ) throws keeper exception , interrupted exception { return zk client get data ( zk bread crumb path , false , stat ) ; } } ) ; } catch ( keeper exception ke ) { if ( is node does not exist ( ke code ( ) ) ) { log info ( " no old node to fence " ) ; return null ; } / / if we failed to read for any other reason , then likely we lost / / our session , or we don ' t have permissions , etc in any case , / / we probably shouldn ' t become active , and failing the whole / / thing is the best bet throw ke ; } log info ( " old node exists : { } " , string utils byte to hex string ( data ) ) ; if ( arrays equals ( data , app data ) ) { log info ( " but old node has our own data , so don ' t need to fence it " ) ; } else { app client fence old active ( data ) ; } return stat ; }


returns true iff { @ code path } denotes an existing directory see { @ link path # is directory ( symlinks ) } for specification

protected abstract boolean is directory ( path path , boolean follow symlinks ) ;


creates memory blocks for the given header

protected void process memory blocks ( mach header header , string source , boolean process sections , boolean allow zero addr ) throws exception { monitor set message ( " processing memory blocks for " + source + " " ) ; if ( header get file type ( ) = = mach header file types mh dylib stub ) { return ; } / / create memory blocks for segments for ( segment command segment : header get all segments ( ) ) { if ( monitor is cancelled ( ) ) { break ; } if ( segment get file size ( ) > 0 & & ( allow zero addr | | segment get v maddress ( ) ! = 0 ) ) { if ( create memory block ( segment get segment name ( ) , space get address ( segment get v maddress ( ) ) , segment get file offset ( ) , segment get file size ( ) , segment get segment name ( ) , source , segment is read ( ) , segment is write ( ) , segment is execute ( ) , false ) = = null ) { log append msg ( string format ( " failed to create block : % s 0x % x 0x % x " , segment get segment name ( ) , segment get v maddress ( ) , segment get v msize ( ) ) ) ; } if ( segment get v msize ( ) > segment get file size ( ) ) { / / pad the remaining address range with uninitialized data if ( create memory block ( segment get segment name ( ) , space get address ( segment get v maddress ( ) ) add ( segment get file size ( ) ) , 0 , segment get v msize ( ) - segment get file size ( ) , segment get segment name ( ) , source , segment is read ( ) , segment is write ( ) , segment is execute ( ) , true ) = = null ) { log append msg ( string format ( " failed to create block : % s 0x % x 0x % x " , segment get segment name ( ) , segment get v maddress ( ) , segment get v msize ( ) ) ) ; } } } else { log append msg ( " skipping segment : " + segment get segment name ( ) + " ( " + source + " ) " ) ; } } / / create memory blocks for sections they will be in the segments we just created , so the / / segment blocks will be split and possibly replaced if ( process sections ) { for ( section section : header get all sections ( ) ) { if ( monitor is cancelled ( ) ) { break ; } if ( section get size ( ) > 0 & & ( allow zero addr | | section get address ( ) ! = 0 ) ) { if ( create memory block ( section get section name ( ) , space get address ( section get address ( ) ) , section get offset ( ) , section get size ( ) , section get segment name ( ) , source , section is read ( ) , section is write ( ) , section is execute ( ) , section get type ( ) = = section types s zerofill ) = = null ) { log append msg ( string format ( " failed to create block : % s % s 0x % x 0x % x % s " , section get segment name ( ) , section get section name ( ) , section get address ( ) , section get size ( ) , source ) ) ; } } else { log append msg ( " skipping section : " + section get segment name ( ) + " " + section get section name ( ) + " ( " + source + " ) " ) ; } } } }


set analyzer timeout on a per - file basis

public void set per file analysis timeout ( string string in secs ) throws invalid input exception { try { per file timeout = integer parse int ( string in secs ) ; } catch ( number format exception nfe ) { throw new invalid input exception ( " ' " + string in secs + " ' is not a valid integer representation " ) ; } }


public static string get file content ( file file , string charset name ) throws i o exception { random access file fis = null ; file lock rlock = null ; try { fis = new random access file ( file , " r " ) ; file channel fcin = fis get channel ( ) ; int i = 0 ; do { try { rlock = fcin try lock ( 0l , long max value , true ) ; } catch ( exception e ) { + + i ; if ( i > retry count ) { naming logger error ( " [ na ] read " + file get name ( ) + " fail ; retryed time : " + i , e ) ; throw new i o exception ( " read " + file get absolute path ( ) + " conflict " ) ; } sleep ( sleep basetime * i ) ; naming logger warn ( " read " + file get name ( ) + " conflict ; retry time : " + i ) ; } } while ( null = = rlock ) ; int file size = ( int ) fcin size ( ) ; byte buffer byte buffer = byte buffer allocate ( file size ) ; fcin read ( byte buffer ) ; byte buffer flip ( ) ; return byte buffer to string ( byte buffer , charset name ) ; } finally { if ( rlock ! = null ) { rlock release ( ) ; rlock = null ; } if ( fis ! = null ) { io utils close quietly ( fis ) ; fis = null ; } } }


record statistics and perform rule checking for the given resource

public static entry entry ( string name , entry type traffic type , int batch count ) throws block exception { return env sph entry ( name , traffic type , batch count , objects0 ) ; }


returns any feedback the command wants to provide for logging this message should be appropriate to expose to the user after the command has been applied

default optional < string > get message ( ) { return optional empty ( ) ; }


returns a random version index compatible with the given version , but not the given version

public static version random previous compatible version ( random random , version version ) { / / todo : change this to minimum compatibility version ( ) , but first need to remove released / unreleased / / versions so get previous verison returns the * actual * previous version otherwise eg 8 0 0 returns say 7 0 2 for previous , / / but 7 2 0 for minimum compat return random version between ( random , version minimum index compatibility version ( ) , get previous version ( version ) ) ; }


public program change set get result change set ( ) { return model get result change set ( ) ; }


resolve the value for the method parameter

mono < object > resolve argument ( method parameter parameter , binding context binding context , server web exchange exchange ) ;


attempts to find a field location for the given address from the given program location

private field location get field location ( address address , program location location , boolean use default location ) { big integer index = address to index map get index ( address ) ; layout layout = get layout ( index ) ; if ( layout = = null ) { index = get layout within code unit ( address ) ; layout = get layout ( index ) ; } if ( layout = = null ) { return null ; } if ( layout get num fields ( ) = = 0 ) { return null ; } int default field index = 0 ; for ( int i = 0 ; i < layout get num fields ( ) ; i + + ) { listing field f = ( listing field ) layout get field ( i ) ; field factory factory = f get field factory ( ) ; if ( factory get class ( ) = = default field factory class ) { default field index = i ; } / / this method only returns a location if all information matches field location floc = factory get field location ( f , index , i , location ) ; if ( floc ! = null ) { return floc ; } } / / if no exact match and using defaults is on , just return a basic location for the / / default field if ( use default location ) { return new field location ( index , default field index , 0 , 0 ) ; } return null ; }


gets the reason for an item ' s eviction in eviction events

cache event listener eviction reason get eviction reason ( ) ;


attempts always load the resource into the cache and return the { @ link file } containing the cached source data this method is designed to work for remote data that is or will be cached using { @ link com bumptech glide load engine disk cache strategy # data } as a result , specifying a { @ link com bumptech glide load engine disk cache strategy } on this request is generally not recommended

public request builder < file > download only ( ) { return as ( file class ) apply ( download only options ) ; }


this helper method makes up the shortage of contains method in collection to support the function of case insensitive contains it only supports the string generic type of collection , cause other types have no cases concept

public static boolean contains ignore cases ( collection < string > collection , string string ) { if ( collection = = null ) { return false ; } if ( string = = null ) { return collection contains ( null ) ; } boolean contains = false ; for ( string element : collection ) { if ( string equals ignore case ( element ) ) { contains = true ; break ; } } return contains ; }


constructs a create operation arguments are as for the zoo keeper method of the same name

public static op create ( string path , byte [ ] data , list < acl > acl , int flags ) { return new create ( path , data , acl , flags ) ; }


tests { @ link result partition manager # create subpartition view ( result partition i d , int , buffer availability listener ) } would throw a { @ link partition not found exception } if the registered partition was released from manager via { @ link result partition # fail ( throwable ) } before

public void test create subpartition on failing partition ( ) throws exception { final result partition manager manager = new result partition manager ( ) ; final result partition partition = new result partition builder ( ) set result partition manager ( manager ) build ( ) ; manager register result partition ( partition ) ; partition fail ( null ) ; verify create subpartition view throws exception ( manager , partition get partition id ( ) ) ; }


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


set sse comment if a multi - line comment is provided , it will be turned into multiple sse comment lines as defined in server - sent events w3c recommendation

builder < t > comment ( string comment ) ;


sets the likelihood of a term being a misspelled even if the term exists in the dictionary the default it { @ code 0 95 } corresponding to 5 % or the real words are misspelled

public phrase suggestion builder real word error likelihood ( float real word error likelihood ) { if ( real word error likelihood < = 0 0 ) { throw new illegal argument exception ( " real word error likelihood must be > 0 0 " ) ; } this real word error likelihood = real word error likelihood ; return this ; }


return the default class loader to use : typically the thread context class loader , if available ; the class loader that loaded the class utils class will be used as fallback call this method if you intend to use the thread context class loader in a scenario where you absolutely need a non - null class loader reference : for example , for class path resource loading ( but not necessarily for < code > class for name < code > , which accepts a < code > null < code > class loader reference as well )

public static class loader get class loader ( ) { return get class loader ( class helper class ) ; }


< code > optional bytes data = 1 ; < code >

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


driver for input sampler from the command line configures a job conf instance and calls { @ link # write partition file }

public int run ( string [ ] args ) throws exception { job job = job get instance ( get conf ( ) ) ; array list < string > other args = new array list < string > ( ) ; sampler < k , v > sampler = null ; for ( int i = 0 ; i < args length ; + + i ) { try { if ( " - r " equals ( args [ i ] ) ) { job set num reduce tasks ( integer parse int ( args [ + + i ] ) ) ; } else if ( " - in format " equals ( args [ i ] ) ) { job set input format class ( class for name ( args [ + + i ] ) as subclass ( input format class ) ) ; } else if ( " - key class " equals ( args [ i ] ) ) { job set map output key class ( class for name ( args [ + + i ] ) as subclass ( writable comparable class ) ) ; } else if ( " - split sample " equals ( args [ i ] ) ) { int num samples = integer parse int ( args [ + + i ] ) ; int max splits = integer parse int ( args [ + + i ] ) ; if ( 0 > = max splits ) max splits = integer max value ; sampler = new split sampler < k , v > ( num samples , max splits ) ; } else if ( " - split random " equals ( args [ i ] ) ) { double pcnt = double parse double ( args [ + + i ] ) ; int num samples = integer parse int ( args [ + + i ] ) ; int max splits = integer parse int ( args [ + + i ] ) ; if ( 0 > = max splits ) max splits = integer max value ; sampler = new random sampler < k , v > ( pcnt , num samples , max splits ) ; } else if ( " - split interval " equals ( args [ i ] ) ) { double pcnt = double parse double ( args [ + + i ] ) ; int max splits = integer parse int ( args [ + + i ] ) ; if ( 0 > = max splits ) max splits = integer max value ; sampler = new interval sampler < k , v > ( pcnt , max splits ) ; } else { other args add ( args [ i ] ) ; } } catch ( number format exception except ) { system out println ( " error : integer expected instead of " + args [ i ] ) ; return print usage ( ) ; } catch ( array index out of bounds exception except ) { system out println ( " error : required parameter missing from " + args [ i - 1 ] ) ; return print usage ( ) ; } } if ( job get num reduce tasks ( ) < = 1 ) { system err println ( " sampler requires more than one reducer " ) ; return print usage ( ) ; } if ( other args size ( ) < 2 ) { system out println ( " error : wrong number of parameters : " ) ; return print usage ( ) ; } if ( null = = sampler ) { sampler = new random sampler < k , v > ( 0 1 , 10000 , 10 ) ; } path outf = new path ( other args remove ( other args size ( ) - 1 ) ) ; total order partitioner set partition file ( get conf ( ) , outf ) ; for ( string s : other args ) { file input format add input path ( job , new path ( s ) ) ; } input sampler < k , v > write partition file ( job , sampler ) ; return 0 ; }


process the result of asynchronous calls on success , rc is { @ link keeper exception code # ok } on failure , rc is set to the corresponding failure code in { @ link keeper exception } { @ link keeper exception code # nonode } - the node on given path doesn ' t exist for some api calls

void process result ( int rc , string path , object ctx , byte [ ] data , stat stat ) ;


public boolean agrees ( object that ) { if ( that instanceof long ) { return agrees ( ( ( long ) that ) long value ( ) ) ; } else if ( that instanceof masked long ) { return agrees ( ( masked long ) that ) ; } else { throw new illegal argument exception ( " must be long or masked long : " + that ) ; } }


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


create the default origin text message with local hostname and timestamp

public static string create default origin message ( ) { return string format ( " created on % s at time % s " , net utils get hostname ( ) , java time instant now ( ) ) ; }


acquired access from one new client for the guarded resource

public lease acquire resource ( ) throws i o exception { synchronized ( lock ) { if ( closed ) { throw new i o exception ( " resource guard was already closed " ) ; } + + lease count ; } return new lease ( ) ; }


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


do not use the returned { @ link rx transaction } allows getting query results using rx observables without any scheduler set for subscribe on

public rx query internal rx plain ( ) { if ( rx tx plain = = null ) { rx tx plain = new rx query ( this ) ; } return rx tx plain ; }


public model api response upload file ( long pet id , string additional metadata , attachment file detail ) { / / todo : implement return null ; }


the interface used by client to get a shell to a container

public abstract void shell to container ( container id container id , shell container command command ) throws i o exception ;


return the { @ link cache invocation parameter } for the parameter holding the value to cache the method arguments must match the signature of the related method invocation

public cache invocation parameter get value parameter ( object values ) { int parameter position = this value parameter detail get parameter position ( ) ; if ( parameter position > = values length ) { throw new illegal state exception ( " values mismatch , value parameter at position " + parameter position + " cannot be matched against " + values length + " value ( s ) " ) ; } return this value parameter detail to cache invocation parameter ( values [ parameter position ] ) ; }


fill slots between < code > from index < code > inclusive to < code > to index < code > exclusive with < code > value < code >

void fill ( long from index , long to index , float value ) ;


aggregate the values of records in this stream by the grouped key and defined sessions note that sessions are generated on a per - key basis and records with different keys create independent sessions records with { @ code null } key or value are ignored aggregating is a generalization of { @ link # reduce ( reducer ) combining via reduce ( ) } as it , for example , allows the result to have a different type than the input values the result is written into a local { @ link session store } ( which is basically an ever - updating materialized view ) that can be queried using the store name as provided with { @ link materialized } furthermore , updates to the store are sent downstream into a { @ link k table } changelog stream the specified { @ link initializer } is applied directly before the first input record per session is processed to provide an initial intermediate aggregation result that is used to process the first record per session the specified { @ link aggregator } is applied for each input record and computes a new aggregate using the current aggregate ( or for the very first record using the intermediate aggregation result provided via the { @ link initializer } ) and the record ' s value the specified { @ link merger } is used to merge two existing sessions into one , i e , when the windows overlap , they are merged into a single session and the old sessions are discarded thus , { @ code aggregate ( ) } can be used to compute aggregate functions like count ( c f { @ link # count ( ) } ) not all updates might get sent downstream , as an internal cache is used to deduplicate consecutive updates to the same window and key if caching is enabled on the { @ link materialized } instance when caching is enabled the rate of propagated updates depends on your input data rate , the number of distinct keys , the number of parallel running kafka streams instances , and the { @ link streams config configuration } parameters for { @ link streams config # cache max bytes buffering config cache size } , and { @ link streams config # commit interval ms config commit interval } to query the local { @ link session store } it must be obtained via { @ link kafka streams # store ( store query parameters ) kafka streams # store ( ) } : { @ code kafka streams streams = some windowed aggregation on value type double sting queryable store name = the queryable store name should be the name of the store as defined by the materialized instance read only session store < string , long > session store = streams store ( queryable store name , queryable store types < string , long > session store ( ) ) ; string key = " some - key " ; key value iterator < windowed < string > , long > agg for key for session = local window store fetch ( key ) ; key must be local ( application state is shared over all running kafka streams instances ) } for non - local keys , a custom rpc mechanism must be implemented using { @ link kafka streams # all metadata ( ) } to query the value of the key on a parallel running instance of your kafka streams application for failure and recovery the store will be backed by an internal changelog topic that will be created in kafka therefore , the store name defined by the { @ link materialized } instance must be a valid kafka topic name and cannot contain characters other than ascii alphanumerics , ' ' , ' ' and ' - ' the changelog topic will be named " $ { application id } - $ { store name } - changelog " , where " application id " is user - specified in { @ link streams config } via parameter { @ link streams config # application id config application id config } , " store name " is the provide store name defined in { @ link materialized } , and " - changelog " is a fixed suffix you can retrieve all generated internal topic names via { @ link topology # describe ( ) }

< vr > k table < windowed < k > , vr > aggregate ( final initializer < vr > initializer , final aggregator < ? super k , ? super v , vr > aggregator , final merger < ? super k , vr > session merger , final materialized < k , vr , session store < bytes , byte [ ] > > materialized ) ;


testing data type shared with the scala tests

public static data type get pojo with custom order data type ( class < ? > pojo class ) { final structured type builder builder = structured type new builder ( pojo class ) ; builder attributes ( arrays as list ( new structured attribute ( " z " , new big int type ( ) ) , new structured attribute ( " y " , new boolean type ( ) ) , new structured attribute ( " x " , new int type ( ) ) ) ) ; builder set final ( true ) ; builder set instantiable ( true ) ; final structured type structured type = builder build ( ) ; final list < data type > field data types = arrays as list ( data types bigint ( ) , data types boolean ( ) , data types int ( ) ) ; return new fields data type ( structured type , pojo class , field data types ) ; }


returns the app id ( or base vuid ) for a given vuid , stripping out the user id from it @ hide

public static int get app id ( int uid ) { return uid % per user range ; }


returns the delay between execution retries

public long get execution retry delay ( ) { return execution retry delay ; }


public static void main ( string [ ] args ) throws i o exception { / / get port first , use to logback xml int port = port helper get port ( args ) ; system set property ( configuration keys server port , integer to string ( port ) ) ; / / create logger final logger logger = logger factory get logger ( server class ) ; if ( container helper is running in container ( ) ) { logger info ( " the server is running in container " ) ; } / / initialize the parameter parser / / note that the parameter parser should always be the first line to execute / / because , here we need to parse the parameters needed for startup parameter parser parameter parser = new parameter parser ( args ) ; / / initialize the metrics metrics manager get ( ) init ( ) ; system set property ( configuration keys store mode , parameter parser get store mode ( ) ) ; thread pool executor working threads = new thread pool executor ( netty server config get min server pool size ( ) , netty server config get max server pool size ( ) , netty server config get keep alive time ( ) , time unit seconds , new linked blocking queue < > ( netty server config get max task queue size ( ) ) , new named thread factory ( " server handler thread " , netty server config get max server pool size ( ) ) , new thread pool executor caller runs policy ( ) ) ; netty remoting server netty remoting server = new netty remoting server ( working threads ) ; / / server port netty remoting server set listen port ( parameter parser get port ( ) ) ; u u i d generator init ( parameter parser get server node ( ) ) ; / / log store mode : file , db , redis session holder init ( parameter parser get store mode ( ) ) ; default coordinator coordinator = new default coordinator ( netty remoting server ) ; coordinator init ( ) ; netty remoting server set handler ( coordinator ) ; / / register shutdown hook shutdown hook get instance ( ) add disposable ( coordinator ) ; shutdown hook get instance ( ) add disposable ( netty remoting server ) ; / / 127 0 0 1 and 0 0 0 0 are not valid here if ( net util is valid ip ( parameter parser get host ( ) , false ) ) { xid set ip address ( parameter parser get host ( ) ) ; } else { xid set ip address ( net util get local ip ( ) ) ; } xid set port ( netty remoting server get listen port ( ) ) ; try { netty remoting server init ( ) ; } catch ( throwable e ) { logger error ( " netty server init error : { } " , e get message ( ) , e ) ; system exit ( - 1 ) ; } system exit ( 0 ) ; }


generate a global key for the given component that is unique among all of this component ' s children of the same type if a manual key has been set on the child component using the key ( ) method , return the manual key todo : ( t38237241 ) remove the usage of the key handler post the nested tree experiment

static string generate global key ( final @ nullable component context parent context , final @ nullable component parent component , final component child component ) { final string key = child component get key ( ) ; final string global key ; if ( parent component = = null ) { global key = key ; } else { if ( component get global key ( parent context , parent component ) = = null ) { log parent has null global key ( parent component , child component ) ; global key = " null " + key ; } else { final string child key = get key with separator ( component get global key ( parent context , parent component ) , key ) ; final int index ; if ( child component has manual key ( ) ) { index = parent component get manual key usages count and increment ( child key ) ; if ( index ! = 0 ) { log duplicate manual key warning ( child component , key ) ; } } else { index = parent component get child count and increment ( child component ) ; } global key = get key for child position ( child key , index ) ; } } return global key ; }


sets the velocity in units per second for moving forward , backward and strafing leftright

public void set velocity ( float velocity ) { this velocity = velocity ; }


creates an external reference from the given instruction for instructions with flow , the flow type will be assumed , otherwise { @ link ref type # data } will be assumed to specify the appropriate ref type use the alternate form of this method

public final reference create external reference ( instruction instruction , int operand index , string library name , string external label , address external addr ) throws exception { / / use inferred reference type ref type ref type = ref type data ; flow type flow type = instruction get flow type ( ) ; if ( flow type is computed ( ) ) { if ( flow type is call ( ) ) { ref type = ref type computed call ; } else if ( flow type is jump ( ) ) { ref type = ref type computed jump ; } } else if ( flow type is call ( ) ) { ref type = ref type unconditional call ; } else if ( flow type is jump ( ) ) { ref type = ref type unconditional jump ; } return create external reference ( instruction , operand index , library name , external label , external addr , ref type ) ; }


the same as { @ link # load arm v 7 library ( context , string ) } but it can be called before calling { @ link tinker installer # install }

public static void load arm v 7 library without tinker installed ( application like app like , string lib name ) { if ( lib name = = null | | lib name is empty ( ) | | app like = = null ) { throw new tinker runtime exception ( " lib name or app like is null ! " ) ; } if ( tinker application helper is tinker enable for native lib ( app like ) ) { if ( tinker application helper load library from tinker ( app like , " lib / armeabi - v 7a " , lib name ) ) { return ; } } system load library ( lib name ) ; }


returns a dummy object for wrapping a job submission result

public static job execution result from job submission result ( job submission result result ) { return new job execution result ( result get job i d ( ) , - 1 , null ) ; }


public static boolean parse args ( string [ ] args , job job ) throws i o exception { / / set the common defaults configuration conf = job get configuration ( ) ; conf set int ( m r job config num maps , num maps default ) ; for ( int i = 0 ; i < args length ; i + + ) { if ( args length = = i + 1 ) { system out println ( " error : required parameter missing from " + args [ i ] ) ; return print usage ( ) = = 0 ; } try { if ( " - v " equals ( args [ i ] ) ) { timeline service version = integer parse int ( args [ + + i ] ) ; } else if ( " - m " equals ( args [ i ] ) ) { if ( integer parse int ( args [ + + i ] ) > 0 ) { job get configuration ( ) set int ( m r job config num maps , integer parse int ( args [ i ] ) ) ; } } else if ( " - mtype " equals ( args [ i ] ) ) { mapper type = integer parse int ( args [ + + i ] ) ; } else if ( " - s " equals ( args [ i ] ) ) { if ( integer parse int ( args [ + + i ] ) > 0 ) { conf set int ( simple entity writer constants kbs sent , integer parse int ( args [ i ] ) ) ; } } else if ( " - t " equals ( args [ i ] ) ) { if ( integer parse int ( args [ + + i ] ) > 0 ) { conf set int ( simple entity writer constants test times , integer parse int ( args [ i ] ) ) ; } } else if ( " - d " equals ( args [ i ] ) ) { conf set ( job history file replay helper processing path , args [ + + i ] ) ; } else if ( " - r " equals ( args [ i ] ) ) { conf set int ( job history file replay helper replay mode , integer parse int ( args [ + + i ] ) ) ; } else { system out println ( " unexpected argument : " + args [ i ] ) ; return print usage ( ) = = 0 ; } } catch ( number format exception except ) { system out println ( " error : integer expected instead of " + args [ i ] ) ; return print usage ( ) = = 0 ; } catch ( exception e ) { throw ( i o exception ) new i o exception ( ) init cause ( e ) ; } } / / handle mapper - specific settings switch ( mapper type ) { case job history file replay mapper : string processing path = conf get ( job history file replay helper processing path ) ; if ( processing path = = null | | processing path is empty ( ) ) { system out println ( " processing path is missing while mtype = 2 " ) ; return print usage ( ) = = 0 ; } switch ( timeline service version ) { case timeline service version 2 : job set mapper class ( job history file replay mapper v 2 class ) ; break ; case timeline service version 1 : default : job set mapper class ( job history file replay mapper v 1 class ) ; break ; } break ; case simple entity writer : default : / / use the current timestamp as the " run id " of the test : this will / / be used as simulating the cluster timestamp for apps conf set long ( simple entity writer constants timeline service performance run id , system current time millis ( ) ) ; switch ( timeline service version ) { case timeline service version 2 : job set mapper class ( simple entity writer v 2 class ) ; break ; case timeline service version 1 : default : job set mapper class ( simple entity writer v 1 class ) ; break ; } break ; } return true ; }


returns the length of continuously cached data starting from { @ code position } , up to a maximum of { @ code max length } , of a resource if { @ code position } isn ' t cached then { @ code - hole length } is returned , where { @ code hole length } is the length of continuously uncached data starting from { @ code position } , up to a maximum of { @ code max length }

long get cached length ( string key , long position , long length ) ;


get the configured number of maximum attempts that will be made to run a map task , as specified by the < code > mapreduce map maxattempts < code > property if this property is not already set , the default is 4 attempts

public int get max map attempts ( ) { return get int ( job context map max attempts , 4 ) ; }


public void clear ( ) { linker clear ( ) ; assembly set text ( " " ) ; }


indicates whether the given class can be written by this converter this method should perform the same checks than { @ link http message converter # can write ( class , media type ) } with additional ones related to the generic type

boolean can write ( @ nullable type type , class < ? > clazz , @ nullable media type media type ) ;


compares the two specified { @ code long } values , treating them as unsigned values between { @ code 0 } and { @ code 2 ^ 64 - 1 } inclusive < b > java 8 users : < b > use { @ link long # compare unsigned ( long , long ) } instead

public static int compare ( long a , long b ) { return longs compare ( flip ( a ) , flip ( b ) ) ; }


applies the given window function to each window the window function is called for each evaluation of the window the output of the window function is interpreted as a regular non - windowed stream note that this function requires that all data in the windows is buffered until the window is evaluated , as the function provides no means of incremental aggregation

public < r > single output stream operator < r > apply ( all window function < t , r , w > function , type information < r > result type ) { string call location = utils get call location name ( ) ; function = input get execution environment ( ) clean ( function ) ; return apply ( new internal iterable all window function < > ( function ) , result type , call location ) ; }


check if the actual layout will be performed

public boolean is cancelled ( ) { return cancelled ; }


confirm that replace values ( ) returns a list implementing random access

public void test replace values random access ( ) { multimap < string , integer > multimap = create ( ) ; multimap put ( " foo " , 1 ) ; multimap put ( " foo " , 3 ) ; assert true ( multimap replace values ( " foo " , as list ( 2 , 4 ) ) instanceof random access ) ; assert true ( multimap replace values ( " bar " , as list ( 2 , 4 ) ) instanceof random access ) ; }


tells the camera to stop drawing preview frames

public synchronized void stop preview ( ) { if ( auto focus manager ! = null ) { auto focus manager stop ( ) ; auto focus manager = null ; } if ( camera ! = null & & previewing ) { camera get camera ( ) stop preview ( ) ; preview callback set handler ( null , 0 ) ; previewing = false ; } }


execute the http method to the given uri template , writing the given request entity to the request , and returns the response as { @ link response entity }

< t > response entity < t > exchange ( uri url , http method method , @ nullable http entity < ? > request entity , class < t > response type ) throws rest client exception ;


public int get number of vertices ( ) { return this task vertices size ( ) ; }


list role grants for a given principal , not recursively

default set < role grant > list role grants ( connector session session , presto principal principal ) { throw new presto exception ( not supported , " this connector does not support roles " ) ; }


get the message to write to the log before the request

private string get before message ( http servlet request request ) { return create message ( request , this before message prefix , this before message suffix ) ; }


confirm that the shutdown if the instance should be done now !

protected boolean confirm shutdown ( ) { if ( ! is shutting down ( ) ) { return false ; } if ( ! in event loop ( ) ) { throw new illegal state exception ( " must be invoked from an event loop " ) ; } cancel scheduled tasks ( ) ; if ( graceful shutdown start time = = 0 ) { graceful shutdown start time = scheduled future task nano time ( ) ; } if ( run all tasks ( ) | | run shutdown hooks ( ) ) { if ( is shutdown ( ) ) { / / executor shut down - no new tasks anymore return true ; } / / there were tasks in the queue wait a little bit more until no tasks are queued for the quiet period or / / terminate if the quiet period is 0 / / see https : / / github com / netty / netty / issues / 4241 if ( graceful shutdown quiet period = = 0 ) { return true ; } task queue offer ( wakeup task ) ; return false ; } final long nano time = scheduled future task nano time ( ) ; if ( is shutdown ( ) | | nano time - graceful shutdown start time > graceful shutdown timeout ) { return true ; } if ( nano time - last execution time < = graceful shutdown quiet period ) { / / check if any tasks were added to the queue every 1 0 0ms / / todo : change the behavior of take task ( ) so that it returns on timeout task queue offer ( wakeup task ) ; try { thread sleep ( 100 ) ; } catch ( interrupted exception e ) { / / ignore } return false ; } / / no tasks were added for last quiet period - hopefully safe to shut down / / ( hopefully because we really cannot make a guarantee that there will be no execute ( ) calls by a user ) return true ; }


removes and returns the entry associated with the specified key in the int key map returns null if the int key map contains no mapping for this key

int entry < value > remove entry for key ( int key ) { int hash = hash ( key ) ; int i = index for ( hash , table length ) ; int entry < value > prev = table [ i ] ; int entry < value > e = prev ; while ( e ! = null ) { int entry < value > next = e next ; if ( e hash = = hash & & key = = e key ) { mod count + + ; size - - ; if ( prev = = e ) table [ i ] = next ; else prev next = next ; return e ; } prev = e ; e = next ; } return e ; }


the wire size of some outbound data is revealed this can only used to record the accumulative outbound wire size there is no guarantee wrt timing or granularity of this method

public void outbound wire size ( long bytes ) { }


tells the background thread to start does not wait for it to be running calling this method more than once has no effect

public void start ( ) { if ( ! compare and set state ( state new , state starting ) ) { / / if previous state was not new , start ( ) has already been called return ; } this watcher thread start ( ) ; }


finds pets by status multiple status values can be provided with comma separated strings < b > 200 < b > - successful operation < b > 400 < b > - invalid status value

public response entity < list < pet > > find pets by status with http info ( list < string > status ) throws rest client exception { object post body = null ; / / verify the required parameter ' status ' is set if ( status = = null ) { throw new http client error exception ( http status bad request , " missing the required parameter ' status ' when calling find pets by status " ) ; } string path = api client expand path ( " / pet / find by status " , collections < string , object > empty map ( ) ) ; final multi value map < string , string > query params = new linked multi value map < string , string > ( ) ; final http headers header params = new http headers ( ) ; final multi value map < string , string > cookie params = new linked multi value map < string , string > ( ) ; final multi value map < string , object > form params = new linked multi value map < string , object > ( ) ; query params put all ( api client parameter to multi value map ( api client collection format value of ( " csv " to upper case ( locale root ) ) , " status " , status ) ) ; final string [ ] local var accepts = { " application / xml " , " application / json " } ; final list < media type > local var accept = api client select header accept ( local var accepts ) ; final string [ ] content types = { } ; final media type content type = api client select header content type ( content types ) ; string [ ] auth names = new string [ ] { " petstore auth " } ; parameterized type reference < list < pet > > return type = new parameterized type reference < list < pet > > ( ) { } ; return api client invoke a p i ( path , http method get , query params , post body , header params , cookie params , form params , local var accept , content type , auth names , return type ) ; }


sets the alignment of the selected item in the select box see { @ link # get list ( ) } and { @ link list # set alignment ( int ) } to set the alignment in the list shown when the select box is open

public void set alignment ( int alignment ) { this alignment = alignment ; }


validate a test where each result has the same values

private static < t extends comparable < t > & copyable value < t > > void validate ( graph < t , null value , null value > graph , long count , long degree , long triangle count ) throws exception { data set < result < t > > cc = graph run ( new local clustering coefficient < > ( ) ) ; list < result < t > > results = cc collect ( ) ; assert equals ( count , results size ( ) ) ; for ( result < t > result : results ) { assert equals ( degree , result get degree ( ) get value ( ) ) ; assert equals ( triangle count , result get triangle count ( ) get value ( ) ) ; } }


public string get phase ( ) { return phase ; }


returns an immutable set containing the given elements , minus duplicates , in the order each was first specified that is , if multiple elements are { @ linkplain object # equals equal } , all except the first are ignored

public static < e > immutable set < e > of ( e e 1 , e e 2 , e e 3 ) { return construct ( 3 , e 1 , e 2 , e 3 ) ; }


creates invalidate api key request for given api key name

public static invalidate api key request using api key name ( string name , boolean owned by authenticated user ) { return new invalidate api key request ( null , null , name , owned by authenticated user , null ) ; }


check that this metric was captured exactly once

private static void check captured ( argument captor < ? > captor , string name ) { assert assert equals ( " expected exactly one metric for name " + name , 1 , captor get all values ( ) size ( ) ) ; }


patch another - fakedummy : to test special tags to test special tags and operation id starting with number

default response entity < client > call 1 2 3test special tags ( client body ) { get request ( ) if present ( request - > { for ( media type media type : media type parse media types ( request get header ( " accept " ) ) ) { if ( media type is compatible with ( media type value of ( " application / json " ) ) ) { string example string = " { \ " client \ " : \ " client \ " } " ; api util set example response ( request , " application / json " , example string ) ; break ; } } } ) ; return new response entity < > ( http status not implemented ) ; }


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


protected abstract void shut down ( ) throws exception ;


increments the number of consumers using the wrapped resource must be called on the main thread this must be called with a number corresponding to the number of new consumers each time new consumers begin using the wrapped resource it is always safer to call acquire more often than necessary generally external users should never call this method , the framework will take care of this for you

synchronized void acquire ( ) { if ( is recycled ) { throw new illegal state exception ( " cannot acquire a recycled resource " ) ; } + + acquired ; }


{ @ link hystrix collapser key } these metrics represent

public hystrix collapser key get collapser key ( ) { return collapser key ; }


creates an { @ code enum set } consisting of all enum values that are not in the specified collection if the collection is an { @ link enum set } , this method has the same behavior as { @ link enum set # complement of } otherwise , the specified collection must contain at least one element , in order to determine the element type if the collection could be empty , use { @ link # complement of ( collection , class ) } instead of this method

public static < e extends enum < e > > enum set < e > complement of ( collection < e > collection ) { if ( collection instanceof enum set ) { return enum set complement of ( ( enum set < e > ) collection ) ; } check argument ( ! collection is empty ( ) , " collection is empty ; use the other version of this method " ) ; class < e > type = collection iterator ( ) next ( ) get declaring class ( ) ; return make complement by hand ( collection , type ) ; }


asserts that the storage lock file in each given directory has been released this method works by trying to acquire the lock file itself if locking fails here , then the main code must have failed to release it

private static void assert file locks released ( collection < string > dirs ) throws i o exception { for ( string dir : dirs ) { try { fs dataset test util assert file lock released ( dir ) ; } catch ( i o exception e ) { log warn ( " { } " , e ) ; } } }


public void write ( data output out ) throws i o exception { out write short ( value ) ; }


construct an in - memory keystore with multiple trusted cert entries

static key store build trust store ( iterable < certificate > certificates ) throws general security exception { assert certificates ! = null : " cannot create keystore with null certificates " ; key store store = build new key store ( ) ; int counter = 0 ; for ( certificate certificate : certificates ) { store set certificate entry ( " cert - " + counter , certificate ) ; counter + + ; } return store ; }


undo changes made during the previous transaction checkpoint all upper - levels must clear table - based cached data prior to invoking this method

public synchronized boolean undo ( ) throws i o exception { if ( can undo ( ) & & buffer mgr undo ( true ) ) { + + checkpoint num ; reload tables ( ) ; return true ; } return false ; }


send a shard failed request to the master node to update the cluster state with the failure of a shard on another node this means that the shard should be failed because a write made it into the primary but was not replicated to this shard copy if the shard does not exist anymore but still has an entry in the in - sync set , remove its allocation id from the in - sync set

public void remote shard failed ( final shard id shard id , string allocation id , long primary term , boolean mark as stale , final string message , @ nullable final exception failure , action listener < void > listener ) { assert primary term > 0l : " primary term should be strictly positive " ; remote failed shards deduplicator execute once ( new failed shard entry ( shard id , allocation id , primary term , message , failure , mark as stale ) , listener , ( req , req listener ) - > send shard action ( shard failed action name , cluster service state ( ) , req , req listener ) ) ; }


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


public void int 3 2 test ( ) { / / todo : test int 3 2 }


appends the node to the tail of the list

public void append to tail ( node head ) { node tail = head prev ; head prev = this ; tail next = this ; next = head ; prev = tail ; }


public void test dog all of ( ) { / / todo : test dog all of }


< code > optional org apache dubbo common serialize protobuf model p b request type c dubbo p b request type = 3 ; < code >

google p b p b request type or builder get c dubbo p b request type or builder ( ) ;


checks the validity of the field and sets the appropriate field attributes

private void validate field ( ) { set background ( is field valid ( ) ? valid color : invalid color ) ; }


emits one element from the source , and attaches the given timestamp this method is relevant for programs using { @ link time characteristic # event time } , where the sources assign timestamps themselves , rather than relying on a { @ link timestamp assigner } on the stream on certain time characteristics , this timestamp may be ignored or overwritten this allows programs to switch between the different time characteristics and behaviors without changing the code of the source functions on { @ link time characteristic # processing time } , the timestamp will be ignored , because processing time never works with element timestamps on { @ link time characteristic # ingestion time } , the timestamp is overwritten with the system ' s current time , to realize proper ingestion time semantics on { @ link time characteristic # event time } , the timestamp will be used

void collect with timestamp ( t element , long timestamp ) ;


helper function to create a key in the key provider defaults to the first indexed name node ' s key provider

public static void create key ( string key name , mini d f s cluster cluster , configuration conf ) throws no such algorithm exception , i o exception { create key ( key name , cluster , 0 , conf ) ; }


compute the maximum , treating the inputs as unsigned this method is overloaded to prevent accidental signed - extension on one of the inputs this method will correctly zero - extend the { @ code int } parameter before performing any comparison

public static long unsigned max ( long a , int b ) { return ( long compare unsigned ( a , b & 0x 0ffffffff l ) > 0 ) ? a : b ; }


indicates whether some other object is " equal to " this one the < tt > equals < tt > method for class < code > object < code > implements the most discriminating possible equivalence relation on objects ; that is , for any reference values < code > x < code > and < code > y < code > , this method returns < code > true < code > if and only if < code > x < code > and < code > y < code > refer to the same object ( < code > x = = y < code > has the value < code > true < code > )

public boolean equals ( object obj ) { if ( obj = = null ) { return false ; } if ( obj = = this ) { return true ; } if ( get class ( ) ! = obj get class ( ) ) { return false ; } byte block range r = ( byte block range ) obj ; return block = = r block & & start index equals ( r start index ) & & end index equals ( r end index ) ; }


applies the given class visitor to all classes in the class pool , in sorted order

public void classes accept alphabetically ( class visitor class visitor ) { / / we ' re already using a tree map / / tree map sorted classes = new tree map ( classes ) ; / / iterator iterator = sorted classes values ( ) iterator ( ) ; iterator iterator = classes values ( ) iterator ( ) ; while ( iterator has next ( ) ) { clazz clazz = ( clazz ) iterator next ( ) ; clazz accept ( class visitor ) ; } }


get the end time of the reservation interval

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


put the given abstract type in the given byte vector , using the jvms verification type info format used in stack map table attributes

static void put abstract type ( final symbol table symbol table , final int abstract type , final byte vector output ) { int array dimensions = ( abstract type & frame dim mask ) > > dim shift ; if ( array dimensions = = 0 ) { int type value = abstract type & value mask ; switch ( abstract type & kind mask ) { case constant kind : output put byte ( type value ) ; break ; case reference kind : output put byte ( item object ) put short ( symbol table add constant class ( symbol table get type ( type value ) value ) index ) ; break ; case uninitialized kind : output put byte ( item uninitialized ) put short ( ( int ) symbol table get type ( type value ) data ) ; break ; default : throw new assertion error ( ) ; } } else { / / case of an array type , we need to build its descriptor first string builder type descriptor = new string builder ( 32 ) ; / / spring patch : larger initial size while ( array dimensions - - > 0 ) { type descriptor append ( ' [ ' ) ; } if ( ( abstract type & kind mask ) = = reference kind ) { type descriptor append ( ' l ' ) append ( symbol table get type ( abstract type & value mask ) value ) append ( ' ; ' ) ; } else { switch ( abstract type & value mask ) { case frame item asm boolean : type descriptor append ( ' z ' ) ; break ; case frame item asm byte : type descriptor append ( ' b ' ) ; break ; case frame item asm char : type descriptor append ( ' c ' ) ; break ; case frame item asm short : type descriptor append ( ' s ' ) ; break ; case frame item integer : type descriptor append ( ' i ' ) ; break ; case frame item float : type descriptor append ( ' f ' ) ; break ; case frame item long : type descriptor append ( ' j ' ) ; break ; case frame item double : type descriptor append ( ' d ' ) ; break ; default : throw new assertion error ( ) ; } } output put byte ( item object ) put short ( symbol table add constant class ( type descriptor to string ( ) ) index ) ; } }


returns the object corresponding to the provided path if present , null otherwise

public < t > t evaluate ( string path ) throws i o exception { return evaluate ( path , stash empty ) ; }


create a builder with an { @ linkplain http status # accepted accepted } status

public static body builder accepted ( ) { return status ( http status accepted ) ; }


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


adds tools , as a set of executable binaries , by fetching them from the given attribute on the { @ code rule context } , in host mode populates manifests , remote runfiles and label map where required

public builder add host tool dependencies ( string tool attribute name ) { list < ? extends transitive info collection > dependencies = rule context get prerequisites ( tool attribute name ) ; add tool dependencies ( dependencies ) ; return this ; }


public boolean is enabled ( ) { return enabled ; }


writes a short value into the byte array at the given offset

void put short ( byte [ ] b , int offset , short value ) ;


protected jwt builder jwt request get jwt request builder ( final optional < registered service > o auth registered service , final o auth 2 0 access token access token ) { val authentication = access token get authentication ( ) ; val attributes = new hash map < > ( authentication get attributes ( ) ) ; attributes put all ( authentication get principal ( ) get attributes ( ) ) ; val builder = jwt builder jwt request builder ( ) ; val dt = authentication get authentication date ( ) plus seconds ( access token get expiration policy ( ) get time to live ( ) ) ; return builder service audience ( service get id ( ) ) issue date ( date time utils date of ( authentication get authentication date ( ) ) ) jwt id ( access token get id ( ) ) subject ( authentication get principal ( ) get id ( ) ) valid until date ( date time utils date of ( dt ) ) attributes ( attributes ) registered service ( o auth registered service ) build ( ) ; }


tests that it can get the task manager location in an execution

public void test get task manager location when scheduled ( ) throws exception { final job vertex job vertex = execution graph test utils create no op vertex ( 1 ) ; final testing logical slot testing logical slot = new testing logical slot builder ( ) create testing logical slot ( ) ; final execution graph eg = execution graph test utils create simple test graph ( job vertex ) ; final execution graph to inputs locations retriever adapter inputs locations retriever = new execution graph to inputs locations retriever adapter ( eg ) ; final execution vertex only execution vertex = eg get all execution vertices ( ) iterator ( ) next ( ) ; only execution vertex deploy to slot ( testing logical slot ) ; execution vertex i d execution vertex id = new execution vertex i d ( job vertex get i d ( ) , 0 ) ; optional < completable future < task manager location > > task manager location optional = inputs locations retriever get task manager location ( execution vertex id ) ; assert true ( task manager location optional is present ( ) ) ; final completable future < task manager location > task manager location future = task manager location optional get ( ) ; assert that ( task manager location future get ( ) , is ( testing logical slot get task manager location ( ) ) ) ; }


get or default returns value if present , else default

public void test get or default ( ) { concurrent map map = map 5 ( ) ; assert equals ( map get or default ( one , " z " ) , " a " ) ; assert equals ( map get or default ( six , " z " ) , " z " ) ; }


tests that round tripping of a sample of four byte permutations work all permutations are prohibitively expensive to test for automated runs this method tests specific four - byte cases

public void test is well formed 4 bytes samples ( ) { / / valid 4 byte assert well formed ( 0x f 0 , 0x a 4 , 0x a d , 0x a 2 ) ; / / bad trailing bytes assert not well formed ( 0x f 0 , 0x a 4 , 0x a d , 0x 7 f ) ; assert not well formed ( 0x f 0 , 0x a 4 , 0x a d , 0x c 0 ) ; / / special cases for byte 2 assert not well formed ( 0x f 0 , 0x 8 f , 0x a d , 0x a 2 ) ; assert not well formed ( 0x f 4 , 0x 9 0 , 0x a d , 0x a 2 ) ; }


subdivide the given list of nodes such that the list or no new parent created will have more than < tt > max nodes < tt > children this algorithm uses the node names to group nodes based upon common prefixes for example , if a parent node contained more than < tt > max nodes < tt > children then a possible grouping would be : - abc - - abca - - abcb - - abcc - g where the nodes given contained : abca abcb abcc g the algorithm prefers to group nodes that have the longest common prefixes < b > note : the given data must be sorted for this method to work properly < b >

private static list < g tree node > compute children ( list < g tree node > list , int max nodes , g tree node parent , int parent level , task monitor monitor ) throws cancelled exception { list < g tree node > children ; if ( list size ( ) < = max nodes ) { children = new array list < > ( list ) ; } else { int character offset = get prefix size for grouping ( list , max nodes ) ; character offset = math max ( character offset , parent level + 1 ) ; children = new array list < > ( ) ; string prev str = list get ( 0 ) get name ( ) ; int start = 0 ; int end = list size ( ) ; for ( int i = 1 ; i < end ; i + + ) { monitor check canceled ( ) ; string str = list get ( i ) get name ( ) ; if ( strings differ ( prev str , str , character offset ) ) { add node ( children , list , start , i - 1 , max nodes , character offset , monitor ) ; start = i ; } prev str = str ; } add node ( children , list , start , end - 1 , max nodes , character offset , monitor ) ; } return children ; }


returns all nodes in this graph adjacent to { @ code node } which can be reached by traversing { @ code node } ' s incoming edges against the direction ( if any ) of the edge some algorithms that operate on a { @ code predecessors function } may produce undesired results if the returned { @ link iterable } contains duplicate elements implementations of such algorithms should document their behavior in the presence of duplicates the elements of the returned { @ code iterable } must each be : non - null usable as { @ code map } keys ( see the guava user guide ' s section on < a href = " https : github comgoogleguavawiki graphs explained # graph - elements - nodes - and - edges " > graph elements for details )

iterable < ? extends n > predecessors ( n node ) ;


returns the { @ link discriminator } value corresponding to the provided { @ link type }

public static discriminator get discriminator from type ( type < ? > type ) { return preconditions check not null ( type map get ( type ) , " no discriminator found for % s " , type ) ; }


{ @ inherit doc } the default implementation does nothing

@ override public void exit grouping expressions ( sql base parser grouping expressions context ctx ) { }


public static cron expression parse ( string expression ) { assert has length ( expression , " expression string must not be empty " ) ; expression = resolve macros ( expression ) ; string [ ] fields = string utils tokenize to string array ( expression , " " ) ; if ( fields length ! = 6 ) { throw new illegal argument exception ( string format ( " cron expression must consist of 6 fields ( found % d in \ " % s \ " ) " , fields length , expression ) ) ; } try { cron field seconds = cron field parse seconds ( fields [ 0 ] ) ; cron field minutes = cron field parse minutes ( fields [ 1 ] ) ; cron field hours = cron field parse hours ( fields [ 2 ] ) ; cron field days of month = cron field parse days of month ( fields [ 3 ] ) ; cron field months = cron field parse month ( fields [ 4 ] ) ; cron field days of week = cron field parse days of week ( fields [ 5 ] ) ; return new cron expression ( seconds , minutes , hours , days of month , months , days of week , expression ) ; } catch ( illegal argument exception ex ) { string msg = ex get message ( ) + " in cron expression \ " " + expression + " \ " " ; throw new illegal argument exception ( msg , ex ) ; } }


inserts the specified element into the queue represented by this deque ( in other words , at the tail of this deque ) if it is possible to do so immediately without violating capacity restrictions , returning < tt > true < tt > upon success and < tt > false < tt > if no space is currently available when using a capacity - restricted deque , this method is generally preferable to the { @ link # add } method , which can fail to insert an element only by throwing an exception < p > this method is equivalent to { @ link # offer last }


an alternative to { @ link # from method name ( class , string , object ) } } for use with an instance of this class created via { @ link # relative to } note : this method extracts values from " forwarded " and " x - forwarded - " headers if found see class - level docs

public uri components builder with method name ( class < ? > controller type , string method name , object args ) { return from method name ( this base url , controller type , method name , args ) ; }


public service info process service json ( string json ) { service info service info = jackson utils to obj ( json , service info class ) ; service info old service = service info map get ( service info get key ( ) ) ; if ( push empty protection & & ! service info validate ( ) ) { / / empty or error push , just ignore return old service ; } boolean changed = false ; if ( old service ! = null ) { if ( old service get last ref time ( ) > service info get last ref time ( ) ) { naming logger warn ( " out of date data received , old - t : " + old service get last ref time ( ) + " , new - t : " + service info get last ref time ( ) ) ; } service info map put ( service info get key ( ) , service info ) ; map < string , instance > old host map = new hash map < string , instance > ( old service get hosts ( ) size ( ) ) ; for ( instance host : old service get hosts ( ) ) { old host map put ( host to inet addr ( ) , host ) ; } map < string , instance > new host map = new hash map < string , instance > ( service info get hosts ( ) size ( ) ) ; for ( instance host : service info get hosts ( ) ) { new host map put ( host to inet addr ( ) , host ) ; } set < instance > mod hosts = new hash set < instance > ( ) ; set < instance > new hosts = new hash set < instance > ( ) ; set < instance > remv hosts = new hash set < instance > ( ) ; list < map entry < string , instance > > new service hosts = new array list < map entry < string , instance > > ( new host map entry set ( ) ) ; for ( map entry < string , instance > entry : new service hosts ) { instance host = entry get value ( ) ; string key = entry get key ( ) ; if ( old host map contains key ( key ) & & ! string utils equals ( host to string ( ) , old host map get ( key ) to string ( ) ) ) { mod hosts add ( host ) ; continue ; } if ( ! old host map contains key ( key ) ) { new hosts add ( host ) ; } } for ( map entry < string , instance > entry : old host map entry set ( ) ) { instance host = entry get value ( ) ; string key = entry get key ( ) ; if ( new host map contains key ( key ) ) { continue ; } if ( ! new host map contains key ( key ) ) { remv hosts add ( host ) ; } } if ( new hosts size ( ) > 0 ) { changed = true ; naming logger info ( " new ips ( " + new hosts size ( ) + " ) service : " + service info get key ( ) + " - > " + jackson utils to json ( new hosts ) ) ; } if ( remv hosts size ( ) > 0 ) { changed = true ; naming logger info ( " removed ips ( " + remv hosts size ( ) + " ) service : " + service info get key ( ) + " - > " + jackson utils to json ( remv hosts ) ) ; } if ( mod hosts size ( ) > 0 ) { changed = true ; update beat info ( mod hosts ) ; naming logger info ( " modified ips ( " + mod hosts size ( ) + " ) service : " + service info get key ( ) + " - > " + jackson utils to json ( mod hosts ) ) ; } service info set json from server ( json ) ; if ( new hosts size ( ) > 0 | | remv hosts size ( ) > 0 | | mod hosts size ( ) > 0 ) { notify center publish event ( new instances change event ( service info get name ( ) , service info get group name ( ) , service info get clusters ( ) , service info get hosts ( ) ) ) ; disk cache write ( service info , cache dir ) ; } } else { changed = true ; naming logger info ( " init new ips ( " + service info ip count ( ) + " ) service : " + service info get key ( ) + " - > " + jackson utils to json ( service info get hosts ( ) ) ) ; service info map put ( service info get key ( ) , service info ) ; notify center publish event ( new instances change event ( service info get name ( ) , service info get group name ( ) , service info get clusters ( ) , service info get hosts ( ) ) ) ; service info set json from server ( json ) ; disk cache write ( service info , cache dir ) ; } metrics monitor get service info map size monitor ( ) set ( service info map size ( ) ) ; if ( changed ) { naming logger info ( " current ips : ( " + service info ip count ( ) + " ) service : " + service info get key ( ) + " - > " + jackson utils to json ( service info get hosts ( ) ) ) ; } return service info ; }


delete the record identified by the specified key

long key node delete record ( long key , table table ) throws i o exception { / / handle non - existent key - do nothing int index = get key index ( key ) ; if ( index < 0 ) { return get root ( ) ; } if ( table ! = null ) { table deleted record ( get record ( table get schema ( ) , index ) ) ; } / / handle removal of last record in node if ( key count = = 1 ) { long key node new root = remove leaf ( ) ; return new root ; } / / remove record within this node remove ( index ) ; / / notify parent of leftmost key change if ( index = = 0 & & parent ! = null ) { parent key changed ( key , get key ( 0 ) ) ; } return get root ( ) ; }


find the { @ link field } by the name in the specified class and its inherited types

static field find field ( object object , string field name ) { return find field ( object get class ( ) , field name ) ; }


public void set table name ( string table name ) { this table name = table name ; }


called whenever { @ link queue } is considering if { @ link hudson model queue item } is ready to execute immediately ( which doesn ' t necessarily mean that it gets executed right away & mdash ; it ' s still subject to executor availability ) , or if it should be considered blocked compared to { @ link # can take ( node , queue buildable item ) } , this version tells jenkins that the task is simply not ready to execute , even if there ' s available executor this is more efficient than { @ link # can take ( node , queue buildable item ) } , and it sends the right signal to jenkins so that it won ' t use { @ link cloud } to try to provision new executors vetos are additive when multiple { @ link queue task dispatcher } s are in the system , the task is considered blocked if any one of them returns a non - null value ( this relationship is also the same with built - in check logic ) if a { @ link queue task dispatcher } returns non - null from this method , the task is placed into the ' blocked ' state , and generally speaking it stays in this state for a few seconds before its state gets re - evaluated if a { @ link queue task dispatcher } wants the blockage condition to be re - evaluated earlier , call { @ link queue # schedule maintenance ( ) } to initiate that process

public @ check for null cause of blockage can run ( queue item item ) { return null ; }


extract the raw class type from { @ code type } for example , the type representing { @ code list < ? extends runnable > } returns { @ code list class }

protected static class < ? > get raw type ( type type ) { return utils get raw type ( type ) ; }


to get or create instance of the advice class create new one and caching when it is not exist

public < t > t get or create instance ( final string class name of advice ) { if ( object pool contains key ( class name of advice ) ) { return ( t ) object pool get ( class name of advice ) ; } lock lock ( ) ; try { object inst = object pool get ( class name of advice ) ; if ( objects is null ( inst ) ) { inst = class for name ( class name of advice , true , this ) new instance ( ) ; object pool put ( class name of advice , inst ) ; } return ( t ) inst ; } finally { lock unlock ( ) ; } }


returns a { @ link bytes reference } view of the data

public bytes reference bytes ( ) { if ( bytes = = null ) { bytes = new bytes array ( text get bytes ( standard charsets utf 8 ) ) ; } return bytes ; }


called after { @ link # setup transitions } has been called and the new layout has been mounted this restores the state of the previous layout for content that will animate and then starts the corresponding animations

void run transitions ( ) { render core systrace begin section ( " run transitions " ) ; restore initial states ( ) ; if ( m debug tag ! = null ) { debug log starting animations ( ) ; } if ( m root animation to run ! = null ) { m root animation to run add listener ( m root animation listener ) ; m root animation to run start ( m resolver ) ; m root animation to run = null ; } render core systrace end section ( ) ; }


returns an immutable array containing the given values , in order

public static immutable int array of ( int e 0 , int e 1 , int e 2 , int e 3 , int e 4 ) { return new immutable int array ( new int [ ] { e 0 , e 1 , e 2 , e 3 , e 4 } ) ; }


cleans the data from the passed path in the passed file system

static void clean data ( file system fs , path dir path ) throws i o exception { fs delete ( dir path , true ) ; }


test the input and output shipping strategies for union operators with input and output operators with different parallelisms src 1 - map ( full p ) - \ - - union - map ( full p ) - out x src 2 - map ( half p ) - - \ - union - map ( half p ) - out the union operator must always have the same parallelism as its successor and connect to it with a forward strategy in this program , the input connections for union should be forward for parallelism - preserving connections and partition random for parallelism - changing connections

public void test union input output different d o p ( ) throws exception { int full dop = default parallelism ; int half dop = default parallelism / 2 ; execution environment env = execution environment get execution environment ( ) ; env set parallelism ( default parallelism ) ; data set < tuple 2 < long , long > > in 1 = env from elements ( new tuple 2 < > ( 0l , 0l ) ) map ( new identity mapper < > ( ) ) set parallelism ( full dop ) name ( " in dop full " ) ; data set < tuple 2 < long , long > > in 2 = env from elements ( new tuple 2 < > ( 0l , 0l ) ) map ( new identity mapper < > ( ) ) set parallelism ( half dop ) name ( " in dop half " ) ; data set < tuple 2 < long , long > > union = in 1 union ( in 2 ) ; data set < tuple 2 < long , long > > dop full map = union map ( new identity mapper < > ( ) ) set parallelism ( full dop ) name ( " out dop full " ) ; data set < tuple 2 < long , long > > dop half map = union map ( new identity mapper < > ( ) ) set parallelism ( half dop ) name ( " out dop half " ) ; dop full map output ( new discarding output format < > ( ) ) ; dop half map output ( new discarding output format < > ( ) ) ; / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / / verify optimized plan / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - optimized plan optimized plan = compile no stats ( env create program plan ( ) ) ; optimizer plan node resolver resolver = get optimizer plan node resolver ( optimized plan ) ; single input plan node in dop full = resolver get node ( " in dop full " ) ; single input plan node in dop half = resolver get node ( " in dop half " ) ; single input plan node out dop full = resolver get node ( " out dop full " ) ; single input plan node out dop half = resolver get node ( " out dop half " ) ; n ary union plan node union dop full = ( n ary union plan node ) out dop full get input ( ) get source ( ) ; n ary union plan node union dop half = ( n ary union plan node ) out dop half get input ( ) get source ( ) ; / / check in map nodes assert equals ( 2 , in dop full get outgoing channels ( ) size ( ) ) ; assert equals ( 2 , in dop half get outgoing channels ( ) size ( ) ) ; assert equals ( full dop , in dop full get parallelism ( ) ) ; assert equals ( half dop , in dop half get parallelism ( ) ) ; / / check union nodes assert equals ( full dop , union dop full get parallelism ( ) ) ; assert equals ( half dop , union dop half get parallelism ( ) ) ; / / check out map nodes assert equals ( full dop , out dop full get parallelism ( ) ) ; assert equals ( half dop , out dop half get parallelism ( ) ) ; / / check union - > out map ship strategies assert equals ( ship strategy type forward , out dop half get input ( ) get ship strategy ( ) ) ; assert equals ( ship strategy type forward , out dop full get input ( ) get ship strategy ( ) ) ; / / check in map - > union ship strategies channel full full ; channel full half ; channel half full ; channel half half ; if ( in dop full get outgoing channels ( ) get ( 0 ) get target ( ) = = union dop full ) { full full = in dop full get outgoing channels ( ) get ( 0 ) ; full half = in dop full get outgoing channels ( ) get ( 1 ) ; } else { full full = in dop full get outgoing channels ( ) get ( 1 ) ; full half = in dop full get outgoing channels ( ) get ( 0 ) ; } if ( in dop half get outgoing channels ( ) get ( 0 ) get target ( ) = = union dop full ) { half full = in dop half get outgoing channels ( ) get ( 0 ) ; half half = in dop half get outgoing channels ( ) get ( 1 ) ; } else { half full = in dop half get outgoing channels ( ) get ( 1 ) ; half half = in dop half get outgoing channels ( ) get ( 0 ) ; } assert equals ( ship strategy type forward , full full get ship strategy ( ) ) ; assert equals ( ship strategy type forward , half half get ship strategy ( ) ) ; assert equals ( ship strategy type partition random , full half get ship strategy ( ) ) ; assert equals ( ship strategy type partition random , half full get ship strategy ( ) ) ; }


generates a result from the given map of events the events are identified by their names only one resulting element can be generated

out select ( map < string , list < in > > pattern ) throws exception ;


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


sets the bytes starting at { @ code address } to the values encoded in { @ code byte string } and then optionally disassembling see { @ link # set bytes ( string , byte [ ] , boolean ) }

public void set bytes ( string address , string byte string , boolean disassemble ) throws exception { byte [ ] bytes = numeric utilities convert string to bytes ( byte string ) ; set bytes ( address , bytes , disassemble ) ; }


returns an instance that is just like this one , except that the register list is mapped by using { @ code mapper }

public dalv insn with mapper ( register mapper mapper ) { return with registers ( mapper map ( get registers ( ) ) ) ; }


determine whether the store { @ link key value store # flush ( ) flushed } the removal of the given key

public boolean flushed entry removed ( final k key ) { return flushed removals contains ( key ) ; }


if device plugin has own scheduler , then use it otherwise , pick our default scheduler to do scheduling

private void pick and do schedule ( set < device > allowed , map < device , container id > used , set < device > assigned , container c , int count , string resource name , device plugin scheduler dps ) throws resource handler exception { container id container id = c get container id ( ) ; map < string , string > env = c get launch context ( ) get environment ( ) ; if ( null = = dps ) { log debug ( " customized device plugin scheduler is preferred " + " but not implemented , use default logic " ) ; default schedule action ( allowed , used , assigned , container id , count ) ; } else { if ( log is debug enabled ( ) ) { log debug ( " customized device plugin implemented , " + " use customized logic " ) ; / / use customized device scheduler log debug ( " try to schedule " + count + " ( " + resource name + " ) using " + dps get class ( ) ) ; } / / pass in unmodifiable set set < device > dps allocated = dps allocate devices ( sets difference ( allowed , used key set ( ) ) , count , immutable map copy of ( env ) ) ; if ( dps allocated size ( ) ! = count ) { throw new resource handler exception ( dps get class ( ) + " should allocate " + count + " of " + resource name + " , but actual : " + assigned size ( ) ) ; } / / copy assigned add all ( dps allocated ) ; / / store assigned devices into used devices for ( device device : assigned ) { used put ( device , container id ) ; } } }


public literal value value ( double value ) { this value = value ; return this ; }


are two interval sets equal ? because all intervals are sorted and disjoint , equals is a simple linear walk over both lists to make sure they are the same interval equals ( ) is used by the list equals ( ) method to check the ranges

public boolean equals ( object obj ) { if ( obj = = null | | ! ( obj instanceof interval set ) ) { return false ; } interval set other = ( interval set ) obj ; return this intervals equals ( other intervals ) ; }


removes and returns the item at the specified index

public float remove index ( int index ) { if ( index > = size ) throw new index out of bounds exception ( " index can ' t be > = size : " + index + " > = " + size ) ; float [ ] items = this items ; float value = items [ index ] ; size - - ; if ( ordered ) system arraycopy ( items , index + 1 , items , index , size - index ) ; else items [ index ] = items [ size ] ; return value ; }


invert the sort order : ascending - > descending or descending - > ascending

public void invert order ( ) { this ascending = ! this ascending ; }


to test the collection format in query parameters

public void test query parameter collection format test ( ) { list < string > pipe = null ; list < string > ioutil = null ; list < string > http = null ; list < string > url = null ; list < string > context = null ; api test query parameter collection format ( pipe , ioutil , http , url , context ) ; / / todo : test validations }


gets a 32 - bit integer at the specified absolute { @ code index } in this buffer this method does not modify { @ code reader index } or { @ code writer index } of this buffer

public abstract int get int ( int index ) ;


return the reverse zone name based on the address

private name get reverse zone name ( subnet utils utils , string network address ) { name reverse zone name = null ; boolean is large network = false ; if ( utils ! = null ) { is large network = utils get info ( ) get address count long ( ) > 256 ; } final string [ ] bytes = network address split ( " \ \ " ) ; if ( bytes length = = 4 ) { string reverse lookup zone name = null ; if ( is large network ) { reverse lookup zone name = string format ( " % s % s % s " , bytes [ 1 ] , bytes [ 0 ] , in addr arpa ) ; } else { reverse lookup zone name = string format ( " % s % s % s % s " , bytes [ 2 ] , bytes [ 1 ] , bytes [ 0 ] , in addr arpa ) ; } try { reverse zone name = name from string ( reverse lookup zone name ) ; } catch ( text parse exception e ) { log warn ( " unable to convert { } to dns name " , reverse lookup zone name ) ; } } return reverse zone name ; }


public void test class model ( ) { / / todo : test class model }


the primary payload for the resource < code > google protobuf any body = 2 ; < code >

public com google protobuf any get body ( ) { return body = = null ? com google protobuf any get default instance ( ) : body ; }


this gives direct access to the underlying storage array the { @ link # to byte array ( ) } should be preferred over this method if the return value is changed then { @ link # array changed ( ) } must be called

public byte [ ] array ( ) { return value ; }


returns an array containing all of the elements in this queue the returned array elements are in no particular order the returned array will be " safe " in that no references to it are maintained by this queue ( in other words , this method must allocate a new array ) the caller is thus free to modify the returned array this method acts as bridge between array - based and collection - based a p is

public object [ ] to array ( ) { final monitor monitor = this monitor ; monitor enter ( ) ; try { return q to array ( ) ; } finally { monitor leave ( ) ; } }