idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
16,200
private QueryBuilderKraken parseUpdate ( ) { Token token ; UpdateQueryBuilder query = new UpdateQueryBuilder ( _tableManager , _sql ) ; String tableName = parseTableName ( ) ; query . setTableName ( tableName ) ; _query = query ; if ( ( token = scanToken ( ) ) != Token . SET ) { throw error ( L . l ( "expected SET at {...
Parses the update .
16,201
private void parseSetItem ( UpdateQueryBuilder query ) { Token token ; if ( ( token = scanToken ( ) ) != Token . IDENTIFIER ) { throw error ( L . l ( "expected identifier at '{0}'" , token ) ) ; } String columnName = _lexeme ; if ( ( token = scanToken ( ) ) != Token . EQ ) { throw error ( "expected '=' at {0}" , token ...
Parses a set item .
16,202
private ExprKraken parseAndExpr ( ) { AndExpr andExpr = new AndExpr ( ) ; andExpr . add ( parseNotExpr ( ) ) ; while ( true ) { Token token = scanToken ( ) ; switch ( token ) { case AND : andExpr . add ( parseNotExpr ( ) ) ; break ; default : _token = token ; return andExpr . getSingleExpr ( ) ; } } }
Parses an AND expression .
16,203
private ExprKraken parseCmpExpr ( ) { ExprKraken left = parseAddExpr ( ) ; Token token = scanToken ( ) ; boolean isNot = false ; switch ( token ) { case EQ : return new BinaryExpr ( BinaryOp . EQ , left , parseAddExpr ( ) ) ; case NE : return new BinaryExpr ( BinaryOp . NE , left , parseAddExpr ( ) ) ; case LT : return...
Parses a CMP expression .
16,204
private ExprKraken parseSimpleTerm ( ) { Token token = scanToken ( ) ; switch ( token ) { case MINUS : return new UnaryExpr ( UnaryOp . MINUS , parseSimpleTerm ( ) ) ; case LPAREN : { ExprKraken expr = parseExpr ( ) ; if ( ( token = scanToken ( ) ) != Token . RPAREN ) { throw error ( "Expected ')' at '{0}'" , token ) ;...
Parses a simple term .
16,205
private String parseIdentifier ( ) { Token token = scanToken ( ) ; if ( token != Token . IDENTIFIER ) { throw error ( "expected identifier at {0}" , token ) ; } return _lexeme ; }
Parses an identifier .
16,206
public I get ( ) { I instance = _instance ; if ( instance == null || instance . isModified ( ) ) { _instance = instance = service ( ) . get ( ) ; } return instance ; }
Returns the current instance .
16,207
public V put ( K key , V value ) { Entry < V > oldValue = _cache . put ( key , new Entry < V > ( _expireInterval , value ) ) ; if ( oldValue != null ) return oldValue . getValue ( ) ; else return null ; }
Put a new item in the cache .
16,208
public V get ( K key ) { Entry < V > entry = _cache . get ( key ) ; if ( entry == null ) return null ; if ( entry . isValid ( ) ) return entry . getValue ( ) ; else { _cache . remove ( key ) ; return null ; } }
Gets an item from the cache returning null if expired .
16,209
private int parseUtf8 ( InputStream is , int length ) throws IOException { if ( length <= 0 ) return 0 ; if ( length > 256 ) { is . skip ( length ) ; return 0 ; } int offset = _charBufferOffset ; if ( _charBuffer . length <= offset + length ) { char [ ] buffer = new char [ 2 * _charBuffer . length ] ; System . arraycop...
Parses the UTF .
16,210
private void scanAttributeForAnnotation ( InputStream is ) throws IOException { int nameIndex = readShort ( is ) ; int length = readInt ( is ) ; if ( ! isNameAnnotation ( nameIndex ) ) { is . skip ( length ) ; return ; } int count = readShort ( is ) ; for ( int i = 0 ; i < count ; i ++ ) { int annTypeIndex = scanAnnota...
Parses an attribute for an annotation .
16,211
public static long toPeriod ( String value , long defaultUnits ) throws ConfigException { if ( value == null ) return 0 ; long sign = 1 ; long period = 0 ; int i = 0 ; int length = value . length ( ) ; if ( length > 0 && value . charAt ( i ) == '-' ) { sign = - 1 ; i ++ ; } while ( i < length ) { long delta = 0 ; char ...
Converts a period string to a time .
16,212
static HttpStreamWrapper openRead ( HttpPath path ) throws IOException { HttpStream stream = createStream ( path ) ; stream . _isPost = false ; HttpStreamWrapper wrapper = new HttpStreamWrapper ( stream ) ; String status = ( String ) wrapper . getAttribute ( "status" ) ; if ( "404" . equals ( status ) ) { throw new Fil...
Opens a new HTTP stream for reading i . e . a GET request .
16,213
static HttpStreamWrapper openReadWrite ( HttpPath path ) throws IOException { HttpStream stream = createStream ( path ) ; stream . _isPost = true ; return new HttpStreamWrapper ( stream ) ; }
Opens a new HTTP stream for reading and writing i . e . a POST request .
16,214
static private HttpStream createStream ( HttpPath path ) throws IOException { String host = path . getHost ( ) ; int port = path . getPort ( ) ; HttpStream stream = null ; long streamTime = 0 ; synchronized ( LOCK ) { if ( _savedStream != null && host . equals ( _savedStream . getHost ( ) ) && port == _savedStream . ge...
Creates a new HTTP stream . If there is a saved connection to the same host use it .
16,215
private void init ( PathImpl path ) { _contentLength = - 1 ; _isChunked = false ; _isRequestDone = false ; _didGet = false ; _isPost = false ; _isHead = false ; _method = null ; _attributes . clear ( ) ; if ( path instanceof HttpPath ) _virtualHost = ( ( HttpPath ) path ) . getVirtualHost ( ) ; }
Initializes the stream for the next request .
16,216
private void getConnInput ( ) throws IOException { if ( _didGet ) return ; try { getConnInputImpl ( ) ; } catch ( IOException e ) { _isKeepalive = false ; throw e ; } catch ( RuntimeException e ) { _isKeepalive = false ; throw e ; } }
Sends the request and initializes the response .
16,217
public void setPathFormat ( String pathFormat ) throws ConfigException { _pathFormat = pathFormat ; if ( pathFormat . endsWith ( ".zip" ) ) { throw new ConfigException ( L . l ( ".zip extension to path-format is not supported." ) ) ; } }
Sets the formatted path .
16,218
public void setArchiveFormat ( String format ) { if ( format . endsWith ( ".gz" ) ) { _archiveFormat = format . substring ( 0 , format . length ( ) - ".gz" . length ( ) ) ; _archiveSuffix = ".gz" ; } else if ( format . endsWith ( ".zip" ) ) { _archiveFormat = format . substring ( 0 , format . length ( ) - ".zip" . leng...
Sets the archive name format
16,219
public void setRolloverPeriod ( Duration period ) { _rolloverPeriod = period . toMillis ( ) ; if ( _rolloverPeriod > 0 ) { _rolloverPeriod += 3600000L - 1 ; _rolloverPeriod -= _rolloverPeriod % 3600000L ; } else _rolloverPeriod = Integer . MAX_VALUE ; }
Sets the log rollover period rounded up to the nearest hour .
16,220
public void setRolloverCheckPeriod ( long period ) { if ( period > 1000 ) _rolloverCheckPeriod = period ; else if ( period > 0 ) _rolloverCheckPeriod = 1000 ; if ( DAY < _rolloverCheckPeriod ) { log . info ( this + " rollover-check-period " + _rolloverCheckPeriod + "ms is longer than 24h" ) ; _rolloverCheckPeriod = DAY...
Sets how often the log rollover will be checked .
16,221
public void write ( byte [ ] buffer , int offset , int length ) throws IOException { synchronized ( _logLock ) { if ( _isRollingOver && getTempStreamMax ( ) < _tempStreamSize ) { try { _logLock . wait ( ) ; } catch ( Exception e ) { } } if ( ! _isRollingOver ) { if ( _os == null ) openLog ( ) ; if ( _os != null ) _os ....
Writes to the underlying log .
16,222
private void rolloverLogTask ( ) { try { if ( _isInit ) { flush ( ) ; } } catch ( Exception e ) { log . log ( Level . WARNING , e . toString ( ) , e ) ; } _isRollingOver = true ; try { if ( ! _isInit ) return ; Path savedPath = null ; long now = CurrentTime . currentTime ( ) ; long lastPeriodEnd = _nextPeriodEnd ; _nex...
Called from rollover worker
16,223
private void openLog ( ) { closeLogStream ( ) ; WriteStream os = _os ; _os = null ; IoUtil . close ( os ) ; Path path = getPath ( ) ; if ( path == null ) { path = getPath ( CurrentTime . currentTime ( ) ) ; } Path parent = path . getParent ( ) ; try { if ( ! Files . isDirectory ( parent ) ) { Files . createDirectory ( ...
Tries to open the log . Called from inside _logLock
16,224
private void removeOldLogs ( ) { try { Path path = getPath ( ) ; Path parent = path . getParent ( ) ; ArrayList < String > matchList = new ArrayList < String > ( ) ; Pattern archiveRegexp = getArchiveRegexp ( ) ; Files . list ( parent ) . forEach ( child -> { String subPath = child . getFileName ( ) . toString ( ) ; Ma...
Removes logs passing the rollover count .
16,225
protected Path getPath ( long time ) { String formatString = getPathFormat ( ) ; if ( formatString == null ) throw new IllegalStateException ( L . l ( "getPath requires a format path" ) ) ; String pathString = getFormatName ( formatString , time ) ; return getPwd ( ) . resolve ( pathString ) ; }
Returns the path of the format file
16,226
public void close ( ) throws IOException { _isClosed = true ; _rolloverWorker . wake ( ) ; _rolloverWorker . close ( ) ; synchronized ( _logLock ) { closeLogStream ( ) ; } Alarm alarm = _rolloverAlarm ; _rolloverAlarm = null ; if ( alarm != null ) alarm . dequeue ( ) ; }
Closes the log flushing the results .
16,227
private void closeLogStream ( ) { try { WriteStream os = _os ; _os = null ; if ( os != null ) os . close ( ) ; } catch ( Throwable e ) { } try { WriteStream zipOut = _zipOut ; _zipOut = null ; if ( zipOut != null ) zipOut . close ( ) ; } catch ( Throwable e ) { } }
Tries to close the log .
16,228
public ApplicationSummary getApplication ( String brooklynId ) throws IOException { Invocation invocation = getJerseyClient ( ) . target ( getEndpoint ( ) + "/v1/applications/" + brooklynId ) . request ( ) . buildGet ( ) ; return invocation . invoke ( ) . readEntity ( ApplicationSummary . class ) ; }
Creates proxied HTTP GET request to Apache Brooklyn which returns the details about a particular hosted application
16,229
public JsonNode getApplicationsTree ( ) throws IOException { Invocation invocation = getJerseyClient ( ) . target ( getEndpoint ( ) + "/v1/applications/fetch" ) . request ( ) . buildGet ( ) ; return invocation . invoke ( ) . readEntity ( JsonNode . class ) ; }
Creates proxied HTTP GET request to Apache Brooklyn which returns the whole applications tree
16,230
public TaskSummary removeApplication ( String brooklynId ) throws IOException { Invocation invocation = getJerseyClient ( ) . target ( getEndpoint ( ) + "/v1/applications/" + brooklynId ) . request ( ) . buildDelete ( ) ; return invocation . invoke ( ) . readEntity ( TaskSummary . class ) ; }
Creates a proxied HTTP DELETE request to Apache Brooklyn to remove an application
16,231
public TaskSummary deployApplication ( String tosca ) throws IOException { Entity content = Entity . entity ( tosca , "application/x-yaml" ) ; Invocation invocation = getJerseyClient ( ) . target ( getEndpoint ( ) + "/v1/applications" ) . request ( ) . buildPost ( content ) ; return invocation . invoke ( ) . readEntity...
Creates a proxied HTTP POST request to Apache Brooklyn to deploy a new application
16,232
public List < EntitySummary > getEntitiesFromApplication ( String brooklynId ) throws IOException { Invocation invocation = getJerseyClient ( ) . target ( getEndpoint ( ) + "/v1/applications/" + brooklynId + "/entities" ) . request ( ) . buildGet ( ) ; return invocation . invoke ( ) . readEntity ( new GenericType < Lis...
Creates a proxied HTTP GET request to Apache Brooklyn to retrieve the Application s Entities
16,233
public PathImpl get ( String scheme ) { ConcurrentHashMap < String , SchemeRoot > map = getMap ( ) ; SchemeRoot root = map . get ( scheme ) ; if ( root == null ) { PathImpl rootPath = createLazyScheme ( scheme ) ; if ( rootPath != null ) { map . putIfAbsent ( scheme , new SchemeRoot ( rootPath ) ) ; root = map . get ( ...
Gets the scheme from the schemeMap .
16,234
public PathImpl remove ( String scheme ) { SchemeRoot oldRoot = getUpdateMap ( ) . remove ( scheme ) ; return oldRoot != null ? oldRoot . getRoot ( ) : null ; }
Removes value from the schemeMap .
16,235
public int export ( ConstantPool target ) { int entryIndex = _entry . export ( target ) ; return target . addMethodHandle ( _type , target . getEntry ( entryIndex ) ) . getIndex ( ) ; }
Exports to the target pool .
16,236
protected void initHttpSystem ( SystemManager system , ServerBartender selfServer ) throws IOException { String clusterId = selfServer . getClusterId ( ) ; String serverHeader = config ( ) . get ( "server.header" ) ; if ( serverHeader != null ) { } else if ( ! CurrentTime . isTest ( ) ) { serverHeader = getProgramName ...
Configures the selected server from the boot config .
16,237
public boolean isModified ( ) { if ( _isDigestModified ) { if ( log . isLoggable ( Level . FINE ) ) log . fine ( _source . getNativePath ( ) + " digest is modified." ) ; return true ; } long sourceLastModified = _source . getLastModified ( ) ; long sourceLength = _source . length ( ) ; if ( ! _requireSource && sourceLa...
If the source modified date changes at all treat it as a modification . This protects against the case where multiple computers have misaligned dates and a < comparison may fail .
16,238
public boolean logModified ( Logger log ) { if ( _isDigestModified ) { log . info ( _source . getNativePath ( ) + " digest is modified." ) ; return true ; } long sourceLastModified = _source . getLastModified ( ) ; long sourceLength = _source . length ( ) ; if ( ! _requireSource && sourceLastModified == 0 ) { return fa...
Log the reason for modification
16,239
public static BaseType createGenericClass ( Class < ? > type ) { TypeVariable < ? > [ ] typeParam = type . getTypeParameters ( ) ; if ( typeParam == null || typeParam . length == 0 ) return ClassType . create ( type ) ; BaseType [ ] args = new BaseType [ typeParam . length ] ; HashMap < String , BaseType > newParamMap ...
Create a class - based type where any parameters are filled with the variables not Object .
16,240
public int read ( byte [ ] buf , int offset , int length ) throws IOException { if ( buf == null ) throw new NullPointerException ( ) ; else if ( offset < 0 || buf . length < offset + length ) throw new ArrayIndexOutOfBoundsException ( ) ; int result = nativeRead ( _fd , buf , offset , length ) ; if ( result > 0 ) _pos...
Reads data from the file .
16,241
public boolean lock ( boolean shared , boolean block ) { if ( shared && ! _canRead ) { return false ; } if ( ! shared && ! _canWrite ) { return false ; } return true ; }
Implement LockableStream as a no - op but maintain compatibility with FileWriteStream and FileReadStream wrt returning false to indicate error case .
16,242
public String getFullName ( ) { StringBuilder name = new StringBuilder ( ) ; name . append ( getName ( ) ) ; name . append ( "(" ) ; JClass [ ] params = getParameterTypes ( ) ; for ( int i = 0 ; i < params . length ; i ++ ) { if ( i != 0 ) name . append ( ", " ) ; name . append ( params [ i ] . getShortName ( ) ) ; } n...
Returns a full method name with arguments .
16,243
public void afterBatch ( ) { if ( _isGc ) { return ; } long gcSequence = _gcSequence ; _gcSequence = 0 ; if ( gcSequence <= 0 ) { return ; } try { ArrayList < SegmentHeaderGc > collectList = findCollectList ( gcSequence ) ; if ( collectList . size ( ) < _table . database ( ) . getGcMinCollect ( ) ) { return ; } _gcGene...
GC executes in
16,244
public URL copyWithDevice ( String deviceAddress , String attrName , String attrValue ) { return new URL ( this . protocol , this . adapterAddress , deviceAddress , Collections . singletonMap ( attrName , attrValue ) , this . serviceUUID , this . characteristicUUID , this . fieldName ) ; }
Makes a copy of a given URL with a new device name and a single attribute .
16,245
public URL getDeviceURL ( ) { return new URL ( this . protocol , this . adapterAddress , this . deviceAddress , this . deviceAttributes , null , null , null ) ; }
Returns a copy of a given URL truncated to its device component . Service characteristic and field components will be null .
16,246
public URL getServiceURL ( ) { return new URL ( this . protocol , this . adapterAddress , this . deviceAddress , this . deviceAttributes , this . serviceUUID , null , null ) ; }
Returns a copy of a given URL truncated to its service component . Characteristic and field components will be null .
16,247
public URL getCharacteristicURL ( ) { return new URL ( this . protocol , this . adapterAddress , this . deviceAddress , this . deviceAttributes , this . serviceUUID , this . characteristicUUID , null ) ; }
Returns a copy of a given URL truncated to its characteristic component . The field component will be null .
16,248
public URL getParent ( ) { if ( isField ( ) ) { return getCharacteristicURL ( ) ; } else if ( isCharacteristic ( ) ) { return getServiceURL ( ) ; } else if ( isService ( ) ) { return getDeviceURL ( ) ; } else if ( isDevice ( ) ) { return getAdapterURL ( ) ; } else if ( isAdapter ( ) ) { return getProtocolURL ( ) ; } el...
Returns a new URL representing its parent component .
16,249
public boolean isDescendant ( URL url ) { if ( url . protocol != null && protocol != null && ! protocol . equals ( url . protocol ) ) { return false ; } if ( adapterAddress != null && url . adapterAddress == null ) { return true ; } if ( adapterAddress != null && ! adapterAddress . equals ( url . adapterAddress ) ) { r...
Checks whether the URL is a descendant of a URL provided as an argument . If the provided URL does not specify protocol then it will match any protocol of the URL
16,250
public Object putValue ( String key , Object value ) { return _valueMap . put ( key , value ) ; }
Sets a value .
16,251
static JavaAnnotation [ ] parseAnnotations ( InputStream is , ConstantPool cp , JavaClassLoader loader ) throws IOException { int n = readShort ( is ) ; JavaAnnotation [ ] annArray = new JavaAnnotation [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { annArray [ i ] = parseAnnotation ( is , cp , loader ) ; } return annArray ;...
Parses the annotation from an annotation block .
16,252
public void run ( ) { try { handleAlarm ( ) ; } catch ( Throwable e ) { log . log ( Level . WARNING , e . toString ( ) , e ) ; } finally { _isRunning = false ; _runningAlarmCount . decrementAndGet ( ) ; } }
Runs the alarm . This is only called from the worker thread .
16,253
private void handleAlarm ( ) { AlarmListener listener = getListener ( ) ; if ( listener == null ) { return ; } Thread thread = Thread . currentThread ( ) ; ClassLoader loader = getContextLoader ( ) ; if ( loader != null ) { thread . setContextClassLoader ( loader ) ; } else { thread . setContextClassLoader ( _systemLoa...
Handles the alarm .
16,254
private IDomain createDomainIfNotExist ( String domainId ) { IDomain foundDomain = findDomainByID ( domainId ) ; if ( foundDomain == null ) { foundDomain = user . createDomain ( domainName ) ; } return foundDomain ; }
This method checks if the domain exists for the user . If the domain was not found it will be created using the domainId .
16,255
protected void configureEnv ( ) { Map < String , String > envs = getEntity ( ) . getConfig ( OpenShiftWebApp . ENV ) ; if ( ( envs != null ) && ( envs . size ( ) != 0 ) ) { deployedApp . addEnvironmentVariables ( envs ) ; deployedApp . restart ( ) ; } }
Add the env tot he application
16,256
public void shutdown ( DeployService2Impl < I > deploy , ShutdownModeAmp mode , Result < Boolean > result ) { deploy . shutdownImpl ( mode , result ) ; }
Stops the instance from an admin command .
16,257
public JavaClass readFromClassPath ( String classFile ) throws IOException { Thread thread = Thread . currentThread ( ) ; ClassLoader loader = thread . getContextClassLoader ( ) ; InputStream is = loader . getResourceAsStream ( classFile ) ; try { return parse ( is ) ; } finally { is . close ( ) ; } }
Reads the class from the classpath .
16,258
private void updateLocalRepository ( ) throws GitAPIException { try { Git . open ( new File ( paasifyRepositoryDirecory ) ) . pull ( ) . call ( ) ; } catch ( IOException e ) { log . error ( "Cannot update local Git repository" ) ; log . error ( e . getMessage ( ) ) ; } }
Updates local Paasify repository
16,259
private Offering getOfferingFromJSON ( JSONObject obj ) throws IOException { JSONArray infrastructures = ( JSONArray ) obj . get ( "infrastructures" ) ; String name = ( String ) obj . get ( "name" ) ; Offering offering = null ; if ( infrastructures == null || infrastructures . size ( ) == 0 ) { String providerName = Of...
Conversion from Paasify JSON model into TOSCA PaaS model
16,260
public int acceptInitialRead ( byte [ ] buffer , int offset , int length ) { synchronized ( _readLock ) { int result = nativeAcceptInit ( _socketFd , _localAddrBuffer , _remoteAddrBuffer , buffer , offset , length ) ; return result ; } }
Initialize new connection from the socket .
16,261
public String getRemoteHost ( ) { if ( _remoteName == null ) { byte [ ] remoteAddrBuffer = _remoteAddrBuffer ; char [ ] remoteAddrCharBuffer = _remoteAddrCharBuffer ; if ( _remoteAddrLength <= 0 ) { _remoteAddrLength = InetAddressUtil . createIpAddress ( remoteAddrBuffer , remoteAddrCharBuffer ) ; } _remoteName = new S...
Returns the remote client s host name .
16,262
public String getLocalHost ( ) { if ( _localName == null ) { byte [ ] localAddrBuffer = _localAddrBuffer ; char [ ] localAddrCharBuffer = _localAddrCharBuffer ; if ( _localAddrLength <= 0 ) { _localAddrLength = InetAddressUtil . createIpAddress ( localAddrBuffer , localAddrCharBuffer ) ; } _localName = new String ( loc...
Returns the local server s host name .
16,263
public int read ( byte [ ] buffer , int offset , int length , long timeout ) throws IOException { if ( length == 0 ) { throw new IllegalArgumentException ( ) ; } long requestExpireTime = _requestExpireTime ; if ( requestExpireTime > 0 && requestExpireTime < CurrentTime . currentTime ( ) ) { close ( ) ; throw new Client...
Reads from the socket .
16,264
public int write ( byte [ ] buffer , int offset , int length , boolean isEnd ) throws IOException { int result ; long requestExpireTime = _requestExpireTime ; if ( requestExpireTime > 0 && requestExpireTime < CurrentTime . currentTime ( ) ) { close ( ) ; throw new ClientDisconnectException ( L . l ( "{0}: request-timeo...
Writes to the socket .
16,265
public StreamImpl stream ( ) throws IOException { if ( _stream == null ) { _stream = new JniStream ( this ) ; } _stream . init ( ) ; return _stream ; }
Returns a stream impl for the socket encapsulating the input and output stream .
16,266
private boolean onLoad ( Cursor cursor , T entity ) { if ( cursor == null ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( L . l ( "{0} load returned null" , _entityInfo ) ) ; } _entityInfo . loadFail ( entity ) ; return false ; } else { _entityInfo . load ( cursor , entity ) ; if ( log . isLoggable ( Le...
Fills the entity on load complete .
16,267
public void findOne ( String sql , Object [ ] params , Result < Cursor > result ) { _db . findOne ( sql , result , params ) ; }
Finds a single value returning a cursor .
16,268
public void findAll ( String sql , Object [ ] params , Result < Iterable < Cursor > > result ) { _db . findAll ( sql , result , params ) ; }
Finds a list of values returning a list of cursors
16,269
public < V > Function < Cursor , V > cursorToBean ( Class < V > api ) { return ( FindDataVault < ID , T , V > ) _valueBeans . get ( api ) ; }
Extract a bean from a cursor .
16,270
public static TempCharBuffer allocate ( ) { TempCharBuffer next = _freeList . allocate ( ) ; if ( next == null ) return new TempCharBuffer ( SIZE ) ; next . _next = null ; next . _offset = 0 ; next . _length = 0 ; next . _bufferCount = 0 ; return next ; }
Allocate a TempCharBuffer reusing one if available .
16,271
public static void free ( TempCharBuffer buf ) { buf . _next = null ; if ( buf . _buf . length == SIZE ) _freeList . free ( buf ) ; }
Frees a single buffer .
16,272
public void log ( int level , String message ) { switch ( level ) { case LogChute . WARN_ID : log . warn ( message ) ; break ; case LogChute . INFO_ID : log . info ( message ) ; break ; case LogChute . TRACE_ID : log . trace ( message ) ; break ; case LogChute . ERROR_ID : log . error ( message ) ; break ; case LogChut...
Send a log message from Velocity .
16,273
public boolean isLevelEnabled ( int level ) { switch ( level ) { case LogChute . DEBUG_ID : return log . isDebugEnabled ( ) ; case LogChute . INFO_ID : return log . isInfoEnabled ( ) ; case LogChute . TRACE_ID : return log . isTraceEnabled ( ) ; case LogChute . WARN_ID : return log . isWarnEnabled ( ) ; case LogChute ....
Checks whether the specified log level is enabled .
16,274
public void onPut ( byte [ ] key , TypePut type ) { WatchKey watchKey = new WatchKey ( key ) ; switch ( type ) { case LOCAL : ArrayList < WatchEntry > listLocal = _entryMapLocal . get ( watchKey ) ; onPut ( listLocal , key ) ; break ; case REMOTE : { int hash = _table . getPodHash ( key ) ; TablePodNodeAmp node = _tabl...
Notification on a table put .
16,275
private void onPut ( ArrayList < WatchEntry > list , byte [ ] key ) { if ( list != null ) { int size = list . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { WatchEntry entry = list . get ( i ) ; RowCursor rowCursor = _table . cursor ( ) ; rowCursor . setKey ( key , 0 ) ; EnvKelp envKelp = null ; CursorKraken cursor =...
Notify all watches with the updated row for the given key .
16,276
public long skip ( long n ) throws IOException { if ( _is == null ) { if ( _s == null ) return - 1 ; _is = _s . getInputStream ( ) ; } return _is . skip ( n ) ; }
Skips bytes in the file .
16,277
public int getAvailable ( ) throws IOException { if ( _is == null ) { if ( _s == null ) return - 1 ; _is = _s . getInputStream ( ) ; } return _is . available ( ) ; }
Returns the number of bytes available to be read from the input stream .
16,278
public void flush ( ) throws IOException { if ( _os == null || ! _needsFlush ) return ; _needsFlush = false ; try { _os . flush ( ) ; } catch ( IOException e ) { try { close ( ) ; } catch ( IOException e1 ) { } throw ClientDisconnectException . create ( e ) ; } }
Flushes the socket .
16,279
public int available ( ) throws IOException { if ( _readOffset < _readLength ) { return _readLength - _readOffset ; } StreamImpl source = _source ; if ( source != null ) { return source . getAvailable ( ) ; } else { return - 1 ; } }
Returns an estimate of the available bytes . If a read would not block it will always return greater than 0 .
16,280
public synchronized boolean addLogger ( Logger logger ) { EnvironmentLogger envLogger = addLogger ( logger . getName ( ) , logger . getResourceBundleName ( ) ) ; if ( ! logger . getClass ( ) . equals ( Logger . class ) ) { return envLogger . addCustomLogger ( logger ) ; } return false ; }
Adds a logger .
16,281
private EnvironmentLogger buildParentTree ( String childName ) { if ( childName == null || childName . equals ( "" ) ) return null ; int p = childName . lastIndexOf ( '.' ) ; String parentName ; if ( p > 0 ) parentName = childName . substring ( 0 , p ) ; else parentName = "" ; EnvironmentLogger parent = null ; SoftRefe...
Recursively builds the parents of the logger .
16,282
public synchronized Logger getLogger ( String name ) { SoftReference < EnvironmentLogger > envLoggerRef = _envLoggers . get ( name ) ; EnvironmentLogger envLogger = null ; if ( envLoggerRef != null ) envLogger = envLoggerRef . get ( ) ; if ( envLogger == null ) envLogger = addLogger ( name , null ) ; Logger customLogge...
Returns the named logger .
16,283
public static JavacConfig getLocalConfig ( ) { JavacConfig config ; config = _localJavac . get ( ) ; if ( config != null ) return config ; else return new JavacConfig ( ) ; }
Returns the environment configuration .
16,284
public ArrayList < InetAddress > getLocalAddresses ( ) { synchronized ( _addressCache ) { ArrayList < InetAddress > localAddresses = _addressCache . get ( "addresses" ) ; if ( localAddresses == null ) { localAddresses = new ArrayList < InetAddress > ( ) ; try { for ( NetworkInterfaceBase iface : getNetworkInterfaces ( ...
Returns the InetAddresses for the local machine .
16,285
public byte [ ] getHardwareAddress ( ) { if ( CurrentTime . isTest ( ) || System . getProperty ( "test.mac" ) != null ) { return new byte [ ] { 10 , 0 , 0 , 0 , 0 , 10 } ; } for ( NetworkInterfaceBase nic : getNetworkInterfaces ( ) ) { if ( ! nic . isLoopback ( ) ) { return nic . getHardwareAddress ( ) ; } } try { Inet...
Returns a unique identifying byte array for the server generally the mac address .
16,286
public void waitForExit ( ) throws IOException { Thread thread = Thread . currentThread ( ) ; ClassLoader oldLoader = thread . getContextClassLoader ( ) ; try { thread . setContextClassLoader ( _systemManager . getClassLoader ( ) ) ; _waitForExitService = new WaitForExitService3 ( this , _systemManager ) ; _waitForExit...
Thread to wait until Baratine should be stopped .
16,287
public boolean compareAndPut ( V testValue , K key , V value ) { V result = compareAndPut ( testValue , key , value , true ) ; return testValue == result ; }
Puts a new item in the cache if the current value matches oldValue .
16,288
private void updateLru ( CacheItem < K , V > item ) { long lruCounter = _lruCounter ; long itemCounter = item . _lruCounter ; long delta = ( lruCounter - itemCounter ) & 0x3fffffff ; if ( _lruTimeout < delta || delta < 0 ) { updateLruImpl ( item ) ; } }
Put item at the head of the used - twice lru list . This is always called while synchronized .
16,289
public boolean removeTail ( ) { CacheItem < K , V > tail = null ; if ( _capacity1 <= _size1 ) tail = _tail1 ; if ( tail == null ) { tail = _tail2 ; if ( tail == null ) { tail = _tail1 ; if ( tail == null ) return false ; } } V oldValue = tail . _value ; if ( oldValue instanceof LruListener ) { ( ( LruListener ) oldValu...
Remove the last item in the LRU
16,290
public Iterator < K > keys ( ) { KeyIterator < K , V > iter = new KeyIterator < K , V > ( this ) ; iter . init ( this ) ; return iter ; }
Returns the keys stored in the cache
16,291
public Iterator < K > keys ( Iterator < K > oldIter ) { KeyIterator < K , V > iter = ( KeyIterator < K , V > ) oldIter ; iter . init ( this ) ; return oldIter ; }
Returns keys stored in the cache using an old iterator
16,292
public Iterator < V > values ( ) { ValueIterator < K , V > iter = new ValueIterator < K , V > ( this ) ; iter . init ( this ) ; return iter ; }
Returns the values in the cache
16,293
public void ssl ( SSLFactory sslFactory ) { try { Objects . requireNonNull ( sslFactory ) ; SocketChannel channel = _channel ; Objects . requireNonNull ( channel ) ; _sslSocket = sslFactory . ssl ( channel ) ; _sslSocket . startHandshake ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw new RuntimeExcep...
Initialize the ssl
16,294
public int portRemote ( ) { if ( _channel != null ) { try { SocketAddress addr = _channel . getRemoteAddress ( ) ; return 0 ; } catch ( Exception e ) { e . printStackTrace ( ) ; return 0 ; } } else return 0 ; }
Returns the remote client s port .
16,295
public Map < IGuaranteeTerm , GuaranteeTermEvaluationResult > evaluate ( IAgreement agreement , Map < IGuaranteeTerm , List < IMonitoringMetric > > metricsMap ) { checkInitialized ( false ) ; Map < IGuaranteeTerm , GuaranteeTermEvaluationResult > result = new HashMap < IGuaranteeTerm , GuaranteeTermEvaluationResult > (...
Evaluate if the metrics fulfill the agreement s service levels .
16,296
public Map < IGuaranteeTerm , GuaranteeTermEvaluationResult > evaluateBusiness ( IAgreement agreement , Map < IGuaranteeTerm , List < IViolation > > violationsMap ) { checkInitialized ( false ) ; Map < IGuaranteeTerm , GuaranteeTermEvaluationResult > result = new HashMap < IGuaranteeTerm , GuaranteeTermEvaluationResult...
Evaluate if the detected violations imply any compensation .
16,297
public Auction createAuction ( String userId , long durationMs , long startPrice , String title , String description ) { ResourceManager manager = getResourceManager ( ) ; ServiceRef ref = manager . create ( userId , durationMs , startPrice , title , description ) ; Auction auction = ref . as ( Auction . class ) ; Auct...
private ResourceManager _manager ;
16,298
public void read ( ) { StateInPipe stateOld ; StateInPipe stateNew ; do { stateOld = _stateInRef . get ( ) ; stateNew = stateOld . toActive ( ) ; } while ( ! _stateInRef . compareAndSet ( stateOld , stateNew ) ) ; while ( stateNew . isActive ( ) ) { readPipe ( ) ; wakeOut ( ) ; do { stateOld = _stateInRef . get ( ) ; s...
Reads data from the pipe .
16,299
private void wakeIn ( ) { StateInPipe stateOld ; StateInPipe stateNew ; do { stateOld = _stateInRef . get ( ) ; if ( stateOld . isActive ( ) ) { return ; } stateNew = stateOld . toWake ( ) ; } while ( ! _stateInRef . compareAndSet ( stateOld , stateNew ) ) ; if ( stateOld == StateInPipe . IDLE ) { try ( OutboxAmp outbo...
Notify the reader of available data in the pipe . If the writer is asleep wake it .