idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
18,300
protected void fire ( ActionRuntime runtime ) throws IOException , ServletException { final ActionResponseReflector reflector = createResponseReflector ( runtime ) ; ready ( runtime , reflector ) ; final OptionalThing < VirtualForm > form = prepareActionForm ( runtime ) ; populateParameter ( runtime , form ) ; final Vi...
Fire the action creating populating performing and to next .
18,301
protected GsonJsonEngine createGsonJsonEngine ( JsonEngineResource resource ) { final boolean serializeNulls = isGsonSerializeNulls ( ) ; final boolean prettyPrinting = isGsonPrettyPrinting ( ) ; final Consumer < GsonBuilder > builderSetupper = prepareGsonBuilderSetupper ( serializeNulls , prettyPrinting ) ; final Cons...
mappingOption is specified for another engine
18,302
public static BegunTx < ? > getBegunTxOnThread ( ) { final Stack < BegunTx < ? > > stack = threadLocal . get ( ) ; return stack != null ? stack . peek ( ) : null ; }
Get prepared begun - tx on thread .
18,303
public static void setBegunTxOnThread ( BegunTx < ? > begunTx ) { if ( begunTx == null ) { String msg = "The argument[begunTx] must not be null." ; throw new IllegalArgumentException ( msg ) ; } Stack < BegunTx < ? > > stack = threadLocal . get ( ) ; if ( stack == null ) { stack = new Stack < BegunTx < ? > > ( ) ; thre...
Set prepared begun - tx on thread .
18,304
public static boolean existsBegunTxOnThread ( ) { final Stack < BegunTx < ? > > stack = threadLocal . get ( ) ; return stack != null ? ! stack . isEmpty ( ) : false ; }
Is existing prepared begun - tx on thread?
18,305
public static void clearBegunTxOnThread ( ) { final Stack < BegunTx < ? > > stack = threadLocal . get ( ) ; if ( stack != null ) { stack . pop ( ) ; if ( stack . isEmpty ( ) ) { perfectlyClear ( ) ; } } }
Clear prepared begun - tx on thread .
18,306
public static RomanticTransaction getRomanticTransaction ( ) { final Stack < RomanticTransaction > stack = threadLocal . get ( ) ; return stack != null ? stack . peek ( ) : null ; }
Get the value of the romantic transaction .
18,307
public static void setRomanticTransaction ( RomanticTransaction romanticTransaction ) { if ( romanticTransaction == null ) { String msg = "The argument 'romanticTransaction' should not be null." ; throw new IllegalArgumentException ( msg ) ; } Stack < RomanticTransaction > stack = threadLocal . get ( ) ; if ( stack == ...
Set the value of the romantic transaction .
18,308
private boolean visitColumnsAndColumnFacets ( VisitContext context , VisitCallback callback , boolean visitRows ) { if ( visitRows ) { setRowIndex ( - 1 ) ; } if ( getChildCount ( ) > 0 ) { for ( UIComponent column : getChildren ( ) ) { if ( column instanceof UIColumn ) { VisitResult result = context . invokeVisitCallb...
Visit each UIColumn and any facets it may have defined exactly once
18,309
private boolean visitRows ( VisitContext context , VisitCallback callback , boolean visitRows ) { int processed = 0 ; int rowIndex = 0 ; int rows = 0 ; if ( visitRows ) { rowIndex = getFirst ( ) - 1 ; rows = getRows ( ) ; } while ( true ) { if ( visitRows ) { if ( ( rows > 0 ) && ( ++ processed > rows ) ) { break ; } s...
Visit each column and row
18,310
public boolean isForwardToHtml ( ) { if ( ! isHtmlResponse ( ) ) { return false ; } final HtmlResponse htmlResponse = ( ( HtmlResponse ) actionResponse ) ; return ! htmlResponse . isRedirectTo ( ) && isHtmlTemplateResponse ( htmlResponse ) ; }
Is the result of the action execute forward to HTML template?
18,311
public boolean handleActionPath ( String requestPath , ActionFoundPathHandler handler ) throws Exception { assertArgumentNotNull ( "requestPath" , requestPath ) ; assertArgumentNotNull ( "handler" , handler ) ; final MappingPathResource pathResource = customizeActionMapping ( requestPath ) ; return mappingActionPath ( ...
Handle the action path from the specified request path .
18,312
public synchronized String encrypt ( String plainText ) { assertArgumentNotNull ( "plainText" , plainText ) ; if ( encryptingCipher == null ) { initialize ( ) ; } return new String ( encodeHex ( doEncrypt ( plainText ) ) ) ; }
Encrypt the text as invertible .
18,313
public UrlChain moreUrl ( Object ... urlParts ) { final String argTitle = "urlParts" ; assertArgumentNotNull ( argTitle , urlParts ) ; checkWrongUrlChainUse ( argTitle , urlParts ) ; this . urlParts = urlParts ; return this ; }
Set up more URL parts as URL chain .
18,314
public UrlChain params ( Object ... paramsOnGet ) { final String argTitle = "paramsOnGet" ; assertArgumentNotNull ( argTitle , paramsOnGet ) ; checkWrongUrlChainUse ( argTitle , paramsOnGet ) ; this . paramsOnGet = paramsOnGet ; return this ; }
Set up parameters on GET as URL chain .
18,315
protected void assertArgumentNotNull ( String argumentName , Object value ) { if ( argumentName == null ) { String msg = "The argument name should not be null: argName=null value=" + value ; throw new IllegalArgumentException ( msg ) ; } if ( value == null ) { String msg = "The value should not be null: argName=" + arg...
Assert that the argument is not null .
18,316
public BigDecimal toBigDecimal ( ) { int scale = 0 ; String text = getIntegerPart ( ) ; String t_fraction = getFractionalPart ( ) ; if ( t_fraction != null ) { text += getFractionalPart ( ) ; scale += t_fraction . length ( ) ; } String t_exponent = getExponent ( ) ; if ( t_exponent != null ) scale -= Integer . parseInt...
So it turns out that parsing arbitrary bases into arbitrary precision numbers is nontrivial and this routine gets it wrong in many important cases .
18,317
protected void handleSqlCount ( ActionRuntime runtime ) { final CallbackContext context = CallbackContext . getCallbackContextOnThread ( ) ; if ( context == null ) { return ; } final SqlStringFilter filter = context . getSqlStringFilter ( ) ; if ( filter == null || ! ( filter instanceof ExecutedSqlCounter ) ) { return ...
Handle count of SQL execution in the request .
18,318
protected void handleTooManySqlExecution ( ActionRuntime runtime , ExecutedSqlCounter sqlCounter , int sqlExecutionCountLimit ) { final int totalCountOfSql = sqlCounter . getTotalCountOfSql ( ) ; final String actionDisp = buildActionDisp ( runtime ) ; logger . warn ( "*Too many SQL executions: {}/{} in {}" , totalCount...
Handle too many SQL executions .
18,319
protected void handleMailCount ( ActionRuntime runtime ) { if ( ThreadCacheContext . exists ( ) ) { final PostedMailCounter counter = ThreadCacheContext . findMailCounter ( ) ; if ( counter != null ) { saveRequestedMailCount ( counter ) ; } } }
Handle count of mail posting in the request .
18,320
protected void handleRemoteApiCount ( ActionRuntime runtime ) { if ( ThreadCacheContext . exists ( ) ) { final CalledRemoteApiCounter counter = ThreadCacheContext . findRemoteApiCounter ( ) ; if ( counter != null ) { saveRequestedRemoteApiCount ( counter ) ; } } }
Handle count of remoteApi calling in the request .
18,321
public UIComponent getFacet ( String name ) { if ( facets != null ) { return ( facets . get ( name ) ) ; } else { return ( null ) ; } }
Do not allocate the facets Map to answer this question
18,322
private Object saveBehaviorsState ( FacesContext context ) { Object state = null ; if ( null != behaviors && behaviors . size ( ) > 0 ) { boolean stateWritten = false ; Object [ ] attachedBehaviors = new Object [ behaviors . size ( ) ] ; int i = 0 ; for ( List < ClientBehavior > eventBehaviors : behaviors . values ( ) ...
Save state of the behaviors map .
18,323
@ SuppressWarnings ( "unchecked" ) public static < OBJ > OBJ getObject ( String key ) { if ( ! exists ( ) ) { throwThreadCacheNotInitializedException ( key ) ; } return ( OBJ ) threadLocal . get ( ) . get ( key ) ; }
Get the value of the object by the key .
18,324
public static void setObject ( String key , Object value ) { if ( ! exists ( ) ) { throwThreadCacheNotInitializedException ( key ) ; } threadLocal . get ( ) . put ( key , value ) ; }
Set the value of the object .
18,325
@ SuppressWarnings ( "unchecked" ) public static < OBJ > OBJ removeObject ( String key ) { if ( ! exists ( ) ) { throwThreadCacheNotInitializedException ( key ) ; } return ( OBJ ) threadLocal . get ( ) . remove ( key ) ; }
Remove the value of the object from the cache .
18,326
public static boolean determineObject ( String key ) { if ( ! exists ( ) ) { throwThreadCacheNotInitializedException ( key ) ; } final Object obj = threadLocal . get ( ) . get ( key ) ; return obj != null && ( boolean ) obj ; }
Determine the object as boolean .
18,327
public static void clearAccessContextOnThread ( ) { final Stack < AccessContext > stack = threadLocal . get ( ) ; if ( stack != null ) { stack . pop ( ) ; if ( stack . isEmpty ( ) ) { perfectlyClear ( ) ; } } }
Clear prepared access - context on thread .
18,328
public static void endAccessContext ( ) { AccessContext . clearAccessContextOnThread ( ) ; final AccessContext accessContext = SuspendedAccessContext . getAccessContextOnThread ( ) ; if ( accessContext != null ) { AccessContext . setAccessContextOnThread ( accessContext ) ; SuspendedAccessContext . clearAccessContextOn...
End access - context use for DBFlute .
18,329
protected TreeMap < String , Object > prepareOrderedMap ( Object form , Set < ConstraintViolation < Object > > vioSet ) { final Map < String , Object > vioPropMap = new HashMap < > ( vioSet . size ( ) ) ; for ( ConstraintViolation < Object > vio : vioSet ) { final String propertyPath = extractPropertyPath ( vio ) ; fin...
basically for batch display
18,330
public static boolean cannotBeValidatable ( Object value ) { return value instanceof String || value instanceof Number || DfTypeUtil . isAnyLocalDate ( value ) || value instanceof Boolean || value instanceof Classification || value . getClass ( ) . isPrimitive ( ) ; }
similar logic is on action response reflector
18,331
public String getPath ( ) { Source parent = getParent ( ) ; if ( parent != null ) return parent . getPath ( ) ; return null ; }
Returns the File currently being lexed .
18,332
public String getName ( ) { Source parent = getParent ( ) ; if ( parent != null ) return parent . getName ( ) ; return null ; }
Returns the human - readable name of the current Source .
18,333
public Token skipline ( boolean white ) throws IOException , LexerException { for ( ; ; ) { Token tok = token ( ) ; switch ( tok . getType ( ) ) { case EOF : warning ( tok . getLine ( ) , tok . getColumn ( ) , "No newline before end of file" ) ; return new Token ( NL , tok . getLine ( ) , tok . getColumn ( ) , "\n" ) ;...
Skips tokens until the end of line .
18,334
void notifyListenersOnStateChange ( ) { LOGGER . debug ( "Notifying connection listeners about state change to {}" , state ) ; for ( ConnectionListener listener : connectionListeners ) { switch ( state ) { case CONNECTED : listener . onConnectionEstablished ( connection ) ; break ; case CONNECTING : listener . onConnec...
Notifies all connection listener about a state change .
18,335
void establishConnection ( ) throws IOException { synchronized ( operationOnConnectionMonitor ) { if ( state == State . CLOSED ) { throw new IOException ( "Attempt to establish a connection with a closed connection factory" ) ; } else if ( state == State . CONNECTED ) { LOGGER . warn ( "Establishing new connection alth...
Establishes a new connection .
18,336
public static String sliceOf ( String str , int start , int end ) { return slc ( str , start , end ) ; }
Get slice of string
18,337
public static String slcEnd ( String str , int end ) { return FastStringUtils . noCopyStringFromChars ( Chr . slcEnd ( FastStringUtils . toCharArray ( str ) , end ) ) ; }
Gets end slice of a string .
18,338
public static char idx ( String str , int index ) { int i = calculateIndex ( str . length ( ) , index ) ; char c = str . charAt ( i ) ; return c ; }
Gets character at index
18,339
public static String idx ( String str , int index , char c ) { char [ ] chars = str . toCharArray ( ) ; Chr . idx ( chars , index , c ) ; return new String ( chars ) ; }
Puts character at index
18,340
public static boolean in ( char c , String str ) { return Chr . in ( c , FastStringUtils . toCharArray ( str ) ) ; }
See if a char is in another string
18,341
public static String add ( String str , String str2 ) { return FastStringUtils . noCopyStringFromChars ( Chr . add ( FastStringUtils . toCharArray ( str ) , FastStringUtils . toCharArray ( str2 ) ) ) ; }
Add one string to another
18,342
public static String add ( String ... strings ) { int length = 0 ; for ( String str : strings ) { if ( str == null ) { continue ; } length += str . length ( ) ; } CharBuf builder = CharBuf . createExact ( length ) ; for ( String str : strings ) { if ( str == null ) { continue ; } builder . add ( str ) ; } return builde...
Add many strings together to another
18,343
public static String sputl ( Object ... messages ) { CharBuf buf = CharBuf . create ( 100 ) ; return sputl ( buf , messages ) . toString ( ) ; }
like putl but writes to a string .
18,344
public static String sputs ( Object ... messages ) { CharBuf buf = CharBuf . create ( 80 ) ; return sputs ( buf , messages ) . toString ( ) ; }
Like puts but writes to a String .
18,345
public static CharBuf sputl ( CharBuf buf , Object ... messages ) { for ( Object message : messages ) { if ( message == null ) { buf . add ( "<NULL>" ) ; } else if ( message . getClass ( ) . isArray ( ) ) { buf . add ( toListOrSingletonList ( message ) . toString ( ) ) ; } else { buf . add ( message . toString ( ) ) ; ...
Writes to a char buf . A char buf is like a StringBuilder .
18,346
private Object parseFile ( File file , String scharset ) { Charset charset = scharset == null || scharset . length ( ) == 0 ? StandardCharsets . UTF_8 : Charset . forName ( scharset ) ; if ( file . length ( ) > 2_000_000 ) { try ( Reader reader = Files . newBufferedReader ( Classpaths . path ( file . toString ( ) ) , c...
Slight changes to remove groovy dependencies .
18,347
public static void puts ( Object ... messages ) { for ( Object message : messages ) { IO . print ( message ) ; if ( ! ( message instanceof Terminal . Escape ) ) IO . print ( ' ' ) ; } IO . println ( ) ; }
Like print but prints out a whole slew of objects on the same line .
18,348
private int compareOrder ( CacheEntry other ) { if ( order > other . order ) { return 1 ; } else if ( order < other . order ) { return - 1 ; } else if ( order == other . order ) { return 0 ; } die ( ) ; return 0 ; }
Compare the order .
18,349
private int compareToLFU ( CacheEntry other ) { int cmp = compareReadCount ( other ) ; if ( cmp != 0 ) { return cmp ; } cmp = compareTime ( other ) ; if ( cmp != 0 ) { return cmp ; } return compareOrder ( other ) ; }
Compares the read counts .
18,350
private int compareToLRU ( CacheEntry other ) { int cmp = compareTime ( other ) ; if ( cmp != 0 ) { return cmp ; } cmp = compareOrder ( other ) ; if ( cmp != 0 ) { return cmp ; } return compareReadCount ( other ) ; }
Compare the time .
18,351
private int compareToFIFO ( CacheEntry other ) { int cmp = compareOrder ( other ) ; if ( cmp != 0 ) { return cmp ; } cmp = compareTime ( other ) ; if ( cmp != 0 ) { return cmp ; } return cmp = compareReadCount ( other ) ; }
Compare for FIFO
18,352
@ SuppressWarnings ( "unchecked" ) public < T > T readBodyAs ( Class < T > type ) { if ( String . class . isAssignableFrom ( type ) ) { return ( T ) readBodyAsString ( ) ; } else if ( Number . class . isAssignableFrom ( type ) ) { return ( T ) readBodyAsNumber ( ( Class < Number > ) type ) ; } else if ( Boolean . class...
Extracts the message body and interprets it as the given Java type
18,353
public String readBodyAsString ( ) { Charset charset = readCharset ( ) ; byte [ ] bodyContent = message . getBodyContent ( ) ; return new String ( bodyContent , charset ) ; }
Extracts the message body and interprets it as a string .
18,354
@ SuppressWarnings ( "unchecked" ) public < T > T readBodyAsObject ( Class < T > type ) { Charset charset = readCharset ( ) ; InputStream inputStream = new ByteArrayInputStream ( message . getBodyContent ( ) ) ; InputStreamReader inputReader = new InputStreamReader ( inputStream , charset ) ; StreamSource streamSource ...
Extracts the message body and interprets it as the XML representation of an object of the given type .
18,355
public < T > void addEvent ( Class < T > eventType , PublisherConfiguration configuration ) { publisherConfigurations . put ( eventType , configuration ) ; }
Adds events of the given type to the CDI events to which the event publisher listens in order to publish them . The publisher configuration is used to decide where to and how to publish messages .
18,356
MessagePublisher providePublisher ( PublisherReliability reliability , Class < ? > eventType ) { Map < Class < ? > , MessagePublisher > localPublishers = publishers . get ( ) ; if ( localPublishers == null ) { localPublishers = new HashMap < Class < ? > , MessagePublisher > ( ) ; publishers . set ( localPublishers ) ; ...
Provides a publisher with the specified reliability . Within the same thread the same producer instance is provided for the given event type .
18,357
static Message buildMessage ( PublisherConfiguration publisherConfiguration , Object event ) { Message message = new Message ( publisherConfiguration . basicProperties ) . exchange ( publisherConfiguration . exchange ) . routingKey ( publisherConfiguration . routingKey ) ; if ( publisherConfiguration . persistent ) { m...
Builds a message based on a CDI event and its publisher configuration .
18,358
public < T > Message body ( T body , Charset charset ) { messageWriter . writeBody ( body , charset ) ; return this ; }
Serializes and adds the given object as body to the message using the given charset for encoding .
18,359
public Message contentEncoding ( String charset ) { basicProperties = basicProperties . builder ( ) . contentEncoding ( charset ) . build ( ) ; return this ; }
Sets the content charset encoding of this message .
18,360
public Message contentType ( String contentType ) { basicProperties = basicProperties . builder ( ) . contentType ( contentType ) . build ( ) ; return this ; }
Sets the content type of this message .
18,361
public void publish ( Channel channel , DeliveryOptions deliveryOptions ) throws IOException { if ( basicProperties . getTimestamp ( ) == null ) { basicProperties . builder ( ) . timestamp ( new Date ( ) ) ; } boolean mandatory = deliveryOptions == DeliveryOptions . MANDATORY ; boolean immediate = deliveryOptions == De...
Publishes a message via the given channel while using the specified delivery options .
18,362
@ SuppressWarnings ( "unchecked" ) Object buildEvent ( Message message ) { Object event = eventPool . get ( ) ; if ( event instanceof ContainsData ) { ( ( ContainsData ) event ) . setData ( message . getBodyContent ( ) ) ; } else if ( event instanceof ContainsContent ) { Class < ? > parameterType = getParameterType ( e...
Builds a CDI event from a message . The CDI event instance is retrieved from the injection container .
18,363
@ SuppressWarnings ( "unchecked" ) static Class < ? > getParameterType ( Object object , Class < ? > expectedType ) { Collection < Class < ? > > extendedAndImplementedTypes = getExtendedAndImplementedTypes ( object . getClass ( ) , new LinkedList < Class < ? > > ( ) ) ; for ( Class < ? > type : extendedAndImplementedTy...
Gets the type parameter of the expected generic interface which is actually used by the class of the given object . The generic interface can be implemented by an class or interface in the object s class hierarchy
18,364
static List < Class < ? > > getExtendedAndImplementedTypes ( Class < ? > clazz , List < Class < ? > > hierarchy ) { hierarchy . add ( clazz ) ; Class < ? > superClass = clazz . getSuperclass ( ) ; if ( superClass != null ) { hierarchy = getExtendedAndImplementedTypes ( superClass , hierarchy ) ; } for ( Class < ? > imp...
Gets all classes and interfaces in the class hierarchy of the given class including the class itself .
18,365
protected Channel provideChannel ( ) throws IOException { if ( channel == null || ! channel . isOpen ( ) ) { Connection connection = connectionFactory . newConnection ( ) ; channel = connection . createChannel ( ) ; } return channel ; }
Initializes a channel if there is not already an open channel .
18,366
protected void handleIoException ( int attempt , IOException ioException ) throws IOException { if ( channel != null && channel . isOpen ( ) ) { try { channel . close ( ) ; } catch ( IOException e ) { LOGGER . warn ( "Failed to close channel after failed publish" , e ) ; } } channel = null ; if ( attempt == DEFAULT_RET...
Handles an IOException depending on the already used attempts to send a message . Also performs a soft reset of the currently used channel .
18,367
public static String getSortableFieldFromClass ( Class < ? > clazz ) { String fieldName = getSortableField ( clazz ) ; if ( fieldName == null ) { for ( String name : fieldSortNames ) { if ( classHasStringField ( clazz , name ) ) { fieldName = name ; break ; } } if ( fieldName == null ) { for ( String name : fieldSortNa...
Gets the first sortable field .
18,368
public void configureFactory ( Class < ? > clazz ) { ConnectionConfiguration connectionConfiguration = resolveConnectionConfiguration ( clazz ) ; if ( connectionConfiguration == null ) { return ; } connectionFactory . setHost ( connectionConfiguration . host ( ) ) ; connectionFactory . setVirtualHost ( connectionConfig...
Configures the connection factory supplied by dependency injection using the connection configuration annotated at the given class .
18,369
private final void buildIfNeededMap ( ) { if ( map == null ) { map = new HashMap < > ( items . length ) ; for ( Entry < String , Value > miv : items ) { if ( miv == null ) { break ; } map . put ( miv . getKey ( ) , miv . getValue ( ) ) ; } } }
Build the map if requested to it does this lazily .
18,370
public static boolean respondsTo ( Object object , String method ) { if ( object instanceof Class ) { return Reflection . respondsTo ( ( Class ) object , method ) ; } else { return Reflection . respondsTo ( object , method ) ; } }
Checks to see if an object responds to a method . Helper facade over Reflection library .
18,371
public < T > void writeBodyFromObject ( T bodyAsObject , Charset charset ) { @ SuppressWarnings ( "unchecked" ) Class < T > clazz = ( Class < T > ) bodyAsObject . getClass ( ) ; ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; Writer outputWriter = new OutputStreamWriter ( outputStream , charset ) ;...
Writes the body by serializing the given object to XML .
18,372
public static boolean toBoolean ( Object obj , boolean defaultValue ) { if ( obj == null ) { return defaultValue ; } if ( obj instanceof Boolean ) { return ( ( Boolean ) obj ) . booleanValue ( ) ; } else if ( obj instanceof Number || obj . getClass ( ) . isPrimitive ( ) ) { int value = toInt ( obj ) ; return value != 0...
Converts the value to boolean and if it is null it uses the default value passed .
18,373
public void addConsumer ( Consumer consumer , String queue ) { addConsumer ( consumer , new ConsumerConfiguration ( queue ) , DEFAULT_AMOUNT_OF_INSTANCES ) ; }
Adds a consumer to the container and binds it to the given queue with auto acknowledge disabled . Does NOT enable the consumer to consume from the message broker until the container is started .
18,374
public synchronized void addConsumer ( Consumer consumer , ConsumerConfiguration configuration , int instances ) { for ( int i = 0 ; i < instances ; i ++ ) { this . consumerHolders . add ( new ConsumerHolder ( consumer , configuration ) ) ; } }
Adds a consumer to the container and configures it according to the consumer configuration . Does NOT enable the consumer to consume from the message broker until the container is started .
18,375
protected List < ConsumerHolder > filterConsumersForClass ( Class < ? extends Consumer > consumerClass ) { List < ConsumerHolder > consumerHolderSubList = new LinkedList < ConsumerHolder > ( ) ; for ( ConsumerHolder consumerHolder : consumerHolders ) { if ( consumerClass . isAssignableFrom ( consumerHolder . getConsume...
Filters the consumers being an instance extending or implementing the given class from the list of managed consumers .
18,376
protected List < ConsumerHolder > filterConsumersForEnabledFlag ( boolean enabled ) { List < ConsumerHolder > consumerHolderSubList = new LinkedList < ConsumerHolder > ( ) ; for ( ConsumerHolder consumerHolder : consumerHolders ) { if ( consumerHolder . isEnabled ( ) == enabled ) { consumerHolderSubList . add ( consume...
Filters the consumers matching the given enabled flag from the list of managed consumers .
18,377
protected List < ConsumerHolder > filterConsumersForActiveFlag ( boolean active ) { List < ConsumerHolder > consumerHolderSubList = new LinkedList < ConsumerHolder > ( ) ; for ( ConsumerHolder consumerHolder : consumerHolders ) { if ( consumerHolder . isActive ( ) == active ) { consumerHolderSubList . add ( consumerHol...
Filters the consumers matching the given active flag from the list of managed consumers .
18,378
protected void enableConsumers ( List < ConsumerHolder > consumerHolders ) throws IOException { checkPreconditions ( consumerHolders ) ; try { for ( ConsumerHolder consumerHolder : consumerHolders ) { consumerHolder . enable ( ) ; } } catch ( IOException e ) { LOGGER . error ( "Failed to enable consumers - disabling al...
Enables all consumers in the given list and hands them over for activation afterwards .
18,379
protected void activateConsumers ( List < ConsumerHolder > consumerHolders ) throws IOException { synchronized ( activationMonitor ) { for ( ConsumerHolder consumerHolder : consumerHolders ) { try { consumerHolder . activate ( ) ; } catch ( IOException e ) { LOGGER . error ( "Failed to activate consumer - deactivating ...
Activates all consumers in the given list .
18,380
protected void deactivateConsumers ( List < ConsumerHolder > consumerHolders ) { synchronized ( activationMonitor ) { for ( ConsumerHolder consumerHolder : consumerHolders ) { consumerHolder . deactivate ( ) ; } } }
Deactivates all consumers in the given list .
18,381
protected void checkPreconditions ( List < ConsumerHolder > consumerHolders ) throws IOException { Channel channel = createChannel ( ) ; for ( ConsumerHolder consumerHolder : consumerHolders ) { String queue = consumerHolder . getConfiguration ( ) . getQueueName ( ) ; try { channel . queueDeclarePassive ( queue ) ; LOG...
Checks if all preconditions are fulfilled on the broker to successfully register a consumer there . One important precondition is the existence of the queue the consumer shall consume from .
18,382
protected Channel createChannel ( ) throws IOException { LOGGER . debug ( "Creating channel" ) ; Connection connection = connectionFactory . newConnection ( ) ; Channel channel = connection . createChannel ( ) ; LOGGER . debug ( "Created channel" ) ; return channel ; }
Creates a channel to be used for consuming from the broker .
18,383
public final char [ ] findNextChar ( boolean inMiddleOfString , boolean wasEscapeChar , int match , int esc ) { try { ensureBuffer ( ) ; int idx = index ; char [ ] _chars = readBuf ; int length = this . length ; int ch = this . ch ; if ( ! inMiddleOfString ) { foundEscape = false ; if ( ch == match ) { } else if ( idx ...
Remember that this must work past buffer reader boundaries so we need to keep track where we were in the nested run .
18,384
public boolean addArray ( float ... values ) { if ( end + values . length >= this . values . length ) { this . values = grow ( this . values , ( this . values . length + values . length ) * 2 ) ; } System . arraycopy ( values , 0 , this . values , end , values . length ) ; end += values . length ; return true ; }
Add a new array to the list .
18,385
private static PropertyDescriptor getPropertyDescriptor ( final Class < ? > type , final String propertyName ) { Exceptions . requireNonNull ( type ) ; Exceptions . requireNonNull ( propertyName ) ; if ( ! propertyName . contains ( "." ) ) { return doGetPropertyDescriptor ( type , propertyName ) ; } else { String [ ] p...
This needs refactor and put into Refleciton .
18,386
public boolean open ( ) { LibMediaInfo lib = LibMediaInfo . INSTANCE ; handle = lib . MediaInfo_New ( ) ; if ( handle != null ) { int opened = lib . MediaInfo_Open ( handle , new WString ( filename ) ) ; if ( opened == 1 ) { return true ; } else { lib . MediaInfo_Delete ( handle ) ; } } return false ; }
Open the media file .
18,387
public void close ( ) { if ( handle != null ) { LibMediaInfo . INSTANCE . MediaInfo_Close ( handle ) ; LibMediaInfo . INSTANCE . MediaInfo_Delete ( handle ) ; } }
Close the media file .
18,388
MediaInfo parse ( ) { try { BufferedReader reader = new BufferedReader ( new StringReader ( data ) ) ; MediaInfo mediaInfo = new MediaInfo ( ) ; String sectionName ; String line ; Sections sections ; Section section = null ; while ( parseState != ParseState . FINISHED ) { switch ( parseState ) { case DEFAULT : parseSta...
Parse the raw data .
18,389
private void checkChildrenCount ( ) { if ( getChildCount ( ) != 2 ) Log . e ( getResources ( ) . getString ( R . string . tag ) , getResources ( ) . getString ( R . string . wrong_number_children_error ) ) ; }
Checks if children number is correct and logs an error if it is not
18,390
public static MediaInfo mediaInfo ( String filename ) { MediaInfo result ; LibMediaInfo lib = LibMediaInfo . INSTANCE ; Pointer handle = lib . MediaInfo_New ( ) ; if ( handle != null ) { try { int opened = lib . MediaInfo_Open ( handle , new WString ( filename ) ) ; if ( opened == 1 ) { WString data = lib . MediaInfo_I...
Extract media information for a particular file .
18,391
public Sections sections ( String type ) { Sections result = sectionsByType . get ( type ) ; if ( result == null ) { result = new Sections ( ) ; sectionsByType . put ( type , result ) ; } return result ; }
Get all of the sections of a particular type .
18,392
public Section first ( String type ) { Section result ; Sections sections = sections ( type ) ; if ( sections != null ) { result = sections . first ( ) ; } else { result = null ; } return result ; }
Get the first section of a particular type .
18,393
public void completeAnimationToFullHeight ( int completeExpandAnimationSpeed ) { HeightAnimation heightAnim = new HeightAnimation ( animableView , animableView . getMeasuredHeight ( ) , displayHeight ) ; heightAnim . setDuration ( completeExpandAnimationSpeed ) ; heightAnim . setInterpolator ( new DecelerateInterpolato...
Animates animableView until it reaches full screen height
18,394
public void completeAnimationToInitialHeight ( int completeShrinkAnimationSpeed , int initialAnimableLayoutHeight ) { HeightAnimation heightAnim = new HeightAnimation ( animableView , animableView . getMeasuredHeight ( ) , initialAnimableLayoutHeight ) ; heightAnim . setDuration ( completeShrinkAnimationSpeed ) ; heigh...
Animates animableView to get its initial height back
18,395
static Integer integer ( String value ) { Integer result ; if ( value != null ) { value = value . trim ( ) ; Matcher matcher = INTEGER_PATTERN . matcher ( value ) ; if ( matcher . matches ( ) ) { result = Integer . parseInt ( matcher . group ( 1 ) . replace ( " " , "" ) ) ; } else { throw new IllegalArgumentException (...
Convert a string to an integer .
18,396
static BigDecimal decimal ( String value ) { BigDecimal result ; if ( value != null ) { value = value . trim ( ) ; Matcher matcher = DECIMAL_PATTERN . matcher ( value ) ; if ( matcher . matches ( ) ) { result = new BigDecimal ( matcher . group ( 1 ) ) ; } else { throw new IllegalArgumentException ( "Unknown format for ...
Convert a string to a big decimal .
18,397
static Duration duration ( String value ) { Duration result ; if ( value != null ) { value = value . trim ( ) ; Matcher matcher = DURATION_PATTERN . matcher ( value ) ; if ( matcher . matches ( ) ) { int hours = matcher . group ( 1 ) != null ? Integer . parseInt ( matcher . group ( 1 ) ) : 0 ; int minutes = matcher . g...
Convert a string to a duration .
18,398
private void loadWebConfigs ( Environment environment , SpringConfiguration config , ApplicationContext appCtx ) throws ClassNotFoundException { loadFilters ( config . getFilters ( ) , environment ) ; environment . servlets ( ) . addServletListeners ( new RestContextLoaderListener ( ( XmlRestWebApplicationContext ) app...
Load filter servlets or listeners for WebApplicationContext .
18,399
@ SuppressWarnings ( "unchecked" ) private void loadFilters ( Map < String , FilterConfiguration > filters , Environment environment ) throws ClassNotFoundException { if ( filters != null ) { for ( Map . Entry < String , FilterConfiguration > filterEntry : filters . entrySet ( ) ) { FilterConfiguration filter = filterE...
Load all filters .