idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
161,800
@ Trivial private static String toKey ( String name , String filter , SearchControls cons ) { int length = name . length ( ) + filter . length ( ) + 100 ; StringBuffer key = new StringBuffer ( length ) ; key . append ( name ) ; key . append ( "|" ) ; key . append ( filter ) ; key . append ( "|" ) ; key . append ( cons . getSearchScope ( ) ) ; key . append ( "|" ) ; key . append ( cons . getCountLimit ( ) ) ; key . append ( "|" ) ; key . append ( cons . getTimeLimit ( ) ) ; String [ ] attrIds = cons . getReturningAttributes ( ) ; if ( attrIds != null ) { for ( int i = 0 ; i < attrIds . length ; i ++ ) { key . append ( "|" ) ; key . append ( attrIds [ i ] ) ; } } return key . toString ( ) ; }
Returns a hash key for the name|filter|cons tuple used in the search query - results cache .
219
21
161,801
@ Trivial private static String toKey ( String name , String filterExpr , Object [ ] filterArgs , SearchControls cons ) { int length = name . length ( ) + filterExpr . length ( ) + filterArgs . length + 200 ; StringBuffer key = new StringBuffer ( length ) ; key . append ( name ) ; key . append ( "|" ) ; key . append ( filterExpr ) ; String [ ] attrIds = cons . getReturningAttributes ( ) ; for ( int i = 0 ; i < filterArgs . length ; i ++ ) { key . append ( "|" ) ; key . append ( filterArgs [ i ] ) ; } if ( attrIds != null ) { for ( int i = 0 ; i < attrIds . length ; i ++ ) { key . append ( "|" ) ; key . append ( attrIds [ i ] ) ; } } return key . toString ( ) ; }
Returns a hash key for the name|filterExpr|filterArgs|cons tuple used in the search query - results cache .
209
26
161,802
public NameParser getNameParser ( ) throws WIMException { if ( iNameParser == null ) { TimedDirContext ctx = iContextManager . getDirContext ( ) ; try { try { iNameParser = ctx . getNameParser ( "" ) ; } catch ( NamingException e ) { if ( ! ContextManager . isConnectionException ( e ) ) { throw e ; } ctx = iContextManager . reCreateDirContext ( ctx , e . toString ( ) ) ; iNameParser = ctx . getNameParser ( "" ) ; } } catch ( NamingException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) , e ) ; throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } finally { iContextManager . releaseDirContext ( ctx ) ; } } return iNameParser ; }
Retrieves the parser associated with the root context .
224
11
161,803
private void createSearchResultsCache ( ) { final String METHODNAME = "createSearchResultsCache" ; if ( iSearchResultsCacheEnabled ) { if ( FactoryManager . getCacheUtil ( ) . isCacheAvailable ( ) ) { iSearchResultsCache = FactoryManager . getCacheUtil ( ) . initialize ( "SearchResultsCache" , iSearchResultsCacheSize , iSearchResultsCacheSize , iSearchResultsCacheTimeOut ) ; if ( iSearchResultsCache != null ) { if ( tc . isDebugEnabled ( ) ) { StringBuilder strBuf = new StringBuilder ( METHODNAME ) ; strBuf . append ( " \nSearch Results Cache: " ) . append ( iSearchResultsCacheName ) . append ( " is enabled:\n" ) ; strBuf . append ( "\tCacheSize: " ) . append ( iSearchResultsCacheSize ) . append ( "\n" ) ; strBuf . append ( "\tCacheTimeOut: " ) . append ( iSearchResultsCacheTimeOut ) . append ( "\n" ) ; strBuf . append ( "\tCacheResultSizeLimit: " ) . append ( iSearchResultSizeLmit ) . append ( "\n" ) ; Tr . debug ( tc , strBuf . toString ( ) ) ; } } } } }
Method to create the search results cache if configured .
280
10
161,804
private void createAttributesCache ( ) { final String METHODNAME = "createAttributesCache" ; if ( iAttrsCacheEnabled ) { if ( FactoryManager . getCacheUtil ( ) . isCacheAvailable ( ) ) { iAttrsCache = FactoryManager . getCacheUtil ( ) . initialize ( "AttributesCache" , iAttrsCacheSize , iAttrsCacheSize , iAttrsCacheTimeOut ) ; if ( iAttrsCache != null ) { if ( tc . isDebugEnabled ( ) ) { StringBuilder strBuf = new StringBuilder ( METHODNAME ) ; strBuf . append ( " \nAttributes Cache: " ) . append ( iAttrsCacheName ) . append ( " is enabled:\n" ) ; strBuf . append ( "\tCacheSize: " ) . append ( iAttrsCacheSize ) . append ( "\n" ) ; strBuf . append ( "\tCacheTimeOut: " ) . append ( iAttrsCacheTimeOut ) . append ( "\n" ) ; strBuf . append ( "\tCacheSizeLimit: " ) . append ( iAttrsSizeLmit ) . append ( "\n" ) ; Tr . debug ( tc , strBuf . toString ( ) ) ; } } } } }
Method to create the attributes cache if configured .
275
9
161,805
public void invalidateAttributes ( String DN , String extId , String uniqueName ) { final String METHODNAME = "invalidateAttributes(String, String, String)" ; if ( getAttributesCache ( ) != null ) { if ( DN != null ) { getAttributesCache ( ) . invalidate ( toKey ( DN ) ) ; } if ( extId != null ) { getAttributesCache ( ) . invalidate ( extId ) ; } if ( uniqueName != null ) { getAttributesCache ( ) . invalidate ( toKey ( uniqueName ) ) ; } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " " + iAttrsCacheName + " size: " + getAttributesCache ( ) . size ( ) ) ; } } }
Method to invalidate the specified entry from the attributes cache . One or all parameters can be set in a single call . If all parameters are null then this operation no - ops .
169
36
161,806
public LdapEntry getEntityByIdentifier ( IdentifierType id , List < String > inEntityTypes , List < String > propNames , boolean getMbrshipAttr , boolean getMbrAttr ) throws WIMException { return getEntityByIdentifier ( id . getExternalName ( ) , id . getExternalId ( ) , id . getUniqueName ( ) , inEntityTypes , propNames , getMbrshipAttr , getMbrAttr ) ; }
Get an LDAP entity by an identifier .
104
9
161,807
public LdapEntry getEntityByIdentifier ( String dn , String extId , String uniqueName , List < String > inEntityTypes , List < String > propNames , boolean getMbrshipAttr , boolean getMbrAttr ) throws WIMException { String [ ] attrIds = iLdapConfigMgr . getAttributeNames ( inEntityTypes , propNames , getMbrshipAttr , getMbrAttr ) ; Attributes attrs = null ; if ( dn == null && ! iLdapConfigMgr . needTranslateRDN ( ) ) { dn = iLdapConfigMgr . switchToLdapNode ( uniqueName ) ; } // Changed the order of the if-else ladder. Please check against tWAS code for the original order if ( dn != null ) { attrs = checkAttributesCache ( dn , attrIds ) ; } else if ( extId != null ) { if ( iLdapConfigMgr . isAnyExtIdDN ( ) ) { dn = LdapHelper . getValidDN ( extId ) ; if ( dn != null ) { attrs = checkAttributesCache ( dn , attrIds ) ; } else if ( uniqueName != null ) { attrs = getAttributesByUniqueName ( uniqueName , attrIds , inEntityTypes ) ; dn = LdapHelper . getDNFromAttributes ( attrs ) ; } else { String msg = Tr . formatMessage ( tc , WIMMessageKey . ENTITY_NOT_FOUND , WIMMessageHelper . generateMsgParms ( null ) ) ; throw new EntityNotFoundException ( WIMMessageKey . ENTITY_NOT_FOUND , msg ) ; } } else { attrs = getAttributesByUniqueName ( extId , attrIds , inEntityTypes ) ; dn = LdapHelper . getDNFromAttributes ( attrs ) ; } } else if ( uniqueName != null ) { attrs = getAttributesByUniqueName ( uniqueName , attrIds , inEntityTypes ) ; dn = LdapHelper . getDNFromAttributes ( attrs ) ; } else { String msg = Tr . formatMessage ( tc , WIMMessageKey . ENTITY_NOT_FOUND , WIMMessageHelper . generateMsgParms ( null ) ) ; throw new EntityNotFoundException ( WIMMessageKey . ENTITY_NOT_FOUND , msg ) ; } String entityType = iLdapConfigMgr . getEntityType ( attrs , uniqueName , dn , extId , inEntityTypes ) ; uniqueName = getUniqueName ( dn , entityType , attrs ) ; if ( extId == null ) { extId = iLdapConfigMgr . getExtIdFromAttributes ( dn , entityType , attrs ) ; } LdapEntry ldapEntry = new LdapEntry ( dn , extId , uniqueName , entityType , attrs ) ; return ldapEntry ; }
Get an LDAP entity by an identifier . One of dn extId or uniqueName must be non - null .
661
24
161,808
private String getUniqueName ( String dn , String entityType , Attributes attrs ) throws WIMException { final String METHODNAME = "getUniqueName" ; String uniqueName = null ; dn = iLdapConfigMgr . switchToNode ( dn ) ; if ( iLdapConfigMgr . needTranslateRDN ( ) && iLdapConfigMgr . needTranslateRDN ( entityType ) ) { try { if ( entityType != null ) { LdapEntity ldapEntity = iLdapConfigMgr . getLdapEntity ( entityType ) ; if ( ldapEntity != null ) { String [ ] rdnName = LdapHelper . getRDNAttributes ( dn ) ; String [ ] [ ] rdnWIMProps = ldapEntity . getWIMRDNProperties ( ) ; String [ ] [ ] rdnWIMAttrs = ldapEntity . getWIMRDNAttributes ( ) ; String [ ] [ ] rdnAttrs = ldapEntity . getRDNAttributes ( ) ; Attribute [ ] rdnAttributes = new Attribute [ rdnWIMProps . length ] ; String [ ] rdnAttrValues = new String [ rdnWIMProps . length ] ; for ( int i = 0 ; i < rdnAttrs . length ; i ++ ) { String [ ] rdnAttr = rdnAttrs [ i ] ; boolean isRDN = true ; for ( int j = 0 ; j < rdnAttr . length ; j ++ ) { if ( ! rdnAttr [ j ] . equalsIgnoreCase ( rdnName [ j ] ) ) { isRDN = false ; } } if ( isRDN ) { String [ ] rdnWIMProp = rdnWIMProps [ i ] ; String [ ] rdnWIMAttr = rdnWIMAttrs [ i ] ; boolean retrieveRDNs = false ; if ( attrs == null ) { retrieveRDNs = true ; } else { for ( int k = 0 ; k < rdnWIMAttr . length ; k ++ ) { if ( attrs . get ( rdnWIMAttr [ k ] ) == null ) { retrieveRDNs = true ; break ; } } } if ( retrieveRDNs ) { attrs = getAttributes ( dn , rdnWIMAttr ) ; } for ( int k = 0 ; k < rdnWIMAttr . length ; k ++ ) { rdnAttributes [ k ] = attrs . get ( rdnWIMAttr [ k ] ) ; if ( rdnAttributes [ k ] != null ) { rdnAttrValues [ k ] = ( String ) rdnAttributes [ k ] . get ( ) ; } } uniqueName = LdapHelper . replaceRDN ( dn , rdnWIMProp , rdnAttrValues ) ; } } } } } catch ( NamingException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } } if ( uniqueName == null ) { uniqueName = dn ; } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Translated uniqueName: " + uniqueName ) ; } } return uniqueName ; }
Get the unique name for the specified distinguished name .
782
10
161,809
@ FFDCIgnore ( { NamingException . class , NameNotFoundException . class } ) private Attributes getAttributes ( String name , String [ ] attrIds ) throws WIMException { Attributes attributes = null ; if ( iLdapConfigMgr . getUseEncodingInSearchExpression ( ) != null ) name = LdapHelper . encodeAttribute ( name , iLdapConfigMgr . getUseEncodingInSearchExpression ( ) ) ; if ( iAttrRangeStep > 0 ) { attributes = getRangeAttributes ( name , attrIds ) ; } else { TimedDirContext ctx = iContextManager . getDirContext ( ) ; try { try { if ( attrIds . length > 0 ) { attributes = ctx . getAttributes ( new LdapName ( name ) , attrIds ) ; } else { attributes = new BasicAttributes ( ) ; } } catch ( NamingException e ) { if ( ! ContextManager . isConnectionException ( e ) ) { throw e ; } ctx = iContextManager . reCreateDirContext ( ctx , e . toString ( ) ) ; if ( attrIds . length > 0 ) { attributes = ctx . getAttributes ( new LdapName ( name ) , attrIds ) ; } else { attributes = new BasicAttributes ( ) ; } } } catch ( NameNotFoundException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . LDAP_ENTRY_NOT_FOUND , WIMMessageHelper . generateMsgParms ( name , e . toString ( true ) ) ) ; throw new EntityNotFoundException ( WIMMessageKey . LDAP_ENTRY_NOT_FOUND , msg , e ) ; } catch ( NamingException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } finally { iContextManager . releaseDirContext ( ctx ) ; } } return attributes ; }
Get the specified attributes for the distinguished name .
480
9
161,810
public Attributes checkAttributesCache ( String name , String [ ] attrIds ) throws WIMException { final String METHODNAME = "checkAttributesCache" ; Attributes attributes = null ; // If attribute cache is available, look up cache first if ( getAttributesCache ( ) != null ) { String key = toKey ( name ) ; Object cached = getAttributesCache ( ) . get ( key ) ; // Cache entry found if ( cached != null && ( cached instanceof Attributes ) ) { List < String > missAttrIdList = new ArrayList < String > ( attrIds . length ) ; Attributes cachedAttrs = ( Attributes ) cached ; attributes = new BasicAttributes ( true ) ; for ( int i = 0 ; i < attrIds . length ; i ++ ) { Attribute attr = LdapHelper . getIngoreCaseAttribute ( cachedAttrs , attrIds [ i ] ) ; if ( attr != null ) { attributes . put ( attr ) ; } else { missAttrIdList . add ( attrIds [ i ] ) ; } } // If no missed attributes, nothing need to do. // Otherwise, retrieve missed attributes and add back to cache if ( missAttrIdList . size ( ) > 0 ) { String [ ] missAttrIds = missAttrIdList . toArray ( new String [ 0 ] ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Miss cache: " + key + " " + WIMTraceHelper . printObjectArray ( missAttrIds ) ) ; } Attributes missAttrs = getAttributes ( name , missAttrIds ) ; // Add missed attributes to attributes. addAttributes ( missAttrs , attributes ) ; // Add missed attributes to cache. updateAttributesCache ( key , missAttrs , cachedAttrs , missAttrIds ) ; } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Hit cache: " + key ) ; } } } // No cache entry, call LDAP to retrieve all request attributes. else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Miss cache: " + key ) ; } attributes = getAttributes ( name , attrIds ) ; // Add attributes to cache. updateAttributesCache ( key , attributes , null , attrIds ) ; } } else { // Attribute cache is not available, directly call LDAP server attributes = getAttributes ( name , attrIds ) ; } return attributes ; }
Check the attributes cache for the attributes on the distinguished name . If any of the attributes are missing a call to the LDAP server will be made to retrieve them .
561
33
161,811
private void updateAttributesCache ( String uniqueNameKey , String dn , Attributes newAttrs , String [ ] attrIds ) { final String METHODNAME = "updateAttributesCache(key,dn,newAttrs)" ; /* * Add uniqueName to DN mapping to cache */ getAttributesCache ( ) . put ( uniqueNameKey , dn , 1 , iAttrsCacheTimeOut , 0 , null ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Update " + iAttrsCacheName + "(size: " + getAttributesCache ( ) . size ( ) + ")\n" + uniqueNameKey + ": " + dn ) ; } /* * Add the DN to Attributes mapping to the cache. */ String dnKey = toKey ( dn ) ; Object cached = getAttributesCache ( ) . get ( dnKey ) ; Attributes cachedAttrs = null ; if ( cached != null && cached instanceof Attributes ) { cachedAttrs = ( Attributes ) cached ; } updateAttributesCache ( dnKey , newAttrs , cachedAttrs , attrIds ) ; }
Update the attributes cache by adding a mapping of the unique name to distinguished name and mapping the distinguished name to the updated attributes .
246
25
161,812
private void updateAttributesCache ( String key , Attributes missAttrs , Attributes cachedAttrs , String [ ] missAttrIds ) { final String METHODNAME = "updateAttributesCache(key,missAttrs,cachedAttrs,missAttrIds)" ; if ( missAttrIds != null ) { boolean newattr = false ; // differentiate between a new entry and an entry we'll update so we change the cache correctly and maintain the creation TTL. if ( missAttrIds . length > 0 ) { if ( cachedAttrs != null ) { cachedAttrs = ( Attributes ) cachedAttrs . clone ( ) ; } else { cachedAttrs = new BasicAttributes ( true ) ; newattr = true ; } for ( int i = 0 ; i < missAttrIds . length ; i ++ ) { boolean findAttr = false ; for ( NamingEnumeration < ? > neu = missAttrs . getAll ( ) ; neu . hasMoreElements ( ) ; ) { Attribute attr = ( Attribute ) neu . nextElement ( ) ; if ( attr . getID ( ) . equalsIgnoreCase ( missAttrIds [ i ] ) ) { findAttr = true ; // If the size of the attributes is larger than the // limit, do not cache it. if ( ! ( iAttrsSizeLmit > 0 && attr . size ( ) > iAttrsSizeLmit ) ) { cachedAttrs . put ( attr ) ; } break ; } else { int pos = attr . getID ( ) . indexOf ( ";" ) ; if ( pos > 0 && missAttrIds [ i ] . equalsIgnoreCase ( attr . getID ( ) . substring ( 0 , pos ) ) ) { findAttr = true ; // If the size of the attributes is larger than // the limit, do not cache it. if ( ! ( iAttrsSizeLmit > 0 && attr . size ( ) > iAttrsSizeLmit ) ) { cachedAttrs . put ( attr ) ; } break ; } } } if ( ! findAttr ) { Attribute nullAttr = new BasicAttribute ( missAttrIds [ i ] , null ) ; cachedAttrs . put ( nullAttr ) ; } } if ( newattr ) { // only set the the TTL if we're putting in a new entry getAttributesCache ( ) . put ( key , cachedAttrs , 1 , iAttrsCacheTimeOut , 0 , null ) ; } else { getAttributesCache ( ) . put ( key , cachedAttrs ) ; } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Update " + iAttrsCacheName + "(size: " + getAttributesCache ( ) . size ( ) + " newEntry: " + newattr + ")\n" + key + ": " + cachedAttrs ) ; } } } else { updateAttributesCache ( key , missAttrs , cachedAttrs ) ; } }
Update the cached attributes for the specified key . Only attribute IDs that are in the missAttrIds array will be added into the cached attributes .
660
30
161,813
private void updateAttributesCache ( String key , Attributes missAttrs , Attributes cachedAttrs ) { final String METHODNAME = "updateAttributeCache(key,missAttrs,cachedAttrs)" ; if ( missAttrs . size ( ) > 0 ) { boolean newAttr = false ; // differentiate between a new entry and an entry we'll update so we change the cache correctly and maintain the creation TTL. if ( cachedAttrs != null ) { cachedAttrs = ( Attributes ) cachedAttrs . clone ( ) ; } else { cachedAttrs = new BasicAttributes ( true ) ; newAttr = true ; } //Set extIdAttrs = iLdapConfigMgr.getExtIds(); for ( NamingEnumeration < ? > neu = missAttrs . getAll ( ) ; neu . hasMoreElements ( ) ; ) { Attribute attr = ( Attribute ) neu . nextElement ( ) ; // If the size of the attributes is larger than the limit, don not cache it. if ( ! ( iAttrsSizeLmit > 0 && attr . size ( ) > iAttrsSizeLmit ) ) { cachedAttrs . put ( attr ) ; } } if ( newAttr ) { getAttributesCache ( ) . put ( key , cachedAttrs , 1 , iAttrsCacheTimeOut , 0 , null ) ; } else { getAttributesCache ( ) . put ( key , cachedAttrs ) ; } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Update " + iAttrsCacheName + "(size: " + getAttributesCache ( ) . size ( ) + " newEntry: " + newAttr + ")\n" + key + ": " + cachedAttrs ) ; } } }
Update the attributes cache for the specified key .
391
9
161,814
private NamingEnumeration < SearchResult > checkSearchCache ( String name , String filterExpr , Object [ ] filterArgs , SearchControls cons ) throws WIMException { final String METHODNAME = "checkSearchCache" ; NamingEnumeration < SearchResult > neu = null ; if ( getSearchResultsCache ( ) != null ) { String key = null ; if ( filterArgs == null ) { key = toKey ( name , filterExpr , cons ) ; } else { key = toKey ( name , filterExpr , filterArgs , cons ) ; } CachedNamingEnumeration cached = ( CachedNamingEnumeration ) getSearchResultsCache ( ) . get ( key ) ; if ( cached == null ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Miss cache: " + key ) ; } neu = search ( name , filterExpr , filterArgs , cons , null ) ; String [ ] reqAttrIds = cons . getReturningAttributes ( ) ; neu = updateSearchCache ( name , key , neu , reqAttrIds ) ; } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Hit cache: " + key ) ; } neu = ( CachedNamingEnumeration ) cached . clone ( ) ; } } else { neu = search ( name , filterExpr , filterArgs , cons , null ) ; } return neu ; }
Check the search cache for previously performed searches . If the result is not cached query the LDAP server .
331
21
161,815
@ FFDCIgnore ( NamingException . class ) private NamingEnumeration < SearchResult > updateSearchCache ( String searchBase , String key , NamingEnumeration < SearchResult > neu , String [ ] reqAttrIds ) throws WIMSystemException { final String METHODNAME = "updateSearchCache" ; CachedNamingEnumeration clone1 = new CachedNamingEnumeration ( ) ; CachedNamingEnumeration clone2 = new CachedNamingEnumeration ( ) ; int count = cloneSearchResults ( neu , clone1 , clone2 ) ; // Size limit 0 means no limit. if ( iSearchResultSizeLmit == 0 || count < iSearchResultSizeLmit ) { getSearchResultsCache ( ) . put ( key , clone2 , 1 , iSearchResultsCacheTimeOut , 0 , null ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , METHODNAME + " Update " + iSearchResultsCacheName + "(size: " + getSearchResultsCache ( ) . size ( ) + ")\n" + key ) ; // To reduce JNDI calls during get(), cache the entry into attribute cache if ( getAttributesCache ( ) != null ) { try { count = 0 ; while ( clone2 . hasMore ( ) ) { SearchResult result = clone2 . nextElement ( ) ; String dnKey = LdapHelper . prepareDN ( result . getName ( ) , searchBase ) ; Object cached = getAttributesCache ( ) . get ( dnKey ) ; Attributes cachedAttrs = null ; if ( cached != null && cached instanceof Attributes ) { cachedAttrs = ( Attributes ) cached ; } updateAttributesCache ( dnKey , result . getAttributes ( ) , cachedAttrs , reqAttrIds ) ; if ( ++ count > 20 ) { // cache only first 20 results from the search. // caching all entries may thrash the attributeCache if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , METHODNAME + " attribute cache updated with " + ( count - 1 ) + " entries. skipping rest." ) ; break ; } } } catch ( NamingException e ) { /* Ignore. */ } } } return clone1 ; }
Update the search cache with search results .
487
8
161,816
public Map < String , LdapEntry > getDynamicGroups ( String bases [ ] , List < String > propNames , boolean getMbrshipAttr ) throws WIMException { Map < String , LdapEntry > dynaGrps = new HashMap < String , LdapEntry > ( ) ; String [ ] attrIds = iLdapConfigMgr . getAttributeNames ( iLdapConfigMgr . getGroupTypes ( ) , propNames , getMbrshipAttr , false ) ; String [ ] dynaMbrAttrNames = iLdapConfigMgr . getDynamicMemberAttributes ( ) ; String [ ] temp = attrIds ; attrIds = new String [ temp . length + dynaMbrAttrNames . length ] ; System . arraycopy ( temp , 0 , attrIds , 0 , temp . length ) ; System . arraycopy ( dynaMbrAttrNames , 0 , attrIds , temp . length , dynaMbrAttrNames . length ) ; String dynaGrpFitler = iLdapConfigMgr . getDynamicGroupFilter ( ) ; for ( int i = 0 , n = bases . length ; i < n ; i ++ ) { String base = bases [ i ] ; for ( NamingEnumeration < SearchResult > urls = search ( base , dynaGrpFitler , SearchControls . SUBTREE_SCOPE , attrIds ) ; urls . hasMoreElements ( ) ; ) { javax . naming . directory . SearchResult thisEntry = urls . nextElement ( ) ; if ( thisEntry == null ) { continue ; } String entryName = thisEntry . getName ( ) ; if ( entryName == null || entryName . trim ( ) . length ( ) == 0 ) { continue ; } String dn = LdapHelper . prepareDN ( entryName , base ) ; javax . naming . directory . Attributes attrs = thisEntry . getAttributes ( ) ; String extId = iLdapConfigMgr . getExtIdFromAttributes ( dn , SchemaConstants . DO_GROUP , attrs ) ; String uniqueName = getUniqueName ( dn , SchemaConstants . DO_GROUP , attrs ) ; LdapEntry ldapEntry = new LdapEntry ( dn , extId , uniqueName , SchemaConstants . DO_GROUP , attrs ) ; dynaGrps . put ( ldapEntry . getDN ( ) , ldapEntry ) ; } } return dynaGrps ; }
Get dynamic groups .
569
4
161,817
public boolean isMemberInURLQuery ( LdapURL [ ] urls , String dn ) throws WIMException { boolean result = false ; String [ ] attrIds = { } ; String rdn = LdapHelper . getRDN ( dn ) ; if ( urls != null ) { for ( int i = 0 ; i < urls . length ; i ++ ) { LdapURL ldapURL = urls [ i ] ; if ( ldapURL . parsedOK ( ) ) { String searchBase = ldapURL . get_dn ( ) ; // If dn is not under base, no need to do search if ( LdapHelper . isUnderBases ( dn , searchBase ) ) { int searchScope = ldapURL . get_searchScope ( ) ; String searchFilter = ldapURL . get_filter ( ) ; if ( searchScope == SearchControls . SUBTREE_SCOPE ) { if ( searchFilter == null ) { result = true ; break ; } else { NamingEnumeration < SearchResult > nenu = search ( dn , searchFilter , SearchControls . SUBTREE_SCOPE , attrIds ) ; if ( nenu . hasMoreElements ( ) ) { result = true ; break ; } } } else { if ( searchFilter == null ) { searchFilter = rdn ; } else { searchFilter = "(&(" + searchFilter + ")(" + rdn + "))" ; } NamingEnumeration < SearchResult > nenu = search ( searchBase , searchFilter , searchScope , attrIds ) ; if ( nenu . hasMoreElements ( ) ) { SearchResult thisEntry = nenu . nextElement ( ) ; if ( thisEntry == null ) { continue ; } String returnedDN = LdapHelper . prepareDN ( thisEntry . getName ( ) , searchBase ) ; if ( dn . equalsIgnoreCase ( returnedDN ) ) { result = true ; break ; } } } } } } } return result ; }
Determine whether the distinguished name is in the LDAP URL query .
454
15
161,818
public SearchResult searchByOperationalAttribute ( String dn , String filter , List < String > inEntityTypes , List < String > propNames , String oprAttribute ) throws WIMException { String inEntityType = null ; List < String > supportedProps = propNames ; if ( inEntityTypes != null && inEntityTypes . size ( ) > 0 ) { inEntityType = inEntityTypes . get ( 0 ) ; supportedProps = iLdapConfigMgr . getSupportedProperties ( inEntityType , propNames ) ; } String [ ] attrIds = iLdapConfigMgr . getAttributeNames ( inEntityTypes , supportedProps , false , false ) ; attrIds = Arrays . copyOf ( attrIds , attrIds . length + 1 ) ; attrIds [ attrIds . length - 1 ] = oprAttribute ; NamingEnumeration < SearchResult > neu = null ; neu = search ( dn , filter , SearchControls . OBJECT_SCOPE , attrIds , iCountLimit , iTimeLimit ) ; if ( neu != null ) { try { if ( neu . hasMore ( ) ) { return neu . next ( ) ; } } catch ( NamingException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } } return null ; }
Search using operational attribute specified in the parameter .
356
9
161,819
private String getBinaryAttributes ( ) { // Add binary settings for all octet string attributes. StringBuffer binaryAttrNamesBuffer = new StringBuffer ( ) ; // Check the ldap data type of the extId attribute. Map < String , LdapAttribute > attrMap = iLdapConfigMgr . getAttributes ( ) ; for ( String attrName : attrMap . keySet ( ) ) { LdapAttribute attr = attrMap . get ( attrName ) ; if ( LdapConstants . LDAP_ATTR_SYNTAX_OCTETSTRING . equalsIgnoreCase ( attr . getSyntax ( ) ) ) { binaryAttrNamesBuffer . append ( attr . getName ( ) ) . append ( " " ) ; } } return binaryAttrNamesBuffer . toString ( ) . trim ( ) ; }
Get the list of configure binary attributes .
192
8
161,820
public void modifyAttributes ( String name , ModificationItem [ ] mods ) throws NamingException , WIMException { TimedDirContext ctx = iContextManager . getDirContext ( ) ; // checkWritePermission(ctx); TODO Why are we not checking for permission here? try { try { ctx . modifyAttributes ( new LdapName ( name ) , mods ) ; } catch ( NamingException e ) { if ( ! ContextManager . isConnectionException ( e ) ) { throw e ; } ctx = iContextManager . reCreateDirContext ( ctx , e . toString ( ) ) ; ctx . modifyAttributes ( new LdapName ( name ) , mods ) ; } } catch ( NameNotFoundException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new EntityNotFoundException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } catch ( NamingException e ) { throw e ; } finally { iContextManager . releaseDirContext ( ctx ) ; } }
Modify the given LDAP name according to the specified modification items .
258
14
161,821
public void modifyAttributes ( String dn , int mod_op , Attributes attrs ) throws NamingException , WIMException { TimedDirContext ctx = iContextManager . getDirContext ( ) ; iContextManager . checkWritePermission ( ctx ) ; try { try { ctx . modifyAttributes ( new LdapName ( dn ) , mod_op , attrs ) ; } catch ( NamingException e ) { if ( ! ContextManager . isConnectionException ( e ) ) { throw e ; } ctx = iContextManager . reCreateDirContext ( ctx , e . toString ( ) ) ; ctx . modifyAttributes ( new LdapName ( dn ) , mod_op , attrs ) ; } } catch ( NameNotFoundException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new EntityNotFoundException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } catch ( NamingException e ) { throw e ; } finally { iContextManager . releaseDirContext ( ctx ) ; } }
Modify the attributes for the specified distinguished name .
267
10
161,822
public void rename ( String dn , String newDn ) throws WIMException { TimedDirContext ctx = iContextManager . getDirContext ( ) ; iContextManager . checkWritePermission ( ctx ) ; try { try { ctx . rename ( dn , newDn ) ; } catch ( NamingException e ) { if ( ! ContextManager . isConnectionException ( e ) ) { throw e ; } ctx = iContextManager . reCreateDirContext ( ctx , e . toString ( ) ) ; ctx . rename ( dn , newDn ) ; } } catch ( NamingException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } finally { iContextManager . releaseDirContext ( ctx ) ; } }
Rename an entity .
223
5
161,823
protected final void addConverter ( String name , String converterId ) { _factories . put ( name , new ConverterHandlerFactory ( converterId ) ) ; }
Add a ConvertHandler for the specified converterId
36
9
161,824
protected final void addConverter ( String name , String converterId , Class < ? extends TagHandler > type ) { _factories . put ( name , new UserConverterHandlerFactory ( converterId , type ) ) ; }
Add a ConvertHandler for the specified converterId of a TagHandler type
49
14
161,825
protected final void addTagHandler ( String name , Class < ? extends TagHandler > handlerType ) { _factories . put ( name , new HandlerFactory ( handlerType ) ) ; }
Use the specified HandlerType in compiling Facelets . HandlerType must extend TagHandler .
39
17
161,826
protected final void addUserTag ( String name , URL source ) { if ( _strictJsf2FaceletsCompatibility == null ) { MyfacesConfig config = MyfacesConfig . getCurrentInstance ( FacesContext . getCurrentInstance ( ) . getExternalContext ( ) ) ; _strictJsf2FaceletsCompatibility = config . isStrictJsf2FaceletsCompatibility ( ) ; } if ( Boolean . TRUE . equals ( _strictJsf2FaceletsCompatibility ) ) { _factories . put ( name , new LegacyUserTagFactory ( source ) ) ; } else { _factories . put ( name , new UserTagFactory ( source ) ) ; } }
Add a UserTagHandler specified a the URL source .
147
11
161,827
@ Reference ( policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . MULTIPLE , target = "(!(com.ibm.ws.security.registry.type=QuickStartSecurityRegistry))" ) protected synchronized void setUserRegistry ( ServiceReference < UserRegistry > ref ) { urs . add ( ref ) ; unregisterQuickStartSecurityRegistryConfiguration ( ) ; unregisterQuickStartSecurityAdministratorRole ( ) ; }
This method will only be called for UserRegistryConfigurations that are not the one we have defined here .
102
22
161,828
@ Reference ( policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . MULTIPLE , target = "(!(com.ibm.ws.management.security.role.name=QuickStartSecurityAdministratorRole))" ) protected synchronized void setManagementRole ( ServiceReference < ManagementRole > ref ) { managementRoles . add ( ref ) ; unregisterQuickStartSecurityRegistryConfiguration ( ) ; unregisterQuickStartSecurityAdministratorRole ( ) ; }
This method will only be called for ManagementRoles that are not the one we have defined here .
103
20
161,829
@ Modified protected synchronized void modify ( QuickStartSecurityConfig config ) { this . config = config ; validateConfigurationProperties ( ) ; if ( urConfigReg == null ) { registerQuickStartSecurityRegistryConfiguration ( ) ; } else { updateQuickStartSecurityRegistryConfiguration ( ) ; } unregisterQuickStartSecurityAdministratorRole ( ) ; registerQuickStartSecurityAdministratorRole ( ) ; }
Push the new user and password into the registry s configuration .
82
12
161,830
@ Trivial private boolean isStringValueUndefined ( Object str ) { if ( str instanceof SerializableProtectedString ) { // Avoid constructing a String from a ProtectedString char [ ] contents = ( ( SerializableProtectedString ) str ) . getChars ( ) ; for ( char ch : contents ) if ( ch > ' ' ) return false ; // See the description of String.trim() return true ; } else { return ( str == null || ( ( String ) str ) . trim ( ) . isEmpty ( ) ) ; } }
Check if the value is non - null not empty and not all white - space .
118
17
161,831
private Dictionary < String , Object > buildUserRegistryConfigProps ( ) { Hashtable < String , Object > properties = new Hashtable < String , Object > ( ) ; properties . put ( "config.id" , QUICK_START_SECURITY_REGISTRY_ID ) ; properties . put ( "id" , QUICK_START_SECURITY_REGISTRY_ID ) ; properties . put ( UserRegistryService . REGISTRY_TYPE , QUICK_START_SECURITY_REGISTRY_TYPE ) ; properties . put ( CFG_KEY_USER , config . userName ( ) ) ; properties . put ( "service.vendor" , "IBM" ) ; return properties ; }
Build the UserRegistryConfiguration properties based on the current user and password .
161
15
161,832
private void registerQuickStartSecurityRegistryConfiguration ( ) { if ( bc == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "BundleContext is null, we must be deactivated." ) ; } return ; } if ( urConfigReg != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "QuickStartSecurityRegistry configuration is already registered." ) ; } return ; } if ( isStringValueUndefined ( config . userName ( ) ) || isStringValueUndefined ( config . userPassword ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Incomplete configuration. This should already have been reported. Will not register QuickStartSecurityRegistry configuration." ) ; } return ; } if ( config . UserRegistry ( ) != null && config . UserRegistry ( ) . length > 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Other UserRegistryConfiguration are present, will not register the QuickStartSecurityRegistry configuration." ) ; } return ; } if ( ! managementRoles . isEmpty ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Other ManagementRole are present, will not register the QuickStartSecurityRegistry configuration." ) ; } return ; } Dictionary < String , Object > props = buildUserRegistryConfigProps ( ) ; quickStartRegistry = new QuickStartSecurityRegistry ( config . userName ( ) , Password . create ( config . userPassword ( ) ) ) ; urConfigReg = bc . registerService ( UserRegistry . class , quickStartRegistry , props ) ; }
Create register and return the ServiceRegistration for the quick start security UserRegistryConfiguration .
425
17
161,833
private void unregisterQuickStartSecurityRegistryConfiguration ( ) { if ( urConfigReg != null ) { urConfigReg . unregister ( ) ; urConfigReg = null ; quickStartRegistry = null ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "QuickStartSecurityRegistry configuration is not registered." ) ; } } }
Unregister the quick start security security UserRegistryConfiguration .
91
12
161,834
private void registerQuickStartSecurityAdministratorRole ( ) { if ( bc == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "BundleContext is null, we must be deactivated." ) ; } return ; } if ( managementRoleReg != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "QuickStartSecurityAdministratorRole is already registered." ) ; } return ; } if ( urConfigReg == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "QuickStartSecurityRegistry configuration is not registered, will not register QuickStartSecurityAdministratorRole." ) ; } return ; } if ( isStringValueUndefined ( config . userName ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "User is not set, can not register the QuickStartSecurityAdministratorRole" ) ; } return ; } if ( ! managementRoles . isEmpty ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Other managment roles are present, will not register the QuickStartSecurityAdministratorRole" ) ; } return ; } Dictionary < String , Object > props = new Hashtable < String , Object > ( ) ; props . put ( ManagementRole . MANAGEMENT_ROLE_NAME , QUICK_START_ADMINISTRATOR_ROLE_NAME ) ; props . put ( "service.vendor" , "IBM" ) ; managementRole = new QuickStartSecurityAdministratorRole ( config . userName ( ) ) ; managementRoleReg = bc . registerService ( ManagementRole . class , managementRole , props ) ; }
Register the quick start security management role .
428
8
161,835
static long roundUpDelay ( long delay , TimeUnit unit , long now ) { if ( delay < 0 ) { // Negative is treated as 0. delay = 0 ; } long target = now + unit . toMillis ( delay ) ; if ( target < now ) { // We can't add the delay to the current time without overflow. // Return the delay unaltered. return delay ; } long remainder = target % PERIOD_MILLISECONDS ; if ( remainder == 0 ) { // Already rounded. return delay ; } long extra = PERIOD_MILLISECONDS - remainder ; long newDelay = delay + unit . convert ( extra , TimeUnit . MILLISECONDS ) ; if ( newDelay < delay ) { // We can't round up without overflow. Return the delay unaltered. return delay ; } return newDelay ; }
Round up delays so that all tasks fire at approximately with approximately the same 15s period .
189
18
161,836
public static void copyStream ( InputStream from , OutputStream to ) throws IOException { byte buffer [ ] = new byte [ 2048 ] ; int bytesRead ; while ( ( bytesRead = from . read ( buffer ) ) != - 1 ) { to . write ( buffer , 0 , bytesRead ) ; } from . close ( ) ; }
Copy the given InputStream to the given OutputStream .
71
11
161,837
public static void copyReader ( Reader from , Writer to ) throws IOException { char buffer [ ] = new char [ 2048 ] ; int charsRead ; while ( ( charsRead = from . read ( buffer ) ) != - 1 ) { to . write ( buffer , 0 , charsRead ) ; } from . close ( ) ; to . flush ( ) ; }
Copy the given Reader to the given Writer .
75
9
161,838
public void activate ( ) { // if no handlers are currently running, start one now if ( this . numHandlersInFlight . getInt ( ) == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Activating result handler: " + this . completionPort ) ; } startHandler ( ) ; } }
Activate the result handler when the channel starts .
85
10
161,839
public static void setConnectionHandle ( VirtualConnection vc , ConnectionHandle handle ) { if ( vc == null || handle == null ) { return ; } Map < Object , Object > map = vc . getStateMap ( ) ; // set connection handle into VC Object vcLock = vc . getLockObject ( ) ; synchronized ( vcLock ) { Object tmpHandle = map . get ( CONNECTION_HANDLE_VC_KEY ) ; // If this connection already has a unique handle when we get here, // something went wrong. if ( tmpHandle != null ) { throw new IllegalStateException ( "Connection " + tmpHandle + " has already been created" ) ; } map . put ( CONNECTION_HANDLE_VC_KEY , handle ) ; } }
Set the connection handle on the virtual connection .
167
9
161,840
protected void setConnectionType ( VirtualConnection vc ) { if ( this . myType == 0 || vc == null ) { ConnectionType newType = ConnectionType . getVCConnectionType ( vc ) ; this . myType = ( newType == null ) ? 0 : newType . export ( ) ; } }
Set ConnectionType based on the input virtual connection .
67
10
161,841
public static void processException ( Throwable th , String sourceId , String probeId , Object callerThis ) { FFDCConfigurator . getDelegate ( ) . processException ( th , sourceId , probeId , callerThis ) ; }
Write a first failure data capture record for the provided throwable
51
12
161,842
void close ( ) { if ( logger . isLoggable ( Level . FINER ) ) { logger . logp ( Level . FINER , logger . getName ( ) , "close" , "Close called for " + RESTClientMessagesUtil . getObjID ( this ) + " within connection: " + connector . getConnectionId ( ) ) ; } closePollingThread ( ) ; if ( notificationRegistry != null ) { notificationRegistry . close ( ) ; } if ( connector . logFailovers ( ) ) { String disconnectMsg = RESTClientMessagesUtil . getMessage ( RESTClientMessagesUtil . MEMBER_DISCONNECT , connector . getCurrentEndpoint ( ) ) ; logger . logp ( Level . INFO , logger . getName ( ) , "close" , disconnectMsg ) ; } disconnect ( ) ; }
do the proper cleaning procedures .
182
6
161,843
@ Trivial private File getArchiveFile ( ) { String methodName = "getArchiveFile" ; if ( archiveFileLock != null ) { synchronized ( archiveFileLock ) { if ( ( archiveFile == null ) && ! archiveFileFailed ) { try { archiveFile = extractEntry ( entryInEnclosingContainer , getCacheDir ( ) ) ; // 'extractEntry' throws IOException if ( archiveFile != null ) { archiveFilePath = archiveFile . getAbsolutePath ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " Archive file [ " + archiveFilePath + " ]" ) ; } } else { archiveFileFailed = true ; Tr . error ( tc , "extract.cache.null" , entryInEnclosingContainer . getPath ( ) ) ; } } catch ( IOException e ) { archiveFileFailed = true ; Tr . error ( tc , "extract.cache.fail" , e . getMessage ( ) ) ; } } } } return archiveFile ; }
Answer the archive file . Extract it if necessary . Answer null if extraction fails .
242
16
161,844
private String getArchiveFilePath ( ) { if ( archiveFileLock == null ) { return archiveFilePath ; } else { synchronized ( archiveFileLock ) { @ SuppressWarnings ( "unused" ) File useArchiveFile = getArchiveFile ( ) ; return archiveFilePath ; } } }
Answer the absolute path to the archive file . Do an extraction if this is a nested archive and the file is not yet extracted . Answer null if extraction fails .
67
32
161,845
ZipFileHandle getZipFileHandle ( ) throws IOException { synchronized ( zipFileHandleLock ) { if ( zipFileHandleFailed ) { return null ; } else if ( zipFileHandle != null ) { return zipFileHandle ; } File useArchiveFile = getArchiveFile ( ) ; if ( useArchiveFile == null ) { zipFileHandleFailed = true ; throw new FileNotFoundException ( entryInEnclosingContainer . getPath ( ) ) ; } try { String useCanonicalPath = getCanonicalPath ( useArchiveFile ) ; // throws IOException zipFileHandle = getZipFileHandle ( useCanonicalPath ) ; // throws IOException } catch ( IOException e ) { zipFileHandleFailed = true ; throw e ; } return zipFileHandle ; } }
Answer the handle to the archive file of this container .
174
11
161,846
@ Trivial protected ZipFileEntry createEntry ( String entryName , String a_entryPath ) { ZipEntryData [ ] useZipEntries = getZipEntryData ( ) ; if ( useZipEntries . length == 0 ) { return null ; } String r_entryPath = a_entryPath . substring ( 1 ) ; int location = locatePath ( r_entryPath ) ; ZipEntryData entryData ; if ( location < 0 ) { location = ( ( location + 1 ) * - 1 ) ; entryData = null ; } else { entryData = useZipEntries [ location ] ; } return createEntry ( null , entryName , a_entryPath , entryData ) ; }
Answer the zip entry for the zip file entry at the specified path . The zip file entry may be virtual .
149
22
161,847
URI createEntryUri ( String r_entryPath , File useArchiveFile ) { URI archiveUri = getURI ( useArchiveFile ) ; if ( archiveUri == null ) { return null ; } if ( r_entryPath . isEmpty ( ) ) { return null ; } // URLs for jar/zip data now use wsjar to avoid locking issues via jar protocol. // // The single string constructor is used to control the encoding an ddecoding. // // The return value of 'parentUri.toString()' is an encoded string. The // handler (usually WSJarURLStreamHandler) must decode that string. // // See: http://stackoverflow.com/questions/9419658/normalising-possibly-encoded-uri-strings-in-java. String encodedUriText = getProtocol ( ) + ":" + archiveUri . toString ( ) + "!/" + ParserUtils . encode ( r_entryPath ) ; try { return new URI ( encodedUriText ) ; } catch ( URISyntaxException e ) { // FFDC return null ; } }
Create and return a URI for an entry of an archive .
243
12
161,848
@ Trivial private static URI getURI ( final File file ) { return AccessController . doPrivileged ( new PrivilegedAction < URI > ( ) { @ Override public URI run ( ) { return file . toURI ( ) ; } } ) ; }
File utility ...
55
3
161,849
private ExtractionGuard placeExtractionGuard ( String path ) { boolean isPrimary ; CountDownLatch completionLatch ; synchronized ( extractionsLock ) { completionLatch = extractionLocks . get ( path ) ; if ( completionLatch != null ) { isPrimary = false ; } else { isPrimary = true ; completionLatch = new CountDownLatch ( 1 ) ; extractionLocks . put ( path , completionLatch ) ; } } return new ExtractionGuard ( path , isPrimary , completionLatch ) ; }
Make sure a completion latch exists for a specified path .
112
11
161,850
private void releaseExtractionGuard ( ExtractionGuard extractionLatch ) { synchronized ( extractionsLock ) { extractionLocks . remove ( extractionLatch . path ) ; } extractionLatch . completionLatch . countDown ( ) ; }
unblocking secondary extractions .
50
6
161,851
private boolean isModified ( ArtifactEntry entry , File file ) { long fileLastModified = FileUtils . fileLastModified ( file ) ; long entryLastModified = entry . getLastModified ( ) ; // File 100K entry 10K delta 90k true (entry is much older than the file) // File 10k entry 100k delta 90k true (file is much older than the entry) // File 10k entry 9k delta 1k false (entry is slightly older than the file) // File 9k entry 10k delta 1k false (file is slightly older than the entry) // File 9k entry 9k delta 0k false (file and entry are exactly the same age) return ( Math . abs ( fileLastModified - entryLastModified ) >= 1010L ) ; }
Tell if an entry is modified relative to a file . That is if the last modified times are different .
171
21
161,852
@ Trivial private boolean deleteAll ( File rootFile ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Delete [ " + rootFile . getAbsolutePath ( ) + " ]" ) ; } if ( FileUtils . fileIsFile ( rootFile ) ) { boolean didDelete = FileUtils . fileDelete ( rootFile ) ; if ( ! didDelete ) { Tr . error ( tc , "Could not delete file [ " + rootFile . getAbsolutePath ( ) + " ]" ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Deleted" ) ; } } return didDelete ; } else { boolean didDeleteAll = true ; int deleteCount = 0 ; File childFiles [ ] = FileUtils . listFiles ( rootFile ) ; int childCount ; if ( childFiles != null ) { childCount = childFiles . length ; for ( File childFile : childFiles ) { // Keep iterating even if one of the deletes fails. // Delete as much as possible. if ( ! deleteAll ( childFile ) ) { didDeleteAll = false ; } else { deleteCount ++ ; } } } else { childCount = 0 ; deleteCount = 0 ; } if ( didDeleteAll ) { didDeleteAll = FileUtils . fileDelete ( rootFile ) ; } if ( ! didDeleteAll ) { Tr . error ( tc , "Could not delete directory [ " + rootFile . getAbsolutePath ( ) + " ]" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Deleted [ " + Integer . valueOf ( deleteCount ) + " ]" + " of [ " + Integer . valueOf ( childCount ) + " ]" ) ; } return didDeleteAll ; } }
a single consolidated wrapper .
430
5
161,853
public void startRecovery ( RecoveryLogFactory fac ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "startRecovery" , fac ) ; // This is a stand alone server. HA can never effect this server so direct local recovery now. RecoveryDirector director = null ; try { director = RecoveryDirectorFactory . recoveryDirector ( ) ; /* @LI1578-22A */ director . setRecoveryLogFactory ( fac ) ; ( ( RecoveryDirectorImpl ) director ) . driveLocalRecovery ( ) ; /* @LI1578-22C */ } catch ( RecoveryFailedException exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery" , "421" , this ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Local recovery failed." ) ; // if (tc.isEntryEnabled()) Tr.exit(tc, "start", "RuntimeError"); // throw new RuntimeError("Unable to complete local recovery processing", exc); } catch ( InternalLogException ile ) { FFDCFilter . processException ( ile , "com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery" , "478" , this ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Local recovery not attempted." , ile ) ; // if (tc.isEntryEnabled()) Tr.exit(tc, "start", "RuntimeError"); // throw new RuntimeError("Unable to complete local recovery processing", ile); } if ( director != null && _isPeerRecoverySupported ) // used to test _recoveryGroup != null { if ( checkPeersAtStartup ( ) ) { try { if ( director instanceof LibertyRecoveryDirectorImpl ) { ( ( LibertyRecoveryDirectorImpl ) director ) . drivePeerRecovery ( ) ; } } catch ( RecoveryFailedException exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.RecLogServiceImpl.startRecovery" , "421" , this ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Local peer failed." ) ; } } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "startRecovery" ) ; }
Driven by the runtime during server startup . This hook is used to perform recovery log service initialization .
528
20
161,854
private boolean checkPeersAtStartup ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "checkPeersAtStartup" ) ; boolean checkAtStartup ; try { checkAtStartup = AccessController . doPrivileged ( new PrivilegedExceptionAction < Boolean > ( ) { @ Override public Boolean run ( ) { return Boolean . getBoolean ( "com.ibm.ws.recoverylog.spi.CheckPeersAtStartup" ) ; } } ) ; } catch ( PrivilegedActionException e ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "checkPeersAtStartup" , e ) ; checkAtStartup = false ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "checkPeersAtStartup" , checkAtStartup ) ; return checkAtStartup ; }
This method retrieves a system property named com . ibm . ws . recoverylog . spi . CheckPeersAtStartup which allows the check to see if peer servers are stale to be bypassed at server startup . The checks will subsequently be performed through the spun - off timer thread .
197
61
161,855
public synchronized void writeHeader ( long timestamp ) throws IOException { if ( writer == null && headerBytes != null ) { writer = createNewWriter ( manager . startNewFile ( timestamp ) ) ; writer . write ( headerBytes ) ; manager . notifyOfFileAction ( LogEventListener . EVENTTYPEROLL ) ; } }
Publishes header if it wasn t done yet .
69
10
161,856
public synchronized void stop ( ) { if ( writer != null ) { try { writer . close ( headerBytes ) ; writer = null ; } catch ( IOException ex ) { // No need to crash on this error even if the tail won't be written // since reading logic can take care of that. } } // Ensure that timer is stopped as well. disableFileSwitch ( ) ; headerBytes = null ; // Don't stop manager here since it can be reused for a different repository writer. //manager.stop(); }
Stops this writer and close its output stream .
107
10
161,857
public void enableFileSwitch ( int switchHour ) { if ( fileSwitchTimer == null ) { fileSwitchTimer = AccessHelper . createTimer ( ) ; } //set calendar instance to the specified configuration hour for cutting //default to midnight when the passed in value is invalid, or midnight is specified (to avoid negative value when 1 is subtracted if ( switchHour < MIN_SWITCH_HOUR || switchHour > MAX_SWITCH_HOUR ) { // It's OK to use logger here since adding logging record will not result in changing // file switching configuration. logger . logp ( Level . WARNING , className , "enableFileSwitch" , "HPEL_IncorrectSwitchHour" , new Object [ ] { switchHour , MIN_SWITCH_HOUR , MAX_SWITCH_HOUR , MIN_SWITCH_HOUR } ) ; switchHour = MIN_SWITCH_HOUR ; } //Note: We will set the file cutting time to match the exact hour that was specified, but it's possible for the timestamp attribute of the file //to go beyond the switchTime, as the final writes to close the file will alter the timestamp attribute. //For example, if a fileSwitch was set to midnight, log records that are written after midnight will go to a new file, but it's possible for the //previous file being closed to have a midnight timestamp attribute. Calendar currentTime = Calendar . getInstance ( ) ; Calendar switchTime = currentTime ; switchTime . set ( Calendar . HOUR_OF_DAY , switchHour ) ; switchTime . set ( Calendar . MINUTE , 00 ) ; switchTime . set ( Calendar . SECOND , 00 ) ; //if the time has already passed, then set to the next day. Otherwise //the timer will catch up on the missed tasks that would've been executed. //For example: If the switchTime was set to 11 (for 11AM), and the server gets started after 11AM, we do not want the file switch //to occur until 11AM of the following day. if ( currentTime . after ( switchTime ) ) { switchTime . add ( Calendar . DATE , 1 ) ; } fileSwitchTime . setTime ( switchTime . getTimeInMillis ( ) ) ; fileSwitchTimer . scheduleAtFixedRate ( fileSwitchTask , fileSwitchTime , SWITCH_PERIOD ) ; }
Enables file switching for the writer by configuring the timer to set a trigger based on the switchHour parm
498
23
161,858
private X509TrustManager createPromptingTrustManager ( ) { TrustManager [ ] trustManagers = null ; try { String defaultAlg = TrustManagerFactory . getDefaultAlgorithm ( ) ; TrustManagerFactory tmf = TrustManagerFactory . getInstance ( defaultAlg ) ; tmf . init ( ( KeyStore ) null ) ; trustManagers = tmf . getTrustManagers ( ) ; } catch ( KeyStoreException e ) { // Unable to initialize the default trust managers. // This is not a problem as PromptX509rustManager can handle null. } catch ( NoSuchAlgorithmException e ) { // Unable to get default trust managers. // This is not a problem as PromptX509rustManager can handle null. } boolean autoAccept = Boolean . valueOf ( System . getProperty ( SYS_PROP_AUTO_ACCEPT , "false" ) ) ; return new PromptX509TrustManager ( stdin , stdout , trustManagers , autoAccept ) ; }
Create a custom trust manager which will prompt for trust acceptance .
214
12
161,859
private SSLSocketFactory setUpSSLContext ( ) throws NoSuchAlgorithmException , KeyManagementException { SSLContext ctx = SSLContext . getInstance ( "SSL" ) ; ctx . init ( null , new TrustManager [ ] { createPromptingTrustManager ( ) } , null ) ; return ctx . getSocketFactory ( ) ; }
Set up the common SSL context for the outbound connection .
75
12
161,860
private HashMap < String , Object > createJMXEnvironment ( final String user , final String password , final SSLSocketFactory sslSF ) { HashMap < String , Object > environment = new HashMap < String , Object > ( ) ; environment . put ( "jmx.remote.protocol.provider.pkgs" , "com.ibm.ws.jmx.connector.client" ) ; environment . put ( JMXConnector . CREDENTIALS , new String [ ] { user , password } ) ; environment . put ( ClientProvider . READ_TIMEOUT , 2 * 60 * 1000 ) ; environment . put ( ConnectorSettings . DISABLE_HOSTNAME_VERIFICATION , Boolean . TRUE ) ; environment . put ( ConnectorSettings . CUSTOM_SSLSOCKETFACTORY , sslSF ) ; environment . put ( "isCollectiveUtil" , Boolean . TRUE ) ; return environment ; }
Creates the common JMX environment used to connect to the controller .
202
14
161,861
private JMXConnector getMBeanServerConnection ( String controllerHost , int controllerPort , HashMap < String , Object > environment ) throws MalformedURLException , IOException { JMXServiceURL serviceURL = new JMXServiceURL ( "REST" , controllerHost , controllerPort , "/IBMJMXConnectorREST" ) ; return new ClientProvider ( ) . newJMXConnector ( serviceURL , environment ) ; }
Get the MBeanServerConnection for the target controller host and port .
92
15
161,862
public JMXConnector getJMXConnector ( String controllerHost , int controllerPort , String user , String password ) throws NoSuchAlgorithmException , KeyManagementException , MalformedURLException , IOException { HashMap < String , Object > environment = createJMXEnvironment ( user , password , setUpSSLContext ( ) ) ; JMXConnector connector = getMBeanServerConnection ( controllerHost , controllerPort , environment ) ; connector . connect ( ) ; return connector ; }
Returns a connected JMXConnector .
101
7
161,863
public synchronized void commit ( ) throws SIIncorrectCallException , SIRollbackException , SIResourceException , SIConnectionLostException , SIErrorException { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "commit" ) ; if ( ! valid ) { throw new SIIncorrectCallException ( nls . getFormattedMessage ( "TRANSACTION_COMPLETE_SICO1022" , null , null ) ) ; } // Mark this as invalid valid = false ; CommsByteBuffer request = getCommsByteBuffer ( ) ; request . putShort ( getConnectionObjectID ( ) ) ; request . putInt ( getTransactionId ( ) ) ; CommsByteBuffer reply = null ; try { // Pass on call to server reply = jfapExchange ( request , JFapChannelConstants . SEG_COMMIT_TRANSACTION , lowestPriority , true ) ; short err = reply . getCommandCompletionCode ( JFapChannelConstants . SEG_COMMIT_TRANSACTION_R ) ; if ( err != CommsConstants . SI_NO_EXCEPTION ) { checkFor_SIIncorrectCallException ( reply , err ) ; checkFor_SIRollbackException ( reply , err ) ; checkFor_SIResourceException ( reply , err ) ; checkFor_SIConnectionLostException ( reply , err ) ; checkFor_SIErrorException ( reply , err ) ; defaultChecker ( reply , err ) ; } } catch ( SIConnectionDroppedException e ) { // No FFDC Code needed // In this case we translate this to an SIConnectionLostException - as transactions aren't // tided to a particular connection throw new SIConnectionLostException ( e . getMessage ( ) , e ) ; } finally { if ( reply != null ) reply . release ( ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "commit" ) ; }
Commits this transaction by flowing the commit to the server and marking this transaction as invalid .
442
18
161,864
public synchronized void rollback ( ) throws SIIncorrectCallException , SIResourceException , SIConnectionLostException , SIErrorException { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "rollback" ) ; if ( ! valid ) { throw new SIIncorrectCallException ( nls . getFormattedMessage ( "TRANSACTION_COMPLETE_SICO1022" , null , null ) ) ; } // Mark this as invalid valid = false ; CommsByteBuffer request = getCommsByteBuffer ( ) ; request . putShort ( getConnectionObjectID ( ) ) ; request . putInt ( getTransactionId ( ) ) ; CommsByteBuffer reply = null ; try { // Pass on call to server reply = jfapExchange ( request , JFapChannelConstants . SEG_ROLLBACK_TRANSACTION , lowestPriority , true ) ; // Inform any associated consumers of the rollback, in case there are // redelivery ordering considerations. We do this regardless of the // success of the rollback, but need to do it after the rollback has // been sent to the ME. informConsumersOfRollback ( ) ; short err = reply . getCommandCompletionCode ( JFapChannelConstants . SEG_ROLLBACK_TRANSACTION_R ) ; if ( err != CommsConstants . SI_NO_EXCEPTION ) { checkFor_SIIncorrectCallException ( reply , err ) ; checkFor_SIResourceException ( reply , err ) ; checkFor_SIConnectionLostException ( reply , err ) ; checkFor_SIErrorException ( reply , err ) ; defaultChecker ( reply , err ) ; } } catch ( SIConnectionDroppedException e ) { // No FFDC Code needed // PK60857: The connection broke on us, but the ME side will eventually timeout // and assume rollback. So we can safely consume this exception. We previously // threw an exception here but that leaked a connection from the pool because // the tx never completed. if ( tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Connection failure during rollback." ) ; } finally { if ( reply != null ) reply . release ( ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "rollback" ) ; }
Rolls back this transaction by flowing the rollback to the server and marking this transaction as invalid .
522
20
161,865
public synchronized boolean isValid ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "isValid" ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "isValid" , "" + valid ) ; return valid ; }
This method will return true if the transaction has not been committed or rolled back .
68
16
161,866
public short getLowestMessagePriority ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getLowestMessagePriority" ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getLowestMessagePriority" , "" + lowestPriority ) ; return lowestPriority ; }
This method gets the lowest message priority being used in this transaction and as such is the JFAP priority that commit and rollback will be sent as .
83
31
161,867
public void updateLowestMessagePriority ( short messagePriority ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "updateLowestMessagePriority" , new Object [ ] { "" + messagePriority } ) ; // Only update if the message priority is lower than another message if ( messagePriority < this . lowestPriority ) { if ( tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Updating lowest priority" ) ; this . lowestPriority = messagePriority ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "updateLowestMessagePriority" ) ; }
This method is used to update the lowest message priority that has been sent on this transaction . The value passed in is stored if it is lower than a previous value . Otherwise it is ignored . The stored value is then used on the exchanges sent when we commit or rollback .
152
55
161,868
public void associateConsumer ( ConsumerSessionProxy consumer ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "associateConsumer" , new Object [ ] { consumer , Boolean . valueOf ( strictRedeliveryOrdering ) } ) ; // This is a no-op if strict redelivery ordering is disabled if ( strictRedeliveryOrdering && consumer != null ) { synchronized ( associatedConsumersLock ) { associatedConsumers . add ( consumer ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "associateConsumer" ) ; }
Called each time a recoverable message is deleted from a consumer using a proxy queue under this transaction to allow the transaction to callback inform the proxy queue it should purge any read - ahead messages if required .
157
41
161,869
public void informConsumersOfRollback ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "informConsumersOfRollback" , new Object [ ] { Boolean . valueOf ( strictRedeliveryOrdering ) } ) ; if ( strictRedeliveryOrdering ) { // Take a copy of the set of consumers, to avoid additional locking // when we call into the consumers to inform them of a rollback. ConsumerSessionProxy [ ] consumersToNotify ; synchronized ( associatedConsumersLock ) { consumersToNotify = new ConsumerSessionProxy [ associatedConsumers . size ( ) ] ; consumersToNotify = ( ConsumerSessionProxy [ ] ) associatedConsumers . toArray ( consumersToNotify ) ; } // Callback each consumer to inform them of the rollback for ( int i = 0 ; i < consumersToNotify . length ; i ++ ) { try { consumersToNotify [ i ] . rollbackOccurred ( ) ; } catch ( SIException e ) { // FFDC for the error, but do not re-throw. // Most likely the connection to the ME is unavailable, or the // consumer has been closed and cleaned up. // In these cases the consumer will not be able to consume any // more messages - so redelivery ordering is not an issue. FFDCFilter . processException ( e , CLASS_NAME + ".informConsumersOfRollback" , CommsConstants . TRANSACTION_INFORMCONSUMERSOFROLLBACK_01 , this ) ; if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Encountered error informing consumer of rollback: " + consumersToNotify [ i ] ) ; if ( tc . isEventEnabled ( ) ) SibTr . exception ( tc , e ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "informConsumersOfRollback" ) ; }
Inform all associated consumers that a rollback has occurred .
449
12
161,870
static void unboundSfsbFromExtendedPC ( JPAExPcBindingContext bindingContext ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "unboundSfsbFromExtendedPC : " + bindingContext ) ; JPAPuId puIds [ ] = bindingContext . getExPcPuIds ( ) ; long bindId = bindingContext . getBindId ( ) ; // New this binding key only once and update the puid in the loop ExPcBindingKey bindingKey = new ExPcBindingKey ( bindId , null ) ; for ( JPAPuId puId : puIds ) { bindingKey . puId = puId ; ExPcBindingInfo exPcBindingInfo = svExPcBindingMap . remove ( bindingKey ) ; if ( exPcBindingInfo != null ) { // JPA 5.9.1 Container Responsibilities // // The container closes the entity manager by calling EntityManager.close after the // stateful session bean and all other stateful session beans that have inherited // the same persistence context as the EntityManager have been removed. if ( exPcBindingInfo . removeRemovedOrDiscardedSfsb ( bindingKey ) == 0 ) { EntityManager em = exPcBindingInfo . getEntityManager ( ) ; if ( em != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "All SFSBs using the same extend-scoped persistence " + "context have been removed, closing EntityManager " + em ) ; if ( em . isOpen ( ) ) // d442445 em . close ( ) ; } } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "unboundSfsbFromExtendedPC : exPcBindMap size=" + svExPcBindingMap . size ( ) ) ; }
When SFSB instances are removed or discard this method is called to unbind the SFSB from the associated persistence context . When the last SFSB is removed from the bound collection the associated EntityManager is closed .
449
45
161,871
private static final boolean parentHasSameExPc ( JPAPuId parentPuIds [ ] , JPAPuId puId ) { for ( JPAPuId parentPuId : parentPuIds ) { if ( parentPuId . equals ( puId ) ) { return true ; } } return false ; }
Returns true if the caller and callee have declared the same
72
12
161,872
public void queue ( JFapByteBuffer bufferData , int segmentType , int requestNumber , int priority , SendListener sendListener , Conversation conversation , Connection connection , int conversationId , boolean pooledBuffers , boolean partOfExchange , long size , boolean terminal , ThrottlingPolicy throttlingPolicy ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "queue" ) ; TransmissionDataIterator iterator = TransmissionDataIterator . allocateFromPool ( connection , bufferData , priority , pooledBuffers , partOfExchange , segmentType , conversationId , requestNumber , conversation , sendListener , terminal , ( int ) size ) ; // begin F193735.3 if ( type == Conversation . ME ) meQueuedBytes += size ; else if ( type == Conversation . CLIENT ) clientQueuedBytes += size ; // end F193735.3 queueInternal ( iterator , throttlingPolicy , terminal ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "queue" ) ; }
Queues the specified request into the priority table .
247
10
161,873
public TransmissionData dequeue ( ) throws SIConnectionDroppedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "dequeue" ) ; TransmissionData retValue = null ; Queue queue = null ; synchronized ( queueMonitor ) { if ( state == CLOSED ) { throw new SIConnectionDroppedException ( TraceNLS . getFormattedMessage ( JFapChannelConstants . MSG_BUNDLE , "PRIORITY_QUEUE_PURGED_SICJ0077" , null , "PRIORITY_QUEUE_PURGED_SICJ0077" ) ) ; } else { // Find the highest non-empty priority int priority = JFapChannelConstants . MAX_PRIORITY_LEVELS - 1 ; while ( ( priority >= 0 ) && ( queueArray [ priority ] . depth == 0 ) ) -- priority ; if ( priority >= 0 ) { queue = queueArray [ priority ] ; // Dequeue the data and update the queue appropriately. TransmissionDataIterator iterator = queue . head ( ) ; // D217401 retValue = iterator . next ( ) ; queue . bytes -= retValue . getSize ( ) ; // If there is no more data left to iterate over then remove the // transmission data from the queue and update the depth counters. if ( ! iterator . hasNext ( ) ) { queue . dequeue ( ) ; // D217401 -- queue . depth ; -- totalQueueDepth ; } // If the priority queue is in closing state and we have just emptied // the queue, mark the queue as closed and unblock anyone waiting for the // queue to close. if ( ( totalQueueDepth == 0 ) && ( state == CLOSING ) ) { state = CLOSED ; // Transition to the close state closeWaitersMonitor . setActive ( false ) ; // Unblock anyone waiting for the close // Un-block any queue monitors, in case other threads are blocked waiting // to try and queue data. for ( int i = 0 ; i < JFapChannelConstants . MAX_PRIORITY_LEVELS ; ++ i ) queueArray [ i ] . monitor . setActive ( false ) ; } // If dequeueing the data caused a change in capacity then // take the appropriate actions if ( ! queue . hasCapacity && ( queue . bytes < maxQueueBytes ) && queue . depth < maxQueueDepth ) { // Mark the queue as having capacity queue . hasCapacity = true ; // If the change in capacity results in more priority levels having capacity then... if ( priority < lowestPriorityWithCapacity ) { // Unblock any threads waiting on the lower capacity levels int newLowestPriorityWithCapacity = priority ; while ( ( newLowestPriorityWithCapacity > 0 ) && queueArray [ newLowestPriorityWithCapacity - 1 ] . hasCapacity ) { queueArray [ newLowestPriorityWithCapacity ] . monitor . setActive ( false ) ; -- newLowestPriorityWithCapacity ; } lowestPriorityWithCapacity = newLowestPriorityWithCapacity ; queueArray [ lowestPriorityWithCapacity ] . monitor . setActive ( false ) ; } } } } } if ( retValue != null ) { if ( type == Conversation . CLIENT ) clientQueuedBytes -= retValue . getSize ( ) ; else meQueuedBytes -= retValue . getSize ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "dequeue" , retValue ) ; return retValue ; }
De - queues the highest priority entry from the table
796
10
161,874
public boolean hasCapacity ( int priority ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "hasCapacity" , "" + priority ) ; boolean result ; synchronized ( queueMonitor ) { result = priority >= lowestPriorityWithCapacity ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "hasCapacity" , "" + result ) ; return result ; }
Checks to see if a given priority level has the capacity to accept another message to be queued .
119
21
161,875
public void close ( boolean immediate ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "close" , "" + immediate ) ; synchronized ( queueMonitor ) { if ( immediate || ( totalQueueDepth == 0 ) ) { state = CLOSED ; closeWaitersMonitor . setActive ( false ) ; } else state = CLOSING ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "close" ) ; }
Closes the priority queue . This causes all new queue requests to be ignored . Any existing data that has been queued may be dequeued unless the immediate flag has been set in which case we consider ourselves closed .
129
44
161,876
public void purge ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "purge" ) ; synchronized ( queueMonitor ) { state = CLOSED ; for ( int i = 0 ; i < JFapChannelConstants . MAX_PRIORITY_LEVELS - 1 ; ++ i ) { queueArray [ i ] . monitor . setActive ( false ) ; } closeWaitersMonitor . setActive ( false ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "purge" ) ; }
Purges the content of the priority queue . This closes the queue and wakes up any blocked threads
151
19
161,877
public void waitForCloseToComplete ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "waitForCloseToComplete" ) ; closeWaitersMonitor . waitOn ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "waitForCloseToComplete" ) ; }
Blocks until a close operation has completed . I . e . the priority queue has been drained . If the queue is already closed this method returns immeidately .
101
33
161,878
public boolean isEmpty ( ) throws SIConnectionDroppedException { synchronized ( queueMonitor ) { if ( state == CLOSED ) throw new SIConnectionDroppedException ( TraceNLS . getFormattedMessage ( JFapChannelConstants . MSG_BUNDLE , "PRIORITY_QUEUE_PURGED_SICJ0077" , null , "PRIORITY_QUEUE_PURGED_SICJ0077" ) ) ; return totalQueueDepth == 0 ; } }
Returns true iff this priority queue is empty .
118
10
161,879
private static boolean isGABuild ( ) { boolean result = true ; final Properties props = new Properties ( ) ; AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { @ Override public Object run ( ) { try { final File version = new File ( getInstallDir ( ) , "lib/versions/WebSphereApplicationServer.properties" ) ; Reader r = new InputStreamReader ( new FileInputStream ( version ) , "UTF-8" ) ; props . load ( r ) ; r . close ( ) ; } catch ( IOException e ) { // ignore because we fail safe. Returning true will result in a GA suitable schema } return null ; } } ) ; String v = props . getProperty ( "com.ibm.websphere.productVersion" ) ; if ( v != null ) { int index = v . indexOf ( ' ' ) ; if ( index != - 1 ) { try { int major = Integer . parseInt ( v . substring ( 0 , index ) ) ; if ( major > 2012 ) { result = false ; } } catch ( NumberFormatException nfe ) { // ignore because we fail safe. True for this hides stuff } } } return result ; }
Work out whether we should generate the schema for a GA build or not .
259
15
161,880
public void setFfdcAlready ( boolean ffdcAlready ) { this . ffdcAlready = ffdcAlready ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "ffdc already handled? " + ffdcAlready ) ; } }
set to true if FFDC already handle this exception
60
10
161,881
private static String getResource ( Bundle myBundle , String resourcePath ) { if ( myBundle == null ) return null ; String bundleShortDescription = getBundleDescription ( myBundle ) ; StringBuilder responseString = new StringBuilder ( ) ; URL bundleResource = myBundle . getResource ( resourcePath ) ; if ( bundleResource != null ) { BufferedReader br = null ; try { // read the requested resource from the bundle br = new BufferedReader ( new InputStreamReader ( bundleResource . openConnection ( ) . getInputStream ( ) , "UTF-8" ) ) ; while ( br . ready ( ) ) { responseString . append ( br . readLine ( ) ) ; } br . close ( ) ; } catch ( Exception e ) { // shouldn't happen if ( OpenAPIUtils . isEventEnabled ( tc ) ) { Tr . event ( tc , "Exception trying to read resource at " + resourcePath + " from bundle " + bundleShortDescription ) ; } } } else { if ( OpenAPIUtils . isEventEnabled ( tc ) ) { Tr . event ( tc , "Unexpected error getting resource from WAB bundle." ) ; } } return responseString . toString ( ) ; }
Return as a string the contents of a file in the bundle .
261
13
161,882
private static void harvestPackageList ( BundlePackages packages , Bundle bundle ) { // Double check that the bundle is (still) installed: if ( bundle . getLocation ( ) != null && bundle . getState ( ) != Bundle . UNINSTALLED ) { BundleManifest manifest = new BundleManifest ( bundle ) ; /* * Only bundles with a bundle vendor of IBM should count as internal. * We definitely don't want to be filtering out user bundles in the shared bundle space. * This filter might catch stack products, which is probably a good thing * if it happens. * We also want to count the system bundle as internal. Some of * the bundles with higher IDs aren't ours, but since we rebuild them * with bnd, they get an IBM vendor header. */ if ( bundle . getBundleId ( ) == 0 || IBM . equals ( manifest . getBundleVendor ( ) ) || IBM . equals ( manifest . getBundleDistributor ( ) ) ) { packages . addPackages ( manifest ) ; } } }
This method is static to avoid concurrent access issues .
218
10
161,883
public static String extractPackageFromStackTraceElement ( StackTraceElement element ) { String className = element . getClassName ( ) ; int lastDotIndex = className . lastIndexOf ( "." ) ; String packageName ; if ( lastDotIndex > 0 ) { packageName = className . substring ( 0 , lastDotIndex ) ; } else { packageName = className ; } return packageName ; }
Work out the package name from a StackTraceElement . This is easier than a stack trace line because we already know the class name .
93
28
161,884
public boolean isSpecOrThirdPartyOrBootDelegationPackage ( String packageName ) { SharedPackageInspector inspector = st . getService ( ) ; if ( inspector != null ) { PackageType type = inspector . getExportedPackageType ( packageName ) ; if ( type != null && type . isSpecApi ( ) ) { return true ; } } boolean isBundlePackage = false ; // Check the boot delegation packages second, since they're patterns, and slower for ( Pattern pattern : bootDelegationPackages ) { isBundlePackage = pattern . matcher ( packageName ) . matches ( ) ; if ( isBundlePackage ) { return isBundlePackage ; } } // If we can't work it out, assume things aren't spec packages return false ; }
Returns true is this package is distributed as part of the Liberty server but is external to IBM and available to user applications - that is if its exposed as a boot delegation package or a spec package or a third party API .
166
44
161,885
public static Properties jslPropertiesToJavaProperties ( final JSLProperties xmlProperties ) { final Properties props = new Properties ( ) ; for ( final Property prop : xmlProperties . getPropertyList ( ) ) { props . setProperty ( prop . getName ( ) , prop . getValue ( ) ) ; } return props ; }
Creates a java . util . Properties map from a com . ibm . jbatch . jsl . model . Properties object .
73
27
161,886
public static JSLProperties javaPropsTojslProperties ( final Properties javaProps ) { JSLProperties newJSLProps = jslFactory . createJSLProperties ( ) ; Enumeration < ? > keySet = javaProps . propertyNames ( ) ; while ( keySet . hasMoreElements ( ) ) { String key = ( String ) keySet . nextElement ( ) ; String value = javaProps . getProperty ( key ) ; Property newProperty = jslFactory . createProperty ( ) ; newProperty . setName ( key ) ; newProperty . setValue ( value ) ; newJSLProps . getPropertyList ( ) . add ( newProperty ) ; } return newJSLProps ; }
Creates a new JSLProperties list from a java . util . Properties object .
160
18
161,887
@ Override public Logger getLogger ( String name ) { // get the logger from the super impl Logger logger = super . getLogger ( name ) ; // At this point we don't know which concrete class to use until the // ras/logging provider is initialized enough to provide a // wsLogger class if ( wsLogger == null ) { return logger ; } // The Java Logging (JSR47) spec requires that the method, // LogManager.getLogManager().getLogger(...) returns null if the logger // with the passed in name does not exist. However, the method // Logger.getLogger(...) // calls this method in order to create a new Logger object. In WAS, we // always want the call to Logger.getLogger(...) to return an instance // of WsLogger. If this method returns null to it (as the spec requires), // then Logger.getLogger() would return an instance of java.util.logging.Logger // rather than our WsLogger. // To account for this "issue", we need to return null when a customer // calls this method and passes in a non-existent logger name, but must // create a new WsLogger when Logger.getLogger() calls this method. As // such, the following code will get the current thread's stack trace // and look for a pattern like: // ... // at com.ibm.ws.bootstrap.WsLogManager.getLogger ... // at java.util.logging.Logger.getLogger ... // ... // If it identifies this pattern in the stacktrace, this method will // create a new logger. If not, it will return null. if ( logger == null ) { boolean createNewLogger = false ; boolean foundCaller = false ; Exception ex = new Exception ( ) ; StackTraceElement [ ] ste = ex . getStackTrace ( ) ; Class < ? > caller = null ; int i = 0 ; while ( ! foundCaller && i < ste . length ) { StackTraceElement s = ste [ i ++ ] ; // A) look for com.ibm.ws.bootstrap.WsLogManager.getLogger if ( s . getClassName ( ) . equals ( CLASS_NAME ) && s . getMethodName ( ) . equals ( "getLogger" ) ) { // B) java.util.logging.Logger.getLogger while ( ! foundCaller && i < ste . length ) { s = ste [ i ++ ] ; if ( s . getClassName ( ) . equals ( "java.util.logging.Logger" ) && s . getMethodName ( ) . equals ( "getLogger" ) ) { createNewLogger = true ; } else if ( createNewLogger ) { caller = StackFinderSingleton . instance . getCaller ( i , s . getClassName ( ) ) ; foundCaller = caller != null ; } } } } if ( createNewLogger ) { try { logger = ( Logger ) wsLogger . newInstance ( name , caller , null ) ; // constructing the new logger will add the logger to the log manager // See the constructor com.ibm.ws.logging.internal.WsLogger.WsLogger(String, Class<?>, String) // This is pretty unfortunate escaping of 'this' out of the constructor, but may be risky to try and fix that. // Instead add a hack here to double check that another thread did not win in creating and adding the WsLogger instance Logger checkLogger = super . getLogger ( name ) ; if ( checkLogger != null ) { // Simply reassign because checkLogger is for sure the one that got added. // Not really sure what it would mean if null was returned from super.getLogger, but do nothing in that case logger = checkLogger ; } } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } } return logger ; }
Returns an instance of WsLogger with specified name . If an instance with specified name does not exist it will be created .
869
26
161,888
public ServiceRegistration < KeyringMonitor > monitorKeyRings ( String ID , String trigger , String keyStoreLocation ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "monitorKeyRing registration for" , ID ) ; } BundleContext bundleContext = actionable . getBundleContext ( ) ; final Hashtable < String , Object > keyRingMonitorProps = new Hashtable < String , Object > ( ) ; keyRingMonitorProps . put ( KeyringMonitor . MONITOR_KEYSTORE_CONFIG_ID , ID ) ; keyRingMonitorProps . put ( KeyringMonitor . KEYSTORE_LOCATION , keyStoreLocation ) ; if ( ! ( trigger . equalsIgnoreCase ( "disabled" ) ) && trigger . equals ( "polled" ) ) { Tr . warning ( tc , "Cannot have polled trigger for keyRing ID: " , ID ) ; } return bundleContext . registerService ( KeyringMonitor . class , this , keyRingMonitorProps ) ; }
Registers this KeyringMonitor to start monitoring the specified keyrings by mbean notification .
233
18
161,889
public void start ( ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "start" ) ; synchronized ( this ) { active = true ; // start the liveness timer for sending ControlRequestHighestGeneratedTick, if needed if ( ! completedTicksInitialized ) { if ( initRequestId == - 1 ) initRequestId = parent . generateUniqueValue ( ) ; requestHighestGeneratedTickTimer = new RequestHighestGeneratedTick ( ) ; //we call the alarm directly requestHighestGeneratedTickTimer . alarm ( null ) ; } if ( parent . getCardinalityOne ( ) && ! isFlushed ) { inactivityTimer = am . create ( mp . getCustomProperties ( ) . get_remote_consumer_cardinality_inactivity_interval ( ) , inactivityHandler ) ; } if ( resetRequestAckSender != null ) { boolean done = resetRequestAckSender . start ( ) ; if ( done ) resetRequestAckSender = null ; } // start all the liveness timers for value ticks dem . startTimer ( ) ; if ( imeRestorationHandler != null ) imeRestorationHandler . startTimer ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "start" ) ; }
Start the stream i . e . start sending data and control messages
318
13
161,890
public void stop ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "stop" ) ; synchronized ( this ) { active = false ; // stop the liveness timer for sending ControlRequestHighestGeneratedTick, if needed //NOTE: the requestHighestGeneratedTickTimer will stop of its own accord once the //stream is noticed to be if ( initRepeatHandler != null ) { initRepeatHandler . cancel ( ) ; } if ( inactivityTimer != null ) { inactivityTimer . cancel ( ) ; inactivityTimer = null ; } if ( resetRequestAckSender != null ) { resetRequestAckSender . stop ( ) ; } // stop all the liveness timers for value ticks dem . stopTimer ( ) ; if ( imeRestorationHandler != null ) imeRestorationHandler . stopTimer ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "stop" ) ; }
Stop the stream i . e . stop sending data and control messages
234
13
161,891
public void processTimedoutEntries ( List timedout ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "processTimedoutEntries" , new Object [ ] { this , timedout } ) ; boolean sendMsg = false ; synchronized ( this ) { if ( active && completedTicksInitialized && ! timedout . isEmpty ( ) ) { sendMsg = true ; } } if ( sendMsg ) parent . sendDecisionExpected ( remoteMEUuid , gatheringTargetDestUuid , streamId , timedout ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "processTimedoutEntries" ) ; }
Called when the DecisionExpected timeout occurs
172
9
161,892
public final void expiredRequest ( long tick ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "expiredRequest" , Long . valueOf ( tick ) ) ; expiredRequest ( tick , false ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "expiredRequest" ) ; }
Callback from JSRemoteConsumerPoint that the given tick in the stream should be changed to the completed state .
99
21
161,893
public final void removeConsumerKey ( String selector , JSRemoteConsumerPoint aock ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeConsumerKey" , new Object [ ] { selector , aock } ) ; synchronized ( this ) { JSRemoteConsumerPoint aock2 = ( JSRemoteConsumerPoint ) consumerKeyTable . get ( selector ) ; if ( aock2 == aock ) { // the object is still in the table consumerKeyTable . remove ( selector ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeConsumerKey" ) ; }
Method to remove the given JSRemoteConsumerPoint from the consumerKeyTable
159
14
161,894
public synchronized long getNumberOfRequestsInState ( int requiredState ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getNumberOfRequestsInState" , Integer . valueOf ( requiredState ) ) ; //Count the number of tick range objects that are in the //specified state long requestCount = 0 ; // Initial range in stream is always completed Range stream . setCursor ( 0 ) ; // skip this and move to next range stream . getNext ( ) ; // Get the first TickRange after completed range and move cursor to the next one TickRange tr = stream . getNext ( ) ; // Iterate until we reach final Unknown range while ( tr . endstamp < RangeList . INFINITY ) { if ( ( tr . type == requiredState ) ) { requestCount ++ ; } tr = stream . getNext ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getNumberOfRequestsInState" , Long . valueOf ( requestCount ) ) ; return requestCount ; }
Counts the number of requests that have been completed since reboot
252
12
161,895
public final void unlockRejectedTick ( TransactionCommon t , AOValue storedTick ) throws MessageStoreException , SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "unlockRejectedTick" ) ; try { SIMPMessage msg = consumerDispatcher . getMessageByValue ( storedTick ) ; Transaction msTran = mp . resolveAndEnlistMsgStoreTransaction ( t ) ; if ( msg != null ) { // Set the rme unlock count into the Messageitem so it can be taken into // account on further rollback threshold checks. (Note we take one off // because the following operation will perform an unlock itself) // 488794. boolean incrementCount = false ; // TODO: THIS DOESN'T WORK - MsgStore does not support the use of 'don't increment count' // when unlocking a persistently locked message (i.e. one of these). So the count will // get incremented anyway. So if the message has been rejected because it was never consumed // (and therefore, shouldn't have the count incremented) the unlock count WILL be incremented // which could cause us to exception it. // TODO: However, this is still an improvement on the pre-V7 logic and not a regression // so we'll leave it as is unless someone complains. // TODO: I also doubt all this logic as the rmeUnlockCount is only transient, if MsgStore // chooses to un-cache this message we'll lose the extra count info. Although I guess it does // solve the case when the RME has rolled it back enough to reach the max failure limit, so I // guess we leave it as is. if ( storedTick . rmeUnlockCount > 0 ) { incrementCount = true ; msg . setRMEUnlockCount ( storedTick . rmeUnlockCount - 1 ) ; } if ( msg . getLockID ( ) == storedTick . getPLockId ( ) ) msg . unlockMsg ( storedTick . getPLockId ( ) , msTran , incrementCount ) ; } storedTick . lockItemIfAvailable ( controlItemLockID ) ; // should always be successful storedTick . remove ( msTran , controlItemLockID ) ; } catch ( MessageStoreException e ) { // No FFDC code needed if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "unlockRejectedTick" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "unlockRejectedTick" ) ; }
Helper method called by the AOStream when a persistent tick representing a persistently locked message should be removed since the message has been rejected . This method will also unlock the message
600
35
161,896
public final void consumeAcceptedTick ( TransactionCommon t , AOValue storedTick ) throws Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "consumeAcceptedTick" , storedTick ) ; try { SIMPMessage msg = consumerDispatcher . getMessageByValue ( storedTick ) ; Transaction msTran = mp . resolveAndEnlistMsgStoreTransaction ( t ) ; // PK67067 We may not find a message in the store for this tick, because // it may have been removed using the SIBQueuePoint MBean if ( msg != null ) { msg . remove ( msTran , storedTick . getPLockId ( ) ) ; } storedTick . lockItemIfAvailable ( controlItemLockID ) ; // should always be successful storedTick . remove ( msTran , controlItemLockID ) ; } catch ( Exception e ) { // No FFDC code needed if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "consumeAcceptedTick" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "consumeAcceptedTick" ) ; }
Helper method called by the AOStream when a persistent tick representing a persistently locked message should be removed since the message has been accepted . This method will also consume the message
301
35
161,897
public FileChannel getFileChannel ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getFileChannel(): " + fc ) ; } return this . fc ; }
Return the FileChannel object that is representing this WsByteBufferImpl .
56
15
161,898
private void convertBufferIfNeeded ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "convertBufferIfNeeded status: " + status ) ; } if ( isFCEnabled ( ) ) { // TRANSFER_TO status is currently on, so turn if OFF status = status & ( ~ WsByteBuffer . STATUS_TRANSFER_TO ) ; // and turn on BUFFER status status = status | WsByteBuffer . STATUS_BUFFER ; try { // save so we can restore the current position int bufPosition = ( int ) fc . position ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "creating a MappedByteBuffer from the FileChannel. position: " + 0 + " size: " + fc . size ( ) ) ; } // map entire FileChannel buffer to ByteBuffer try { oByteBuffer = fc . map ( MapMode . PRIVATE , 0 , fc . size ( ) ) ; } catch ( NonWritableChannelException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "FileChannel is readonly" ) ; } oByteBuffer = fc . map ( MapMode . READ_ONLY , 0 , fc . size ( ) ) ; setReadOnly ( true ) ; } // The mapped byte buffer returned by this method will have a // position of zero and a limit and capacity of size; // its mark will be undefined. // The buffer and the mapping that it represents will // remain valid until the buffer itself is garbage-collected. // restore the position and limit if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "set MappedByteBuffer position to: " + bufPosition + " limit to: " + fcLimit ) ; } position ( bufPosition ) ; limit ( fcLimit ) ; } catch ( IOException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "got IOException: " + e ) ; } FFDCFilter . processException ( e , CLASS_NAME + ".convertBufferIfNeeded" , "112" , this ) ; throw new RuntimeException ( e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "convertBufferIfNeeded status: " + status ) ; } }
If the buffer has not already been converted from a TRANSFER_TO buffer back to the more common base BUFFER then do so now .
583
28
161,899
public void checkType ( JSField elem , int indir ) throws JMFSchemaViolationException { if ( ! equivFields ( element , elem ) || indir != indirect ) throw new JMFSchemaViolationException ( "Incorrect list element types" ) ; }
SchemaViolationException if not
62
7