initialize the handler , setup the authentication entry attributes

public void initialize ( ) { val attributes = new hash set < string > ( ) ; logger debug ( " initializing ldap attribute configuration " ) ; if ( string utils is not blank ( this principal id attribute ) ) { logger debug ( " configured to retrieve principal id attribute [ { } ] " , this principal id attribute ) ; attributes add ( this principal id attribute ) ; } if ( this principal attribute map ! = null & & ! this principal attribute map is empty ( ) ) { val attrs = this principal attribute map key set ( ) ; attributes add all ( attrs ) ; logger debug ( " configured to retrieve principal attribute collection of [ { } ] " , attrs ) ; } this authenticated entry attributes = attributes to array ( array utils empty string array ) ; logger debug ( " ldap authentication entry attributes for the authentication request are [ { } ] " , ( object [ ] ) this authenticated entry attributes ) ; }


disk attribute and disk file upload class of netty store post chunks and file chunks as temp files on local disk by default , netty will register these temp files to java io delete on exit hook which may lead to memory leak { @ link file upload handler } disables the shutdown hook registration so no file should be registered note that clean up of temp files is handed over to { @ link org apache flink runtime entrypoint cluster entrypoint }

private void verify no file is registered to delete on exit hook ( ) { try { class < ? > clazz = class for name ( " java io delete on exit hook " ) ; field field = clazz get declared field ( " files " ) ; field set accessible ( true ) ; linked hash set files = ( linked hash set ) field get ( null ) ; assert true ( files is empty ( ) ) ; } catch ( class not found exception | illegal access exception | no such field exception e ) { fail ( " this should never happen " ) ; } }


write just the given { @ link user } , but not the inner { @ link # authenticated user }

private static void write user ( user user , stream output output ) throws i o exception { output write boolean ( false ) ; / / not a system user output write string ( user username ) ; output write string array ( user roles ) ; output write map ( user metadata ) ; output write optional string ( user full name ) ; output write optional string ( user email ) ; output write boolean ( user enabled ) ; }


retrieve the message for the given code , using the " default html escape " setting

public string get message ( string code , @ nullable object [ ] args , string default message ) { return get message ( code , args , default message , is default html escape ( ) ) ; }


gets the d register number , as a code unit this will throw if the value is out of the range of an unsigned code unit

public final short get d unit ( ) { int d = get d ( ) ; if ( ( d & ~ 0xffff ) ! = 0 ) { throw new dex exception 2 ( " register d out of range : " + hex u 8 ( d ) ) ; } return ( short ) d ; }


checks whether the jni bundle was successfully loaded or not

public static boolean is jni available ( ) { return jni available ; }


asynchronous version of { @ link abstract dao # update in tx ( iterable ) }

public < e > async operation update in tx ( class < e > entity class , iterable < e > entities ) { return update in tx ( entity class , entities , 0 ) ; }


get next data - type which should be used

public data type get next data type ( data type current data type , boolean stack pointers ) { if ( data list size ( ) = = 0 ) { return null ; } data type data type = current data type ; pointer ptr = null ; if ( stack pointers & & data type instanceof pointer ) { ptr = ( pointer ) data type ; data type = get next data type ( ptr get data type ( ) , true ) ; return ptr new pointer ( data type ) ; } int index = - 1 ; if ( data type ! = null & & ! data type is equivalent ( data type default ) ) { for ( int i = 0 ; i < data list size ( ) ; i + + ) { data type cycle dt = data list get ( i ) ; if ( data type is equivalent ( cycle dt ) ) { index = i ; break ; } } } if ( + + index > = data list size ( ) ) { data type = data list get ( 0 ) ; } else { data type = data list get ( index ) ; } return data type ; }


create the rpc invocation message for the given rpc

protected rpc invocation create rpc invocation message ( final string method name , final class < ? > [ ] parameter types , final object [ ] args ) throws i o exception { final rpc invocation rpc invocation ; if ( is local ) { rpc invocation = new local rpc invocation ( method name , parameter types , args ) ; } else { try { remote rpc invocation remote rpc invocation = new remote rpc invocation ( method name , parameter types , args ) ; if ( remote rpc invocation get size ( ) > maximum framesize ) { throw new i o exception ( string format ( " the rpc invocation size % d exceeds the maximum akka framesize " , remote rpc invocation get size ( ) ) ) ; } else { rpc invocation = remote rpc invocation ; } } catch ( i o exception e ) { log warn ( " could not create remote rpc invocation message failing rpc invocation because " , e ) ; throw e ; } } return rpc invocation ; } / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / / helper methods / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


test the property ' name wrapped array '

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


returns the lines from { @ code cpu stat } for the control group to which the elasticsearch process belongs for the { @ code cpu } subsystem these lines represent the cpu time statistics and have the form < blockquote > nr periods \ d + nr throttled \ d + throttled time \ d + < blockquote > where { @ code nr periods } is the number of period intervals as specified by { @ code cpu cfs period us } that have elapsed , { @ code nr throttled } is the number of times tasks in the given control group have been throttled , and { @ code throttled time } is the total time in nanoseconds for which tasks in the given control group have been throttled

list < string > read sys fs cgroup cpu acct cpu stat ( final string control group ) throws i o exception { final list < string > lines = files read all lines ( path utils get ( " / sys / fs / cgroup / cpu " , control group , " cpu stat " ) ) ; assert lines ! = null & & lines size ( ) = = 3 ; return lines ; }


not like { @ cod share security check get package properties if present } we don ' t check signatures or other files , we just get the package meta ' s properties directly

public static properties fast get patch package meta ( file patch file ) { if ( patch file = = null | | ! patch file is file ( ) | | patch file length ( ) = = 0 ) { share tinker log e ( tag , " patch file is illegal " ) ; return null ; } zip file zip file = null ; try { zip file = new zip file ( patch file ) ; zip entry package entry = zip file get entry ( share constants package meta file ) ; if ( package entry = = null ) { share tinker log e ( tag , " patch meta entry not found " ) ; return null ; } input stream input stream = null ; try { input stream = zip file get input stream ( package entry ) ; properties properties = new properties ( ) ; properties load ( input stream ) ; return properties ; } finally { share patch file util close quietly ( input stream ) ; } } catch ( i o exception e ) { share tinker log e ( tag , " fast get patch package meta exception : " + e get message ( ) ) ; return null ; } finally { share patch file util close zip ( zip file ) ; } }


public post data response post data ( post data request request , request options options ) throws i o exception { return rest high level client perform request and parse entity ( request , m l request converters : : post data , options , post data response : : from x content , collections empty set ( ) ) ; }


get all of the xattrs for a file or directory only those xattrs for which the logged - in user has permissions to view are returned refer to the hdfs extended attributes user documentation for details

public map < string , byte [ ] > get x attrs ( path path , list < string > names ) throws i o exception { throw new unsupported operation exception ( get class ( ) get simple name ( ) + " doesn ' t support get x attrs " ) ; }


main loop for each bp thread run until shutdown , forever calling remote name node functions

private void offer service ( ) throws exception { log info ( " for namenode " + nn addr + " using " + " blockreport interval of " + dn conf block report interval + " msecs " + " cachereport interval of " + dn conf cache report interval + " msecs " + " initial delay : " + dn conf initial block report delay ms + " msecs " + " ; heart beat interval = " + dn conf heart beat interval + ( lifeline sender ! = null ? " ; lifeline interval ms = " + dn conf get lifeline interval ms ( ) : " " ) ) ; / / / / now loop for a long time / / while ( should run ( ) ) { try { data node fault injector get ( ) start offer service ( ) ; final long start time = scheduler monotonic now ( ) ; / / / / every so often , send heartbeat or block - report / / final boolean send heartbeat = scheduler is heartbeat due ( start time ) ; heartbeat response resp = null ; if ( send heartbeat ) { / / / / all heartbeat messages include following info : / / - - datanode name / / - - data transfer port / / - - total capacity / / - - bytes remaining / / boolean request block report lease = ( full block report lease id = = 0 ) & & scheduler is block report due ( start time ) ; if ( ! dn are heartbeats disabled for tests ( ) ) { resp = send heart beat ( request block report lease ) ; assert resp ! = null ; if ( resp get full block report lease id ( ) ! = 0 ) { if ( full block report lease id ! = 0 ) { log warn ( nn addr + " sent back a full block report lease " + " id of 0x " + long to hex string ( resp get full block report lease id ( ) ) + " , but we already have a lease id of 0x " + long to hex string ( full block report lease id ) + " " + " overwriting old lease id " ) ; } full block report lease id = resp get full block report lease id ( ) ; } dn get metrics ( ) add heartbeat ( scheduler monotonic now ( ) - start time , get rpc metric suffix ( ) ) ; / / if the state of this nn has changed ( eg standby - > active ) / / then let the b p offer service update itself / / / / important that this happens before process command below , / / since the first heartbeat to a new active might have commands / / that we should actually process bpos update actor states from heartbeat ( this , resp get name node ha state ( ) ) ; state = resp get name node ha state ( ) get state ( ) ; if ( state = = h a service state active ) { handle rolling upgrade status ( resp ) ; } command processing thread enqueue ( resp get commands ( ) ) ; } } if ( ! dn are i b r disabled for tests ( ) & & ( ibr manager send immediately ( ) | | send heartbeat ) ) { ibr manager send i b rs ( bp namenode , bp registration , bpos get block pool id ( ) , get rpc metric suffix ( ) ) ; } list < datanode command > cmds = null ; boolean force full br = scheduler force full block report get and set ( false ) ; if ( force full br ) { log info ( " forcing a full block report to " + nn addr ) ; } if ( ( full block report lease id ! = 0 ) | | force full br ) { cmds = block report ( full block report lease id ) ; full block report lease id = 0 ; } command processing thread enqueue ( cmds ) ; if ( ! dn are cache reports disabled for tests ( ) ) { datanode command cmd = cache report ( ) ; command processing thread enqueue ( cmd ) ; } if ( send heartbeat ) { dn get metrics ( ) add heartbeat total ( scheduler monotonic now ( ) - start time , get rpc metric suffix ( ) ) ; } / / there is no work to do ; sleep until hearbeat timer elapses , / / or work arrives , and then iterate again ibr manager wait till next i b r ( scheduler get heartbeat wait time ( ) ) ; } catch ( remote exception re ) { string re class = re get class name ( ) ; if ( unregistered node exception class get name ( ) equals ( re class ) | | disallowed datanode exception class get name ( ) equals ( re class ) | | incorrect version exception class get name ( ) equals ( re class ) ) { log warn ( this + " is shutting down " , re ) ; should service run = false ; return ; } log warn ( " remote exception in offer service " , re ) ; sleep after exception ( ) ; } catch ( i o exception e ) { log warn ( " i o exception in offer service " , e ) ; sleep after exception ( ) ; } finally { data node fault injector get ( ) end offer service ( ) ; } process queue messages ( ) ; } / / while ( should run ( ) ) }


assert that the given text does not contain the given substring < pre class = " code " > assert does not contain ( name , " rod " , " name must not contain ' rod ' " ) ;

public static void does not contain ( @ nullable string text to search , string substring , string message ) { if ( string utils has length ( text to search ) & & string utils has length ( substring ) & & text to search contains ( substring ) ) { throw new illegal argument exception ( message ) ; } }


public boolean is files being written empty ( ) { synchronized ( files being written ) { return files being written is empty ( ) ; } }


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

public void delete user ( string username , api client auth info auth info , handler < async result < void > > result handler ) { object local var body = null ; / / verify the required parameter ' username ' is set if ( username = = null ) { result handler handle ( api exception fail ( 400 , " missing the required parameter ' username ' when calling delete user " ) ) ; return ; } / / create path and map variables string local var path = " / user / { username } " replace all ( " \ \ { " + " username " + " \ \ } " , encode parameter ( username to string ( ) ) ) ; / / query params list < pair > local var query params = new array list < > ( ) ; / / header params multi map local var header params = multi map case insensitive multi map ( ) ; / / cookie params multi map local var cookie params = multi map case insensitive multi map ( ) ; / / form params / / todo : sending files within multipart / form - data is not supported yet ( because of vertx web - client ) map < string , object > local var form params = new hash map < > ( ) ; string [ ] local var accepts = { } ; string [ ] local var content types = { } ; string [ ] local var auth names = new string [ ] { } ; api client invoke a p i ( local var path , " delete " , local var query params , local var body , local var header params , local var cookie params , local var form params , local var accepts , local var content types , local var auth names , auth info , null , result handler ) ; }


protected void on refresh ( ) { this theme source = ui application context utils init theme source ( this ) ; }


return the expression string used to create this { @ code cron expression }

public string to string ( ) { return this expression ; }


returns the program associated with this location

public program get program ( ) { return program ; }


generates the files for the ranks relation the ranks entries apply the following format : < br > < code > rank | url | average duration | \ n < code >

private static void gen ranks ( int no docs , string path ) { random rand = new random ( calendar get instance ( ) get time in millis ( ) ) ; try ( buffered writer fw = new buffered writer ( new file writer ( path ) ) ) { for ( int i = 0 ; i < no docs ; i + + ) { / / rank string builder rank = new string builder ( rand next int ( 100 ) + " | " ) ; / / url rank append ( " url " + i + " | " ) ; / / average duration rank append ( rand next int ( 10 ) + rand next int ( 50 ) + " | \ n " ) ; fw write ( rank to string ( ) ) ; } } catch ( i o exception e ) { e print stack trace ( ) ; } }


config file in the standard format like xml , properties , json , yaml , template

public aux service file type ( type enum t ) { this type = t ; return this ; }


train and produce a { @ link model base } which fits the records from the given { @ link batch operator }

protected abstract m fit ( batch operator input ) ;


formats an { @ code int } as a 1 - byte signed hex value

public static string s 1 ( int v ) { char [ ] result = new char [ 3 ] ; if ( v < 0 ) { result [ 0 ] = ' - ' ; v = - v ; } else { result [ 0 ] = ' + ' ; } for ( int i = 0 ; i < 2 ; i + + ) { result [ 2 - i ] = character for digit ( v & 0x 0f , 16 ) ; v > > = 4 ; } return new string ( result ) ; }


public static string load digestes ( jar file jar file , jar entry je ) throws exception { input stream bis = null ; string builder sb = new string builder ( ) ; try { input stream is = jar file get input stream ( je ) ; byte [ ] bytes = new byte [ share constants buffer size ] ; bis = new buffered input stream ( is ) ; int read bytes ; while ( ( read bytes = bis read ( bytes ) ) > 0 ) { sb append ( new string ( bytes , 0 , read bytes ) ) ; } } finally { close quietly ( bis ) ; } return sb to string ( ) ; }


if the { @ code human readable } flag is set , writes both a formatted and unformatted version of the time value using the date transformer for the { @ link long } class

public x content builder time field ( string name , string readable name , long value ) throws i o exception { assert name equals ( readable name ) = = false : " expected raw and readable field names to differ , but they were both : " + name ; if ( human readable ) { function < object , object > long transformer = date transformers get ( long class ) ; if ( long transformer = = null ) { throw new illegal argument exception ( " cannot write time value xcontent for unknown value of type long " ) ; } field ( readable name ) value ( long transformer apply ( value ) ) ; } field ( name , value ) ; return this ; }


update old - format filesystem names , for back - compatibility this should eventually be replaced with a check name ( ) method that throws an exception for old - format names

private static string fix name ( string name ) { / / convert old - format name to new - format name if ( name equals ( " local " ) ) { / / " local " is now " file : / / / " logger warn ( " \ " local \ " is a deprecated filesystem name " + " use \ " file : / / / \ " instead " ) ; name = " file : / / / " ; } else if ( name index of ( ' / ' ) = = - 1 ) { / / unqualified is " hdfs : / / " logger warn ( " \ " " + name + " \ " is a deprecated filesystem name " + " use \ " hdfs : / / " + name + " / \ " instead " ) ; name = " hdfs : / / " + name ; } return name ; }


return the handler methods for the given mapping name

public list < handler method > get handler methods for mapping name ( string mapping name ) { return this mapping registry get handler methods by mapping name ( mapping name ) ; }


convenience wrapper that simply calls through to { @ code observer change indent ( ) }

private void change indent ( int indent ) { observer change indent ( indent ) ; }


returns the top axis space in percent of the full range default 1 0f

public float get space top ( ) { return m space percent top ; }


merge all input files to output map file < br > 1 read first keyvalue from all input files to keysvalues array < br > 2 select the least key and corresponding value < br > 3 write the selected key and value to output file < br > 4 replace the already written keyvalue in keysvalues arrays with the next keyvalue from the selected input < br > 5 repeat step 2 - 4 till all keys are read < br >

private void merge pass ( ) throws i o exception { / / re - usable array writable comparable [ ] keys = new writable comparable [ in readers length ] ; writable [ ] values = new writable [ in readers length ] ; / / read first key / value from all inputs for ( int i = 0 ; i < in readers length ; i + + ) { keys [ i ] = reflection utils new instance ( key class , null ) ; values [ i ] = reflection utils new instance ( value class , null ) ; if ( ! in readers [ i ] next ( keys [ i ] , values [ i ] ) ) { / / handle empty files keys [ i ] = null ; values [ i ] = null ; } } do { int current entry = - 1 ; writable comparable current key = null ; writable current value = null ; for ( int i = 0 ; i < keys length ; i + + ) { if ( keys [ i ] = = null ) { / / skip readers reached eof continue ; } if ( current key = = null | | comparator compare ( current key , keys [ i ] ) > 0 ) { current entry = i ; current key = keys [ i ] ; current value = values [ i ] ; } } if ( current key = = null ) { / / merge complete break ; } / / write the selected key / value to merge stream out writer append ( current key , current value ) ; / / replace the already written key / value in keys / values arrays with the / / next key / value from the selected input if ( ! in readers [ current entry ] next ( keys [ current entry ] , values [ current entry ] ) ) { / / eof for this file keys [ current entry ] = null ; values [ current entry ] = null ; } } while ( true ) ; }


insert the specified number of records using random keys

private d b record [ ] create random var key table records ( table table , int record cnt , int var data size ) throws i o exception { long tx id = dbh start transaction ( ) ; if ( table = = null ) { table = d b test utils create binary key table ( dbh , table 1 name , d b test utils all types , false ) ; } d b record [ ] recs = new d b record [ record cnt ] ; for ( int i = 0 ; i < record cnt ; i + + ) { try { recs [ i ] = d b test utils create binary key record ( table , max var key length , var data size , true ) ; } catch ( duplicate key exception e ) { assert fail ( " duplicate key error " ) ; } } dbh end transaction ( tx id , true ) ; return recs ; }


number of records in partition including garbage

public long get record count ( ) { return this record counter ; }


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


evict and close sockets older than expiry period from the cache

private synchronized void evict expired ( long expiry period ) { while ( multimap size ( ) ! = 0 ) { iterator < entry < key , value > > iter = multimap entries ( ) iterator ( ) ; entry < key , value > entry = iter next ( ) ; / / if oldest socket expired , remove it if ( entry = = null | | time monotonic now ( ) - entry get value ( ) get time ( ) < expiry period ) { break ; } i o utils client cleanup with logger ( log , entry get value ( ) get peer ( ) ) ; iter remove ( ) ; } }


this implementation eagerly fetches the preferences instances for the required system and user tree nodes

public void after properties set ( ) { if ( this system tree path ! = null ) { this system prefs = this system prefs node ( this system tree path ) ; } if ( this user tree path ! = null ) { this user prefs = this user prefs node ( this user tree path ) ; } }


get a long key node object for a specified buffer

long key node get long key node ( int buffer id ) throws i o exception { long key node node = ( long key node ) node table get ( buffer id ) ; if ( node ! = null ) { return node ; } data buffer buf = buffer mgr get buffer ( buffer id ) ; int node type = get node type ( buf ) ; switch ( node type ) { case longkey var rec node : node = new var rec node ( this , buf ) ; leaf record cnt + = node key count ; break ; case longkey fixed rec node : node = new fixed rec node ( this , buf , schema get fixed length ( ) ) ; leaf record cnt + = node key count ; break ; case longkey interior node : node = new long key interior node ( this , buf ) ; break ; default : buffer mgr release buffer ( buf ) ; throw new assert exception ( " unexpected node type ( " + node type + " ) found , expecting long key node " ) ; } return node ; }


validates loading a file system state backend with additional parameters from the cluster configuration

public void test load file system state backend ( ) throws exception { final string checkpoint dir = new path ( tmp new folder ( ) to u r i ( ) ) to string ( ) ; final string savepoint dir = new path ( tmp new folder ( ) to u r i ( ) ) to string ( ) ; final string local dir 1 = tmp new folder ( ) get absolute path ( ) ; final string local dir 2 = tmp new folder ( ) get absolute path ( ) ; final string local dirs = local dir 1 + file path separator + local dir 2 ; final boolean incremental = ! checkpointing options incremental checkpoints default value ( ) ; final path expected checkpoints path = new path ( checkpoint dir ) ; final path expected savepoints path = new path ( savepoint dir ) ; / / we configure with the explicit string ( rather than / / abstract state backend # x state backend name ) / / to guard against config - breaking changes of the name final configuration config 1 = new configuration ( ) ; config 1 set string ( backend key , " rocksdb " ) ; config 1 set string ( checkpointing options checkpoints directory , checkpoint dir ) ; config 1 set string ( checkpointing options savepoint directory , savepoint dir ) ; config 1 set string ( rocks d b options local directories , local dirs ) ; config 1 set boolean ( checkpointing options incremental checkpoints , incremental ) ; final configuration config 2 = new configuration ( ) ; config 2 set string ( backend key , rocks d b state backend factory class get name ( ) ) ; config 2 set string ( checkpointing options checkpoints directory , checkpoint dir ) ; config 2 set string ( checkpointing options savepoint directory , savepoint dir ) ; config 2 set string ( rocks d b options local directories , local dirs ) ; config 2 set boolean ( checkpointing options incremental checkpoints , incremental ) ; state backend backend 1 = state backend loader load state backend from config ( config 1 , cl , null ) ; state backend backend 2 = state backend loader load state backend from config ( config 2 , cl , null ) ; assert true ( backend 1 instanceof rocks d b state backend ) ; assert true ( backend 2 instanceof rocks d b state backend ) ; rocks d b state backend fs 1 = ( rocks d b state backend ) backend 1 ; rocks d b state backend fs 2 = ( rocks d b state backend ) backend 2 ; abstract file state backend fs 1back = ( abstract file state backend ) fs 1 get checkpoint backend ( ) ; abstract file state backend fs 2back = ( abstract file state backend ) fs 2 get checkpoint backend ( ) ; assert equals ( expected checkpoints path , fs 1back get checkpoint path ( ) ) ; assert equals ( expected checkpoints path , fs 2back get checkpoint path ( ) ) ; assert equals ( expected savepoints path , fs 1back get savepoint path ( ) ) ; assert equals ( expected savepoints path , fs 2back get savepoint path ( ) ) ; assert equals ( incremental , fs 1 is incremental checkpoints enabled ( ) ) ; assert equals ( incremental , fs 2 is incremental checkpoints enabled ( ) ) ; check paths ( fs 1 get db storage paths ( ) , local dir 1 , local dir 2 ) ; check paths ( fs 2 get db storage paths ( ) , local dir 1 , local dir 2 ) ; }


public synchronized void write ( int b ) throws i o exception { buf [ count + + ] = ( byte ) b ; if ( count = = buf length ) { flush buffer ( ) ; } }


writes the given double to the current position and increases the position by 1

public abstract double buffer put ( double d ) ;


creates a new { @ link date format } suitable for processing this { @ link time scale }

public date format create date format ( ) { switch ( this ) { case hour : return new simple date format ( " mmm / dd hh " ) ; case min : return new simple date format ( " hh : mm " ) ; case sec10 : return new simple date format ( " hh : mm : ss " ) ; default : throw new assertion error ( ) ; } }


get computed user - limit for all users in this queue if cached data is invalidated due to resource change , this method also enforce to recompute user - limit

public resource get computed resource limit for all users ( string user name , resource cluster resource , string node partition , scheduling mode scheduling mode ) { map < scheduling mode , resource > user limit per scheduling mode ; write lock lock ( ) ; try { user limit per scheduling mode = pre computed all user limit get ( node partition ) ; if ( is recompute needed ( scheduling mode , node partition , false ) ) { / / recompute user limit per scheduling mode = re compute user limits ( user name , node partition , cluster resource , scheduling mode , false ) ; / / update user count to cache so that we can avoid recompute if no major / / changes set local version of users state ( node partition , scheduling mode , false ) ; } } finally { write lock unlock ( ) ; } resource user limit resource = user limit per scheduling mode get ( scheduling mode ) ; user user = get user ( user name ) ; float weight = ( user = = null ) ? 1 0f : user get weight ( ) ; resource user specific user limit = resources multiply and normalize down ( resource calculator , user limit resource , weight , l queue get minimum allocation ( ) ) ; log debug ( " user limit is fetched user limit = { } , user specific user limit = { } , " + " scheduling mode = { } , partition = { } " , user limit resource , user specific user limit , scheduling mode , node partition ) ; return user specific user limit ; }


tests the { @ link data type conflict handler # replace empty structs or rename and add handler resoraah } conflict handler when adding a conflicting typedef impl ( but equiv ) that is referred to multiple times during a single add data type ( ) call success is if the fields of struct 2 are all the original typedef 1 type a failure would be if the fields of struct 2 are different types

public void test typedef to stub use existing typedef to populated structure multi ref ( ) { structure data type struct 1a = create populated ( data mgr ) ; type def td 1a = new typedef data type ( root , " typedef 1 " , struct 1a , data mgr ) ; data type td 1a result = data mgr add data type ( td 1a , data type conflict handler replace empty structs or rename and add handler ) ; string origtd 1 name = td 1a result get path name ( ) ; structure data type struct 1b = create stub ( data mgr , 0 ) ; type def td 1b = new typedef data type ( root , " typedef 1 " , struct 1b , data mgr ) ; pointer data type ptd = new pointer data type ( td 1b , program get default pointer size ( ) , data mgr ) ; / / struct 2 is used to create multiple references to the same conflicting typedef impl / / use a pointer to the typedef , otherwise struct 2 ' s size will be wrong when the / / conflicting struct 1 impl size changes from 0 to 10 structure data type struct 2 = new structure data type ( root , " struct 2 " , 0 , data mgr ) ; struct 2 add ( ptd , " typedef 1 instance 1 " , " first " ) ; struct 2 add ( ptd , " typedef 1 instance 2 " , " second " ) ; struct 2 add ( ptd , " typedef 1 instance 3 " , " third " ) ; structure struct 2 result = ( structure ) data mgr add data type ( struct 2 , data type conflict handler replace empty structs or rename and add handler ) ; for ( data type component dtc : struct 2 result get components ( ) ) { pointer pr = ( pointer ) dtc get data type ( ) ; type def tr = ( type def ) pr get data type ( ) ; string dtc d t name = tr get path name ( ) ; assert equals ( origtd 1 name , dtc d t name ) ; } }


execute the given command in the background

public synchronized void execute command ( background command cmd , undoable domain object obj ) { if ( tool = = null ) { return ; } background command task task = new background command task ( this , obj , cmd ) ; tasks add last ( task ) ; start time = system current time millis ( ) ; if ( task thread ! = null & & task thread is alive ( ) ) { return ; } task thread = new thread ( task thread group , this , " background - task - " + tool get name ( ) ) ; task thread set priority ( thread min priority + 1 ) ; task thread start ( ) ; try { / / we will get notified by the task , after it has started the transaction / / todo : why do we need to wait until the transaction is started ? ! ? wait ( 1000 ) ; } catch ( interrupted exception e ) { msg error ( this , " interrupted waiting for the background command to start a transaction " ) ; } }


returns true if the key was not already in the set

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


resolves symlink , if the given file is a symlink otherwise return null if the resolution fails , report an error

public string read link ( ) throws i o exception , interrupted exception { return act ( new read link ( ) ) ; }


called the first time { @ link # act ( float ) } is called this is a good place to query the { @ link # actor actor ' s } starting state


void set current fallthrough ( address addr ) { if ( is user defined & & ! executing command ) { current fallthrough addr = addr ; listener state changed ( null ) ; } }


returns a string useful for debugging ( especially within a debugger )

public string to string ( ) { return string format ( " % s [ buffer = % s , current line pos = % s , eof = % s , ibit work area = % s , lbit work area = % s , " + " modulus = % s , pos = % s , read pos = % s ] " , this get class ( ) get simple name ( ) , arrays to string ( buffer ) , current line pos , eof , ibit work area , lbit work area , modulus , pos , read pos ) ; }


registers a rest handler to be executed when the provided { @ code method } and { @ code path } match the request

protected void register as deprecated handler ( rest request method method , string path , rest handler handler , string deprecation message ) { assert ( handler instanceof deprecation rest handler ) = = false ; register handler ( method , path , new deprecation rest handler ( handler , deprecation message , deprecation logger ) ) ; }


private int find bucket ( long val ) { for ( int i = 0 ; i < cuts length ; + + i ) { if ( val < cuts [ i ] ) { return i ; } } return cuts length ; }


adds all of the specified ranges to this range set ( optional operation ) after this operation , this range set is the minimal range set that { @ linkplain # encloses all ( range set ) encloses } both the original range set and each range in { @ code other } this is equivalent to calling { @ link # add } on each of the ranges in { @ code other } in turn

default void add all ( iterable < range < c > > ranges ) { for ( range < c > range : ranges ) { add ( range ) ; } }


runtime classloader for loading user - defined classes


public map < string , big decimal > get map number ( ) { return map number ; }


analyze backup storage directories for consistency < br > recover from incomplete checkpoints if required < br > read version and fstime files if exist < br > do not load image or edits

void recover create read ( ) throws i o exception { for ( iterator < storage directory > it = storage dir iterator ( ) ; it has next ( ) ; ) { storage directory sd = it next ( ) ; storage state cur state ; try { cur state = sd analyze storage ( hdfs server constants startup option regular , storage ) ; / / sd is locked but not opened switch ( cur state ) { case non existent : / / fail if any of the configured storage dirs are inaccessible throw new inconsistent f s state exception ( sd get root ( ) , " checkpoint directory does not exist or is not accessible " ) ; case not formatted : / / for backup node all directories may be unformatted initially log info ( " storage directory " + sd get root ( ) + " is not formatted " ) ; log info ( " formatting " ) ; sd clear directory ( ) ; / / create empty current break ; case normal : break ; default : / / recovery is possible sd do recover ( cur state ) ; } if ( cur state ! = storage state not formatted ) { / / read and verify consistency with other directories storage read properties ( sd ) ; } } catch ( i o exception ioe ) { sd unlock ( ) ; throw ioe ; } } }


static helper method to easily display an two - option dialog with no cancel button the dialog will remain until the user presses the option 1 or option 2 button

public static int show option no cancel dialog ( component parent , string title , string message , string option 1 , string option 2 , icon icon ) { return swing run now ( ( ) - > { option dialog info = new option dialog ( title , message , option 1 , option 2 , plain message , icon , false ) ; return info show ( ) ; } ) ; }


public static object create instance ( string class name ) { object retv = null ; try { class loader class loader = thread current thread ( ) get context class loader ( ) ; class < ? > the filter class = class for name ( class name , true , class loader ) ; constructor < ? > meth = the filter class get declared constructor ( arg array ) ; meth set accessible ( true ) ; retv = meth new instance ( ) ; } catch ( exception e ) { throw new runtime exception ( e ) ; } return retv ; }


sets the { @ code output dir } and returns a reference to this builder so that the methods can be chained together

public builder with output dir ( string output dir ) { if ( output dir ! = null ) { this output dir = paths get ( output dir ) to absolute path ( ) to string ( ) ; } else { this output dir = default output dir ; } return this ; }


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


returns the current { @ link com bumptech glide request manager } or null if none exists

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


check service class byte in ipc header is correct on wire

public void test ipc with service class ( ) throws i o exception { / / start server server server = new test server ( 5 , false ) ; inet socket address addr = net utils get connect address ( server ) ; server start ( ) ; / / start client client set connect timeout ( conf , 10000 ) ; call and verify ( server , addr , 0 , true ) ; / / service class is low to - 128 as byte on wire / / - 128 shouldn ' t be casted on wire but - 129 should call and verify ( server , addr , - 128 , true ) ; call and verify ( server , addr , - 129 , false ) ; / / service class is up to 127 / / 127 shouldn ' t be casted on wire but 128 should call and verify ( server , addr , 127 , true ) ; call and verify ( server , addr , 128 , false ) ; server stop ( ) ; }


reads bytes into a buffer until eof or the buffer ' s limit is reached

private int fill buffer ( file input stream stream , byte buffer buf ) throws i o exception { int bytes read = stream get channel ( ) read ( buf ) ; if ( bytes read < 0 ) { / / eof return bytes read ; } while ( buf remaining ( ) > 0 ) { int n = stream get channel ( ) read ( buf ) ; if ( n < 0 ) { / / eof return bytes read ; } bytes read + = n ; } return bytes read ; }


program get program ( ) { return program ; }


create a uri builder with default settings


returns the number of instantiated sections instantiated sections contain code or data that are required for execution

public short get instantiated section count ( ) { return inst section count ; }


public void test map serialization ( ) throws exception { final long key = 0l ; final heap keyed state backend < long > long heap keyed state backend = get long heap keyed state backend ( key ) ; final internal map state < long , void namespace , long , string > map state = ( internal map state < long , void namespace , long , string > ) long heap keyed state backend get partitioned state ( void namespace instance , void namespace serializer instance , new map state descriptor < > ( " test " , long serializer instance , string serializer instance ) ) ; test map serialization ( key , map state ) ; }


gets all dependencies of this plugin on other plugins note that the list will usually include the members of { @ link # get optional dependencies } ( missing optional dependencies will however be omitted )

public list < dependency > get dependencies ( ) { return dependencies ; }


bfs traversal of the system under path root , with the entries in the list , in the same order as that of the traversal < b > important : < b > this is not an atomic snapshot of the tree ever , but the state as it exists across multiple r p cs from zk client to the ensemble for practical purposes , it is suggested to bring the clients to the ensemble down ( i e prevent writes to path root ) to ' simulate ' a snapshot behavior

public static list < string > list sub tree b f s ( zoo keeper zk , final string path root ) throws keeper exception , interrupted exception { queue < string > queue = new array deque < > ( ) ; list < string > tree = new array list < string > ( ) ; queue add ( path root ) ; tree add ( path root ) ; while ( ! queue is empty ( ) ) { string node = queue poll ( ) ; list < string > children = zk get children ( node , false ) ; for ( final string child : children ) { final string child path = node + " / " + child ; queue add ( child path ) ; tree add ( child path ) ; } } return tree ; }


private static f s data output stream append ( file system fs , path p ) throws exception { for ( int i = 0 ; i < 10 ; i + + ) { try { return fs append ( p ) ; } catch ( remote exception re ) { if ( re get class name ( ) equals ( recovery in progress exception class get name ( ) ) ) { append test util log info ( " will sleep and retry , i = " + i + " , p = " + p , re ) ; thread sleep ( 1000 ) ; } else throw re ; } } throw new i o exception ( " cannot append to " + p ) ; }


returns the unique greatest value of type { @ code c } that is less than { @ code value } , or { @ code null } if none exists inverse operation to { @ link # next }

public abstract c previous ( c value ) ;


specifies a { @ link key selector } for elements from the first input

public < key > where < key > where ( key selector < t1 , key > key selector ) { require non null ( key selector ) ; final type information < key > key type = type extractor get key selector types ( key selector , input 1 get type ( ) ) ; return where ( key selector , key type ) ; }


set the short description for what the plugin does

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


gets the c register number , as a nibble this will throw if the value is out of the range of an unsigned nibble

public final short get c nibble ( ) { int c = get c ( ) ; if ( ( c & ~ 0xf ) ! = 0 ) { throw new dex exception 2 ( " register c out of range : " + hex u 8 ( c ) ) ; } return ( short ) c ; }


processes each model ' s property mapped to some real type and adds related vendor extensions

public void process real type property ( codegen model model , codegen property property , string description , ktorm schema ktorm schema ) { map < string , object > column definition = new hash map < string , object > ( ) ; string base name = property get base name ( ) ; string col name = to column name ( base name ) ; string data type = property get data type ( ) ; string data format = property get data format ( ) ; string actual type = to column type ( data type , data format ) ; string minimum = property get minimum ( ) ; string maximum = property get maximum ( ) ; boolean exclusive minimum = property get exclusive minimum ( ) ; boolean exclusive maximum = property get i exclusive maximum ( ) ; float cmin = ( minimum ! = null ) ? float parse float ( minimum ) : null ; float cmax = ( maximum ! = null ) ? float parse float ( maximum ) : null ; if ( exclusive minimum & & cmin ! = null ) cmin + = 1 ; if ( exclusive maximum & & cmax ! = null ) cmax - = 1 ; float min = ( cmin ! = null ) ? cmin : float min value ; float max = ( cmax ! = null ) ? cmax : float max value ; float actual min = math min ( min , max ) ; / / sometimes min and max values can be mixed up float actual max = math max ( min , max ) ; / / sometimes only minimum specified and it can be pretty high ktorm schema put ( " column definition " , column definition ) ; column definition put ( " col name " , col name ) ; column definition put ( " col type " , actual type ) ; column definition put ( " col kotlin type " , data type ) ; column definition put ( " col minimum " , actual min ) ; column definition put ( " col maximum " , actual max ) ; process type args ( data type , data format , actual min , actual max , column definition ) ; process null and default ( model , property , description , column definition ) ; }


the default sasl properties read from the configuration

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


report a protocol violation exception with a personalized message referencing the simple type name of the consumer class and report it via rx java plugins on error

public static void report double subscription ( class < ? > consumer ) { rx java plugins on error ( new protocol violation exception ( compose message ( consumer get name ( ) ) ) ) ; }


add a configuration resource to this instance ' s configuration , return true if the resource was found

protected boolean maybe add conf resource ( string resource ) { url url = this get class ( ) get class loader ( ) get resource ( resource ) ; boolean found = url ! = null ; if ( found ) { get conf ( ) add resource ( resource ) ; } return found ; }


creates an instance of an active namenode resolver from the configuration

public static active namenode resolver new active namenode resolver ( configuration conf , state store service state store ) { class < ? extends active namenode resolver > clazz = conf get class ( r b f config keys federation namenode resolver client class , r b f config keys federation namenode resolver client class default , active namenode resolver class ) ; return new instance ( conf , state store , state store service class , clazz ) ; }


create a ( built ) response with the given asynchronous response parameter { @ code async response } can be a { @ link completable future completable future & lt ; server response & gt ; } or { @ link publisher publisher & lt ; server response & gt ; } ( or any asynchronous producer of a single { @ code server response } that can be adapted via the { @ link reactive adapter registry } ) this method can be used to set the response status code , headers , and body based on an asynchronous result if only the body is asynchronous , { @ link body builder # body ( object ) } can be used instead

static server response async ( object async response ) { return default async server response create ( async response , null ) ; }


construct the fs instances in a cache with effectively no limit on the number of instances which can be created simultaneously this is the effective state before hadoop - 17313 all but one thread ' s fs instance will be discarded

public void test cache large semaphore construction ( ) throws exception { file system cache cache = semaphored cache ( 999 ) ; int count = 10 ; create file systems ( cache , count ) ; assertions assert that ( cache get discarded instances ( ) ) described as ( " discarded fs instances " ) is equal to ( count - 1 ) ; }


whether async request processing has completed it is important to avoid use of request and response objects after async processing has completed servlet containers often re - use them

public boolean is async complete ( ) { return this async completed get ( ) ; }


returns a { @ link decision } whether the given shard routing can be re - balanced to the given allocation the default is { @ link decision # always }

public decision can rebalance ( shard routing shard routing , routing allocation allocation ) { return decision always ; }


associates the provided { @ code fingerprint } and contents of the future , when it completes there may be a race between this call and calls to { @ link # put } those races are benign , since the fingerprint should be the same regardless we may pessimistically end up having a future to wait on for serialization that isn ' t actually necessary , but that isn ' t a big concern

private void put async ( byte string fingerprint , listenable future < object [ ] > future contents ) { future contents add listener ( ( ) - > { try { object [ ] contents = futures get done ( future contents ) ; / / replace the cache entry with the unwrapped contents , since the future may be gc ' d fingerprint to contents put ( fingerprint , contents ) ; / / there may already be an entry here , but it ' s better to put a fingerprint result / / with an immediate future , since then later readers won ' t need to block / / unnecessarily it would be nice to check the old value , but cache # put / / doesn ' t provide it to us contents to fingerprint put ( contents , fingerprint computation result create ( fingerprint , immediate future ( null ) ) ) ; } catch ( execution exception e ) { / / failure to fetch the nested set contents is unexpected , but the failed future can / / be stored as the nested set children this way the exception is only propagated if / / the nested set is consumed ( unrolled ) bug reporter send bug report ( e ) ; } } , more executors direct executor ( ) ) ; }


synchronized repository handle get repository handle ( string name ) throws i o exception , not connected exception { check server handle ( ) ; try { return server handle get repository ( name ) ; } catch ( remote exception e ) { if ( recover connection ( e ) ) { return server handle get repository ( name ) ; } throw e ; } }


clears a value that has not yet been set , and thus does not require count to be modified

boolean clear value for testing ( k key , int hash , weak value reference < k , v , ? extends internal entry < k , v , ? > > value reference ) { lock ( ) ; try { atomic reference array < e > table = this table ; int index = hash & ( table length ( ) - 1 ) ; e first = table get ( index ) ; for ( e e = first ; e ! = null ; e = e get next ( ) ) { k entry key = e get key ( ) ; if ( e get hash ( ) = = hash & & entry key ! = null & & map key equivalence equivalent ( key , entry key ) ) { weak value reference < k , v , e > v = ( ( weak value entry < k , v , e > ) e ) get value reference ( ) ; if ( v = = value reference ) { e new first = remove from chain ( first , e ) ; table set ( index , new first ) ; return true ; } return false ; } } return false ; } finally { unlock ( ) ; } }


helper method which sets up an iteration with the given vertex value

private void set up iteration ( delta iteration < ? , ? > iteration ) { / / set up the iteration operator if ( this configuration ! = null ) { iteration name ( this configuration get name ( " vertex - centric iteration ( " + compute function + " ) " ) ) ; iteration parallelism ( this configuration get parallelism ( ) ) ; iteration set solution set un managed ( this configuration is solution set unmanaged memory ( ) ) ; / / register all aggregators for ( map entry < string , aggregator < ? > > entry : this configuration get aggregators ( ) entry set ( ) ) { iteration register aggregator ( entry get key ( ) , entry get value ( ) ) ; } } else { / / no configuration provided ; set default name iteration name ( " vertex - centric iteration ( " + compute function + " ) " ) ; } }


return an instance ( possibly shared or independent ) of the object managed by this factory as with a { @ link bean factory } , this allows support for both the singleton and prototype design pattern if this factory bean is not fully initialized yet at the time of the call ( for example because it is involved in a circular reference ) , throw a corresponding { @ link factory bean not initialized exception } as of spring 2 0 , factory beans are allowed to return { @ code null } objects the factory will consider this as normal value to be used ; it will not throw a factory bean not initialized exception in this case anymore factory bean implementations are encouraged to throw factory bean not initialized exception themselves now , as appropriate


evict the passed vertex from the cache so that it will be recomputed with presumably changed values

public void evict ( attributed vertex vertex ) { map remove ( vertex ) ; }


public void write optional int ( @ nullable integer integer ) throws i o exception { if ( integer = = null ) { write boolean ( false ) ; } else { write boolean ( true ) ; write int ( integer ) ; } }


check whether the step size in mapped file queue is correct

public void check self ( ) { this mapped file queue check self ( ) ; }


return the number of milliseconds to wait , based on the connection state and the throttle time , before attempting to send data if the connection has been established but being throttled , return throttle delay otherwise , return connection delay

public long poll delay ms ( string id , long now ) { long throttle delay ms = throttle delay ms ( id , now ) ; if ( is connected ( id ) & & throttle delay ms > 0 ) { return throttle delay ms ; } else { return connection delay ( id , now ) ; } }


fake endpoint to test group parameters ( optional ) fake endpoint to test group parameters ( optional ) < b > 400 < b > - someting wrong

public response entity < void > test group parameters with http info ( integer required string group , boolean required boolean group , long required int 6 4 group , integer string group , boolean boolean group , long int 6 4 group ) throws rest client exception { object post body = null ; / / verify the required parameter ' required string group ' is set if ( required string group = = null ) { throw new http client error exception ( http status bad request , " missing the required parameter ' required string group ' when calling test group parameters " ) ; } / / verify the required parameter ' required boolean group ' is set if ( required boolean group = = null ) { throw new http client error exception ( http status bad request , " missing the required parameter ' required boolean group ' when calling test group parameters " ) ; } / / verify the required parameter ' required int 6 4 group ' is set if ( required int 6 4 group = = null ) { throw new http client error exception ( http status bad request , " missing the required parameter ' required int 6 4 group ' when calling test group parameters " ) ; } string path = api client expand path ( " / fake " , collections < string , object > empty map ( ) ) ; final multi value map < string , string > query params = new linked multi value map < string , string > ( ) ; final http headers header params = new http headers ( ) ; final multi value map < string , string > cookie params = new linked multi value map < string , string > ( ) ; final multi value map < string , object > form params = new linked multi value map < string , object > ( ) ; query params put all ( api client parameter to multi value map ( null , " required string group " , required string group ) ) ; query params put all ( api client parameter to multi value map ( null , " required int 6 4 group " , required int 6 4 group ) ) ; query params put all ( api client parameter to multi value map ( null , " string group " , string group ) ) ; query params put all ( api client parameter to multi value map ( null , " int 6 4 group " , int 6 4 group ) ) ; if ( required boolean group ! = null ) header params add ( " required boolean group " , api client parameter to string ( required boolean group ) ) ; if ( boolean group ! = null ) header params add ( " boolean group " , api client parameter to string ( boolean group ) ) ; final string [ ] local var accepts = { } ; final list < media type > local var accept = api client select header accept ( local var accepts ) ; final string [ ] content types = { } ; final media type content type = api client select header content type ( content types ) ; string [ ] auth names = new string [ ] { } ; parameterized type reference < void > return type = new parameterized type reference < void > ( ) { } ; return api client invoke a p i ( path , http method delete , query params , post body , header params , cookie params , form params , local var accept , content type , auth names , return type ) ; }


compacts this char buffer the remaining chars will be moved to the head of the buffer , starting from position zero then the position is set to { @ code remaining ( ) } ; the limit is set to capacity ; the mark is cleared

public abstract char buffer compact ( ) ;


public void set branch type ( string branch type ) { this branch type = branch type ; }


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


called when an unrecoverable session error has occurred

void read frame error ( string message ) ;


set the { @ link application context } to be used by this test instance , provided via { @ link application context aware } semantics

public final void set application context ( final application context application context ) { this application context = application context ; }


utility method to evaluate a callable and fill in the future with the result or the exception raised once this method returns , the future will have been evaluated to either a return value or an exception

public static < t > completable future < t > eval ( final completable future < t > result , final callable < t > call ) { try { result complete ( call call ( ) ) ; } catch ( throwable tx ) { result complete exceptionally ( tx ) ; } return result ; }


returns the least of the specified values according to this ordering if there are multiple least values , the first of those is returned < b > java 8 users : < b > if { @ code iterable } is a { @ link collection } , use { @ code collections min ( collection , this comparator ) } instead otherwise , use { @ code streams stream ( iterable ) min ( this comparator ) get ( ) } instead note that these alternatives do not guarantee which tied minimum element is returned )

public < e extends t > e min ( iterable < e > iterable ) { return min ( iterable iterator ( ) ) ; }


public file path get parent ( ) { int i = remote length ( ) - 2 ; for ( ; i > = 0 ; i - - ) { char ch = remote char at ( i ) ; if ( ch = = ' \ \ ' | | ch = = ' / ' ) break ; } return i > = 0 ? new file path ( channel , remote substring ( 0 , i + 1 ) ) : null ; }


test whether the file system supports append and return the answer

private boolean check append ( file system fs ) { boolean can append = true ; try { fs append ( base path ) ; } catch ( unsupported operation exception ex ) { can append = false ; } catch ( i o exception ex ) { / / ignore the operation is supported } return can append ; }


build a function prepares rounding values to be called many times this returns a { @ linkplain function } because auto date histogram will need to call it many times over the course of running the aggregation

public function < rounding , rounding prepared > rounding preparer ( ) throws i o exception { return values source rounding preparer ( ) ; }


writes a double as a typed bytes sequence

public void write double ( double d ) throws i o exception { out write ( type double code ) ; out write double ( d ) ; }


public counters get task counters ( ) { return counters ; }


represents the shard - level summary of the response execution

public shards shards ( ) { return shards ; }


test parsing procmeminfo with inactive ( file ) present

public void parsing proc mem file 2 ( ) throws i o exception { long mem total = 131403836l ; long mem free = 11257036l ; long inactive = 27396032l ; long inactive file = 21010696l ; long swap total = 31981552l ; long swap free = 1818480l ; long hardware corrupt = 31960904l ; int nr huge pages = 10 ; file temp file = new file ( fake memfile ) ; temp file delete on exit ( ) ; file writer f writer = new file writer ( fake memfile ) ; f writer write ( string format ( meminfo format 2 , mem total , mem free , inactive , inactive file , swap total , swap free , hardware corrupt , nr huge pages ) ) ; f writer close ( ) ; assert equals ( plugin get available physical memory size ( ) , 1024l * ( mem free + inactive file ) ) ; assert false ( plugin get available physical memory size ( ) = = 1024l * ( mem free + inactive ) ) ; assert equals ( plugin get available virtual memory size ( ) , 1024l * ( mem free + inactive file + swap free ) ) ; assert equals ( plugin get physical memory size ( ) , 1024l * ( mem total - hardware corrupt - ( nr huge pages * 2048 ) ) ) ; assert equals ( plugin get virtual memory size ( ) , 1024l * ( mem total - hardware corrupt - ( nr huge pages * 2048 ) + swap total ) ) ; }


convenience wrapper around reconfig that takes lists of strings instead of comma - separated servers

public byte [ ] reconfigure ( list < string > joining servers , list < string > leaving servers , list < string > new members , long from config , stat stat ) throws keeper exception , interrupted exception { return reconfigure ( string utils join strings ( joining servers , " , " ) , string utils join strings ( leaving servers , " , " ) , string utils join strings ( new members , " , " ) , from config , stat ) ; }


returns { @ link job entity } that are eligble to be executed for example used by the default { @ link acquire jobs cmd } command used by the default { @ link acquire timer jobs runnable } implementation to get async jobs that can be executed

list < job entity > find jobs to execute ( page page ) ;


public boolean process ( set < ? extends type element > annotations , round environment round env ) { if ( collection utils is not empty ( annotations ) ) { set < ? extends element > elements = round env get elements annotated with ( interceptor class ) ; try { parse interceptors ( elements ) ; } catch ( exception e ) { logger error ( e ) ; } return true ; } return false ; }


returns the time that this entry was last written , in ns

public long get write time ( ) { return 0l ; }


following method performs the finalization

public void unprepare ( ) { if ( this output ! = null ) { this output flush ( ) ; this output close ( ) ; } if ( this error ! = null ) { this error flush ( ) ; this error close ( ) ; } logger debug ( " file logger module : : unprepare ( ) ; " ) ; }


create a { @ link metadata aware aspect instance factory } for the supplied aspect type if the aspect type has no per clause , then a { @ link singleton metadata aware aspect instance factory } is returned , otherwise a { @ link prototype aspect instance factory } is returned

private metadata aware aspect instance factory create aspect instance factory ( aspect metadata am , class < ? > aspect class , string aspect name ) { metadata aware aspect instance factory instance factory ; if ( am get aj type ( ) get per clause ( ) get kind ( ) = = per clause kind singleton ) { / / create a shared aspect instance object instance = get singleton aspect instance ( aspect class ) ; instance factory = new singleton metadata aware aspect instance factory ( instance , aspect name ) ; } else { / / create a factory for independent aspect instances instance factory = new simple metadata aware aspect instance factory ( aspect class , aspect name ) ; } return instance factory ; }


returns the { @ link dns question } of the dns query that has failed

public dns question question ( ) { return question ; }


sets the used y - axis offset for the labels on this axis for the legend , higher offset means the legend as a whole will be placed further away from the top

public void set y offset ( float y offset ) { m y offset = utils convert dp to pixel ( y offset ) ; }


configure filters for the graph , based on the vertex and edge attributes

private void configure filters ( ) { / / close and rebuild filter dialog if exists if ( filter dialog ! = null ) { filter dialog close ( ) ; filter dialog = null ; } set < attributed vertex > vertices = graph vertex set ( ) ; set < attributed edge > edges = graph edge set ( ) ; vertex filters = attribute filters builder ( ) exclude ( set of ( " address " , " code " , " name " ) ) elements ( vertices ) max factor ( 05 ) button supplier ( j radio button : : new ) paint function ( v - > colors vertex type to color map get or default ( v , color blue ) ) build ( ) ; vertex filters add item listener ( item - > { @ suppress warnings ( " unchecked " ) set < string > selected = ( set < string > ) item get item ( ) ; viewer get render context ( ) set vertex include predicate ( v - > v get attribute map ( ) values ( ) stream ( ) none match ( selected : : contains ) ) ; viewer repaint ( ) ; } ) ; edge filters = attribute filters builder ( ) exclude ( set of ( " * to key " , " * from key " , " address " , " name " ) ) elements ( edges ) max factor ( 01 ) button supplier ( j radio button : : new ) paint function ( e - > colors edge type to color map get or default ( e , color green ) ) build ( ) ; edge filters add item listener ( item - > { @ suppress warnings ( " unchecked " ) set < string > selected = ( set < string > ) item get item ( ) ; viewer get render context ( ) set edge include predicate ( e - > e get attribute map ( ) values ( ) stream ( ) none match ( selected : : contains ) ) ; viewer repaint ( ) ; } ) ; }


returns whether this is a hole { @ link cache span }

public boolean is hole span ( ) { return ! is cached ; }


gets the total number of open streams ( input plus output )

public int get total number of open streams ( ) { lock lock ( ) ; try { return num reserved output streams + num reserved input streams ; } finally { lock unlock ( ) ; } }


public boolean supports ( final j e e context context ) { return context get request attribute ( o auth 2 0 constants error ) is present ( ) ; }


returns a formatter for a four digit year and two digit month of year ( yyyy - mm )

public static date time formatter year month ( ) { return constants ym ; }


subclasses should invoke this method to set the result of the computation to { @ code value } this will set the state of the future to { @ link old abstract future sync # completed } and invoke the listeners if the state was successfully changed

protected boolean set ( @ nullable decl v value ) { boolean result = sync set ( value ) ; if ( result ) { execution list execute ( ) ; } return result ; }


protected void order items ( ) { int sz = class defs size ( ) ; int idx = 0 ; ordered defs = new array list < class def item > ( sz ) ; / * * iterate over all the classes , recursively assigning an * index to each , implicitly skipping the ones that have * already been assigned by the time this ( top - level ) * iteration reaches them * / for ( type type : class defs key set ( ) ) { idx = order items 0 ( type , idx , sz - idx ) ; } }


public void test quorum internal ( string addr ) throws exception { client base setup test env ( ) ; final int client port qp1 = port assignment unique ( ) ; final int client port qp2 = port assignment unique ( ) ; string server 1 = string format ( " server 1 = % 1 $ s : % 2 $ s : % 3 $ s ; % 4 $ s " , addr , port assignment unique ( ) , port assignment unique ( ) , client port qp1 ) ; string server 2 = string format ( " server 2 = % 1 $ s : % 2 $ s : % 3 $ s ; % 4 $ s " , addr , port assignment unique ( ) , port assignment unique ( ) , client port qp2 ) ; string quorum cfg section = server 1 + " \ n " + server 2 ; main thread q 1 = new main thread ( 1 , client port qp1 , quorum cfg section ) ; main thread q 2 = new main thread ( 2 , client port qp2 , quorum cfg section ) ; q 1 start ( ) ; q 2 start ( ) ; assert true ( client base wait for server up ( addr + " : " + client port qp1 , connection timeout ) , " waiting for server 1 being up " ) ; assert true ( client base wait for server up ( addr + " : " + client port qp2 , connection timeout ) , " waiting for server 2 being up " ) ; quorum peer quorum peer = q 1 main quorum peer ; int tick time = quorum peer get tick time ( ) ; assert equals ( tick time * 2 , quorum peer get min session timeout ( ) , " default value of minimum session time out is not considered " ) ; assert equals ( tick time * 20 , quorum peer get max session timeout ( ) , " default value of maximum session time out is not considered " ) ; zoo keeper zk = new zoo keeper ( addr + " : " + client port qp1 , client base connection timeout , this ) ; wait for one ( zk , states connected ) ; zk create ( " / foo q 1 " , " foobar 1 " get bytes ( ) , ids open acl unsafe , create mode persistent ) ; assert equals ( new string ( zk get data ( " / foo q 1 " , null , null ) ) , " foobar 1 " ) ; zk close ( ) ; zk = new zoo keeper ( addr + " : " + client port qp2 , client base connection timeout , this ) ; wait for one ( zk , states connected ) ; zk create ( " / foo q 2 " , " foobar 2 " get bytes ( ) , ids open acl unsafe , create mode persistent ) ; assert equals ( new string ( zk get data ( " / foo q 2 " , null , null ) ) , " foobar 2 " ) ; zk close ( ) ; q 1 shutdown ( ) ; q 2 shutdown ( ) ; assert true ( client base wait for server down ( addr + " : " + client port qp1 , client base connection timeout ) , " waiting for server 1 down " ) ; assert true ( client base wait for server down ( addr + " : " + client port qp2 , client base connection timeout ) , " waiting for server 2 down " ) ; }


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


ignore the given resource type when resolving { @ code @ resource } annotations by default , the { @ code javax xml ws web service context } interface will be ignored , since it will be resolved by the jax - ws runtime

public void ignore resource type ( string resource type ) { assert not null ( resource type , " ignored resource type must not be null " ) ; this ignored resource types add ( resource type ) ; }


reads the template file without variable substitution

public static string read template contents ( string template file path ) throws build encyclopedia doc exception , i o exception { return read template contents ( template file path , null ) ; }


public void verify loosely ( final list < trace > traces ) { for ( final trace matcher matcher : get traces ( ) ) { boolean matched = false ; for ( final trace trace : traces ) { try { matcher verify ( trace ) ; matched = true ; } catch ( throwable ignored ) { } } if ( ! matched ) { fail ( " \ n expected : % s \ n actual : % s " , get traces ( ) , traces ) ; } } }


return whether the proxy currently holds a target connection

private boolean has target connection ( ) { return ( this target ! = null ) ; }


gets the task start time to be reported to a t sv 2

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


same { { @ link # mkdirs ( string , fs permission , boolean ) } except that the permissions has already been masked against umask

public boolean primitive mkdir ( string src , fs permission abs permission , boolean create parent ) throws i o exception { check open ( ) ; if ( abs permission = = null ) { abs permission = apply u mask dir ( null ) ; } log debug ( " { } : masked = { } " , src , abs permission ) ; try ( trace scope ignored = tracer new scope ( " mkdir " ) ) { return namenode mkdirs ( src , abs permission , create parent ) ; } catch ( remote exception re ) { throw re unwrap remote exception ( access control exception class , invalid path exception class , file already exists exception class , file not found exception class , parent not directory exception class , safe mode exception class , n s quota exceeded exception class , d s quota exceeded exception class , quota by storage type exceeded exception class , unresolved path exception class , snapshot access control exception class ) ; } }


replaces the list contents with the new list

public void refresh list ( object [ ] data list ) { list set list data ( data list ) ; list clear selection ( ) ; }


links operator wrappers in forward topological order

private stream operator wrapper < ? , ? > link operator wrappers ( list < stream operator wrapper < ? , ? > > all operator wrappers ) { stream operator wrapper < ? , ? > previous = null ; for ( stream operator wrapper < ? , ? > current : all operator wrappers ) { if ( previous ! = null ) { previous set previous ( current ) ; } current set next ( previous ) ; previous = current ; } return previous ; }


private static void read eval print loop ( ) { system err println ( " welcome to starlark ( java starlark net ) " ) ; string line ; while ( ( line = prompt ( ) ) ! = null ) { parser input input = parser input from string ( line , " < stdin > " ) ; try { object result = starlark exec file ( input , options , module , thread ) ; if ( result ! = starlark none ) { system out println ( starlark repr ( result ) ) ; } } catch ( syntax error exception ex ) { for ( syntax error error : ex errors ( ) ) { system err println ( error ) ; } } catch ( eval exception ex ) { / / todo ( adonovan ) : provide a source reader requires that we buffer the / / entire history so that line numbers don ' t reset in each chunk system err println ( ex get message with stack ( ) ) ; } catch ( interrupted exception ex ) { system err println ( " interrupted " ) ; } } }


post fake { pet id } upload image with required file : uploads an image ( required )

public response entity < model api response > upload file with required file ( @ api param ( value = " id of pet to update " , required = true ) @ path variable ( " pet id " ) long pet id , @ api param ( value = " file to upload " ) @ valid @ request part ( value = " required file " , required = true ) multipart file required file , @ api param ( value = " additional data to pass to server " ) @ valid @ request part ( value = " additional metadata " , required = false ) string additional metadata ) { for ( media type media type : media type parse media types ( request get header ( " accept " ) ) ) { if ( media type is compatible with ( media type value of ( " application / json " ) ) ) { string example string = " { \ " code \ " : 0 , \ " type \ " : \ " type \ " , \ " message \ " : \ " message \ " } " ; api util set example response ( request , " application / json " , example string ) ; break ; } } return new response entity < > ( http status not implemented ) ; }


used during debugging mock test failures ; cranks up logging of method calls

private void set mock log level ( int level ) { wrapper f s set log events ( level ) ; }


iterates over the provided records and tests whether { @ link record writer # serialize record } and { @ link record deserializer } interact as expected only a single { @ link memory segment } will be allocated

private static void test serialization round trip ( iterable < serialization test type > records , int segment size , record deserializer < serialization test type > deserializer ) throws exception { final data output serializer serializer = new data output serializer ( 128 ) ; final array deque < serialization test type > serialized records = new array deque < > ( ) ; / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - buffer and serializer result serialization result = set next buffer for serializer ( serializer wrap as byte buffer ( ) , segment size ) ; int num records = 0 ; for ( serialization test type record : records ) { serialized records add ( record ) ; num records + + ; / / serialize record serializer clear ( ) ; byte buffer serialized record = record writer serialize record ( serializer , record ) ; serialization result get buffer builder ( ) append and commit ( serialized record ) ; if ( serialization result get buffer builder ( ) is full ( ) ) { / / buffer is full = > start deserializing deserializer set next buffer ( serialization result build buffer ( ) ) ; num records - = deserialization utils deserialize records ( serialized records , deserializer ) ; / / move buffers as long as necessary ( for long records ) while ( ( serialization result = set next buffer for serializer ( serialized record , segment size ) ) is full buffer ( ) ) { deserializer set next buffer ( serialization result build buffer ( ) ) ; } } assert assert false ( serialized record has remaining ( ) ) ; } / / deserialize left over records deserializer set next buffer ( serialization result build buffer ( ) ) ; while ( ! serialized records is empty ( ) ) { serialization test type expected = serialized records poll ( ) ; serialization test type actual = expected get class ( ) new instance ( ) ; record deserializer deserialization result result = deserializer get next record ( actual ) ; assert assert true ( result is full record ( ) ) ; assert assert equals ( expected , actual ) ; num records - - ; } / / assert that all records have been serialized and deserialized assert assert equals ( 0 , num records ) ; assert assert false ( deserializer has unfinished data ( ) ) ; }


remove all tracked requests from this instance so that the first time { @ link # execute once } is invoked with any request it triggers an actual request execution use this e g for requests to master that need to be sent again on master failover

public void clear ( ) { requests clear ( ) ; }


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


public static void create table ( database db , boolean if not exists ) { string constraint = if not exists ? " if not exists " : " " ; db exec s q l ( " create table " + constraint + " \ " test entity \ " ( " + / / " \ " id \ " integer primary key , " + / / 0 : id " \ " simple int \ " integer not null , " + / / 1 : simple int " \ " simple integer \ " integer , " + / / 2 : simple integer " \ " simple string not null \ " text not null , " + / / 3 : simple string not null " \ " simple string \ " text , " + / / 4 : simple string " \ " indexed string \ " text , " + / / 5 : indexed string " \ " indexed string asc unique \ " text , " + / / 6 : indexed string asc unique " \ " simple date \ " integer , " + / / 7 : simple date " \ " simple boolean \ " integer , " + / / 8 : simple boolean " \ " simple byte array \ " blob ) ; " ) ; / / 9 : simple byte array / / add indexes db exec s q l ( " create index " + constraint + " idx test entity indexed string on test entity " + " ( \ " indexed string \ " ) ; " ) ; db exec s q l ( " create unique index " + constraint + " idx test entity indexed string asc unique on test entity " + " ( \ " indexed string asc unique \ " asc ) ; " ) ; }


public static icon get closed folder icon ( boolean disabled ) { load images ( ) ; if ( disabled ) { return disabled closed folder icon ; } return closed folder icon ; }


suspends the underlying timer manager ( if not shared )

public void stop ( ) { if ( ! this shared ) { obtain timer manager ( ) suspend ( ) ; } }


litho handles addingremoving views automatically using mountunmount calls manually adding removing views will mess up litho ' s bookkeeping of added views and cause weird crashes down the line

public void remove view at ( int index ) { throw new unsupported operation exception ( " removing views manually within litho views is not supported " ) ; }


assert an int counter metric as expected

public static void assert counter ( string name , int expected , metrics record builder rb ) { assert assert equals ( " bad value for metric " + name , expected , get int counter ( name , rb ) ) ; }


sets the number of times that failed tasks are re - executed a value of zero effectively disables fault tolerance a value of { @ code - 1 } indicates that the system default value ( as defined in the configuration ) should be used

public execution config set number of execution retries ( int number of execution retries ) { if ( number of execution retries < - 1 ) { throw new illegal argument exception ( " the number of execution retries must be non - negative , or - 1 ( use system default ) " ) ; } this number of execution retries = number of execution retries ; return this ; }


void set response ( response response ) ;


testing one of the errors reported in zookeeper - 2164 , when some servers can not rejoin to the quorum after restarting the current leader multiple times

public void test restarting leader multiple times ( ) throws exception { for ( int restart count = 1 ; restart count < = 3 ; restart count + + ) { int leader id = qu get leader server ( ) ; log info ( " * * * * * new leader : " + leader id ) ; qu shutdown ( leader id ) ; assert true ( client base wait for server down ( " 127 0 0 1 : " + qu get peer ( leader id ) client port , client base connection timeout ) , " timeout during waiting for current leader to go down " ) ; string error message = " no new leader was elected " ; wait for ( error message , ( ) - > qu leader exists ( ) & & qu get leader server ( ) ! = leader id , 30 ) ; qu restart ( leader id ) ; error message = " not all the quorum members are connected after restarting the old leader " ; wait for ( error message , ( ) - > qu all peers are connected ( ) , 30 ) ; log info ( " * * * * * leader restart { } succeeded " , restart count ) ; } }


creates ( and starts ) a new stopwatch using { @ link system # nano time } as its time source

public static stopwatch create started ( ) { return new stopwatch ( ) start ( ) ; }


navigate to either the external program location or address linkage location this method will only navigate to the external program associated with the specified location if either check navigation option is false , or the navigation option is set to show external program , or the current location is the same as the single linkage location see { @ link # go to external linkage ( navigatable , external location , boolean ) } method for external linkage navigation behavior if navigation to an external program will be performed , the associated program will be identified and the location within that program found once this occurs , the external program will be opened within the current tool and navigation completed if an external program association has not yet been established , the user will be prompted to make an association if they choose before completing the navigation

public boolean go to external location ( navigatable nav , external location external location , boolean check navigation option ) { if ( check navigation option & & ! nav options is goto external program enabled ( ) ) { return go to external linkage ( nav , external location , true ) ; } program external program = open external program ( external location ) ; if ( external program = = null ) { return false ; } / / try the address first if it exists address addr = external location get address ( ) ; if ( addr ! = null & & external program get memory ( ) contains ( addr ) ) { go to ( nav , new address field location ( external program , addr ) , external program ) ; return true ; } / / then try the symbol symbol symbol = get external symbol ( external program , external location ) ; if ( symbol ! = null ) { go to ( nav , symbol get program location ( ) , external program ) ; return true ; } perform default external program navigation ( nav , external location , external program , addr ) ; return false ; / / return false because we did not go to the requested address }


test serialization of outer boolean types

public void fake outer boolean serialize test ( ) { boolean body = null ; boolean response = api fake outer boolean serialize ( body ) ; / / todo : test validations }


sets the maximum parallelism of this operator the maximum parallelism specifies the upper bound for dynamic scaling it also defines the number of key groups used for partitioned state

public one input operator transformation < t > set max parallelism ( int max parallelism ) { this operator max parallelism = optional int of ( max parallelism ) ; return this ; }


returns serializable object representing differences between this and previous state


executes the given { @ link listener invocation } on { @ link # listener } does nothing if { @ link # release } has been called on this instance

public void invoke ( listener invocation listener invocation ) { if ( ! released ) { listener invocation invoke listener ( listener ) ; } }


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


returns the record number of the field descriptor list used for this composite

public record number get field descriptor list record number ( ) { return field descriptor list record number ; }


adds a mapping from the specified key to the specified value , replacing the previous mapping from the specified key if there was one

public void put ( int key , int value ) { int i = binary search ( m keys , m size , key ) ; if ( i > = 0 ) { m values [ i ] = value ; } else { i = ~ i ; m keys = insert element into int array ( m keys , m size , i , key ) ; m values = insert element into int array ( m values , m size , i , value ) ; + + m size ; } }


get petfind by tags : finds pets by tags multiple tags can be provided with comma separated strings use tag 1 , tag 2 , tag 3 for testing

default response entity < list < pet > > find pets by tags ( @ not null @ api param ( value = " tags to filter by " , required = true ) @ valid @ request param ( value = " tags " , required = true ) list < string > tags , @ api ignore final pageable pageable ) { return get delegate ( ) find pets by tags ( tags , pageable ) ; }


resolve the { @ link method definition }

protected method definition resolve method definition ( method service method , class < ? > service type , class < ? > service interface class ) { method definition builder builder = new method definition builder ( ) ; return builder build ( service method ) ; }


convenience method to get this element as a float

public float get as float ( ) { return is number ( ) ? get as number ( ) float value ( ) : float parse float ( get as string ( ) ) ; }


return { @ link # set allowed origin patterns ( collection ) configured } origin patterns

public collection < string > get allowed origin patterns ( ) { return this cors configuration get allowed origin patterns ( ) ; }


walk the { @ link breakable service } through it ' s lifecycle , more to verify that service ' s counters work than anything else

public void test walkthrough ( ) throws throwable { breakable service svc = new breakable service ( ) ; assert service state created ( svc ) ; assert state count ( svc , service state notinited , 1 ) ; assert state count ( svc , service state inited , 0 ) ; assert state count ( svc , service state started , 0 ) ; assert state count ( svc , service state stopped , 0 ) ; svc init ( new configuration ( ) ) ; assert service state inited ( svc ) ; assert state count ( svc , service state inited , 1 ) ; svc start ( ) ; assert service state started ( svc ) ; assert state count ( svc , service state started , 1 ) ; svc stop ( ) ; assert service state stopped ( svc ) ; assert state count ( svc , service state stopped , 1 ) ; }


the raw text of the string < code > optional string value = 1 ; < code >

public builder clear value ( ) { copy on write ( ) ; instance clear value ( ) ; return this ; }


hold configuration settings in a parent field mainly used for serialization

public serializable with holder ( ) { return new holder ( this ) ; }


public delete role mapping response delete role mapping ( delete role mapping request request , request options options ) throws i o exception { return rest high level client perform request and parse entity ( request , security request converters : : delete role mapping , options , delete role mapping response : : from x content , empty set ( ) ) ; }


returns the offset from the beginning of the resource name list to resource name

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


return the additional ( undeclared ) property

public map < string , object > get additional properties ( ) { return additional properties ; }


public result matcher name ( string expected view name ) { return result - > { model and view mav = result get model and view ( ) ; if ( mav = = null ) { fail ( " no model and view found " ) ; } assert equals ( " view name " , expected view name , mav get view name ( ) ) ; } ; }


specify the name of the entity manager factory configuration default is none , indicating the default entity manager factory configuration the persistence provider will throw an exception if ambiguous entity manager configurations are found

public void set persistence unit name ( @ nullable string persistence unit name ) { this persistence unit name = persistence unit name ; }


public detector result detect ( ) throws not found exception { result point [ ] corner points = rectangle detector detect ( ) ; result point [ ] points = detect solid 1 ( corner points ) ; points = detect solid 2 ( points ) ; points [ 3 ] = correct top right ( points ) ; if ( points [ 3 ] = = null ) { throw not found exception get not found instance ( ) ; } points = shift to module center ( points ) ; result point top left = points [ 0 ] ; result point bottom left = points [ 1 ] ; result point bottom right = points [ 2 ] ; result point top right = points [ 3 ] ; int dimension top = transitions between ( top left , top right ) + 1 ; int dimension right = transitions between ( bottom right , top right ) + 1 ; if ( ( dimension top & 0x 0 1 ) = = 1 ) { dimension top + = 1 ; } if ( ( dimension right & 0x 0 1 ) = = 1 ) { dimension right + = 1 ; } if ( 4 * dimension top < 7 * dimension right & & 4 * dimension right < 7 * dimension top ) { / / the matrix is square dimension top = dimension right = math max ( dimension top , dimension right ) ; } bit matrix bits = sample grid ( image , top left , bottom left , bottom right , top right , dimension top , dimension right ) ; return new detector result ( bits , new result point [ ] { top left , bottom left , bottom right , top right } ) ; }


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


returns the { @ link aggregation } s keyed by aggregation name

public final map < string , aggregation > as map ( ) { return get as map ( ) ; }


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


required : a list of server specifications < code > repeated istio networking v 1alpha 3 server servers = 1 ; < code >

public com alibaba nacos istio model server or builder get servers or builder ( int index ) { if ( servers builder = = null ) { return servers get ( index ) ; } else { return servers builder get message or builder ( index ) ; } }


add the given object to the list of jndi objects that this template will expose

public void add object ( string name , object object ) { this jndi objects put ( name , object ) ; }


public void set projection ( projection projection ) { if ( ! is supported ( projection ) ) { return ; } stereo mode = projection stereo mode ; left mesh data = new mesh data ( projection left mesh get sub mesh ( 0 ) ) ; right mesh data = projection single mesh ? left mesh data : new mesh data ( projection right mesh get sub mesh ( 0 ) ) ; }


dispose of resource that this editor may be using


extract { @ code field name } from { @ code hit } and if it is a string return the string else { @ code null }

default string string field value or null ( search hit hit , string field name ) { document field doc field = hit field ( field name ) ; if ( doc field ! = null ) { object value = doc field get value ( ) ; if ( value instanceof string ) { return ( string ) value ; } } return null ; }


tests to verify region failover results regarding different input result partition availability combinations ( v 1 ) - - rp 1 - - \ ( v 3 ) ( v 2 ) - - rp 2 - - ^ | ( blocking ) each vertex is in an individual region rp 1 , rp 2 are result partitions

public void test region failover for various result partition availability combinations ( ) throws exception { testing scheduling topology topology = new testing scheduling topology ( ) ; testing scheduling execution vertex v 1 = topology new execution vertex ( execution state finished ) ; testing scheduling execution vertex v 2 = topology new execution vertex ( execution state finished ) ; testing scheduling execution vertex v 3 = topology new execution vertex ( execution state running ) ; topology connect ( v 1 , v 3 , result partition type blocking ) ; topology connect ( v 2 , v 3 , result partition type blocking ) ; test result partition availability checker availability checker = new test result partition availability checker ( ) ; restart pipelined region failover strategy strategy = new restart pipelined region failover strategy ( topology , availability checker ) ; intermediate result partition i d rp 1 i d = v 1 get produced results ( ) iterator ( ) next ( ) get id ( ) ; intermediate result partition i d rp 2 i d = v 2 get produced results ( ) iterator ( ) next ( ) get id ( ) ; / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / / combination 1 : ( rp 1 = = available , rp 2 = = available ) / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - availability checker failed partitions clear ( ) ; verify that failed execution ( strategy , v 1 ) restarts ( v 1 , v 3 ) ; verify that failed execution ( strategy , v 2 ) restarts ( v 2 , v 3 ) ; verify that failed execution ( strategy , v 3 ) restarts ( v 3 ) ; / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / / combination 2 : ( rp 1 = = unavailable , rp 2 = = available ) / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - availability checker failed partitions clear ( ) ; availability checker mark result partition failed ( rp 1 i d ) ; verify that failed execution ( strategy , v 1 ) restarts ( v 1 , v 3 ) ; verify that failed execution ( strategy , v 2 ) restarts ( v 1 , v 2 , v 3 ) ; verify that failed execution ( strategy , v 3 ) restarts ( v 1 , v 3 ) ; / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / / combination 3 : ( rp 1 = = available , rp 2 = = unavailable ) / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - availability checker failed partitions clear ( ) ; availability checker mark result partition failed ( rp 2 i d ) ; verify that failed execution ( strategy , v 1 ) restarts ( v 1 , v 2 , v 3 ) ; verify that failed execution ( strategy , v 2 ) restarts ( v 2 , v 3 ) ; verify that failed execution ( strategy , v 3 ) restarts ( v 2 , v 3 ) ; / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / / combination 4 : ( rp 1 = = unavailable , rp = = unavailable ) / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - availability checker failed partitions clear ( ) ; availability checker mark result partition failed ( rp 1 i d ) ; availability checker mark result partition failed ( rp 2 i d ) ; verify that failed execution ( strategy , v 1 ) restarts ( v 1 , v 2 , v 3 ) ; verify that failed execution ( strategy , v 2 ) restarts ( v 1 , v 2 , v 3 ) ; verify that failed execution ( strategy , v 3 ) restarts ( v 1 , v 2 , v 3 ) ; }


http post from create a new resource by p u tting the given map { @ code body values } to http request , http header content type default ' applicationx - www - form - urlencoded ; charset = utf - 8 ' { @ code response type } can be an http rest result or http rest result data { @ code t } type

public < t > http rest result < t > post form ( string url , header header , map < string , string > body values , type response type ) throws exception { request http entity request http entity = new request http entity ( header set content type ( media type application form urlencoded ) , body values ) ; return execute ( url , http method post , request http entity , response type ) ; }


returns < code > true < code > if the given < b > argument < b > can be passed to the given < code > argument matcher < code > without causing a { @ link class cast exception }

private static boolean is compatible ( argument matcher < ? > argument matcher , object argument ) { if ( argument = = null ) return true ; class < ? > expected argument type = get argument type ( argument matcher ) ; return expected argument type is instance ( argument ) ; }


test to set and clear space quote when path is a file

public void test set and clear space quota path is file ( ) throws exception { final path parent = new path ( path utils get test dir ( get class ( ) ) get path ( ) , generic test utils get method name ( ) ) ; final path file = new path ( parent , " path - is - file " ) ; d f s test util create file ( dfs , file , 1024l , ( short ) 1l , 0 ) ; assert true ( dfs is file ( file ) ) ; / * set space quota * / test set and clear space quota path is file internal ( new string [ ] { " - set space quota " , " 1024 " , file to string ( ) } , file , - 1 , " set space quota " ) ; / * clear space quota * / test set and clear space quota path is file internal ( new string [ ] { " - clr space quota " , file to string ( ) } , file , - 1 , " clr space quota " ) ; }


locates the function based on the location given at construction time

public static undefined function find function ( program program , address address , task monitor monitor ) { if ( program = = null | | address = = null ) { return null ; } if ( monitor is cancelled ( ) ) { return null ; } / / first try to walk back up to the top of the function undefined function function = find function using simple block model ( program , address , monitor ) ; if ( function ! = null ) { return function ; } return find function using isolated block model ( program , address , monitor ) ; }


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


trim a varnode in a constant space to the correct starting offset constant handles may contain constants of indeterminate size this is where the size gets fixed , i e we mask off the constant to its proper size a varnode that is ends up in pcode should call this method to ensure that varnodes always contains raw data on the other hand , varnodes in handles are allowed to have offsets that violate size restrictions

public void trim ( ) { if ( address get address space ( ) get type ( ) = = address space type constant ) { offset = offset & masks [ size ] ; address = address get new address ( offset ) ; } }


add listener if cache data already set new content , listener should init last call md 5 by cache data md 5

public void add listener ( listener listener ) { if ( null = = listener ) { throw new illegal argument exception ( " listener is null " ) ; } manager listener wrap wrap = ( listener instanceof abstract config change listener ) ? new manager listener wrap ( listener , md 5 , content ) : new manager listener wrap ( listener , md 5 ) ; if ( listeners add if absent ( wrap ) ) { logger info ( " [ { } ] [ add - listener ] ok , tenant = { } , data id = { } , group = { } , cnt = { } " , name , tenant , data id , group , listeners size ( ) ) ; } }


set the unassigned primary shard to non - primary

public shard routing move unassigned from primary ( ) { assert state = = shard routing state unassigned : " expected an unassigned shard " + this ; if ( ! primary ) { throw new illegal shard routing state exception ( this , " not primary , can ' t move to replica " ) ; } return new shard routing ( shard id , current node id , relocating node id , false , state , peer recovery source instance , unassigned info , allocation id , expected shard size ) ; }