checks whether a candidate sync word position is likely to be the position of a real sync word the caller must check that the first byte of the sync word is 0x f f before calling this method this method performs the following checks : the mpeg version of this frame must match the previously detected version the sample rate index of this frame must match the previously detected sample rate index the frame size must be at least 7 bytes the bytes following the frame must be either another sync word with the same mpeg version , or the start of an id3 header with the exception of the first check , if there is insufficient data in the buffer then checks are optimistically skipped and { @ code true } is returned

private boolean check sync position valid ( parsable byte array pes buffer , int sync position candidate ) { pes buffer set position ( sync position candidate + 1 ) ; if ( ! try read ( pes buffer , adts scratch data , 1 ) ) { return false ; } / / the mpeg version of this frame must match the previously detected version adts scratch set position ( 4 ) ; int current frame version = adts scratch read bits ( 1 ) ; if ( first frame version ! = version unset & & current frame version ! = first frame version ) { return false ; } / / the sample rate index of this frame must match the previously detected sample rate index if ( first frame sample rate index ! = c index unset ) { if ( ! try read ( pes buffer , adts scratch data , 1 ) ) { / / insufficient data for further checks return true ; } adts scratch set position ( 2 ) ; int current frame sample rate index = adts scratch read bits ( 4 ) ; if ( current frame sample rate index ! = first frame sample rate index ) { return false ; } pes buffer set position ( sync position candidate + 2 ) ; } / / the frame size must be at least 7 bytes if ( ! try read ( pes buffer , adts scratch data , 4 ) ) { / / insufficient data for further checks return true ; } adts scratch set position ( 14 ) ; int frame size = adts scratch read bits ( 13 ) ; if ( frame size < 7 ) { return false ; } / / the bytes following the frame must be either another sync word with the same mpeg version , or / / the start of an id3 header byte [ ] data = pes buffer get data ( ) ; int data limit = pes buffer limit ( ) ; int next sync position = sync position candidate + frame size ; if ( next sync position > = data limit ) { / / insufficient data for further checks return true ; } if ( data [ next sync position ] = = ( byte ) 0x f f ) { if ( next sync position + 1 = = data limit ) { / / insufficient data for further checks return true ; } return is adts sync bytes ( ( byte ) 0x f f , data [ next sync position + 1 ] ) & & ( ( data [ next sync position + 1 ] & 0x 8 ) > > 3 ) = = current frame version ; } else { if ( data [ next sync position ] ! = ' i ' ) { return false ; } if ( next sync position + 1 = = data limit ) { / / insufficient data for further checks return true ; } if ( data [ next sync position + 1 ] ! = ' d ' ) { return false ; } if ( next sync position + 2 = = data limit ) { / / insufficient data for further checks return true ; } return data [ next sync position + 2 ] = = ' 3 ' ; } }


this method serves to force sub classes to " hide " this static factory

public static server builder < ? > for port ( int port ) { throw new unsupported operation exception ( " subclass failed to hide static factory " ) ; }


public double get double ( int column index ) throws s q l exception { return 0 ; }


method is synchronized to make the handler removal from the double linked list atomic

private synchronized void atomic remove from handler list ( abstract channel handler context ctx ) { abstract channel handler context prev = ctx prev ; abstract channel handler context next = ctx next ; prev next = next ; next prev = prev ; }


checks if the location of the tool is overridden for the given node , and if so , return the node - specific home directory otherwise return { @ code installation get home ( ) } this is the core logic behind { @ link node specific # for node ( node , task listener ) } for { @ link tool installation }

public static string get tool home ( node node , tool installation installation , task listener log ) throws i o exception , interrupted exception { string result = null ; / / node - specific configuration takes precedence tool location node property property = node get node properties ( ) get ( tool location node property class ) ; if ( property ! = null ) { result = property get home ( installation ) ; } if ( result ! = null ) { return result ; } / / consult translators for ( tool location translator t : tool location translator all ( ) ) { result = t get tool home ( node , installation , log ) ; if ( result ! = null ) { return result ; } } / / fall back is no - op return installation get home ( ) ; }


load classes from predefined packages ( hack to limit the scope ) and if they match the hierarchy , add them to the cache

private static < t > void maybe load class ( class < t > clazz , string class name , string location , set < class < ? extends t > > results ) throws i o exception { / / filter the class that are not interested / / ( and ide folders like eclipse ) if ( class name starts with ( " org elasticsearch xpack ql " ) = = false & & class name starts with ( " org elasticsearch xpack sql " ) = = false & & class name starts with ( " org elasticsearch xpack eql " ) = = false ) { return ; } class < ? > c ; try { c = class for name ( class name ) ; } catch ( class not found exception e ) { throw new i o exception ( " couldn ' t load " + location , e ) ; } if ( false = = modifier is abstract ( c get modifiers ( ) ) & & false = = c is anonymous class ( ) & & clazz is assignable from ( c ) ) { class < ? extends t > s = c as subclass ( clazz ) ; results add ( s ) ; } }


adds the given functions to an existing comparison provider

public void compare functions ( function source , function target , function comparison provider provider ) { if ( provider = = null ) { return ; } providers add ( provider ) ; provider set visible ( true ) ; provider get model ( ) compare functions ( source , target ) ; }


puts a new item into the < code > map < code > map

public mixed properties and additional properties class put map item ( string key , animal map item ) { this map put ( key , map item ) ; return this ; }


a sensible definition of { @ link # iterator } in terms of { @ link # entry set } and { @ link # remove ( object ) } if you override either of these methods , you may wish to override { @ link # iterator } to forward to this implementation

protected iterator < e > standard iterator ( ) { return multisets iterator impl ( this ) ; }


register a free marker view resolver with an empty default view name prefix and a default suffix of " ftl " note that you must also configure free marker by adding a { @ link org springframework web servlet view freemarker free marker configurer } bean

public url based view resolver registration free marker ( ) { if ( ! check bean of type ( free marker configurer class ) ) { throw new bean initialization exception ( " in addition to a free marker view resolver " + " there must also be a single free marker config bean in this web application context " + " ( or its parent ) : free marker configurer is the usual implementation " + " this bean may be given any name " ) ; } free marker registration registration = new free marker registration ( ) ; this view resolvers add ( registration get view resolver ( ) ) ; return registration ; }


resets the fields to initial values this is necessary if the tuples are reused and not all fields were modified

public void reset ( ) { f 0 = null ; f 1 = null ; f 2 = null value ; f 3 = 0l ; }


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

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


check whether context wrapper is a wrapper of base context

private static boolean is context wrapper ( context context wrapper , context base context ) { while ( base context instanceof context wrapper ) { base context = ( ( context wrapper ) base context ) get base context ( ) ; } context current context = context wrapper ; while ( current context instanceof context wrapper ) { current context = ( ( context wrapper ) current context ) get base context ( ) ; } return current context = = base context ; }


invoke all possible actions on the weapon and check if the actions are executed on the actual underlying weapon implementation

void test hammer ( ) { final var hammer = spy ( new hammer ( mock ( flying enchantment class ) ) ) ; test basic weapon actions ( hammer ) ; }


invoke the handler method with the given argument values

protected object do invoke ( object args ) throws exception { method method = get bridged method ( ) ; reflection utils make accessible ( method ) ; try { if ( kotlin detector is suspending function ( method ) ) { return coroutines utils invoke suspending function ( method , get bean ( ) , args ) ; } return method invoke ( get bean ( ) , args ) ; } catch ( illegal argument exception ex ) { assert target bean ( method , get bean ( ) , args ) ; string text = ( ex get message ( ) ! = null ? ex get message ( ) : " illegal argument " ) ; throw new illegal state exception ( format invoke error ( text , args ) , ex ) ; } catch ( invocation target exception ex ) { / / unwrap for handler exception resolvers throwable target exception = ex get target exception ( ) ; if ( target exception instanceof runtime exception ) { throw ( runtime exception ) target exception ; } else if ( target exception instanceof error ) { throw ( error ) target exception ; } else if ( target exception instanceof exception ) { throw ( exception ) target exception ; } else { throw new illegal state exception ( format invoke error ( " invocation failure " , args ) , target exception ) ; } } }


convenience method for counting the rows in the given table

protected int count rows in table ( string table name ) { return jdbc test utils count rows in table ( this jdbc template , table name ) ; }


deep equality for tuples by calling equals ( ) on the tuple members

public boolean equals ( object o ) { if ( this = = o ) { return true ; } if ( ! ( o instanceof tuple 7 ) ) { return false ; } @ suppress warnings ( " rawtypes " ) tuple 7 tuple = ( tuple 7 ) o ; if ( f 0 ! = null ? ! f 0 equals ( tuple f 0 ) : tuple f 0 ! = null ) { return false ; } if ( f 1 ! = null ? ! f 1 equals ( tuple f 1 ) : tuple f 1 ! = null ) { return false ; } if ( f 2 ! = null ? ! f 2 equals ( tuple f 2 ) : tuple f 2 ! = null ) { return false ; } if ( f 3 ! = null ? ! f 3 equals ( tuple f 3 ) : tuple f 3 ! = null ) { return false ; } if ( f 4 ! = null ? ! f 4 equals ( tuple f 4 ) : tuple f 4 ! = null ) { return false ; } if ( f 5 ! = null ? ! f 5 equals ( tuple f 5 ) : tuple f 5 ! = null ) { return false ; } if ( f 6 ! = null ? ! f 6 equals ( tuple f 6 ) : tuple f 6 ! = null ) { return false ; } return true ; }


private int recursive tokens ( int depth ) throws bad location exception { int new lines = 0 ; while ( c next pos < f range end ) { while ( c next pos < f range end ) { char ch = document get char ( c next pos + + ) ; switch ( ch ) { case ' < ' : int start offset = c next pos - 1 ; int start new lines = new lines ; int classification = classify tag ( ) ; / / string tag string = f document get ( start offset , math min ( c next pos - start offset , f range end - start offset ) ) ; / / this is to see where we are in the debugger new lines + = c new lines ; / / c new lines is written by / / classify tag ( ) switch ( classification ) { case start tag : new lines + = recursive tokens ( depth + 1 ) ; if ( new lines > start new lines + 1 ) { emit position ( start offset , c next pos - start offset ) ; } break ; case leaf tag : if ( new lines > start new lines + 1 ) { emit position ( start offset , c next pos - start offset ) ; } break ; case comment tag : if ( new lines > start new lines + 1 ) { emit position ( start offset , c next pos - start offset ) ; } break ; case pi tag : break ; case end tag : case eor tag : return new lines ; default : break ; } break ; case ' \ n ' : case ' \ r ' : if ( ( ch = = c last n l char ) | | ( ' ' = = c last n l char ) ) { new lines + + ; c last n l char = ch ; } break ; default : break ; } } } return new lines ; }


notifies the decode loop if there exists a queued input buffer and an available output buffer to decode into should only be called whilst synchronized on the lock object

private void maybe notify decode loop ( ) { if ( can decode buffer ( ) ) { lock notify ( ) ; } }


locates and decodes a data matrix code in an image

public result decode ( binary bitmap image ) throws not found exception , checksum exception , format exception { return decode ( image , null ) ; }


set the message listener implementation to register this can be either a standard jms { @ link message listener } object or a spring { @ link session aware message listener } object note : the message listener may be replaced at runtime , with the listener container picking up the new listener object immediately ( works e g with default message listener container , as long as the cache level is less than cache consumer ) however , this is considered advanced usage ; use it with care !

public void set message listener ( @ nullable object message listener ) { check message listener ( message listener ) ; this message listener = message listener ; if ( message listener ! = null & & this subscription name = = null ) { this subscription name = get default subscription name ( message listener ) ; } }


we need to override this as a { @ link legacy serializer snapshot transformer } because in flink 1 6 x and below , this serializer was incorrectly returning directly the snapshot of the nested list serializer as its own snapshot this method transforms the incorrect list serializer snapshot to be a proper { @ link list view serializer snapshot }

public < u > type serializer snapshot < list view < t > > transform legacy serializer snapshot ( type serializer snapshot < u > legacy snapshot ) { if ( legacy snapshot instanceof list view serializer snapshot ) { return ( type serializer snapshot < list view < t > > ) legacy snapshot ; } else if ( legacy snapshot instanceof collection serializer config snapshot ) { / / first , transform the incorrect list serializer ' s snapshot / / into a proper list serializer snapshot list serializer snapshot < t > transformed nested list serializer snapshot = new list serializer snapshot < > ( ) ; collection serializer config snapshot < list < t > , t > snapshot = ( collection serializer config snapshot < list < t > , t > ) legacy snapshot ; composite type serializer util set nested serializers snapshots ( transformed nested list serializer snapshot , ( type serializer snapshot < ? > ) ( snapshot get single nested serializer and config ( ) f 1 ) ) ; / / then , wrap the transformed list serializer snapshot / / as a nested snapshot in the final resulting list view serializer snapshot list view serializer snapshot < t > transformed list view serializer snapshot = new list view serializer snapshot < > ( ) ; composite type serializer util set nested serializers snapshots ( transformed list view serializer snapshot , transformed nested list serializer snapshot ) ; return transformed list view serializer snapshot ; } else { throw new unsupported operation exception ( legacy snapshot get class ( ) get canonical name ( ) + " is not supported " ) ; } }


provide access to the shared handler interceptors used to configure { @ link handler mapping } instances with this method cannot be overridden ; use { @ link # add interceptors } instead

protected final object [ ] get interceptors ( formatting conversion service mvc conversion service , resource url provider mvc resource url provider ) { if ( this interceptors = = null ) { interceptor registry registry = new interceptor registry ( ) ; add interceptors ( registry ) ; registry add interceptor ( new conversion service exposing interceptor ( mvc conversion service ) ) ; registry add interceptor ( new resource url provider exposing interceptor ( mvc resource url provider ) ) ; this interceptors = registry get interceptors ( ) ; } return this interceptors to array ( ) ; }


this method is deprecated use get fills ( ) instead

public list < fill > get gradients ( ) { return m fills ; }


public acl create a c l for user ( user group information ugi , int perms ) { if ( log is debug enabled ( ) ) { log debug ( " creating acl for " , new ugi info ( ugi ) ) ; } if ( ! secure registry ) { return all readwrite access ; } else { return create a c lfrom username ( ugi get user name ( ) , perms ) ; } }


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


this method allows resolution of configurations outside of a skyfunction call unlike { @ link # resolve configurations } , this doesn ' t expect the current context to be evaluating dependencies of a parent target so this method is also suitable for top - level targets resolution consists of two steps : apply the per - target transitions specified in { @ code targets to evaluate } this can be used , e g , to apply { @ link com google devtools build lib analysis config transitions transition factory } s over global top - level configurations ( optionally ) trim configurations to only the fragments the targets actually need this is triggered by { @ link build configuration # trim configurations } preserves the original input order ( but merges duplicate nodes that might occur due to top - level configuration transitions ) uses original ( untrimmed , pre - transition ) configurations for targets that can ' t be evaluated ( e g due to loading phase errors ) this is suitable for feeding { @ link com google devtools build lib skyframe configured target value } keys : as general principle { @ link com google devtools build lib analysis configured target } s should have exactly as much information in their configurations as they need to evaluate and no more ( e g there ' s no need for android settings in a c + + configured target )

public static top level targets and configs result get configurations from executor ( iterable < target and configuration > default context , multimap < build configuration , dependency key > targets to evaluate , extended event handler event handler , configurations collector configurations collector ) throws invalid configuration exception , interrupted exception { map < label , target > labels to targets = new hash map < > ( ) ; for ( target and configuration target and config : default context ) { labels to targets put ( target and config get label ( ) , target and config get target ( ) ) ; } / / maps < target , original config > pairs to < target , final config > pairs for targets that / / could be successfully skyframe - evaluated map < target and configuration , target and configuration > successfully evaluated targets = new linked hash map < > ( ) ; boolean has error = false ; if ( ! targets to evaluate is empty ( ) ) { for ( build configuration from config : targets to evaluate key set ( ) ) { configurations result configurations result = configurations collector get configurations ( event handler , from config get options ( ) , targets to evaluate get ( from config ) ) ; has error | = configurations result has error ( ) ; for ( map entry < dependency key , build configuration > evaluated target : configurations result get configuration map ( ) entries ( ) ) { target target = labels to targets get ( evaluated target get key ( ) get label ( ) ) ; successfully evaluated targets put ( new target and configuration ( target , from config ) , new target and configuration ( target , evaluated target get value ( ) ) ) ; } } } linked hash set < target and configuration > result = new linked hash set < > ( ) ; for ( target and configuration original input : default context ) { if ( successfully evaluated targets contains key ( original input ) ) { / / the configuration was successfully evaluated result add ( successfully evaluated targets get ( original input ) ) ; } else { / / either the configuration couldn ' t be determined ( e g loading phase error ) or it ' s null result add ( original input ) ; } } return new top level targets and configs result ( result , has error ) ; }


given a value that has been extracted from a document ' s source , parse it into a standard format this parsing logic should closely mirror the value parsing in { @ link field mapper # parse create field } or { @ link field mapper # parse }

protected abstract object parse source value ( object value ) ;


removes the download with the given id does nothing if a download with the given id does not exist this method may be slow and shouldn ' t normally be called on the main thread

void remove download ( string id ) throws i o exception ;


returns an array containing elements in the specified range of the specified array if the range matches the entire array , the input array will be returned otherwise , a copy will be returned

public static boolean [ ] compact array ( boolean [ ] array , int index , int length ) { if ( index = = 0 & & length = = array length ) { return array ; } return arrays copy of range ( array , index , index + length ) ; }


a method to initialize the fields that depend on a configuration must be called before use kerberos or groups is used

private static void ensure initialized ( ) { if ( ! is initialized ( ) ) { synchronized ( user group information class ) { if ( ! is initialized ( ) ) { / / someone might have beat us initialize ( new configuration ( ) , false ) ; } } } }


returns true if this navigator processes nodes from the top down ; false if nodes are processed from the bottom up

public boolean is top down ( ) { return is top down ; }


return the next value associated with the current document this must not be called more than { @ link # doc value count ( ) } times note : the returned { @ link geo point } might be shared across invocations

public abstract geo point next value ( ) throws i o exception ;


check if three conditions are met before sync 1 only one source directory 2 both source and target file system are dfs 3 there is no change between from and the current status in target file system throw exceptions if first two aren ' t met , and return false to fallback to default distcp if the third condition isn ' t met

private boolean pre sync check ( ) throws i o exception { list < path > source paths = context get source paths ( ) ; if ( source paths size ( ) ! = 1 ) { / / we only support one source dir which must be a snapshottable directory throw new illegal argument exception ( source paths size ( ) + " source paths are provided " ) ; } final path source dir = source paths get ( 0 ) ; final path target dir = context get target path ( ) ; final file system src fs = source dir get file system ( conf ) ; final file system tgt fs = target dir get file system ( conf ) ; final file system snapshot diff fs = is rdiff ( ) ? tgt fs : src fs ; final path snapshot diff dir = is rdiff ( ) ? target dir : source dir ; / / currently we require both the source and the target file system are / / distributed file system if ( ! ( src fs instanceof distributed file system ) | | ! ( tgt fs instanceof distributed file system ) ) { throw new illegal argument exception ( " the file systems needs to " + " be distributed file system for using snapshot - diff - based distcp " ) ; } final distributed file system target fs = ( distributed file system ) tgt fs ; / / make sure target f s has no change between from and the current states if ( ! check no change ( target fs , target dir ) ) { / / set the source path using the snapshot path context set source paths ( arrays as list ( get snapshot path ( source dir , context get to snapshot ( ) ) ) ) ; return false ; } final string from = get snapshot name ( context get from snapshot ( ) ) ; final string to = get snapshot name ( context get to snapshot ( ) ) ; try { final file status from snapshot stat = snapshot diff fs get file status ( get snapshot path ( snapshot diff dir , from ) ) ; final file status to snapshot stat = snapshot diff fs get file status ( get snapshot path ( snapshot diff dir , to ) ) ; if ( is rdiff ( ) ) { / / if from snapshot isn ' t current dir then do a time check if ( ! from equals ( " " ) & & from snapshot stat get modification time ( ) < to snapshot stat get modification time ( ) ) { throw new hadoop illegal argument exception ( " snapshot " + from + " should be newer than " + to ) ; } } else { / / if to snapshot isn ' t current dir then do a time check if ( ! to equals ( " " ) & & from snapshot stat get modification time ( ) > to snapshot stat get modification time ( ) ) { throw new hadoop illegal argument exception ( " snapshot " + to + " should be newer than " + from ) ; } } } catch ( file not found exception nfe ) { throw new invalid input exception ( " input snapshot is not found " , nfe ) ; } return true ; }


returns a supplier that gathers a { @ link # new stored context ( boolean ) } and restores it once the returned supplier is invoked the context returned from the supplier is a stored version of the suppliers callers context that should be restored once the originally gathered context is not needed anymore for instance this method should be used like this : supplier & lt ; thread context stored context & gt ; restorable = context new restorable context ( true ) ; new thread ( ) { public void run ( ) { try ( thread context stored context ctx = restorable get ( ) ) { execute with the parents context and restore the threads context afterwards } } } start ( ) ;

public supplier < stored context > new restorable context ( boolean preserve response headers ) { return wrap restorable ( new stored context ( preserve response headers ) ) ; }


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


returns an immutable array containing the given values , in order

public static immutable double array of ( double e 0 , double e 1 , double e 2 , double e 3 , double e 4 , double e 5 ) { return new immutable double array ( new double [ ] { e 0 , e 1 , e 2 , e 3 , e 4 , e 5 } ) ; } / / todo ( kevinb ) : go up to 11 ?


sets the < code > name < code > property

public additional properties any type name ( string name ) { this name = name ; return this ; }


json variables need to be represented as json node for engine to handle as json do this for any var marked as json or whose type is not recognised from the extension file

private process extension model convert json variables ( process extension model process extension model ) { if ( process extension model ! = null & & process extension model get all extensions ( ) ! = null & & process extension model get all extensions ( ) size ( ) > 0 ) { for ( extension extension : process extension model get all extensions ( ) values ( ) ) { if ( extension get properties ( ) ! = null ) { save variable as json object ( extension ) ; } } } return process extension model ; }


public byte attributes ( ) { return buffer get ( attributes offset ) ; }


returns the status of { @ link async search task }

public async status response get status response ( ) { mutable search response mutable search response = search response get ( ) ; assert mutable search response ! = null ; return mutable search response to status response ( search id get encoded ( ) , get start time ( ) , expiration time millis ) ; }


returns whether the sample at the given index has a subsample encryption table

public boolean sample has subsample encryption table ( int index ) { return defines encryption data & & sample has subsample encryption table [ index ] ; }


reset all instance variables of this object to a state equal to that of a newly constructed object

public synchronized void reset ( ) { packages completed = 0 ; pending set = new linked hash set < > ( ) ; }


updates ssl context via the passed callback

public synchronized void update ssl context ( final ssl context provider callback callback ) { check not null ( callback , " callback " ) ; check state ( ! shutdown , " supplier is shutdown ! " ) ; if ( ssl context provider = = null ) { ssl context provider = tls context manager find or create client ssl context provider ( upstream tls context ) ; } / / we want to increment the ref - count so call find or create again final ssl context provider to release = tls context manager find or create client ssl context provider ( upstream tls context ) ; ssl context provider add callback ( new ssl context provider callback ( callback get executor ( ) ) { @ override public void update secret ( ssl context ssl context ) { callback update secret ( ssl context ) ; tls context manager release client ssl context provider ( to release ) ; } @ override public void on exception ( throwable throwable ) { callback on exception ( throwable ) ; tls context manager release client ssl context provider ( to release ) ; } } ) ; }


handle the web socket handshake for the web socket specification < a href = " https : tools ietf orghtmldraft - ietf - hybi - thewebsocketprotocol - 07 " > hy bi version 7 browser request to the server : get chat http1 1 host : server example com upgrade : websocket connection : upgrade sec - web socket - key : d ghl i h nhb x bs z s bub 2 5j z q = = sec - web socket - origin : http : example com sec - web socket - protocol : chat , superchat sec - web socket - version : 7 server response : http1 1 101 switching protocols upgrade : websocket connection : upgrade sec - web socket - accept : s 3p p l m bi txa q 9k y gzzh z rb k + x oo = sec - web socket - protocol : chat

protected full http response new handshake response ( full http request req , http headers headers ) { char sequence key = req headers ( ) get ( http header names sec websocket key ) ; if ( key = = null ) { throw new web socket server handshake exception ( " not a web socket request : missing key " , req ) ; } full http response res = new default full http response ( http 1 1 , http response status switching protocols , req content ( ) alloc ( ) buffer ( 0 ) ) ; if ( headers ! = null ) { res headers ( ) add ( headers ) ; } string accept seed = key + websocket 07 accept guid ; byte [ ] sha 1 = web socket util sha 1 ( accept seed get bytes ( charset util us ascii ) ) ; string accept = web socket util base 6 4 ( sha 1 ) ; if ( logger is debug enabled ( ) ) { logger debug ( " web socket version 07 server handshake key : { } , response : { } " , key , accept ) ; } res headers ( ) set ( http header names upgrade , http header values websocket ) set ( http header names connection , http header values upgrade ) set ( http header names sec websocket accept , accept ) ; string subprotocols = req headers ( ) get ( http header names sec websocket protocol ) ; if ( subprotocols ! = null ) { string selected subprotocol = select subprotocol ( subprotocols ) ; if ( selected subprotocol = = null ) { if ( logger is debug enabled ( ) ) { logger debug ( " requested subprotocol ( s ) not supported : { } " , subprotocols ) ; } } else { res headers ( ) set ( http header names sec websocket protocol , selected subprotocol ) ; } } return res ; }


convert each { @ code http range } into a { @ code resource region } , selecting the appropriate segment of the given { @ code resource } using http range information

public static list < resource region > to resource regions ( list < http range > ranges , resource resource ) { if ( collection utils is empty ( ranges ) ) { return collections empty list ( ) ; } list < resource region > regions = new array list < > ( ranges size ( ) ) ; for ( http range range : ranges ) { regions add ( range to resource region ( resource ) ) ; } if ( ranges size ( ) > 1 ) { long length = get length for ( resource ) ; long total = 0 ; for ( resource region region : regions ) { total + = region get count ( ) ; } if ( total > = length ) { throw new illegal argument exception ( " the sum of all ranges ( " + total + " ) should be less than the resource length ( " + length + " ) " ) ; } } return regions ; }


only needed if a stacked - barchart entry was highlighted references the selected value within the stacked - entry

public int get stack index ( ) { return m stack index ; }


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

public void create user ( user body , api client auth info auth info , handler < async result < void > > result handler ) { delegate create user ( body , auth info , result handler ) ; }


checks that a certain event sequence is recognized

public void test simple pattern event time with comparator ( ) throws exception { stream execution environment env = stream execution environment get execution environment ( ) ; / / ( event , timestamp ) data stream < event > input = env from elements ( tuple 2 of ( new event ( 1 , " start " , 1 0 ) , 5l ) , tuple 2 of ( new event ( 2 , " middle " , 2 0 ) , 1l ) , tuple 2 of ( new event ( 3 , " end " , 3 0 ) , 3l ) , tuple 2 of ( new event ( 4 , " end " , 4 0 ) , 10l ) , tuple 2 of ( new event ( 5 , " middle " , 6 0 ) , 7l ) , tuple 2 of ( new event ( 6 , " middle " , 5 0 ) , 7l ) , / / last element for high final watermark tuple 2 of ( new event ( 7 , " middle " , 5 0 ) , 100l ) ) assign timestamps and watermarks ( new assigner with punctuated watermarks < tuple 2 < event , long > > ( ) { @ override public long extract timestamp ( tuple 2 < event , long > element , long previous timestamp ) { return element f 1 ; } @ override public watermark check and get next watermark ( tuple 2 < event , long > last element , long extracted timestamp ) { return new watermark ( last element f 1 - 5 ) ; } } ) map ( new map function < tuple 2 < event , long > , event > ( ) { @ override public event map ( tuple 2 < event , long > value ) throws exception { return value f 0 ; } } ) ; event comparator < event > comparator = new custom event comparator ( ) ; pattern < event , ? extends event > pattern = pattern < event > begin ( " start " ) where ( new simple condition < event > ( ) { @ override public boolean filter ( event value ) throws exception { return value get name ( ) equals ( " start " ) ; } } ) followed by any ( " middle " ) where ( new simple condition < event > ( ) { @ override public boolean filter ( event value ) throws exception { return value get name ( ) equals ( " middle " ) ; } } ) followed by any ( " end " ) where ( new simple condition < event > ( ) { @ override public boolean filter ( event value ) throws exception { return value get name ( ) equals ( " end " ) ; } } ) ; data stream < string > result = cep pattern ( input , pattern , comparator ) select ( new pattern select function < event , string > ( ) { @ override public string select ( map < string , list < event > > pattern ) { string builder builder = new string builder ( ) ; builder append ( pattern get ( " start " ) get ( 0 ) get id ( ) ) append ( " , " ) append ( pattern get ( " middle " ) get ( 0 ) get id ( ) ) append ( " , " ) append ( pattern get ( " end " ) get ( 0 ) get id ( ) ) ; return builder to string ( ) ; } } ) ; list < string > result list = new array list < > ( ) ; data stream utils collect ( result ) for each remaining ( result list : : add ) ; list < string > expected = arrays as list ( " 1 , 6 , 4 " , " 1 , 5 , 4 " ) ; expected sort ( string : : compare to ) ; result list sort ( string : : compare to ) ; assert equals ( expected , result list ) ; }


adds the temporary direct deps given in { @ code helper } and returns the set of unique deps added it is the users responsibility to ensure that there are no elements in common between helper and the already existing temporary direct deps

set < sky key > add temporary direct deps ( grouped list helper < sky key > helper ) ;


protected uri components normalize ( final string resource ) { val builder = uri components builder new instance ( ) ; val matcher = resource normalized pattern matcher ( resource ) ; if ( ! matcher matches ( ) ) { logger error ( " unable to match the resource [ { } ] against pattern [ { } ] for normalization " , resource , matcher pattern ( ) pattern ( ) ) ; return null ; } builder scheme ( matcher group ( pattern group index scheme ) ) ; builder user info ( matcher group ( pattern group index userinfo ) ) ; builder host ( matcher group ( pattern group index host ) ) ; val port = matcher group ( pattern group index port ) ; if ( ! string utils is blank ( port ) ) { builder port ( integer parse int ( port ) ) ; } builder path ( matcher group ( pattern group index path ) ) ; builder query ( matcher group ( pattern group index query ) ) ; builder fragment ( matcher group ( pattern group index fragment ) ) ; val current builder = builder build ( ) ; if ( string utils is blank ( current builder get scheme ( ) ) ) { if ( string utils is not blank ( current builder get user info ( ) ) & & string utils is blank ( current builder get path ( ) ) & & string utils is blank ( current builder get query ( ) ) & & current builder get port ( ) < 0 ) { builder scheme ( " acct " ) ; } else { builder scheme ( " https " ) ; } } builder fragment ( null ) ; return builder build ( ) ; }


replaces the internal components of this structure with components of the given structure

public void replace with ( data type data type ) { if ( ! ( data type instanceof structure ) ) { throw new illegal argument exception ( ) ; } structure struct = ( structure ) data type ; int old length = struct length ; components clear ( ) ; struct length = 0 ; num components = 0 ; flexible array component = null ; set alignment ( struct ) ; if ( struct is internally aligned ( ) ) { do replace with aligned ( struct ) ; } else { do replace with unaligned ( struct ) ; } data type component flex component = struct get flexible array component ( ) ; if ( flex component ! = null ) { set flexible array component ( flex component get data type ( ) , flex component get field name ( ) , flex component get comment ( ) ) ; } if ( old length ! = struct length ) { notify size changed ( ) ; } }


protected void after release ( boolean recycled ) { / / nothing to do }


public response entity < void > add pet ( @ api param ( value = " pet object that needs to be added to the store " , required = true ) @ valid @ request body pet body ) { return delegate add pet ( body ) ; }


this implementation always returns a { @ link cache } implementation that will not store items additionally , the request cache will be remembered by the manager for consistency

public cache get cache ( string name ) { cache cache = this caches get ( name ) ; if ( cache = = null ) { this caches compute if absent ( name , key - > new no op cache ( name ) ) ; synchronized ( this cache names ) { this cache names add ( name ) ; } } return this caches get ( name ) ; }


add a new encryption zone called while holding the f s directory lock

void add encryption zone ( long inode id , cipher suite suite , crypto protocol version version , string key name ) { assert dir has write lock ( ) ; unprotected add encryption zone ( inode id , suite , version , key name ) ; }


void print stack trace ( exception ex ) ;


you may not overwrite an item you know is there even if you cannot see it

@ test public void overwrite known target ( ) throws exception { cannot overwrite ( " known " ) ; }


returns valence as a double should be overridden extending classes

public double degree ( vertex v ) { return valence ( v ) ; }


the method is used to find out if the stop watch is started

public boolean is running ( ) { return is started ; }


equivalent to { @ link # remove metadata output ( metadata output ) }

public void clear metadata output ( metadata output output ) { remove metadata output ( output ) ; }


this method is used as part of the view class and is not normally called or subclassed by clients of g l texture view

protected void on attached to window ( ) { super on attached to window ( ) ; if ( log attach detach ) { log d ( tag , " on attached to window reattach = " + detached ) ; } if ( detached & & ( renderer ! = null ) ) { int render mode = rendermode continuously ; if ( gl thread ! = null ) { render mode = gl thread get render mode ( ) ; } gl thread = new g l thread ( m this weak ref ) ; if ( render mode ! = rendermode continuously ) { gl thread set render mode ( render mode ) ; } gl thread start ( ) ; } detached = false ; }


closes the ' { @ code form } ' block tag and removes the form object name from the { @ link javax servlet jsp page context }

public int do end tag ( ) throws jsp exception { request data value processor processor = get request context ( ) get request data value processor ( ) ; servlet request request = this page context get request ( ) ; if ( processor ! = null & & request instanceof http servlet request ) { write hidden fields ( processor get extra hidden fields ( ( http servlet request ) request ) ) ; } assert state ( this tag writer ! = null , " no tag writer set " ) ; this tag writer end tag ( ) ; return eval page ; }


verify the following scenario a put a live node to maintenance = > 1 maintenance , 2 live b the maintenance node becomes dead = > block map still has 1 maintenance , 2 live c restart nn = > block map only has 2 live = > restore the 3 live d restart the maintenance dn = > 1 maintenance , 3 live e take the node out of maintenance = > over replication = > 3 live

public void test with n n and d n restart ( ) throws exception { log info ( " starting test with n n and d n restart " ) ; final int num namenodes = 1 ; final int num datanodes = 4 ; start cluster ( num namenodes , num datanodes ) ; final path file = new path ( " / test with n n and d n restart dat " ) ; final int replicas = 3 ; final file system file sys = get cluster ( ) get file system ( 0 ) ; f s namesystem ns = get cluster ( ) get namesystem ( 0 ) ; write file ( file sys , file , replicas , 1 ) ; datanode info node outof service = take node outof service ( 0 , get first block first replica uuid ( file sys , file ) , long max value , null , admin states in maintenance ) ; check with retry ( ns , file sys , file , replicas - 1 , node outof service ) ; d f s client client = get dfs client ( 0 ) ; assert equals ( " all datanodes must be alive " , num datanodes , client datanode report ( datanode report type live ) length ) ; mini d f s cluster data node properties dn prop = get cluster ( ) stop data node ( node outof service get xfer addr ( ) ) ; d f s test util wait for datanode state ( get cluster ( ) , node outof service get datanode uuid ( ) , false , 20000 ) ; assert equals ( " maintenance node shouldn ' t be alive " , num datanodes - 1 , client datanode report ( datanode report type live ) length ) ; / / dead maintenance node ' s blocks should remain in block map check with retry ( ns , file sys , file , replicas - 1 , node outof service ) ; / / restart nn , nn will restore 3 live replicas given it doesn ' t / / know the maintenance node has the replica get cluster ( ) restart name node ( 0 ) ; ns = get cluster ( ) get namesystem ( 0 ) ; check with retry ( ns , file sys , file , replicas , null ) ; / / restart dn , nn has 1 maintenance replica and 3 live replicas get cluster ( ) restart data node ( dn prop , true ) ; get cluster ( ) wait active ( ) ; check with retry ( ns , file sys , file , replicas , node outof service ) ; / / put the node in service , a redundant replica should be removed put node in service ( 0 , node outof service get datanode uuid ( ) ) ; check with retry ( ns , file sys , file , replicas , null ) ; cleanup file ( file sys , file ) ; }


public void quit worker ( io grpc benchmarks proto control void request , io grpc stub stream observer < io grpc benchmarks proto control void > response observer ) { io grpc stub server calls async unimplemented unary call ( get quit worker method ( ) , response observer ) ; }


returns the start future indicating whether this leader election service has been started or not

public synchronized completable future < void > get start future ( ) { return start future ; }


returns an equivalence over iterables based on the equivalence of their elements more specifically , two iterables are considered equivalent if they both contain the same number of elements , and each pair of corresponding elements is equivalent according to { @ code this } null iterables are equivalent to one another note that this method performs a similar function for equivalences as { @ link com google common collect ordering # lexicographical } does for orderings

public final < s extends t > equivalence < iterable < s > > pairwise ( ) { / / ideally , the returned equivalence would support iterable < ? extends t > however , / / the need for this is so rare that it ' s not worth making callers deal with the ugly wildcard return new pairwise equivalence < s > ( this ) ; }


public object get anytype 2 ( ) { return anytype 2 ; }


gets the cached " raw " method name for this method descriptor the raw name is transport specific , and should be set using { @ link # set raw method name } by the transport

final object get raw method name ( int transport ordinal ) { return raw method names get ( transport ordinal ) ; }


public void set bytes ( long bytes ) { this bytes = bytes ; }


use a runnable wrapper that simulates a task with unknown failures

public void test exception throwing task ( ) throws exception { thread context context = new thread context ( settings empty ) ; e w m a tracking es thread pool executor executor = new e w m a tracking es thread pool executor ( " test - threadpool " , 1 , 1 , 1000 , time unit milliseconds , concurrent collections new blocking queue ( ) , exceptional wrapper ( ) , es executors daemon thread factory ( " queuetest " ) , new es abort policy ( ) , context ) ; executor prestart all core threads ( ) ; logger info ( " - - > executor : { } " , executor ) ; assert that ( ( long ) executor get task execution e w m a ( ) , equal to ( 0l ) ) ; execute task ( executor , 1 ) ; executor shutdown ( ) ; executor await termination ( 10 , time unit seconds ) ; }


when there are all the internal blocks available but they are not placed on enough racks , name node should avoid normal decoding reconstruction but copy an internal block to a new rack in this test , we first need to create a scenario that a striped block has all the internal blocks but distributed in < 6 racks then we check if the redundancy monitor can correctly schedule the reconstruction work for it

public void test reconstruct for not enough racks ( ) throws exception { log info ( " cluster hosts : { } , racks : { } " , arrays as list ( hosts ) , arrays as list ( racks ) ) ; cluster = new mini d f s cluster builder ( conf ) racks ( racks ) hosts ( hosts ) num data nodes ( hosts length ) build ( ) ; cluster wait active ( ) ; fs = cluster get file system ( ) ; fs enable erasure coding policy ( striped file test util get default e c policy ( ) get name ( ) ) ; fs set erasure coding policy ( new path ( " / " ) , striped file test util get default e c policy ( ) get name ( ) ) ; f s namesystem fsn = cluster get namesystem ( ) ; block manager bm = fsn get block manager ( ) ; mini d f s cluster data node properties last host = stop data node ( hosts [ hosts length - 1 ] ) ; final path file = new path ( " / foo " ) ; / / the file ' s block is in 9 dn but 5 racks d f s test util create file ( fs , file , cell size * data blocks * 2 , ( short ) 1 , 0l ) ; generic test utils wait for ( ( ) - > bm num of under replicated blocks ( ) = = 0 , 100 , 30000 ) ; log info ( " created file { } " , file ) ; final i node file file node = fsn get f s directory ( ) get i node 4 write ( file to string ( ) ) as file ( ) ; block info striped block info = ( block info striped ) file node get last block ( ) ; / / we now should have 9 internal blocks distributed in 5 racks set < string > rack set = new hash set < > ( ) ; for ( datanode storage info storage : block info storages ) { rack set add ( storage get datanode descriptor ( ) get network location ( ) ) ; } assert assert equals ( " rack set size is wrong : " + rack set , data blocks - 1 , rack set size ( ) ) ; / / restart the stopped datanode cluster restart data node ( last host ) ; cluster wait active ( ) ; / / make sure we have 6 racks again network topology topology = bm get datanode manager ( ) get network topology ( ) ; log info ( " topology is : { } " , topology ) ; assert assert equals ( hosts length , topology get num of leaves ( ) ) ; assert assert equals ( data blocks , topology get num of racks ( ) ) ; / / pause all the heartbeats for ( data node dn : cluster get data nodes ( ) ) { data node test utils set heartbeats disabled for tests ( dn , true ) ; } fsn write lock ( ) ; try { bm process mis replicated blocks ( ) ; } finally { fsn write unlock ( ) ; } / / check if redundancy monitor correctly schedule the reconstruction work boolean scheduled = false ; for ( int i = 0 ; i < 5 ; i + + ) { / / retry 5 times for ( datanode storage info storage : block info storages ) { if ( storage ! = null ) { datanode descriptor dn = storage get datanode descriptor ( ) ; assert assert equals ( " block to be erasure coded is wrong for datanode : " + dn , 0 , dn get number of blocks to be erasure coded ( ) ) ; if ( dn get number of blocks to be replicated ( ) = = 1 ) { scheduled = true ; } } } if ( scheduled ) { break ; } thread sleep ( 1000 ) ; } assert assert true ( scheduled ) ; }


returns an address in a normalized format for akka when an i pv 6 address is specified , it normalizes the i pv 6 address to avoid complications with the exact url match policy of akka

public static string unresolved host to normalized string ( string host ) { / / return loopback interface address if host is null / / this represents the behavior of { @ code inet address get by name } and rfc 3330 if ( host = = null ) { host = inet address get loopback address ( ) get host address ( ) ; } else { host = host trim ( ) to lower case ( ) ; if ( host starts with ( " [ " ) & & host ends with ( " ] " ) ) { string address = host substring ( 1 , host length ( ) - 1 ) ; if ( i p address util is i pv 6 literal address ( address ) ) { host = address ; } } } / / normalize and valid address if ( i p address util is i pv 6 literal address ( host ) ) { byte [ ] ip v 6 address = i p address util text to numeric format v 6 ( host ) ; host = get i pv 6 url representation ( ip v 6 address ) ; } else if ( ! i p address util is i pv 4 literal address ( host ) ) { try { / / we don ' t allow these in hostnames preconditions check argument ( ! host starts with ( " " ) ) ; preconditions check argument ( ! host ends with ( " " ) ) ; preconditions check argument ( ! host contains ( " : " ) ) ; } catch ( exception e ) { throw new illegal configuration exception ( " the configured hostname is not valid " , e ) ; } } return host ; }


public resource profile get resource profile ( ) { return resource profile ; }


encodes some exceptions where " c " is silent

boolean encode silent c ( ) { if ( string at ( ( m current + 1 ) , 1 , " t " , " s " , " " ) ) { if ( string at ( 0 , 11 , " connecticut " , " " ) | | string at ( 0 , 6 , " indict " , " tucson " , " " ) ) { m current + + ; return true ; } } return false ; }


the time that this offset started in milliseconds since epoch

public long start utc millis ( ) { return start utc millis ; }


public final int write size ( ) { collection < ? extends item > items = items ( ) ; int sz = items size ( ) ; if ( sz = = 0 ) { return 0 ; } / / since each item has to be the same size , we can pick any return sz * items iterator ( ) next ( ) write size ( ) ; }


< code > pattern < code > argument that matches the given regular expression see examples in javadoc for { @ link argument matchers } class

public static string matches ( pattern pattern ) { report matcher ( new matches ( pattern ) ) ; return " " ; }


invoked by async data service to write back to hdfs

void execute write back ( ) { preconditions check state ( async status , " open file ctx has false async status , file id : " + latest attr get file id ( ) ) ; final long start offset = async write back start offset ; try { while ( active state ) { / / async status could be changed to false in offer next to write ( ) write ctx to write = offer next to write ( ) ; if ( to write ! = null ) { / / do the write do single write ( to write ) ; update last access time ( ) ; } else { break ; } } if ( ! active state ) { log debug ( " the open file ctx is not active anymore , file id : { } " , latest attr get file id ( ) ) ; } } finally { / / make sure to reset async status to false unless a race happens synchronized ( this ) { if ( start offset = = async write back start offset ) { async status = false ; } else { log info ( " another async task is already started before this one " + " is finalized file id : { } async status : { } " + " original start offset : { } " + " new start offset : { } won ' t change async status here " , latest attr get file id ( ) , async status , start offset , async write back start offset ) ; } } } }


refresh the stub and retry the remote invocation if necessary if not configured to refresh on connect failure , this method simply rethrows the original exception

private object handle remote connect failure ( method invocation invocation , exception ex ) throws throwable { if ( this refresh stub on connect failure ) { string msg = " could not connect to rmi service [ " + get service url ( ) + " ] - retrying " ; if ( logger is debug enabled ( ) ) { logger warn ( msg , ex ) ; } else if ( logger is warn enabled ( ) ) { logger warn ( msg ) ; } return refresh and retry ( invocation ) ; } else { throw ex ; } }


gets the blob ' s contents size in bytes

public int get contents size ( ) { return contents size ; }


public static byte [ ] get all data ( string server ) throws exception { map < string , string > params = new hash map < > ( 8 ) ; rest result < string > result = http client http get ( " http : / / " + server + env util get context path ( ) + utils and commons nacos naming context + all data get url , new array list < > ( ) , params ) ; if ( result ok ( ) ) { return result get data ( ) get bytes ( ) ; } throw new i o exception ( " failed to req api : " + " http : / / " + server + env util get context path ( ) + utils and commons nacos naming context + all data get url + " code : " + result get code ( ) + " msg : " + result get message ( ) ) ; }


construct the preferred type of ' raw ' sequence file writer

public static writer create writer ( configuration conf , f s data output stream out , class key class , class val class , compression type compression type , compression codec codec , metadata metadata ) throws i o exception { return create writer ( conf , writer stream ( out ) , writer key class ( key class ) , writer value class ( val class ) , writer compression ( compression type , codec ) , writer metadata ( metadata ) ) ; }


called when some running operations are cancelled or { @ link # check for cancel ( ) } is explicitly called if this method throws an exception , cancelling tasks will fail with that exception ; otherwise they will fail with the default exception { @ link execution cancelled exception }

void on cancel ( string reason , @ nullable exception before cancel exception ) ;


calculates the maximum size allowed before rehashing

private int calc max size ( int capacity ) { / / clip the upper bound so that there will always be at least one available slot int upper bound = capacity - 1 ; return math min ( upper bound , ( int ) ( capacity * load factor ) ) ; }


public murmur hash reset ( ) { count = 0 ; hash = seed ; return this ; }


get an array of the row indices for all the selected components

public int [ ] get selected component rows ( ) { int [ ] selected rows = new int [ get num selected component rows ( ) ] ; int new index = 0 ; int num components = get num components ( ) ; int num ranges = selection get num ranges ( ) ; for ( int i = 0 ; i < num ranges ; i + + ) { field range range = selection get field range ( i ) ; for ( int temp row = range get start ( ) get index ( ) int value ( ) ; temp row < range get end ( ) get index ( ) int value ( ) & & temp row < num components ; temp row + + ) { selected rows [ new index + + ] = temp row ; } } return selected rows ; }


public string get application owner ( ) throws i o exception { t file reader scanner owner scanner = null ; try { owner scanner = reader create scanner ( ) ; log key key = new log key ( ) ; while ( ! owner scanner at end ( ) ) { t file reader scanner entry entry = owner scanner entry ( ) ; key read fields ( entry get key stream ( ) ) ; if ( key to string ( ) equals ( application owner key to string ( ) ) ) { data input stream value stream = entry get value stream ( ) ; return value stream read u t f ( ) ; } owner scanner advance ( ) ; } return null ; } finally { i o utils cleanup with logger ( log , owner scanner ) ; } }


public void set deferred collector ( iterable < bucket collector > deferred collectors ) { this collector = multi bucket collector wrap ( deferred collectors ) ; }


public list < list < read only first > > get array array of model ( ) { return array array of model ; }


sets the playback parameters of the player , and also saves them to shared preferences speed and pitch are rounded up to 2 decimal places before being used or saved

public void set playback parameters ( final float speed , final float pitch , final boolean skip silence ) { final float rounded speed = math round ( speed * 100 0f ) / 100 0f ; final float rounded pitch = math round ( pitch * 100 0f ) / 100 0f ; save playback parameters to prefs ( this , rounded speed , rounded pitch , skip silence ) ; simple exo player set playback parameters ( new playback parameters ( rounded speed , rounded pitch , skip silence ) ) ; }


called by the activity base class from the { @ link activity # on resume } method


see { @ link stream tracer # inbound message read } called from { @ link io grpc internal message deframer }

public void inbound message read ( int seq no , long optional wire size , long optional uncompressed size ) { for ( stream tracer tracer : tracers ) { tracer inbound message read ( seq no , optional wire size , optional uncompressed size ) ; } }


replaces the existing addresses used with this { @ code subchannel } if the new and old addresses overlap , the subchannel can continue using an existing connection it must be called from the synchronization context or will throw

public void update addresses ( list < equivalent address group > addrs ) { throw new unsupported operation exception ( ) ; }


generate a new class if necessary and return it without creating a new instance this ignores any callbacks that have been set to create a new instance you will have to use reflection , and methods called during the constructor will not be intercepted to avoid this problem , use the multi - arg < code > create < code > method

public class create class ( ) { class only = true ; return ( class ) create helper ( ) ; }


return the { @ link x m l stream writer } for the given st a x result

public static x m l stream writer get x m l stream writer ( result result ) { if ( result instanceof st a x result ) { return ( ( st a x result ) result ) get x m l stream writer ( ) ; } else if ( result instanceof stax result ) { return ( ( stax result ) result ) get x m l stream writer ( ) ; } else { throw new illegal argument exception ( " result ' " + result + " ' is neither stax result nor st a x result " ) ; } }


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


public list < plugin wrapper > get plugins ( ) { return collections unmodifiable list ( plugins ) ; }


trying to abort an upload with no data does not create a file

public void test abort empty upload ( ) throws exception { describe ( " initialize upload and abort before uploading data " ) ; path file = method path ( ) ; abort upload ( start upload ( file ) , file ) ; assert path does not exist ( " uploaded file should not exist " , file ) ; }


writes this section header to the specified random access file

public void write header ( random access file raf , data converter dc ) throws i o exception { byte [ ] padded name = new byte [ image sizeof short name ] ; byte [ ] name bytes = name get bytes ( ) ; system arraycopy ( name bytes , 0 , padded name , 0 , math min ( name bytes length , image sizeof short name ) ) ; raf write ( padded name ) ; raf write ( dc get bytes ( virtual size ) ) ; raf write ( dc get bytes ( virtual address ) ) ; raf write ( dc get bytes ( size of raw data ) ) ; raf write ( dc get bytes ( pointer to raw data ) ) ; raf write ( dc get bytes ( pointer to relocations ) ) ; raf write ( dc get bytes ( pointer to linenumbers ) ) ; raf write ( dc get bytes ( number of relocations ) ) ; raf write ( dc get bytes ( number of linenumbers ) ) ; raf write ( dc get bytes ( characteristics ) ) ; }


called after a client has given the { @ link abstract drawee controller } a hint that the view is no longer visible in the viewport

void on drawee viewport exit ( string id ) ;


< code > repeated bytes bytes list = 10 ; < code >

public com google protobuf byte string get bytes list ( int index ) { return bytes list get ( index ) ; }


creates a new { @ code tumbling processing time windows } { @ link window assigner } that assigns elements to time windows based on the element timestamp

public static tumbling processing time windows of ( time size ) { return new tumbling processing time windows ( size to milliseconds ( ) , 0 , window stagger aligned ) ; }


creates a namespace hierarchy using the list of strings specified in namespace path

public static namespace create namespace ( program program , string namespace path ) throws duplicate name exception , invalid input exception { namespace parent namespace = program get global namespace ( ) ; namespace namespace = null ; for ( string namespace name : namespace path ) { namespace = get namespace ( program , parent namespace , namespace name ) ; parent namespace = namespace ; } return namespace ; }


gets direct access to the underlying { @ code binder }

protected binder binder ( ) { return binder ; }


validates taking the application - defined memory state backend and adding additional parameters from the cluster configuration

public void test configure memory state backend ( ) throws exception { final string checkpoint dir = new path ( tmp new folder ( ) to u r i ( ) ) to string ( ) ; final string savepoint dir = new path ( tmp new folder ( ) to u r i ( ) ) to string ( ) ; final path expected checkpoint path = new path ( checkpoint dir ) ; final path expected savepoint path = new path ( savepoint dir ) ; final int max size = 100 ; final boolean async = ! checkpointing options async snapshots default value ( ) ; final memory state backend backend = new memory state backend ( max size , async ) ; final configuration config = new configuration ( ) ; config set string ( backend key , " filesystem " ) ; / / check that this is not accidentally picked up config set string ( checkpointing options checkpoints directory , checkpoint dir ) ; config set string ( checkpointing options savepoint directory , savepoint dir ) ; config set boolean ( checkpointing options async snapshots , ! async ) ; state backend loaded backend = state backend loader from application or config or default ( backend , config , cl , null ) ; assert true ( loaded backend instanceof memory state backend ) ; final memory state backend mem backend = ( memory state backend ) loaded backend ; assert equals ( expected checkpoint path , mem backend get checkpoint path ( ) ) ; assert equals ( expected savepoint path , mem backend get savepoint path ( ) ) ; assert equals ( max size , mem backend get max state size ( ) ) ; assert equals ( async , mem backend is using asynchronous snapshots ( ) ) ; }


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


sends ganglia metrics to the configured hosts

protected void emit to ganglia hosts ( ) throws i o exception { try { for ( socket address socket address : metrics servers ) { if ( socket address = = null | | ! ( socket address instanceof inet socket address ) ) throw new illegal argument exception ( " unsupported address type " ) ; inet socket address inet address = ( inet socket address ) socket address ; if ( inet address is unresolved ( ) ) { throw new unknown host exception ( " unresolved host : " + inet address ) ; } datagram packet packet = new datagram packet ( buffer , offset , socket address ) ; datagram socket send ( packet ) ; } } finally { / / reset the buffer for the next metric to be built offset = 0 ; } }


read an array , returning a default if the index is out of bounds

protected static int check read ( byte [ ] arr , int idx , int def ) { / / when there ' s an offset , idx can be < 0 if ( idx > = arr length | | idx < 0 ) { return 0xff & def ; } return 0xff & arr [ idx ] ; }


get any delegation token manager created by the filesystem

abfs delegation token manager get delegation token manager ( ) { return delegation token manager ; }


void start seek ( long target granule ) ;


register a contact filter to provide specific control over collision otherwise the default filter is used ( default filter ) the listener is owned by you and must remain in scope

public void set contact filter ( contact filter filter ) { m contact manager m contact filter = filter ; }


set the key of an application context reference to expose in the job data map , for example " application context " default is none only applicable when running in a spring application context in case of a quartz job bean , the reference will be applied to the job instance as bean property an " application context " attribute will correspond to a " set application context " method in that scenario note that bean factory callback interfaces like application context aware are not automatically applied to quartz job instances , because quartz itself is responsible for the lifecycle of its jobs < b > note : when using persistent job stores where job detail contents will be kept in the database , do not put an application context reference into the job data map but rather into the scheduler context < b >

public void set application context job data key ( string application context job data key ) { this application context job data key = application context job data key ; }


adds a list of splits for this reader to read this method is called when the enumerator assigns a split via { @ link split enumerator context # assign split ( source split , int ) } or { @ link split enumerator context # assign splits ( splits assignment ) }

void add splits ( list < split t > splits ) ;


compare two byte arrays by their corresponding entries if the two arrays have differing lengths , the shorter precedes the longer otherwise , they are compared as in c ' s { @ code memcmp } , except that java { @ code byte } s are signed

public static int compare arrays ( byte [ ] a , byte [ ] b ) { int result ; result = a length - b length ; if ( result ! = 0 ) { return result ; } for ( int i = 0 ; i < a length ; i + + ) { result = a [ i ] - b [ i ] ; if ( result ! = 0 ) { return result ; } } return 0 ; }


tests that the underlying stream file is deleted if the close and get handle method fails

public void test cleanup when failing close and get handle ( ) throws i o exception { final file system fs = mock ( file system class ) ; final f s data output stream output stream = mock ( f s data output stream class ) ; final argument captor < path > path captor = argument captor for class ( path class ) ; when ( fs create ( path captor capture ( ) , any ( file system write mode class ) ) ) then return ( output stream ) ; do throw ( new i o exception ( " test i o exception " ) ) when ( output stream ) close ( ) ; checkpoint stream factory checkpoint state output stream stream = new fs checkpoint stream factory fs checkpoint state output stream ( path from local file ( temp dir new folder ( ) ) , fs , 4 , 0 , relative paths ) ; / / this should create the underlying file stream stream write ( new byte [ ] { 1 , 2 , 3 , 4 , 5 } ) ; verify ( fs ) create ( any ( path class ) , any ( file system write mode class ) ) ; try { stream close and get handle ( ) ; fail ( " expected i o exception " ) ; } catch ( i o exception io e ) { / / expected exception } verify ( fs ) delete ( eq ( path captor get value ( ) ) , any boolean ( ) ) ; }


public long get idle delay ( ) { return idle delay ; }


allow map access to the environment to be set for the connector , with the option to add or override specific entries useful for specifying entries directly , for example via " environment [ my key ] " this is particularly useful for adding or overriding entries in child bean definitions

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


any insn that isn ' t a move or a phi ( which is also a move )

public void visit non move insn ( normal ssa insn insn ) ;


specify custom type filters for spring - based scanning for entity classes default is to search all specified packages for classes annotated with { @ code @ javax persistence entity } , { @ code @ javax persistence embeddable } or { @ code @ javax persistence mapped superclass }

public local session factory builder set entity type filters ( type filter entity type filters ) { this entity type filters = entity type filters ; return this ; }


submits the task and adds a listener that adds the future to { @ code queue } when it completes

private static < t > listenable future < t > submit and add queue listener ( listening executor service executor service , callable < t > task , final blocking queue < future < t > > queue ) { final listenable future < t > future = executor service submit ( task ) ; future add listener ( new runnable ( ) { @ override public void run ( ) { queue add ( future ) ; } } , direct executor ( ) ) ; return future ; }


encode the given username and password into basic authentication credentials the encoded credentials returned by this method can be supplied to { @ link # set basic auth ( string ) } to set the basic authentication header

public static string encode basic auth ( string username , string password , @ nullable charset charset ) { assert not null ( username , " username must not be null " ) ; assert does not contain ( username , " : " , " username must not contain a colon " ) ; assert not null ( password , " password must not be null " ) ; if ( charset = = null ) { charset = standard charsets iso 8859 1 ; } charset encoder encoder = charset new encoder ( ) ; if ( ! encoder can encode ( username ) | | ! encoder can encode ( password ) ) { throw new illegal argument exception ( " username or password contains characters that cannot be encoded to " + charset display name ( ) ) ; } string credentials string = username + " : " + password ; byte [ ] encoded bytes = base 6 4 get encoder ( ) encode ( credentials string get bytes ( charset ) ) ; return new string ( encoded bytes , charset ) ; }


returns a list of all detected g filesystem filesystem names see { @ link file system factory mgr # get all filesystem names ( ) }

public list < string > get all filesystem names ( ) { return file system factory mgr get instance ( ) get all filesystem names ( ) ; }


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


obtain the active operation count , or { @ link index shard # operations blocked } if all permits are held

int get active operations count ( ) { int available permits = semaphore available permits ( ) ; if ( available permits = = 0 ) { return index shard operations blocked ; / / this occurs when block operations ( ) has acquired all the permits } else { return total permits - available permits ; } }


private s get node internal ( k key , n namespace ) { memory segment key segment = get key segment ( key , namespace ) ; int key len = key segment size ( ) ; return get node ( key segment , 0 , key len ) ; }


increment the initial window size for this stream

void increment initial stream window ( int delta ) ;


com netflix hystrix hystrix command < response entity < void > > add pet ( @ api param ( value = " pet object that needs to be added to the store " , required = true ) @ valid @ request body pet body ) ;


asynchronous version of { @ link query # unique ( ) }

public async operation query unique ( query < ? > query , int flags ) { return enqueue database operation ( operation type query unique , query , flags ) ; }


add static data to this view , exposed in each view " static " attributes are fixed attributes that are specified in the view instance configuration " dynamic " attributes , on the other hand , are values passed in as part of the model must be invoked before any calls to { @ code render }

public void add static attribute ( string name , object value ) { this static attributes put ( name , value ) ; }


begins reading the elements of an array , returning the array ' s size the caller must follow up by calling a read method for each element in the array for example , this reads a byte array : { @ code int array size = read array ( ) ; for ( int i = 0 , i < array size ; i + + ) { read byte ( ) ; } }

public int read array ( ) { check type ( encoded array ) ; type = must read ; return leb 1 2 8 read unsigned leb 1 2 8 ( in ) ; }


public map < string , configuration metadata property > properties ( ) { return repository get repository ( ) get all properties ( ) ; }


register an uniform which might be used by this shader only possible prior to the call to init ( )

public int register ( final string alias , final validator validator , final setter setter ) { if ( locations ! = null ) throw new gdx runtime exception ( " cannot register an uniform after initialization " ) ; final int existing = get uniform i d ( alias ) ; if ( existing > = 0 ) { validators set ( existing , validator ) ; setters set ( existing , setter ) ; return existing ; } uniforms add ( alias ) ; validators add ( validator ) ; setters add ( setter ) ; return uniforms size - 1 ; }


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


, , , , ， ， invoke ( object obj , object args ) ( ) , ( )

public static method get accessible method by name ( final class clazz , final string method name ) { validate not null ( clazz , " clazz can ' t be null " ) ; validate not empty ( method name , " method name can ' t be blank " ) ; for ( class < ? > search type = clazz ; search type ! = object class ; search type = search type get superclass ( ) ) { method [ ] methods = search type get declared methods ( ) ; for ( method method : methods ) { if ( method get name ( ) equals ( method name ) ) { make accessible ( method ) ; return method ; } } } return null ; }


public final string get event name ( ) { return event name ; }


called on the start of each build , giving extensions a chance to intercept the data that is written to the log

public output stream decorate logger ( abstract build build , output stream logger ) throws i o exception , interrupted exception { if ( util is overridden ( console log filter class , get class ( ) , " decorate logger " , run class , output stream class ) ) { / / old client calling newer implementation forward the call return decorate logger ( ( run ) build , logger ) ; } else { / / happens only if the subtype fails to override either decorate logger method throw new abstract method error ( " plugin class ' " + this get class ( ) get name ( ) + " ' does not override " + " either overload of the decorate logger method " ) ; } }


generate t parser java and t lexer java from t g 4 if combined , else just use t java as output regardless of type

public string get recognizer file name ( boolean header ) { st ext s t = get templates ( ) get instance of ( " code file extension " ) ; string recognizer name = gen g get recognizer name ( ) ; return recognizer name + ext s t render ( ) ; }


this test validates the correctness of blacklist logic in case the cluster has no active subclusters

public void test all blacklist subcluster ( ) throws yarn exception { federation router policy local policy = ( federation router policy ) get policy ( ) ; application submission context application submission context = application submission context new instance ( null , null , null , null , null , false , false , 0 , resources none ( ) , null , false , null , null ) ; map < sub cluster id , sub cluster info > active sub clusters = get active subclusters ( ) ; if ( active sub clusters ! = null & & active sub clusters size ( ) > 1 & & ! ( local policy instanceof reject router policy ) ) { list < sub cluster id > blacklist subclusters = new array list < sub cluster id > ( active sub clusters key set ( ) ) ; try { local policy get home subcluster ( application submission context , blacklist subclusters ) ; assert fail ( ) ; } catch ( yarn exception e ) { assert assert true ( e get message ( ) equals ( federation policy utils no active subcluster available ) ) ; } } }


reflects over the generated protobuf class and ensures that no new fields have been added since we wrote this if we didn ' t , newly added fields would not be resolved by { @ link group change util # resolve conflict ( decrypted group , decrypted group change ) }

public void ensure resolve conflict knows about all fields of decrypted group ( ) { int max field found = get max declared field number ( decrypted group class ) ; assert equals ( " group change util # resolve conflict and its tests need updating to account for new fields on " + decrypted group class get name ( ) , 10 , max field found ) ; }


initialize the given property editor registry with the custom editors that have been registered with this bean factory to be called for bean wrappers that will create and populate bean instances , and for simple type converter used for constructor argument and factory method type conversion

protected void register custom editors ( property editor registry registry ) { if ( registry instanceof property editor registry support ) { ( ( property editor registry support ) registry ) use config value editors ( ) ; } if ( ! this property editor registrars is empty ( ) ) { for ( property editor registrar registrar : this property editor registrars ) { try { registrar register custom editors ( registry ) ; } catch ( bean creation exception ex ) { throwable root cause = ex get most specific cause ( ) ; if ( root cause instanceof bean currently in creation exception ) { bean creation exception bce = ( bean creation exception ) root cause ; string bce bean name = bce get bean name ( ) ; if ( bce bean name ! = null & & is currently in creation ( bce bean name ) ) { if ( logger is debug enabled ( ) ) { logger debug ( " property editor registrar [ " + registrar get class ( ) get name ( ) + " ] failed because it tried to obtain currently created bean ' " + ex get bean name ( ) + " ' : " + ex get message ( ) ) ; } on suppressed exception ( ex ) ; continue ; } } throw ex ; } } } if ( ! this custom editors is empty ( ) ) { this custom editors for each ( ( required type , editor class ) - > registry register custom editor ( required type , bean utils instantiate class ( editor class ) ) ) ; } }


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


public outer enum get outer enum ( ) { return outer enum ; }


returns the value of the java system property with the specified { @ code key } , while falling back to { @ code null } if the property access fails

public static string get ( string key ) { return get ( key , null ) ; }


enables integrating hamcrest matchers that match primitive < code > char < code > arguments note that { @ link # arg that } will not work with primitive < code > char < code > matchers due to < code > null pointer exception < code > auto - unboxing caveat < p > see examples in javadoc for { @ link mockito hamcrest } class

public static char char that ( matcher < character > matcher ) { report matcher ( matcher ) ; return 0 ; }


override the http2 authority the channel claims to be connecting to this is not generally safe overriding allows advanced users to re - use a single channel for multiple services , even if those services are hosted on different domain names that assumes the server is virtually hosting multiple domains and is guaranteed to continue doing so it is rare for a service provider to make such a guarantee at this time , there is no security verification of the overridden value , such as making sure the authority matches the server ' s tls certificate

public call options with authority ( @ nullable string authority ) { call options new options = new call options ( this ) ; new options authority = authority ; return new options ; }


< code > optional uint 3 2 line number = 1 ; < code >

private void set line number ( int value ) { bit field 0 | = 0x 0 0 0 0 0 0 0 1 ; line number = value ; }


creates an empty { @ code tree multimap } ordered by the natural ordering of its keys and values

public static < k extends comparable , v extends comparable > tree multimap < k , v > create ( ) { return new tree multimap < > ( ordering natural ( ) , ordering natural ( ) ) ; }


test that the various command lines for formatting the zk directory function correctly

public void test format z k ( ) throws exception { dummy h a service svc = cluster get service ( 1 ) ; / / run without formatting the base dir , / / should barf assert equals ( z k failover controller err code no parent znode , run f c ( svc ) ) ; / / format the base dir , should succeed assert equals ( 0 , run f c ( svc , " - format z k " ) ) ; / / should fail to format if already formatted assert equals ( z k failover controller err code format denied , run f c ( svc , " - format z k " , " - non interactive " ) ) ; / / unless ' - force ' is on assert equals ( 0 , run f c ( svc , " - format z k " , " - force " ) ) ; }


public void metadata ( ) throws exception { assert false ( new nio udt byte rendezvous channel ( ) metadata ( ) has disconnect ( ) ) ; }


returns the index for the given key , or - 1 if key is not in the table

public int get ( int key ) { return find key ( key ) ; }


< code > optional int 3 2 blah = 1 ; < code >

public builder clear blah ( ) { bit field 0 = ( bit field 0 & ~ 0x 0 0 0 0 0 0 0 1 ) ; blah = 0 ; on changed ( ) ; return this ; }


returns whether there was a previous get value [ s ] [ or throw ] that indicated a missing dependency formally , returns true iff at least one of the following occurred : get value [ or throw ] ( k [ , c ] ) returned { @ code null } for some k get values ( ks ) get ( k ) = = { @ code null } for some ks and k such that ks contains ( k ) get values or throw ( ks , c ) get ( k ) get ( ) = = { @ code null } for some ks and k such that ks contains ( k ) if this returns true , the { @ link sky function } must return { @ code null }


print the records of a { @ link k stream } to system out

public static < k , v > printed < k , v > to sys out ( ) { return new printed < > ( system out ) ; }


get file data for child specified by file name

ghidra file data get file data ( string file name , boolean lazy ) throws i o exception { synchronized ( file system ) { if ( lazy | | contains file ( file name ) ) { ghidra file data file data = file data cache get ( file name ) ; if ( file data = = null ) { file data = add file data ( file name ) ; } return file data ; } } return null ; } / / / / todo : examine ! / / private void remove folder x ( string folder name ) { / / folder list remove ( folder name ) ; / / folder data cache remove ( folder name ) ; / / listener domain folder removed ( get domain folder ( ) , folder name ) ; / / } / / / / / / todo : examine ! / / void remove file x ( string file name ) { / / file list remove ( file name ) ; / / ghidra file v 2 data file data = file data cache remove ( file name ) ; / / if ( file data ! = null ) { / / file data dispose ( ) ; / / } / / / / todo : may need to eliminate presence of file i d in callback / / listener domain file removed ( get domain folder ( ) , file name , null / * file i d * / ) ; / / } / / / /


protected string get request url path ( ) { string request url path = this call get method descriptor ( ) get full method name ( ) ; return request url path ; }


private void execute ( dist sum distsum , final map < bellard parameter , bellard sum > sums ) throws exception { final list < computation > computations = new array list < computation > ( ) ; int i = 0 ; for ( bellard parameter p : bellard parameter values ( ) ) for ( summation s : sums get ( p ) ) if ( s get value ( ) = = null ) computations add ( distsum new computation ( i + + , p to string ( ) , s ) ) ; if ( computations is empty ( ) ) util out println ( " no computation " ) ; else { timer tick ( " execute " + computations size ( ) + " computation ( s ) " ) ; util execute ( distsum get parameters ( ) n threads , computations ) ; timer tick ( " done " ) ; } }


specifies the time attribute on which rows are ordered for streaming tables , reference a rowtime or proctime time attribute here to specify the time mode for batch tables , refer to a timestamp or long attribute

public over window partitioned ordered order by ( string order by ) { return this order by ( expression parser parse expression ( order by ) ) ; }


gets the { @ link standard socket options # so rcvbuf } option


begin creating a { @ link web test client } by providing an already initialized { @ link mock mvc } instance to use as the server

static web test client builder bind to ( mock mvc mock mvc ) { client http connector connector = new mock mvc http connector ( mock mvc ) ; return web test client bind to server ( connector ) ; }


build a new { @ link alias action } to remove an index

public static alias actions remove index ( ) { return new alias actions ( alias actions type remove index ) ; }


public test group parameters oper resp spec ( consumer < response spec builder > resp spec customizer ) { resp spec customizer accept ( resp spec ) ; return this ; }


resume the container from pause state the default implementation ignores this event specific implementations can override this behavior

public void resume container ( container container ) { log warn ( " { } doesn ' t support resume " , container get container id ( ) ) ; throw new unsupported operation exception ( ) ; }


remove the lease for the specified holder and src

synchronized void remove lease ( string holder , i node file src ) { lease lease = get lease ( holder ) ; if ( lease ! = null ) { remove lease ( lease , src get id ( ) ) ; } else { log warn ( " removing non - existent lease ! holder = { } src = { } " , holder , src get full path name ( ) ) ; } }


return a hex string form of an object ' s identity hash code

public static string get identity hex string ( object obj ) { return integer to hex string ( system identity hash code ( obj ) ) ; }


constructs a new builder of a name resolution result

public static builder new builder ( ) { return new builder ( ) ; }


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


visit the main class of the current module

public void visit main class ( final string main class ) { if ( mv ! = null ) { mv visit main class ( main class ) ; } }


tests a valid dependency where the dependency doesn ' t " know " about the expected environment ' s group , but implicitly supports it because that environment is a default

public void valid constraints unknown environment to dependency ( ) throws exception { new environment group maker ( " buildenv / foo " ) set environments ( " a " , " b " , " c " ) set defaults ( " a " , " b " ) make ( ) ; scratch file ( " hello / build " , get dependency rule ( ) , get depending rule ( constrained to ( " / / buildenv / foo : b " ) ) ) ; assert that ( get configured target ( " / / hello : main " ) ) is not null ( ) ; assert no events ( ) ; }


method : only for ' ' match pattern , return true of false

public static boolean is match pattern ( final string string , final string pattern string ) { boolean result = false ; if ( string ! = null & & pattern string ! = null ) { if ( pattern string index of ( metch pattern ) > = 0 ) { string match pattern = constant symbol xor + pattern string replace all ( metch pattern regex , metch pattern replacement ) + constant symbol dollar ; result = is match regex ( string , match pattern ) ; } else { if ( string equals ( pattern string ) ) { result = true ; } } } return result ; }


convert { @ link row type } to { @ link csv schema }

public static csv schema convert ( row type row type ) { builder builder = new csv schema builder ( ) ; list < row type row field > fields = row type get fields ( ) ; for ( int i = 0 ; i < row type get field count ( ) ; i + + ) { string field name = fields get ( i ) get name ( ) ; logical type field type = fields get ( i ) get type ( ) ; builder add column ( new column ( i , field name , convert type ( field name , field type ) ) ) ; } return builder build ( ) ; }


creates a new listenable future - style stub that supports unary calls on the service

public static metrics service future stub new future stub ( io grpc channel channel ) { io grpc stub abstract stub stub factory < metrics service future stub > factory = new io grpc stub abstract stub stub factory < metrics service future stub > ( ) { @ java lang override public metrics service future stub new stub ( io grpc channel channel , io grpc call options call options ) { return new metrics service future stub ( channel , call options ) ; } } ; return metrics service future stub new stub ( factory , channel ) ; }


returns { @ code true } if the content of both { @ link char sequence } ' s are equals this only supports 8 - bit ascii

public static boolean content equals ( char sequence a , char sequence b ) { if ( a = = null | | b = = null ) { return a = = b ; } if ( a instanceof ascii string ) { return ( ( ascii string ) a ) content equals ( b ) ; } if ( b instanceof ascii string ) { return ( ( ascii string ) b ) content equals ( a ) ; } if ( a length ( ) ! = b length ( ) ) { return false ; } for ( int i = 0 ; i < a length ( ) ; + + i ) { if ( a char at ( i ) ! = b char at ( i ) ) { return false ; } } return true ; }


returns the string value for the given key if the key does not exist it will return the given default value

public string get ( string key , string default value ) { add to defaults ( key , default value ) ; string value = get ( key ) ; if ( value = = null ) { return default value ; } else { return value ; } }


returns the { @ linkplain # is registry suffix ( ) registry suffix } portion of the domain name , or { @ code null } if no registry suffix is present

public internet domain name registry suffix ( ) { return has registry suffix ( ) ? ancestor ( registry suffix index ) : null ; }


public machine node [ ] get random machines ( int expected , random random ) ;


specifies whether this project may be disabled by the user

default boolean supports make disabled ( ) { return false ; }


returns type variable named { @ code name } without bounds

public static type variable name get ( string name ) { return type variable name of ( name , collections empty list ( ) ) ; }


whether the return value represents an asynchronous , future - like type with success and error callbacks if this method returns { @ code true } , then { @ link # to listenable future } is invoked next if it returns { @ code false } , then { @ link # handle return value } is called note : this method will only be invoked after { @ link # supports return type ( org springframework core method parameter ) } is called and it returns { @ code true }

boolean is async return value ( object return value , method parameter return type ) ;


latesttop page where total number of items less than the max page size

public void test latest partial page ( ) throws i o exception { history page filter < model object > history page filter = new page ( 5 , null , null ) ; list < model object > runs = new runs ( 1 , 2 ) ; list < queue item > queue items = new queue items ( 3 , 4 ) ; history page filter add ( runs , queue items ) ; assert assert false ( history page filter has up page ) ; assert assert false ( history page filter has down page ) ; assert assert equals ( 2 , history page filter queue items size ( ) ) ; assert assert equals ( 2 , history page filter runs size ( ) ) ; assert assert equals ( 4 , history page filter queue items get ( 0 ) get entry id ( ) ) ; assert assert equals ( 4 , history page filter newest on page ) ; assert assert equals ( 3 , history page filter queue items get ( 1 ) get entry id ( ) ) ; assert assert equals ( history page entry get entry id ( 2 ) , history page filter runs get ( 0 ) get entry id ( ) ) ; assert assert equals ( history page entry get entry id ( 1 ) , history page filter runs get ( 1 ) get entry id ( ) ) ; assert assert equals ( history page entry get entry id ( 1 ) , history page filter oldest on page ) ; }


converts the provided 32 - bit integer to a 32 - bit float value and writes it to { @ code buffer }

private static void write pcm 3 2 bit float ( int pcm 3 2 bit int , byte buffer buffer ) { float pcm 3 2 bit float = ( float ) ( pcm 32 bit int to pcm 32 bit float factor * pcm 3 2 bit int ) ; int float bits = float float to int bits ( pcm 3 2 bit float ) ; if ( float bits = = float nan as int ) { float bits = float float to int bits ( ( float ) 0 0 ) ; } buffer put int ( float bits ) ; }


creates a new async stub that supports all call types for the service

public static simple service stub new stub ( io grpc channel channel ) { io grpc stub abstract stub stub factory < simple service stub > factory = new io grpc stub abstract stub stub factory < simple service stub > ( ) { @ java lang override public simple service stub new stub ( io grpc channel channel , io grpc call options call options ) { return new simple service stub ( channel , call options ) ; } } ; return simple service stub new stub ( factory , channel ) ; }


get the appropriate cursor for the action and mouse position within the node

cursor get cursor ( int action , int relative mouse pos ) { cursor c = null ; if ( ( action & dn d constants action link ) = = dn d constants action link ) { return super get drop ok cursor ( action ) ; } if ( ( action & dn d constants action move ) = = dn d constants action move ) { c = drag source default move drop ; if ( relative mouse pos ! = 0 ) { c = get move cursor ( ) ; } } else { c = drag source default copy drop ; if ( relative mouse pos ! = 0 ) { c = get copy cursor ( ) ; } } return c ; }


return whether data was updated if this method returns false , there ' s nothing to roll back the default implementation always returns true this can be overridden in subclasses

public boolean was data updated ( ) { return true ; }


test multiple sniffing rounds by mocking the { @ link scheduler } as well as the { @ link nodes sniffer } simulates the ordinary behaviour of { @ link sniffer } when sniffing on failure is not enabled the { @ link counting nodes sniffer } doesn ' t make any network connection but may throw exception or return no nodes , which makes it possible to verify that errors are properly handled and don ' t affect subsequent runs and their scheduling the { @ link scheduler } implementation submits rather than scheduling tasks , meaning that it doesn ' t respect the requested sniff delays while allowing to assert that the requested delays for each requested run and the following one are the expected values

public void test ordinary sniff rounds ( ) throws exception { final long sniff interval = random long between ( 1 , long max value ) ; long sniff after failure delay = random long between ( 1 , long max value ) ; rest client rest client = mock ( rest client class ) ; counting nodes sniffer nodes sniffer = new counting nodes sniffer ( ) ; final int iters = random int between ( 30 , 100 ) ; final set < future < ? > > futures = new copy on write array set < > ( ) ; final count down latch completion latch = new count down latch ( 1 ) ; final atomic integer runs = new atomic integer ( iters ) ; final executor service executor = executors new single thread executor ( ) ; final atomic reference < future < ? > > last future = new atomic reference < > ( ) ; final atomic reference < sniffer task > last task = new atomic reference < > ( ) ; scheduler scheduler = new scheduler ( ) { @ override public future < ? > schedule ( sniffer task task , long delay millis ) { assert equals ( sniff interval , task next task delay ) ; int number of runs = runs get and decrement ( ) ; if ( number of runs = = iters ) { / / the first call is to schedule the first sniff round from the sniffer constructor , with delay o assert equals ( 0l , delay millis ) ; assert equals ( sniff interval , task next task delay ) ; } else { / / all of the subsequent times " schedule " is called with delay set to the configured sniff interval assert equals ( sniff interval , delay millis ) ; assert equals ( sniff interval , task next task delay ) ; if ( number of runs = = 0 ) { completion latch count down ( ) ; return null ; } } / / we submit rather than scheduling to make the test quick and not depend on time future < ? > future = executor submit ( task ) ; futures add ( future ) ; if ( number of runs = = 1 ) { last future set ( future ) ; last task set ( task ) ; } return future ; } @ override public void shutdown ( ) { / / the executor is closed externally , shutdown is tested separately } } ; try { new sniffer ( rest client , nodes sniffer , scheduler , sniff interval , sniff after failure delay ) ; assert true ( " timeout waiting for sniffing rounds to be completed " , completion latch await ( 1000 , time unit milliseconds ) ) ; assert equals ( iters , futures size ( ) ) ; / / the last future is the only one that may not be completed yet , as the count down happens / / while scheduling the next round which is still part of the execution of the runnable itself assert true ( last task get ( ) has started ( ) ) ; last future get ( ) get ( ) ; for ( future < ? > future : futures ) { assert true ( future is done ( ) ) ; future get ( ) ; } } finally { executor shutdown ( ) ; assert true ( executor await termination ( 1000 , time unit milliseconds ) ) ; } int total runs = nodes sniffer runs get ( ) ; assert equals ( iters , total runs ) ; int set nodes runs = total runs - nodes sniffer failures get ( ) - nodes sniffer empty list get ( ) ; verify ( rest client , times ( set nodes runs ) ) set nodes ( any collection of ( node class ) ) ; verify no more interactions ( rest client ) ; }