idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
139,500 | private void updateHubHeartbeatSelf ( ) { _isHubHeartbeatSelf = true ; if ( _hubHeartbeatCount < 2 ) { for ( Result < Boolean > result : _hubHeartbeatList ) { result . ok ( true ) ; } _hubHeartbeatList . clear ( ) ; } } | If the join is to the self server and there s only one successful join update immediately . |
139,501 | void updateRack ( UpdateRackHeartbeat updateRack ) { ClusterHeartbeat cluster = findCluster ( updateRack . getClusterId ( ) ) ; if ( cluster == null ) { return ; } RackHeartbeat rack ; if ( cluster != _serverSelf . getCluster ( ) ) { rack = cluster . createRack ( "external" ) ; ClusterTarget target = createClusterTarge... | Process an update message for a rack of servers . |
139,502 | private void updateServerStart ( UpdateServerHeartbeat update ) { boolean isSSL = false ; ServerHeartbeat server = _root . createServer ( update . getAddress ( ) , update . getPort ( ) , isSSL , 0 , getCluster ( ) ) ; server . setDisplayName ( update . getDisplayName ( ) ) ; updateServer ( server , update ) ; if ( serv... | Update a server where the update is directly from the peer . |
139,503 | void updateServer ( ServerHeartbeat server , UpdateServerHeartbeat update ) { if ( server . isSelf ( ) ) { return ; } String externalId = update . getExternalId ( ) ; updateExternal ( server , externalId ) ; server . setSeedIndex ( update . getSeedIndex ( ) ) ; if ( server . onHeartbeatUpdate ( update ) ) { if ( server... | Update a server with a heartbeat update . |
139,504 | private void updateExternal ( ServerHeartbeat server , String externalId ) { if ( externalId != null ) { ServerHeartbeat serverExternal = _root . getServer ( externalId ) ; server . setExternalServer ( serverExternal ) ; } else { server . setExternalServer ( null ) ; } } | Update the external server delegation . |
139,505 | private void onServerLinkClose ( String hostName ) { ServerHeartbeat server = _root . getServer ( hostName ) ; if ( server == null ) { return ; } if ( ! isHub ( server ) && ! isHub ( _serverSelf ) ) { return ; } if ( server . onHeartbeatStop ( ) ) { onServerStop ( server ) ; if ( server . getRack ( ) != null ) { server... | The peer server is now down . |
139,506 | private boolean isHub ( ServerBartender server ) { int upCount = 0 ; for ( ServerHeartbeat rackServer : _rack . getServers ( ) ) { if ( rackServer == null || ! rackServer . isUp ( ) ) { continue ; } if ( rackServer == server && upCount < _hubCount ) { return true ; } upCount ++ ; if ( _hubCount <= upCount ) { return fa... | Test if the server is a hub server for its rack . |
139,507 | private void sendHubHeartbeats ( ) { RackHeartbeat rack = _rack ; UpdateRackHeartbeat updateRack = rack . getUpdate ( ) ; UpdatePodSystem updatePod = getUpdatePodSystem ( ) ; long now = CurrentTime . currentTime ( ) ; if ( ! isJoinComplete ( ) ) { updatePod = null ; } for ( ServerHeartbeat rackServer : _rack . getServe... | Sends full heartbeat messages to all targets . Hub heartbeat messages contains all the servers in the hub and all the pods known to the hub server . |
139,508 | private void sendSpokeHeartbeats ( ) { for ( ServerTarget target : _targets ) { ServerHeartbeat server = target . getServer ( ) ; if ( server . getRack ( ) != _rack ) { continue ; } if ( isHub ( server ) ) { target . sendServerHeartbeat ( getServerSelf ( ) . getUpdate ( ) ) ; } } } | Sends a server status message to the hub servers . The server message contains the status for the current server . |
139,509 | public static boolean isAvailable ( ) { try { return create ( ) != null ; } catch ( Exception e ) { log . log ( Level . FINEST , e . toString ( ) , e ) ; return false ; } } | Checks if the heap is available |
139,510 | public void cleanup ( ) { state = null ; if ( headerBuffer != null ) { bufferPool . deallocate ( headerBuffer ) ; } if ( dataBuffer != null ) { bufferPool . deallocate ( dataBuffer ) ; } } | De - allocates all buffers . This method should be called iff the reader isn t used anymore i . e . when its connection is severed . |
139,511 | void clusterHeartbeat ( String clusterId , UpdateServerHeartbeat updateSelf , UpdateRackHeartbeat updateRack , UpdatePodSystem updatePod , long sequence ) { if ( startUpdate ( updateRack , updatePod ) ) { getHeartbeat ( ) . clusterHeartbeat ( clusterId , updateSelf , updateRack , updatePod , sequence ) ; } } | Sends a cluster heartbeat message if the update has changed or it s time for a periodic heartbeat . |
139,512 | void hubHeartbeat ( UpdateServerHeartbeat updateServer , UpdateRackHeartbeat updateRack , UpdatePodSystem updatePod , long sequence ) { if ( startUpdate ( updateRack , updatePod ) ) { getHeartbeat ( ) . hubHeartbeat ( updateServer , updateRack , updatePod , sequence ) ; } } | Sends a hub heartbeat message if the update has changed or it s time for a periodic heartbeat . |
139,513 | private boolean startUpdate ( UpdateRackHeartbeat updateRack , UpdatePodSystem updatePod ) { long now = CurrentTime . currentTime ( ) ; if ( _lastHubTime + getTimeout ( ) < now ) { } else if ( _lastRackCrc != updateRack . getCrc ( ) ) { } else if ( updatePod != null && _lastPodCrc != updatePod . getCrc ( ) ) { } else {... | Only send updates on changes or timeouts . |
139,514 | public int owner ( int hash ) { NodePodAmp delegate = delegate ( ) ; if ( delegate != null ) { return delegate ( ) . owner ( hash ) ; } else { return 0 ; } } | The owner index for the node . |
139,515 | public void run ( ) { try { while ( ! isClosed ( ) && _is . read ( ) > 0 && _in . readMessage ( _is ) ) { ServiceRef . flushOutbox ( ) ; } } catch ( EOFException e ) { log . finer ( this + " end of file" ) ; if ( log . isLoggable ( Level . ALL ) ) { log . log ( Level . ALL , e . toString ( ) , e ) ; } } catch ( SocketE... | Receive messages from the client |
139,516 | protected CharSequence getHost ( ) { if ( _host != null ) return _host ; if ( _uriHost . length ( ) > 0 ) { _host = _uriHost ; } else if ( ( _host = getForwardedHostHeader ( ) ) != null ) { } else { _host = getHostHeader ( ) ; } return _host ; } | Returns the virtual host of the request |
139,517 | private CharSequence hostInvocation ( ) throws IOException { if ( _host != null ) { } else if ( _uriHost . length ( ) > 0 ) { _host = _uriHost ; } else if ( ( _host = getForwardedHostHeader ( ) ) != null ) { } else if ( ( _host = getHostHeader ( ) ) != null ) { } else if ( HTTP_1_1 <= version ( ) ) { throw new BadReque... | Returns the virtual host from the invocation |
139,518 | public String header ( String key ) { CharSegment buf = getHeaderBuffer ( key ) ; if ( buf != null ) return buf . toString ( ) ; else return null ; } | Returns the header . |
139,519 | public CharSegment getHeaderBuffer ( char [ ] testBuf , int length ) { char [ ] keyBuf = _headerBuffer ; CharSegment [ ] headerKeys = _headerKeys ; char [ ] toLowerAscii = _toLowerAscii ; for ( int i = _headerSize - 1 ; i >= 0 ; i -- ) { CharSegment key = headerKeys [ i ] ; if ( key . length ( ) != length ) continue ; ... | Returns the matching header . |
139,520 | public CharSegment getHeaderBuffer ( String key ) { int i = matchNextHeader ( 0 , key ) ; if ( i >= 0 ) { return _headerValues [ i ] ; } else { return null ; } } | Returns the header value for the key returned as a CharSegment . |
139,521 | public void getHeaderBuffers ( String key , ArrayList < CharSegment > values ) { int i = - 1 ; while ( ( i = matchNextHeader ( i + 1 , key ) ) >= 0 ) { values . add ( _headerValues [ i ] ) ; } } | Fills an ArrayList with the header values matching the key . |
139,522 | public Enumeration < String > getHeaders ( String key ) { ArrayList < String > values = new ArrayList < String > ( ) ; int i = - 1 ; while ( ( i = matchNextHeader ( i + 1 , key ) ) >= 0 ) { values . add ( _headerValues [ i ] . toString ( ) ) ; } return Collections . enumeration ( values ) ; } | Return an enumeration of headers matching a key . |
139,523 | private int matchNextHeader ( int i , String key ) { int size = _headerSize ; int length = key . length ( ) ; char [ ] keyBuf = _headerBuffer ; char [ ] toLowerAscii = _toLowerAscii ; for ( ; i < size ; i ++ ) { CharSegment header = _headerKeys [ i ] ; if ( header . length ( ) != length ) continue ; int offset = header... | Returns the index of the next header matching the key . |
139,524 | public void setHeader ( String key , String value ) { int tail ; if ( _headerSize > 0 ) { tail = ( _headerValues [ _headerSize - 1 ] . offset ( ) + _headerValues [ _headerSize - 1 ] . length ( ) ) ; } else { tail = 0 ; } int keyLength = key . length ( ) ; int valueLength = value . length ( ) ; char [ ] headerBuffer = _... | Adds a new header . Used only by the caching to simulate If - Modified - Since . |
139,525 | private boolean parseRequest ( ) throws IOException { try { ReadStream is = connTcp ( ) . readStream ( ) ; if ( ! readRequest ( is ) ) { clearRequest ( ) ; return false ; } _sequence = connHttp ( ) . nextSequenceRead ( ) ; if ( log . isLoggable ( Level . FINE ) ) { log . fine ( _method + " " + new String ( _uri , 0 , _... | Parses a http request . |
139,526 | protected void initRequest ( ) { super . initRequest ( ) ; _state = _state . toActive ( ) ; HttpBufferStore bufferStore = getHttpBufferStore ( ) ; _method . clear ( ) ; _methodString = null ; _protocol . clear ( ) ; _uriLength = 0 ; if ( bufferStore == null ) { _uri = getSmallUriBuffer ( ) ; _headerBuffer = getSmallHea... | Clear the request variables in preparation for a new request . |
139,527 | public void onTimeout ( ) { try { if ( true ) throw new UnsupportedOperationException ( ) ; } catch ( Exception e ) { log . log ( Level . FINEST , e . toString ( ) , e ) ; } closeResponse ( ) ; } | Handles a timeout . |
139,528 | @ Path ( "{uuid}" ) public Penalty getPenaltyByUuid ( @ PathParam ( "uuid" ) UUID uuid ) { logger . debug ( "StartOf getPenaltyByUuid - REQUEST for /penalties/{}" , uuid ) ; PenaltyHelperE penaltyRestHelper = getPenaltyHelper ( ) ; Penalty result = penaltyRestHelper . getPenaltyByUuid ( uuid ) ; logger . debug ( "EndOf... | Returns the information of an specific penalty given an uuid . |
139,529 | public List < Penalty > getPenalties ( @ QueryParam ( "agreementId" ) String agreementId , @ QueryParam ( "guaranteeTerm" ) String guaranteeTerm , @ QueryParam ( "begin" ) DateParam begin , @ QueryParam ( "end" ) DateParam end ) throws InternalException { logger . debug ( "StartOf getPenalties REQUEST for /penalties/?... | Search penalties given several query terms . |
139,530 | public final ClientSocketFactory getLoadBalanceSocketPool ( ) { ClientSocketFactory factory = getLoadBalanceSocketFactory ( ) ; if ( factory == null ) return null ; if ( _serverBartender . getState ( ) . isDisableSoft ( ) ) { factory . enableSessionOnly ( ) ; } else if ( _serverBartender . getState ( ) . isDisabled ( )... | Returns the socket pool as a load - balancer . |
139,531 | boolean onHeartbeatStop ( ) { SocketPool clusterSocketPool ; if ( isExternal ( ) ) { clusterSocketPool = _clusterSocketPool . getAndSet ( null ) ; } else { clusterSocketPool = _clusterSocketPool . get ( ) ; } if ( clusterSocketPool != null ) { clusterSocketPool . getFactory ( ) . notifyHeartbeatStop ( ) ; } log . fine ... | Notify that a stop event has been received . |
139,532 | public void close ( ) { SocketPool loadBalancePool = _loadBalanceSocketPool . get ( ) ; if ( loadBalancePool != null ) loadBalancePool . getFactory ( ) . close ( ) ; SocketPool clusterPool = _clusterSocketPool . get ( ) ; if ( clusterPool != null ) clusterPool . getFactory ( ) . close ( ) ; } | Close any ports . |
139,533 | public void schema ( Class < ? > type ) { Objects . requireNonNull ( type ) ; _context . schema ( type ) ; } | Adds a predefined schema |
139,534 | public static long getRandomLong ( ) { Random random = getRandom ( ) ; long value = random . nextLong ( ) ; if ( ! _isTest ) { _freeRandomList . free ( random ) ; } return value ; } | Returns the next random long . |
139,535 | public static int nextInt ( int n ) { Random random = getRandom ( ) ; int value = random . nextInt ( n ) ; if ( ! _isTest ) _freeRandomList . free ( random ) ; return value ; } | Returns the next random int . |
139,536 | public static double nextDouble ( ) { Random random = getRandom ( ) ; double value = random . nextDouble ( ) ; if ( ! _isTest ) _freeRandomList . free ( random ) ; return value ; } | Returns the next random double between 0 and 1 |
139,537 | public static Random getRandom ( ) { if ( _isTest ) { return _testRandom ; } Random random = _freeRandomList . allocate ( ) ; if ( random == null ) { random = new SecureRandom ( ) ; } return random ; } | Returns the random generator . |
139,538 | public void writeChunk ( long length , boolean isFinal ) { long chunk ; if ( isFinal ) { chunk = length << 1 ; } else { chunk = ( length << 1 ) + 1 ; } writeUnsigned ( chunk ) ; } | chunked header . LSB |
139,539 | public void writeStringData ( String value , int offset , int length ) { char [ ] cBuf = _charBuffer ; int cBufLength = cBuf . length ; for ( int i = 0 ; i < length ; i += cBufLength ) { int sublen = Math . min ( length - i , cBufLength ) ; value . getChars ( offset + i , offset + i + sublen , cBuf , 0 ) ; writeStringC... | string data without length |
139,540 | public void writeBinaryData ( byte [ ] sBuf , int sOffset , int sLength ) { byte [ ] tBuf = _buffer ; int tOffset = _offset ; int tLength = tBuf . length ; int end = sOffset + sLength ; while ( sOffset < end ) { if ( tLength - tOffset < 1 ) { tOffset = flush ( tOffset ) ; } int sublen = Math . min ( tLength - tOffset ,... | binary data without type or length |
139,541 | private void require ( int len ) { int offset = _offset ; int length = _length ; if ( offset + len < length ) { return ; } flush ( _offset ) ; } | Require empty space in the output buffer . |
139,542 | private int flush ( int offset ) { try { _os . write ( _buffer , 0 , offset ) ; _offset = 0 ; return 0 ; } catch ( IOException e ) { throw new H3ExceptionOut ( e ) ; } } | Flush the buffer and set the offset to zero . |
139,543 | public void writeRef ( int ref ) { require ( 1 ) ; _buffer [ _offset ++ ] = ( byte ) ConstH3 . REF ; writeUnsigned ( ref ) ; } | write graph reference |
139,544 | public final PathImpl lookup ( URL url ) { String name = URLDecoder . decode ( url . toString ( ) ) ; return lookup ( name , null ) ; } | Looks up a path by a URL . |
139,545 | public String lookupRelativeNativePath ( PathImpl path ) { String thisNative = getNativePath ( ) ; String pathNative = path . getNativePath ( ) ; if ( pathNative . startsWith ( thisNative ) ) { int i = thisNative . length ( ) ; while ( i < pathNative . length ( ) ) { if ( pathNative . charAt ( i ) != getFileSeparatorCh... | Returns a native path relative to this native path if the passed path is relative to this path or an absolute path if the passed path is not relative to this path . |
139,546 | public ArrayList < PathImpl > getResources ( String name ) { ArrayList < PathImpl > list = new ArrayList < PathImpl > ( ) ; PathImpl path = lookup ( name ) ; if ( path . exists ( ) ) list . add ( path ) ; return list ; } | Looks up all the resources matching a name . ( Generally only useful with MergePath . |
139,547 | public ArrayList < PathImpl > getResources ( ) { ArrayList < PathImpl > list = new ArrayList < PathImpl > ( ) ; list . add ( this ) ; return list ; } | Looks up all the existing resources . ( Generally only useful with MergePath . |
139,548 | protected String scanScheme ( String uri ) { int i = 0 ; if ( uri == null ) return null ; int length = uri . length ( ) ; if ( length == 0 ) return null ; int ch = uri . charAt ( 0 ) ; if ( ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' ) { for ( i = 1 ; i < length ; i ++ ) { ch = uri . charAt ( i ) ; if ( ch == ':' ... | Returns the scheme portion of a uri . Since schemes are case - insensitive normalize them to lower case . |
139,549 | public boolean isWindowsInsecure ( ) { String lower = getPath ( ) . toLowerCase ( Locale . ENGLISH ) ; int lastCh ; if ( ( lastCh = lower . charAt ( lower . length ( ) - 1 ) ) == '.' || lastCh == ' ' || lastCh == '*' || lastCh == '?' || ( ( lastCh == '/' || lastCh == '\\' ) && ! isDirectory ( ) ) || lower . endsWith ( ... | Returns true for windows security issues . |
139,550 | public Iterator < String > iterator ( ) throws IOException { String list [ ] = list ( ) ; if ( list == null ) list = new String [ 0 ] ; return new ArrayIterator ( list ) ; } | Returns a jdk1 . 2 Iterator for the contents of this directory . |
139,551 | public boolean removeAll ( ) throws IOException { if ( isDirectory ( ) && ! isLink ( ) ) { String [ ] list = list ( ) ; for ( int i = 0 ; i < list . length ; i ++ ) { PathImpl subpath = lookup ( list [ i ] ) ; subpath . removeAll ( ) ; } } return remove ( ) ; } | Removes the all files and directories below this path . |
139,552 | public boolean createNewFile ( ) throws IOException { synchronized ( LOCK ) { if ( ! exists ( ) ) { clearStatusCache ( ) ; WriteStreamOld s = openWrite ( ) ; s . close ( ) ; return true ; } } return false ; } | Creates the file named by this Path and returns true if the file is new . |
139,553 | public long getCrc64 ( ) { try { if ( isDirectory ( ) ) { String [ ] list = list ( ) ; long digest = 0x1 ; for ( int i = 0 ; i < list . length ; i ++ ) { digest = Crc64 . generate ( digest , list [ i ] ) ; } return digest ; } else if ( canRead ( ) ) { ReadStreamOld is = openRead ( ) ; try { long digest = 0x1 ; byte [ ]... | Returns the crc64 code . |
139,554 | void put ( RowCursor cursor ) { boolean isValid ; do { isValid = true ; try ( JournalOutputStream os = openItem ( ) ) { os . write ( CODE_PUT ) ; cursor . writeJournal ( os ) ; isValid = os . complete ( ) ; } catch ( IOException e ) { log . log ( Level . FINER , e . toString ( ) , e ) ; } } while ( ! isValid ) ; } | Writes the put to the journal . |
139,555 | void remove ( RowCursor cursor ) { boolean isValid ; do { isValid = true ; try ( JournalOutputStream os = openItem ( ) ) { os . write ( CODE_REMOVE ) ; cursor . getKey ( _buffer , 0 ) ; os . write ( _buffer , 0 , getKeyLength ( ) ) ; try { BitsUtil . writeLong ( os , cursor . getVersion ( ) ) ; } catch ( IOException e ... | Writes the remove to the journal . |
139,556 | private MultivaluedMapWrapper < String , IGuaranteeTerm > initTermsMap ( IAgreement agreement ) { MultivaluedMapWrapper < String , IGuaranteeTerm > result = new MultivaluedMapWrapper < String , IGuaranteeTerm > ( ) ; for ( IGuaranteeTerm term : agreement . getGuaranteeTerms ( ) ) { String variable = constraintEvaluator... | Inits a MultivaluedMap with metrickey as key and the terms that evaluate the metrickey as values . |
139,557 | public boolean accept ( SocketBar socket ) throws IOException { JniSocketImpl jniSocket = ( JniSocketImpl ) socket ; if ( _fd == 0 ) throw new IOException ( "accept from closed socket" ) ; return jniSocket . accept ( this , _fd , _socketTimeout ) ; } | Accepts a new connection from the socket . |
139,558 | public void setIdleMax ( int idleMax ) { if ( idleMax <= _idleMin ) { throw new IllegalArgumentException ( L . l ( "idle-max '{0}' must be greater than idle-min '{1}'." , idleMax , _idleMin ) ) ; } _launcher . setIdleMax ( _idleMax ) ; } | Returns the thread idle max . |
139,559 | public boolean schedule ( Runnable task ) { ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; boolean isPriority = false ; boolean isQueue = true ; boolean isWake = true ; return scheduleImpl ( task , loader , MAX_EXPIRE , isPriority , isQueue , isWake ) ; } | Schedules a new task . |
139,560 | private void wakeThreads ( int count ) { while ( true ) { int taskCount = Math . max ( 0 , _taskCount . get ( ) ) ; int spinIdleCount = _spinIdleCount . get ( ) ; long threadWakeHead = _threadWakeHead . get ( ) ; long threadWakeTail = _threadWakeTail . get ( ) ; long threadCount = spinIdleCount + threadWakeHead - threa... | wake enough threads to process the tasks |
139,561 | public void clearIdleThreads ( ) { _launcher . resetThrottle ( ) ; int idleCount = _idleThreadRing . size ( ) ; ThreadAmp thread ; while ( idleCount -- > 0 && ( thread = _idleThreadRing . poll ( ) ) != null ) { thread . close ( ) ; } } | interrupts all the idle threads . |
139,562 | public void start ( ) { if ( _lifecycle . isActive ( ) ) { return ; } synchronized ( _lifecycle ) { if ( ! _lifecycle . toInit ( ) ) { return ; } init ( _stubMain ) ; } start ( _stubMain ) ; } | Start is called lazily when a service is first used . |
139,563 | private void init ( StubAmp stub ) { OnInitMessage onInitMsg = new OnInitMessage ( this ) ; _queue . offer ( onInitMsg ) ; _queue . wake ( ) ; } | Init calls the |
139,564 | public void shutdown ( ShutdownModeAmp mode ) { if ( ! _lifecycle . toStopping ( ) ) { return ; } _lifecycle . toDestroy ( ) ; OnShutdownMessage shutdownMessage = new OnShutdownMessage ( this , mode , isSingle ( ) ) ; _queue . offer ( shutdownMessage ) ; _queue . wakeAllAndWait ( ) ; shutdownMessage . waitFor ( 1 , Tim... | Closes the inbox |
139,565 | public void setLocalTime ( long time ) { if ( _timeZone != _gmtTimeZone ) { calculateSplit ( time ) ; } else { calculateSplit ( time - _localTimeZone . getRawOffset ( ) ) ; try { long offset = _localTimeZone . getOffset ( GregorianCalendar . AD , ( int ) _year , ( int ) _month , ( int ) _dayOfMonth + 1 , getDayOfWeek (... | Sets the time in milliseconds since the epoch and calculate the internal variables . |
139,566 | public long getLocalTime ( ) { if ( _timeZone != _gmtTimeZone ) { return _localTimeOfEpoch ; } else { long offset = _localTimeZone . getOffset ( GregorianCalendar . AD , ( int ) _year , ( int ) _month , ( int ) _dayOfMonth + 1 , getDayOfWeek ( ) , ( int ) _timeOfDay ) ; return _localTimeOfEpoch + offset ; } } | Returns the time in milliseconds since the epoch . |
139,567 | public void setMonth ( int month ) { if ( month < 0 || DAYS_IN_MONTH . length <= month ) return ; _month = month ; if ( DAYS_IN_MONTH [ month ] <= _dayOfMonth ) _dayOfMonth = DAYS_IN_MONTH [ month ] - 1 ; calculateJoin ( ) ; calculateSplit ( _localTimeOfEpoch ) ; } | Sets the month in the year . |
139,568 | public int getWeek ( ) { int dow4th = ( int ) ( ( _dayOfEpoch - _dayOfYear + 3 ) % 7 + 10 ) % 7 ; int ww1monday = 3 - dow4th ; if ( _dayOfYear < ww1monday ) return 53 ; int week = ( _dayOfYear - ww1monday ) / 7 + 1 ; if ( _dayOfYear >= 360 ) { int days = 365 + ( _isLeapYear ? 1 : 0 ) ; long nextNewYear = ( _dayOfEpoch ... | Returns the week in the year . |
139,569 | public long get ( int field ) { switch ( field ) { case TIME : return getLocalTime ( ) ; case YEAR : return getYear ( ) ; case MONTH : return getMonth ( ) ; case DAY_OF_MONTH : return getDayOfMonth ( ) ; case DAY : return getDayOfWeek ( ) ; case DAY_OF_WEEK : return getDayOfWeek ( ) ; case HOUR : return getHour ( ) ; c... | Gets values based on a field . |
139,570 | public long set ( int field , long value ) { switch ( field ) { case YEAR : setYear ( ( int ) value ) ; break ; case MONTH : setMonth ( ( int ) value ) ; break ; case DAY_OF_MONTH : setDayOfMonth ( ( int ) value ) ; break ; case HOUR : setHour ( ( int ) value ) ; break ; case MINUTE : setMinute ( ( int ) value ) ; brea... | Sets values based on a field . |
139,571 | public void printDate ( WriteStreamOld os ) throws IOException { os . print ( DAY_NAMES [ ( int ) ( _dayOfEpoch % 7 + 11 ) % 7 ] ) ; os . write ( ',' ) ; os . write ( ' ' ) ; os . print ( ( _dayOfMonth + 1 ) / 10 ) ; os . print ( ( _dayOfMonth + 1 ) % 10 ) ; os . write ( ' ' ) ; os . print ( MONTH_NAMES [ ( int ) _mont... | Prints the date to a stream . |
139,572 | public String printISO8601 ( ) { StringBuilder sb = new StringBuilder ( ) ; if ( _year > 0 ) { sb . append ( ( _year / 1000 ) % 10 ) ; sb . append ( ( _year / 100 ) % 10 ) ; sb . append ( ( _year / 10 ) % 10 ) ; sb . append ( _year % 10 ) ; sb . append ( '-' ) ; sb . append ( ( ( _month + 1 ) / 10 ) % 10 ) ; sb . appen... | Prints the time in ISO 8601 |
139,573 | public String printISO8601Date ( ) { CharBuffer cb = new CharBuffer ( ) ; if ( _year > 0 ) { cb . append ( ( _year / 1000 ) % 10 ) ; cb . append ( ( _year / 100 ) % 10 ) ; cb . append ( ( _year / 10 ) % 10 ) ; cb . append ( _year % 10 ) ; cb . append ( '-' ) ; cb . append ( ( ( _month + 1 ) / 10 ) % 10 ) ; cb . append ... | Prints just the date component of ISO 8601 |
139,574 | public synchronized static String formatGMT ( long gmtTime , String format ) { _gmtDate . setGMTTime ( gmtTime ) ; return _gmtDate . format ( new CharBuffer ( ) , format ) . toString ( ) ; } | Formats a date . |
139,575 | public String format ( String format ) { CharBuffer cb = new CharBuffer ( ) ; return format ( cb , format ) . close ( ) ; } | Formats the current date . |
139,576 | private long yearToDayOfEpoch ( long year ) { if ( year > 0 ) { year -= 1601 ; return ( 365 * year + year / 4 - year / 100 + year / 400 - ( ( 1970 - 1601 ) * 365 + ( 1970 - 1601 ) / 4 - 3 ) ) ; } else { year = 2000 - year ; return ( ( 2000 - 1970 ) * 365 + ( 2000 - 1970 ) / 4 - ( 365 * year + year / 4 - year / 100 + ye... | Based on the year return the number of days since the epoch . |
139,577 | private long monthToDayOfYear ( long month , boolean isLeapYear ) { long day = 0 ; for ( int i = 0 ; i < month && i < 12 ; i ++ ) { day += DAYS_IN_MONTH [ i ] ; if ( i == 1 && isLeapYear ) day ++ ; } return day ; } | Calculates the day of the year for the beginning of the month . |
139,578 | public long setDate ( long year , long month , long day ) { year += ( long ) Math . floor ( month / 12.0 ) ; month -= ( long ) 12 * Math . floor ( month / 12.0 ) ; _year = year ; _month = month ; _dayOfMonth = day - 1 ; calculateJoin ( ) ; calculateSplit ( _localTimeOfEpoch ) ; return _localTimeOfEpoch ; } | Sets date in the local time . |
139,579 | private void calculateSplit ( long localTime ) { _localTimeOfEpoch = localTime ; _dayOfEpoch = divFloor ( _localTimeOfEpoch , MS_PER_DAY ) ; _timeOfDay = _localTimeOfEpoch - MS_PER_DAY * _dayOfEpoch ; calculateYear ( ) ; calculateMonth ( ) ; _hour = _timeOfDay / 3600000 ; _minute = _timeOfDay / 60000 % 60 ; _second = _... | Calculate and set the calendar components based on the given time . |
139,580 | private void calculateYear ( ) { long days = _dayOfEpoch ; days += ( 1970 - 1601 ) * 365 + ( 1970 - 1601 ) / 4 - 3 ; long n400 = divFloor ( days , 400 * 365 + 100 - 3 ) ; days -= n400 * ( 400 * 365 + 100 - 3 ) ; long n100 = divFloor ( days , 100 * 365 + 25 - 1 ) ; if ( n100 == 4 ) n100 = 3 ; days -= n100 * ( 100 * 365 ... | Calculates the year the dayOfYear and whether this is a leap year from the current days since the epoch . |
139,581 | private void calculateMonth ( ) { _dayOfMonth = _dayOfYear ; for ( _month = 0 ; _month < 12 ; _month ++ ) { if ( _month == 1 && _isLeapYear ) { if ( _dayOfMonth < 29 ) return ; else _dayOfMonth -= 29 ; } else if ( _dayOfMonth < DAYS_IN_MONTH [ ( int ) _month ] ) return ; else _dayOfMonth -= DAYS_IN_MONTH [ ( int ) _mon... | Calculates the month based on the day of the year . |
139,582 | private long calculateJoin ( ) { _year += divFloor ( _month , 12 ) ; _month -= 12 * divFloor ( _month , 12 ) ; _localTimeOfEpoch = MS_PER_DAY * ( yearToDayOfEpoch ( _year ) + monthToDayOfYear ( _month , isLeapYear ( _year ) ) + _dayOfMonth ) ; _localTimeOfEpoch += _ms + 1000 * ( _second + 60 * ( _minute + 60 * _hour ) ... | Based on the current data calculate the time since the epoch . |
139,583 | public boolean logModified ( Logger log ) { for ( int i = _dependencyList . size ( ) - 1 ; i >= 0 ; i -- ) { Dependency dependency = _dependencyList . get ( i ) ; if ( dependency . logModified ( log ) ) return true ; } return false ; } | Log the reason for the modification |
139,584 | public void getSafe ( RowCursor cursor , Result < Boolean > result ) { result . ok ( getImpl ( cursor ) ) ; } | Non - peek get . |
139,585 | public void getStream ( RowCursor cursor , Result < GetStreamResult > result ) { long version = cursor . getVersion ( ) ; PageLeafImpl leaf = getLeafByCursor ( cursor ) ; if ( leaf == null ) { result . ok ( new GetStreamResult ( false , null ) ) ; return ; } if ( ! leaf . get ( cursor ) ) { result . ok ( new GetStreamR... | For cluster calls returns a stream to the new value if the value has changed . |
139,586 | long getSequenceSize ( SegmentKelp segment ) { int tailPid = _tailPid . get ( ) ; long size = 0 ; for ( int i = 0 ; i <= tailPid ; i ++ ) { Page page = _pages . get ( i ) ; if ( page != null && page . getSegment ( ) == segment ) { size += page . size ( ) ; } } return size ; } | Returns the size in bytes of all pages with the given sequence . |
139,587 | public void checkpoint ( Result < Boolean > result ) { if ( ! _journalStream . saveStart ( ) ) { result . ok ( true ) ; return ; } TableWriterService readWrite = _table . getReadWrite ( ) ; int tailPid = _tailPid . get ( ) ; for ( int pid = 1 ; pid <= tailPid ; pid ++ ) { Page page = _pages . get ( pid ) ; if ( page !=... | Requests a checkpoint flushing the in - memory data to disk . |
139,588 | boolean compareAndSetLeaf ( Page oldPage , Page page ) { if ( oldPage == page ) { return true ; } int pid = ( int ) page . getId ( ) ; updateTailPid ( pid ) ; if ( oldPage instanceof PageLeafImpl && page instanceof PageLeafImpl ) { PageLeafImpl oldLeaf = ( PageLeafImpl ) oldPage ; PageLeafImpl newLeaf = ( PageLeafImpl ... | Updates the leaf to a new page . Called only from TableService . |
139,589 | public static DynamicClassLoader getDynamicClassLoader ( ClassLoader loader ) { for ( ; loader != null ; loader = loader . getParent ( ) ) { if ( loader instanceof DynamicClassLoader ) { return ( DynamicClassLoader ) loader ; } } return null ; } | Returns the topmost dynamic class loader . |
139,590 | public static void setConfigException ( Throwable e ) { ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; for ( ; loader != null ; loader = loader . getParent ( ) ) { if ( loader instanceof EnvironmentClassLoader ) { EnvironmentClassLoader envLoader = ( EnvironmentClassLoader ) loader ; envL... | Sets a configuration exception . |
139,591 | public static Throwable getConfigException ( ) { ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; for ( ; loader != null ; loader = loader . getParent ( ) ) { if ( loader instanceof EnvironmentClassLoader ) { EnvironmentClassLoader envLoader = ( EnvironmentClassLoader ) loader ; if ( envLoa... | Returns any configuration exception . |
139,592 | public static String getLocalClassPath ( ClassLoader loader ) { for ( ; loader != null ; loader = loader . getParent ( ) ) { if ( loader instanceof EnvironmentClassLoader ) { return ( ( EnvironmentClassLoader ) loader ) . getLocalClassPath ( ) ; } } return DynamicClassLoader . getSystemClassPath ( ) ; } | Returns the classpath for the environment level . |
139,593 | public static void closeGlobal ( ) { ArrayList < EnvLoaderListener > listeners ; listeners = new ArrayList < > ( ) ; listeners . addAll ( _globalLoaderListeners ) ; _globalLoaderListeners . clear ( ) ; for ( int i = 0 ; i < listeners . size ( ) ; i ++ ) { EnvLoaderListener listener = listeners . get ( i ) ; listener . ... | destroys the current environment . |
139,594 | public static synchronized void initializeEnvironment ( ) { if ( _isStaticInit ) return ; _isStaticInit = true ; ClassLoader systemLoader = ClassLoader . getSystemClassLoader ( ) ; Thread thread = Thread . currentThread ( ) ; ClassLoader oldLoader = thread . getContextClassLoader ( ) ; try { thread . setContextClassLoa... | Initializes the environment |
139,595 | private MonitoringRule buildRelatedRule ( IGuaranteeTerm guarantee ) { MonitoringRule result = new MonitoringRule ( ) ; result . setId ( guarantee . getName ( ) ) ; String violation = extractOutputMetric ( guarantee ) ; Parameter param = new Parameter ( ) ; param . setName ( QosModels . METRIC_PARAM_NAME ) ; param . se... | Build a MonitoringRule given a guarantee term |
139,596 | public void debug ( WriteStream out , Path path , byte [ ] tableKey ) throws IOException { SegmentKelpBuilder builder = new SegmentKelpBuilder ( ) ; builder . path ( path ) ; builder . create ( false ) ; builder . services ( ServicesAmp . newManager ( ) . get ( ) ) ; SegmentServiceImpl segmentService = builder . build ... | Debug with a table key |
139,597 | private void debugSegment ( WriteStream out , SegmentServiceImpl segmentService , SegmentExtent extent , byte [ ] debugTableKey ) throws IOException { int length = extent . length ( ) ; try ( InSegment in = segmentService . openRead ( extent ) ) { ReadStream is = new ReadStream ( in ) ; is . position ( length - BLOCK_S... | Trace through a segment displaying its sequence table and extent . |
139,598 | private void debugSegmentEntries ( WriteStream out , ReadStream is , SegmentExtent extent , TableEntry table ) throws IOException { TempBuffer tBuf = TempBuffer . create ( ) ; byte [ ] buffer = tBuf . buffer ( ) ; for ( long ptr = extent . length ( ) - BLOCK_SIZE ; ptr > 0 ; ptr -= BLOCK_SIZE ) { is . position ( ptr ) ... | Trace through the segment entries . |
139,599 | private int debugSegmentIndex ( WriteStream out , ReadStream is , byte [ ] buffer , long segmentAddress , long ptr , int head , TableEntry table ) throws IOException { int sublen = 1 + 4 * 4 ; int typeCode = buffer [ head ] & 0xff ; head ++ ; if ( typeCode <= 0 ) { return 0 ; } Type type = Type . valueOf ( typeCode ) ;... | Debug a single segment index entry . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.