idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
120,100 | private long getRemainingBytes ( ) { if ( in != null ) { if ( ! useLoadBuf ) { return in . remaining ( ) ; } try { if ( channel . isOpen ( ) ) { return channelSize - channel . position ( ) + in . remaining ( ) ; } else { return in . remaining ( ) ; } } catch ( Exception e ) { log . error ( "Error getRemainingBytes" , e... | Get the remaining bytes that could be read from a file or ByteBuffer . |
120,101 | public long getTotalBytes ( ) { if ( ! useLoadBuf ) { return in . capacity ( ) ; } try { return channelSize ; } catch ( Exception e ) { log . error ( "Error getTotalBytes" , e ) ; return 0 ; } } | Get the total readable bytes in a file or ByteBuffer . |
120,102 | private long getCurrentPosition ( ) { long pos ; if ( ! useLoadBuf ) { return in . position ( ) ; } try { if ( in != null ) { pos = ( channel . position ( ) - in . remaining ( ) ) ; } else { pos = channel . position ( ) ; } return pos ; } catch ( Exception e ) { log . error ( "Error getCurrentPosition" , e ) ; return 0... | Get the current position in a file or ByteBuffer . |
120,103 | private void setCurrentPosition ( long pos ) { if ( pos == Long . MAX_VALUE ) { pos = file . length ( ) ; } if ( ! useLoadBuf ) { in . position ( ( int ) pos ) ; return ; } try { if ( pos >= ( channel . position ( ) - in . limit ( ) ) && pos < channel . position ( ) ) { in . position ( ( int ) ( pos - ( channel . posit... | Modifies current position . |
120,104 | private void fillBuffer ( long amount , boolean reload ) { try { if ( amount > bufferSize ) { amount = bufferSize ; } log . debug ( "Buffering amount: {} buffer size: {}" , amount , bufferSize ) ; if ( channelSize - channel . position ( ) < amount ) { amount = channelSize - channel . position ( ) ; } if ( in == null ) ... | Load enough bytes from channel to buffer . After the loading process the caller can make sure the amount in buffer is of size amount if we haven t reached the end of channel . |
120,105 | public static void setBufferType ( String bufferType ) { int bufferTypeHash = bufferType . hashCode ( ) ; switch ( bufferTypeHash ) { case 3198444 : FLVReader . bufferType = BufferType . HEAP ; break ; case - 1331586071 : FLVReader . bufferType = BufferType . DIRECT ; break ; case 3005871 : default : FLVReader . buffer... | Setter for buffer type . |
120,106 | private ITag readTagHeader ( ) throws UnsupportedDataTypeException { fillBuffer ( 15 ) ; int previousTagSize = in . getInt ( ) ; byte dataType = in . get ( ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "Bits: {}" , Integer . toBinaryString ( dataType ) ) ; } dataType = ( byte ) ( dataType & 31 ) ; byte filter = (... | Read only header part of a tag . |
120,107 | public static int getDuration ( File flvFile ) { int duration = 0 ; RandomAccessFile flv = null ; try { flv = new RandomAccessFile ( flvFile , "r" ) ; long flvLength = Math . max ( flvFile . length ( ) , flv . length ( ) ) ; log . debug ( "File length: {}" , flvLength ) ; if ( flvLength > 13 ) { flv . seek ( flvLength ... | Returns the last tag s timestamp as the files duration . |
120,108 | public int compareTo ( MP4Frame that ) { int ret = 0 ; if ( this . time > that . getTime ( ) ) { ret = 1 ; } else if ( this . time < that . getTime ( ) ) { ret = - 1 ; } else if ( Double . doubleToLongBits ( time ) == Double . doubleToLongBits ( that . getTime ( ) ) && this . offset > that . getOffset ( ) ) { ret = 1 ;... | The frames are expected to be sorted by their timestamp |
120,109 | private void writePrimitiveByteArray ( byte [ ] bytes ) { writeAMF3 ( ) ; this . buf . put ( AMF3 . TYPE_BYTEARRAY ) ; if ( hasReference ( bytes ) ) { putInteger ( getReferenceId ( bytes ) << 1 ) ; return ; } storeReference ( bytes ) ; int length = bytes . length ; putInteger ( length << 1 | 0x1 ) ; this . buf . put ( ... | Use the specialized BYTEARRAY type . |
120,110 | public void writeVectorInt ( Vector < Integer > vector ) { log . debug ( "writeVectorInt: {}" , vector ) ; writeAMF3 ( ) ; buf . put ( AMF3 . TYPE_VECTOR_INT ) ; if ( hasReference ( vector ) ) { putInteger ( getReferenceId ( vector ) << 1 ) ; return ; } storeReference ( vector ) ; putInteger ( vector . size ( ) << 1 | ... | Write a Vector< ; int> ; . |
120,111 | public void writeVectorUInt ( Vector < Long > vector ) { log . debug ( "writeVectorUInt: {}" , vector ) ; writeAMF3 ( ) ; buf . put ( AMF3 . TYPE_VECTOR_UINT ) ; if ( hasReference ( vector ) ) { putInteger ( getReferenceId ( vector ) << 1 ) ; return ; } storeReference ( vector ) ; putInteger ( vector . size ( ) << 1 | ... | Write a Vector< ; uint> ; . |
120,112 | public void writeVectorNumber ( Vector < Double > vector ) { log . debug ( "writeVectorNumber: {}" , vector ) ; buf . put ( AMF3 . TYPE_VECTOR_NUMBER ) ; if ( hasReference ( vector ) ) { putInteger ( getReferenceId ( vector ) << 1 ) ; return ; } storeReference ( vector ) ; putInteger ( vector . size ( ) << 1 | 1 ) ; pu... | Write a Vector< ; Number> ; . |
120,113 | public void writeVectorObject ( Vector < Object > vector ) { log . debug ( "writeVectorObject: {}" , vector ) ; buf . put ( AMF3 . TYPE_VECTOR_OBJECT ) ; if ( hasReference ( vector ) ) { putInteger ( getReferenceId ( vector ) << 1 ) ; return ; } storeReference ( vector ) ; putInteger ( vector . size ( ) << 1 | 1 ) ; pu... | Write a Vector< ; Object> ; . |
120,114 | public void close ( ) throws IOException { if ( fis != null ) { try { fis . close ( ) ; fis = null ; } catch ( Throwable th ) { } } } | Will close all opened resources |
120,115 | void logInfo ( String tag , String msg ) { log ( Log . INFO , tag , msg ) ; } | Log with level info . |
120,116 | public void put ( String key , T object ) { if ( ramMode . equals ( DualCacheRamMode . ENABLE_WITH_REFERENCE ) ) { ramCacheLru . put ( key , object ) ; } String ramSerialized = null ; if ( ramMode . equals ( DualCacheRamMode . ENABLE_WITH_SPECIFIC_SERIALIZER ) ) { ramSerialized = ramSerializer . toString ( object ) ; r... | Put an object in cache . |
120,117 | public T get ( String key ) { Object ramResult = null ; String diskResult = null ; DiskLruCache . Snapshot snapshotObject = null ; boolean isRamSerialized = ramMode . equals ( DualCacheRamMode . ENABLE_WITH_SPECIFIC_SERIALIZER ) ; boolean isRamReferenced = ramMode . equals ( DualCacheRamMode . ENABLE_WITH_REFERENCE ) ;... | Return the object of the corresponding key from the cache . In no object is available return null . |
120,118 | public void delete ( String key ) { if ( ! ramMode . equals ( DualCacheRamMode . DISABLE ) ) { ramCacheLru . remove ( key ) ; } if ( ! diskMode . equals ( DualCacheDiskMode . DISABLE ) ) { try { dualCacheLock . lockDiskEntryWrite ( key ) ; diskLruCache . remove ( key ) ; } catch ( IOException e ) { logger . logError ( ... | Delete the corresponding object in cache . |
120,119 | public void invalidateDisk ( ) { if ( ! diskMode . equals ( DualCacheDiskMode . DISABLE ) ) { try { dualCacheLock . lockFullDiskWrite ( ) ; diskLruCache . delete ( ) ; openDiskLruCache ( diskCacheFolder ) ; } catch ( IOException e ) { logger . logError ( e ) ; } finally { dualCacheLock . unLockFullDiskWrite ( ) ; } } } | Remove all objects from Disk . |
120,120 | public boolean contains ( String key ) { if ( ! ramMode . equals ( DualCacheRamMode . DISABLE ) && ramCacheLru . snapshot ( ) . containsKey ( key ) ) { return true ; } try { dualCacheLock . lockDiskEntryWrite ( key ) ; if ( ! diskMode . equals ( DualCacheDiskMode . DISABLE ) && diskLruCache . get ( key ) != null ) { re... | Test if an object is present in cache . |
120,121 | public DualCache < T > build ( ) { if ( ramMode == null ) { throw new IllegalStateException ( "No ram mode set" ) ; } if ( diskMode == null ) { throw new IllegalStateException ( "No disk mode set" ) ; } DualCache < T > cache = new DualCache < > ( appVersion , new Logger ( logEnabled ) , ramMode , ramSerializer , maxRam... | Builder the cache . Exception will be thrown if it can not be created . |
120,122 | public int read ( ) throws IOException { byte [ ] buf = new byte [ 1 ] ; int res = this . read ( buf , 0 , 1 ) ; if ( res != - 1 ) { return 0xFF & buf [ 0 ] ; } return res ; } | Read a byte |
120,123 | public int read ( byte [ ] b , int off , int len ) throws IOException { if ( currentEntry != null ) { if ( currentFileSize == currentEntry . getSize ( ) ) { return - 1 ; } else if ( ( currentEntry . getSize ( ) - currentFileSize ) < len ) { len = ( int ) ( currentEntry . getSize ( ) - currentFileSize ) ; } } int br = s... | Checks if the bytes being read exceed the entry size and adjusts the byte array length . Updates the byte counters |
120,124 | public TarEntry getNextEntry ( ) throws IOException { closeCurrentEntry ( ) ; byte [ ] header = new byte [ TarConstants . HEADER_BLOCK ] ; byte [ ] theader = new byte [ TarConstants . HEADER_BLOCK ] ; int tr = 0 ; while ( tr < TarConstants . HEADER_BLOCK ) { int res = read ( theader , 0 , TarConstants . HEADER_BLOCK - ... | Returns the next entry in the tar file |
120,125 | protected void skipPad ( ) throws IOException { if ( bytesRead > 0 ) { int extra = ( int ) ( bytesRead % TarConstants . DATA_BLOCK ) ; if ( extra > 0 ) { long bs = 0 ; while ( bs < TarConstants . DATA_BLOCK - extra ) { long res = skip ( TarConstants . DATA_BLOCK - extra - bs ) ; bs += res ; } } } } | Skips the pad at the end of each tar entry file content |
120,126 | public static int getLongOctalBytes ( long value , byte [ ] buf , int offset , int length ) { byte [ ] temp = new byte [ length + 1 ] ; getOctalBytes ( value , temp , 0 , length + 1 ) ; System . arraycopy ( temp , 0 , buf , offset , length ) ; return offset + length ; } | Write an octal long integer to a header buffer . |
120,127 | public void write ( int b ) throws IOException { out . write ( b ) ; bytesWritten += 1 ; if ( currentEntry != null ) { currentFileSize += 1 ; } } | Writes a byte to the stream and updates byte counters |
120,128 | public void write ( byte [ ] b , int off , int len ) throws IOException { if ( currentEntry != null && ! currentEntry . isDirectory ( ) ) { if ( currentEntry . getSize ( ) < currentFileSize + len ) { throw new IOException ( "The current entry[" + currentEntry . getName ( ) + "] size[" + currentEntry . getSize ( ) + "] ... | Checks if the bytes being written exceed the current entry size . |
120,129 | public void putNextEntry ( TarEntry entry ) throws IOException { closeCurrentEntry ( ) ; byte [ ] header = new byte [ TarConstants . HEADER_BLOCK ] ; entry . writeEntryHeader ( header ) ; write ( header ) ; currentEntry = entry ; } | Writes the next tar entry header on the stream |
120,130 | protected void pad ( ) throws IOException { if ( bytesWritten > 0 ) { int extra = ( int ) ( bytesWritten % TarConstants . DATA_BLOCK ) ; if ( extra > 0 ) { write ( new byte [ TarConstants . DATA_BLOCK - extra ] ) ; } } } | Pads the last content block |
120,131 | @ SuppressWarnings ( "unused" ) public void setIndicatorWidth ( int indicatorWidth ) { mIndicatorWidth = indicatorWidth ; mIndicatorRectangle . set ( getPaddingLeft ( ) , getPaddingTop ( ) , getPaddingLeft ( ) + mIndicatorWidth , getMeasuredHeight ( ) - getPaddingBottom ( ) ) ; requestLayout ( ) ; } | Set indicator width |
120,132 | @ SuppressWarnings ( "unused" ) public void resetView ( ) { if ( mForwardAnimatorSet != null && mForwardAnimatorSet . isRunning ( ) ) { mForwardAnimatorSet . end ( ) ; } if ( mReverseAnimatorSet != null && mReverseAnimatorSet . isRunning ( ) ) { mReverseAnimatorSet . end ( ) ; } if ( mAnimationView != null && mAnimatio... | Reset view to initial state |
120,133 | @ SuppressWarnings ( "unused" ) public void showContextView ( ) { if ( ( mForwardAnimatorSet != null && mForwardAnimatorSet . isRunning ( ) ) || ( mAnimationView != null && mAnimationView . isPlaying ( ) ) || ( mReverseAnimatorSet != null && mReverseAnimatorSet . isRunning ( ) ) ) { return ; } if ( mBaseContainer != nu... | Show context view |
120,134 | @ SuppressWarnings ( "unused" ) public void showBaseView ( ) { if ( ( mForwardAnimatorSet != null && mForwardAnimatorSet . isRunning ( ) ) || ( mAnimationView != null && mAnimationView . isPlaying ( ) ) || ( mReverseAnimatorSet != null && mReverseAnimatorSet . isRunning ( ) ) ) { return ; } if ( mBaseContainer != null ... | Show base view |
120,135 | public static float normalize ( float val , float minVal , float maxVal ) { if ( val < minVal || val > maxVal ) throw new IllegalArgumentException ( "Value must be between min and max values. [val, min, max]: [" + val + "," + minVal + ", " + maxVal + "]" ) ; return ( val - minVal ) / ( maxVal - minVal ) ; } | Normalize value between minimum and maximum . |
120,136 | public static float enlarge ( float startValue , float endValue , float time ) { if ( startValue > endValue ) throw new IllegalArgumentException ( "Start size can't be larger than end size." ) ; return startValue + ( endValue - startValue ) * time ; } | Enlarge value from startValue to endValue |
120,137 | public static float reduce ( float startValue , float endValue , float time ) { if ( startValue < endValue ) throw new IllegalArgumentException ( "End size can't be larger than start size." ) ; return endValue + ( startValue - endValue ) * ( 1 - time ) ; } | Reduce value from startValue to endValue |
120,138 | public void configureTasks ( ScheduledTaskRegistrar taskRegistrar ) { BugsnagScheduledTaskExceptionHandler bugsnagErrorHandler = new BugsnagScheduledTaskExceptionHandler ( bugsnag ) ; TaskScheduler registrarScheduler = taskRegistrar . getScheduler ( ) ; TaskScheduler taskScheduler = registrarScheduler != null ? registr... | Add bugsnag error handling to a task scheduler |
120,139 | private void populateContextData ( Report report , ILoggingEvent event ) { Map < String , String > propertyMap = event . getMDCPropertyMap ( ) ; if ( propertyMap != null ) { for ( Map . Entry < String , String > entry : propertyMap . entrySet ( ) ) { report . addToTab ( "Context" , entry . getKey ( ) , entry . getValue... | Adds logging context values to the given report meta data |
120,140 | private Severity calculateSeverity ( ILoggingEvent event ) { if ( event . getLevel ( ) . equals ( Level . ERROR ) ) { return Severity . ERROR ; } else if ( event . getLevel ( ) . equals ( Level . WARN ) ) { return Severity . WARNING ; } return Severity . INFO ; } | Calculates the severity based on the logging event |
120,141 | public void setEndpoint ( String endpoint ) { this . endpoint = endpoint ; if ( bugsnag != null ) { bugsnag . setEndpoints ( endpoint , null ) ; } } | Internal use only Should only be used via the logback . xml file |
120,142 | List < String > split ( String value ) { if ( value == null ) { return Collections . emptyList ( ) ; } String [ ] parts = value . split ( "," , - 1 ) ; return Arrays . asList ( parts ) ; } | Splits the given string on commas |
120,143 | private boolean isExcludedLogger ( String loggerName ) { for ( Pattern excludedLoggerPattern : EXCLUDED_LOGGER_PATTERNS ) { if ( excludedLoggerPattern . matcher ( loggerName ) . matches ( ) ) { return true ; } } return false ; } | Whether or not a logger is excluded from generating Bugsnag reports |
120,144 | public static String getHostnameValue ( ) { if ( ! hostnameInitialised ) { synchronized ( LOCK ) { if ( ! hostnameInitialised ) { hostname = lookupHostname ( ) ; hostnameInitialised = true ; } } } return hostname ; } | Memoises the hostname as lookup can be expensive |
120,145 | protected List < Exception > getExceptions ( ) { List < Exception > exceptions = new ArrayList < Exception > ( ) ; exceptions . add ( exception ) ; Throwable currentThrowable = exception . getThrowable ( ) . getCause ( ) ; while ( currentThrowable != null ) { exceptions . add ( new Exception ( config , currentThrowable... | Get the exceptions for the report . |
120,146 | public Report addToTab ( String tabName , String key , Object value ) { diagnostics . metaData . addToTab ( tabName , key , value ) ; return this ; } | Add a key value pair to a metadata tab . |
120,147 | public Report setAppInfo ( String key , Object value ) { diagnostics . app . put ( key , value ) ; return this ; } | Add some application info on the report . |
120,148 | public Report setDeviceInfo ( String key , Object value ) { diagnostics . device . put ( key , value ) ; return this ; } | Set device information on the report . |
120,149 | public Report setUser ( String id , String email , String name ) { diagnostics . user . put ( "id" , id ) ; diagnostics . user . put ( "email" , email ) ; diagnostics . user . put ( "name" , name ) ; return this ; } | Helper method to set all the user attributes . |
120,150 | protected void disableSessionDelivery ( ) { bugsnag . setSessionDelivery ( new Delivery ( ) { public void deliver ( Serializer serializer , Object object , Map < String , String > headers ) { } public void close ( ) { } } ) ; } | Prevents sessions from being delivered |
120,151 | protected void flushAllSessions ( ) { try { Field field = bugsnag . getClass ( ) . getDeclaredField ( "sessionTracker" ) ; field . setAccessible ( true ) ; Object sessionTracker = field . get ( bugsnag ) ; field = sessionTracker . getClass ( ) . getDeclaredField ( "enqueuedSessionCounts" ) ; field . setAccessible ( tru... | Flushes sessions from the Bugsnag object |
120,152 | public void writeToStream ( OutputStream stream , Object object ) throws SerializationException { try { mapper . writeValue ( stream , object ) ; } catch ( IOException ex ) { throw new SerializationException ( "Exception during serialization" , ex ) ; } } | Write the object to the stream . |
120,153 | public Bugsnag bugsnag ( ) { Bugsnag bugsnag = new Bugsnag ( "YOUR-API-KEY" ) ; bugsnag . setReleaseStage ( "staging" ) ; bugsnag . setAppVersion ( "1.0.1" ) ; bugsnag . addCallback ( new Callback ( ) { public void beforeNotify ( Report report ) { report . addToTab ( "diagnostics" , "timestamp" , new Date ( ) ) ; repor... | Define singleton bean bugsnag which can be injected into any Spring managed class with |
120,154 | public void close ( ) { LOGGER . debug ( "Closing connection to Bugsnag" ) ; if ( config . delivery != null ) { config . delivery . close ( ) ; } ExceptionHandler . disable ( this ) ; } | Close the connection to Bugsnag and unlink the exception handler . |
120,155 | public static void addThreadMetaData ( String tabName , String key , Object value ) { THREAD_METADATA . get ( ) . addToTab ( tabName , key , value ) ; } | Add a key value pair to a metadata tab just for this thread . |
120,156 | @ SuppressWarnings ( "checkstyle:emptycatchblock" ) void excludeLoggers ( ) { try { BugsnagAppender . addExcludedLoggerPattern ( "org.apache.catalina.core.ContainerBase." + "\\[Tomcat.*\\][.]\\[.*\\][.]\\[/.*\\][.]\\[.*\\]" ) ; BugsnagAppender . addExcludedLoggerPattern ( "org.eclipse.jetty.server.HttpChannel" ) ; Bugs... | If using Logback stop any configured appender from creating Bugsnag reports for Spring log messages as they effectively duplicate error reports for unhandled exceptions . |
120,157 | protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { try { int mode = MeasureSpec . getMode ( heightMeasureSpec ) ; if ( mode == MeasureSpec . UNSPECIFIED || mode == MeasureSpec . AT_MOST ) { super . onMeasure ( widthMeasureSpec , heightMeasureSpec ) ; int height = 0 ; for ( int i = 0 ; i < getCh... | Allows to redraw the view size to wrap the content of the bigger child . |
120,158 | private void setWidth ( int width ) { contentParams . width = options . fullScreenPeek ( ) ? screenWidth : width ; content . setLayoutParams ( contentParams ) ; } | Sets the width of the view in PX . |
120,159 | private void setHeight ( int height ) { contentParams . height = options . fullScreenPeek ( ) ? screenHeight : height ; content . setLayoutParams ( contentParams ) ; } | Sets the height of the view in PX . |
120,160 | public void setOffsetByMotionEvent ( MotionEvent event ) { int x = ( int ) event . getRawX ( ) ; int y = ( int ) event . getRawY ( ) ; if ( x + contentParams . width + FINGER_SIZE < screenWidth ) { setContentOffset ( x , y , Translation . HORIZONTAL , FINGER_SIZE ) ; } else if ( x - FINGER_SIZE - contentParams . width ... | Places the peek view over the top of a motion event . This will translate the motion event s start points so that the PeekView isn t covered by the finger . |
120,161 | private void setContentOffset ( int startX , int startY , Translation translation , int movementAmount ) { if ( translation == Translation . VERTICAL ) { int originalStartX = startX ; startX -= contentParams . width / 2 ; boolean moveDown = true ; if ( startY + contentParams . height + FINGER_SIZE > screenHeight ) { st... | Show the PeekView over the point of motion |
120,162 | public void show ( ) { androidContentView . addView ( this ) ; content . setTranslationX ( distanceFromLeft ) ; content . setTranslationY ( distanceFromTop ) ; ObjectAnimator animator = ObjectAnimator . ofFloat ( this , View . ALPHA , 0.0f , 1.0f ) ; animator . addListener ( new AnimatorEndListener ( ) { public void on... | Show the content of the PeekView by adding it to the android . R . id . content FrameLayout . |
120,163 | public void hide ( ) { ObjectAnimator animator = ObjectAnimator . ofFloat ( this , View . ALPHA , 1.0f , 0.0f ) ; animator . addListener ( new AnimatorEndListener ( ) { public void onAnimationEnd ( Animator animator ) { androidContentView . removeView ( PeekView . this ) ; if ( callbacks != null ) { callbacks . dismiss... | Hide the PeekView and remove it from the android . R . id . content FrameLayout . |
120,164 | public void applyTo ( final PeekViewActivity activity , final View base ) { final GestureDetectorCompat detector = new GestureDetectorCompat ( activity , new GestureListener ( activity , base , this ) ) ; base . setOnTouchListener ( new View . OnTouchListener ( ) { public boolean onTouch ( View view , final MotionEvent... | Finish the builder by selecting the base view that you want to show the PeekView from . |
120,165 | public void show ( PeekViewActivity activity , MotionEvent motionEvent ) { PeekView peek ; if ( layout == null ) { peek = new PeekView ( activity , options , layoutRes , callbacks ) ; } else { peek = new PeekView ( activity , options , layout , callbacks ) ; } peek . setOffsetByMotionEvent ( motionEvent ) ; activity . ... | Show the PeekView |
120,166 | public void loadStyledAttributes ( AttributeSet attrs , int defStyleAttr ) { if ( attrs != null ) { final TypedArray attributes = mContext . getTheme ( ) . obtainStyledAttributes ( attrs , R . styleable . CircularViewPager , defStyleAttr , 0 ) ; mStartLineEnabled = attributes . getBoolean ( R . styleable . CircularView... | Loads the styles and attributes defined in the xml tag of this class |
120,167 | private void initializePainters ( ) { mClockwiseReachedArcPaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; mClockwiseReachedArcPaint . setColor ( mClockwiseArcColor ) ; mClockwiseReachedArcPaint . setAntiAlias ( true ) ; mClockwiseReachedArcPaint . setStrokeWidth ( mClockwiseReachedArcWidth ) ; mClockwiseReachedArcPaint... | Initializes the paints used for the bars |
120,168 | public static ProducerSnapshot createSnapshot ( IStatsProducer producer , String intervalName ) { ProducerSnapshot ret = new ProducerSnapshot ( ) ; ret . setCategory ( producer . getCategory ( ) ) ; ret . setSubsystem ( producer . getSubsystem ( ) ) ; ret . setProducerId ( producer . getProducerId ( ) ) ; ret . setInte... | Creates a snapshot for a producer . |
120,169 | private static StatSnapshot createStatSnapshot ( IStats stat , String intervalName , List < String > valueNames ) { StatSnapshot snapshot = new StatSnapshot ( stat . getName ( ) ) ; for ( String valueName : valueNames ) { snapshot . setValue ( valueName , stat . getValueByNameAsString ( valueName , intervalName , TimeU... | Creates a snapshot for one stat object . |
120,170 | public static BlueprintProducer getBlueprintProducer ( String producerId , String category , String subsystem ) { try { BlueprintProducer producer = producers . get ( producerId ) ; if ( producer == null ) { synchronized ( producers ) { producer = producers . get ( producerId ) ; if ( producer == null ) { producer = ne... | Returns the blueprint producer with this id . Creates one if none is existing . Uses DLC pattern to reduce synchronization overhead . |
120,171 | private void setAccumulatorAttributes ( List < String > accumulatorIds , HttpServletRequest request ) throws APIException { if ( accumulatorIds == null || accumulatorIds . isEmpty ( ) ) { return ; } request . setAttribute ( "accumulatorsPresent" , Boolean . TRUE ) ; List < AccumulatedSingleGraphAO > singleGraphDataBean... | Sets accumulator specific attributes required to show accumulator charts on page . |
120,172 | private void setThresholdAttributes ( List < String > thresholdIds , HttpServletRequest request ) throws APIException { if ( thresholdIds == null || thresholdIds . isEmpty ( ) ) { return ; } request . setAttribute ( "thresholdsPresent" , Boolean . TRUE ) ; List < ThresholdStatusBean > thresholdStatusBeans = getThreshol... | Sets threshold specific attributes required to show thresholds on page . |
120,173 | private void removeCumulatedStats ( ProducerDecoratorBean decorator ) { if ( decorator == null ) { LOGGER . warn ( "Decorator is empty" ) ; return ; } for ( ProducerAO producer : decorator . getProducers ( ) ) { for ( Iterator < StatLineAO > statLineIterator = producer . getLines ( ) . listIterator ( ) ; statLineIterat... | Removes cumulated stats from producers inside decorator . |
120,174 | private boolean hasAnyStat ( ProducerDecoratorBean decorator ) { for ( ProducerAO producer : decorator . getProducers ( ) ) { for ( StatLineAO line : producer . getLines ( ) ) { if ( ! CUMULATED_STAT_NAME_VALUE . equals ( line . getStatName ( ) ) ) { return true ; } } } return false ; } | Checks whether given decorator stat lines contain something besides cumulated stat . |
120,175 | public boolean isMBeanRequired ( final String domainName , final String className ) { if ( domains == null || domains . length == 0 ) return true ; for ( MBeanProducerDomainConfig domainConfig : domains ) if ( domainConfig . getName ( ) . equalsIgnoreCase ( domainName ) ) { return ArrayUtils . contains ( domainConfig .... | Checks is mbean with given domain and class required by this configuration . |
120,176 | private static < A extends Annotation > A findAnnotationInAnnotations ( final AnnotatedElement source , final Class < A > targetAnnotationClass ) { final Annotation [ ] allAnnotations = source . getAnnotations ( ) ; for ( final Annotation annotation : allAnnotations ) { final A result = findAnnotation ( annotation , ta... | Tries to find required annotation in scope of all annotations of incoming source . |
120,177 | public static < A extends Annotation > A findTypeAnnotation ( final Class < ? > type , final Class < A > targetAnnotationClass ) { Objects . requireNonNull ( type , "incoming 'type' is not valid" ) ; Objects . requireNonNull ( targetAnnotationClass , "incoming 'targetAnnotationClass' is not valid" ) ; if ( type . equal... | Recursive annotation search on type it annotations and parents hierarchy . Interfaces ignored . |
120,178 | private ValueHolder getHolderByIntervalName ( String aIntervalName ) { ValueHolder h = values . get ( aIntervalName ) ; if ( h == null ) throw new UnknownIntervalException ( aIntervalName ) ; return h ; } | This method returns the ValueHolder that is stored for the given Interval name . |
120,179 | public void initWithDefaultProperties ( Properties properties ) throws ConnectorInitException { log . debug ( "Starting to initWithDefaultProperties RabbitMQ connector in php plugin..." ) ; ConnectionFactory factory = new ConnectionFactory ( ) ; factory . setHost ( properties . getProperty ( "connector.host" ) ) ; fact... | Opens connection and channel to listen configured queue for incoming data |
120,180 | public void deinit ( ) { if ( channel != null ) try { channel . close ( ) ; } catch ( IOException | TimeoutException e ) { log . warn ( "Failed to close channel in RabbitMQ connector" ) ; } if ( connection != null ) try { connection . close ( ) ; } catch ( IOException e ) { log . warn ( "Failed to close connection in R... | Closes RabbitMQ channel and connection |
120,181 | public void intervalUpdated ( Interval caller ) { output . out ( "===============================================================================" ) ; output . out ( "=== SNAPSHOT Interval " + interval . getName ( ) + " updated, Entity: " + id ) ; output . out ( "=== Timestamp: " + Date . currentDate ( ) + ", ServiceId... | Called by the timer . Writes the current status to the logger . |
120,182 | public static void startMoSKitoInspectBackend ( int port ) throws MoSKitoInspectStartException { log . info ( "Starting moskito-inspect remote agent at port " + port ) ; Class serverClazz = null ; Exception exception = null ; try { serverClazz = Class . forName ( "net.anotheria.moskito.webui.shared.api.generated.Combin... | Starts MoSKito Inspect Backend . |
120,183 | public MapperConfig [ ] getDefault ( ) { MapperConfig executionStatsMapper = new MapperConfig ( ) ; executionStatsMapper . setMapperClass ( "net.anotheria.extensions.php.mappers.impl.ExecutionStatsMapper" ) ; executionStatsMapper . setMapperId ( "ExecutionStatsMapper" ) ; MapperConfig serviceStatsMapper = new MapperCon... | Defines builtin default mappers that required for agent proper work |
120,184 | private Object doMoskitoProfiling ( ProceedingJoinPoint pjp , String statement ) throws Throwable { String statementGeneralized = removeParametersFromStatement ( statement ) ; long callTime = System . nanoTime ( ) ; QueryStats cumulatedStats = producer . getDefaultStats ( ) ; QueryStats statementStats = null ; try { st... | Perform MoSKito profiling . |
120,185 | private void addTrace ( String statement , final boolean isSuccess , final long duration ) { TracedCall aRunningTrace = RunningTraceContainer . getCurrentlyTracedCall ( ) ; CurrentlyTracedCall currentTrace = aRunningTrace . callTraced ( ) ? ( CurrentlyTracedCall ) aRunningTrace : null ; if ( currentTrace != null ) { Tr... | Perform additional profiling - for Journey stuff . |
120,186 | private Object count ( ProceedingJoinPoint pjp , String aProducerId , String aSubsystem , String aCategory ) throws Throwable { return perform ( false , getMethodStatName ( pjp . getSignature ( ) ) , pjp , aProducerId , aCategory , aSubsystem ) ; } | Implementation for the |
120,187 | void bootstrapPlugin ( IProducerRegistry producerRegistry ) throws PHPPluginBootstrapException { config . setConfigChangedNotifier ( new ConfigChangedNotifierImpl ( ) ) ; MappersRegistry mappersRegistry = new MappersRegistry ( ) ; listener = new OnProducerDataReceivedListenerImpl ( mappersRegistry , producerRegistry ) ... | Bootstraps Moskito PHP plugin |
120,188 | public static String makeDeepLink ( String link ) { if ( link != null && getCurrentRemoteConnectionLink ( ) != null && ! containsRemoteParameter ( link ) ) { link += ( link . contains ( "?" ) ? "&" : "?" ) + PARAM_REMOTE_CONNECTION + "=" + getCurrentRemoteConnectionLink ( ) ; } return link ; } | Adds remote connection parameter to link GET query if parameter yet not present in this link . |
120,189 | private String formatQuery ( final ThresholdAlert alert ) { return String . format ( SMS_QUERY_FORMAT , user , password , createMessage ( alert , smsTemplate ) , recipients ) ; } | Formats query . |
120,190 | private static String createMessage ( final ThresholdAlert alert , final String template ) { String message ; if ( ! StringUtils . isEmpty ( template ) ) { ThresholdAlertTemplate thresholdAlertTemplate = new ThresholdAlertTemplate ( alert ) ; message = thresholdAlertTemplate . process ( template ) ; } else { message = ... | Create SMS message . |
120,191 | public void addCaption ( String name , String type ) { captions . add ( new StatCaptionBean ( name , name + " as " + type , "" ) ) ; } | Add a caption value . |
120,192 | public void putAll ( Storage < ? extends K , ? extends V > anotherStorage ) { wrapper . putAll ( anotherStorage . getWrapper ( ) ) ; stats . setSize ( wrapper . size ( ) ) ; } | Puts all elements from anotherStorage to this storage . |
120,193 | public Map < K , V > fillMap ( Map < K , V > toFill ) { return wrapper . fillMap ( toFill ) ; } | Puts all elements into a given map . |
120,194 | public static < K , V > Storage < K , V > createHashtableStorage ( ) { return new Storage < K , V > ( new MapStorageWrapper < K , V > ( new HashMap < K , V > ( ) ) ) ; } | Factory method to create a new storage backed by a hashtable . |
120,195 | public static < K , V > Storage < K , V > createTreeMapStorage ( String name ) { return new Storage < K , V > ( name , new MapStorageWrapper < K , V > ( new TreeMap < K , V > ( ) ) ) ; } | Creates a new TreeMap backed Storage . |
120,196 | protected static IValueHolderFactory createValueHolderFactory ( StatValueTypes aType ) { switch ( aType ) { case LONG : return longValueHolderFactory ; case INT : return intValueHolderFactory ; case STRING : return stringValueHolderFactory ; case COUNTER : return counterValueHolderFactory ; case DOUBLE : return doubleV... | This method creates the responsible ValueHolderFactory from the given internal type representation . |
120,197 | public static String buildCall ( final Method method , final Object [ ] parameters ) { if ( method == null ) { throw new IllegalArgumentException ( "Parameter method can't be null" ) ; } return buildCall ( method . getDeclaringClass ( ) . getSimpleName ( ) , method . getName ( ) , parameters , null ) . toString ( ) ; } | Builds call . |
120,198 | public static List < TagEntryAO > tagsMapToTagEntries ( Map < String , String > tagsMap ) { if ( tagsMap == null ) return Collections . EMPTY_LIST ; List < TagEntryAO > tagEntries = new ArrayList < > ( tagsMap . size ( ) ) ; for ( Map . Entry < String , String > entry : tagsMap . entrySet ( ) ) tagEntries . add ( new T... | Creates tags info beans from given tags map with tag names as keys and tag values as map values |
120,199 | private void apiAfterConfiguration ( ) { ProducerFilterConfig filterConfig [ ] = WebUIConfig . getInstance ( ) . getFilters ( ) ; if ( filterConfig == null || filterConfig . length == 0 ) return ; List < ProducerFilter > newProducerFilters = new ArrayList < > ( filterConfig . length ) ; for ( ProducerFilterConfig pfc :... | Called after the configuration has been read . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.