idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
150,100 | public void setAcquireRetryDelay ( long acquireRetryDelay , TimeUnit timeUnit ) { this . acquireRetryDelayInMs = TimeUnit . MILLISECONDS . convert ( acquireRetryDelay , timeUnit ) ; } | Sets the number of ms to wait before attempting to obtain a connection again after a failure . |
150,101 | public void setQueryExecuteTimeLimit ( long queryExecuteTimeLimit , TimeUnit timeUnit ) { this . queryExecuteTimeLimitInMs = TimeUnit . MILLISECONDS . convert ( queryExecuteTimeLimit , timeUnit ) ; } | Queries taking longer than this limit to execute are logged . |
150,102 | public void setConnectionTimeout ( long connectionTimeout , TimeUnit timeUnit ) { this . connectionTimeoutInMs = TimeUnit . MILLISECONDS . convert ( connectionTimeout , timeUnit ) ; } | Sets the maximum time to wait before a call to getConnection is timed out . |
150,103 | public void setCloseConnectionWatchTimeout ( long closeConnectionWatchTimeout , TimeUnit timeUnit ) { this . closeConnectionWatchTimeoutInMs = TimeUnit . MILLISECONDS . convert ( closeConnectionWatchTimeout , timeUnit ) ; } | Sets the time to wait when close connection watch threads are enabled . 0 = wait forever . |
150,104 | public void setMaxConnectionAge ( long maxConnectionAge , TimeUnit timeUnit ) { this . maxConnectionAgeInSeconds = TimeUnit . SECONDS . convert ( maxConnectionAge , timeUnit ) ; } | Sets the maxConnectionAge . Any connections older than this setting will be closed off whether it is idle or not . Connections currently in use will not be affected until they are returned to the pool . |
150,105 | private Properties parseXML ( Document doc , String sectionName ) { int found = - 1 ; Properties results = new Properties ( ) ; NodeList config = null ; if ( sectionName == null ) { config = doc . getElementsByTagName ( "default-config" ) ; found = 0 ; } else { config = doc . getElementsByTagName ( "named-config" ) ; i... | Parses the given XML doc to extract the properties and return them into a java . util . Properties . |
150,106 | protected Class < ? > loadClass ( String clazz ) throws ClassNotFoundException { if ( this . classLoader == null ) { return Class . forName ( clazz ) ; } return Class . forName ( clazz , true , this . classLoader ) ; } | Loads the given class respecting the given classloader . |
150,107 | public boolean hasSameConfiguration ( BoneCPConfig that ) { if ( that != null && Objects . equal ( this . acquireIncrement , that . getAcquireIncrement ( ) ) && Objects . equal ( this . acquireRetryDelayInMs , that . getAcquireRetryDelayInMs ( ) ) && Objects . equal ( this . closeConnectionWatch , that . isCloseConnect... | Returns true if this instance has the same config as a given config . |
150,108 | protected long preConnection ( ) throws SQLException { long statsObtainTime = 0 ; if ( this . pool . poolShuttingDown ) { throw new SQLException ( this . pool . shutdownStackTrace ) ; } if ( this . pool . statisticsEnabled ) { statsObtainTime = System . nanoTime ( ) ; this . pool . statistics . incrementConnectionsRequ... | Prep for a new connection |
150,109 | protected void postConnection ( ConnectionHandle handle , long statsObtainTime ) { handle . renewConnection ( ) ; if ( handle . getConnectionHook ( ) != null ) { handle . getConnectionHook ( ) . onCheckOut ( handle ) ; } if ( this . pool . closeConnectionWatch ) { this . pool . watchConnection ( handle ) ; } if ( this ... | After obtaining a connection perform additional tasks . |
150,110 | public BoneCP getPool ( ) { FinalWrapper < BoneCP > wrapper = this . pool ; return wrapper == null ? null : wrapper . value ; } | Returns a handle to the pool . Useful to obtain a handle to the statistics for example . |
150,111 | public void configure ( Properties props ) throws HibernateException { try { this . config = new BoneCPConfig ( props ) ; String url = props . getProperty ( CONFIG_CONNECTION_URL ) ; String username = props . getProperty ( CONFIG_CONNECTION_USERNAME ) ; String password = props . getProperty ( CONFIG_CONNECTION_PASSWORD... | Pool configuration . |
150,112 | protected BoneCP createPool ( BoneCPConfig config ) { try { return new BoneCP ( config ) ; } catch ( SQLException e ) { throw new HibernateException ( e ) ; } } | Creates the given connection pool with the given configuration . Extracted here to make unit mocking easier . |
150,113 | private Properties mapToProperties ( Map < String , String > map ) { Properties p = new Properties ( ) ; for ( Map . Entry < String , String > entry : map . entrySet ( ) ) { p . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } return p ; } | Legacy conversion . |
150,114 | protected synchronized void stealExistingAllocations ( ) { for ( ConnectionHandle handle : this . threadFinalizableRefs . keySet ( ) ) { if ( handle . logicallyClosed . compareAndSet ( true , false ) ) { try { this . pool . releaseConnection ( handle ) ; } catch ( SQLException e ) { logger . error ( "Error releasing co... | Tries to close off all the unused assigned connections back to the pool . Assumes that the strategy mode has already been flipped prior to calling this routine . Called whenever our no of connection requests > no of threads . |
150,115 | protected void threadWatch ( final ConnectionHandle c ) { this . threadFinalizableRefs . put ( c , new FinalizableWeakReference < Thread > ( Thread . currentThread ( ) , this . finalizableRefQueue ) { public void finalizeReferent ( ) { try { if ( ! CachedConnectionStrategy . this . pool . poolShuttingDown ) { logger . ... | Keep track of this handle tied to which thread so that if the thread is terminated we can reclaim our connection handle . We also |
150,116 | public synchronized void shutdown ( ) { if ( ! this . poolShuttingDown ) { logger . info ( "Shutting down connection pool..." ) ; this . poolShuttingDown = true ; this . shutdownStackTrace = captureStackTrace ( SHUTDOWN_LOCATION_TRACE ) ; this . keepAliveScheduler . shutdownNow ( ) ; this . maxAliveScheduler . shutdown... | Closes off this connection pool . |
150,117 | protected void unregisterDriver ( ) { String jdbcURL = this . config . getJdbcUrl ( ) ; if ( ( jdbcURL != null ) && this . config . isDeregisterDriverOnClose ( ) ) { logger . info ( "Unregistering JDBC driver for : " + jdbcURL ) ; try { DriverManager . deregisterDriver ( DriverManager . getDriver ( jdbcURL ) ) ; } catc... | Drops a driver from the DriverManager s list . |
150,118 | protected void destroyConnection ( ConnectionHandle conn ) { postDestroyConnection ( conn ) ; conn . setInReplayMode ( true ) ; try { conn . internalClose ( ) ; } catch ( SQLException e ) { logger . error ( "Error in attempting to close connection" , e ) ; } } | Physically close off the internal connection . |
150,119 | protected void postDestroyConnection ( ConnectionHandle handle ) { ConnectionPartition partition = handle . getOriginatingPartition ( ) ; if ( this . finalizableRefQueue != null && handle . getInternalConnection ( ) != null ) { this . finalizableRefs . remove ( handle . getInternalConnection ( ) ) ; } partition . updat... | Update counters and call hooks . |
150,120 | protected Connection obtainInternalConnection ( ConnectionHandle connectionHandle ) throws SQLException { boolean tryAgain = false ; Connection result = null ; Connection oldRawConnection = connectionHandle . getInternalConnection ( ) ; String url = this . getConfig ( ) . getJdbcUrl ( ) ; int acquireRetryAttempts = thi... | Obtains a database connection retrying if necessary . |
150,121 | protected void registerUnregisterJMX ( boolean doRegister ) { if ( this . mbs == null ) { this . mbs = ManagementFactory . getPlatformMBeanServer ( ) ; } try { String suffix = "" ; if ( this . config . getPoolName ( ) != null ) { suffix = "-" + this . config . getPoolName ( ) ; } ObjectName name = new ObjectName ( MBEA... | Initialises JMX stuff . |
150,122 | protected void watchConnection ( ConnectionHandle connectionHandle ) { String message = captureStackTrace ( UNCLOSED_EXCEPTION_MESSAGE ) ; this . closeConnectionExecutor . submit ( new CloseThreadMonitor ( Thread . currentThread ( ) , connectionHandle , message , this . closeConnectionWatchTimeoutInMs ) ) ; } | Starts off a new thread to monitor this connection attempt . |
150,123 | public ListenableFuture < Connection > getAsyncConnection ( ) { return this . asyncExecutor . submit ( new Callable < Connection > ( ) { public Connection call ( ) throws Exception { return getConnection ( ) ; } } ) ; } | Obtain a connection asynchronously by queueing a request to obtain a connection in a separate thread . |
150,124 | protected void maybeSignalForMoreConnections ( ConnectionPartition connectionPartition ) { if ( ! connectionPartition . isUnableToCreateMoreTransactions ( ) && ! this . poolShuttingDown && connectionPartition . getAvailableConnections ( ) * 100 / connectionPartition . getMaxConnections ( ) <= this . poolAvailabilityThr... | Tests if this partition has hit a threshold and signal to the pool watch thread to create new connections |
150,125 | protected void internalReleaseConnection ( ConnectionHandle connectionHandle ) throws SQLException { if ( ! this . cachedPoolStrategy ) { connectionHandle . clearStatementCaches ( false ) ; } if ( connectionHandle . getReplayLog ( ) != null ) { connectionHandle . getReplayLog ( ) . clear ( ) ; connectionHandle . recove... | Release a connection by placing the connection back in the pool . |
150,126 | protected void putConnectionBackInPartition ( ConnectionHandle connectionHandle ) throws SQLException { if ( this . cachedPoolStrategy && ( ( CachedConnectionStrategy ) this . connectionStrategy ) . tlConnections . dumbGet ( ) . getValue ( ) ) { connectionHandle . logicallyClosed . set ( true ) ; ( ( CachedConnectionSt... | Places a connection back in the originating partition . |
150,127 | public boolean isConnectionHandleAlive ( ConnectionHandle connection ) { Statement stmt = null ; boolean result = false ; boolean logicallyClosed = connection . logicallyClosed . get ( ) ; try { connection . logicallyClosed . compareAndSet ( true , false ) ; String testStatement = this . config . getConnectionTestState... | Sends a dummy statement to the server to keep the connection alive |
150,128 | public int getTotalLeased ( ) { int total = 0 ; for ( int i = 0 ; i < this . partitionCount && this . partitions [ i ] != null ; i ++ ) { total += this . partitions [ i ] . getCreatedConnections ( ) - this . partitions [ i ] . getAvailableConnections ( ) ; } return total ; } | Return total number of connections currently in use by an application |
150,129 | public int getTotalCreatedConnections ( ) { int total = 0 ; for ( int i = 0 ; i < this . partitionCount && this . partitions [ i ] != null ; i ++ ) { total += this . partitions [ i ] . getCreatedConnections ( ) ; } return total ; } | Return total number of connections created in all partitions . |
150,130 | protected void addFreeConnection ( ConnectionHandle connectionHandle ) throws SQLException { connectionHandle . setOriginatingPartition ( this ) ; updateCreatedConnections ( 1 ) ; if ( ! this . disableTracking ) { trackConnectionFinalizer ( connectionHandle ) ; } if ( ! this . freeConnections . offer ( connectionHandle... | Adds a free connection . |
150,131 | public void terminateAllConnections ( ) { this . terminationLock . lock ( ) ; try { for ( int i = 0 ; i < this . pool . partitionCount ; i ++ ) { this . pool . partitions [ i ] . setUnableToCreateMoreTransactions ( false ) ; List < ConnectionHandle > clist = new LinkedList < ConnectionHandle > ( ) ; this . pool . parti... | Closes off all connections in all partitions . |
150,132 | protected void queryTimerEnd ( String sql , long queryStartTime ) { if ( ( this . queryExecuteTimeLimit != 0 ) && ( this . connectionHook != null ) ) { long timeElapsed = ( System . nanoTime ( ) - queryStartTime ) ; if ( timeElapsed > this . queryExecuteTimeLimit ) { this . connectionHook . onQueryExecuteTimeLimitExcee... | Call the onQueryExecuteTimeLimitExceeded hook if necessary |
150,133 | public static MBeanServerConnection getMBeanServerConnection ( Process p , boolean startAgent ) { try { final JMXServiceURL serviceURL = getLocalConnectorAddress ( p , startAgent ) ; final JMXConnector connector = JMXConnectorFactory . connect ( serviceURL ) ; final MBeanServerConnection mbsc = connector . getMBeanServ... | Connects to a child JVM process |
150,134 | public static JMXServiceURL getLocalConnectorAddress ( Process p , boolean startAgent ) { return getLocalConnectorAddress ( Integer . toString ( getPid ( p ) ) , startAgent ) ; } | Returns the JMX connector address of a child process . |
150,135 | public final Jar setAttribute ( String name , String value ) { verifyNotSealed ( ) ; if ( jos != null ) throw new IllegalStateException ( "Manifest cannot be modified after entries are added." ) ; getManifest ( ) . getMainAttributes ( ) . putValue ( name , value ) ; return this ; } | Sets an attribute in the main section of the manifest . |
150,136 | public final Jar setAttribute ( String section , String name , String value ) { verifyNotSealed ( ) ; if ( jos != null ) throw new IllegalStateException ( "Manifest cannot be modified after entries are added." ) ; Attributes attr = getManifest ( ) . getAttributes ( section ) ; if ( attr == null ) { attr = new Attribute... | Sets an attribute in a non - main section of the manifest . |
150,137 | public Jar setListAttribute ( String name , Collection < ? > values ) { return setAttribute ( name , join ( values ) ) ; } | Sets an attribute in the main section of the manifest to a list . The list elements will be joined with a single whitespace character . |
150,138 | public Jar setMapAttribute ( String name , Map < String , ? > values ) { return setAttribute ( name , join ( values ) ) ; } | Sets an attribute in the main section of the manifest to a map . The map entries will be joined with a single whitespace character and each key - value pair will be joined with a = . |
150,139 | public String getAttribute ( String section , String name ) { Attributes attr = getManifest ( ) . getAttributes ( section ) ; return attr != null ? attr . getValue ( name ) : null ; } | Returns an attribute s value from a non - main section of this JAR s manifest . |
150,140 | public List < String > getListAttribute ( String section , String name ) { return split ( getAttribute ( section , name ) ) ; } | Returns an attribute s list value from a non - main section of this JAR s manifest . The attributes string value will be split on whitespace into the returned list . The returned list may be safely modified . |
150,141 | public Map < String , String > getMapAttribute ( String name , String defaultValue ) { return mapSplit ( getAttribute ( name ) , defaultValue ) ; } | Returns an attribute s map value from this JAR s manifest s main section . The attributes string value will be split on whitespace into map entries and each entry will be split on = to get the key - value pair . The returned map may be safely modified . |
150,142 | public Jar addClass ( Class < ? > clazz ) throws IOException { final String resource = clazz . getName ( ) . replace ( '.' , '/' ) + ".class" ; return addEntry ( resource , clazz . getClassLoader ( ) . getResourceAsStream ( resource ) ) ; } | Adds a class entry to this JAR . |
150,143 | public Jar addPackageOf ( Class < ? > clazz , Filter filter ) throws IOException { try { final String path = clazz . getPackage ( ) . getName ( ) . replace ( '.' , '/' ) ; URL dirURL = clazz . getClassLoader ( ) . getResource ( path ) ; if ( dirURL != null && dirURL . getProtocol ( ) . equals ( "file" ) ) addDir ( Path... | Adds the contents of a Java package to this JAR . |
150,144 | public Jar setJarPrefix ( String value ) { verifyNotSealed ( ) ; if ( jos != null ) throw new IllegalStateException ( "Really executable cannot be set after entries are added." ) ; if ( value != null && jarPrefixFile != null ) throw new IllegalStateException ( "A prefix has already been set (" + jarPrefixFile + ")" ) ;... | Sets a string that will be prepended to the JAR file s data . |
150,145 | public Jar setJarPrefix ( Path file ) { verifyNotSealed ( ) ; if ( jos != null ) throw new IllegalStateException ( "Really executable cannot be set after entries are added." ) ; if ( file != null && jarPrefixStr != null ) throw new IllegalStateException ( "A prefix has already been set (" + jarPrefixStr + ")" ) ; this ... | Sets a file whose contents will be prepended to the JAR file s data . |
150,146 | public < T extends OutputStream > T write ( T os ) throws IOException { close ( ) ; if ( ! ( this . os instanceof ByteArrayOutputStream ) ) throw new IllegalStateException ( "Cannot write to another target if setOutputStream has been called" ) ; final byte [ ] content = ( ( ByteArrayOutputStream ) this . os ) . toByteA... | Writes this JAR to an output stream and closes the stream . |
150,147 | public Capsule newCapsule ( String mode , Path wrappedJar ) { final String oldMode = properties . getProperty ( PROP_MODE ) ; final ClassLoader oldCl = Thread . currentThread ( ) . getContextClassLoader ( ) ; Thread . currentThread ( ) . setContextClassLoader ( capsuleClass . getClassLoader ( ) ) ; try { setProperty ( ... | Creates a new capsule |
150,148 | @ SuppressWarnings ( "unchecked" ) public static Map < String , List < Path > > findJavaHomes ( ) { try { return ( Map < String , List < Path > > ) accessible ( Class . forName ( CAPSULE_CLASS_NAME ) . getDeclaredMethod ( "getJavaHomes" ) ) . invoke ( null ) ; } catch ( ReflectiveOperationException e ) { throw new Asse... | Returns all known Java installations |
150,149 | public static List < String > enableJMX ( List < String > jvmArgs ) { final String arg = "-D" + OPT_JMX_REMOTE ; if ( jvmArgs . contains ( arg ) ) return jvmArgs ; final List < String > cmdLine2 = new ArrayList < > ( jvmArgs ) ; cmdLine2 . add ( arg ) ; return cmdLine2 ; } | Adds an option to the JVM arguments to enable JMX connection |
150,150 | public final void setVolumeByIncrement ( float level ) throws IOException { Volume volume = this . getStatus ( ) . volume ; float total = volume . level ; if ( volume . increment <= 0f ) { throw new ChromeCastException ( "Volume.increment is <= 0" ) ; } if ( level > total ) { while ( total < level ) { total = Math . mi... | ChromeCast does not allow you to jump levels too quickly to avoid blowing speakers . Setting by increment allows us to easily get the level we want |
150,151 | private void connect ( ) throws IOException , GeneralSecurityException { synchronized ( closedSync ) { if ( socket == null || socket . isClosed ( ) ) { SSLContext sc = SSLContext . getInstance ( "SSL" ) ; sc . init ( null , new TrustManager [ ] { new X509TrustAllManager ( ) } , new SecureRandom ( ) ) ; socket = sc . ge... | Establish connection to the ChromeCast device |
150,152 | public static ExecutorService newSingleThreadDaemonExecutor ( ) { return Executors . newSingleThreadExecutor ( r -> { Thread t = Executors . defaultThreadFactory ( ) . newThread ( r ) ; t . setDaemon ( true ) ; return t ; } ) ; } | Creates an Executor that is based on daemon threads . This allows the program to quit without explicitly calling shutdown on the pool |
150,153 | public static ScheduledExecutorService newScheduledDaemonThreadPool ( int corePoolSize ) { return Executors . newScheduledThreadPool ( corePoolSize , r -> { Thread t = Executors . defaultThreadFactory ( ) . newThread ( r ) ; t . setDaemon ( true ) ; return t ; } ) ; } | Creates a scheduled thread pool where each thread has the daemon property set to true . This allows the program to quit without explicitly calling shutdown on the pool |
150,154 | private static MenuDrawer createMenuDrawer ( Activity activity , int dragMode , Position position , Type type ) { MenuDrawer drawer ; if ( type == Type . STATIC ) { drawer = new StaticDrawer ( activity ) ; } else if ( type == Type . OVERLAY ) { drawer = new OverlayDrawer ( activity , dragMode ) ; if ( position == Posit... | Constructs the appropriate MenuDrawer based on the position . |
150,155 | private static void attachToContent ( Activity activity , MenuDrawer menuDrawer ) { ViewGroup content = ( ViewGroup ) activity . findViewById ( android . R . id . content ) ; content . removeAllViews ( ) ; content . addView ( menuDrawer , LayoutParams . MATCH_PARENT , LayoutParams . MATCH_PARENT ) ; } | Attaches the menu drawer to the content view . |
150,156 | private static void attachToDecor ( Activity activity , MenuDrawer menuDrawer ) { ViewGroup decorView = ( ViewGroup ) activity . getWindow ( ) . getDecorView ( ) ; ViewGroup decorChild = ( ViewGroup ) decorView . getChildAt ( 0 ) ; decorView . removeAllViews ( ) ; decorView . addView ( menuDrawer , LayoutParams . MATCH... | Attaches the menu drawer to the window . |
150,157 | public void setActiveView ( View v , int position ) { final View oldView = mActiveView ; mActiveView = v ; mActivePosition = position ; if ( mAllowIndicatorAnimation && oldView != null ) { startAnimatingIndicator ( ) ; } invalidate ( ) ; } | Set the active view . If the mdActiveIndicator attribute is set this View will have the indicator drawn next to it . |
150,158 | private int getIndicatorStartPos ( ) { switch ( getPosition ( ) ) { case TOP : return mIndicatorClipRect . left ; case RIGHT : return mIndicatorClipRect . top ; case BOTTOM : return mIndicatorClipRect . left ; default : return mIndicatorClipRect . top ; } } | Returns the start position of the indicator . |
150,159 | private void animateIndicatorInvalidate ( ) { if ( mIndicatorScroller . computeScrollOffset ( ) ) { mIndicatorOffset = mIndicatorScroller . getCurr ( ) ; invalidate ( ) ; if ( ! mIndicatorScroller . isFinished ( ) ) { postOnAnimation ( mIndicatorRunnable ) ; return ; } } completeAnimatingIndicator ( ) ; } | Callback when each frame in the indicator animation should be drawn . |
150,160 | public void setDropShadowColor ( int color ) { GradientDrawable . Orientation orientation = getDropShadowOrientation ( ) ; final int endColor = color & 0x00FFFFFF ; mDropShadowDrawable = new GradientDrawable ( orientation , new int [ ] { color , endColor , } ) ; invalidate ( ) ; } | Sets the color of the drop shadow . |
150,161 | public void setSlideDrawable ( Drawable drawable ) { mSlideDrawable = new SlideDrawable ( drawable ) ; mSlideDrawable . setIsRtl ( ViewHelper . getLayoutDirection ( this ) == LAYOUT_DIRECTION_RTL ) ; if ( mActionBarHelper != null ) { mActionBarHelper . setDisplayShowHomeAsUpEnabled ( true ) ; if ( mDrawerIndicatorEnabl... | Sets the drawable used as the drawer indicator . |
150,162 | public ViewGroup getContentContainer ( ) { if ( mDragMode == MENU_DRAG_CONTENT ) { return mContentContainer ; } else { return ( ViewGroup ) findViewById ( android . R . id . content ) ; } } | Returns the ViewGroup used as a parent for the content view . |
150,163 | public void setMenuView ( int layoutResId ) { mMenuContainer . removeAllViews ( ) ; mMenuView = LayoutInflater . from ( getContext ( ) ) . inflate ( layoutResId , mMenuContainer , false ) ; mMenuContainer . addView ( mMenuView ) ; } | Set the menu view from a layout resource . |
150,164 | public void onClick ( View v ) { String tag = ( String ) v . getTag ( ) ; mContentTextView . setText ( String . format ( "%s clicked." , tag ) ) ; mMenuDrawer . setActiveView ( v ) ; } | Click handler for bottom drawer items . |
150,165 | protected void animateOffsetTo ( int position , int velocity , boolean animate ) { endDrag ( ) ; endPeek ( ) ; final int startX = ( int ) mOffsetPixels ; final int dx = position - startX ; if ( dx == 0 || ! animate ) { setOffsetPixels ( position ) ; setDrawerState ( position == 0 ? STATE_CLOSED : STATE_OPEN ) ; stopLay... | Moves the drawer to the position passed . |
150,166 | public ParsedWord pollParsedWord ( ) { if ( hasNextWord ( ) ) { if ( parsedLine . words ( ) . size ( ) > ( word + 1 ) ) character = parsedLine . words ( ) . get ( word + 1 ) . lineIndex ( ) ; else character = - 1 ; return parsedLine . words ( ) . get ( word ++ ) ; } else return new ParsedWord ( null , - 1 ) ; } | Polls the next ParsedWord from the stack . |
150,167 | public char pollChar ( ) { if ( hasNextChar ( ) ) { if ( hasNextWord ( ) && character + 1 >= parsedLine . words ( ) . get ( word ) . lineIndex ( ) + parsedLine . words ( ) . get ( word ) . word ( ) . length ( ) ) word ++ ; return parsedLine . line ( ) . charAt ( character ++ ) ; } return '\u0000' ; } | Polls the next char from the stack |
150,168 | public void updateIteratorPosition ( int length ) { if ( length > 0 ) { if ( ( length + character ) > parsedLine . line ( ) . length ( ) ) length = parsedLine . line ( ) . length ( ) - character ; while ( hasNextWord ( ) && ( length + character ) >= parsedLine . words ( ) . get ( word ) . lineIndex ( ) + parsedLine . w... | Update the current position with specified length . The input will append to the current position of the iterator . |
150,169 | public String printHelp ( ) { List < CommandLineParser < CI > > parsers = getChildParsers ( ) ; if ( parsers != null && parsers . size ( ) > 0 ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( processedCommand . printHelp ( helpNames ( ) ) ) . append ( Config . getLineSeparator ( ) ) . append ( processedComm... | Returns a usage String based on the defined command and options . Useful when printing help info etc . |
150,170 | public void parse ( String line , Mode mode ) { parse ( lineParser . parseLine ( line , line . length ( ) ) . iterator ( ) , mode ) ; } | Parse a command line with the defined command as base of the rules . If any options are found but not defined in the command object an CommandLineParserException will be thrown . Also if a required option is not found or options specified with value but is not given any value an CommandLineParserException will be throw... |
150,171 | public void populateObject ( ProcessedCommand < Command < CI > , CI > processedCommand , InvocationProviders invocationProviders , AeshContext aeshContext , CommandLineParser . Mode mode ) throws CommandLineParserException , OptionValidatorException { if ( processedCommand . parserExceptions ( ) . size ( ) > 0 && mode ... | Populate a Command instance with the values parsed from a command line If any parser errors are detected it will throw an exception |
150,172 | public List < TerminalString > getOptionLongNamesWithDash ( ) { List < ProcessedOption > opts = getOptions ( ) ; List < TerminalString > names = new ArrayList < > ( opts . size ( ) ) ; for ( ProcessedOption o : opts ) { if ( o . getValues ( ) . size ( ) == 0 && o . activator ( ) . isActivated ( new ParsedCommand ( this... | Return all option names that not already have a value and is enabled |
150,173 | public String printHelp ( String commandName ) { int maxLength = 0 ; int width = 80 ; List < ProcessedOption > opts = getOptions ( ) ; for ( ProcessedOption o : opts ) { if ( o . getFormattedLength ( ) > maxLength ) maxLength = o . getFormattedLength ( ) ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( "Usa... | Returns a description String based on the defined command and options . Useful when printing help info etc . |
150,174 | public boolean hasUniqueLongOption ( String optionName ) { if ( hasLongOption ( optionName ) ) { for ( ProcessedOption o : getOptions ( ) ) { if ( o . name ( ) . startsWith ( optionName ) && ! o . name ( ) . equals ( optionName ) ) return false ; } return true ; } return false ; } | not start with another option name |
150,175 | public void seek ( final int position ) throws IOException { if ( position < 0 ) { throw new IllegalArgumentException ( "position < 0: " + position ) ; } if ( position > size ) { throw new EOFException ( ) ; } this . pointer = position ; } | Sets the file - pointer offset measured from the beginning of this file at which the next read or write occurs . |
150,176 | public EditMode editMode ( ) { if ( readInputrc ) { try { return EditModeBuilder . builder ( ) . parseInputrc ( new FileInputStream ( inputrc ( ) ) ) . create ( ) ; } catch ( FileNotFoundException e ) { return EditModeBuilder . builder ( mode ( ) ) . create ( ) ; } } else return EditModeBuilder . builder ( mode ( ) ) .... | Get EditMode based on os and mode |
150,177 | public String logFile ( ) { if ( logFile == null ) { logFile = Config . getTmpDir ( ) + Config . getPathSeparator ( ) + "aesh.log" ; } return logFile ; } | Get log file |
150,178 | public void detect ( final String ... packageNames ) throws IOException { final String [ ] pkgNameFilter = new String [ packageNames . length ] ; for ( int i = 0 ; i < pkgNameFilter . length ; ++ i ) { pkgNameFilter [ i ] = packageNames [ i ] . replace ( '.' , '/' ) ; if ( ! pkgNameFilter [ i ] . endsWith ( "/" ) ) { p... | Report all Java ClassFile files available on the class path within the specified packages and sub packages . |
150,179 | private void addReverse ( final File [ ] files ) { for ( int i = files . length - 1 ; i >= 0 ; -- i ) { stack . add ( files [ i ] ) ; } } | Add the specified files in reverse order . |
150,180 | public < C extends Contextual < I > , I > C getContextual ( String id ) { return this . < C , I > getContextual ( new StringBeanIdentifier ( id ) ) ; } | Given a particular id return the correct contextual . For contextuals which aren t passivation capable the contextual can t be found in another container and null will be returned . |
150,181 | private void processDestructionQueue ( HttpServletRequest request ) { Object contextsAttribute = request . getAttribute ( DESTRUCTION_QUEUE_ATTRIBUTE_NAME ) ; if ( contextsAttribute instanceof Map ) { Map < String , List < ContextualInstance < ? > > > contexts = cast ( contextsAttribute ) ; synchronized ( contexts ) { ... | If needed destroy the remaining conversation contexts after an HTTP session was invalidated within the current request . |
150,182 | public static void unregisterContextualInstance ( EjbDescriptor < ? > descriptor ) { Set < Class < ? > > classes = CONTEXTUAL_SESSION_BEANS . get ( ) ; classes . remove ( descriptor . getBeanClass ( ) ) ; if ( classes . isEmpty ( ) ) { CONTEXTUAL_SESSION_BEANS . remove ( ) ; } } | Indicates that contextual session bean instance has been constructed . |
150,183 | protected Object [ ] getParameterValues ( Object specialVal , BeanManagerImpl manager , CreationalContext < ? > ctx , CreationalContext < ? > transientReferenceContext ) { if ( getInjectionPoints ( ) . isEmpty ( ) ) { if ( specialInjectionPointIndex == - 1 ) { return Arrays2 . EMPTY_ARRAY ; } else { return new Object [... | Helper method for getting the current parameter values from a list of annotated parameters . |
150,184 | public Set < ? extends AbstractBean < ? , ? > > resolveSpecializedBeans ( Bean < ? > specializingBean ) { if ( specializingBean instanceof AbstractClassBean < ? > ) { AbstractClassBean < ? > abstractClassBean = ( AbstractClassBean < ? > ) specializingBean ; if ( abstractClassBean . isSpecializing ( ) ) { return special... | Returns a set of beans specialized by this bean . An empty set is returned if this bean does not specialize another beans . |
150,185 | private void addHandlerInitializerMethod ( ClassFile proxyClassType , ClassMethod staticConstructor ) throws Exception { ClassMethod classMethod = proxyClassType . addMethod ( AccessFlag . PRIVATE , INIT_MH_METHOD_NAME , BytecodeUtils . VOID_CLASS_DESCRIPTOR , LJAVA_LANG_OBJECT ) ; final CodeAttribute b = classMethod .... | calls _initMH on the method handler and then stores the result in the methodHandler field as then new methodHandler |
150,186 | private static boolean isEqual ( Method m , Method a ) { if ( m . getName ( ) . equals ( a . getName ( ) ) && m . getParameterTypes ( ) . length == a . getParameterTypes ( ) . length && m . getReturnType ( ) . isAssignableFrom ( a . getReturnType ( ) ) ) { for ( int i = 0 ; i < m . getParameterTypes ( ) . length ; i ++... | m is more generic than a |
150,187 | protected CDI11Deployment createDeployment ( ServletContext context , CDI11Bootstrap bootstrap ) { ImmutableSet . Builder < Metadata < Extension > > extensionsBuilder = ImmutableSet . builder ( ) ; extensionsBuilder . addAll ( bootstrap . loadExtensions ( WeldResourceLoader . getClassLoader ( ) ) ) ; if ( isDevModeEnab... | Create servlet deployment . |
150,188 | protected Container findContainer ( ContainerContext ctx , StringBuilder dump ) { Container container = null ; String containerClassName = ctx . getServletContext ( ) . getInitParameter ( Container . CONTEXT_PARAM_CONTAINER_CLASS ) ; if ( containerClassName != null ) { try { Class < Container > containerClass = Reflect... | Find container env . |
150,189 | private Resolvable createMetadataProvider ( Class < ? > rawType ) { Set < Type > types = Collections . < Type > singleton ( rawType ) ; return new ResolvableImpl ( rawType , types , declaringBean , qualifierInstances , delegate ) ; } | just as facade but we keep the qualifiers so that we can recognize Bean from |
150,190 | private boolean hasAbstractPackagePrivateSuperClassWithImplementation ( Class < ? > clazz , BridgeMethod bridgeMethod ) { Class < ? > superClass = clazz . getSuperclass ( ) ; while ( superClass != null ) { if ( Modifier . isAbstract ( superClass . getModifiers ( ) ) && Reflections . isPackagePrivate ( superClass . getM... | Returns true if super class of the parameter exists and is abstract and package private . In such case we want to omit such method . |
150,191 | protected void addSpecialMethods ( ClassFile proxyClassType , ClassMethod staticConstructor ) { try { for ( Method method : LifecycleMixin . class . getMethods ( ) ) { BeanLogger . LOG . addingMethodToProxy ( method ) ; MethodInformation methodInfo = new RuntimeMethodInformation ( method ) ; createInterceptorBody ( pro... | Adds methods requiring special implementations rather than just delegation . |
150,192 | public static void checkDelegateType ( Decorator < ? > decorator ) { Set < Type > types = new HierarchyDiscovery ( decorator . getDelegateType ( ) ) . getTypeClosure ( ) ; for ( Type decoratedType : decorator . getDecoratedTypes ( ) ) { if ( ! types . contains ( decoratedType ) ) { throw BeanLogger . LOG . delegateMust... | Check whether the delegate type implements or extends all decorated types . |
150,193 | public static < T > void checkAbstractMethods ( Set < Type > decoratedTypes , EnhancedAnnotatedType < T > type , BeanManagerImpl beanManager ) { if ( decoratedTypes == null ) { decoratedTypes = new HashSet < Type > ( type . getInterfaceClosure ( ) ) ; decoratedTypes . remove ( Serializable . class ) ; } Set < MethodSig... | Check all abstract methods are declared by the decorated types . |
150,194 | public void checkSpecialization ( ) { if ( isSpecializing ( ) ) { boolean isNameDefined = getAnnotated ( ) . isAnnotationPresent ( Named . class ) ; String previousSpecializedBeanName = null ; for ( AbstractBean < ? , ? > specializedBean : getSpecializedBeans ( ) ) { String name = specializedBean . getName ( ) ; if ( p... | Validates specialization if this bean specializes another bean . |
150,195 | public void fireEvent ( Type eventType , Object event , Annotation ... qualifiers ) { final EventMetadata metadata = new EventMetadataImpl ( eventType , null , qualifiers ) ; notifier . fireEvent ( eventType , event , metadata , qualifiers ) ; } | Fire an event and notify observers that belong to this module . |
150,196 | @ SuppressWarnings ( "unchecked" ) public static < T > T getJlsDefaultValue ( Class < T > type ) { if ( ! type . isPrimitive ( ) ) { return null ; } return ( T ) JLS_PRIMITIVE_DEFAULT_VALUES . get ( type ) ; } | See also JLS8 4 . 12 . 5 Initial Values of Variables . |
150,197 | public void afterDeploymentValidation ( @ Priority ( 1 ) AfterDeploymentValidation event , BeanManager beanManager ) { BeanManagerImpl manager = BeanManagerProxy . unwrap ( beanManager ) ; probe . init ( manager ) ; if ( isJMXSupportEnabled ( manager ) ) { try { MBeanServer mbs = ManagementFactory . getPlatformMBeanSer... | any possible bean invocations from other ADV observers |
150,198 | static boolean matchPath ( String [ ] tokenizedPattern , String [ ] strDirs , boolean isCaseSensitive ) { int patIdxStart = 0 ; int patIdxEnd = tokenizedPattern . length - 1 ; int strIdxStart = 0 ; int strIdxEnd = strDirs . length - 1 ; while ( patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd ) { String patDir = to... | Core implementation of matchPath . It is isolated so that it can be called from TokenizedPattern . |
150,199 | static String [ ] tokenize ( String str ) { char sep = '.' ; int start = 0 ; int len = str . length ( ) ; int count = 0 ; for ( int pos = 0 ; pos < len ; pos ++ ) { if ( str . charAt ( pos ) == sep ) { if ( pos != start ) { count ++ ; } start = pos + 1 ; } } if ( len != start ) { count ++ ; } String [ ] l = new String ... | Tokenize the the string as a package hierarchy |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.