idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
16,400
public void addConstant ( ConstantPoolEntry entry ) { if ( entry instanceof Utf8Constant ) { Utf8Constant utf8 = ( Utf8Constant ) entry ; _utf8Map . put ( utf8 . getValue ( ) , utf8 ) ; } _entries . add ( entry ) ; }
Adds a new constant .
16,401
public Utf8Constant addUTF8 ( String value ) { Utf8Constant entry = getUTF8 ( value ) ; if ( entry != null ) return entry ; entry = new Utf8Constant ( this , _entries . size ( ) , value ) ; addConstant ( entry ) ; return entry ; }
Adds a UTF - 8 constant .
16,402
public StringConstant getString ( String name ) { for ( int i = 0 ; i < _entries . size ( ) ; i ++ ) { ConstantPoolEntry entry = _entries . get ( i ) ; if ( ! ( entry instanceof StringConstant ) ) continue ; StringConstant stringEntry = ( StringConstant ) entry ; if ( stringEntry . getString ( ) . equals ( name ) ) ret...
Gets a string constant .
16,403
public StringConstant addString ( String name ) { StringConstant entry = getString ( name ) ; if ( entry != null ) { return entry ; } Utf8Constant utf8 = addUTF8 ( name ) ; entry = new StringConstant ( this , _entries . size ( ) , utf8 . getIndex ( ) ) ; addConstant ( entry ) ; return entry ; }
Adds a string constant .
16,404
public IntegerConstant getIntegerByValue ( int value ) { for ( int i = 0 ; i < _entries . size ( ) ; i ++ ) { ConstantPoolEntry entry = _entries . get ( i ) ; if ( ! ( entry instanceof IntegerConstant ) ) continue ; IntegerConstant integerEntry = ( IntegerConstant ) entry ; if ( integerEntry . getValue ( ) == value ) r...
Gets a integer constant .
16,405
public IntegerConstant addInteger ( int value ) { IntegerConstant entry = getIntegerByValue ( value ) ; if ( entry != null ) return entry ; entry = new IntegerConstant ( this , _entries . size ( ) , value ) ; addConstant ( entry ) ; return entry ; }
Adds a integer constant .
16,406
public LongConstant getLongByValue ( long value ) { for ( int i = 0 ; i < _entries . size ( ) ; i ++ ) { ConstantPoolEntry entry = _entries . get ( i ) ; if ( ! ( entry instanceof LongConstant ) ) continue ; LongConstant longEntry = ( LongConstant ) entry ; if ( longEntry . getValue ( ) == value ) return longEntry ; } ...
Gets a long constant .
16,407
public LongConstant addLong ( long value ) { LongConstant entry = getLongByValue ( value ) ; if ( entry != null ) return entry ; entry = new LongConstant ( this , _entries . size ( ) , value ) ; addConstant ( entry ) ; addConstant ( null ) ; return entry ; }
Adds a long constant .
16,408
public FloatConstant getFloatByValue ( float value ) { for ( int i = 0 ; i < _entries . size ( ) ; i ++ ) { ConstantPoolEntry entry = _entries . get ( i ) ; if ( ! ( entry instanceof FloatConstant ) ) continue ; FloatConstant floatEntry = ( FloatConstant ) entry ; if ( floatEntry . getValue ( ) == value ) return floatE...
Gets a float constant .
16,409
public FloatConstant addFloat ( float value ) { FloatConstant entry = getFloatByValue ( value ) ; if ( entry != null ) return entry ; entry = new FloatConstant ( this , _entries . size ( ) , value ) ; addConstant ( entry ) ; return entry ; }
Adds a float constant .
16,410
public DoubleConstant getDoubleByValue ( double value ) { for ( int i = 0 ; i < _entries . size ( ) ; i ++ ) { ConstantPoolEntry entry = _entries . get ( i ) ; if ( ! ( entry instanceof DoubleConstant ) ) continue ; DoubleConstant doubleEntry = ( DoubleConstant ) entry ; if ( doubleEntry . getValue ( ) == value ) retur...
Gets a double constant .
16,411
public DoubleConstant addDouble ( double value ) { DoubleConstant entry = getDoubleByValue ( value ) ; if ( entry != null ) return entry ; entry = new DoubleConstant ( this , _entries . size ( ) , value ) ; addConstant ( entry ) ; addConstant ( null ) ; return entry ; }
Adds a double constant .
16,412
public ClassConstant getClass ( String name ) { for ( int i = 0 ; i < _entries . size ( ) ; i ++ ) { ConstantPoolEntry entry = _entries . get ( i ) ; if ( ! ( entry instanceof ClassConstant ) ) continue ; ClassConstant classEntry = ( ClassConstant ) entry ; if ( classEntry . getName ( ) . equals ( name ) ) return class...
Gets a class constant .
16,413
public ClassConstant addClass ( String name ) { ClassConstant entry = getClass ( name ) ; if ( entry != null ) return entry ; Utf8Constant utf8 = addUTF8 ( name ) ; entry = new ClassConstant ( this , _entries . size ( ) , utf8 . getIndex ( ) ) ; addConstant ( entry ) ; return entry ; }
Adds a class constant .
16,414
public NameAndTypeConstant getNameAndType ( String name , String type ) { for ( int i = 0 ; i < _entries . size ( ) ; i ++ ) { ConstantPoolEntry entry = _entries . get ( i ) ; if ( ! ( entry instanceof NameAndTypeConstant ) ) continue ; NameAndTypeConstant methodEntry = ( NameAndTypeConstant ) entry ; if ( methodEntry ...
Gets a name - and - type constant .
16,415
public NameAndTypeConstant addNameAndType ( String name , String type ) { NameAndTypeConstant entry = getNameAndType ( name , type ) ; if ( entry != null ) return entry ; Utf8Constant nameEntry = addUTF8 ( name ) ; Utf8Constant typeEntry = addUTF8 ( type ) ; entry = new NameAndTypeConstant ( this , _entries . size ( ) ...
Adds a name - and - type constant .
16,416
public FieldRefConstant addFieldRef ( String className , String name , String type ) { FieldRefConstant entry = getFieldRef ( className , name , type ) ; if ( entry != null ) return entry ; ClassConstant classEntry = addClass ( className ) ; NameAndTypeConstant typeEntry = addNameAndType ( name , type ) ; entry = new F...
Adds a field ref constant .
16,417
public MethodHandleConstant getMethodHandle ( MethodHandleType mhType , ConstantPoolEntry cpEntry ) { for ( int i = 0 ; i < _entries . size ( ) ; i ++ ) { ConstantPoolEntry entry = _entries . get ( i ) ; if ( ! ( entry instanceof MethodHandleConstant ) ) { continue ; } MethodHandleConstant methodHandle = ( MethodHandle...
Gets a method ref constant .
16,418
public InterfaceMethodRefConstant getInterfaceRef ( String className , String name , String type ) { for ( int i = 0 ; i < _entries . size ( ) ; i ++ ) { ConstantPoolEntry entry = _entries . get ( i ) ; if ( ! ( entry instanceof InterfaceMethodRefConstant ) ) continue ; InterfaceMethodRefConstant methodEntry ; methodEn...
Gets an interface constant .
16,419
public InterfaceMethodRefConstant addInterfaceRef ( String className , String name , String type ) { InterfaceMethodRefConstant entry = getInterfaceRef ( className , name , type ) ; if ( entry != null ) return entry ; ClassConstant classEntry = addClass ( className ) ; NameAndTypeConstant typeEntry = addNameAndType ( n...
Adds an interface ref constant .
16,420
public InvokeDynamicConstant addInvokeDynamicRef ( BootstrapMethodAttribute attr , String methodName , String methodType , String bootClass , String bootMethod , String bootType , ConstantPoolEntry [ ] cpEntries ) { NameAndTypeConstant methodEntry = addNameAndType ( methodName , methodType ) ; MethodRefConstant bootMet...
Adds an invokedynamic constant .
16,421
public void write ( ByteCodeWriter out ) throws IOException { out . writeShort ( _entries . size ( ) ) ; for ( int i = 1 ; i < _entries . size ( ) ; i ++ ) { ConstantPoolEntry entry = _entries . get ( i ) ; if ( entry != null ) entry . write ( out ) ; } }
Writes the contents of the pool .
16,422
public void write ( int b ) throws IOException { log . info ( "random-write(0x" + Long . toHexString ( getFilePointer ( ) ) + ",1)" ) ; _file . write ( b ) ; }
Write a byte to the file advancing the pointer .
16,423
private Topology createAdHocTopologyFromSuitableOptions ( SuitableOptions appInfoSuitableOptions ) { Topology topology = new Topology ( ) ; TopologyElement current = null ; TopologyElement previous = null ; for ( String moduleName : appInfoSuitableOptions . getStringIterator ( ) ) { if ( current == null ) { current = n...
Later it will be better an exception than a weird result .
16,424
public int read ( byte [ ] buffer , int offset , int length ) throws IOException { int len = _next . read ( buffer , offset , length ) ; _crc = Crc64 . generate ( _crc , buffer , offset , len ) ; return len ; }
Reads a buffer from the underlying stream .
16,425
public void removeDirectory ( String path , String tail , Result < Object > result ) { result . ok ( null ) ; }
Updates the directory with the new file list .
16,426
void updateRack ( HeartbeatImpl heartbeat , UpdateRackHeartbeat updateRack ) { for ( UpdateServerHeartbeat serverUpdate : updateRack . getServers ( ) ) { if ( serverUpdate == null ) { continue ; } update ( serverUpdate ) ; ServerHeartbeat peerServer = findServer ( serverUpdate . getAddress ( ) , serverUpdate . getPort ...
Update the rack with a heartbeat message .
16,427
public String get ( String key , String defaultValue ) { String value = _map . get ( key ) ; if ( value != null ) { return value ; } else { return defaultValue ; } }
Configuration value with a default value .
16,428
@ SuppressWarnings ( "unchecked" ) public < T > T get ( String key , Class < T > type , T defaultValue ) { Objects . requireNonNull ( key ) ; Objects . requireNonNull ( type ) ; String value = _map . get ( key ) ; if ( value == null ) { return defaultValue ; } if ( type . equals ( String . class ) ) { return ( T ) valu...
Gets a configuration value converted to a type .
16,429
public < T > void inject ( T bean , String prefix ) { Objects . requireNonNull ( bean ) ; ConfigStub stub = new ConfigStub ( bean . getClass ( ) , prefix ) ; stub . inject ( bean , this ) ; }
Inject a bean from the configuration
16,430
private static void readChar ( ByteToChar converter , CharReader is , int ch , boolean isTop ) throws IOException { if ( ch == '+' ) { if ( isTop ) converter . addByte ( ' ' ) ; else converter . addChar ( ' ' ) ; } else if ( ch == '%' ) { int ch1 = is . next ( ) ; if ( ch1 == 'u' ) { ch1 = is . next ( ) ; int ch2 = is ...
Scans the next character from the input stream adding it to the converter .
16,431
public void run ( ) { try { runImpl ( ) ; } catch ( final Throwable e ) { if ( e instanceof DisplayableException ) log . warning ( e . getMessage ( ) ) ; else log . warning ( e . toString ( ) ) ; _exception = e ; } finally { notifyComplete ( ) ; } }
runs the compiler .
16,432
public void write ( int v ) throws IOException { _buf [ 0 ] = ( byte ) v ; _stream . write ( _buf , 0 , 1 , false ) ; }
Writes a byte to the underlying stream .
16,433
public static String getLocation ( String providerName ) { for ( String key : map . keySet ( ) ) { if ( providerName . startsWith ( key ) ) { return map . get ( key ) ; } } return null ; }
Gets the sanitized location of an offering
16,434
public void read ( ByteCodeParser in ) throws IOException { int length = in . readInt ( ) ; if ( length != 2 ) throw new IOException ( "expected length of 2 at " + length ) ; int code = in . readShort ( ) ; _signature = in . getUTF8 ( code ) ; }
Reads the signature .
16,435
public void write ( String s , int offset , int length ) throws IOException { while ( length > 0 ) { if ( _tail == null ) addBuffer ( TempCharBuffer . allocate ( ) ) ; else if ( _tail . _buf . length <= _tail . _length ) { addBuffer ( TempCharBuffer . allocate ( ) ) ; } int sublen = _tail . _buf . length - _tail . _len...
Writes part of a string .
16,436
private static ClassLoader getInitParent ( ClassLoader parent , boolean isRoot ) { if ( parent == null ) parent = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( isRoot || parent instanceof DynamicClassLoader ) return parent ; else { return parent ; } }
Returns the initialization parent i . e . the parent if given or the context class loader if not given .
16,437
public void write ( int ch ) throws IOException { char [ ] buffer = _tempCharBuffer ; buffer [ 0 ] = ( char ) ch ; write ( buffer , 0 , 1 ) ; }
Writes a character to the output .
16,438
public void write ( String s , int off , int len ) throws IOException { char [ ] buffer = _tempCharBuffer ; int bufferLength = buffer . length ; while ( len > 0 ) { int sublen = Math . min ( len , bufferLength ) ; s . getChars ( off , off + sublen , buffer , 0 ) ; write ( buffer , 0 , sublen ) ; off += sublen ; len -= ...
Writes a subsection of a string to the output .
16,439
final public void write ( String s ) throws IOException { if ( s == null ) { write ( _nullChars , 0 , _nullChars . length ) ; return ; } write ( s , 0 , s . length ( ) ) ; }
Writes a string to the output .
16,440
public HeaderParams put ( String name , String value ) { values . put ( cleanAndValidate ( name ) , cleanAndValidate ( value ) ) ; return this ; }
Overwrites in case there is a value already associated with that name .
16,441
public void setBackgroundPeriod ( long period ) { if ( period < 1 ) { throw new ConfigException ( L . l ( "profile period '{0}ms' is too small. The period must be greater than 10ms." , period ) ) ; } _profilerService . setBackgroundInterval ( period , TimeUnit . MILLISECONDS ) ; }
Sets the background interval . If the background profile hasn t started start it .
16,442
public void setLocation ( String filename , int line ) throws IOException { if ( _lineMap != null && filename != null && line >= 0 ) { _lineMap . add ( filename , line , _destLine , _isPreferLast ) ; } }
Sets the source filename and line .
16,443
public void print ( String s ) throws IOException { if ( _startLine ) printIndent ( ) ; if ( s == null ) { _lastCr = false ; _os . print ( "null" ) ; return ; } int len = s . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { int ch = s . charAt ( i ) ; if ( ch == '\n' && ! _lastCr ) _destLine ++ ; else if ( ch == '\r' ...
Prints a string
16,444
public void print ( char ch ) throws IOException { if ( _startLine ) printIndent ( ) ; if ( ch == '\r' ) { _destLine ++ ; } else if ( ch == '\n' && ! _lastCr ) _destLine ++ ; _lastCr = ch == '\r' ; _os . print ( ch ) ; }
Prints a character .
16,445
public void print ( boolean b ) throws IOException { if ( _startLine ) printIndent ( ) ; _os . print ( b ) ; _lastCr = false ; }
Prints a boolean .
16,446
public void print ( long l ) throws IOException { if ( _startLine ) printIndent ( ) ; _os . print ( l ) ; _lastCr = false ; }
Prints an long
16,447
public void print ( Object o ) throws IOException { if ( _startLine ) printIndent ( ) ; _os . print ( o ) ; _lastCr = false ; }
Prints an object .
16,448
public void println ( ) throws IOException { _os . println ( ) ; if ( ! _lastCr ) _destLine ++ ; _lastCr = false ; _startLine = true ; }
Prints a newline
16,449
public void printClass ( Class < ? > cl ) throws IOException { if ( ! cl . isArray ( ) ) print ( cl . getName ( ) . replace ( '$' , '.' ) ) ; else { printClass ( cl . getComponentType ( ) ) ; print ( "[]" ) ; } }
Prints the Java represention of the class
16,450
@ SuppressWarnings ( "unchecked" ) public void printType ( Type type ) throws IOException { if ( type instanceof Class < ? > ) { printTypeClass ( ( Class < ? > ) type ) ; } else if ( type instanceof ParameterizedType ) { ParameterizedType parameterizedType = ( ParameterizedType ) type ; printParameterizedType ( paramet...
Prints the Java representation of the type
16,451
public void printIndent ( ) throws IOException { _startLine = false ; for ( int i = 0 ; i < _indentDepth ; i ++ ) _os . print ( ' ' ) ; _lastCr = false ; }
Prints the indentation at the beginning of a line .
16,452
public static Parameter getActionParameter ( Action action , String paramName ) { for ( Parameter param : action . getParameters ( ) ) { if ( paramName . equals ( param . getName ( ) ) ) { return param ; } } return NOT_FOUND_PARAMETER ; }
Returns the first parameter with attribute name equals to paramName ; if not found NOT_FOUND_PARAMETER .
16,453
public static List < Action > getActions ( MonitoringRule rule , String nameFilter ) { List < Action > result = new ArrayList < Action > ( ) ; if ( nameFilter == null ) { throw new NullPointerException ( "nameFilter cannot be null" ) ; } for ( Action action : getActions ( rule ) ) { if ( nameFilter . equalsIgnoreCase (...
Get the actions of a rule filtered by its name
16,454
public static List < Action > getActions ( MonitoringRule rule ) { List < Action > result ; if ( rule . getActions ( ) != null && rule . getActions ( ) . getActions ( ) != null ) { result = rule . getActions ( ) . getActions ( ) ; } else { result = Collections . < Action > emptyList ( ) ; } return result ; }
Wrapper to avoid a NPE
16,455
public static ObjectName getObjectName ( String domain , Map < String , String > properties ) throws MalformedObjectNameException { StringBuilder cb = new StringBuilder ( ) ; cb . append ( domain ) ; cb . append ( ':' ) ; boolean isFirst = true ; Pattern escapePattern = Pattern . compile ( "[,=:\"*?]" ) ; String type =...
Creates the clean name
16,456
private boolean isMethodApi ( Method method ) { if ( _type == _api ) { return true ; } for ( Method methodApi : _api . getMethods ( ) ) { if ( methodApi . getName ( ) . equals ( method . getName ( ) ) ) { return true ; } } return false ; }
Only API methods are exposed .
16,457
public StateConnection service ( ) { try { StateConnection nextState = _state . service ( this ) ; return nextState ; } catch ( Throwable e ) { log . warning ( e . toString ( ) ) ; log . log ( Level . FINER , e . toString ( ) , e ) ; toClose ( ) ; return StateConnection . CLOSE_READ_A ; } }
Service is the main call when data is available from the socket .
16,458
public void exec ( String sql , Result < Object > result , Object ... args ) { _kraken . query ( sql ) . exec ( result , args ) ; }
Executes a command against the database .
16,459
public void prepare ( String sql , Result < CursorPrepareSync > result ) { result . ok ( _kraken . query ( sql ) . prepare ( ) ) ; }
Prepares for later execution of a command .
16,460
public void findOne ( String sql , Result < Cursor > result , Object ... args ) { _kraken . query ( sql ) . findOne ( result , args ) ; }
Queries for a single result in the database .
16,461
public void find ( ResultStream < Cursor > result , String sql , Object ... args ) { _kraken . findStream ( sql , args , result ) ; }
Queries the database returning values to a result sink .
16,462
public void map ( MethodRef method , String sql , Object ... args ) { _kraken . map ( method , sql , args ) ; }
Starts a map call on the local node .
16,463
public void writeAttribute ( String name , Object value ) { if ( ! _isElementOpen ) throw new IllegalStateException ( "no open element" ) ; if ( value == null ) return ; _isElementOpen = false ; try { _strategy . writeAttribute ( this , name , value ) ; } finally { _isElementOpen = true ; } }
Write an attribute with a value if value is null nothing is written .
16,464
public void writeAttribute ( String name , Object ... values ) { if ( ! _isElementOpen ) throw new IllegalStateException ( "no open element" ) ; _isElementOpen = false ; try { _strategy . writeAttribute ( this , name , values ) ; } finally { _isElementOpen = true ; } }
Write an attribute with multiple values separated by space if a value is null nothing is written .
16,465
public void requestPubkey ( final BitmessageAddress contact ) { BitmessageAddress stored = addressRepository . getAddress ( contact . getAddress ( ) ) ; tryToFindMatchingPubkey ( contact ) ; if ( contact . getPubkey ( ) != null ) { if ( stored != null ) { stored . setPubkey ( contact . getPubkey ( ) ) ; addressReposito...
Be aware that if the pubkey already exists in the inventory the metods will not request it and the callback for freshly received pubkeys will not be called . Instead the pubkey is added to the contact and stored on DB .
16,466
public void addForeignWatch ( TableKraken table , byte [ ] key , String serverId ) { WatchForeign watch = new WatchForeign ( key , table , serverId ) ; WatchTable watchTable = getWatchTable ( table ) ; watchTable . addWatchForeign ( watch , key ) ; }
Adds a watch from a foreign server . Remote notifications will send a copy to the foreign server .
16,467
public void notifyWatch ( TableKraken table , byte [ ] key ) { WatchTable watchTable = _tableMap . get ( table ) ; if ( watchTable != null ) { watchTable . onPut ( key , TableListener . TypePut . REMOTE ) ; } }
Notify local and remote watches for the given table and key
16,468
public void notifyLocalWatch ( TableKraken table , byte [ ] key ) { WatchTable watchTable = _tableMap . get ( table ) ; if ( watchTable != null ) { watchTable . onPut ( key , TableListener . TypePut . LOCAL ) ; } }
Notify local watches for the given table and key
16,469
public void addTable ( TableKelp tableKelp , String sql , BackupKelp backupCb ) { RowCursor cursor = _metaTable . cursor ( ) ; cursor . setBytes ( 1 , tableKelp . tableKey ( ) , 0 ) ; cursor . setString ( 2 , tableKelp . getName ( ) ) ; cursor . setString ( 3 , sql ) ; _metaTable . put ( cursor , backupCb , Result . ig...
Table callbacks .
16,470
public void write ( byte [ ] buffer , int offset , int length ) throws IOException { _file . write ( buffer , offset , length ) ; }
Writes a block starting from the current file pointer .
16,471
public void write ( long fileOffset , byte [ ] buffer , int offset , int length ) throws IOException { _file . seek ( fileOffset ) ; _file . write ( buffer , offset , length ) ; }
Writes a block from a given location .
16,472
public OutputStream getOutputStream ( ) throws IOException { if ( _os == null ) _os = new FileOutputStream ( _file . getFD ( ) ) ; return _os ; }
Returns an OutputStream for this stream .
16,473
public InputStream getInputStream ( ) throws IOException { if ( _is == null ) _is = new FileInputStream ( _file . getFD ( ) ) ; return _is ; }
Returns an InputStream for this stream .
16,474
public static String encodeString ( String uri ) { CharBuffer cb = CharBuffer . allocate ( ) ; for ( int i = 0 ; i < uri . length ( ) ; i ++ ) { char ch = uri . charAt ( i ) ; switch ( ch ) { case '<' : cb . append ( "&lt;" ) ; break ; case '>' : cb . append ( "&gt;" ) ; break ; case '&' : cb . append ( "&amp;" ) ; bre...
Escape special characters .
16,475
public double getLatencyFactor ( ) { long now = CurrentTime . currentTime ( ) ; long decayPeriod = 60000 ; long delta = decayPeriod - ( now - _lastSuccessTime ) ; if ( delta <= 0 ) return 0 ; else return ( _latencyFactor * delta ) / decayPeriod ; }
Returns the latency factory
16,476
public double getCpuLoadAvg ( ) { double avg = _cpuLoadAvg ; long time = _cpuSetTime ; long now = CurrentTime . currentTime ( ) ; if ( now - time < 10000L ) return avg ; else return avg * 10000L / ( now - time ) ; }
Gets the CPU load avg
16,477
public void success ( ) { _currentFailCount = 0 ; long now = CurrentTime . currentTime ( ) ; if ( _firstSuccessTime <= 0 ) { _firstSuccessTime = now ; } _dynamicFailRecoverTime = 1000L ; }
Called when the server has a successful response
16,478
public ClientSocket openWarm ( ) { State state = _state ; if ( ! state . isEnabled ( ) ) { return null ; } ClientSocket stream = openRecycle ( ) ; if ( stream != null ) { return stream ; } if ( canOpenWarm ( ) ) { return connect ( ) ; } else { return null ; } }
Open a stream to the target server restricted by warmup .
16,479
public ClientSocket openIfLive ( ) { if ( _state . isClosed ( ) ) { return null ; } ClientSocket stream = openRecycle ( ) ; if ( stream != null ) return stream ; long now = CurrentTime . currentTime ( ) ; if ( isFailed ( now ) ) return null ; else if ( _state == State . FAIL && _startingCount . get ( ) > 0 ) { return n...
Open a stream to the target server object persistence .
16,480
public ClientSocket openIfHeartbeatActive ( ) { if ( _state . isClosed ( ) ) { return null ; } if ( ! _isHeartbeatActive && _isHeartbeatServer ) { return null ; } ClientSocket stream = openRecycle ( ) ; if ( stream != null ) return stream ; return connect ( ) ; }
Open a stream if the target server s heartbeat is active .
16,481
public ClientSocket openSticky ( ) { State state = _state ; if ( ! state . isSessionEnabled ( ) ) { return null ; } ClientSocket stream = openRecycle ( ) ; if ( stream != null ) return stream ; long now = CurrentTime . currentTime ( ) ; if ( isFailed ( now ) ) { return null ; } if ( isBusy ( now ) ) { return null ; } r...
Open a stream to the target server for a session .
16,482
public ClientSocket open ( ) { State state = _state ; if ( ! state . isInit ( ) ) return null ; ClientSocket stream = openRecycle ( ) ; if ( stream != null ) return stream ; return connect ( ) ; }
Open a stream to the target server for the load balancer .
16,483
private ClientSocket openRecycle ( ) { long now = CurrentTime . currentTime ( ) ; ClientSocket stream = null ; synchronized ( this ) { if ( _idleHead != _idleTail ) { stream = _idle [ _idleHead ] ; long freeTime = stream . getIdleStartTime ( ) ; _idle [ _idleHead ] = null ; _idleHead = ( _idleHead + _idle . length - 1 ...
Returns a valid recycled stream from the idle pool to the backend .
16,484
private ClientSocket connect ( ) { if ( _maxConnections <= _activeCount . get ( ) + _startingCount . get ( ) ) { if ( log . isLoggable ( Level . WARNING ) ) { log . warning ( this + " connect exceeded max-connections" + "\n max-connections=" + _maxConnections + "\n activeCount=" + _activeCount . get ( ) + "\n starti...
Connect to the backend server .
16,485
public boolean canConnect ( ) { try { wake ( ) ; ClientSocket stream = open ( ) ; if ( stream != null ) { stream . free ( stream . getIdleStartTime ( ) ) ; return true ; } return false ; } catch ( Exception e ) { log . log ( Level . FINER , e . toString ( ) , e ) ; return false ; } }
Returns true if can connect to the client .
16,486
public void write ( byte [ ] buffer , int offset , int length ) { write ( buffer , offset , length , true ) ; }
Write a final binary chunk .
16,487
public void writePart ( byte [ ] buffer , int offset , int length ) { write ( buffer , offset , length , false ) ; }
Write a non - final binary chunk .
16,488
private void write ( byte [ ] buffer , int offset , int length , boolean isFinal ) { Objects . requireNonNull ( buffer ) ; _frameOut . write ( buffer , offset , length , isFinal ) ; }
Write a binary chunk .
16,489
public void close ( WebSocketClose reason , String text ) { Objects . requireNonNull ( reason ) ; if ( _state . isClosed ( ) ) { return ; } _state = _state . closeSelf ( ) ; _frameOut . close ( reason , text ) ; if ( _state . isClosed ( ) ) { disconnect ( ) ; } }
Close the websocket .
16,490
private void readClose ( FrameIn fIs ) throws IOException { if ( _state . isClosed ( ) ) { return ; } _state = _state . closePeer ( ) ; int code = fIs . readClose ( ) ; StringBuilder sb = new StringBuilder ( ) ; fIs . readText ( sb ) ; if ( _service != null ) { WebSocketClose codeWs = WebSocketCloses . of ( code ) ; tr...
Read a close frame .
16,491
public void fail ( Throwable exn ) { log . log ( Level . WARNING , exn . toString ( ) , exn ) ; }
Close the websocket with a failure .
16,492
public static PathImpl lookup ( String url ) { PathImpl pwd = getPwd ( ) ; if ( ! url . startsWith ( "/" ) ) { return pwd . lookup ( url , null ) ; } else { return PWD . lookup ( url , null ) ; } }
Returns a new path relative to the current directory .
16,493
public static PathImpl getPwd ( ) { PathImpl pwd = ENV_PWD . get ( ) ; if ( pwd == null ) { if ( PWD == null ) { PWD = new FilePath ( null ) ; } pwd = PWD ; ENV_PWD . setGlobal ( pwd ) ; } return pwd ; }
Returns a path for the current directory .
16,494
public static PathImpl lookupNative ( String url , Map < String , Object > attr ) { return getPwd ( ) . lookupNative ( url , attr ) ; }
Returns a native filesystem path with attributes .
16,495
public static ReadStreamOld openRead ( InputStream is ) { if ( is instanceof ReadStreamOld ) return ( ReadStreamOld ) is ; VfsStreamOld s = new VfsStreamOld ( is , null ) ; return new ReadStreamOld ( s ) ; }
Creates new ReadStream from an InputStream
16,496
public static ReadStreamOld openRead ( Reader reader ) { if ( reader instanceof ReadStreamOld . StreamReader ) return ( ( ReadStreamOld . StreamReader ) reader ) . getStream ( ) ; ReaderWriterStream s = new ReaderWriterStream ( reader , null ) ; ReadStreamOld is = new ReadStreamOld ( s ) ; try { is . setEncoding ( "utf...
Creates a ReadStream from a Reader
16,497
public static WriteStreamOld openWrite ( CharBuffer cb ) { com . caucho . v5 . vfs . VfsStringWriter s = new com . caucho . v5 . vfs . VfsStringWriter ( cb ) ; WriteStreamOld os = new WriteStreamOld ( s ) ; try { os . setEncoding ( "utf-8" ) ; } catch ( Exception e ) { } return os ; }
Creates a write stream to a CharBuffer . This is the standard way to write to a string .
16,498
public static void initJNI ( ) { if ( _isInitJNI . getAndSet ( true ) ) { return ; } FilesystemPath jniFilePath = JniFilePath . create ( ) ; if ( jniFilePath != null ) { DEFAULT_SCHEME_MAP . put ( "file" , jniFilePath ) ; SchemeMap localMap = _localSchemeMap . get ( ) ; if ( localMap != null ) localMap . put ( "file" ,...
Initialize the JNI .
16,499
private void writeMetaTable ( TableEntry entry ) { TempBuffer tBuf = TempBuffer . create ( ) ; byte [ ] buffer = tBuf . buffer ( ) ; int offset = 0 ; buffer [ offset ++ ] = CODE_TABLE ; offset += BitsUtil . write ( buffer , offset , entry . tableKey ( ) ) ; offset += BitsUtil . writeInt16 ( buffer , offset , entry . ro...
Metadata for a table entry .