post pet { pet id } : updates a pet in the store with form data

completable future < response entity < void > > update pet with form ( @ api param ( value = " id of pet that needs to be updated " , required = true ) @ path variable ( " pet id " ) long pet id , @ api param ( value = " updated name of the pet " ) @ request param ( value = " name " , required = false ) string name , @ api param ( value = " updated status of the pet " ) @ request param ( value = " status " , required = false ) string status ) ;


scans a string literal delimited by ' quot ' on entry : ' pos ' is 1 + the index of the first delimiter on exit : ' pos ' is 1 + the index of the last delimiter

private void string literal ( char quot , boolean is raw ) { int literal start pos = is raw ? pos - 2 : pos - 1 ; int content start pos = pos ; / / don ' t even attempt to parse triple - quotes here if ( skip triple quote ( quot ) ) { pos - = 2 ; escaped string literal ( quot , is raw ) ; return ; } / / first quick optimistic scan for a simple non - escaped string while ( pos < buffer length ) { char c = buffer [ pos + + ] ; switch ( c ) { case ' \ n ' : error ( " unclosed string literal " , literal start pos ) ; set token ( token kind string , literal start pos , pos ) ; set value ( buffer slice ( content start pos , pos - 1 ) ) ; return ; case ' \ \ ' : if ( is raw ) { if ( peek ( 0 ) = = ' \ r ' & & peek ( 1 ) = = ' \ n ' ) { / / there was a crlf after the newline no shortcut possible , since it needs to be / / transformed into a single lf pos = content start pos ; escaped string literal ( quot , true ) ; return ; } else { pos + + ; break ; } } / / oops , hit an escape , need to start over & build a new string buffer pos = content start pos ; escaped string literal ( quot , false ) ; return ; case ' \ ' ' : case ' " ' : if ( c = = quot ) { / / close - quote , all done set token ( token kind string , literal start pos , pos ) ; set value ( buffer slice ( content start pos , pos - 1 ) ) ; return ; } break ; default : / / fall out } } / / if the current position is beyond the end of the file , need to move it backwards / / possible if the file ends with ` r " \ ` ( unclosed raw string literal with a backslash ) if ( pos > buffer length ) { pos = buffer length ; } error ( " unclosed string literal " , literal start pos ) ; set token ( token kind string , literal start pos , pos ) ; set value ( buffer slice ( content start pos , pos ) ) ; }


returns whether this is a single - byte codepoint ( i e , ascii ) with the form ' 0xxxxxxx '

private static boolean is one byte ( byte b ) { return b > = 0 ; }


returns the { @ link selection manager } in use by this g table < code > null < code > is returned if the user has installed their own { @ link list selection model }

public selection manager get selection manager ( ) { return selection manager ; }


opens the specified file in append mode , first closing the current file if needed

public void open ( string path ) throws i o exception { try { close ( ) ; file = new file ( path ) ; stream = new counting output stream ( new file output stream ( file , true ) ) ; writer = new output stream writer ( stream , utf 8 ) ; } catch ( i o exception e ) { close ( ) ; throw e ; } }


finds the first executable called { @ code exe } in the search path if { @ code exe } is not a basename , it will always return null this should be equivalent to running which ( 1 )

public static path which ( list < path > search path , string exe ) { path fragment fragment = path fragment create ( exe ) ; if ( fragment segment count ( ) ! = 1 | | fragment is absolute ( ) ) { return null ; } for ( path p : search path ) { path ch = p get child ( exe ) ; try { if ( ch exists ( ) & & ch is executable ( ) ) { return ch ; } } catch ( i o exception e ) { / / like which ( 1 ) , we ignore any io exception ( disk on fire , permission denied etc ) } } return null ; }


creates a trigger that continuously fires based on the given interval

public static < w extends window > continuous processing time trigger < w > of ( time interval ) { return new continuous processing time trigger < > ( interval to milliseconds ( ) ) ; }


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


checks if array consisting of first header size bytes of image header bytes starts with png signature more information on png can be found there : < a href = " http : en wikipedia orgwiki portable network graphics " > http : en wikipedia orgwiki portable network graphics

private static boolean is png header ( final byte [ ] image header bytes , final int header size ) { return header size > = png header length & & image format checker utils starts with pattern ( image header bytes , png header ) ; }


applies { @ link # line graph } colors to the given renderer

public static void apply ( line and shape renderer renderer ) { int n = 0 ; for ( color c : line graph ) renderer set series paint ( n + + , c ) ; }


start the reader thread , wait for latch if necessary

public void start ( ) { log info ( " starting stress submission " ) ; this r thread start ( ) ; }


gets the terminal state future which is completed once the payload has reached a terminal state

completable future < ? > get terminal state future ( ) ;


public final byte [ ] get byte array ( ) { return this byte array ; }


gets the number of bytes currently occupied in this hash table

public long get occupancy ( ) { return num all memory segments * segment size - free memory segments size ( ) * segment size ; }


by default , a consumer will be built from properties derived from builder defaults , as well as " auto offset reset " - > " earliest " any properties set here will override the consumer config for example : only consume spans since you connected by setting the below { @ code map < string , string > overrides = new linked hash map < > ( ) ; overrides put ( consumer config auto offset reset config , " latest " ) ; builder overrides ( overrides ) ; }

public final builder overrides ( map < string , ? > overrides ) { if ( overrides = = null ) throw new null pointer exception ( " overrides = = null " ) ; properties put all ( overrides ) ; return this ; }


refresh the properties holder for the given bundle filename the holder can be { @ code null } if not cached before , or a timed - out cache entry ( potentially getting re - validated against the current last - modified timestamp )

protected properties holder refresh properties ( string filename , @ nullable properties holder prop holder ) { long refresh timestamp = ( get cache millis ( ) < 0 ? - 1 : system current time millis ( ) ) ; resource resource = this resource loader get resource ( filename + properties suffix ) ; if ( ! resource exists ( ) ) { resource = this resource loader get resource ( filename + xml suffix ) ; } if ( resource exists ( ) ) { long file timestamp = - 1 ; if ( get cache millis ( ) > = 0 ) { / / last - modified timestamp of file will just be read if caching with timeout try { file timestamp = resource last modified ( ) ; if ( prop holder ! = null & & prop holder get file timestamp ( ) = = file timestamp ) { if ( logger is debug enabled ( ) ) { logger debug ( " re - caching properties for filename [ " + filename + " ] - file hasn ' t been modified " ) ; } prop holder set refresh timestamp ( refresh timestamp ) ; return prop holder ; } } catch ( i o exception ex ) { / / probably a class path resource : cache it forever if ( logger is debug enabled ( ) ) { logger debug ( resource + " could not be resolved in the file system - assuming that it hasn ' t changed " , ex ) ; } file timestamp = - 1 ; } } try { properties props = load properties ( resource , filename ) ; prop holder = new properties holder ( props , file timestamp ) ; } catch ( i o exception ex ) { if ( logger is warn enabled ( ) ) { logger warn ( " could not parse properties file [ " + resource get filename ( ) + " ] " , ex ) ; } / / empty holder representing " not valid " prop holder = new properties holder ( ) ; } } else { / / resource does not exist if ( logger is debug enabled ( ) ) { logger debug ( " no properties file found for [ " + filename + " ] - neither plain properties nor xml " ) ; } / / empty holder representing " not found " prop holder = new properties holder ( ) ; } prop holder set refresh timestamp ( refresh timestamp ) ; this cached properties put ( filename , prop holder ) ; return prop holder ; }


get the first element from the queue without removing it

public t peek ( ) { lock lock ( ) ; try { return queue peek ( ) ; } finally { lock unlock ( ) ; } }


returns an immutable snapshot of the statistics on the { @ code y } values alone

public stats y stats ( ) { return y stats snapshot ( ) ; }


see { @ link media session compat callback # on set rating ( rating compat ) }

void on set rating ( player player , rating compat rating ) ;


gets the association response determines the mode first if mode is set to associate , will set the response then builds the response parameters next and returns

public map < string , string > get association response ( final http servlet request request ) { val parameters = new parameter list ( request get parameter map ( ) ) ; val mode = parameters has parameter ( open id protocol constants openid mode ) ? parameters get parameter value ( open id protocol constants openid mode ) : null ; val response = function utils do if ( string utils equals ( mode , open id protocol constants associate ) , ( ) - > this server manager association response ( parameters ) , ( ) - > null ) get ( ) ; val response params = new hash map < string , string > ( ) ; if ( response ! = null ) { response params put all ( response get parameter map ( ) ) ; } return response params ; }


creates a builder for new server - side { @ link ssl context }

public static ssl context builder for server ( private key key , x 5 0 9 certificate key cert chain ) { return new ssl context builder ( true ) key manager ( key , key cert chain ) ; }


return the time unit for the delay and period values

public time unit get time unit ( ) { return this time unit ; }


retrieve all candidate methods for the given class , considering the { @ link root bean definition # is non public access allowed ( ) } flag called as the starting point for factory method determination

private method [ ] get candidate methods ( class < ? > factory class , root bean definition mbd ) { if ( system get security manager ( ) ! = null ) { return access controller do privileged ( ( privileged action < method [ ] > ) ( ) - > ( mbd is non public access allowed ( ) ? reflection utils get all declared methods ( factory class ) : factory class get methods ( ) ) ) ; } else { return ( mbd is non public access allowed ( ) ? reflection utils get all declared methods ( factory class ) : factory class get methods ( ) ) ; } }


creates the builder for a { @ link streaming file sink } with bulk - encoding format

public static < in > streaming file sink default bulk format builder < in > for bulk format ( final path base path , final bulk writer factory < in > writer factory ) { return new streaming file sink default bulk format builder < > ( base path , writer factory , new date time bucket assigner < > ( ) ) ; }


protected string get filesystem conf key ( ) { return get conf key ( string format ( fsname option , get scheme ( ) ) ) ; }


repositions this stream to the position at the time the < code > mark < code > method was last called on this input stream this method simply performs < code > in reset ( ) < code > stream marks are intended to be used in situations where you need to read ahead a little to see what ' s in the stream often this is most easily done by invoking some general parser if the stream is of the type handled by the parse , it just chugs along happily if the stream is not of that type , the parser should toss an exception when it fails if this happens within readlimit bytes , it allows the outer code to reset the stream and try another parser @ exception i o exception if the stream has not been marked or if the mark has been invalidated

public synchronized void reset ( ) throws i o exception { in reset ( ) ; }


overridden to reliably pass a { @ link current tenant identifier resolver } to the session factory

public void set current tenant identifier resolver ( current tenant identifier resolver current tenant identifier resolver ) { get properties ( ) put ( available settings multi tenant identifier resolver , current tenant identifier resolver ) ; super set current tenant identifier resolver ( current tenant identifier resolver ) ; }


check file creation on a mount point if it is fault tolerant , it should be able to write everything if it is not fault tolerant , it should fail to write some of the files

private void check files fault tolerant ( path mount point , destination order order , file system router 0 fs , file system router 1 fs , file system ns 0 fs , boolean fault tolerant ) throws exception { / / get one of the existing sub directories final file status [ ] dirs 0 = list status ( router 1 fs , mount point ) ; final path dir 0 = path get path without scheme and authority ( dirs 0 [ 0 ] get path ( ) ) ; log info ( " create files in { } " , dir 0 ) ; final list < callable < boolean > > tasks = new array list < > ( ) ; for ( int i = 0 ; i < num files ; i + + ) { final string new file = string format ( " % s / file - % 0 3d txt " , dir 0 , i ) ; file system fs = get random router file system ( ) ; tasks add ( get file create task ( fs , new file , ns 0 fs ) ) ; } task results results = collect results ( " create file " + dir 0 , tasks ) ; log info ( " check files results for { } : { } " , dir 0 , results ) ; if ( fault tolerant ) { assert equals ( " not enough success in " + mount point , num files , results get success ( ) ) ; assert equals ( " nothing should fail in " + mount point , 0 , results get failure ( ) ) ; } else { assert equals ( " nothing should succeed in " + mount point , 0 , results get success ( ) ) ; assert equals ( " everything should fail in " + mount point , num files , results get failure ( ) ) ; } log info ( " check files listing for { } " , dir 0 ) ; tasks add ( get list fail task ( router 0 fs , dir 0 ) ) ; tasks add ( get list success task ( router 1 fs , dir 0 , results get success ( ) ) ) ; assert equals ( 2 , collect results ( " list " + dir 0 , tasks ) get success ( ) ) ; tasks add ( get content summary fail task ( router 0 fs , dir 0 ) ) ; tasks add ( get content summary success task ( router 1 fs , dir 0 , results get success ( ) ) ) ; results = collect results ( " content summary " + dir 0 , tasks ) ; assert equals ( 2 , results get success ( ) ) ; }


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

public void set action ( @ nullable string action ) { this action = ( action ! = null ? action : " " ) ; }


， ， copy from commons lang 3 5 string utils , : 1 ， 2 3 preserve all tokens

public static list < string > split ( @ nullable final string str , final char separator char , int expect parts ) { if ( str = = null ) { return null ; } final int len = str length ( ) ; if ( len = = 0 ) { return list util empty list ( ) ; } final list < string > list = new array list < string > ( expect parts ) ; int i = 0 ; int start = 0 ; boolean match = false ; while ( i < len ) { if ( str char at ( i ) = = separator char ) { if ( match ) { list add ( str substring ( start , i ) ) ; match = false ; } start = + + i ; continue ; } match = true ; i + + ; } if ( match ) { list add ( str substring ( start , i ) ) ; } return list ; }


sets the cue text note that { @ code text } may be decorated with styling spans

public builder set text ( char sequence text ) { this text = text ; return this ; }


indicates to the cache replication monitor that there have been cache manager changes that require a rescan

public void set needs rescan ( ) { preconditions check argument ( lock is held by current thread ( ) , " must hold the crm lock when setting the needs rescan bit " ) ; if ( cur scan count > = 0 ) { / / if there is a scan in progress , we need to wait for the scan after / / that needed scan count = cur scan count + 1 ; } else { / / if there is no scan in progress , we need to wait for the next scan needed scan count = completed scan count + 1 ; } }


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


configure whether to use named parameter expansion defaults to { @ code true }

builder named parameters ( boolean enabled ) ;


retrieves and removes the first element ( w r t the order ) of this set , or returns { @ code null } if this set is empty


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

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


retrieve the errors instance that this tag is currently bound to intended for cooperating nesting tags

public final errors get errors ( ) { return this errors ; }


the interpretedcompiled version of the ` value ` string < code > optional aapt pb item compiled item = 6 ; < code >

public com android aapt resources item get compiled item ( ) { return instance get compiled item ( ) ; }


merges the type at the given index in the given abstract type array with the given type returns { @ literal true } if the type array has been modified by this operation

private static boolean merge ( final symbol table symbol table , final int source type , final int [ ] dst types , final int dst index ) { int dst type = dst types [ dst index ] ; if ( dst type = = source type ) { / / if the types are equal , merge ( source type , dst type ) = dst type , so there is no change return false ; } int src type = source type ; if ( ( source type & ~ dim mask ) = = null ) { if ( dst type = = null ) { return false ; } src type = null ; } if ( dst type = = 0 ) { / / if dst types [ dst index ] has never been assigned , merge ( src type , dst type ) = src type dst types [ dst index ] = src type ; return true ; } int merged type ; if ( ( dst type & dim mask ) ! = 0 | | ( dst type & kind mask ) = = reference kind ) { / / if dst type is a reference type of any array dimension if ( src type = = null ) { / / if src type is the null type , merge ( src type , dst type ) = dst type , so there is no change return false ; } else if ( ( src type & ( dim mask | kind mask ) ) = = ( dst type & ( dim mask | kind mask ) ) ) { / / if src type has the same array dimension and the same kind as dst type if ( ( dst type & kind mask ) = = reference kind ) { / / if src type and dst type are reference types with the same array dimension , / / merge ( src type , dst type ) = dim ( src type ) | common super class of src type and dst type merged type = ( src type & dim mask ) | reference kind | symbol table add merged type ( src type & value mask , dst type & value mask ) ; } else { / / if src type and dst type are array types of equal dimension but different element types , / / merge ( src type , dst type ) = dim ( src type ) - 1 | java / lang / object int merged dim = element of + ( src type & dim mask ) ; merged type = merged dim | reference kind | symbol table add type ( " java / lang / object " ) ; } } else if ( ( src type & dim mask ) ! = 0 | | ( src type & kind mask ) = = reference kind ) { / / if src type is any other reference or array type , / / merge ( src type , dst type ) = min ( src ddim , dst dim ) | java / lang / object / / where src dim is the array dimension of src type , minus 1 if src type is an array type / / with a non reference element type ( and similarly for dst dim ) int src dim = src type & dim mask ; if ( src dim ! = 0 & & ( src type & kind mask ) ! = reference kind ) { src dim = element of + src dim ; } int dst dim = dst type & dim mask ; if ( dst dim ! = 0 & & ( dst type & kind mask ) ! = reference kind ) { dst dim = element of + dst dim ; } merged type = math min ( src dim , dst dim ) | reference kind | symbol table add type ( " java / lang / object " ) ; } else { / / if src type is any other type , merge ( src type , dst type ) = top merged type = top ; } } else if ( dst type = = null ) { / / if dst type is the null type , merge ( src type , dst type ) = src type , or top if src type is not a / / an array type or a reference type merged type = ( src type & dim mask ) ! = 0 | | ( src type & kind mask ) = = reference kind ? src type : top ; } else { / / if dst type is any other type , merge ( src type , dst type ) = top whatever src type merged type = top ; } if ( merged type ! = dst type ) { dst types [ dst index ] = merged type ; return true ; } return false ; } / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / / frame output methods , to generate stack map frame attributes / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


discovery snapshot handler it is up to log processor to decide which snapshot operate should be loaded and saved by itself

public list < snapshot operation > load snapshot operate ( ) { return collections empty list ( ) ; }


builds the aspect definition the builder object is reusable afterwards

public aspect definition build ( ) { required providers required providers = this required providers build ( ) ; if ( apply to generating rules & & ! required providers accepts any ( ) ) { throw new illegal state exception ( " an aspect cannot simultaneously have required providers " + " and apply to generating rules " ) ; } return new aspect definition ( aspect class , advertised providers build ( ) , required providers , required aspect providers build ( ) , immutable map copy of ( attributes ) , immutable set copy of ( required toolchains ) , use toolchain transition , propagate along attributes = = null ? null : immutable set copy of ( propagate along attributes ) , configuration fragment policy build ( ) , apply to files , apply to generating rules ) ; }


sets the action execution mode for the give action ( identified by its id )

public void set action mode ( string action id , action execution mode action mode ) { objects require non null ( action id , " action id cannot be null " ) ; action modes put ( action id , action mode ) ; }


specify the order value for this handler adapter bean the default value is { @ code ordered lowest precedence } , meaning non - ordered

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


get an adaptor for root that indicates how to walk antlr trees override to change the adapter from the default of { @ link tree layout adaptor }

public tree for tree layout < tree > get tree layout adaptor ( tree root ) { return new tree layout adaptor ( root ) ; }


gets the url of the help file this help will shown next to the text area of the description , and is ideal of describing what the allowed syntax is by default , we look for colocated help - syntax html

public string get help url ( ) { return get descriptor ( ) get help file ( " syntax " ) ; }


extract a substring from the given string , using start index and length of the extracted substring

static string substring ( string s , int start , int length ) { if ( ! has length ( s ) ) { return s ; } if ( start < 0 ) { start = 0 ; } if ( start + 1 > s length ( ) | | length < 0 ) { return " " ; } return ( start + length > s length ( ) ) ? s substring ( start ) : s substring ( start , start + length ) ; }


calculates the drift offset when members are in the given set of slots for the specified pattern

public vec 3 calculate drift offset ( vec 3 center of mass , seq < slot assignment > slot assignments , formation pattern pattern ) { / / clear the center of mass center of mass x = center of mass y = 0 ; float center of mass orientation = 0 ; / / make sure temp location is instantiated if ( temp location = = null ) temp location = new vec 3 ( ) ; / / go through each assignment and add its contribution to the center float number of assignments = slot assignments size ; for ( int i = 0 ; i < number of assignments ; i + + ) { pattern calculate slot location ( temp location , slot assignments get ( i ) slot number ) ; center of mass add ( temp location ) ; center of mass orientation + = temp location z ; } / / divide through to get the drift offset center of mass scl ( 1f / number of assignments ) ; center of mass orientation / = number of assignments ; center of mass z = center of mass orientation ; return center of mass ; }


close all running tools ; called from the close ( ) method in tool manager impl which is called from the project ' s close ( )

void close ( ) { for ( plugin tool tool : running tools ) { try { tool exit ( ) ; } finally { tool manager tool removed ( this , tool ) ; } } running tools clear ( ) ; }


return the current web application context

public final web application context get web application context ( ) { return this web application context ; }


whether the expression is a column name range expression , e g with columns ( a ~ b )

private boolean is name range call ( unresolved call expression expression ) { return expression get function definition ( ) = = range to & & expression get children ( ) get ( 0 ) instanceof unresolved reference expression & & expression get children ( ) get ( 1 ) instanceof unresolved reference expression ; }


given an offset , populate vbytes with the associated set of deserialized value bytes should only be called during a spill

private void get v bytes for offset ( int kvoff , in mem val bytes vbytes ) { / / get the keystart for the next serialized value to be the end / / of this value if this is the last value in the buffer , use bufend final int vallen = kvmeta get ( kvoff + vallen ) ; assert vallen > = 0 ; vbytes reset ( kvbuffer , kvmeta get ( kvoff + valstart ) , vallen ) ; }


convert the given request object to serialized form , possibly using a { @ link org springframework messaging converter message converter } , wrap it as a message with the given headers , apply the given post processor and send the resulting { @ link message } to the specified destination , receive the reply and convert its body of the given target class

< t > t convert send and receive ( string destination name , object request , map < string , object > headers , class < t > target class , message post processor request post processor ) throws messaging exception ;


public closeable image decode ( encoded image encoded image , int length , quality info quality info , image decode options options ) { rect region to decode = compute region to decode ( encoded image , options ) ; closeable reference < bitmap > decoded bitmap reference = m platform decoder decode j p e g from encoded image with color space ( encoded image , options bitmap config , region to decode , length , options color space ) ; try { maybe apply transformation ( options bitmap transformation , decoded bitmap reference ) ; return new closeable static bitmap ( decoded bitmap reference , immutable quality info full quality , encoded image get rotation angle ( ) , encoded image get exif orientation ( ) ) ; } finally { closeable reference close safely ( decoded bitmap reference ) ; } }


change panel state to the given state with

public void set panel state ( panel state state ) { / / abort any running animation , to allow state change if ( m drag helper get view drag state ( ) = = view drag helper state settling ) { log d ( tag , " view is settling aborting animation " ) ; m drag helper abort ( ) ; } if ( state = = null | | state = = panel state dragging ) { throw new illegal argument exception ( " panel state cannot be null or dragging " ) ; } if ( ! is enabled ( ) | | ( ! m first layout & & m slideable view = = null ) | | state = = m slide state | | m slide state = = panel state dragging ) return ; if ( m first layout ) { set panel state internal ( state ) ; } else { if ( m slide state = = panel state hidden ) { m slideable view set visibility ( view visible ) ; request layout ( ) ; } switch ( state ) { case anchored : smooth slide to ( m anchor point , 0 ) ; break ; case collapsed : smooth slide to ( 0 , 0 ) ; break ; case expanded : smooth slide to ( 1 0f , 0 ) ; break ; case hidden : int new top = compute panel top position ( 0 0f ) + ( m is sliding up ? + m panel height : - m panel height ) ; smooth slide to ( compute slide offset ( new top ) , 0 ) ; break ; } } }


test that trailing whitespace is ignored http : code google compgoogle - gsonissuesdetail ? id = 302

public void test trailing whitespace ( ) throws exception { list < integer > integers = gson from json ( " [ 1 , 2 , 3 ] \ n \ n " , new type token < list < integer > > ( ) { } get type ( ) ) ; assert equals ( arrays as list ( 1 , 2 , 3 ) , integers ) ; }


flips { @ link # data } and { @ link # supplemental data } in preparation for being queued to a decoder

public final void flip ( ) { if ( data ! = null ) { data flip ( ) ; } if ( supplemental data ! = null ) { supplemental data flip ( ) ; } }


writes the { @ link table } to a { @ link table sink } that was registered under the specified path , and then execute the insert operation see the documentation of { @ link table environment # use database ( string ) } or { @ link table environment # use catalog ( string ) } for the rules on the path resolution a batch { @ link table } can only be written to a { @ code org apache flink table sinks batch table sink } , a streaming { @ link table } requires a { @ code org apache flink table sinks append stream table sink } , a { @ code org apache flink table sinks retract stream table sink } , or an { @ code org apache flink table sinks upsert stream table sink } example : { @ code table table = table env from query ( " select from my table " ) ; table result table result = table execute insert ( " my sink " , true ) ; table result }

table result execute insert ( string table path , boolean overwrite ) ;


get the final result to be returned by default this method returns the last process result

default r finish ( @ nullable r result ) { return result ; }


public statistic type enum get type ( ) { return type ; }


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

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


returns the peer extracted from a completed handshake

public tsi peer extract peer ( ) throws general security exception { preconditions check state ( ! is in progress ( ) , " handshake is not complete " ) ; list < tsi peer property < ? > > peer properties = new array list < > ( ) ; peer properties add ( new tsi peer string property ( tsi service account peer property , handshaker get result ( ) get peer identity ( ) get service account ( ) ) ) ; return new tsi peer ( peer properties ) ; }


public boolean branch fits ( target insn insn ) { return true ; }


sets the message that will appear in the lower part of the graph

public void set status message ( string message ) { view set status message ( message ) ; }


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


expose underlying { @ link channel u d t } for debugging and monitoring

public static channel u d t channel u d t ( final channel channel ) { / / bytes if ( channel instanceof nio udt byte acceptor channel ) { return ( ( nio udt byte acceptor channel ) channel ) java channel ( ) ; } if ( channel instanceof nio udt byte rendezvous channel ) { return ( ( nio udt byte rendezvous channel ) channel ) java channel ( ) ; } if ( channel instanceof nio udt byte connector channel ) { return ( ( nio udt byte connector channel ) channel ) java channel ( ) ; } / / message if ( channel instanceof nio udt message acceptor channel ) { return ( ( nio udt message acceptor channel ) channel ) java channel ( ) ; } if ( channel instanceof nio udt message rendezvous channel ) { return ( ( nio udt message rendezvous channel ) channel ) java channel ( ) ; } if ( channel instanceof nio udt message connector channel ) { return ( ( nio udt message connector channel ) channel ) java channel ( ) ; } return null ; }


to count token numbers from start offset to end offset

private int get token count ( int start offset , int end offset , s q l heuristic scanner scanner , int token ) { int token count = 0 ; while ( start offset < end offset ) { int next token = scanner next token ( start offset , end offset ) ; int position = scanner get position ( ) ; if ( next token ! = s q l indent symbols token e o f & & scanner is same token ( next token , token ) ) { token count + + ; } start offset = position ; } return token count ; }


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

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


sets the rewind increment in milliseconds

public session callback builder set rewind increment ms ( int rewind ms ) { this rewind ms = rewind ms ; return this ; }


exposed for elastic search http bulk indexer

public static char sequence json escape ( char sequence v ) { int length = v length ( ) ; if ( length = = 0 ) return v ; int after replacement = 0 ; string builder builder = null ; for ( int i = 0 ; i < length ; i + + ) { char c = v char at ( i ) ; string replacement ; if ( c < 0x 8 0 ) { replacement = replacement chars [ c ] ; if ( replacement = = null ) continue ; } else if ( c = = ' \ u 2 0 2 8 ' ) { replacement = u2028 ; } else if ( c = = ' \ u 2 0 2 9 ' ) { replacement = u2029 ; } else { continue ; } if ( after replacement < i ) { / / write characters between the last replacement and now if ( builder = = null ) builder = new string builder ( length ) ; builder append ( v , after replacement , i ) ; } if ( builder = = null ) builder = new string builder ( length ) ; builder append ( replacement ) ; after replacement = i + 1 ; } if ( builder = = null ) return v ; / / then we didn ' t escape anything if ( after replacement < length ) { builder append ( v , after replacement , length ) ; } return builder ; }


add listener for specific type of message by its id don ' t forget to call { @ link # remove listener ( ui message callback ) } or { @ link # remove listeners ( int ) }

public void add listener ( int id , @ non null final ui message callback listener ) { synchronized ( m listeners specific ) { list < ui message callback > id listeners = m listeners specific get ( id ) ; if ( id listeners = = null ) { id listeners = new array list < > ( ) ; m listeners specific put ( id , id listeners ) ; } if ( ! id listeners contains ( listener ) ) { id listeners add ( listener ) ; } } }


checks whether the line pointed to by a pair of indexes : { @ code from } ( inclusive ) and { @ code to } ( exclusive ) is blank a line is considered blank if it only consists of space characters ( ' ' )

private static boolean is blank ( bytes reference bytes ref , int from , int to ) { for ( int i = from ; i < to ; + + i ) { if ( bytes ref get ( i ) ! = ( ( byte ) ' ' ) ) { return false ; } } return true ; }


returns map from { @ link index } to index metadata generation

public map < index , long > get index generations ( ) { return index generations ; }


initiate a graceful failover by talking to the target node ' s zkfc this sends an rpc to the zkfc , which coordinates the failover

protected int graceful failover through z k f cs ( h a service target to node ) throws i o exception { int timeout = failover controller get rpc timeout to new active ( get conf ( ) ) ; z k f c protocol proxy = to node get z k f c proxy ( get conf ( ) , timeout ) ; try { proxy graceful failover ( ) ; out println ( " failover to " + to node + " successful " ) ; } catch ( service failed exception sfe ) { err out println ( " failover failed : " + sfe get localized message ( ) ) ; return - 1 ; } return 0 ; }


clears cache for the specified hystrix command

protected void flush cache ( ) { if ( cache remove invocation context ! = null ) { hystrix request cache manager get instance ( ) clear cache ( cache remove invocation context ) ; } }


get the average degree , the average number of in - plus out - edges per vertex a result of { @ code float na n } is returned for an empty graph for which both the number of edges and number of vertices is zero

public double get average degree ( ) { return vertex count = = 0 ? double na n : get number of edges ( ) / ( double ) vertex count ; }


computes the quantile value of the given dataset

public double compute ( long dataset ) { return compute in place ( longs to doubles ( dataset ) ) ; }


public void test arguments ( ) throws i o exception { string [ ] args = new string [ ] { " - input " , " a " , " - whitelist " , " b " , " - blacklist " , " c " , " - fs " , " hdfs : / / c : 8020 " , " - target " , " d " , " - initial replication " , " 100 " , " - acceptable replication " , " 120 " , " - final replication " , " 140 " , " - timeout " , " 10 " } ; framework uploader uploader = new framework uploader ( ) ; boolean success = uploader parse arguments ( args ) ; assert assert true ( " expected to print help " , success ) ; assert assert equals ( " input mismatch " , " a " , uploader input ) ; assert assert equals ( " whitelist mismatch " , " b " , uploader whitelist ) ; assert assert equals ( " blacklist mismatch " , " c " , uploader blacklist ) ; assert assert equals ( " target mismatch " , " hdfs : / / c : 8020 / d " , uploader target ) ; assert assert equals ( " initial replication mismatch " , 100 , uploader initial replication ) ; assert assert equals ( " acceptable replication mismatch " , 120 , uploader acceptable replication ) ; assert assert equals ( " final replication mismatch " , 140 , uploader final replication ) ; assert assert equals ( " timeout mismatch " , 10 , uploader timeout ) ; }


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


set the runfiles support for executable targets

public rule configured target builder set runfiles support ( runfiles support runfiles support , artifact executable ) { this runfiles support = runfiles support ; this executable = executable ; return this ; }


private static string generate test file ( string output file , int length ) throws i o exception , no such algorithm exception { path output file path = new path ( output file ) ; final file system file system = output file path get file system ( ) ; try ( final f s data output stream fs data output stream = file system create ( output file path , file system write mode overwrite ) ) { return write random content ( fs data output stream , length ) ; } }


seeks for recurring element in a parsed document which are likely candidates for being data records

static public string [ ] detect record element ( tree reader parser ) { if ( logger is trace enabled ( ) ) { logger trace ( " detect record element ( input stream ) " ) ; } list < record element candidate > candidates = new array list < record element candidate > ( ) ; try { while ( parser has next ( ) ) { token event type = parser next ( ) ; if ( event type = = token start entity ) { record element candidate candidate = detect record element ( parser , new string [ ] { parser get field name ( ) } ) ; if ( candidate ! = null ) { candidates add ( candidate ) ; } } } } catch ( tree reader exception e ) { / / silent e print stack trace ( ) ; } if ( candidates size ( ) > 0 ) { sort record element candidates ( candidates ) ; return candidates get ( 0 ) path ; } logger info ( " no candidate elements were found in data - at least 6 similar elements are required " ) ; return null ; }


resolves a name to a global , predeclared , or universal binding

scope resolve ( string name ) throws undefined ;


creates a new instance of immutable { @ link domain name mapping } attempts to add new mappings to the result object will cause { @ link unsupported operation exception } to be thrown

public domain name mapping < v > build ( ) { return new immutable domain name mapping < v > ( default value , map ) ; }


verify that we correctly clean up even when a purging trigger has purged window state

private void test state and timer cleanup at event time g c with purging trigger ( final time domain adaptor time adaptor ) throws exception { window assigner < integer , time window > mock assigner = mock time window assigner ( ) ; time adaptor set is event time ( mock assigner ) ; trigger < integer , time window > mock trigger = mock trigger ( ) ; internal window function < iterable < integer > , void , integer , time window > mock window function = mock window function ( ) ; keyed one input stream operator test harness < integer , integer , void > test harness = create window operator ( mock assigner , mock trigger , 20l , mock window function ) ; test harness open ( ) ; when ( mock assigner assign windows ( any int ( ) , any long ( ) , any assigner context ( ) ) ) then return ( arrays as list ( new time window ( 0 , 20 ) ) ) ; assert equals ( 0 , test harness get output ( ) size ( ) ) ; assert equals ( 0 , test harness num keyed state entries ( ) ) ; do answer ( new answer < trigger result > ( ) { @ override public trigger result answer ( invocation on mock invocation ) throws exception { trigger trigger context context = ( trigger trigger context ) invocation get arguments ( ) [ 3 ] ; / / very far in the future so our watermark does not trigger it time adaptor register timer ( context , 1000l ) ; context get partitioned state ( value state descriptor ) update ( " hello " ) ; return trigger result purge ; } } ) when ( mock trigger ) on element ( matchers < integer > any object ( ) , any long ( ) , any time window ( ) , any trigger context ( ) ) ; do answer ( new answer < object > ( ) { @ override public object answer ( invocation on mock invocation ) throws exception { trigger trigger context context = ( trigger trigger context ) invocation get arguments ( ) [ 1 ] ; time adaptor delete timer ( context , 1000l ) ; context get partitioned state ( value state descriptor ) clear ( ) ; return null ; } } ) when ( mock trigger ) clear ( any time window ( ) , any trigger context ( ) ) ; test harness process element ( new stream record < > ( 0 , 0l ) ) ; / / clear is only called at cleanup time / gc time verify ( mock trigger , never ( ) ) clear ( any time window ( ) , any trigger context ( ) ) ; assert equals ( 1 , test harness num keyed state entries ( ) ) ; / / just the trigger state remains assert equals ( 2 , time adaptor num timers ( test harness ) ) ; / / window timers / gc timers assert equals ( 0 , time adaptor num timers other domain ( test harness ) ) ; time adaptor advance time ( test harness , 19 + 20 ) ; / / 19 is max time of the window verify ( mock trigger , times ( 1 ) ) clear ( any time window ( ) , any trigger context ( ) ) ; assert equals ( 0 , test harness num keyed state entries ( ) ) ; / / window contents plus trigger state assert equals ( 0 , time adaptor num timers ( test harness ) ) ; / / window timers / gc timers assert equals ( 0 , time adaptor num timers other domain ( test harness ) ) ; }


creates a mockito mock object it returns a generic typed { @ link resource } to prevent unchecked warnings

public static < t > resource < t > mock resource ( ) { return mock ( resource class ) ; }


returns the name of the custom permission to keep

public set < string > get retain permissions ( ) { return retain permissions ; }


returns the number of bytes currently being used to store the values in this cache this may be greater than the max size if a background deletion is pending

public synchronized long size ( ) { return size ; }


creates a new { @ code set multimap } that uses the provided map and factory it can generate a multimap based on arbitrary { @ link map } and { @ link set } classes the { @ code factory } - generated and { @ code map } classes determine the multimap iteration order they also specify the behavior of the { @ code equals } , { @ code hash code } , and { @ code to string } methods for the multimap and its returned views however , the multimap ' s { @ code get } method returns instances of a different class than { @ code factory get ( ) } does the multimap is serializable if { @ code map } , { @ code factory } , the sets generated by { @ code factory } , and the multimap contents are all serializable the multimap is not threadsafe when any concurrent operations update the multimap , even if { @ code map } and the instances generated by { @ code factory } are concurrent read operations will work correctly to allow concurrent update operations , wrap the multimap with a call to { @ link # synchronized set multimap } call this method only when the simpler methods { @ link hash multimap # create ( ) } , { @ link linked hash multimap # create ( ) } , { @ link tree multimap # create ( ) } , and { @ link tree multimap # create ( comparator , comparator ) } won ' t suffice note : the multimap assumes complete ownership over of { @ code map } and the sets returned by { @ code factory } those objects should not be manually updated and they should not use soft , weak , or phantom references

public static < k , v > set multimap < k , v > new set multimap ( map < k , collection < v > > map , final supplier < ? extends set < v > > factory ) { return new custom set multimap < > ( map , factory ) ; }


apply { @ link bean post processor bean post processors } to the given existing bean instance , invoking their { @ code post process after initialization } methods the returned bean instance may be a wrapper around the original

object apply bean post processors after initialization ( object existing bean , string bean name ) throws beans exception ;


save snapshot diff list for an i node directory with snapshot

private static < n extends i node , a extends i node attributes , d extends abstract i node diff < n , a , d > > void save i node diffs ( final abstract i node diff list < n , a , d > diffs , final data output out , reference map reference map ) throws i o exception { / / record the diffs in reversed order , so that we can find the correct / / reference for i nodes in the created list when loading the f s image if ( diffs = = null ) { out write int ( - 1 ) ; / / no diffs } else { final diff list < d > list = diffs as list ( ) ; final int size = list size ( ) ; out write int ( size ) ; for ( int i = size - 1 ; i > = 0 ; i - - ) { list get ( i ) write ( out , reference map ) ; } } }


returns any additional jvm command - line options that this plugin adds only applies to plugins whose < code > type < code > is " bootstrap "

public string get java opts ( ) { return java opts ; }


constructs the { @ link resolved addresses }

public resolved addresses build ( ) { return new resolved addresses ( addresses , attributes , load balancing policy config ) ; }


return whether the plugin is in the given category

public boolean is in category ( string parent category ) { return parent category equals ( category ) ; }


public swift native file system store get store ( ) { return store ; }


get the root path from the specified { @ link url connection u rl }

protected string get root path ( url url ) { string root path = url get parameter ( config root path param name , build root path ( url ) ) ; root path = normalize ( root path ) ; int root path length = root path length ( ) ; if ( root path length > 1 & & root path ends with ( path separator ) ) { root path = root path substring ( 0 , root path length - 1 ) ; } return root path ; }


sets frame rate in frames per second equivalent to < code > set delay ( 1 0 0 0fps ) < code >

public void set frame rate ( float fps ) { if ( fps ! = 0f ) { delay = math round ( 1 0 0f / fps ) ; } }


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 void set max length ( float length ) { jni set max length ( addr , length ) ; }


gets a dummy rule context object by creating a dummy target

private rule context get rule context ( string kind , string additional lines ) throws exception { configured target target = scratch configured target ( " java / foo " , " target " , immutable list < string > builder ( ) add ( kind + " ( name = ' target ' , " ) add ( additional lines ) add ( " ) " ) build ( ) to array ( new string [ 0 ] ) ) ; return get rule context for action testing ( target ) ; }


get a local file under a directory named by dirs prop with the given path if dirs prop contains multiple directories , then one is chosen based on path ' s hash code if the selected directory does not exist , an attempt is made to create it

public path get local path ( string dirs prop , string path ) throws i o exception { string [ ] dirs = get trimmed strings ( dirs prop ) ; int hash code = path hash code ( ) ; file system fs = file system get local ( this ) ; for ( int i = 0 ; i < dirs length ; i + + ) { / / try each local dir int index = ( hash code + i & integer max value ) % dirs length ; path file = new path ( dirs [ index ] , path ) ; path dir = file get parent ( ) ; if ( fs mkdirs ( dir ) | | fs exists ( dir ) ) { return file ; } } log warn ( " could not make " + path + " in local directories from " + dirs prop ) ; for ( int i = 0 ; i < dirs length ; i + + ) { int index = ( hash code + i & integer max value ) % dirs length ; log warn ( dirs prop + " [ " + index + " ] = " + dirs [ index ] ) ; } throw new i o exception ( " no valid local directories in property : " + dirs prop ) ; }


append a leaf which contains one or more keys and update tree leaf is inserted as the new right sibling of this leaf

var key node append leaf ( var key record node leaf ) throws i o exception { / / create new leaf and link leaf buffer put int ( prev leaf id offset , buffer get id ( ) ) ; int right leaf buf id = buffer get int ( next leaf id offset ) ; leaf buffer put int ( next leaf id offset , right leaf buf id ) ; / / adjust this node int new buf id = leaf buffer get id ( ) ; buffer put int ( next leaf id offset , new buf id ) ; / / adjust old right node if present if ( right leaf buf id > = 0 ) { var key node right leaf = node mgr get var key node ( right leaf buf id ) ; right leaf buffer put int ( prev leaf id offset , new buf id ) ; } if ( parent ! = null ) { / / ask parent to insert new node and return root - leaf parent is unknown return parent insert ( leaf ) ; } / / new parent node becomes root return new var key interior node ( node mgr , get key field ( 0 ) , buffer get id ( ) , leaf get key field ( 0 ) , new buf id ) ; }


this covers a bug where if a listener was installed that would stop the manager if any service fails and something failed during startup before service start was called on all the services , then await stopped would deadlock due to an illegal state exception that was thrown when trying to stop the timer ( ! )

public void test fail start stop others ( ) throws timeout exception { service a = new fail start service ( ) ; service b = new no op service ( ) ; final service manager manager = new service manager ( as list ( a , b ) ) ; manager add listener ( new listener ( ) { @ override public void failure ( service service ) { manager stop async ( ) ; } } , direct executor ( ) ) ; manager start async ( ) ; manager await stopped ( 10 , time unit milliseconds ) ; }


public string get entity id ( ) { return entity id ; }


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


return whether input matches regex of date which pattern is " yyyy - mm - dd "

public static boolean is date ( final char sequence input ) { return is match ( regex constants regex date , input ) ; }


private void create logout propagation end state ( final flow flow ) { create end state ( flow , cas webflow constants state id propagate logout requests , " cas propagate logout view " ) ; }


public string get property class ( ) { return property class ; }


public void update by xml ( final input stream source ) throws i o exception , servlet exception { check permission ( configure ) ; node result = ( node ) jenkins xstream2 from x m l ( source ) ; jenkins get ( ) get nodes object ( ) replace node ( this get node ( ) , result ) ; }


returns an array of all names of attributes managed by this attribute manager

public string [ ] get attribute names ( ) { string [ ] names = new string [ 0 ] ; names = defined attributes key set ( ) to array ( names ) ; return names ; }


ensures that we ' re currently on the start of an object , or that the next token is a start of an object

public static void verify object ( x content parser parser ) throws i o exception , elasticsearch parse exception { if ( parser current token ( ) = = x content parser token start object ) { return ; } x content parser token token = parser next token ( ) ; if ( token ! = x content parser token start object ) { throw new elasticsearch parse exception ( " expected an object , but found token [ { } ] " , parser current token ( ) ) ; } }


prefetch all directories and symlinks within the package rooted at " path " enter at most " max dirs " total directories specializations for high - latency remote filesystems may wish to implement this in order to warm the filesystem ' s internal caches

protected void prefetch package async ( path path , int max dirs ) { }


whether the input image is resized to make subsequent decodings faster

boolean can resize ( encoded image encoded image , @ nullable rotation options rotation options , @ nullable resize options resize options ) ;


public void deregister request ( ) { phaser arrive and deregister ( ) ; }


return the configured handlers , or possibly { @ code null } if not initialized yet via { @ link # after properties set ( ) }

public list < handler method return value handler > get return value handlers ( ) { return ( this return value handlers ! = null ? this return value handlers get handlers ( ) : null ) ; }


private collection < map < string , object > > get active sso sessions ( final sso session report options option ) { val date format = new i s o standard date format ( ) ; return get non expired ticket granting tickets ( ) stream ( ) map ( ticket granting ticket class : : cast ) filter ( tgt - > ! ( option = = sso session report options direct & & tgt get proxied by ( ) ! = null ) ) map ( tgt - > { val authentication = tgt get authentication ( ) ; val principal = authentication get principal ( ) ; val sso = new hash map < string , object > ( sso session attribute keys values ( ) length ) ; sso put ( sso session attribute keys authenticated principal get attribute key ( ) , principal get id ( ) ) ; sso put ( sso session attribute keys authentication date get attribute key ( ) , authentication get authentication date ( ) ) ; sso put ( sso session attribute keys authentication date formatted get attribute key ( ) , date format format ( date time utils date of ( authentication get authentication date ( ) ) ) ) ; sso put ( sso session attribute keys number of uses get attribute key ( ) , tgt get count of uses ( ) ) ; sso put ( sso session attribute keys ticket granting ticket get attribute key ( ) , tgt get id ( ) ) ; sso put ( sso session attribute keys principal attributes get attribute key ( ) , principal get attributes ( ) ) ; sso put ( sso session attribute keys authentication attributes get attribute key ( ) , authentication get attributes ( ) ) ; if ( option ! = sso session report options direct ) { if ( tgt get proxied by ( ) ! = null ) { sso put ( sso session attribute keys is proxied get attribute key ( ) , boolean true ) ; sso put ( sso session attribute keys proxied by get attribute key ( ) , tgt get proxied by ( ) get id ( ) ) ; } else { sso put ( sso session attribute keys is proxied get attribute key ( ) , boolean false ) ; } } sso put ( sso session attribute keys authenticated services get attribute key ( ) , tgt get services ( ) ) ; return sso ; } ) collect ( collectors to list ( ) ) ; }


confirm that remove all ( ) returns a list implementing random access

public void test remove all random access ( ) { multimap < string , integer > multimap = create ( ) ; multimap put ( " foo " , 1 ) ; multimap put ( " foo " , 3 ) ; assert true ( multimap remove all ( " foo " ) instanceof random access ) ; assert true ( multimap remove all ( " bar " ) instanceof random access ) ; }


the assignment should improve the overall balance of the partition assignments to consumers

private void assign partition ( topic partition partition , tree set < string > sorted current subscriptions , map < string , list < topic partition > > current assignment , map < string , list < topic partition > > consumer 2 all potential partitions , map < topic partition , string > current partition consumer ) { for ( string consumer : sorted current subscriptions ) { if ( consumer 2 all potential partitions get ( consumer ) contains ( partition ) ) { sorted current subscriptions remove ( consumer ) ; current assignment get ( consumer ) add ( partition ) ; current partition consumer put ( partition , consumer ) ; sorted current subscriptions add ( consumer ) ; break ; } } }


gets the string representation of the agent log

public string get log ( ) throws i o exception { return util load file ( get log file ( ) ) ; }


returns { @ code x } , rounded to a { @ code double } with the specified rounding mode if { @ code x } is precisely representable as a { @ code double } , its { @ code double } value will be returned ; otherwise , the rounding will choose between the two nearest representable values with { @ code mode } for the case of { @ link rounding mode # half even } , this implementation uses the ieee 754 default rounding mode : if the two nearest representable values are equally near , the one with the least significant bit zero is chosen ( in such cases , both of the nearest representable values are even integers ; this method returns the one that is a multiple of a greater power of two )

public static double round to double ( long x , rounding mode mode ) { / / logic adapted from to double rounder double round arbitrarily = ( double ) x ; long round arbitrarily as long = ( long ) round arbitrarily ; int cmp x to round arbitrarily ; if ( round arbitrarily as long = = long max value ) { / * * for most values , the conversion from round arbitrarily to round arbitrarily as long is * lossless in that case we can compare x to round arbitrarily using longs compare ( x , * round arbitrarily as long ) the exception is for values where the conversion to double rounds * up to give round arbitrarily equal to 2 ^ 63 , so the conversion back to long overflows and * round arbitrarily as long is long max value ( this is the only way this condition can occur as * otherwise the conversion back to long pads with zero bits ) in this case we know that * round arbitrarily > x ( this is important when x = = long max value = = * round arbitrarily as long ) * / cmp x to round arbitrarily = - 1 ; } else { cmp x to round arbitrarily = longs compare ( x , round arbitrarily as long ) ; } switch ( mode ) { case unnecessary : check rounding unnecessary ( cmp x to round arbitrarily = = 0 ) ; return round arbitrarily ; case floor : return ( cmp x to round arbitrarily > = 0 ) ? round arbitrarily : double utils next down ( round arbitrarily ) ; case ceiling : return ( cmp x to round arbitrarily < = 0 ) ? round arbitrarily : math next up ( round arbitrarily ) ; case down : if ( x > = 0 ) { return ( cmp x to round arbitrarily > = 0 ) ? round arbitrarily : double utils next down ( round arbitrarily ) ; } else { return ( cmp x to round arbitrarily < = 0 ) ? round arbitrarily : math next up ( round arbitrarily ) ; } case up : if ( x > = 0 ) { return ( cmp x to round arbitrarily < = 0 ) ? round arbitrarily : math next up ( round arbitrarily ) ; } else { return ( cmp x to round arbitrarily > = 0 ) ? round arbitrarily : double utils next down ( round arbitrarily ) ; } case half down : case half up : case half even : { long round floor ; double round floor as double ; long round ceiling ; double round ceiling as double ; if ( cmp x to round arbitrarily > = 0 ) { round floor as double = round arbitrarily ; round floor = round arbitrarily as long ; round ceiling as double = math next up ( round arbitrarily ) ; round ceiling = ( long ) math ceil ( round ceiling as double ) ; } else { round ceiling as double = round arbitrarily ; round ceiling = round arbitrarily as long ; round floor as double = double utils next down ( round arbitrarily ) ; round floor = ( long ) math floor ( round floor as double ) ; } long delta to floor = x - round floor ; long delta to ceiling = round ceiling - x ; if ( round ceiling = = long max value ) { / / correct for long max value as discussed above : round ceiling as double must be 2 ^ 63 , but / / round ceiling is 2 ^ 63 - 1 delta to ceiling + + ; } int diff = longs compare ( delta to floor , delta to ceiling ) ; if ( diff < 0 ) { / / closer to floor return round floor as double ; } else if ( diff > 0 ) { / / closer to ceiling return round ceiling as double ; } / / halfway between the representable values ; do the half - whatever logic switch ( mode ) { case half even : return ( ( double utils get significand ( round floor as double ) & 1l ) = = 0 ) ? round floor as double : round ceiling as double ; case half down : return ( x > = 0 ) ? round floor as double : round ceiling as double ; case half up : return ( x > = 0 ) ? round ceiling as double : round floor as double ; default : throw new assertion error ( " impossible " ) ; } } } throw new assertion error ( " impossible " ) ; }


parses { @ link annotation } using a strict parser

public static annotation from x content ( x content parser parser , void context ) { return strict parser apply ( parser , context ) build ( ) ; }


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


required : the port on which the proxy should listen for incoming connections < code > istio networking v 1alpha 3 port port = 1 ; < code >

public com alibaba nacos istio model port or builder get port or builder ( ) { return get port ( ) ; }


find the fields constant that matches field id , throwing an exception if it is not found

public static fields find by thrift id or throw ( int field id ) { fields fields = find by thrift id ( field id ) ; if ( fields = = null ) throw new illegal argument exception ( " field " + field id + " doesn ' t exist ! " ) ; return fields ; }


re - initialize the { @ link reservation system }

void reinitialize ( configuration conf , r m context rm context ) throws yarn exception ;


method called when the drag operation exits the drop target without dropping

public void drag canceled ( drag source drop event event ) { plugin set tool button transferable ( null ) ; reset button after drag ( this ) ; / / unusual code alert ! / / when dragging , we do not get mouse released ( ) events , which we use to launch tools / / in this case , the drag was cancelled ; if we are over ourselves , then simulate / / the java - eaten mouse released ( ) call container parent = get parent ( ) ; if ( parent = = null ) { return ; } point point = event get location ( ) ; if ( point = = null ) { return ; } swing utilities convert point from screen ( point , parent ) ; component component under mouse = swing utilities get deepest component at ( parent , point x , point y ) ; if ( component under mouse = = this ) { handle mouse released ( ) ; } }


private void submit plan ( final string plan file , final string plan data , boolean skip date check ) throws i o exception { preconditions check not null ( plan data ) ; node plan plan = node plan parse json ( plan data ) ; string data node address = plan get node name ( ) + " : " + plan get port ( ) ; preconditions check not null ( data node address ) ; client datanode protocol data node = get data node proxy ( data node address ) ; string plan hash = digest utils sha 1 hex ( plan data ) ; try { data node submit disk balancer plan ( plan hash , disk balancer c l i plan version , plan file , plan data , skip date check ) ; } catch ( disk balancer exception ex ) { log error ( " submitting plan on { } failed result : { } , message : { } " , plan get node name ( ) , ex get result ( ) to string ( ) , ex get message ( ) ) ; throw ex ; } }


returns the version of content type note this is the version of the structurestorage for the content type , not the users version of their data

public int get content type version ( ) { throw new unsupported operation exception ( " get content type version is not applicable to versioned item " ) ; }


model tests for additional properties any type

public void test additional properties any type ( ) { / / todo : test additional properties any type }


start a keep - alive thread that will continue to renew the lease until it is freed or the process dies

public void run ( ) { log debug ( " starting lease keep - alive thread " ) ; access condition access condition = access condition generate empty condition ( ) ; access condition set lease i d ( lease i d ) ; while ( ! lease freed ) { try { thread sleep ( lease renewal period ) ; } catch ( interrupted exception e ) { log debug ( " keep - alive thread for lease " + lease i d + " interrupted " ) ; / / restore the interrupted status thread current thread ( ) interrupt ( ) ; } try { if ( ! lease freed ) { blob wrapper get blob ( ) renew lease ( access condition ) ; / / it ' ll be very rare to renew the lease ( most will be short ) / / so log that we did it , to help with system debugging log info ( " renewed lease " + lease i d + " on " + get cloud blob ( ) get uri ( ) ) ; } } catch ( storage exception e ) { if ( ! lease freed ) { / / free the lease so we don ' t leave this thread running forever lease freed = true ; / / normally leases should be freed and there should be no / / exceptions , so log a warning log warn ( " attempt to renew lease " + lease i d + " on " + get cloud blob ( ) get uri ( ) + " failed , but lease not yet freed reason : " + e get message ( ) ) ; } } } }


returns the path fragment that is either absolute or relative to the execution root that can be used to execute the given tool

public string get tool path string or null ( tool tool ) { path fragment tool path fragment = get tool path fragment or null ( tool ) ; return tool path fragment = = null ? null : tool path fragment get path string ( ) ; }


public static < t > t invoke method by name ( final object obj , final string method name , final object [ ] args ) { method method = get accessible method by name ( obj get class ( ) , method name ) ; if ( method = = null ) { throw new illegal argument exception ( " could not find method [ " + method name + " ] on class [ " + obj get class ( ) + ' ] ' ) ; } return invoke method ( obj , method , args ) ; }


used for handling output of callable statements

public string get jdbc type name ( ) { return jdbc type name ; }


public void select unhealthy instances clusters ( ) throws exception { string service name = random domain name ( ) ; naming register instance ( service name , " 1 1 1 1 " , test port , " c 1 " ) ; naming register instance ( service name , " 1 1 1 2 " , test port , " c 2 " ) ; time unit seconds sleep ( 8 ) ; list < instance > instances = naming select instances ( service name , arrays as list ( " c 1 " , " c 2 " ) , false ) ; time unit seconds sleep ( 2 ) ; assert assert equals ( 0 , instances size ( ) ) ; list < instance > instances get = naming get all instances ( service name ) ; assert assert true ( verify instance list ( instances , instances get ) ) ; }


return the bytes of aes decryption for hex string

public static byte [ ] decrypt hex string a e s ( final string data , final byte [ ] key , final string transformation , final byte [ ] iv ) { return decrypt a e s ( utils bridge hex string 2 bytes ( data ) , key , transformation , iv ) ; }


public void write ( byte [ ] bytes ) { write ( bytes , 0 , bytes length ) ; }


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


public string get prop 1 ( ) { return prop 1 ; }


extract the method name out of a fully qualified method name may return { @ code null } if the input is malformed , but you cannot rely on it for the validity of the input

public static string extract bare method name ( string full method name ) { int index = check not null ( full method name , " full method name " ) last index of ( ' / ' ) ; if ( index = = - 1 ) { return null ; } return full method name substring ( index + 1 ) ; }


by default , we sleep for 2 5 0ms between polls you may override this method in order to change how it sleeps

protected long sleep for ( ) { return 250 ; }


returns an { @ link optional } containing the first element in this fluent iterable if the iterable is empty , { @ code optional absent ( ) } is returned < b > { @ code stream } equivalent : < b > if the goal is to obtain any element , { @ link stream # find any } ; if it must specifically be the first element , { @ code stream # find first }

public final optional < e > first ( ) { iterator < e > iterator = get delegate ( ) iterator ( ) ; return iterator has next ( ) ? optional of ( iterator next ( ) ) : optional < e > absent ( ) ; }


set the position of the vertical and horizontal scroll bars

public void set scroll bar positions ( boolean bottom , boolean right ) { h scroll on bottom = bottom ; v scroll on right = right ; }


get the canonical uri of the filesystem , which is what is used to identify the tokens

public uri get canonical uri ( ) { return canonical uri ; }


check if this cached observable is connected to its source

/ * public * / boolean is connected ( ) { return once get ( ) ; }


write successfully to the directory with full rw access , fail to write or delete data elsewhere

public void test restricted write subdir ( ) throws throwable { describe ( " attempt writing to paths where a role only has " + " write access to a subdir of the bucket " ) ; path restricted dir = method path ( ) ; path child = new path ( restricted dir , " child " ) ; / / the full fs s 3 a file system fs = get file system ( ) ; fs delete ( restricted dir , true ) ; configuration conf = create assumed role config ( ) ; bind role policy statements ( conf , statement s3guard client , statement all bucket read access , statement allow sse kms rw , new statement ( effects allow ) add actions ( s3 all operations ) add resources ( directory ( restricted dir ) ) ) ; role f s = ( s 3 a file system ) restricted dir get file system ( conf ) ; role f s get file status ( root ) ; role f s mkdirs ( restricted dir ) ; assert is directory ( restricted dir ) ; / / you can create an adjacent child touch ( role f s , child ) ; assert is file ( child ) ; / / child delete rights contract test utils assert deleted ( role f s , child , true ) ; / / parent delete rights contract test utils assert deleted ( role f s , restricted dir , true ) ; / / delete will try to create an empty parent directory marker , and may fail role f s delete ( restricted dir , false ) ; / / this sibling path has the same prefix as restricted dir , but is / / adjacent this verifies that a restricted dir * pattern isn ' t matching / / siblings , so granting broader rights path sibling = new path ( restricted dir to uri ( ) + " sibling " ) ; touch ( fs , sibling ) ; assert touch forbidden ( role f s , sibling ) ; assert delete forbidden ( role f s , sibling ) ; }


alternative to { @ link # set allowed origins } that supports origins declared via wildcard patterns in contrast to { @ link # set allowed origins allowed origins } which does support the special value { @ code " " } , this property allows more flexible patterns , e g { @ code " https : domain 1 com " } furthermore it always sets the { @ code access - control - allow - origin } response header to the matched origin and never to { @ code " " } , nor to any other pattern , and therefore can be used in combination with { @ link # set allow credentials } set to { @ code true } by default this is not set

public cors configuration set allowed origin patterns ( @ nullable list < string > allowed origin patterns ) { if ( allowed origin patterns = = null ) { this allowed origin patterns = null ; } else { this allowed origin patterns = new array list < > ( allowed origin patterns size ( ) ) ; for ( string pattern value : allowed origin patterns ) { add allowed origin pattern ( pattern value ) ; } } return this ; }


returns { @ code true } if the { @ link file region } has a open file - descriptor

public boolean is open ( ) { return file ! = null ; }


private s s l engine result handshake wrap ( boolean do write ) throws i o exception { log trace ( " s s l handshake handshake wrap { } " , channel id ) ; if ( net write buffer has remaining ( ) ) throw new illegal state exception ( " handshake wrap called with net write buffer not empty " ) ; / / this should never be called with a network buffer that contains data / / so we can clear it here net write buffer clear ( ) ; s s l engine result result = ssl engine wrap ( byte utils empty buf , net write buffer ) ; / / prepare the results to be written net write buffer flip ( ) ; handshake status = result get handshake status ( ) ; if ( result get status ( ) = = s s l engine result status ok & & result get handshake status ( ) = = handshake status need task ) { handshake status = run delegated tasks ( ) ; } if ( do write ) flush ( net write buffer ) ; return result ; }


test running an analysis worker from an analysis task thread with events used by analysis at various priority levels

public void test disable resume analysis task worker invocation ( ) throws exception { env show tool ( ) ; load program ( " notepad empty " ) ; auto analysis manager mgr = auto analysis manager get analysis manager ( program ) ; schedule ( mgr , new set test property command ( " p 0 " , 500 ) , 0 ) ; schedule ( mgr , new set test property command ( " p 1 " , 500 ) , 10 ) ; worker background test cmd cmd = new worker background test cmd ( true ) ; schedule ( mgr , cmd , 0 ) ; cmd wait until finished ( ) ; if ( cmd error ! = null ) { fail with exception ( " unexpected exception " , cmd error ) ; } verify program state then undo ( true ) ; }


build a grok pattern that will match all of the sample messages in their entirety

public string create grok pattern from examples ( string seed pattern name , map < string , string > seed mapping , string seed field name ) { overall grok pattern builder set length ( 0 ) ; grok pattern candidate seed candidate = new precalculated mapping grok pattern candidate ( seed pattern name , seed mapping , seed field name , grok pattern definitions ) ; process candidate and split ( seed candidate , true , sample messages , false , 0 , false , 0 ) ; return overall grok pattern builder to string ( ) replace ( " \ t " , " \ \ t " ) replace ( " \ n " , " \ \ n " ) ; }


test for an invalid hash code method , i e , one that returns different value for objects that are equal according to the equals method

public void test invalid hash code ( ) { object a = new invalid hash code object ( 1 , 2 ) ; object b = new invalid hash code object ( 1 , 2 ) ; equals tester add equality group ( a , b ) ; try { equals tester test equals ( ) ; } catch ( assertion failed error e ) { assert error message ( e , " the object # hash code ( " + a hash code ( ) + " ) of " + a + " [ group 1 , item 1 ] must be equal to the object # hash code ( " + b hash code ( ) + " ) of " + b ) ; return ; } fail ( " should get invalid hash code error " ) ; }


set the capacity for the thread pool executor ' s blocking queue default is { @ code integer max value } any positive value will lead to a linked blocking queue instance ; any other value will lead to a synchronous queue instance

public void set queue capacity ( int queue capacity ) { this queue capacity = queue capacity ; }


{ @ inherit doc } < b > note : < b > this method ignores how often any element might appear in { @ code c } , and only cares whether or not an element appears at all if you wish to remove one occurrence in this multiset for every occurrence in { @ code c } , see { @ link multisets # remove occurrences ( multiset , multiset ) } this method refines { @ link collection # remove all } to further specify that it < b > may not < b > throw an exception in response to any of { @ code elements } being null or of the wrong type

boolean remove all ( collection < ? > c ) ;


get a connection from the pool , or timeout after the specified number of milliseconds

public connection get connection ( final long hard timeout ) throws s q l exception { suspend resume lock acquire ( ) ; final long start time = current time ( ) ; try { long timeout = hard timeout ; do { pool entry pool entry = connection bag borrow ( timeout , milliseconds ) ; if ( pool entry = = null ) { break ; / / we timed out break and throw exception } final long now = current time ( ) ; if ( pool entry is marked evicted ( ) | | ( elapsed millis ( pool entry last accessed , now ) > alive bypass window ms & & ! is connection alive ( pool entry connection ) ) ) { close connection ( pool entry , pool entry is marked evicted ( ) ? evicted connection message : dead connection message ) ; timeout = hard timeout - elapsed millis ( start time ) ; } else { metrics tracker record borrow stats ( pool entry , start time ) ; return pool entry create proxy connection ( leak task factory schedule ( pool entry ) , now ) ; } } while ( timeout > 0l ) ; metrics tracker record borrow timeout stats ( start time ) ; throw create timeout exception ( start time ) ; } catch ( interrupted exception e ) { thread current thread ( ) interrupt ( ) ; throw new s q l exception ( pool name + " - interrupted during connection acquisition " , e ) ; } finally { suspend resume lock release ( ) ; } }


public static key manager factory build keystore ( final client certificate properties properties ) { try ( val key input = properties get certificate ( ) get location ( ) get input stream ( ) ) { val key manager factory = key manager factory get instance ( key manager factory get default algorithm ( ) ) ; val key store = key store get instance ( " pkcs12 " ) ; key store load ( key input , properties get passphrase ( ) to char array ( ) ) ; key manager factory init ( key store , properties get passphrase ( ) to char array ( ) ) ; return key manager factory ; } }


returns the corresponding conversion class for representing values if no conversion class was defined manually , the default conversion defined by the logical type is used

public class < ? > get conversion class ( ) { return conversion class ; }


get the array stringable for a specified data type not used on an array data type , but on array ' s element ' s type

public static array stringable get array stringable ( data type dt ) { if ( dt instanceof type def ) { dt = ( ( type def ) dt ) get base data type ( ) ; } return ( dt instanceof array stringable ) ? ( array stringable ) dt : null ; }


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

public api response < client > call 1 2 3test special tags with http info ( client body ) throws api exception { http request builder local var request builder = call 1 2 3test special tags request builder ( body ) ; try { http response < input stream > local var response = member var http client send ( local var request builder build ( ) , http response body handlers of input stream ( ) ) ; if ( member var response interceptor ! = null ) { member var response interceptor accept ( local var response ) ; } if ( local var response status code ( ) / 100 ! = 2 ) { throw new api exception ( local var response status code ( ) , " call 1 2 3test special tags call received non - success response " , local var response headers ( ) , local var response body ( ) = = null ? null : new string ( local var response body ( ) read all bytes ( ) ) ) ; } return new api response < client > ( local var response status code ( ) , local var response headers ( ) map ( ) , member var object mapper read value ( local var response body ( ) , new type reference < client > ( ) { } ) ) ; } catch ( i o exception e ) { throw new api exception ( e ) ; } catch ( interrupted exception e ) { thread current thread ( ) interrupt ( ) ; throw new api exception ( e ) ; } }


test the case when a custom record delimiter is specified using the textinputformat record delimiter configuration property

public void test custom record delimiters ( ) throws i o exception , interrupted exception , class not found exception { configuration conf = new configuration ( ) ; conf set ( " textinputformat record delimiter " , " \ t \ n " ) ; conf set int ( " mapreduce job maps " , 1 ) ; file system local fs = file system get local ( conf ) ; / / cleanup local fs delete ( work dir , true ) ; / / creating input test file create input file ( conf ) ; create and run job ( conf ) ; string expected = " 0 \ tabc \ ndef \ n 9 \ tghi \ njkl \ n " ; assert equals ( expected , read output file ( conf ) ) ; }


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


returns the target model class that should be used to deserialize the input data the discriminator mappings are used to determine the target model class

public static class < ? > get class for element ( json node node , class < ? > model class ) { class discriminator mapping cdm = model discriminators get ( model class ) ; if ( cdm ! = null ) { return cdm get class for element ( node , new hash set < class < ? > > ( ) ) ; } return null ; }


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

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


returns the implicit output artifact for a given template function if multiple or no artifacts can be found as a result of the template , an exception is thrown

artifact get implicit output artifact ( implicit outputs function function ) throws interrupted exception ;


protected void check subject roles and permissions ( final subject current user ) throws failed login exception { if ( this required roles ! = null ) { for ( val role : this required roles ) { if ( ! current user has role ( role ) ) { throw new failed login exception ( " required role " + role + " does not exist " ) ; } } } if ( this required permissions ! = null ) { for ( val perm : this required permissions ) { if ( ! current user is permitted ( perm ) ) { throw new failed login exception ( " required permission " + perm + " cannot be located " ) ; } } } }


implementations should return true if they need more views to be computed in order to fill the screen


if path doesn ' t starts with ' ' method will concat ' '

private string path to root path ( string path ) { if ( path = = null ) { return null ; } if ( path starts with ( " / " ) ) { return path ; } return " / " concat ( path ) ; }


publish a { @ link before test class event } to the { @ code application context } for the supplied { @ link test context }

public void before test class ( test context test context ) { test context publish event ( before test class event : : new ) ; }


test main method of dist cp method should to call system exit ( )

public void test cleanup test via tool runner ( ) throws i o exception , interrupted exception { configuration conf = get conf ( ) ; path staging dir = job submission files get staging dir ( new cluster ( conf ) , conf ) ; staging dir get file system ( conf ) mkdirs ( staging dir ) ; path soure = create file ( " tmp txt " ) ; path target = create file ( " target txt " ) ; try { string [ ] arg = { target to string ( ) , soure to string ( ) } ; dist cp main ( arg ) ; assert fail ( ) ; } catch ( exit exception t ) { assert assert true ( fs exists ( target ) ) ; assert assert equals ( t status , 0 ) ; assert assert equals ( staging dir get file system ( conf ) list status ( staging dir ) length , 0 ) ; } }


swap the linkages of two nodes in a tree

private void swap position ( r b node x , r b node y ) { / / save initial values r b node px = x parent , lx = x left , rx = x right ; r b node py = y parent , ly = y left , ry = y right ; boolean x was left child = px ! = null & & x = = px left ; boolean y was left child = py ! = null & & y = = py left ; / / swap , handling special cases of one being the other ' s parent if ( x = = py ) { / / x was y ' s parent x parent = y ; if ( y was left child ) { y left = x ; y right = rx ; } else { y right = x ; y left = lx ; } } else { x parent = py ; if ( py ! = null ) { if ( y was left child ) { py left = x ; } else { py right = x ; } } y left = lx ; y right = rx ; } if ( y = = px ) { / / y was x ' s parent y parent = x ; if ( x was left child ) { x left = y ; x right = ry ; } else { x right = y ; x left = ly ; } } else { y parent = px ; if ( px ! = null ) { if ( x was left child ) { px left = y ; } else { px right = y ; } } x left = ly ; x right = ry ; } / / fix children ' s parent pointers if ( x left ! = null ) { x left parent = x ; } if ( x right ! = null ) { x right parent = x ; } if ( y left ! = null ) { y left parent = y ; } if ( y right ! = null ) { y right parent = y ; } / / swap colors byte c = x color ; x color = y color ; y color = c ; / / check if root changed if ( root = = x ) { root = y ; } else if ( root = = y ) { root = x ; } }


returns a crc of the remaining bytes in the stream

public string crc ( input stream input ) { if ( input = = null ) throw new illegal argument exception ( " input cannot be null " ) ; crc32 crc = new crc32 ( ) ; byte [ ] buffer = new byte [ 4096 ] ; try { while ( true ) { int length = input read ( buffer ) ; if ( length = = - 1 ) break ; crc update ( buffer , 0 , length ) ; } } catch ( exception ex ) { } finally { stream utils close quietly ( input ) ; } return long to string ( crc get value ( ) , 16 ) ; }


public void set created time ( long created time ) { this created time = created time ; }


get an enumeration of the keys of the j s o n object

public iterator keys ( ) { return this map key set ( ) iterator ( ) ; }


test that standby node tails multiple segments while catching up during the transition to active

public void test undertailing while failover ( ) throws exception { cluster transition to active ( 0 ) ; cluster wait active ( 0 ) ; string p = " / test failover while tailing without cache / " ; mkdirs ( nn 0 , p + 0 , p + 1 , p + 2 , p + 3 , p + 4 ) ; nn 0 get rpc server ( ) roll edit log ( ) ; / / create segment 1 mkdirs ( nn 0 , p + 5 , p + 6 , p + 7 , p + 8 , p + 9 ) ; nn 0 get rpc server ( ) roll edit log ( ) ; / / create segment 2 mkdirs ( nn 0 , p + 10 , p + 11 , p + 12 , p + 13 , p + 14 ) ; nn 0 get rpc server ( ) roll edit log ( ) ; / / create segment 3 cluster transition to standby ( 0 ) ; cluster transition to active ( 1 ) ; cluster wait active ( 1 ) ; wait for file info ( nn 1 , p + 0 , p + 1 , p + 14 ) ; }


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


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

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


public void dispose ( ) { stop framework ( ) ; }


closes the reader by closing the underlying { @ code input stream } and marking this reader as closed

public void close ( ) throws i o exception { synchronized ( in ) { if ( buf ! = null ) { buf = null ; in close ( ) ; } } }


add a { @ link bt indexed mesh } to this array

public bt triangle index vertex array add indexed mesh ( final bt indexed mesh mesh ) { return add indexed mesh ( mesh , phy scalar type phy short ) ; }


returns true if the attribute doc is of a common attribute type

public boolean is common type ( ) { return common type ! = null ; }


submit a request to readahead on the given file descriptor

public readahead request submit readahead ( string identifier , file descriptor fd , long off , long len ) { readahead request impl req = new readahead request impl ( identifier , fd , off , len ) ; pool execute ( req ) ; if ( log is trace enabled ( ) ) { log trace ( " submit readahead : " + req ) ; } return req ; }


runs before the { @ link builder } runs ( but after the checkout has occurred ) , and performs a set up

public environment set up ( abstract build build , launcher launcher , build listener listener ) throws i o exception , interrupted exception { / / if it ' s a build , and the plugin implements the deprecated api , use it if ( build instanceof build & & util is overridden ( build wrapper class , get class ( ) , " set up " , build class , launcher class , build listener class ) ) return set up ( ( build ) build , launcher , listener ) ; else / / not a supported build type throw new unsupported operation exception ( " plugin class ' " + this get class ( ) get name ( ) + " ' does not support a build of type ' " + build get class ( ) get name ( ) + " ' " ) ; }


append " bytes " in " mode " mode ( encoding ) into " bits " on success , store the result in " bits "

static void append bytes ( string content , mode mode , bit array bits , charset encoding ) throws writer exception { switch ( mode ) { case numeric : append numeric bytes ( content , bits ) ; break ; case alphanumeric : append alphanumeric bytes ( content , bits ) ; break ; case byte : append 8 bit bytes ( content , bits , encoding ) ; break ; case kanji : append kanji bytes ( content , bits ) ; break ; default : throw new writer exception ( " invalid mode : " + mode ) ; } }


public list < delayed data detector factory bucket with missing data > detect missing data ( long unused time stamp ) { return collections empty list ( ) ; }


the total time large merges were stopped so smaller merges could finish

public long get total stopped time in millis ( ) { return this total stopped time in millis ; }


adds the element to the queue , or fails with an exception , if the queue is closed checking whether the queue is open and adding the element is one atomic operation

public void add ( e element ) throws illegal state exception { require non null ( element ) ; lock lock ( ) ; try { if ( open ) { elements add last ( element ) ; if ( elements size ( ) = = 1 ) { non empty signal all ( ) ; } } else { throw new illegal state exception ( " queue is closed " ) ; } } finally { lock unlock ( ) ; } }


returns the number of pairs in the dataset

public long count ( ) { return x stats count ( ) ; }


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


database traffic metrics source the metrics base on the oal scripts

database access to database access ( ) { if ( ! request type database equals ( type ) ) { return null ; } database access database access = new database access ( ) ; database access set database type id ( component id ) ; database access set latency ( latency ) ; database access set name ( dest service name ) ; database access set status ( status ) ; database access set time bucket ( time bucket ) ; return database access ; }


returns a copy of the current observer snapshot

public list < learner handler > get observing learners ( ) { synchronized ( observing learners ) { return new array list < learner handler > ( observing learners ) ; } }


formats a network address and port range for display purposes this formats the address with { @ link # format ( inet address ) } and appends the port range in brackets in case there is only one port , the result is the same with { @ link # format ( inet address , int ) } example output : i pv 4 no port : { @ code 127 0 0 1 } i pv 4 single port : { @ code 127 0 0 1 : 9300 } i pv 4 multiple ports : { @ code 127 0 0 1 : [ 9300 - 9400 ] } i pv 6 multiple ports : { @ code [ : : 1 ] : [ 9300 - 9400 ] }

public static string format ( inet address address , ports range ports range ) { objects require non null ( address ) ; string builder builder = new string builder ( ) ; int number of ports = ports range ports ( ) length ; if ( number of ports ! = 0 & & address instanceof inet 6 address ) { builder append ( inet addresses to uri string ( address ) ) ; } else { builder append ( inet addresses to addr string ( address ) ) ; } if ( number of ports ! = 0 ) { builder append ( ' : ' ) ; if ( number of ports = = 1 ) { builder append ( ports range get port range string ( ) ) ; } else { builder append ( " [ " ) append ( ports range get port range string ( ) ) append ( " ] " ) ; } } return builder to string ( ) ; }


public void insert recognizer test 3 ( ) { string sql = " insert into t 1 ( name 1 , name 2 ) values ( ' name 1 ' , ' name 2 ' ) , ( ' name 3 ' , ' name 4 ' ) , ( ' name 5 ' , ' name 6 ' ) " ; s q l statement statement = get s q l statement ( sql ) ; my s q l insert recognizer my s q l insert recognizer = new my s q l insert recognizer ( sql , statement ) ; assertions assert equals ( sql , my s q l insert recognizer get original s q l ( ) ) ; assertions assert equals ( " t 1 " , my s q l insert recognizer get table name ( ) ) ; assertions assert equals ( arrays as list ( " name 1 " , " name 2 " ) , my s q l insert recognizer get insert columns ( ) ) ; assertions assert equals ( 3 , my s q l insert recognizer get insert rows ( collections singleton list ( pk index ) ) size ( ) ) ; assertions assert equals ( arrays as list ( " name 1 " , " name 2 " ) , my s q l insert recognizer get insert rows ( collections singleton list ( pk index ) ) get ( 0 ) ) ; assertions assert equals ( arrays as list ( " name 3 " , " name 4 " ) , my s q l insert recognizer get insert rows ( collections singleton list ( pk index ) ) get ( 1 ) ) ; assertions assert equals ( arrays as list ( " name 5 " , " name 6 " ) , my s q l insert recognizer get insert rows ( collections singleton list ( pk index ) ) get ( 2 ) ) ; }


public string next procedure ( ) { return next procedure ; }


forwards folder deleted callback to all listeners within this list

public void folder deleted ( string parent path , string folder name ) { if ( enable asynchronous dispatching ) { add ( new folder deleted event ( parent path , folder name ) ) ; } else { for ( file system listener l : listener list ) { l folder deleted ( parent path , folder name ) ; } } }


return maximum length since actual length is unknown

public long length ( ) { return integer max value ; }


appends an int to the fingerprint message

public fingerprint add int ( int x ) { try { coded out write int 3 2 no tag ( x ) ; } catch ( i o exception e ) { throw new illegal state exception ( " failed to write int " , e ) ; } return this ; }


finds the next entry in the current chain returns true if an entry was found

boolean next in chain ( ) { if ( next entry ! = null ) { for ( next entry = next entry get next ( ) ; next entry ! = null ; next entry = next entry get next ( ) ) { if ( advance to ( next entry ) ) { return true ; } } } return false ; }


fills { @ link # padding buffer } using data from { @ code input } , plus any additional buffered data at the end of { @ code buffer } ( up to its { @ code size } ) required to fill it , advancing the input position

private void update padding buffer ( byte buffer input , byte [ ] buffer , int size ) { int from input size = min ( input remaining ( ) , padding size ) ; int from buffer size = padding size - from input size ; system arraycopy ( / * src = * / buffer , / * src pos = * / size - from buffer size , / * dest = * / padding buffer , / * dest pos = * / 0 , / * length = * / from buffer size ) ; input position ( input limit ( ) - from input size ) ; input get ( padding buffer , from buffer size , from input size ) ; }


developers might use standalone mode ( which is the default for one server ) this test checks ssl works in standalone mode of zk server note that in this test the zk server has only secure client port

public void test secure standalone server ( ) throws exception { integer secure client port = port assignment unique ( ) ; main thread mt = new main thread ( main thread unset myid , " " , secure client port , false ) ; mt start ( ) ; zoo keeper zk = client base create z k client ( " 127 0 0 1 : " + secure client port , timeout ) ; zk create ( " / test " , " " get bytes ( ) , zoo defs ids open acl unsafe , create mode persistent ) ; zk delete ( " / test " , - 1 ) ; zk close ( ) ; mt shutdown ( ) ; }


computes the path to the sandbox base tree for the given running command

private static path compute sandbox base ( sandbox options options , command environment env ) throws i o exception { if ( options sandbox base is empty ( ) ) { return env get output base ( ) get relative ( " sandbox " ) ; } else { string dir name = string format ( " % s - sandbox % s " , env get runtime ( ) get product name ( ) , fingerprint get hex digest ( env get output base ( ) to string ( ) ) ) ; file system file system = env get runtime ( ) get file system ( ) ; path resolved sandbox base = file system get path ( options sandbox base ) resolve symbolic links ( ) ; return resolved sandbox base get relative ( dir name ) ; } }


extracts the parameter names of a method if possible

static @ nullable list < string > extract method parameter names ( method method ) { return extract executable names ( method ) ; }


tests that the send operation is being retried

public void test retriable send operation if connection error or service unavailable ( ) throws exception { final ping rest handler ping rest handler = new ping rest handler ( future utils completed exceptionally ( new rest handler exception ( " test exception " , http response status service unavailable ) ) , completable future completed future ( empty response body get instance ( ) ) ) ; try ( final test rest server endpoint rest server endpoint = create rest server endpoint ( ping rest handler ) ) { rest cluster client < ? > rest cluster client = create rest cluster client ( rest server endpoint get server address ( ) get port ( ) ) ; try { final atomic boolean first poll failed = new atomic boolean ( ) ; fail http request = ( message headers , message parameters , request body ) - > message headers instanceof ping rest handler headers & & ! first poll failed get and set ( true ) ; rest cluster client send request ( ping rest handler headers instance ) get ( ) ; } finally { rest cluster client close ( ) ; } } }