send a { @ link android util log # warn } log message and log the exception

void w ( string tag , string msg , throwable tr ) ;


get routed invokers from result of script rule evaluation

protected < t > list < invoker < t > > get routed invokers ( object obj ) { if ( obj instanceof invoker [ ] ) { return arrays as list ( ( invoker < t > [ ] ) obj ) ; } else if ( obj instanceof object [ ] ) { return arrays stream ( ( object [ ] ) obj ) map ( item - > ( invoker < t > ) item ) collect ( collectors to list ( ) ) ; } else { return ( list < invoker < t > > ) obj ; } }


private void initiate connect ( node node , long now ) { string node connection id = node id string ( ) ; try { connection states connecting ( node connection id , now , node host ( ) , client dns lookup ) ; inet address address = connection states current address ( node connection id ) ; log debug ( " initiating connection to node { } using address { } " , node , address ) ; selector connect ( node connection id , new inet socket address ( address , node port ( ) ) , this socket send buffer , this socket receive buffer ) ; } catch ( i o exception e ) { log warn ( " error connecting to node { } " , node , e ) ; / / attempt failed , we ' ll try again after the backoff connection states disconnected ( node connection id , now ) ; / / notify metadata updater of the connection failure metadata updater handle server disconnect ( now , node connection id , optional empty ( ) ) ; } }


compute if absent use this method if you are frequently using the same key , because the get method has no lock

public static < k , v > v compute if absent ( map < k , v > map , k key , function < ? super k , ? extends v > mapping function ) { v value = map get ( key ) ; if ( value ! = null ) { return value ; } return map compute if absent ( key , mapping function ) ; }


tries to get a read only adapter for the database whose handle is passed to this method

static function definition d b adapter find read only adapter ( d b handle handle ) throws version exception { try { return new function definition d b adapter v 0 ( handle ) ; } catch ( version exception e ) { if ( ! e is upgradable ( ) ) { throw e ; } } return new function definition d b adapter no table ( handle ) ; }


returns the unsigned { @ code byte } value represented by a string with the given radix

public static byte parse unsigned byte ( string string , int radix ) { int parse = integer parse int ( check not null ( string ) , radix ) ; / / we need to throw a number format exception , so we have to duplicate checked cast = ( if ( parse > > byte size = = 0 ) { return ( byte ) parse ; } else { throw new number format exception ( " out of range : " + parse ) ; } }


adds a field to run the multi match against with a specific boost

public multi match query builder field ( string field , float boost ) { if ( strings is empty ( field ) ) { throw new illegal argument exception ( " supplied field is null or empty " ) ; } check negative boost ( boost ) ; this fields boosts put ( field , boost ) ; return this ; }


public nested set < string > sdk dylibs ( ) { return this sdk dylibs ; }


choose target for web h d f s redirection

public datanode storage info [ ] choose target 4 web h d f s ( string src , datanode descriptor clientnode , set < node > excludes , long blocksize ) { return placement policies get policy ( contiguous ) choose target ( src , 1 , clientnode , collections < datanode storage info > empty list ( ) , false , excludes , blocksize , storage policy suite get default policy ( ) , null ) ; }


size the columns such that the interesting ones are wider than the uninteresting columns

private void adjust table columns ( ) { refs table size columns to fit ( - 1 ) ; table column column = refs table get column ( edit references model operand ) ; column set preferred width ( 80 ) ; column = refs table get column ( edit references model location ) ; column set preferred width ( 100 ) ; column = refs table get column ( edit references model label ) ; column set preferred width ( 150 ) ; column = refs table get column ( edit references model ref type ) ; column set preferred width ( 150 ) ; column = refs table get column ( edit references model is primary ) ; column set preferred width ( 60 ) ; column = refs table get column ( edit references model ref source ) ; column set preferred width ( 70 ) ; }


delegates to data source utils for automatically participating in spring - managed transactions throws the original s q l exception , if any the returned connection handle implements the connection proxy interface , allowing to retrieve the underlying target connection

public connection get connection ( ) throws s q l exception { return get transaction aware connection proxy ( obtain target data source ( ) ) ; }


set the name of the property mapped to the ' { @ code value } ' attribute of the ' { @ code option } ' tag required when wishing to render ' { @ code option } ' tags from an array or { @ link java util collection }

public void set item value ( string item value ) { assert has text ( item value , " ' item value ' must not be empty " ) ; this item value = item value ; }


returns the label of the owning target of this provider

public label get label ( ) { return label ; }


public void remove ( ) { check state ( key ! = long min value ) ; prev next = next ; next prev = prev ; prev = next = null ; type = null ; }


equivalent to { @ link # expect missing ( object [ ] ) expect missing } { @ code ( null ) } except that the call to { @ code contains ( null ) } is permitted to throw a { @ code null pointer exception }

protected void expect null missing when null unsupported ( string message ) { try { assert false ( message , actual contents ( ) contains ( null ) ) ; } catch ( null pointer exception tolerated ) { / / tolerated } }


the series of types defined by the package < code > repeated aapt pb type type = 3 ; < code >

public builder add all type ( java lang iterable < ? extends com android aapt resources type > values ) { copy on write ( ) ; instance add all type ( values ) ; return this ; }


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


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


deletes the reference to a script that has previously been pinned subsequent calls to { @ link # execute script ( script key , object ) } will fail for the given { @ code key }

default void unpin ( script key key ) { require non null ( " key to unpin " , key ) ; require state condition ( key instanceof unpinned script key , " script key should have been generated by this driver " ) ; unpinned script key unpin ( this , ( unpinned script key ) key ) ; }


returns the index that is offset { @ code code point offset } code points from { @ code index }

public int offset by code points ( int index , int code point offset ) { return character offset by code points ( chars , 0 , length , index , code point offset ) ; }


set this property to true for databases that do not provide an error code but that do provide sql state ( this includes postgre s q l )

public void set use sql state for translation ( boolean use state code for translation ) { this use sql state for translation = use state code for translation ; }


sets the { @ code id } of this dns message


cache two groups with a set of users test membership correctness clear cache , cache only one group test membership correctness

public void test group removal ( ) { list < string > users = new array list < string > ( ) ; users add ( user1 ) ; users add ( user2 ) ; netgroup cache add ( group1 , users ) ; users = new array list < string > ( ) ; users add ( user1 ) ; users add ( user3 ) ; netgroup cache add ( group2 , users ) ; verify group membership ( user1 , 2 , group1 ) ; verify group membership ( user1 , 2 , group2 ) ; verify group membership ( user2 , 1 , group1 ) ; verify group membership ( user3 , 1 , group2 ) ; netgroup cache clear ( ) ; users = new array list < string > ( ) ; users add ( user1 ) ; users add ( user2 ) ; netgroup cache add ( group1 , users ) ; verify group membership ( user1 , 1 , group1 ) ; verify group membership ( user2 , 1 , group1 ) ; verify group membership ( user3 , 0 , null ) ; }


prior to fixing spr - 10546 this might have succeeded depending on the ordering the classes were picked up if they are picked up in the same order as { @ link # enclosing config first parent defines bean ( ) } then it would fail this test is mostly for illustration purposes , but doesn ' t hurt to continue using it we purposely use the { @ link a enclosing config } to make it alphabetically prior to the { @ link a enclosing config child config } which encourages this to occur with the classpath scanning implementation being used by the author of this test

public void enclosing config first parent defines bean with scanning ( ) { annotation config application context ctx = new annotation config application context ( ) ; context = ctx ; ctx scan ( a enclosing config class get package ( ) get name ( ) ) ; ctx refresh ( ) ; assert that ( context get bean ( " my bean " , string class ) ) is equal to ( " my bean " ) ; }


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


get the hash code of an array of hashcodes hashcodes are sorted before hashcode is calculated so the returned value is irrelevant of the hashcode order in the array

static int get fingerprint ( int [ ] hashcodes ) { arrays sort ( hashcodes ) ; return arrays hash code ( hashcodes ) ; }


returns all the { @ link label atom property descriptor } s that can be potentially configured on this label

public list < label atom property descriptor > get applicable property descriptors ( ) { return label atom property all ( ) ; }


adds a single occurrence of the specified element to this multiset this method refines { @ link collection # add } , which only ensures the presence of the element , to further specify that a successful call must always increment the count of the element , and the overall size of the collection , by one to both add the element and obtain the previous count of that element , use { @ link # add ( object , int ) add } { @ code ( element , 1 ) } instead


the grouping function is used in conjunction with grouping sets , rollup and cube to indicate which columns are present in that grouping the grouping function must be invoked with arguments that exactly match the columns referenced in the corresponding grouping set , rollup or cube clause at the associated query level those column arguments are not evaluated and instead the function is re - written with the arguments below to compute the resulting bit set for a particular row , bits are assigned to the argument columns with the rightmost column being the most significant bit for a given grouping , a bit is set to 0 if the corresponding column is included in the grouping and 1 otherwise for an example , see the sql documentation for the function

static long calculate grouping ( set < integer > grouping set , list < integer > columns ) { long grouping = ( 1l < < columns size ( ) ) - 1 ; for ( int index = 0 ; index < columns size ( ) ; index + + ) { int column = columns get ( index ) ; if ( grouping set contains ( column ) ) { / / leftmost argument to grouping ( ) ( i e when index = 0 ) corresponds to / / the most significant bit in the result that is why we shift 1l starting / / from the columns size ( ) - 1 bit index grouping = grouping & ~ ( 1l < < ( columns size ( ) - 1 - index ) ) ; } } return grouping ; }


copies { @ code num bytes } bytes from the source to this view

void write ( data input view source , int num bytes ) throws i o exception ;


public string get namespace string ( ) { return namespace string ; }


public boolean is supported protocol ( final string protocol ) { return this sso descriptor is supported protocol ( protocol ) ; }


add elements from { @ code names } into { @ code enabled } if they are in { @ code supported }

static void add if supported ( set < string > supported , list < string > enabled , string names ) { for ( string n : names ) { if ( supported contains ( n ) ) { enabled add ( n ) ; } } }


add mix - in annotations to use for augmenting specified class or interface

public void set mix ins ( map < class < ? > , class < ? > > mix ins ) { this builder mix ins ( mix ins ) ; }


increments the element of this big array at specified index

public void increment ( long index ) { array [ segment ( index ) ] [ offset ( index ) ] + + ; }


sets unimplemented status for method on given response stream for unary call

public static void async unimplemented unary call ( method descriptor < ? , ? > method descriptor , stream observer < ? > response observer ) { check not null ( method descriptor , " method descriptor " ) ; check not null ( response observer , " response observer " ) ; response observer on error ( status unimplemented with description ( string format ( " method % s is unimplemented " , method descriptor get full method name ( ) ) ) as runtime exception ( ) ) ; }


marks the given visitor accepter as being used in this context , the visitor accepter will be a utf 8 constant object

private void mark as used ( visitor accepter visitor accepter ) { visitor accepter set visitor info ( used ) ; }


test if the { @ link advanced sorceress } smokes whatever instance of { @ link tobacco } is passed to her through the setter ' s parameter

public void test smoke every thing ( ) throws exception { list < tobacco > tobaccos = list of ( new old toby tobacco ( ) , new rivendell tobacco ( ) , new second breakfast tobacco ( ) ) ; / / verify if the sorceress is smoking the correct tobacco tobaccos for each ( tobacco - > { final var advanced sorceress = new advanced sorceress ( ) ; advanced sorceress set tobacco ( tobacco ) ; advanced sorceress smoke ( ) ; string last message = appender get last message ( ) ; assert equals ( " advanced sorceress smoking " + tobacco get class ( ) get simple name ( ) , last message ) ; } ) ; / / and nothing else is happening assert equals ( tobaccos size ( ) , appender get log size ( ) ) ; }


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


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


tests that we can write more than 64 values

public void test wide tuple boundary ( ) throws exception { text empty text = new text ( " should not be set written " ) ; writable [ ] values = new writable [ 65 ] ; arrays fill ( values , empty text ) ; values [ 64 ] = new text ( " should be the only value set written " ) ; tuple writable tuple = new tuple writable ( values ) ; tuple set written ( 64 ) ; for ( int pos = 0 ; pos < tuple size ( ) ; pos + + ) { boolean has = tuple has ( pos ) ; if ( pos = = 64 ) { assert true ( has ) ; } else { assert false ( " tuple position is incorrectly labelled as set : " + pos , has ) ; } } }


{ @ link canvas # clip path ( path ) } is not supported in hardware accelerated layers before api 18 use software layer instead < p > https : developer android comguidetopicsgraphicshardware - accel html # unsupported

private void enable clip path support if necessary ( ) { if ( build version sdk int < = build version codes jelly bean mr1 ) { if ( ripple rounded corners ! = 0 ) { layer type = get layer type ( ) ; set layer type ( layer type software , null ) ; } else { set layer type ( layer type , null ) ; } } }


determines if a particular entry is available note that using this when not within a context that is maintaining a sequence barrier , it is likely that using this to determine if you can read a value is likely to result in a race condition and broken code

public boolean is published ( long sequence ) { return sequencer is available ( sequence ) ; }


creates a keystore with a single key and saves it to a file

public static void create key store ( string filename , string password , string key password , string alias , key private key , certificate cert ) throws general security exception , i o exception { key store ks = create empty key store ( ) ; ks set key entry ( alias , private key , key password to char array ( ) , new certificate [ ] { cert } ) ; save key store ( ks , filename , password ) ; }


creates { @ link restart backoff time strategy factory } from the given configuration the strategy factory is decided in order as follows : strategy set within job graph , i e { @ link restart strategies restart strategy configuration } , unless the config is { @ link restart strategies fallback restart strategy configuration } strategy set in the cluster ( server - side ) config ( flink - conf yaml ) , unless the strategy is not specified { @ link fixed delay restart backoff time strategy fixed delay restart backoff time strategy factory } if checkpointing is enabled otherwise { @ link no restart backoff time strategy no restart backoff time strategy factory }

public static restart backoff time strategy factory create restart backoff time strategy factory ( final restart strategies restart strategy configuration job restart strategy configuration , final configuration cluster configuration , final boolean is checkpointing enabled ) { check not null ( job restart strategy configuration ) ; check not null ( cluster configuration ) ; return get job restart strategy factory ( job restart strategy configuration ) or else ( get cluster restart strategy factory ( cluster configuration ) or else ( get default restart strategy factory ( is checkpointing enabled ) ) ) ; }


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

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


private static void version ( ) { system err println ( " dx version " + version version ) ; system exit ( 0 ) ; }


create a new channel instance to hold the entries by default returns an rss 2 0 channel , but the subclass can specify any channel

protected channel new feed ( ) { return new channel ( " rss 2 0 " ) ; }


public void test json form data test ( ) throws api exception { string param = null ; string param 2 = null ; api test json form data ( param , param 2 ) ; / / todo : test validations }


gets the type of operation that this class belongs to


get the password to use in secret managers this is a constant ; its just recalculated every time to stop findbugs highlighting security risks of shared mutable byte arrays

private static byte [ ] get secret manager passsword ( ) { return " non - password " get bytes ( charset for name ( " utf - 8 " ) ) ; }


test request scoped caching of commands so that a 2nd duplicate call doesn ' t execute but returns the previous future

public void test request cache with slow execution ( ) { test circuit breaker circuit breaker = new test circuit breaker ( ) ; slow cacheable command command 1 = new slow cacheable command ( circuit breaker , " a " , 200 ) ; slow cacheable command command 2 = new slow cacheable command ( circuit breaker , " a " , 100 ) ; slow cacheable command command 3 = new slow cacheable command ( circuit breaker , " a " , 100 ) ; slow cacheable command command 4 = new slow cacheable command ( circuit breaker , " a " , 100 ) ; future < string > f 1 = command 1 observe ( ) to blocking ( ) to future ( ) ; future < string > f 2 = command 2 observe ( ) to blocking ( ) to future ( ) ; future < string > f 3 = command 3 observe ( ) to blocking ( ) to future ( ) ; future < string > f 4 = command 4 observe ( ) to blocking ( ) to future ( ) ; try { assert equals ( " a " , f 2 get ( ) ) ; assert equals ( " a " , f 3 get ( ) ) ; assert equals ( " a " , f 4 get ( ) ) ; assert equals ( " a " , f 1 get ( ) ) ; } catch ( exception e ) { throw new runtime exception ( e ) ; } assert true ( command 1 executed ) ; / / the second one should not have executed as it should have received the cached value instead assert false ( command 2 executed ) ; assert false ( command 3 executed ) ; assert false ( command 4 executed ) ; / / the execution log for command 1 should show an emit and a success assert command execution events ( command 1 , hystrix event type emit , hystrix event type success ) ; assert true ( command 1 get execution time in milliseconds ( ) > - 1 ) ; assert false ( command 1 is response from cache ( ) ) ; / / the execution log for command 2 should show it came from cache assert command execution events ( command 2 , hystrix event type emit , hystrix event type success , hystrix event type response from cache ) ; assert true ( command 2 get execution time in milliseconds ( ) = = - 1 ) ; assert true ( command 2 is response from cache ( ) ) ; assert command execution events ( command 3 , hystrix event type emit , hystrix event type success , hystrix event type response from cache ) ; assert true ( command 3 is response from cache ( ) ) ; assert true ( command 3 get execution time in milliseconds ( ) = = - 1 ) ; assert command execution events ( command 4 , hystrix event type emit , hystrix event type success , hystrix event type response from cache ) ; assert true ( command 4 is response from cache ( ) ) ; assert true ( command 4 get execution time in milliseconds ( ) = = - 1 ) ; assert sane hystrix request log ( 4 ) ; / / semaphore isolated assert false ( command 1 is executed in thread ( ) ) ; assert false ( command 2 is executed in thread ( ) ) ; assert false ( command 3 is executed in thread ( ) ) ; assert false ( command 4 is executed in thread ( ) ) ; }


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


the value of each entry in the { @ code provides with index } table must be a valid index into the constant pool the entry at that index must be a { @ link constant pool class info } structure representing a service implementation for the service interface specified by { @ code provides index }

public int get provides with index entry ( int i ) { return provides with index [ i ] ; }


tests if any view hierarchy under the root has the given content description

public view tree assert has content description ( final int resource id ) { return has content description ( runtime environment application get resources ( ) get string ( resource id ) ) ; }


deserializes the { @ link symbol records } from the stream noted in the dbi header

void deserialize ( task monitor monitor ) throws i o exception , pdb exception , cancelled exception { int stream number ; pdb byte reader reader ; stream number = pdb get debug info ( ) get symbol records stream number ( ) ; reader = pdb get reader for stream number ( stream number , monitor ) ; symbols by offset = deserialize symbol records ( reader , monitor ) ; for ( abstract module information module : pdb get debug info ( ) module information list ) { stream number = module get stream number debug information ( ) ; if ( stream number ! = 0xffff ) { / / system out println ( " \ n \ n stream number : " + stream number ) ; reader = pdb get reader for stream number ( stream number , monitor ) ; int x = reader parse int ( ) ; / / todo : do not know what this value is int size debug = module get size local symbols debug information ( ) ; size debug - = x ; / / todo : seems right , but need to evaluate this pdb byte reader debug reader = reader get sub pdb byte reader ( size debug ) ; map < long , abstract ms symbol > one module symbols by offset = deserialize symbol records ( debug reader , monitor ) ; module symbols by offset add ( one module symbols by offset ) ; / / todo : figure out the rest of the bytes in the stream / / as of 20190618 : feel that this is where we will find c 1 1 lines or c 1 3 lines / / information / / pdb byte reader rest = reader get sub pdb byte reader ( reader num remaining ( ) ) ; / / system out println ( rest dump ( ) ) ; } else { module symbols by offset add ( new tree map < > ( ) ) ; } } }


validate that a pending commit data file exists , load it and validate its contents

private path validate pending commit data ( string filename , path magic file ) throws i o exception { s 3 a file system fs = get file system ( ) ; path pending data path = new path ( magic file get parent ( ) , filename + pending suffix ) ; file status file status = verify path exists ( fs , " no pending file " , pending data path ) ; assert true ( " no data in " + file status , file status get len ( ) > 0 ) ; string data = read ( fs , pending data path ) ; log info ( " contents of { } : \ n { } " , pending data path , data ) ; / / really read it in and parse single pending commit persisted = single pending commit serializer ( ) load ( fs , pending data path ) ; persisted validate ( ) ; assert true ( " created timestamp wrong in " + persisted , persisted get created ( ) > 0 ) ; assert true ( " saved timestamp wrong in " + persisted , persisted get saved ( ) > 0 ) ; list < string > etags = persisted get etags ( ) ; assert equals ( " etag list " + persisted , 1 , etags size ( ) ) ; list < part e tag > part list = commit operations to part etags ( etags ) ; assert equals ( " part list " + persisted , 1 , part list size ( ) ) ; return pending data path ; }


configure a reactive adapter registry this is needed for async return values by default this is a { @ link reactive adapter registry } with default settings

public void set reactive adapter registry ( reactive adapter registry registry ) { this reactive adapter registry = registry ; }


public static boolean check client secret ( final o auth registered service registered service , final string client secret , final cipher executor < serializable , string > cipher executor ) { logger debug ( " found : [ { } ] in secret check " , registered service ) ; var defined secret = registered service get client secret ( ) ; if ( string utils is blank ( defined secret ) ) { logger debug ( " the client secret is not defined for the registered service [ { } ] " , registered service get name ( ) ) ; return true ; } defined secret = cipher executor decode ( defined secret , new object [ ] { registered service } ) ; if ( ! string utils equals ( defined secret , client secret ) ) { logger error ( " wrong client secret for service : [ { } ] " , registered service get service id ( ) ) ; return false ; } return true ; }


returns { @ code true } if this { @ code lifecycle } component should get started automatically by the container at the time that the containing { @ link application context } gets refreshed a value of { @ code false } indicates that the component is intended to be started through an explicit { @ link # start ( ) } call instead , analogous to a plain { @ link lifecycle } implementation the default implementation returns { @ code true }

default boolean is auto startup ( ) { return true ; }


allows subclasses to vote on the inclusion of a particular attribute mutator

protected abstract boolean include write attribute ( method method , string bean key ) ;


@ min ( 10 ) @ max ( 100 ) public integer get integer ( ) { return integer ; }


closes all { @ code closeable } instances that have been added to this { @ code closer } if an exception was thrown in the try block and passed to one of the { @ code exception thrown } methods , any exceptions thrown when attempting to close a closeable will be suppressed otherwise , the first exception to be thrown from an attempt to close a closeable will be thrown and any additional exceptions that are thrown after that will be suppressed

public void close ( ) throws i o exception { throwable throwable = thrown ; / / close closeables in lifo order while ( ! stack is empty ( ) ) { closeable closeable = stack remove first ( ) ; try { closeable close ( ) ; } catch ( throwable e ) { if ( throwable = = null ) { throwable = e ; } else { suppressor suppress ( closeable , throwable , e ) ; } } } if ( thrown = = null & & throwable ! = null ) { throwables propagate if possible ( throwable , i o exception class ) ; throw new assertion error ( throwable ) ; / / not possible } }


override point for any committer specific validation operations ; called after the base assertions have all passed

protected void custom post execution validation ( path dest path , success data success data ) throws exception { }


public static long generate identifier ( ) { return s id counter increment and get ( ) ; }


public boolean is magic commit enabled ( ) { return committer integration is magic commit enabled ( ) ; }


returns { @ code true } if the node is accepting tasks needed to allow agents programmatic suspension of task scheduling that does not overlap with being offline called by { @ link computer # is accepting tasks ( ) } this method is distinct from { @ link computer # is accepting tasks ( ) } as sometimes the { @ link node } concrete class may not have control over the { @ link hudson model computer } concrete class associated with it

public boolean is accepting tasks ( ) { return true ; }


exit a parse tree produced by the { @ code sys tables } labeled alternative in { @ link sql base parser # statement }

void exit sys tables ( sql base parser sys tables context ctx ) ;


sets the < code > type < code > property

public model api response type ( string type ) { this type = type ; return this ; }


returns null if it was created , the value otherwise

public object get state or create ( long txid , state initializer init ) { if ( curr contains key ( txid ) ) { return curr get ( txid ) ; } else { get state ( txid , init ) ; return null ; } }


gets the start address for the call frame augmentation data

public address get augmentation ex data address ( ) { return augmentation data ex addr ; }


returns a binder that skips { @ code classes to skip } when identify the calling code the caller ' s { @ link stack trace element } is used to locate the source of configuration errors

binder skip sources ( class < ? > classes to skip ) ;


all shards for the provided index and shard id

public index shard routing table shard routing table ( string index , int shard id ) { index routing table index routing = index ( index ) ; if ( index routing = = null ) { throw new index not found exception ( index ) ; } return shard routing table ( index routing , shard id ) ; }


increments the ref count of this instance


public void test model api response ( ) { / / todo : test model api response }


convert this object , in org apache kafka connect data format , into a json object with an envelope object containing schema and payload fields

private json node convert to json with envelope ( schema schema , object value ) { return new json schema envelope ( as json schema ( schema ) , convert to json ( schema , value ) ) to json node ( ) ; }


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


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

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


adds the action to the graph display not all graph displays support adding custom actions , so this may have no effect

public void add action ( docking action action ) ;


specifies the scheduler to use when scheduling routine maintenance based on an expiration event this augments the periodic maintenance that occurs during normal cache operations to allow for the prompt removal of expired entries regardless of whether any cache activity is occurring at that time by default , { @ link scheduler # disabled scheduler ( ) } is used the scheduling between expiration events is paced to exploit batching and to minimize executions in short succession this minimum difference between the scheduled executions is implementation - specific , currently at ~ 1 second ( 2 ^ 30 ns ) in addition , the provided scheduler may not offer real - time guarantees ( including { @ link scheduled thread pool executor } ) the scheduling is best - effort and does not make any hard guarantees of when an expired entry will be removed < b > note for java 9 and later : < b > consider using { @ link scheduler # system scheduler ( ) } to leverage the dedicated , system - wide scheduling thread

public caffeine < k , v > scheduler ( @ non null scheduler scheduler ) { require state ( this scheduler = = null , " scheduler was already set to % s " , this scheduler ) ; this scheduler = require non null ( scheduler ) ; return this ; }


append the request to the transaction logs

public boolean append ( request si ) throws i o exception { return txn log append ( si get hdr ( ) , si get txn ( ) , si get txn digest ( ) ) ; }


searches this database for functions whose name matches the given regular expression

public list < function record > find functions by name regex ( string regex ) { try { list < function record > list = functions table get function records by name regex ( regex ) ; return list ; } catch ( i o exception e ) { msg error ( this , " serious problem search for fid functions by regular expression " , e ) ; } return null ; }


public static void put ( @ non null final string key , final serializable value , final int save time , @ non null final cache disk utils cache disk utils ) { cache disk utils put ( key , value , save time ) ; }


public order place order ( order body ) { / / todo : implement return null ; }


move bullet position by the provided offset

public void move bullet ( float offset ) { var current position = bullet get position ( ) ; bullet set position ( current position + offset ) ; }


perform spring - based scanning for entity classes , registering them as annotated classes with this { @ code configuration }

public local session factory builder scan packages ( string packages to scan ) throws hibernate exception { set < string > entity class names = new tree set < > ( ) ; set < string > converter class names = new tree set < > ( ) ; set < string > package names = new tree set < > ( ) ; try { for ( string pkg : packages to scan ) { string pattern = resource pattern resolver classpath all url prefix + class utils convert class name to resource path ( pkg ) + resource pattern ; resource [ ] resources = this resource pattern resolver get resources ( pattern ) ; metadata reader factory reader factory = new caching metadata reader factory ( this resource pattern resolver ) ; for ( resource resource : resources ) { if ( resource is readable ( ) ) { metadata reader reader = reader factory get metadata reader ( resource ) ; string class name = reader get class metadata ( ) get class name ( ) ; if ( matches entity type filter ( reader , reader factory ) ) { entity class names add ( class name ) ; } else if ( converter type filter match ( reader , reader factory ) ) { converter class names add ( class name ) ; } else if ( class name ends with ( package info suffix ) ) { package names add ( class name substring ( 0 , class name length ( ) - package info suffix length ( ) ) ) ; } } } } } catch ( i o exception ex ) { throw new mapping exception ( " failed to scan classpath for unlisted classes " , ex ) ; } try { class loader cl = this resource pattern resolver get class loader ( ) ; for ( string class name : entity class names ) { add annotated class ( class utils for name ( class name , cl ) ) ; } for ( string class name : converter class names ) { add attribute converter ( ( class < ? extends attribute converter < ? , ? > > ) class utils for name ( class name , cl ) ) ; } for ( string package name : package names ) { add package ( package name ) ; } } catch ( class not found exception ex ) { throw new mapping exception ( " failed to load annotated classes from classpath " , ex ) ; } return this ; }


the primary resource for merging this resource will overwrite any resource or data value in the transitive closure

private android resource merging action builder with primary ( parsed android resources primary ) { this primary = primary ; return this ; }


get class desc boolean [ ] class = > " [ z " object class = > " ljavalang object ; "

public static string get desc ( class < ? > c ) { string builder ret = new string builder ( ) ; while ( c is array ( ) ) { ret append ( ' [ ' ) ; c = c get component type ( ) ; } if ( c is primitive ( ) ) { string t = c get name ( ) ; if ( " void " equals ( t ) ) { ret append ( jvm void ) ; } else if ( " boolean " equals ( t ) ) { ret append ( jvm boolean ) ; } else if ( " byte " equals ( t ) ) { ret append ( jvm byte ) ; } else if ( " char " equals ( t ) ) { ret append ( jvm char ) ; } else if ( " double " equals ( t ) ) { ret append ( jvm double ) ; } else if ( " float " equals ( t ) ) { ret append ( jvm float ) ; } else if ( " int " equals ( t ) ) { ret append ( jvm int ) ; } else if ( " long " equals ( t ) ) { ret append ( jvm long ) ; } else if ( " short " equals ( t ) ) { ret append ( jvm short ) ; } } else { ret append ( ' l ' ) ; ret append ( c get name ( ) replace ( ' ' , ' / ' ) ) ; ret append ( ' ; ' ) ; } return ret to string ( ) ; }


adds all of the converter testers from the given iterable only one tester for each class is permitted ; duplicates will cause { @ link # build } to fail

public builder add all ( iterable < converter tester > items ) { items for each ( this : : add ) ; return this ; }


this test validates the correctness of { @ link r m web service protocol # get cluster node labels ( ) } inside router

public void test get cluster node labels x m l ( ) throws exception { list < node labels info > responses = perform get calls ( rm web service path + get node labels , node labels info class , null , null ) ; node labels info router response = responses get ( 0 ) ; node labels info rm response = responses get ( 1 ) ; assert not null ( router response ) ; assert not null ( rm response ) ; assert equals ( rm response get node labels ( ) size ( ) , router response get node labels ( ) size ( ) ) ; }


interface implementation of zookeeper callback for monitor ( exists )

public synchronized void process result ( int rc , string path , object ctx , stat stat ) { if ( is stale client ( ctx ) ) return ; monitor lock node pending = false ; assert want to be in election : " got a stat node result after quitting election " ; if ( log is debug enabled ( ) ) { log debug ( " stat node result : " + rc + " for path : " + path + " connection state : " + zk connection state + " for " + this ) ; } code code = code get ( rc ) ; if ( is success ( code ) ) { / / the following owner check completes verification in case the lock znode / / creation was retried if ( stat get ephemeral owner ( ) = = zk client get session id ( ) ) { / / we own the lock znode so we are the leader if ( ! become active ( ) ) { re join election after failure to become active ( ) ; } } else { / / we dont own the lock znode so we are a standby become standby ( ) ; } / / the watch set by us will notify about changes return ; } if ( is node does not exist ( code ) ) { / / the lock znode disappeared before we started monitoring it enter neutral mode ( ) ; join election internal ( ) ; return ; } string error message = " received stat error from zookeeper code : " + code to string ( ) ; log debug ( error message ) ; if ( should retry ( code ) ) { if ( stat retry count < max retry num ) { + + stat retry count ; monitor lock node async ( ) ; return ; } error message = error message + " not retrying further znode monitoring connection errors " ; } else if ( is session expired ( code ) ) { / / this isn ' t fatal - the client watcher will re - join the election log warn ( " lock monitoring failed because session was lost " ) ; return ; } fatal error ( error message ) ; }


checks a given { @ link config infos } for validation error messages and adds an exception to the given { @ link callback } if any were found

protected final boolean maybe add config errors ( config infos config infos , callback < created < connector info > > callback ) { int errors = config infos error count ( ) ; boolean has errors = errors > 0 ; if ( has errors ) { string builder messages = new string builder ( ) ; messages append ( " connector configuration is invalid and contains the following " ) append ( errors ) append ( " error ( s ) : " ) ; for ( config info config info : config infos values ( ) ) { for ( string msg : config info config value ( ) errors ( ) ) { messages append ( ' \ n ' ) append ( msg ) ; } } callback on completion ( new bad request exception ( messages append ( " \ n you can also find the above list of errors at the endpoint ` / connector - plugins / { connector type } / config / validate ` " ) to string ( ) ) , null ) ; } return has errors ; }


gets the total file size , if known this is package - scope in order to allow the { @ link header section } to set itself up properly

public int get file size ( ) { if ( file size < 0 ) { throw new runtime exception ( " file size not yet known " ) ; } return file size ; }


replaces all parameters with the given parameters

public media type with parameters ( multimap < string , string > parameters ) { return create ( type , subtype , parameters ) ; }


ignore an optional leading ` ` in the domain

@ test public void domain matches ignores leading dot ( ) throws exception { cookie cookie = cookie parse ( url , " a = b ; domain = example com " ) ; assert that ( cookie matches ( http url get ( " http : / / example com " ) ) ) is true ( ) ; assert that ( cookie matches ( http url get ( " http : / / www example com " ) ) ) is true ( ) ; assert that ( cookie matches ( http url get ( " http : / / square com " ) ) ) is false ( ) ; }


/ * package * / void update one definition ( ssa insn insn , register spec old result ) { if ( definition list = = null ) return ; if ( old result ! = null ) { int reg = old result get reg ( ) ; definition list [ reg ] = null ; } register spec result reg = insn get result ( ) ; if ( result reg ! = null ) { int reg = result reg get reg ( ) ; if ( definition list [ reg ] ! = null ) { throw new runtime exception ( " duplicate add of insn " ) ; } else { definition list [ result reg get reg ( ) ] = insn ; } } }


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


public static string intern ( @ check for null string s ) { return s = = null ? s : s intern ( ) ; }


sends a string directly to the output stream , without escaping any characters use with caution !

public void print ( string s ) { out print ( s ) ; }


computes the quantile value of the given dataset

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


return the configured { @ code decoder }

public decoder < ? > get decoder ( ) { return this decoder ; }


returns the minimum should match to apply to the resulting query should that be a boolean query

public string minimum should match ( ) { return minimum should match ; }


returns { @ code true } if the explained shard is primary , { @ code false } otherwise

public boolean is primary ( ) { return shard routing primary ( ) ; }


writes length bytes from the specified byte array starting at off to this output stream

public synchronized void write ( final byte [ ] data , final int off , final int length ) throws i o exception { maybe throw last error ( ) ; preconditions check argument ( data ! = null , " null data " ) ; if ( off < 0 | | length < 0 | | length > data length - off ) { throw new index out of bounds exception ( ) ; } int current offset = off ; int writable bytes = buffer size - buffer index ; int number of bytes to write = length ; while ( number of bytes to write > 0 ) { if ( writable bytes < = number of bytes to write ) { system arraycopy ( data , current offset , buffer , buffer index , writable bytes ) ; buffer index + = writable bytes ; write current buffer to service ( ) ; current offset + = writable bytes ; number of bytes to write = number of bytes to write - writable bytes ; } else { system arraycopy ( data , current offset , buffer , buffer index , number of bytes to write ) ; buffer index + = number of bytes to write ; number of bytes to write = 0 ; } writable bytes = buffer size - buffer index ; } increment write ops ( ) ; }


appends to the given { @ code string builder } the default description for the given { @ code detector }

public static void append on ( detector detector , string builder sb ) { if ( is not null or empty ( detector get function ( ) get full name ( ) ) ) { sb append ( detector get function ( ) ) ; if ( is not null or empty ( detector get field name ( ) ) ) { sb append ( ' ( ' ) append ( quote field ( detector get field name ( ) ) ) append ( ' ) ' ) ; } } else if ( is not null or empty ( detector get field name ( ) ) ) { sb append ( quote field ( detector get field name ( ) ) ) ; } if ( is not null or empty ( detector get by field name ( ) ) ) { sb append ( by token ) append ( quote field ( detector get by field name ( ) ) ) ; } if ( is not null or empty ( detector get over field name ( ) ) ) { sb append ( over token ) append ( quote field ( detector get over field name ( ) ) ) ; } if ( detector is use null ( ) ) { sb append ( use null option ) append ( detector is use null ( ) ) ; } if ( is not null or empty ( detector get partition field name ( ) ) ) { sb append ( partition field option ) append ( quote field ( detector get partition field name ( ) ) ) ; } if ( detector get exclude frequent ( ) ! = null ) { sb append ( exclude frequent option ) append ( detector get exclude frequent ( ) ) ; } }


returns the class that implements a copy strategy looks up the implementation for a particular strategy from distcp - default xml

public static class < ? extends input format > get strategy ( configuration conf , dist cp context context ) { string conf label = " distcp " + string utils to lower case ( context get copy strategy ( ) ) + " strategy " + " impl " ; return conf get class ( conf label , uniform size input format class , input format class ) ; }


return the aliases for the given bean name , if any all of those aliases point to the same bean when used in a { @ link # get bean } call if the given name is an alias , the corresponding original bean name and other aliases ( if any ) will be returned , with the original bean name being the first element in the array will ask the parent factory if the bean cannot be found in this factory instance

string [ ] get aliases ( string name ) ;


set the fetch position to the committed position ( if there is one ) or reset it using the offset reset policy the user has configured

private boolean update fetch positions ( final timer timer ) { / / if any partitions have been truncated due to a leader change , we need to validate the offsets fetcher validate offsets if needed ( ) ; cached subscription hash all fetch positions = subscriptions has all fetch positions ( ) ; if ( cached subscription hash all fetch positions ) return true ; / / if there are any partitions which do not have a valid position and are not / / awaiting reset , then we need to fetch committed offsets we will only do a / / coordinator lookup if there are partitions which have missing positions , so / / a consumer with manually assigned partitions can avoid a coordinator dependence / / by always ensuring that assigned partitions have an initial position if ( coordinator ! = null & & ! coordinator refresh committed offsets if needed ( timer ) ) return false ; / / if there are partitions still needing a position and a reset policy is defined , / / request reset using the default policy if no reset strategy is defined and there / / are partitions with a missing position , then we will raise an exception subscriptions reset initializing positions ( ) ; / / finally send an asynchronous request to lookup and update the positions of any / / partitions which are awaiting reset fetcher reset offsets if needed ( ) ; return true ; }


send the given java mail mime message the message needs to have been created with { @ link # create mime message ( ) }

void send ( mime message mime message ) throws mail exception ;


public string compile template ( templating executor executor , map < string , object > bundle , string template file ) throws i o exception { template tmpl = compiler with loader ( name - > find template ( executor , name ) ) default value ( " " ) compile ( executor get full template contents ( template file ) ) ; return tmpl execute ( bundle ) ; } @ suppress warnings ( { " java : s108 " }


handle an account state warning produced by ldaptive account state machinery override this method to provide custom warning message handling

protected void handle warning ( final account state warning warning , final authentication response response , final password policy context configuration , final list < message descriptor > messages ) { logger debug ( " handling account state warning [ { } ] " , warning ) ; if ( warning = = null ) { logger debug ( " account state warning not defined " ) ; return ; } if ( warning get expiration ( ) ! = null ) { val exp date = date time utils zoned date time of ( warning get expiration ( ) ) ; val ttl = zoned date time now ( zone offset utc ) until ( exp date , chrono unit days ) ; logger debug ( " password expires in [ { } ] days expiration warning threshold is [ { } ] days " , ttl , configuration get password warning number of days ( ) ) ; if ( configuration is always display password expiration warning ( ) | | ttl < configuration get password warning number of days ( ) ) { messages add ( new password expiring warning message descriptor ( " password expires in { 0 } days " , ttl ) ) ; } } else { logger debug ( " no account expiration warning was provided as part of the account state " ) ; } if ( warning get logins remaining ( ) > 0 ) { messages add ( new default message descriptor ( " password expiration logins remaining " , " you have { 0 } logins remaining before you must change your password " , new serializable [ ] { warning get logins remaining ( ) } ) ) ; } }


private s 3 a file system get mixed f s ( ) { return mixed f s ; }


public static short max ( short a , short b ) { return a > = b ? a : b ; }


public final request builder set task id ( task id task id ) { request set task id ( task id ) ; return ( request builder ) this ; }


join records of this stream with another { @ code k stream } ' s records using windowed left equi join using the { @ link joined } instance for configuration of the { @ link serde key serde } , { @ link serde this stream ' s value serde } , and { @ link serde the other stream ' s value serde } in contrast to { @ link # join ( k stream , value joiner , join windows ) inner - join } , all records from this stream will produce at least one output record ( cf below ) the join is computed on the records ' key with join attribute { @ code this k stream key = = other k stream key } furthermore , two records are only joined if their timestamps are close to each other as defined by the given { @ link join windows } , i e , the window defines an additional join predicate on the record timestamps for each pair of records meeting both join predicates the provided { @ link value joiner } will be called to compute a value ( with arbitrary type ) for the result record the key of the result record is the same as for both joining input records furthermore , for each input record of this { @ code k stream } that does not satisfy the join predicate the provided { @ link value joiner } will be called with a { @ code null } value for the other stream if an input record key or value is { @ code null } the record will not be included in the join operation and thus no output record will be added to the resulting { @ code k stream } example ( assuming all input records belong to the correct windows ) : < table border = ' 1 ' > < tr > < th > this < th > < th > other < th > < th > result < th > < tr > < tr > < td > & lt ; k1 : a & gt ; < td > < td > < td > < td > & lt ; k1 : value joiner ( a , null ) & gt ; < td > < tr > < tr > < td > & lt ; k2 : b & gt ; < td > < td > & lt ; k2 : b & gt ; < td > < td > & lt ; k2 : value joiner ( b , b ) & gt ; < td > < tr > < tr > < td > < td > < td > & lt ; k3 : c & gt ; < td > < td > < td > < tr > < table > both input streams ( or to be more precise , their underlying source topics ) need to have the same number of partitions if this is not the case , you would need to call { @ link # repartition ( repartitioned ) } ( for one input stream ) before doing the join and specify the " correct " number of partitions via { @ link repartitioned } parameter furthermore , both input streams need to be co - partitioned on the join key ( i e , use the same partitioner ) if this requirement is not met , kafka streams will automatically repartition the data , i e , it will create an internal repartitioning topic in kafka and write and re - read the data via this topic before the actual join the repartitioning topic will be named " $ { application id } - & lt ; name & gt ; - repartition " , where " application id " is user - specified in { @ link streams config } via parameter { @ link streams config # application id config application id config } , " & lt ; name & gt ; " is an internally generated name , and " - repartition " is a fixed suffix repartitioning can happen for one or both of the joining { @ code k stream } s for this case , all data of the stream will be redistributed through the repartitioning topic by writing all records to it , and rereading all records from it , such that the join input { @ code k stream } is partitioned correctly on its key both of the joining { @ code k stream } s will be materialized in local state stores with auto - generated store names for failure and recovery each store will be backed by an internal changelog topic that will be created in kafka the changelog topic will be named " $ { application id } - & lt ; storename & gt ; - changelog " , where " application id " is user - specified in { @ link streams config } via parameter { @ link streams config # application id config application id config } , " store name " is an internally generated name , and " - changelog " is a fixed suffix you can retrieve all generated internal topic names via { @ link topology # describe ( ) }

< vo , vr > k stream < k , vr > left join ( final k stream < k , vo > other stream , final value joiner < ? super v , ? super vo , ? extends vr > joiner , final join windows windows , final joined < k , v , vo > joined ) ;


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


returns a multimap containing the mappings in { @ code unfiltered } whose keys satisfy a predicate the returned multimap is a live view of { @ code unfiltered } ; changes to one affect the other the resulting multimap ' s views have iterators that don ' t support { @ code remove ( ) } , but all other methods are supported by the multimap and its views when adding a key that doesn ' t satisfy the predicate , the multimap ' s { @ code put ( ) } , { @ code put all ( ) } , and { @ code replace values ( ) } methods throw an { @ link illegal argument exception } when methods such as { @ code remove all ( ) } and { @ code clear ( ) } are called on the filtered multimap or its views , only mappings whose keys satisfy the filter will be removed from the underlying multimap the returned multimap isn ' t threadsafe or serializable , even if { @ code unfiltered } is many of the filtered multimap ' s methods , such as { @ code size ( ) } , iterate across every keyvalue mapping in the underlying multimap and determine which satisfy the filter when a live view is not needed , it may be faster to copy the filtered multimap and use the copy < b > warning : < b > { @ code key predicate } must be consistent with equals , as documented at { @ link predicate # apply } do not provide a predicate such as { @ code predicates instance of ( array list class ) } , which is inconsistent with equals

public static < k , v > multimap < k , v > filter keys ( multimap < k , v > unfiltered , final predicate < ? super k > key predicate ) { if ( unfiltered instanceof set multimap ) { return filter keys ( ( set multimap < k , v > ) unfiltered , key predicate ) ; } else if ( unfiltered instanceof list multimap ) { return filter keys ( ( list multimap < k , v > ) unfiltered , key predicate ) ; } else if ( unfiltered instanceof filtered key multimap ) { filtered key multimap < k , v > prev = ( filtered key multimap < k , v > ) unfiltered ; return new filtered key multimap < > ( prev unfiltered , predicates < k > and ( prev key predicate , key predicate ) ) ; } else if ( unfiltered instanceof filtered multimap ) { filtered multimap < k , v > prev = ( filtered multimap < k , v > ) unfiltered ; return filter filtered ( prev , maps < k > key predicate on entries ( key predicate ) ) ; } else { return new filtered key multimap < > ( unfiltered , key predicate ) ; } }


creates n new { @ link stream record } of { @ link row data } based on the given fields array and a default update after row kind

public static stream record < row data > update after record ( object fields ) { row data row = row ( fields ) ; row set row kind ( row kind update after ) ; return new stream record < > ( row ) ; }


public void test multiple commands carry over multiple buckets and then age out ( ) throws interrupted exception { hystrix command group key group key = hystrix command group key factory as key ( " thread pool - concurrency - f " ) ; hystrix thread pool key thread pool key = hystrix thread pool key factory as key ( " thread pool - concurrency - f " ) ; hystrix command key key = hystrix command key factory as key ( " rolling concurrency - f " ) ; stream = rolling thread pool max concurrency stream get instance ( thread pool key , 10 , 100 ) ; stream start caching stream values if unstarted ( ) ; final count down latch latch = new count down latch ( 1 ) ; stream observe ( ) take ( 30 ) subscribe ( get subscriber ( latch ) ) ; command cmd 1 = command from ( group key , key , hystrix event type success , 300 ) ; command cmd 2 = command from ( group key , key , hystrix event type success , 300 ) ; command cmd 3 = command from ( group key , key , hystrix event type success , 10 ) ; command cmd 4 = command from ( group key , key , hystrix event type success , 10 ) ; cmd 1 observe ( ) ; thread sleep ( 100 ) ; / / bucket roll cmd 2 observe ( ) ; thread sleep ( 100 ) ; cmd 3 observe ( ) ; thread sleep ( 100 ) ; cmd 4 observe ( ) ; assert true ( latch await ( 10000 , time unit milliseconds ) ) ; assert equals ( 0 , stream get latest rolling max ( ) ) ; }


set the adapter for this { @ link card stack layout }

public void set adapter ( card stack adapter adapter ) { this m adapter = adapter ; m adapter set adapter params ( this ) ; for ( int i = 0 ; i < m adapter get count ( ) ; i + + ) { m adapter add view ( i ) ; } if ( m show init animation ) { post delayed ( this : : restore cards , 500 ) ; } }


for the purposes of unit tests , we don ' t need to actually write durably to disk so , we can skip the fsync ( ) calls for a speed improvement

public static void set should skip fsync for testing ( boolean skip ) { should skip fsync for tests = skip ; }


create a memory block that uses the bytes located at a different location with a 1 : 1 byte mapping scheme

public memory block create byte mapped block ( string name , address start , address mapped address , long length , byte mapping scheme byte mapping scheme , boolean overlay ) throws lock exception , memory conflict exception , address overflow exception , illegal argument exception ;


short - circuit ? : no threadsemaphore : thread thread pool full ? : yes thread pool queue full ? : yes fallback : unsupported operation exception

public void test execution hook thread pool queue full no fallback ( ) { assert hooks on fail fast ( new func 0 < test hystrix command < integer > > ( ) { @ override public test hystrix command < integer > call ( ) { hystrix circuit breaker test test circuit breaker circuit breaker = new hystrix circuit breaker test test circuit breaker ( ) ; hystrix thread pool pool = new single threaded pool with queue ( 1 ) ; try { / / fill the pool get latent command ( execution isolation strategy thread , abstract test hystrix command execution result success , 500 , abstract test hystrix command fallback result unimplemented , circuit breaker , pool , 600 ) observe ( ) ; / / fill the queue get latent command ( execution isolation strategy thread , abstract test hystrix command execution result success , 500 , abstract test hystrix command fallback result unimplemented , circuit breaker , pool , 600 ) observe ( ) ; } catch ( exception e ) { / / ignore } return get latent command ( execution isolation strategy thread , abstract test hystrix command execution result success , 500 , abstract test hystrix command fallback result unimplemented , circuit breaker , pool , 600 ) ; } } , new action 1 < test hystrix command < integer > > ( ) { @ override public void call ( test hystrix command < integer > command ) { testable execution hook hook = command get builder ( ) execution hook ; assert true ( hook command emissions match ( 0 , 1 , 0 ) ) ; assert true ( hook execution events match ( 0 , 0 , 0 ) ) ; assert true ( hook fallback events match ( 0 , 0 , 0 ) ) ; assert equals ( rejected execution exception class , hook get command exception ( ) get class ( ) ) ; assert null ( hook get fallback exception ( ) ) ; assert equals ( " on start - on error - " , hook execution sequence to string ( ) ) ; } } ) ; }


writes a { @ link tuple } data set as csv file ( s ) to the specified location with the specified field and line delimiters < b > note : only a tuple data set can written as a csv file < b > for each tuple field the result of { @ link object # to string ( ) } is written

public data sink < t > write as csv ( string file path , string row delimiter , string field delimiter ) { return internal write as csv ( new path ( file path ) , row delimiter , field delimiter , null ) ; }


creates an ssl context builder with ciphers and apn appropriate for g r p c

public static ssl context builder for server ( input stream key cert chain , input stream key ) { return configure ( ssl context builder for server ( key cert chain , key ) ) ; }


remove all activities from this local activity manager , performing an { @ link activity # on destroy } on any that are currently instantiated

public void remove all activities ( ) { dispatch destroy ( true ) ; }


cleanup any resources used for the multipart handling , like a storage for the uploaded files

void cleanup multipart ( multipart http servlet request request ) ;


writes the specified long at the specified index

public void write long ( long index , long value ) throws i o exception { byte [ ] bytes = converter get bytes ( value ) ; provider write bytes ( index , bytes ) ; }


add the object to the droppable component the drop target adapter calls this method from its drop ( ) method

public void add ( object obj , drop target drop event e , data flavor f ) { address set view view = ( ( selection transfer data ) obj ) get address set ( ) ; if ( view get num address ranges ( ) = = 0 ) { return ; } plugin add memory references ( panel , view , current code unit , instr panel get selected op index ( ) , true ) ; }


waits for the all the services to reach a terminal state for no more than the given time after this method returns all services will either be { @ linkplain service state # terminated terminated } or { @ linkplain service state # failed failed }

public void await stopped ( long timeout , time unit unit ) throws timeout exception { state await stopped ( timeout , unit ) ; }


gets the next address indicating the address after this action record

public address get next address ( ) { return next address ; }


public string get name ( ) { return ( ( reference symbol internals 2 ) internals ) get name ( ) ; }


return the signature of the proxied method

public signature get signature ( ) { return sig 1 ; }


simple server - to - client streaming rpc

public void server streaming rpc ( io grpc testing protobuf simple request request , io grpc stub stream observer < io grpc testing protobuf simple response > response observer ) { io grpc stub client calls async server streaming call ( get channel ( ) new call ( get server streaming rpc method ( ) , get call options ( ) ) , request , response observer ) ; }


set a currency time limit for this attribute

public void set currency time limit ( int currency time limit ) { this currency time limit = currency time limit ; }


sends the message and returns whether the message was sent to its target

public boolean maybe send to target ( long current time ms ) { if ( post time < = current time ms ) { if ( runnable ! = null ) { handler post ( runnable ) ; } else { handler send empty message ( message ) ; } return true ; } return false ; }


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 settings as delimited string

public string to delimited string ( char delimiter ) { string builder sb = new string builder ( ) ; for ( map entry < string , object > entry : settings entry set ( ) ) { sb append ( entry get key ( ) ) append ( " = " ) append ( entry get value ( ) ) append ( delimiter ) ; } return sb to string ( ) ; }


public float get friction ( ) { return fixture get friction ( ) ; }


sets the component id value , used to identify the tool that this test integration belongs to this is optional

public builder set component id ( string id ) { this component id = id ; return this ; }


compute the path where the output of a given job attempt will be placed

public static path get job attempt path ( job context context , path out ) { return get job attempt path ( get app attempt id ( context ) , out ) ; }


public void read ( data entry data entry ) throws i o exception ;


creates an index { @ code immutable list multimap } that contains the results of applying a specified function to each item in this { @ code fluent iterable } of values each element of this iterable will be stored as a value in the resulting multimap , yielding a multimap with the same size as this iterable the key used to store that value in the multimap will be the result of calling the function on that value the resulting multimap is created as an immutable snapshot in the returned multimap , keys appear in the order they are first encountered , and the values corresponding to each key appear in the same order as they are encountered < b > { @ code stream } equivalent : < b > { @ code stream collect ( collectors grouping by ( key function ) ) } behaves similarly , but returns a mutable { @ code map < k , list < e > > } instead , and may not preserve the order of entries )

public final < k > immutable list multimap < k , e > index ( function < ? super e , k > key function ) { return multimaps index ( get delegate ( ) , key function ) ; }


starts the { @ link checkpoint i d counter } service down


this method reads a byte from the file , starting from the current file pointer this method blocks until the byte is read , the end of the stream is detected , or an exception is thrown

public byte read byte ( ) throws i o exception { check open ( ) ; ensure ( 1 ) ; return buffer [ ( int ) buffer offset ] ; }


test the property ' name wrapped array '

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


execute the given callable and return its result as a { @ link completable future } this method can be used to run code outside of the main thread of a { @ link rpc endpoint } < b > important : < b > this executor does not isolate the method invocations against any concurrent invocations and is therefore not suitable to run completion methods of futures that modify state of an { @ link rpc endpoint } for such operations , one needs to use the { @ link rpc endpoint # get main thread executor ( ) main thread execution context } of that { @ code rpc endpoint }

< t > completable future < t > execute ( callable < t > callable ) ;


handle the case where a { @ linkplain org springframework http converter http message converter message converter } cannot write to an http request the default implementation sends an http 500 error , and returns an empty { @ code model and view } alternatively , a fallback view could be chosen , or the http message not writable exception could be rethrown as - is

protected model and view handle http message not writable ( http message not writable exception ex , http servlet request request , http servlet response response , @ nullable object handler ) throws i o exception { send server error ( ex , request , response ) ; return new model and view ( ) ; }


add an instance of { @ link registry config } with the specified id

public dubbo bootstrap registry ( string id , consumer < registry builder > consumer builder ) { registry builder builder = create registry builder ( id ) ; consumer builder accept ( builder ) ; return registry ( builder build ( ) ) ; }


public dex options get dex options ( ) { return dex options ; }


checks if any of the patterns match the given request and returns an instance that is guaranteed to contain matching patterns , sorted

public patterns request condition get matching condition ( server web exchange exchange ) { sorted set < path pattern > matches = get matching patterns ( exchange ) ; return ( matches ! = null ? new patterns request condition ( matches ) : null ) ; }


shows any previously created tool , creating a simple empty tool if not tool has yet been created the given program will be opened in the tool < p > this method is considered sub - standard and users should prefer instead { @ link # launch default tool ( ) } or { @ link # launch default tool ( program ) }

public plugin tool show tool ( program p ) { open ( p ) ; / / this call lazy tool ( ) plugin tool t = abstract ghidra headed integration test show tool ( lazy tool ( ) ) ; remove all consumers except tool ( p , t ) ; return t ; }


used to set the scheduling information associated to a particular job

protected synchronized void set scheduling info ( string scheduling info ) { this scheduling info = scheduling info ; }


when parameter is annotated then jersey classifies such parameter as { @ link org glassfish jersey server model parameter source # unknown } instead of { @ link org glassfish jersey server model parameter source # entity } which is used for unannotated parameters value factory provider resolution logic is different for these two sources therefore must be tested separately

public void annotated principal entity resource without auth 2 0 0 ( ) { string principal name = " astar seran " ; assert that ( target ( " / no - auth - test / annotated - principal - entity " ) request ( ) header ( http headers authorization , " anything here " ) post ( entity entity ( new json principal ( principal name ) , media type application json ) ) read entity ( string class ) ) is equal to ( principal name ) ; }


public uri get source uri ( ) { return m source uri ; }


if unit tests were interrupted and crushed accidentally , the test containers won ' t be deleted in that case , dev can use this tool to list and delete all test containers by default , all test container used in e2e tests sharing same prefix : " abfs - testcontainer - "

public void check containers ( ) throws throwable { assume assume true ( this get auth type ( ) = = auth type shared key ) ; int count = 0 ; cloud storage account storage account = azure blob storage test account create test account ( ) ; cloud blob client blob client = storage account create cloud blob client ( ) ; iterable < cloud blob container > containers = blob client list containers ( test container prefix ) ; for ( cloud blob container container : containers ) { count + + ; log info ( " container { } , uri { } " , container get name ( ) , container get uri ( ) ) ; } log info ( " found { } test containers " , count ) ; }


public long get count ( ) { return count ; }


return the { @ link jdbc template } used by this operation object

public jdbc template get jdbc template ( ) { return this jdbc template ; }


a utility method to analyze the exceptions and collect the clauses

public static list < throwable > get exception causes ( throwable e , list < throwable > causes ) { if ( e get cause ( ) = = null ) { return causes ; } else { causes add ( e get cause ( ) ) ; get exception causes ( e get cause ( ) , causes ) ; } return causes ; }


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 abstract void load model ( list < row > model rows ) ;


returns a future holding the request result

public < k , s extends state , v > completable future < s > get kv state ( final job i d job id , final string queryable state name , final k key , final type hint < k > key type hint , final state descriptor < s , v > state descriptor ) { preconditions check not null ( key type hint ) ; type information < k > key type info = key type hint get type info ( ) ; return get kv state ( job id , queryable state name , key , key type info , state descriptor ) ; }


return the specified node to cache with the associated buffer object

private void return to cache ( buffer node node , data buffer buf ) { / / ? ? should not happen if ( node buffer ! = null | | buf = = null ) { throw new assert exception ( ) ; } node buffer = buf ; / / todo : set buffer id node add to cache ( cache head ) ; + + buffers on hand ; }


constructs a merkle tree from a lexicographically sorted map of files

public static merkle tree build ( sorted map < path fragment , path > input files , digest util digest util ) throws i o exception { try ( silent closeable c = profiler instance ( ) profile ( " merkle tree build ( path ) " ) ) { directory tree tree = directory tree builder from paths ( input files , digest util ) ; return build ( tree , digest util ) ; } }


this forces page to be redisplayed when location has not changed

private void reload page ( url help u r l ) { if ( ! ( main h b instanceof g help broker ) ) { / / not our broker installed ; can ' t force a reload return ; } ( ( g help broker ) main h b ) reload help page ( validate url ( help u r l ) ) ; }


filter invokers with current routing rule and only return the invokers that comply with the rule

< t > list < invoker < t > > route ( list < invoker < t > > invokers , url url , invocation invocation ) throws rpc exception ;


disposes the object and releases all resources after calling this method , calling any methods on the object may result in undefined behavior


returns a string that shows the current line with the field under the cursor in between ' [ ] ' chars

string current token to string ( ) { decompiler panel decompiler panel = controller get decompiler panel ( ) ; field location cursor = decompiler panel get cursor position ( ) ; list < clang line > lines = decompiler panel get lines ( ) ; clang line line = lines get ( cursor get row ( ) ) ; clang token token at cursor = decompiler panel get token at cursor ( ) ; list < clang token > tokens = arrays as list ( token at cursor ) ; string string = line to debug string ( tokens ) ; return string ; }


returns true iff the refresh setting exists or in other words is explicitly set

public boolean is explicit refresh ( ) { return index refresh interval setting exists ( settings ) ; }


set the additional ( undeclared ) property with the specified name and value if the property does not already exist , create it otherwise replace it

public my schema name characters put additional property ( string key , object value ) { if ( this additional properties = = null ) { this additional properties = new hash map < string , object > ( ) ; } this additional properties put ( key , value ) ; return this ; }


base 6 4 version of the commit id ( see { @ link segment infos # get id ( ) }

public string get id ( ) { return id ; }


find the level down to which to assign all nodes black this is the last ` full ' level of the complete binary tree produced by build tree the remaining nodes are colored red ( this makes a ` nice ' set of color assignments wrt future insertions ) this level number is computed by finding the number of splits needed to reach the zeroeth node ( the answer is ~ lg ( n ) , but in any case must be computed by same quick o ( lg ( n ) ) loop )

private static int compute red level ( int sz ) { int level = 0 ; for ( int m = sz - 1 ; m > = 0 ; m = m / 2 - 1 ) level + + ; return level ; }


public void write long ( long l ) throws i o exception { out write ( type long code ) ; out write long ( l ) ; }


verifies that the resources are set onto each job vertex correctly when generating job graph which covers the delta iteration case

public void test resources for delta iteration ( ) throws exception { resource spec resource 1 = resource spec new builder ( 0 1 , 100 ) build ( ) ; resource spec resource 2 = resource spec new builder ( 0 2 , 200 ) build ( ) ; resource spec resource 3 = resource spec new builder ( 0 3 , 300 ) build ( ) ; resource spec resource 4 = resource spec new builder ( 0 4 , 400 ) build ( ) ; resource spec resource 5 = resource spec new builder ( 0 5 , 500 ) build ( ) ; resource spec resource 6 = resource spec new builder ( 0 6 , 600 ) build ( ) ; method op method = operator class get declared method ( " set resources " , resource spec class ) ; op method set accessible ( true ) ; method delta method = delta iteration class get declared method ( " set resources " , resource spec class ) ; delta method set accessible ( true ) ; method sink method = data sink class get declared method ( " set resources " , resource spec class ) ; sink method set accessible ( true ) ; map function < tuple 2 < long , long > , tuple 2 < long , long > > map function = new map function < tuple 2 < long , long > , tuple 2 < long , long > > ( ) { @ override public tuple 2 < long , long > map ( tuple 2 < long , long > value ) throws exception { return value ; } } ; filter function < tuple 2 < long , long > > filter function = new filter function < tuple 2 < long , long > > ( ) { @ override public boolean filter ( tuple 2 < long , long > value ) throws exception { return false ; } } ; execution environment env = execution environment get execution environment ( ) ; data set < tuple 2 < long , long > > input = env from elements ( new tuple 2 < > ( 1l , 2l ) ) ; op method invoke ( input , resource 1 ) ; / / chain ( map - > filter ) data set < tuple 2 < long , long > > map = input map ( map function ) ; op method invoke ( map , resource 2 ) ; delta iteration < tuple 2 < long , long > , tuple 2 < long , long > > iteration = map iterate delta ( map , 100 , 0 ) register aggregator ( " test " , new long sum aggregator ( ) ) ; delta method invoke ( iteration , resource 3 ) ; data set < tuple 2 < long , long > > delta = iteration get workset ( ) map ( map function ) ; op method invoke ( delta , resource 4 ) ; data set < tuple 2 < long , long > > feedback = delta filter ( filter function ) ; op method invoke ( feedback , resource 5 ) ; data sink < tuple 2 < long , long > > sink = iteration close with ( delta , feedback ) output ( new discarding output format < tuple 2 < long , long > > ( ) ) ; sink method invoke ( sink , resource 6 ) ; job graph job graph = compile job ( env ) ; job vertex source map vertex = job graph get vertices sorted topologically from sources ( ) get ( 0 ) ; job vertex iteration head vertex = job graph get vertices sorted topologically from sources ( ) get ( 1 ) ; job vertex delta vertex = job graph get vertices sorted topologically from sources ( ) get ( 2 ) ; job vertex iteration tail vertex = job graph get vertices sorted topologically from sources ( ) get ( 3 ) ; job vertex feedback vertex = job graph get vertices sorted topologically from sources ( ) get ( 4 ) ; job vertex sink vertex = job graph get vertices sorted topologically from sources ( ) get ( 5 ) ; job vertex iteration sync vertex = job graph get vertices sorted topologically from sources ( ) get ( 6 ) ; assert true ( source map vertex get min resources ( ) equals ( resource 1 merge ( resource 2 ) ) ) ; assert true ( iteration head vertex get preferred resources ( ) equals ( resource 3 ) ) ; assert true ( delta vertex get min resources ( ) equals ( resource 4 ) ) ; / / the iteration tail task will be scheduled in the same instance with iteration head , and / / currently not set resources assert true ( iteration tail vertex get preferred resources ( ) equals ( resource spec default ) ) ; assert true ( feedback vertex get min resources ( ) equals ( resource 5 ) ) ; assert true ( sink vertex get preferred resources ( ) equals ( resource 6 ) ) ; assert true ( iteration sync vertex get min resources ( ) equals ( resource 3 ) ) ; }


creates a new { @ link parameters action } that contains all the parameters in this action with the overrides new values given as parameters

public parameters action create updated ( collection < ? extends parameter value > overrides ) { if ( overrides = = null ) { parameters action parameters action = new parameters action ( parameters ) ; parameters action safe parameters = this safe parameters ; return parameters action ; } list < parameter value > combined parameters = lists new array list ( overrides ) ; set < string > names = new hash set ( ) ; for ( parameter value v : overrides ) { if ( v = = null ) continue ; names add ( v get name ( ) ) ; } for ( parameter value v : parameters ) { if ( v = = null ) continue ; if ( ! names contains ( v get name ( ) ) ) { combined parameters add ( v ) ; } } return new parameters action ( combined parameters , this safe parameters ) ; } / * * creates a new { @ link parameters action } that contains all the parameters in this action * with the overrides / new values given as another { @ link parameters action } * @ return new { @ link parameters action } the result may contain null { @ link parameter value }


tests that deleted blocks should not be returned by { @ link low redundancy blocks # choose low redundancy blocks ( int , boolean ) }

public void test deleted blocks ( ) throws exception { int num blocks = 5 ; low redundancy blocks queues = new low redundancy blocks ( ) ; / / create 5 blockinfos the first one is corrupt for ( int ind = 0 ; ind < num blocks ; ind + + ) { block info block info = gen block info ( ind , ind = = 0 ) ; queues add ( block info , 2 , 0 , 0 , 3 ) ; } list < list < block info > > blocks ; / / get two blocks from the queue , but we should only get one because first / / block is deleted blocks = queues choose low redundancy blocks ( 2 , false ) ; assert equals ( 1 , blocks get ( 2 ) size ( ) ) ; assert equals ( 1 , blocks get ( 2 ) get ( 0 ) get block id ( ) ) ; / / get the next blocks - should be id 2 blocks = queues choose low redundancy blocks ( 1 , false ) ; assert equals ( 2 , blocks get ( 2 ) get ( 0 ) get block id ( ) ) ; / / get the next block , but also reset this time - should be id 3 returned blocks = queues choose low redundancy blocks ( 1 , true ) ; assert equals ( 3 , blocks get ( 2 ) get ( 0 ) get block id ( ) ) ; / / get one more block and due to resetting the queue it will be block id 1 blocks = queues choose low redundancy blocks ( 1 , false ) ; assert equals ( 1 , blocks get ( 2 ) get ( 0 ) get block id ( ) ) ; }


get the address set that the get differences method results are restricted to null indicates no current restrictions the addresses in the returned address set are derived from program 1

synchronized public address set view get restricted address set ( ) { return restrict address set ; }


ensures that the cache statistics match exactly the given values

private void assert statistics ( int hits , iterable < miss detail > misses ) { action cache statistics builder builder = action cache statistics new builder ( ) ; cache merge into action cache statistics ( builder ) ; action cache statistics stats = builder build ( ) ; assert that ( stats get hits ( ) ) is equal to ( hits ) ; assert that ( stats get miss details list ( ) ) contains exactly elements in ( misses ) ; }


connects to the debug server , and starts listening for events

void connect ( server socket server socket , duration timeout ) { long start time millis = system current time millis ( ) ; i o exception exception = null ; while ( system current time millis ( ) - start time millis < timeout to millis ( ) ) { try { client socket = new socket ( ) ; client socket connect ( new inet socket address ( server socket get inet address ( ) , server socket get local port ( ) ) , 100 ) ; read task = read task executor submit ( ( ) - > { while ( true ) { event received ( debug event parse delimited from ( client socket get input stream ( ) ) ) ; } } ) ; return ; } catch ( i o exception e ) { exception = e ; } } throw new runtime exception ( " couldn ' t connect to the debug server " , exception ) ; }


combines the given jobs overview with this

public jobs overview combine ( jobs overview jobs overview ) { return new jobs overview ( this , jobs overview ) ; }


get the create flag as set during the config setup

public boolean get create flag ( ) { return create queue ; }


asynchronously send a record to a topic equivalent to < code > send ( record , null ) < code > see { @ link # send ( producer record , callback ) } for details

public future < record metadata > send ( producer record < k , v > record ) { return send ( record , null ) ; }


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


negative test to verify rename access check

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


public boolean is compatible ( dalv insn insn ) { register spec list regs = insn get registers ( ) ; if ( ! ( ( insn instanceof target insn ) & & ( regs size ( ) = = 1 ) & & unsigned fits in byte ( regs get ( 0 ) get reg ( ) ) ) ) { return false ; } target insn ti = ( target insn ) insn ; return ti has target offset ( ) ? branch fits ( ti ) : true ; }


public query get child query ( ) { return query get child query ( ) ; }


load a compiled expression class makes sure the classloaders aren ' t used too much because they anchor compiled classes in memory and prevent gc if you have expressions continually recompiling over time then by replacing the classloader periodically at least some of the older variants can be garbage collected

private class < ? extends compiled expression > load class ( string name , byte [ ] bytes ) { child class loader ccl = this child class loader ; if ( ccl get classes defined count ( ) > = classes defined limit ) { synchronized ( this ) { child class loader current ccl = this child class loader ; if ( ccl = = current ccl ) { / / still the same class loader that needs to be replaced ccl = new child class loader ( ccl get parent ( ) ) ; this child class loader = ccl ; } else { / / already replaced by some other thread , let ' s pick it up ccl = current ccl ; } } } return ( class < ? extends compiled expression > ) ccl define class ( name , bytes ) ; }


indicates whether the total hits in the response should be serialized as number ( < code > true < code > ) or as an object ( < code > false < code > ) defaults to false

public void set rest total hits as int ( boolean value ) { this rest total hits as int = value ; }


returns whether the given options class uses only the core types listed in { @ link uses only core types # core types } these are guaranteed to be deeply immutable and serializable

public static boolean get uses only core types ( class < ? extends options base > options class ) { options data data = options parser get options data internal ( options class ) ; return data get uses only core types ( options class ) ; }


not yet implemented returns string with style information ( if any )

public char sequence get ( int index ) { return get string ( index ) ; }


creates an artifact in a directory that is unique to the package that contains the rule , thus guaranteeing that it never clashes with artifacts created by rules in other packages

artifact get package relative artifact ( path fragment relative , artifact root root ) ;


our bitmaps live in ashmem , meaning that they are pinned in androids ' shared native memory therefore , we are not constrained by the max heap size of the dalvik heap , but we want to make sure we don ' t use too much memory on low end devices , so that we don ' t force other background process to be evicted

private static int get max size hard cap ( ) { final int max memory = ( int ) math min ( runtime get runtime ( ) max memory ( ) , integer max value ) ; if ( max memory > 16 * byte constants mb ) { return max memory / 4 * 3 ; } else { return max memory / 2 ; } }


creates a random mapping , with the mapping definition nested under the given type name

public static x content builder random mapping ( string type ) throws i o exception { x content builder builder = x content factory content builder ( random from ( x content type values ( ) ) ) ; builder start object ( ) start object ( type ) ; random mapping fields ( builder , true ) ; builder end object ( ) end object ( ) ; return builder ; }


resolves the provided pattern or field name from the { @ link query shard context } and return a map of the expanded fields with their original boost

static map < string , float > resolve mapping field ( query shard context context , string field or pattern , float weight , boolean accept all types , boolean accept metadata field , string field suffix ) { set < string > all fields = context simple match to index names ( field or pattern ) ; map < string , float > fields = new hash map < > ( ) ; for ( string field name : all fields ) { if ( field suffix ! = null & & context get field type ( field name + field suffix ) ! = null ) { field name = field name + field suffix ; } if ( context is field mapped ( field name ) = = false ) { continue ; } mapped field type field type = context get field type ( field name ) ; if ( accept metadata field = = false & & field type name ( ) starts with ( " " ) ) { / / ignore metadata fields continue ; } if ( accept all types = = false ) { if ( field type get text search info ( ) = = text search info none ) { continue ; } } / / deduplicate aliases and their concrete fields string resolved field name = field type name ( ) ; if ( all fields contains ( resolved field name ) ) { field name = resolved field name ; } float w = fields get or default ( field name , 1 0f ) ; fields put ( field name , w * weight ) ; } return fields ; }


public boolean equals ( object obj ) { return super equals ( obj ) ; }


set assignments for the topologies which needs scheduling the new assignments is available through < code > cluster get assignments ( ) < code >

void schedule ( topologies topologies , cluster cluster ) ;


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


when failing over , new active rm should read from current state of store , including any updates when the new active rm was in standby

public void test failover reads from updated store ( ) throws exception { h a service protocol state change request info req = new h a service protocol state change request info ( h a service protocol request source request by user ) ; configuration conf 1 = create r m h a conf ( " rm 1 , rm 2 " , " rm 1 " , 1234 ) ; resource manager rm 1 = new mock r m ( conf 1 ) ; rm 1 start ( ) ; rm 1 get r m context ( ) get r m admin service ( ) transition to active ( req ) ; assert equals ( " rm with z k store didn ' t start " , service state started , rm 1 get service state ( ) ) ; assert equals ( " rm should be active " , h a service protocol h a service state active , rm 1 get r m context ( ) get r m admin service ( ) get service status ( ) get state ( ) ) ; assert null ( ( ( mutable conf scheduler ) rm 1 get resource scheduler ( ) ) get configuration ( ) get ( " key " ) ) ; configuration conf 2 = create r m h a conf ( " rm 1 , rm 2 " , " rm 2 " , 5678 ) ; resource manager rm 2 = new mock r m ( conf 2 ) ; rm 2 start ( ) ; assert equals ( " rm should be standby " , h a service protocol h a service state standby , rm 2 get r m context ( ) get r m admin service ( ) get service status ( ) get state ( ) ) ; / / update configuration on rm1 sched conf update info sched conf update info = new sched conf update info ( ) ; sched conf update info get global params ( ) put ( " key " , " val " ) ; mutable configuration provider conf provider = ( ( mutable conf scheduler ) rm 1 get resource scheduler ( ) ) get mutable conf provider ( ) ; user group information user = user group information create user for testing ( test user , new string [ 0 ] ) ; log mutation log = conf provider log and apply mutation ( user , sched conf update info ) ; rm 1 get resource scheduler ( ) reinitialize ( conf 1 , rm 1 get r m context ( ) ) ; assert equals ( " val " , ( ( mutable conf scheduler ) rm 1 get resource scheduler ( ) ) get configuration ( ) get ( " key " ) ) ; conf provider confirm pending mutation ( log , true ) ; assert equals ( " val " , ( ( mutable c s configuration provider ) conf provider ) get conf store ( ) retrieve ( ) get ( " key " ) ) ; / / next update is not persisted , it should not be recovered sched conf update info get global params ( ) put ( " key " , " bad val " ) ; log = conf provider log and apply mutation ( user , sched conf update info ) ; / / start rm2 and verifies it starts with updated configuration rm 2 get r m context ( ) get r m admin service ( ) transition to active ( req ) ; assert equals ( " rm with z k store didn ' t start " , service state started , rm 2 get service state ( ) ) ; assert equals ( " rm should be active " , h a service protocol h a service state active , rm 2 get r m context ( ) get r m admin service ( ) get service status ( ) get state ( ) ) ; for ( int i = 0 ; i < zk timeout ms / 50 ; i + + ) { if ( h a service protocol h a service state active = = rm 1 get r m context ( ) get r m admin service ( ) get service status ( ) get state ( ) ) { thread sleep ( 100 ) ; } } assert equals ( " rm should have been fenced " , h a service protocol h a service state standby , rm 1 get r m context ( ) get r m admin service ( ) get service status ( ) get state ( ) ) ; assert equals ( " rm should be active " , h a service protocol h a service state active , rm 2 get r m context ( ) get r m admin service ( ) get service status ( ) get state ( ) ) ; assert equals ( " val " , ( ( mutable c s configuration provider ) ( ( capacity scheduler ) rm 2 get resource scheduler ( ) ) get mutable conf provider ( ) ) get conf store ( ) retrieve ( ) get ( " key " ) ) ; assert equals ( " val " , ( ( mutable conf scheduler ) rm 2 get resource scheduler ( ) ) get configuration ( ) get ( " key " ) ) ; / / transition to standby will set rm ' s ha status and then reinitialize in / / a separate thread despite asserting for standby state , it ' s / / possible for reinitialization to be unfinished wait here for it to / / finish , otherwise closing rm 1 will close zk manager and the unfinished / / reinitialization will throw an exception thread sleep ( 10000 ) ; rm 1 close ( ) ; rm 2 close ( ) ; }


private static j s o n object normalize key config ( object key ) throws j s o n exception { j s o n object jobject ; if ( key instanceof string ) { jobject = new j s o n object ( ) ; jobject put ( " key " , key ) ; } else if ( key instanceof j s o n object ) { jobject = ( j s o n object ) key ; } else { throw new j s o n exception ( " an key in the extra - key matrix must be a string or an object " ) ; } return jobject ; }


format the given date object into string

public string format date ( date date ) { return date format format ( date ) ; }


increase heap usage by current process by the given amount this is done by creating objects each of size 1mb

public void load ( long size in m b ) { for ( long i = 0 ; i < size in m b ; + + i ) { / / create another string object of size 1mb heap space add ( ( object ) new byte [ one mb ] ) ; } }