reads the element values of a jvms ' annotation ' structure and makes the given visitor visit them this method can also be used to read the values of the jvms ' array value ' field of an annotation ' s ' element value '

private int read element values ( final annotation visitor annotation visitor , final int annotation offset , final boolean named , final char [ ] char buffer ) { int current offset = annotation offset ; / / read the num element value pairs field ( or num values field for an array value ) int num element value pairs = read unsigned short ( current offset ) ; current offset + = 2 ; if ( named ) { / / parse the element value pairs array while ( num element value pairs - - > 0 ) { string element name = read u t f 8 ( current offset , char buffer ) ; current offset = read element value ( annotation visitor , current offset + 2 , element name , char buffer ) ; } } else { / / parse the array value array while ( num element value pairs - - > 0 ) { current offset = read element value ( annotation visitor , current offset , / * named = * / null , char buffer ) ; } } if ( annotation visitor ! = null ) { annotation visitor visit end ( ) ; } return current offset ; }


public boolean is empty ( ) { return size = = 0 ; }


returns the { @ link flac stream metadata } decoded from the initialization data

public flac stream metadata get stream metadata ( ) { return stream metadata ; }


returns a string representing current build time

private string get build time ( ) { date format date format = new simple date format ( " yyyy - mm - dd ' t ' hh : mm ' z ' " ) ; date format set time zone ( time zone get time zone ( " utc " ) ) ; return date format format ( new date ( ) ) ; }


returns the external package prefix of the given external class name

public static string external package prefix ( string external class name ) { return external class name substring ( 0 , external class name last index of ( java constants package separator , external class name length ( ) - 2 ) + 1 ) ; }


checks that the graph rooted at ' target node ' has been completely built ; fails if not callers of { @ link # get transitive closure } must ensure that { @ link # build transitive closure } has been called before it would be inefficient and failure - prone to make get transitive closure call build transitive closure directly also , it would cause nondeterministic behavior of the operators , since the set of packages loaded ( and hence errors reported ) would depend on the ordering details of the query operators ' implementations

private void check built ( target target node ) { preconditions check state ( label visitor has visited ( target node get label ( ) ) , " get transitive closure ( % s ) called without prior call to build transitive closure ( ) " , target node ) ; }


test the property ' array array number '

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


get the snapshot root of a given file or directory if it exists e g if snapdir 1 is a snapshottable directory and path given is snapdir 1pathtofile , this method would return snapdir 1

string get snapshot root ( string path str ) throws i o exception { snapshottable directory status [ ] dir status list = get rpc client protocol ( ) get snapshottable dir listing ( ) ; if ( dir status list = = null ) { return null ; } for ( snapshottable directory status dir status : dir status list ) { string curr dir = dir status get full path ( ) to string ( ) ; if ( path str starts with ( curr dir ) ) { return curr dir ; } } return null ; }


adds unannounced credits from the consumer or resumes data consumption after an exactly - once checkpoint and enqueues the corresponding reader for this consumer ( if not enqueued yet )

void add credit or resume consumption ( input channel i d receiver id , consumer < network sequence view reader > operation ) throws exception { if ( fatal error ) { return ; } network sequence view reader reader = all readers get ( receiver id ) ; if ( reader ! = null ) { operation accept ( reader ) ; enqueue available reader ( reader ) ; } else { throw new illegal state exception ( " no reader for receiver id = " + receiver id + " exists " ) ; } }


public data type get void type ( ) { return base data type void ; }


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

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


public static void put logout requests ( final request context context , final list < single logout request context > requests ) { context get flow scope ( ) put ( parameter logout requests , requests ) ; }


add to this collection a { @ link header } with the given key and value

headers add double ( string key , double value ) ;


tests for required field , both null , non - existing and empty strings

public void test binding with required fields ( ) { test bean tb = new test bean ( ) ; tb set spouse ( new test bean ( ) ) ; data binder binder = new data binder ( tb , " person " ) ; binder set required fields ( " touchy " , " name " , " age " , " date " , " spouse name " ) ; mutable property values pvs = new mutable property values ( ) ; pvs add ( " touchy " , " " ) ; pvs add ( " name " , null ) ; pvs add ( " age " , null ) ; pvs add ( " spouse name " , " " ) ; binder bind ( pvs ) ; binding result br = binder get binding result ( ) ; assert that ( br get error count ( ) ) as ( " wrong number of errors " ) is equal to ( 5 ) ; assert that ( br get field error ( " touchy " ) get code ( ) ) is equal to ( " required " ) ; assert that ( br get field value ( " touchy " ) ) is equal to ( " " ) ; assert that ( br get field error ( " name " ) get code ( ) ) is equal to ( " required " ) ; assert that ( br get field value ( " name " ) ) is equal to ( " " ) ; assert that ( br get field error ( " age " ) get code ( ) ) is equal to ( " required " ) ; assert that ( br get field value ( " age " ) ) is equal to ( " " ) ; assert that ( br get field error ( " date " ) get code ( ) ) is equal to ( " required " ) ; assert that ( br get field value ( " date " ) ) is equal to ( " " ) ; assert that ( br get field error ( " spouse name " ) get code ( ) ) is equal to ( " required " ) ; assert that ( br get field value ( " spouse name " ) ) is equal to ( " " ) ; }


writes the generated class files to the output jar

private static void write output jar ( path temp dir , gen class options options ) throws i o exception { jar creator output = new jar creator ( options output jar ( ) to string ( ) ) ; output set compression ( true ) ; output set normalize ( true ) ; output add directory ( temp dir ) ; output execute ( ) ; }


return the limit for the number of idle consumers

public final int get idle consumer limit ( ) { synchronized ( this lifecycle monitor ) { return this idle consumer limit ; } }


builds a hadoop - path from a swift path , inserting the uri authority of this fs instance

private path get correct swift path ( swift object path path ) throws swift exception { try { final uri full uri = new uri ( uri get scheme ( ) , uri get authority ( ) , path get object ( ) , null , null ) ; return new path ( full uri ) ; } catch ( u r i syntax exception e ) { throw new swift exception ( " specified path " + path + " is incorrect " , e ) ; } }


returns the value of this { @ code unsigned long } as an { @ code int }

public int int value ( ) { return ( int ) value ; }


gets the average xceiver count with respect to the storage types

private double get in service xceiver average by storage type ( set < storage type > storage types ) { double avg load = 0 ; final map < storage type , storage type stats > storage stats = stats get storage type stats ( ) ; int num nodes = 0 ; int num xceiver = 0 ; for ( storage type s : storage types ) { storage type stats storage type stats = storage stats get ( s ) ; num nodes + = storage type stats get nodes in service ( ) ; num xceiver + = storage type stats get nodes in service xceiver count ( ) ; } if ( num nodes ! = 0 ) { avg load = ( double ) num xceiver / num nodes ; } return avg load ; }


public void pop operand ( ) { point = point get parent ( ) ; depth - = 1 ; }


public long elapsed millis 0 ( final long start time ) { return nanoseconds to millis ( system nano time ( ) - start time ) ; }


whether the threadpool queue has space available according to the < code > queue size rejection threshold < code > settings note that the < code > queue size < code > is an final instance variable on hystrix thread pool default , and not looked up dynamically the data structure is static , so this does not make sense as a dynamic lookup the < code > queue size rejection threshold < code > can be dynamic ( up to < code > queue size < code > ) , so that should still get checked on each invocation if a synchronous queue implementation is used ( < code > max queue size < code > < = 0 ) , it always returns 0 as the size so this would always return true

public boolean is queue space available ( ) { if ( queue size < = 0 ) { / / we don ' t have a queue so we won ' t look for space but instead / / let the thread - pool reject or not return true ; } else { return thread pool get queue ( ) size ( ) < properties queue size rejection threshold ( ) get ( ) ; } }


loading a matcher from a string the default access privilege is read - only the string contains 1 or 2 parts , separated by whitespace characters , where the first part specifies the client hosts , and the second part ( if existent ) specifies the access privilege of the client hosts i e , " client - hosts [ access - privilege ] "

private static match get match ( string line ) { string [ ] parts = line split ( " \ \ s + " ) ; final string host ; access privilege privilege = access privilege read only ; switch ( parts length ) { case 1 : host = string utils to lower case ( parts [ 0 ] ) trim ( ) ; break ; case 2 : host = string utils to lower case ( parts [ 0 ] ) trim ( ) ; string option = parts [ 1 ] trim ( ) ; if ( " rw " equals ignore case ( option ) ) { privilege = access privilege read write ; } break ; default : throw new illegal argument exception ( " incorrectly formatted line ' " + line + " ' " ) ; } if ( host equals ( " * " ) ) { if ( log is debug enabled ( ) ) { log debug ( " using match all for ' " + host + " ' and " + privilege ) ; } return new anonymous match ( privilege ) ; } else if ( cidr format short matcher ( host ) matches ( ) ) { if ( log is debug enabled ( ) ) { log debug ( " using cidr match for ' " + host + " ' and " + privilege ) ; } return new c i d r match ( privilege , new subnet utils ( host ) get info ( ) ) ; } else if ( cidr format long matcher ( host ) matches ( ) ) { if ( log is debug enabled ( ) ) { log debug ( " using cidr match for ' " + host + " ' and " + privilege ) ; } string [ ] pair = host split ( " / " ) ; return new c i d r match ( privilege , new subnet utils ( pair [ 0 ] , pair [ 1 ] ) get info ( ) ) ; } else if ( host contains ( " * " ) | | host contains ( " ? " ) | | host contains ( " [ " ) | | host contains ( " ] " ) | | host contains ( " ( " ) | | host contains ( " ) " ) ) { if ( log is debug enabled ( ) ) { log debug ( " using regex match for ' " + host + " ' and " + privilege ) ; } return new regex match ( privilege , host ) ; } else if ( hostname format matcher ( host ) matches ( ) ) { if ( log is debug enabled ( ) ) { log debug ( " using exact match for ' " + host + " ' and " + privilege ) ; } return new exact match ( privilege , host ) ; } else { throw new illegal argument exception ( " invalid hostname provided ' " + host + " ' " ) ; } }


public void append msg ( string message ) { add ( message ) ; }


positive test to verify rename access check

public void test rename access check positive ( ) throws throwable { path parent dir = new path ( " / test rename access check positive " ) ; path src path = new path ( parent dir , " test 1 dat " ) ; path dst path = new path ( parent dir , " test 2 dat " ) ; / * to create parent dir * / authorizer add auth rule for owner ( " / " , write , true ) ; / * for rename * / authorizer add auth rule for owner ( parent dir to string ( ) , write , true ) ; fs update wasb authorizer ( authorizer ) ; try { touch ( fs , src path ) ; assert path exists ( fs , " source path does not exist " , src path ) ; assert rename outcome ( fs , src path , dst path , true ) ; assert path exists ( fs , " dest path does not exist " , dst path ) ; assert path does not exist ( fs , " source path exists after rename ! " , src path ) ; } finally { recursive delete ( parent dir ) ; } }


test connecting to the main host then an alternative , although only subject alternative names are used if present no special consideration of common name

@ test public void common then alternative ( ) throws exception { server enqueue ( new mock response ( ) ) ; server enqueue ( new mock response ( ) ) ; assert 2 0 0 http 2 response ( execute ( url ) , server get host name ( ) ) ; http url san url = url new builder ( ) host ( " san com " ) build ( ) ; assert 2 0 0 http 2 response ( execute ( san url ) , " san com " ) ; assert that ( client connection pool ( ) connection count ( ) ) is equal to ( 1 ) ; }


makes an instance for the given value this may ( but does not necessarily ) return an already - allocated instance

public static cst double make ( long bits ) { / * * note : javadoc notwithstanding , this implementation always * allocates * / return new cst double ( bits ) ; }


ensure a cluster is formed with all published nodes

public synchronized void validate cluster formed ( ) { final set < discovery node > expected nodes = new hash set < > ( ) ; for ( node and client node and client : nodes values ( ) ) { expected nodes add ( get instance from node ( cluster service class , node and client node ( ) ) local node ( ) ) ; } logger trace ( " validating cluster formed , expecting { } " , expected nodes ) ; try { assert busy ( ( ) - > { final list < cluster state > states = nodes values ( ) stream ( ) map ( node - > get instance from node ( cluster service class , node node ( ) ) ) map ( cluster service : : state ) collect ( collectors to list ( ) ) ; final string debug string = " , expected nodes : " + expected nodes + " and actual cluster states " + states ; / / all nodes have a master assert true ( " missing master " + debug string , states stream ( ) all match ( cs - > cs nodes ( ) get master node id ( ) ! = null ) ) ; / / all nodes have the same master ( in same term ) assert equals ( " not all masters in same term " + debug string , 1 , states stream ( ) map to long ( cluster state : : term ) distinct ( ) count ( ) ) ; / / all nodes know about all other nodes states for each ( cs - > { discovery nodes discovery nodes = cs nodes ( ) ; assert equals ( " node size mismatch " + debug string , expected nodes size ( ) , discovery nodes get size ( ) ) ; for ( discovery node expected node : expected nodes ) { assert true ( " expected node to exist : " + expected node + debug string , discovery nodes node exists ( expected node ) ) ; } } ) ; } , 30 , time unit seconds ) ; } catch ( assertion error ae ) { throw new illegal state exception ( " cluster failed to form " , ae ) ; } catch ( exception e ) { throw new illegal state exception ( e ) ; } }


returns the incompatible dependencies that caused this provider to be present this may be null if it is null , then { @ code get constraints responsible for incompatibility ( ) } is guaranteed to be non - null it will have at least one element in it if it is not null

public abstract immutable list < configured target > targets responsible for incompatibility ( ) ;


public offset date time get date time ( ) { return date time ; }


returns the value associated with the specified key , or { @ code null } if there is no such value specifically , if any range in this range map contains the specified key , the value associated with that range is returned


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 per - package configured runfiles

public static nested set < artifact > compute per package data ( rule context rule context , java toolchain provider toolchain ) { / / do not use streams here as they create excessive garbage nested set builder < artifact > data = nested set builder naive link order ( ) ; for ( java package configuration provider provider : toolchain package configuration ( ) ) { if ( provider matches ( rule context get label ( ) ) ) { data add transitive ( provider data ( ) ) ; } } return data build ( ) ; }


public static < l , r > either < l , r > left ( l value ) { return new left < l , r > ( value ) ; }


checks that the given range is valid see https : bugs eclipse orgbugsshow bug cgi ? id = 69292

private void check range ( int offset , int length , int document length ) { assert is legal ( offset > - 1 ) ; assert is legal ( length > - 1 ) ; assert is legal ( offset + length < = document length ) ; }


adapt saml metadata and parse acts as a facade

public static optional < saml registered service service provider metadata facade > get ( final saml registered service caching metadata resolver resolver , final saml registered service registered service , final request abstract type request ) { return get ( resolver , registered service , saml id p utils get issuer from saml object ( request ) ) ; }


get declared method with provided name and parameter types in given class and its super classes all parameters should be valid

private method get declared method for ( class < ? > clazz , string name , class < ? > parameter types ) { try { return clazz get declared method ( name , parameter types ) ; } catch ( no such method exception e ) { class < ? > super class = clazz get superclass ( ) ; if ( super class ! = null ) { return get declared method for ( super class , name , parameter types ) ; } } return null ; }


stops all published endpoints , taking the web services offline

public void destroy ( ) { for ( endpoint endpoint : this published endpoints ) { endpoint stop ( ) ; } }


a list of namespaces to which this service is exported exporting a service allows it to be used by sidecars , gateways and virtual services defined in other namespaces this feature provides a mechanism for service owners and mesh administrators to control the visibility of services across namespace boundaries if no namespaces are specified then the service is exported to all namespaces by default the value " " is reserved and defines an export to the same namespace that the service is declared in similarly the value " " is reserved and defines an export to all namespaces for a kubernetes service , the equivalent effect can be achieved by setting the annotation " networking istio ioexport to " to a comma - separated list of namespace names note : in the current release , the ` export to ` value is restricted to " " or " " ( i e , the current namespace or all namespaces ) < code > repeated string export to = 7 ; < code >

public builder add export to ( java lang string value ) { if ( value = = null ) { throw new null pointer exception ( ) ; } ensure export to is mutable ( ) ; export to add ( value ) ; on changed ( ) ; return this ; }


get the latest session key from the config state

public session key session key ( ) { return session key ; }


returns a { @ link field } that represents the specified declared field for the supplied class

static public field get declared field ( class c , string name ) throws reflection exception { try { return new field ( c get declared field ( name ) ) ; } catch ( security exception e ) { throw new reflection exception ( " security violation while getting field : " + name + " , for class : " + c get name ( ) , e ) ; } catch ( no such field exception e ) { throw new reflection exception ( " field not found : " + name + " , for class : " + c get name ( ) , e ) ; } }


gets the largest timestamp that still belongs to this window this timestamp is identical to { @ code get end ( ) - 1 }

public long max timestamp ( ) { return end - 1 ; }


writes 0x 0 0 until the position is aligned to a multiple of 4

public void align to four bytes with zero fill ( ) { while ( ( data position ( ) & 3 ) ! = 0 ) { data put ( ( byte ) 0 ) ; } }


resolve events internal set implementation may filter events from the collection to only return the one that is appropriate for this request the default implementation returns the entire collection

protected set < event > resolve events internal ( final collection < event > resolve events , final authentication authentication , final registered service registered service , final http servlet request request , final request context context ) { if ( ! resolve events is empty ( ) ) { logger trace ( " collection of resolved events for this authentication sequence are : " ) ; resolve events for each ( e - > logger trace ( " event id [ { } ] resolved from [ { } ] " , e get id ( ) , e get source ( ) get class ( ) get name ( ) ) ) ; } else { logger trace ( " no events resolved for authentication transaction [ { } ] and service [ { } ] " , authentication , registered service ) ; } val pair = filter events by multifactor authentication provider ( resolve events , authentication , registered service , request ) ; web utils put resolved multifactor authentication providers ( context , pair get value ( ) ) ; return new hash set < > ( pair get key ( ) ) ; }


return a descriptive name for the given object ' s type : usually simply the class name , but component type class name + " [ ] " for arrays , and an appended list of implemented interfaces for jdk proxies

public static string get descriptive type ( @ nullable object value ) { if ( value = = null ) { return null ; } class < ? > clazz = value get class ( ) ; if ( proxy is proxy class ( clazz ) ) { string prefix = clazz get name ( ) + " implementing " ; string joiner result = new string joiner ( " , " , prefix , " " ) ; for ( class < ? > ifc : clazz get interfaces ( ) ) { result add ( ifc get name ( ) ) ; } return result to string ( ) ; } else { return clazz get type name ( ) ; } }


return true if this order object is equal to o

public boolean equals ( object o ) { if ( this = = o ) { return true ; } if ( o = = null | | get class ( ) ! = o get class ( ) ) { return false ; } order order = ( order ) o ; return objects equals ( this id , order id ) & & objects equals ( this pet id , order pet id ) & & objects equals ( this quantity , order quantity ) & & objects equals ( this ship date , order ship date ) & & objects equals ( this status , order status ) & & objects equals ( this complete , order complete ) ; }


cancels a relocation of a shard that shard must relocating

private shard routing cancel relocation ( shard routing shard ) { relocating shards - - ; shard routing cancelled shard = shard cancel relocation ( ) ; update assigned ( shard , cancelled shard ) ; return cancelled shard ; }


public void place order test ( ) throws i o exception { order order = null ; order response = api place order ( order ) ; / / todo : test validations }


list < tenant info > find tenant by kp ( string kp ) ;


public long get pet id ( ) { return pet id ; }


returns true if a script info object exists for the specified script file

public boolean contains metadata ( resource file script file ) { return script file to info map contains key ( script file ) ; }


returns a new set containing the first n elements in this grouped and sorted { @ link data set }


pushes an element onto the stack represented by this deque in other words , inserts the element at the front of this deque this method is equivalent to { @ link # add first }

public void push ( e e ) { add first ( e ) ; }


suitable for { @ link job # get nearest build }

public final run t get nearest build ( int n ) { return builds search ( n , abstract lazy load run map direction asc ) ; }


if resources exist and a data binding layout info file is requested : processes data binding declarations over those resources , populates the output file , and creates a new resources directory with data binding expressions stripped out ( so aapt , which doesn ' t understand data binding , can properly read them ) returns the resources directory that aapt should read

static path process data bindings ( path processed resource output directory , path input resources dir , path data binding info out , string package path , boolean should zip data binding info , boolean use data binding android x ) throws i o exception { if ( data binding info out = = null ) { return input resources dir ; } else if ( ! files is directory ( input resources dir ) ) { / / no resources : no data binding needed create a dummy file to satisfy declared outputs files create file ( data binding info out ) ; return input resources dir ; } / / strip the file name ( the data binding library automatically adds it back in ) / / * * the data binding library assumes this file is called " layout - info zip " * * if ( should zip data binding info ) { data binding info out = data binding info out get parent ( ) ; if ( files not exists ( data binding info out ) ) { files create directory ( data binding info out ) ; } } / / create a directory for the resources , namespaced with the old resource path path processed resource dir = files create directories ( processed resource output directory resolve ( input resources dir is absolute ( ) ? input resources dir get root ( ) relativize ( input resources dir ) : input resources dir ) ) ; process xml options options = new process xml options ( ) ; options set app id ( package path ) ; options set res input ( input resources dir to file ( ) ) ; options set res output ( processed resource dir to file ( ) ) ; options set layout info output ( data binding info out to file ( ) ) ; options set use android x ( use data binding android x ) ; / / whether or not to aggregate data - bound xml files into a single zip options set zip layout info ( should zip data binding info ) ; try { android data binding do run ( options ) ; } catch ( throwable t ) { throw new runtime exception ( t ) ; } return processed resource dir ; }


test that a typedef of a structure can ' t be added to the structure

public void test cyclic dependency problem 3 ( ) { type def type def = create type def ( struct ) ; try { struct add ( type def ) ; assert fail ( " shouldn ' t be able to add a structure typedef to the typedef ' s structure " ) ; } catch ( illegal argument exception e ) { / / should get an exception from adding the struct to itself } try { struct insert ( 0 , type def ) ; assert fail ( " shouldn ' t be able to insert a structure typedef into the typedef ' s structure " ) ; } catch ( illegal argument exception e ) { / / should get an exception from inserting the struct to itself } try { struct replace ( 0 , type def , type def get length ( ) ) ; assert fail ( " shouldn ' t be able to replace a structure component with the structure ' s typedef " ) ; } catch ( illegal argument exception e ) { / / should get an exception from replacing the struct to itself } }


returns the timeout for the cached ssl session objects , in seconds

public abstract long session timeout ( ) ;


thread run method invoke when the jvm shutdown 1 count the invocation times 2 execute the { @ link shutdown hook thread # callback } , and time it

public void run ( ) { synchronized ( this ) { log info ( " shutdown hook was invoked , " + this shutdown times increment and get ( ) + " times " ) ; if ( ! this has shutdown ) { this has shutdown = true ; long begin time = system current time millis ( ) ; try { this callback call ( ) ; } catch ( exception e ) { log error ( " shutdown hook callback invoked failure " , e ) ; } long consuming time total = system current time millis ( ) - begin time ; log info ( " shutdown hook done , consuming time total ( ms ) : " + consuming time total ) ; } } }


adds a to - one relationship to the given target entity using the given given foreign key property ( which belongs to this entity )

public to one add to one ( entity target , property fk property ) { if ( protobuf ) { throw new illegal state exception ( " protobuf entities do not support realtions , currently " ) ; } property [ ] fk properties = { fk property } ; to one to one = new to one ( schema , this , target , fk properties , true ) ; to one relations add ( to one ) ; return to one ; }


add a record to the accumulator , return the append result the append result will contain the future metadata , and flag for whether the appended batch is full or a new batch is created

public record append result append ( topic partition tp , long timestamp , byte [ ] key , byte [ ] value , header [ ] headers , callback callback , long max time to block , boolean abort on new batch , long now ms ) throws interrupted exception { / / we keep track of the number of appending thread to make sure we do not miss batches in / / abort incomplete batches ( ) appends in progress increment and get ( ) ; byte buffer buffer = null ; if ( headers = = null ) headers = record empty headers ; try { / / check if we have an in - progress batch deque < producer batch > dq = get or create deque ( tp ) ; synchronized ( dq ) { if ( closed ) throw new kafka exception ( " producer closed while send in progress " ) ; record append result append result = try append ( timestamp , key , value , headers , callback , dq , now ms ) ; if ( append result ! = null ) return append result ; } / / we don ' t have an in - progress record batch try to allocate a new batch if ( abort on new batch ) { / / return a result that will cause another call to append return new record append result ( null , false , false , true ) ; } byte max usable magic = api versions max usable produce magic ( ) ; int size = math max ( this batch size , abstract records estimate size in bytes upper bound ( max usable magic , compression , key , value , headers ) ) ; log trace ( " allocating a new { } byte message buffer for topic { } partition { } with remaining timeout { } ms " , size , tp topic ( ) , tp partition ( ) , max time to block ) ; buffer = free allocate ( size , max time to block ) ; / / update the current time in case the buffer allocation blocked above now ms = time milliseconds ( ) ; synchronized ( dq ) { / / need to check if producer is closed again after grabbing the dequeue lock if ( closed ) throw new kafka exception ( " producer closed while send in progress " ) ; record append result append result = try append ( timestamp , key , value , headers , callback , dq , now ms ) ; if ( append result ! = null ) { / / somebody else found us a batch , return the one we waited for ! hopefully this doesn ' t happen often return append result ; } memory records builder records builder = records builder ( buffer , max usable magic ) ; producer batch batch = new producer batch ( tp , records builder , now ms ) ; future record metadata future = objects require non null ( batch try append ( timestamp , key , value , headers , callback , now ms ) ) ; dq add last ( batch ) ; incomplete add ( batch ) ; / / don ' t deallocate this buffer in the finally block as it ' s being used in the record batch buffer = null ; return new record append result ( future , dq size ( ) > 1 | | batch is full ( ) , true , false ) ; } } finally { if ( buffer ! = null ) free deallocate ( buffer ) ; appends in progress decrement and get ( ) ; } }


draws a polyline in the xy plane using { @ link shape type # line } the vertices must contain at least 2 points ( 4 floats x , y )

public void polyline ( float [ ] vertices , int offset , int count ) { if ( count < 4 ) throw new illegal argument exception ( " polylines must contain at least 2 points " ) ; if ( count % 2 ! = 0 ) throw new illegal argument exception ( " polylines must have an even number of vertices " ) ; check ( shape type line , null , count ) ; float color bits = color to float bits ( ) ; for ( int i = offset , n = offset + count - 2 ; i < n ; i + = 2 ) { float x 1 = vertices [ i ] ; float y 1 = vertices [ i + 1 ] ; float x 2 ; float y 2 ; x 2 = vertices [ i + 2 ] ; y 2 = vertices [ i + 3 ] ; renderer color ( color bits ) ; renderer vertex ( x 1 , y 1 , 0 ) ; renderer color ( color bits ) ; renderer vertex ( x 2 , y 2 , 0 ) ; } }


void draw ( image image ) { draw ( image , 0 , 0 ) ; }


public byte [ ] get bytes ( string name , byte [ ] default value ) { return map contains key ( name ) ? ( byte [ ] ) map get ( name ) : default value ; }


enter a parse tree produced by { @ link sql base parser # select items }

void enter select items ( sql base parser select items context ctx ) ;


public < t > future < t > submit ( runnable runnable , t result ) { submitted mark ( ) ; return delegate submit ( new instrumented runnable ( runnable ) , result ) ; }


closes { @ code closeable } and if an exception is thrown , it is logged at the warn level

public static void close quietly ( auto closeable closeable , string name ) { if ( closeable ! = null ) { try { closeable close ( ) ; } catch ( throwable t ) { log warn ( " failed to close { } with type { } " , name , closeable get class ( ) get name ( ) , t ) ; } } }


when copying the client , stateful things like the connection pool are shared across all clients

@ test public void clone shares stateful instances ( ) throws exception { ok http client client = client test rule new client ( ) ; / / values should be non - null ok http client a = client new builder ( ) build ( ) ; assert that ( a dispatcher ( ) ) is not null ( ) ; assert that ( a connection pool ( ) ) is not null ( ) ; assert that ( a ssl socket factory ( ) ) is not null ( ) ; assert that ( a x 5 0 9 trust manager ( ) ) is not null ( ) ; / / multiple clients share the instances ok http client b = client new builder ( ) build ( ) ; assert that ( b dispatcher ( ) ) is same as ( a dispatcher ( ) ) ; assert that ( b connection pool ( ) ) is same as ( a connection pool ( ) ) ; assert that ( b ssl socket factory ( ) ) is same as ( a ssl socket factory ( ) ) ; assert that ( b x 5 0 9 trust manager ( ) ) is same as ( a x 5 0 9 trust manager ( ) ) ; }


verify that the listener completes in a reasonable amount of time , and asserts that the future returns the expected data

public void assert success ( object expected data ) throws throwable { / / verify that the listener executed in a reasonable amount of time assert assert true ( count down latch await ( 1l , time unit seconds ) ) ; try { assert assert equals ( expected data , future get ( ) ) ; } catch ( execution exception e ) { throw e get cause ( ) ; } }


returns true if the key was not already in the set if this set already contains the key , the call leaves the set unchanged and returns false

public boolean add ( t key ) { int i = locate key ( key ) ; if ( i > = 0 ) return false ; / / existing key was found i = - ( i + 1 ) ; / / empty space was found key table [ i ] = key ; if ( + + size > = threshold ) resize ( key table length < < 1 ) ; return true ; }


retrieve the { @ linkplain platform transaction manager transaction manager } to use for the supplied { @ linkplain test context test context } the following algorithm is used to retrieve the transaction manager from the { @ link org springframework context application context application context } of the supplied test context : look up the transaction manager by type and explicit name , if the supplied { @ code name } is non - empty , throwing a { @ link beans exception } if the named transaction manager does not exist attempt to look up the transaction manager via a { @ link transaction management configurer } , if present attempt to look up the single transaction manager by type attempt to look up the primary transaction manager by type attempt to look up the transaction manager by type and the { @ linkplain # default transaction manager name default transaction manager name }

public static platform transaction manager retrieve transaction manager ( test context test context , @ nullable string name ) { assert not null ( test context , " test context must not be null " ) ; bean factory bf = test context get application context ( ) get autowire capable bean factory ( ) ; try { / / look up by type and explicit name if ( string utils has text ( name ) ) { return bf get bean ( name , platform transaction manager class ) ; } } catch ( beans exception ex ) { logger error ( string format ( " failed to retrieve transaction manager named ' % s ' for test context % s " , name , test context ) , ex ) ; throw ex ; } try { if ( bf instanceof listable bean factory ) { listable bean factory lbf = ( listable bean factory ) bf ; / / look up single transaction management configurer map < string , transaction management configurer > configurers = bean factory utils beans of type including ancestors ( lbf , transaction management configurer class ) ; assert state ( configurers size ( ) < = 1 , " only one transaction management configurer may exist in the application context " ) ; if ( configurers size ( ) = = 1 ) { transaction manager tm = configurers values ( ) iterator ( ) next ( ) annotation driven transaction manager ( ) ; assert state ( tm instanceof platform transaction manager , ( ) - > " transaction manager specified via transaction management configurer " + " is not a platform transaction manager : " + tm ) ; return ( platform transaction manager ) tm ; } / / look up single bean by type map < string , platform transaction manager > tx mgrs = bean factory utils beans of type including ancestors ( lbf , platform transaction manager class ) ; if ( tx mgrs size ( ) = = 1 ) { return tx mgrs values ( ) iterator ( ) next ( ) ; } try { / / look up single bean by type , with support for ' primary ' beans return bf get bean ( platform transaction manager class ) ; } catch ( beans exception ex ) { log beans exception ( test context , ex , platform transaction manager class ) ; } } / / look up by type and default name return bf get bean ( default transaction manager name , platform transaction manager class ) ; } catch ( beans exception ex ) { log beans exception ( test context , ex , platform transaction manager class ) ; return null ; } }


returns the shard that the explanation is about

public shard id get shard ( ) { return shard routing shard id ( ) ; }


create a { @ link consumer record } with the given topic name and given topic , key , value , and timestamp does not auto advance internally tracked time

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


1 run the pickler script to package all the pending metrics into a single message 2 send the message to graphite 3 clear out the list of metrics

private void write metrics ( ) throws i o exception { if ( metrics size ( ) > 0 ) { try { byte [ ] payload = pickle metrics ( metrics ) ; byte [ ] header = byte buffer allocate ( 4 ) put int ( payload length ) array ( ) ; @ suppress warnings ( " resource " ) output stream output stream = socket get output stream ( ) ; output stream write ( header ) ; output stream write ( payload ) ; output stream flush ( ) ; if ( logger is debug enabled ( ) ) { logger debug ( " wrote { } metrics " , metrics size ( ) ) ; } } catch ( i o exception e ) { this failures + + ; throw e ; } finally { / / if there was an error , we might miss some data for now , drop those on the floor and / / try to keep going metrics clear ( ) ; } } }


public string message ( ) { return message ; }


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 string get name ( ) { return this name ; }


< code > required uint 3 2 month = 2 ; < code >


test the property ' any type prop nullable '

public void any type prop nullable test ( ) { / / todo : test any type prop nullable }


gets a rule context that can be used to register actions and test that they are created correctly takes in a dummy target which will be used to configure the rule context ' s { @ link android configuration }

public rule context get rule context for action testing ( configured target dummy target ) throws exception { rule context dummy = get rule context ( dummy target ) ; extended event handler event handler = new stored event handler ( ) ; sky function environment skyframe env = skyframe executor get sky function environment for testing ( event handler ) ; starlark builtins value starlark builtins value = ( starlark builtins value ) preconditions check not null ( skyframe env get value ( starlark builtins value key ( ) ) ) ; caching analysis environment analysis env = new caching analysis environment ( view get artifact factory ( ) , skyframe executor get action key context ( ) , configured target key builder ( ) set label ( dummy target get label ( ) ) set configuration ( target config ) build ( ) , / * is system env = * / false , target config extended sanity checks ( ) , target config allow analysis failures ( ) , event handler , skyframe env , starlark builtins value ) ; return view get rule context for testing ( event handler , dummy target , analysis env , new build configuration collection ( immutable list of ( dummy get configuration ( ) ) , dummy get host configuration ( ) ) ) ; }


return true if this method call does need to be synced , false otherwise sync meaning server state needs to have caught up with client state

boolean is coordinated call ( string protocol name , string method ) ;


protected synchronized void set state ( state state ) { this run state = state ; }


refreshes the displayed diff details for the indicated program location address

void refresh details ( program location p 1 location ) { if ( p 1 location = = null ) { return ; } current location = p 1 location ; update manager update ( ) ; }


creates a new { @ link resource leak tracker } which is expected to be closed via { @ link resource leak tracker # close ( object ) } when the related resource is deallocated

public final resource leak tracker < t > track ( t obj ) { return track 0 ( obj ) ; }


set the jdbc template for this dao explicitly , as an alternative to specifying a data source

public final void set jdbc template ( @ nullable jdbc template jdbc template ) { this jdbc template = jdbc template ; init template config ( ) ; }


creates new file text content for the given fully qualified name

public string create file content ( string fqn ) { final pair < string , string > content = component generate service get instance ( ) create litho file content ( component f q n to spec get ( fqn ) ) ; if ( content = = null ) return null ; return content second ; }


applies this function to the given arguments


check if at least one permission in the list of denied permissions has been permanently denied ( user clicked " never ask again " ) < b > note < b > : due to a limitation in the information provided by the android framework permissions api , this method only works after the permission has been denied and your app has received the on permissions denied callback otherwise the library cannot distinguish permanent denial from the " not yet denied " case

public static boolean some permission permanently denied ( @ non null activity host , @ non null list < string > denied permissions ) { return permission helper new instance ( host ) some permission permanently denied ( denied permissions ) ; }


public void unimplemented call ( io grpc testing integration empty protos empty request , io grpc stub stream observer < io grpc testing integration empty protos empty > response observer ) { io grpc stub client calls async unary call ( get channel ( ) new call ( get unimplemented call method ( ) , get call options ( ) ) , request , response observer ) ; }


gets the type associated with this instance


sets the maximum number of buttons that can be checked set to - 1 for no maximum default is 1

public void set max check count ( int max check count ) { if ( max check count = = 0 ) max check count = - 1 ; this max check count = max check count ; }


get storeinventory : returns pet inventories by status returns a map of status codes to quantities

response entity < map < string , integer > > get inventory ( ) ;


performs the load , returning on completion or cancellation


override the default jackson smile { @ code decoder } note that { @ link # max in memory size ( int ) } , if configured , will be applied to the given decoder

void jackson 2 smile decoder ( decoder < ? > decoder ) ;


ensure the host incremental mount ouput ' s bounds are containing the bounds of this item

private static void ensure host bounds ( final incremental mount output child , final @ nullable incremental mount output host ) { if ( host = = null ) { return ; } final rect child bounds = child get bounds ( ) ; final rect host bounds = host get bounds ( ) ; boolean needs update = false ; if ( child bounds top < host bounds top ) { maybe cache original bounds ( host ) ; host bounds top = child bounds top ; needs update = true ; } if ( child bounds bottom > host bounds bottom ) { maybe cache original bounds ( host ) ; host bounds bottom = child bounds bottom ; needs update = true ; } if ( child bounds left < host bounds left ) { maybe cache original bounds ( host ) ; host bounds left = child bounds left ; needs update = true ; } if ( child bounds right > host bounds right ) { maybe cache original bounds ( host ) ; host bounds right = child bounds right ; needs update = true ; } if ( needs update ) { ensure host bounds ( host , host get host output ( ) ) ; } }


{ @ link audio track # get playback head position ( ) } returns a value intended to be interpreted as an unsigned 32 bit integer , which also wraps around periodically this method returns the playback head position as a long that will only wrap around if the value exceeds { @ link long # max value } ( which in practice will never happen )

private long get playback head position ( ) { audio track audio track = assertions check not null ( this audio track ) ; if ( stop timestamp us ! = c time unset ) { / / simulate the playback head position up to the total number of frames submitted long elapsed time since stop us = ( system clock elapsed realtime ( ) * 1000 ) - stop timestamp us ; long frames since stop = ( elapsed time since stop us * output sample rate ) / c micros per second ; return min ( end playback head position , stop playback head position + frames since stop ) ; } int state = audio track get play state ( ) ; if ( state = = playstate stopped ) { / / the audio track hasn ' t been started return 0 ; } long raw playback head position = 0x f f f f f f f f l & audio track get playback head position ( ) ; if ( needs passthrough workarounds ) { / / work around an issue with passthrough / direct audio tracks on platform api versions 21 / 22 / / where the playback head position jumps back to zero on paused passthrough / direct audio / / tracks see [ internal : b / 19187573 ] if ( state = = playstate paused & & raw playback head position = = 0 ) { passthrough workaround pause offset = last raw playback head position ; } raw playback head position + = passthrough workaround pause offset ; } if ( util sdk int < = 29 ) { if ( raw playback head position = = 0 & & last raw playback head position > 0 & & state = = playstate playing ) { / / if connecting a bluetooth audio device fails , the audio track may be left in a state / / where its java api is in the playing state , but the native track is stopped when this / / happens the playback head position gets stuck at zero in this case , return the old / / playback head position and force the track to be reset after / / { @ link # force reset workaround timeout ms } has elapsed if ( force reset workaround time ms = = c time unset ) { force reset workaround time ms = system clock elapsed realtime ( ) ; } return last raw playback head position ; } else { force reset workaround time ms = c time unset ; } } if ( last raw playback head position > raw playback head position ) { / / the value must have wrapped around raw playback head wrap count + + ; } last raw playback head position = raw playback head position ; return raw playback head position + ( raw playback head wrap count < < 32 ) ; }


guaranteed to throw an exception and leave the { @ code range set } unmodified

public void add all ( range set < c > other ) { throw new unsupported operation exception ( ) ; }


post storeorder : place an order for a pet

default response entity < order > place order ( @ api param ( value = " order placed for purchasing the pet " , required = true ) @ valid @ request body order body ) { return get delegate ( ) place order ( body ) ; }


public synchronized void save ( ) throws i o exception { if ( bulk change contains ( this ) ) return ; get config file ( ) write ( this ) ; saveable listener fire on change ( this , get config file ( ) ) ; }


execute a python file using this interpreter

public synchronized void exec file ( resource file file , python script script ) throws illegal state exception { if ( cleaned up ) { throw new illegal state exception ( " ghidra python interpreter has already been cleaned up " ) ; } inject script hierarchy ( script ) ; py get thread state ( ) tracefunc = interrupt trace function ; / / if the remote python debugger is alive , initialize it by calling settrace ( ) if ( ! system utilities is in development mode ( ) & & ! system utilities is in headless mode ( ) ) { if ( py dev utils get py dev src dir ( ) ! = null ) { try { inet address localhost = inet address get local host ( ) ; new socket ( localhost , py dev utils pydev remote debugger port ) close ( ) ; msg info ( this , " python debugger found " ) ; exec ( " import pydevd ; pydevd settrace ( host = \ " " + localhost get host name ( ) + " \ " , port = " + py dev utils pydev remote debugger port + " , suspend = false ) ; " ) ; msg info ( this , " connected to a python debugger " ) ; } catch ( i o exception e ) { msg info ( this , " not connected to a python debugger " ) ; } } } / / run python file execfile ( file get absolute path ( ) ) ; }


for this test , the body for this request much reference a schema named & # x 6 0 ; file & # x 6 0 ;

public single < void > rx test body with file schema ( file schema test class body ) { return single create ( new io vertx rx java single on subscribe adapter < > ( fut - > delegate test body with file schema ( body , fut ) ) ) ; }


create a sorted ( tree ) map from an unsorted map this incurs the cost of creating a map and that of inserting every object into the tree

private static < e > map < string , e > sorted map ( final map < string , e > source , final predicate < e > is empty ) { map < string , e > tm = new tree map < > ( ) ; for ( map entry < string , e > entry : source entry set ( ) ) { if ( ! is empty test ( entry get value ( ) ) ) { tm put ( entry get key ( ) , entry get value ( ) ) ; } } return tm ; }


records the failed load of a new entry this should be called when a cache request causes an entry to be loaded , but an exception is thrown while loading the entry in contrast to { @ link # record misses } , this method should only be called by the loading thread

void record load exception ( long load time ) ;


public void test process execution ( ) throws exception { assume true ( " test requires security manager " , system get security manager ( ) ! = null ) ; try { runtime get runtime ( ) exec ( " ls " ) ; fail ( " didn ' t get expected exception " ) ; } catch ( security exception expected ) { } }


gets a new address set indicating all addresses of the indicated memory type in the specified program

public static address set get address set ( program program , boolean blocks with bytes ) { memory block [ ] mem blocks = program memory util get mem blocks ( program , blocks with bytes ) ; address set addr set = new address set ( ) ; for ( memory block block : mem blocks ) { addr set add ( block get start ( ) , block get end ( ) ) ; } return addr set ; }


it is possible to get the token count in a search response

public void test search returns token count ( ) throws i o exception { init ( ) ; assert search returns ( search by id ( " single " ) , " single " ) ; assert search returns ( search by id ( " bulk 1 " ) , " bulk 1 " ) ; assert search returns ( search by id ( " bulk 2 " ) , " bulk 2 " ) ; assert search returns ( search by id ( " multi " ) , " multi " ) ; assert search returns ( search by id ( " multibulk 1 " ) , " multibulk 1 " ) ; assert search returns ( search by id ( " multibulk 2 " ) , " multibulk 2 " ) ; }


public void set heap usage ( long usage ) { heap usage = usage ; }


public static int parse ttml color ( string color expression ) { return parse color internal ( color expression , false ) ; }


modify configuration according user - specified generic options

private void process general options ( command line line ) throws i o exception { if ( line has option ( " fs " ) ) { file system set default uri ( conf , line get option value ( " fs " ) ) ; } if ( line has option ( " jt " ) ) { string option value = line get option value ( " jt " ) ; if ( option value equals ignore case ( " local " ) ) { conf set ( " mapreduce framework name " , option value ) ; } conf set ( " yarn resourcemanager address " , option value , " from - jt command line option " ) ; } if ( line has option ( " conf " ) ) { string [ ] values = line get option values ( " conf " ) ; for ( string value : values ) { conf add resource ( new path ( value ) ) ; } } if ( line has option ( ' d ' ) ) { string [ ] property = line get option values ( ' d ' ) ; for ( string prop : property ) { string [ ] keyval = prop split ( " = " , 2 ) ; if ( keyval length = = 2 ) { conf set ( keyval [ 0 ] , keyval [ 1 ] , " from command line " ) ; } } } if ( line has option ( " libjars " ) ) { / / for libjars , we allow expansion of wildcards conf set ( " tmpjars " , validate files ( line get option value ( " libjars " ) , true ) , " from - libjars command line option " ) ; / / setting libjars in client classpath url [ ] libjars = get lib jars ( conf ) ; if ( libjars ! = null & & libjars length > 0 ) { conf set class loader ( new u r l class loader ( libjars , conf get class loader ( ) ) ) ; thread current thread ( ) set context class loader ( new u r l class loader ( libjars , thread current thread ( ) get context class loader ( ) ) ) ; } } if ( line has option ( " files " ) ) { conf set ( " tmpfiles " , validate files ( line get option value ( " files " ) ) , " from - files command line option " ) ; } if ( line has option ( " archives " ) ) { conf set ( " tmparchives " , validate files ( line get option value ( " archives " ) ) , " from - archives command line option " ) ; } conf set boolean ( " mapreduce client genericoptionsparser used " , true ) ; / / tokens file if ( line has option ( " token cache file " ) ) { string file name = line get option value ( " token cache file " ) ; / / check if the local file exists file system local fs = file system get local ( conf ) ; path p = local fs make qualified ( new path ( file name ) ) ; local fs get file status ( p ) ; if ( log is debug enabled ( ) ) { log debug ( " setting conf tokens file : " + file name ) ; } user group information get current user ( ) add credentials ( credentials read token storage file ( p , conf ) ) ; conf set ( " mapreduce job credentials binary " , p to string ( ) , " from - token cache file command line option " ) ; } }


returns the key groups which this state backend is responsible for

key group range get key group range ( ) ;


called by { @ link spatial index builder operator } to provide a { @ link supplier } of spatial indexes for { @ link spatial join operator } s to use returns a future that completes once all the { @ link spatial join operator } s have completed

public listenable future < ? > lend pages spatial index ( supplier < pages spatial index > pages spatial index ) { require non null ( pages spatial index , " pages spatial index is null " ) ; if ( active probe operators get free future ( ) is done ( ) ) { return not blocked ; } list < settable future < pages spatial index > > settable futures ; synchronized ( this ) { verify ( this pages spatial index = = null ) ; this pages spatial index = pages spatial index ; settable futures = immutable list copy of ( pages spatial index futures ) ; pages spatial index futures clear ( ) ; } for ( settable future < pages spatial index > settable future : settable futures ) { settable future set ( pages spatial index get ( ) ) ; } return active probe operators get free future ( ) ; }


set the value of the < code > name < code > property to the given type this is equivalent to < code > set ( & lt ; name & gt ; , value to string ( ) ) < code >

public < t extends enum < t > > void set enum ( string name , t value ) { set ( name , value to string ( ) ) ; }


public int get flags ( ) { return flags ; }


get the process id of the c + + process whose log messages are being read this will arrive in the first log message logged by the c + + process they all log a copyright message immediately on startup so it should not take long to arrive , but will not be available instantly after the process starts

public string get cpp copyright ( duration timeout ) throws timeout exception { if ( cpp copyright = = null ) { try { cpp copyright latch await ( timeout to millis ( ) , time unit milliseconds ) ; } catch ( interrupted exception e ) { thread current thread ( ) interrupt ( ) ; } if ( cpp copyright = = null ) { throw new timeout exception ( " timed out waiting for c + + process copyright " ) ; } } return cpp copyright ; }


shut down the embedded database instance that backs the supplied { @ link data source }

void shutdown ( data source data source , string database name ) ;


split the given text into parts where the returned list contains either a string or an annotation

private static list < object > do parse text into text and annotations ( string text , function < annotation , annotation > fixer upper , program program , attributed string prototype ) { list < object > results = new array list < > ( ) ; list < word location > annotations = get comment annotations ( text ) ; if ( annotations is empty ( ) ) { results add ( text ) ; return results ; } / / split the text into pieces of normal text and annotated int offset = 0 ; for ( word location word : annotations ) { int start = word get start ( ) ; if ( offset ! = start ) { / / text between annotations string preceeding = text substring ( offset , start ) ; results add ( preceeding ) ; } string annotation text = word get word ( ) ; annotation annotation = new annotation ( annotation text , prototype , program ) ; annotation = fixer upper apply ( annotation ) ; results add ( annotation ) ; offset = start + annotation text length ( ) ; } if ( offset ! = text length ( ) ) { / / trailing text results add ( text substring ( offset ) ) ; } return results ; }


return the target class behind the implementing object ( typically a proxy configuration or an actual proxy )


public attribute filters build ( ) { return new attribute filters ( this ) ; }


return the set of allowed { @ link http method http methods } , as specified by the { @ code allow } header returns an empty set when the allowed methods are unspecified

public set < http method > get allow ( ) { string value = get first ( allow ) ; if ( string utils has length ( value ) ) { string [ ] tokens = string utils tokenize to string array ( value , " , " ) ; list < http method > result = new array list < > ( tokens length ) ; for ( string token : tokens ) { http method resolved = http method resolve ( token ) ; if ( resolved ! = null ) { result add ( resolved ) ; } } return enum set copy of ( result ) ; } else { return enum set none of ( http method class ) ; } }


configure options related to the processing of messages received from and sent to web socket clients

default void configure web socket transport ( web socket transport registration registry ) { }


asynchronously fulfills the request into the specified { @ link remote views } object with the given { @ code view id } this is used for loading bitmaps into a { @ link notification }

public void into ( @ non null remote views remote views , @ id res int view id , int notification id , @ non null notification notification ) { into ( remote views , view id , notification id , notification , null ) ; }


optional : if specified , only support the specified cipher list otherwise default to the default cipher list supported by envoy < code > repeated string cipher suites = 9 ; < code >

public java lang string get cipher suites ( int index ) { return cipher suites get ( index ) ; }


compares the two specified { @ code float } values using { @ link float # compare ( float , float ) } you may prefer to invoke that method directly ; this method exists only for consistency with the other utilities in this package < b > note : < b > this method simply delegates to the jdk method { @ link float # compare } it is provided for consistency with the other primitive types , whose compare methods were not added to the jdk until jdk 7

public static int compare ( float a , float b ) { return float compare ( a , b ) ; }


returns true if the set has one or more items

public boolean not empty ( ) { return size > 0 ; }


sets the current collector which is used to emit the final result

public void set collector ( collector < t > collector ) { this collector = collector ; }


returns a human readable string representing the path from the root of the json object graph to this value

public string trace ( ) { if ( parent = = null ) { if ( type = = value type array ) return " [ ] " ; if ( type = = value type object ) return " { } " ; return " " ; } string trace ; if ( parent type = = value type array ) { trace = " [ ] " ; int i = 0 ; for ( json value child = parent child ; child ! = null ; child = child next , i + + ) { if ( child = = this ) { trace = " [ " + i + " ] " ; break ; } } } else if ( name index of ( ' ' ) ! = - 1 ) trace = " \ " " + name replace ( " \ " " , " \ \ \ " " ) + " \ " " ; else trace = ' ' + name ; return parent trace ( ) + trace ; }


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

default response entity < void > update pet with form ( long pet id , string name , string status ) { return new response entity < > ( http status not implemented ) ; }


returns the value of this { @ code unsigned long } as a { @ code float } , analogous to a widening primitive conversion from { @ code long } to { @ code float } , and correctly rounded

public float float value ( ) { @ suppress warnings ( " cast " ) float f value = ( float ) ( value & unsigned mask ) ; if ( value < 0 ) { f value + = 0x 1 0p 6 3f ; } return f value ; }


removes the ( local ) variables and creates a new { @ link historic variable update } for each of them


return a merged properties instance containing both the loaded properties and properties set on this factory bean

protected properties merge properties ( ) throws i o exception { properties result = new properties ( ) ; if ( this local override ) { / / load properties from file upfront , to let local properties override load properties ( result ) ; } if ( this local properties ! = null ) { for ( properties local prop : this local properties ) { collection utils merge properties into map ( local prop , result ) ; } } if ( ! this local override ) { / / load properties from file afterwards , to let those properties override load properties ( result ) ; } return result ; }


find a { @ code content negotiation strategy } of the given type

public < t extends content negotiation strategy > t get strategy ( class < t > strategy type ) { for ( content negotiation strategy strategy : get strategies ( ) ) { if ( strategy type is instance ( strategy ) ) { return ( t ) strategy ; } } return null ; }


creates a converter for mapping between flink ' s internal data structures and objects specified by the given { @ link data type } that can be passed into a runtime implementation for example , { @ link row data } and its fields can be converted into a { @ link row } , or the internal representation for structured types can be converted back into the original ( possibly nested ) pojo

data structure converter create data structure converter ( data type consumed data type ) ;


load a string as the java version of a json type , either list ( json array ) , map ( json object ) , number , boolean or string

public static object load ( string json ) throws i o exception { x content parser parser = json x content json x content create parser ( named x content registry empty , deprecation handler throw unsupported operation , json ) ; switch ( parser next token ( ) ) { case start array : return parser list ( ) ; case start object : return parser map ( ) ; case value number : return parser number value ( ) ; case value boolean : return parser boolean value ( ) ; case value string : return parser text ( ) ; default : return null ; } }


public application id get application id ( ) { return this application id ; }


force bakes the given translog generation as recovery information in the lucene index this is used when recovering from a snapshot or peer file based recovery where a new empty translog is created and the existing lucene index needs should be changed to use it

public void associate index with new translog ( final string translog u u i d ) throws i o exception { metadata lock write lock ( ) lock ( ) ; try ( index writer writer = new appending index writer ( directory , null ) ) { if ( translog u u i d equals ( get user data ( writer ) get ( translog translog uuid key ) ) ) { throw new illegal argument exception ( " a new translog uuid can ' t be equal to existing one got [ " + translog u u i d + " ] " ) ; } update commit data ( writer , map of ( translog translog uuid key , translog u u i d ) ) ; } finally { metadata lock write lock ( ) unlock ( ) ; } }


updates { @ link # required classpath } to include dependencies from the given output artifact

private void collect dependencies from artifact ( path path ) throws i o exception { try ( buffered input stream bis = new buffered input stream ( files new input stream ( path ) ) ) { dependencies deps = dependencies parse from ( bis ) ; / / quick check to make sure we have a valid proto if ( ! deps has rule label ( ) ) { throw new i o exception ( " could not parse deps dependencies message from proto " ) ; } for ( dependency dep : deps get dependency list ( ) ) { if ( dep get kind ( ) = = kind explicit | | dep get kind ( ) = = kind implicit | | dep get kind ( ) = = kind incomplete ) { required classpath add ( paths get ( dep get path ( ) ) ) ; } } } catch ( i o exception e ) { throw new i o exception ( string format ( " error reading deps artifact : % s " , path ) , e ) ; } }


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


if this method is not called , the { @ link # default timeout } will be used

public http request builder timeout ( int time out ) { validate ( ) ; http request set time out ( time out ) ; return this ; }


verifies that if apple binary a depends on a dylib b1 which then depends on a dylib b2 , that the symbols from b2 are not present in a

public void check avoid deps through dylib ( rule type rule type ) throws exception { rule type scratch target ( scratch , " deps " , " [ ' / / package : objc lib ' ] " , " dylibs " , " [ ' / / package : dylib 1 ' ] " ) ; scratch framework starlark stub ( " frameworkstub / framework stub bzl " ) ; scratch file ( " package / build " , " load ( ' / / frameworkstub : framework stub bzl ' , ' framework stub rule ' ) " , " objc library ( name = ' objc lib ' , srcs = [ ' objc lib m ' ] , " , " deps = [ ' : dylib 1 lib ' , ' : dylib 2 lib ' ] ) " , " objc library ( name = ' dylib 1 lib ' , srcs = [ ' dylib 1 lib m ' ] ) " , " objc library ( name = ' dylib 2 lib ' , srcs = [ ' dylib 2 lib m ' ] ) " , " framework stub rule ( name = ' dylib 1 ' , binary = ' : dylib 1 binary ' ) " , " apple binary ( name = ' dylib 1 binary ' , binary type = ' dylib ' , " , " platform type = ' ios ' , " , " deps = [ ' : dylib 1 lib ' ] , dylibs = [ ' / / package : dylib 2 ' ] ) " , " framework stub rule ( name = ' dylib 2 ' , binary = ' : dylib 2 binary ' ) " , " apple binary ( name = ' dylib 2 binary ' , binary type = ' dylib ' , " , " platform type = ' ios ' , " , " deps = [ ' : dylib 2 lib ' ] ) " , " apple binary ( name = ' alternate ' , " , " platform type = ' ios ' , " , " deps = [ ' / / package : objc lib ' ] ) " ) ; action lipobin action = lipo bin action ( " / / x : x " ) ; artifact bin artifact = get first artifact ending with ( lipobin action get inputs ( ) , " x / x bin " ) ; action link action = get generating action ( bin artifact ) ; assert that ( get first artifact ending with ( link action get inputs ( ) , " package / lib objc lib a " ) ) is not null ( ) ; assert that ( get first artifact ending with ( link action get inputs ( ) , " package / lib dylib 1 lib a " ) ) is null ( ) ; assert that ( get first artifact ending with ( link action get inputs ( ) , " package / lib dylib 2 lib a " ) ) is null ( ) ; / / check that the identical binary without dylibs would be fully linked action alternate lipobin action = lipo bin action ( " / / package : alternate " ) ; artifact alternate bin artifact = get first artifact ending with ( alternate lipobin action get inputs ( ) , " package / alternate bin " ) ; action alternate link action = get generating action ( alternate bin artifact ) ; assert that ( get first artifact ending with ( alternate link action get inputs ( ) , " package / lib objc lib a " ) ) is not null ( ) ; assert that ( get first artifact ending with ( alternate link action get inputs ( ) , " package / lib dylib 1 lib a " ) ) is not null ( ) ; assert that ( get first artifact ending with ( alternate link action get inputs ( ) , " package / lib dylib 2 lib a " ) ) is not null ( ) ; }


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


returns true if the target { @ code from } is visible to the target { @ code to }

public static < t > boolean visible ( query expression caller , query environment < t > env , t to , t from ) throws query exception , interrupted exception { set < query visibility < t > > visible packages = env get accessor ( ) get visibility ( caller , from ) ; for ( query visibility < t > spec : visible packages ) { if ( spec contains ( to ) ) { return true ; } } return false ; }


protected map < string , list < object > > resolve attributes from principal attribute repository ( final principal principal , final registered service registered service ) { val repository = object utils default if null ( this principal attributes repository , get principal attributes repository from application context ( ) ) ; if ( repository ! = null ) { logger debug ( " using principal attribute repository [ { } ] to retrieve attributes " , repository ) ; return repository get attributes ( principal , registered service ) ; } return principal get attributes ( ) ; }


commit block ' s length and generation stamp as reported by the client set block state to { @ link block u c state # committed }

list < replica under construction > commit block ( block block ) throws i o exception { if ( get block id ( ) ! = block get block id ( ) ) { throw new i o exception ( " trying to commit inconsistent block : id = " + block get block id ( ) + " , expected id = " + get block id ( ) ) ; } preconditions check state ( ! is complete ( ) ) ; uc commit ( ) ; this set num bytes ( block get num bytes ( ) ) ; / / sort out invalid replicas return set generation stamp and verify replicas ( block get generation stamp ( ) ) ; }


gets a local vector given a world vector note that the same vector 2 instance is returned each time this method is called

public vector 2 get local vector ( vector 2 world vector ) { jni get local vector ( addr , world vector x , world vector y , tmp ) ; local vector x = tmp [ 0 ] ; local vector y = tmp [ 1 ] ; return local vector ; }


closes current { @ link strings segment } and adds a { @ link reference segment } to the store

segment mapper adopt ( fully qualified name adopted key ) { segment store put ( segment key , new strings segment ( current lines ) ) ; adopted add ( adopted key ) ; segment store put ( segment key , new reference segment ( adopted key , segment store ) ) ; current lines = new array list < > ( ) ; return this ; }


public < t extends socket address > t proxy address ( ) { return ( t ) proxy address ; }


get the job i d of the slot requested for

public job i d get job id ( ) { return job id ; }


set the handler exception resolver types to use this is delegated to { @ link standalone mock mvc builder # set handler exception resolvers ( handler exception resolver ) }

controller spec handler exception resolvers ( handler exception resolver exception resolvers ) ;


assign preempted containers to the applications that have reserved resources for preempted containers

static void assign preempted containers ( f s scheduler node node ) { for ( entry < f s app attempt , resource > entry : node get preemption list ( ) entry set ( ) ) { f s app attempt app = entry get key ( ) ; resource preemption pending = resources clone ( entry get value ( ) ) ; while ( ! app is stopped ( ) & & ! resources is none ( preemption pending ) ) { resource assigned = app assign container ( node ) ; if ( resources is none ( assigned ) | | assigned equals ( fair scheduler container reserved ) ) { / / fail to assign , let ' s not try further break ; } resources subtract from non negative ( preemption pending , assigned ) ; } } }


append to an existing file in the namespace

last block with status append file ( string src arg , string holder , string client machine , enum set < create flag > flag , boolean log retry cache ) throws i o exception { final string operation name = " append " ; boolean new block = flag contains ( create flag new block ) ; if ( new block ) { require effective layout version for feature ( feature append new block ) ; } name node state change log debug ( " dir * name system append file : src = { } , holder = { } , client machine = { } " , src arg , holder , client machine ) ; try { boolean skip sync = false ; last block with status lbs = null ; check operation ( operation category write ) ; final f s permission checker pc = get permission checker ( ) ; f s permission checker set operation type ( operation name ) ; write lock ( ) ; try { check operation ( operation category write ) ; check name node safe mode ( " cannot append to file " + src arg ) ; lbs = f s dir append op append file ( this , src arg , pc , holder , client machine , new block , log retry cache ) ; } catch ( standby exception se ) { skip sync = true ; throw se ; } finally { write unlock ( operation name , get lock report info supplier ( src arg ) ) ; / / there might be transactions logged while trying to recover the lease / / they need to be sync ' ed even when an exception was thrown if ( ! skip sync ) { get edit log ( ) log sync ( ) ; } } log audit event ( true , operation name , src arg ) ; return lbs ; } catch ( access control exception e ) { log audit event ( false , operation name , src arg ) ; throw e ; } }


add an entry to the directory listing if this listing already contains a { @ code file status } with the same path , it will be replaced

public boolean put ( path metadata child path metadata ) { preconditions check not null ( child path metadata , " child path metadata must be non - null " ) ; final s 3 a file status file status = child path metadata get file status ( ) ; path child path = child status to path key ( file status ) ; path metadata new value = child path metadata ; path metadata old value = list map put ( child path , child path metadata ) ; return old value = = null | | ! old value equals ( new value ) ; }


public static double check arg ( double arg , boolean expression , object msg ) { if ( ! expression ) { throw new illegal argument exception ( string value of ( msg ) + " : " + arg ) ; } return arg ; }


public start message deployed event impl build ( ) { return new start message deployed event impl ( this ) ; }


returns { @ code true } if one of the global blocks as its disable state persistence flag set

public boolean disable state persistence ( ) { for ( cluster block cluster block : global ) { if ( cluster block disable state persistence ( ) ) { return true ; } } return false ; }


public cors configuration get cors configuration ( http servlet request request ) { return this cors configuration ; }


static resource estimator server start resource estimator server ( ) throws i o exception , interrupted exception { configuration config = new yarn configuration ( ) ; config add resource ( resource estimator configuration config file ) ; resource estimator server resource estimator server = null ; try { resource estimator server = new resource estimator server ( ) ; shutdown hook manager get ( ) add shutdown hook ( new composite service shutdown hook ( resource estimator server ) , 30 ) ; resource estimator server init ( config ) ; resource estimator server start ( ) ; } catch ( throwable t ) { logger error ( " error starting resource estimator server " , t ) ; } return resource estimator server ; }


returns the value of the given { @ code int } as a { @ code long } , when treated as unsigned < b > java 8 users : < b > use { @ link integer # to unsigned long ( int ) } instead

public static long to long ( int value ) { return value & int mask ; }


public scripted metric aggregation builder reduce script ( script reduce script ) { if ( reduce script = = null ) { throw new illegal argument exception ( " [ reduce script ] must not be null : [ " + name + " ] " ) ; } this reduce script = reduce script ; return this ; }


async observable and semaphore isolation with functioning request context use hystrix context scheduler to make the user provided scheduler capture context

public void test short circuited with fallback request context with thread isolated asynchronous observable and captured context scheduler ( ) { request context test results results = test request context on short circuited with fallback ( execution isolation strategy thread , new hystrix context scheduler ( schedulers new thread ( ) ) ) ; assert true ( results is context initialized get ( ) ) ; / / the user scheduler captures context assert true ( results origin thread get ( ) get name ( ) starts with ( " rx new thread " ) ) ; / / the user provided thread / scheduler assert true ( results is context initialized observe on get ( ) ) ; / / the user scheduler captures context assert true ( results observe on thread get ( ) get name ( ) starts with ( " rx new thread " ) ) ; / / the user provided thread / scheduler from get fallback / / thread isolated but rejected so not executed in a thread assert false ( results command is executed in thread ( ) ) ; }


perform the operation that a shutdown hook would have

public void delete temporary files ( ) { if ( ! should reap ( ) ) { return ; } for ( file file : temporary files ) { try { file handler delete ( file ) ; } catch ( unchecked i o exception ignore ) { / / ignore ; an interrupt will already have been logged } } }


serialize the key , value to intermediate storage when this method returns , kvindex must refer to sufficient unused storage to store one metadata

public synchronized void collect ( k key , v value , final int partition ) throws i o exception { reporter progress ( ) ; if ( key get class ( ) ! = key class ) { throw new i o exception ( " type mismatch in key from map : expected " + key class get name ( ) + " , received " + key get class ( ) get name ( ) ) ; } if ( value get class ( ) ! = val class ) { throw new i o exception ( " type mismatch in value from map : expected " + val class get name ( ) + " , received " + value get class ( ) get name ( ) ) ; } if ( partition < 0 | | partition > = partitions ) { throw new i o exception ( " illegal partition for " + key + " ( " + partition + " ) " ) ; } check spill exception ( ) ; buffer remaining - = metasize ; if ( buffer remaining < = 0 ) { / / start spill if the thread is not running and the soft limit has been / / reached spill lock lock ( ) ; try { do { if ( ! spill in progress ) { final int kvbidx = 4 * kvindex ; final int kvbend = 4 * kvend ; / / serialized , unspilled bytes always lie between kvindex and / / bufindex , crossing the equator note that any void space / / created by a reset must be included in " used " bytes final int b used = distance to ( kvbidx , bufindex ) ; final boolean bufsoftlimit = b used > = soft limit ; if ( ( kvbend + metasize ) % kvbuffer length ! = equator - ( equator % metasize ) ) { / / spill finished , reclaim space reset spill ( ) ; buffer remaining = math min ( distance to ( bufindex , kvbidx ) - 2 * metasize , soft limit - b used ) - metasize ; continue ; } else if ( bufsoftlimit & & kvindex ! = kvend ) { / / spill records , if any collected ; check latter , as it may / / be possible for metadata alignment to hit spill pcnt start spill ( ) ; final int avg rec = ( int ) ( map output byte counter get counter ( ) / map output record counter get counter ( ) ) ; / / leave at least half the split buffer for serialization data / / ensure that kvindex > = bufindex final int distkvi = distance to ( bufindex , kvbidx ) ; final int new pos = ( bufindex + math max ( 2 * metasize - 1 , math min ( distkvi / 2 , distkvi / ( metasize + avg rec ) * metasize ) ) ) % kvbuffer length ; set equator ( new pos ) ; bufmark = bufindex = new pos ; final int ser bound = 4 * kvend ; / / bytes remaining before the lock must be held and limits / / checked is the minimum of three arcs : the metadata space , the / / serialization space , and the soft limit buffer remaining = math min ( / / metadata max distance to ( bufend , new pos ) , math min ( / / serialization max distance to ( new pos , ser bound ) , / / soft limit soft limit ) ) - 2 * metasize ; } } } while ( false ) ; } finally { spill lock unlock ( ) ; } } try { / / serialize key bytes into buffer int keystart = bufindex ; key serializer serialize ( key ) ; if ( bufindex < keystart ) { / / wrapped the key ; must make contiguous bb shift buffered key ( ) ; keystart = 0 ; } / / serialize value bytes into buffer final int valstart = bufindex ; val serializer serialize ( value ) ; / / it ' s possible for records to have zero length , i e the serializer / / will perform no writes to ensure that the boundary conditions are / / checked and that the kvindex invariant is maintained , perform a / / zero - length write into the buffer the logic monitoring this could be / / moved into collect , but this is cleaner and inexpensive for now , it / / is acceptable bb write ( b 0 , 0 , 0 ) ; / / the record must be marked after the preceding write , as the metadata / / for this record are not yet written int valend = bb mark record ( ) ; map output record counter increment ( 1 ) ; map output byte counter increment ( distance to ( keystart , valend , bufvoid ) ) ; / / write accounting info kvmeta put ( kvindex + partition , partition ) ; kvmeta put ( kvindex + keystart , keystart ) ; kvmeta put ( kvindex + valstart , valstart ) ; kvmeta put ( kvindex + vallen , distance to ( valstart , valend ) ) ; / / advance kvindex kvindex = ( kvindex - nmeta + kvmeta capacity ( ) ) % kvmeta capacity ( ) ; } catch ( map buffer too small exception e ) { log info ( " record too large for in - memory buffer : " + e get message ( ) ) ; spill single record ( key , value , partition ) ; map output record counter increment ( 1 ) ; return ; } }


get a plugin bundle using the supplied locale and class loader

private static @ check for null resource bundle get bundle ( @ non null string base name , @ non null locale locale , @ non null class loader class loader ) { try { return resource bundle get bundle ( base name , locale , class loader ) ; } catch ( missing resource exception e ) { / / fall through and return null logger finer ( e get message ( ) ) ; } return null ; }


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


this case will cost several minutes , which causes ci very slow , so it only runs when - d alarm core test = true existed

public void test trigger time point ( ) throws interrupted exception { string test = system get property ( " alarm core test " ) ; if ( test = = null ) { return ; } rules empty rules = new rules ( ) ; empty rules set rules ( new array list < > ( 0 ) ) ; empty rules set webhooks ( new array list < > ( 0 ) ) ; alarm core core = new alarm core ( new alarm rules watcher ( empty rules , null ) ) ; map < string , list < running rule > > running context = whitebox get internal state ( core , " running context " ) ; list < running rule > rules = new array list < > ( 1 ) ; running rule mock rule = power mockito mock ( running rule class ) ; list < local date time > check time = new linked list < > ( ) ; final boolean [ ] is add = { true } ; power mockito do answer ( new answer < object > ( ) { @ override public object answer ( invocation on mock mock ) throws throwable { if ( is add [ 0 ] ) { check time add ( local date time now ( ) ) ; } return new array list < > ( 0 ) ; } } ) when ( mock rule ) check ( ) ; rules add ( mock rule ) ; running context put ( " mock " , rules ) ; core start ( new array list < > ( 0 ) ) ; for ( int i = 0 ; i < 10 ; i + + ) { thread sleep ( 60 * 1000l ) ; if ( check time size ( ) > = 3 ) { is add [ 0 ] = false ; assert assert true ( check time points ( check time ) ) ; break ; } if ( i = = 9 ) { assert assert true ( false ) ; } } }


return a version indicator ( older version , newer version or unknown version ) only an older version has the possibility of being upgradeable

public int get version indicator ( ) { return version indicator ; }


fills a triangle with vertices at x 1 , y 1 and x 2 , y 2 and x 3 , y 3 using the current color

public void fill triangle ( int x 1 , int y 1 , int x 2 , int y 2 , int x 3 , int y 3 ) { triangle ( x 1 , y 1 , x 2 , y 2 , x 3 , y 3 , draw type fill ) ; }


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


private void create version 3 ( ) throws i o exception { local managed buffer file vbf = null ; local managed buffer file save file = null ; try { / / open private file for version update vbf = new local managed buffer file ( versioned test file mgr , true , - 1 , versioned ) ; save file = ( local managed buffer file ) vbf get save file ( ) ; assert not null ( save file ) ; long pfile i d = vbf get file id ( ) ; assert true ( pfile i d ! = 0 ) ; / / write application level change file write app change file ( vbf ) ; / / modify save file byte [ ] data = new byte [ buffer size ] ; data buffer buf = new data buffer ( data ) ; arrays fill ( data , ( byte ) 0xf 2 ) ; / / modified empty buffer buf set id ( 12 ) ; save file put ( buf , 2 ) ; arrays fill ( data , ( byte ) 0xf 3 ) ; / / new buffer buf set id ( 13 ) ; save file put ( buf , 3 ) ; arrays fill ( data , ( byte ) 0xf 4 ) ; / / new buffer - added to free list below buf set id ( 14 ) ; save file put ( buf , 4 ) ; arrays fill ( data , ( byte ) 0xf 5 ) ; / / new buffer buf set id ( 13 ) ; save file put ( buf , 5 ) ; arrays fill ( data , ( byte ) 0xf 6 ) ; / / new buffer - added to free list below buf set id ( 16 ) ; save file put ( buf , 6 ) ; arrays fill ( data , ( byte ) 0xf 7 ) ; / / new buffer buf set id ( 17 ) ; save file put ( buf , 7 ) ; arrays fill ( data , ( byte ) 0xf 8 ) ; / / new buffer - added to free list below buf set id ( 18 ) ; save file put ( buf , 8 ) ; arrays fill ( data , ( byte ) 0xf 9 ) ; / / new buffer buf set id ( 19 ) ; save file put ( buf , 9 ) ; / / set free id list for output file int [ ] new free list = new int [ ] { 0 , 4 , 6 } ; save file set free indexes ( new free list ) ; / / copy / set file parameters save file set parameter ( " test parm 1 " , 0x 3 2 9 ) ; save file set parameter ( " test parm 2 " , 0x 5 4 9 ) ; save file set parameter ( " test parm 3 " , 0x 6 7 9 ) ; vbf save completed ( true ) ; vbf close ( ) ; vbf = null ; save file close ( ) ; save file = null ; assert equals ( 2 , private test file mgr get current version ( ) ) ; assert true ( private test file mgr get buffer file ( 2 ) exists ( ) ) ; assert true ( private test file mgr get change data file ( 2 ) exists ( ) ) ; } finally { if ( save file ! = null ) { try { vbf save completed ( false ) ; save file close ( ) ; } catch ( i o exception e ) { / / ignore } } if ( vbf ! = null ) { try { vbf close ( ) ; } catch ( i o exception e ) { / / ignore } } } }


test getting snapshot stats m x bean information

public void test snapshot stats m x bean info ( ) throws exception { configuration conf = new configuration ( ) ; mini d f s cluster cluster = null ; string path name = " / snapshot " ; path path = new path ( path name ) ; try { cluster = new mini d f s cluster builder ( conf ) build ( ) ; cluster wait active ( ) ; snapshot manager sm = cluster get namesystem ( ) get snapshot manager ( ) ; distributed file system dfs = ( distributed file system ) cluster get file system ( ) ; dfs mkdirs ( path ) ; dfs allow snapshot ( path ) ; dfs create snapshot ( path ) ; m bean server mbs = management factory get platform m bean server ( ) ; object name mxbean name = new object name ( " hadoop : service = name node , name = snapshot info " ) ; composite data [ ] directories = ( composite data [ ] ) mbs get attribute ( mxbean name , " snapshottable directories " ) ; int num directories = array get length ( directories ) ; assert equals ( sm get num snapshottable dirs ( ) , num directories ) ; composite data [ ] snapshots = ( composite data [ ] ) mbs get attribute ( mxbean name , " snapshots " ) ; int num snapshots = array get length ( snapshots ) ; assert equals ( sm get num snapshots ( ) , num snapshots ) ; composite data d = ( composite data ) array get ( directories , 0 ) ; composite data s = ( composite data ) array get ( snapshots , 0 ) ; assert true ( ( ( string ) d get ( " path " ) ) contains ( path name ) ) ; assert true ( ( ( string ) s get ( " snapshot directory " ) ) contains ( path name ) ) ; } finally { if ( cluster ! = null ) { cluster shutdown ( ) ; } } }


the unit tests below are from operation merge and should ensure the normal merge functionality is correct

public void merge flowable of flowables ( ) { final flowable < string > f 1 = flowable unsafe create ( new test synchronous flowable ( ) ) ; final flowable < string > f 2 = flowable unsafe create ( new test synchronous flowable ( ) ) ; flowable < flowable < string > > flowable of flowables = flowable unsafe create ( new publisher < flowable < string > > ( ) { @ override public void subscribe ( subscriber < ? super flowable < string > > subscriber ) { subscriber on subscribe ( new boolean subscription ( ) ) ; / / simulate what would happen in a flowable subscriber on next ( f 1 ) ; subscriber on next ( f 2 ) ; subscriber on complete ( ) ; } } ) ; flowable < string > m = flowable merge delay error ( flowable of flowables ) ; m subscribe ( string subscriber ) ; verify ( string subscriber , never ( ) ) on error ( any ( throwable class ) ) ; verify ( string subscriber , times ( 1 ) ) on complete ( ) ; verify ( string subscriber , times ( 2 ) ) on next ( " hello " ) ; }


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


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


specifies whether to analyze wildcards defaults to false if unset

public void analyze wildcard ( boolean analyze wildcard ) { this analyze wildcard = analyze wildcard ; }


encodes the specified cookies into a single cookie header value

public string encode ( collection < ? extends cookie > cookies ) { if ( check not null ( cookies , " cookies " ) is empty ( ) ) { return null ; } string builder buf = string builder ( ) ; if ( strict ) { if ( cookies size ( ) = = 1 ) { encode ( buf , cookies iterator ( ) next ( ) ) ; } else { cookie [ ] cookies sorted = cookies to array ( new cookie [ 0 ] ) ; arrays sort ( cookies sorted , cookie comparator ) ; for ( cookie c : cookies sorted ) { encode ( buf , c ) ; } } } else { for ( cookie c : cookies ) { encode ( buf , c ) ; } } return strip trailing separator or null ( buf ) ; }


public offset date time get date time ( ) { return date time ; }


create a hibernate template for the given session factory only invoked if populating the dao with a session factory reference ! can be overridden in subclasses to provide a hibernate template instance with different configuration , or a custom hibernate template subclass

protected hibernate template create hibernate template ( session factory session factory ) { return new hibernate template ( session factory ) ; }


return the name of the target interface that this invoker operates on

public string get target interface name ( ) throws remote exception ;


public static boolean is word ( int operand type ) { return ( operand type & word ) ! = 0 ; }