code
stringlengths
73
34.1k
label
stringclasses
1 value
public static void setDnsCache(Properties properties) { for (Map.Entry<Object, Object> entry : properties.entrySet()) { final String host = (String) entry.getKey(); String ipList = (String) entry.getValue(); ipList = ipList.trim(); if (ipList.isEmpty()) continue; final String[] ips = COMMA_SEPARATOR.split(ipList); setDnsCache(host, ips); } }
java
public static void loadDnsCacheConfig(String propertiesFileName) { InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertiesFileName); if (inputStream == null) { inputStream = DnsCacheManipulator.class.getClassLoader().getResourceAsStream(propertiesFileName); } if (inputStream == null) { throw new DnsCacheManipulatorException("Fail to find " + propertiesFileName + " on classpath!"); } try { Properties properties = new Properties(); properties.load(inputStream); inputStream.close(); setDnsCache(properties); } catch (Exception e) { final String message = String.format("Fail to loadDnsCacheConfig from %s, cause: %s", propertiesFileName, e.toString()); throw new DnsCacheManipulatorException(message, e); } }
java
@Nullable public static DnsCacheEntry getDnsCache(String host) { try { return InetAddressCacheUtil.getInetAddressCache(host); } catch (Exception e) { throw new DnsCacheManipulatorException("Fail to getDnsCache, cause: " + e.toString(), e); } }
java
public static List<DnsCacheEntry> listDnsCache() { try { return InetAddressCacheUtil.listInetAddressCache().getCache(); } catch (Exception e) { throw new DnsCacheManipulatorException("Fail to listDnsCache, cause: " + e.toString(), e); } }
java
public static DnsCache getWholeDnsCache() { try { return InetAddressCacheUtil.listInetAddressCache(); } catch (Exception e) { throw new DnsCacheManipulatorException("Fail to getWholeDnsCache, cause: " + e.toString(), e); } }
java
public static void removeDnsCache(String host) { try { InetAddressCacheUtil.removeInetAddressCache(host); } catch (Exception e) { final String message = String.format("Fail to removeDnsCache for host %s, cause: %s", host, e.toString()); throw new DnsCacheManipulatorException(message, e); } }
java
public static void setDnsNegativeCachePolicy(int negativeCacheSeconds) { try { InetAddressCacheUtil.setDnsNegativeCachePolicy(negativeCacheSeconds); } catch (Exception e) { throw new DnsCacheManipulatorException("Fail to setDnsNegativeCachePolicy, cause: " + e.toString(), e); } }
java
private void initializeDrawableForDisplay(Drawable d) { if (mBlockInvalidateCallback == null) { mBlockInvalidateCallback = new BlockInvalidateCallback(); } // Temporary fix for suspending callbacks during initialization. We // don't want any of these setters causing an invalidate() since that // may call back into DrawableContainer. d.setCallback(mBlockInvalidateCallback.wrap(d.getCallback())); try { if (mDrawableContainerState.mEnterFadeDuration <= 0 && mHasAlpha) { d.setAlpha(mAlpha); } if (mDrawableContainerState.mHasColorFilter) { // Color filter always overrides tint. d.setColorFilter(mDrawableContainerState.mColorFilter); } else { if (mDrawableContainerState.mHasTintList) { DrawableCompat.setTintList(d, mDrawableContainerState.mTintList); } if (mDrawableContainerState.mHasTintMode) { DrawableCompat.setTintMode(d, mDrawableContainerState.mTintMode); } } d.setVisible(isVisible(), true); d.setDither(mDrawableContainerState.mDither); d.setState(getState()); d.setLevel(getLevel()); d.setBounds(getBounds()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { d.setLayoutDirection(getLayoutDirection()); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { d.setAutoMirrored(mDrawableContainerState.mAutoMirrored); } final Rect hotspotBounds = mHotspotBounds; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && hotspotBounds != null) { d.setHotspotBounds(hotspotBounds.left, hotspotBounds.top, hotspotBounds.right, hotspotBounds.bottom); } } finally { d.setCallback(mBlockInvalidateCallback.unwrap()); } }
java
@Override protected boolean onStateChange(int[] stateSet) { final boolean changed = super.onStateChange(stateSet); int idx = mAnimationScaleListState.getCurrentDrawableIndexBasedOnScale(); return selectDrawable(idx) || changed; }
java
public static int longToInt(long inLong) { if (inLong < Integer.MIN_VALUE) { return Integer.MIN_VALUE; } if (inLong > Integer.MAX_VALUE) { return Integer.MAX_VALUE; } return (int) inLong; }
java
public static void getAllInterfaces(Class<?> classObject, ArrayList<Type> interfaces) { Type[] superInterfaces = classObject.getGenericInterfaces(); interfaces.addAll((Arrays.asList(superInterfaces))); // for cases where the extended class is defined with a Generic. Type tgs = classObject.getGenericSuperclass(); if (tgs != null) { if ((tgs) instanceof ParameterizedType) { interfaces.add(tgs); } } if (tc.isDebugEnabled()) { Tr.debug(tc, "updated interfaces to: " + interfaces); } Class<?> superClass = classObject.getSuperclass(); if (superClass != null) { getAllInterfaces(superClass, interfaces); } }
java
public static String truncateCloseReason(String reasonPhrase) { if (reasonPhrase != null) { byte[] reasonBytes = reasonPhrase.getBytes(Utils.UTF8_CHARSET); int len = reasonBytes.length; // Why 120? UTF-8 can take 4 bytes per character, so we either hit the boundary, or are off by 1-3 bytes. // Subtract 3 from 123 and we'll try to cut only if it is greater than that. if (len > 120) { String updatedPhrase = cutStringByByteSize(reasonPhrase, 120); reasonPhrase = updatedPhrase; } } return reasonPhrase; }
java
protected Converter getConverter(FacesContext facesContext, UIComponent component) { if (component instanceof UISelectMany) { return HtmlRendererUtils.findUISelectManyConverterFailsafe(facesContext, (UISelectMany) component); } else if (component instanceof UISelectOne) { return HtmlRendererUtils.findUIOutputConverterFailSafe(facesContext, component); } return null; }
java
public void startConditional() throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "startConditional", this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Activating MBean for ME " + getName()); setState(STATE_STARTING); start(JsConstants.ME_START_DEFAULT); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "startConditional"); }
java
private boolean okayToSendServerStarted() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "okayToSendServerStarted", this); synchronized (lockObject) { if (!_sentServerStarted) { if ((_state == STATE_STARTED) && _mainImpl.isServerStarted()) { _sentServerStarted = true; } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "okayToSendServerStarted", new Boolean(_sentServerStarted)); return _sentServerStarted; }
java
private boolean okayToSendServerStopping() { // Removed the synchronized modifier of this method, as its only setting one private variable _sentServerStopping, // If its synchronized, then notification thread gets blocked here until JsActivationThread returns and so it doesnot set _sentServerStopping to true if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())// To enable the JsActivationThread to check for serverStopping notification while its still running, this method should not be synchronized. SibTr.entry(tc, "okayToSendServerStopping", this); synchronized (lockObject) { // This should be run in a synchronized context if (!_sentServerStopping) { if ((_state == STATE_STARTED || _state == STATE_AUTOSTARTING || _state == STATE_STARTING) && _mainImpl.isServerStopping()) { // Adding additional ME states( STARTING and AUTOSTARTING) , so that sever stopping notification is also sent when ME is in those states. _sentServerStopping = true; } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "okayToSendServerStopping", new Boolean( _sentServerStopping)); return _sentServerStopping; }
java
@SuppressWarnings("unchecked") public <EngineComponent> EngineComponent getEngineComponent(Class<EngineComponent> clazz) { String thisMethodName = "getEngineComponent"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, clazz); } JsEngineComponent foundEngineComponent = null; // No need to synchronize on jmeComponents to prevent concurrent // modification from dynamic config and runtime callbacks, because // jmeComponents is now a CopyOnWriteArrayList. Iterator<ComponentList> vIter = jmeComponents.iterator(); while (vIter.hasNext() && foundEngineComponent == null) { ComponentList c = vIter.next(); if (clazz.isInstance(c.getRef())) { foundEngineComponent = c.getRef(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName, foundEngineComponent); } return (EngineComponent) foundEngineComponent; }
java
@SuppressWarnings("unchecked") public <EngineComponent> EngineComponent[] getEngineComponents(Class<EngineComponent> clazz) { String thisMethodName = "getEngineComponents"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, clazz); } List<EngineComponent> foundComponents = new ArrayList<EngineComponent>(); // No need to synchronize on jmeComponents to prevent concurrent // modification from dynamic config and runtime callbacks, because // jmeComponents is now a CopyOnWriteArrayList. Iterator<ComponentList> vIter = jmeComponents.iterator(); while (vIter.hasNext()) { JsEngineComponent ec = vIter.next().getRef(); if (clazz.isInstance(ec)) { foundComponents.add((EngineComponent) ec); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName, foundComponents); } // this code is required to get an array of the EngineComponent type. return foundComponents.toArray((EngineComponent[]) Array.newInstance(clazz, 0)); }
java
public final JsMEConfig getMeConfig() { String thisMethodName = "getMeConfig"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, this); SibTr.exit(tc, thisMethodName, _me); } return _me; }
java
@Deprecated public JsEngineComponent getMessageProcessor(String name) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getMessageProcessor", this); SibTr.exit(tc, "getMessageProcessor", _messageProcessor); } return _messageProcessor; }
java
private void resolveExceptionDestination(BaseDestinationDefinition dd) { String thisMethodName = "resolveExceptionDestination"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, dd.getName()); } // If variable substitution string detected, then override ED name if (dd.isLocal()) { String ed = ((DestinationDefinition) dd).getExceptionDestination(); if ((ed != null) && (ed.equals(JsConstants.DEFAULT_EXCEPTION_DESTINATION))) { ((DestinationDefinition) dd).setExceptionDestination(JsConstants.EXCEPTION_DESTINATION_PREFIX + this.getName()); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName); } }
java
BaseDestinationDefinition getSIBDestinationByUuid(String bus, String key, boolean newCache) throws SIBExceptionDestinationNotFound, SIBExceptionBase { String thisMethodName = "getSIBDestinationByUuid"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, new Object[] { bus, key, new Boolean(newCache) }); } BaseDestinationDefinition bdd = null; if (oldDestCache == null || newCache) { bdd = (BaseDestinationDefinition) _bus.getDestinationCache().getSIBDestinationByUuid(bus, key).clone(); } else { bdd = (BaseDestinationDefinition) oldDestCache.getSIBDestinationByUuid(bus, key).clone(); } // Resolve Exception Destination if necessary resolveExceptionDestination(bdd); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName, bdd); } return bdd; }
java
public final String getState() { String thisMethodName = "getState"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, this); SibTr.exit(tc, thisMethodName, states[_state]); } return states[_state]; }
java
public final boolean isStarted() { String thisMethodName = "isStarted"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, this); } boolean retVal = (_state == STATE_STARTED); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName, Boolean.toString(retVal)); } return retVal; }
java
final boolean addLocalizationPoint(LWMConfig lp, DestinationDefinition dd) { String thisMethodName = "addLocalizationPoint"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, lp); } boolean success = _localizer.addLocalizationPoint(lp, dd); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName, Boolean.valueOf(success)); } return success; }
java
final void alterLocalizationPoint(BaseDestination dest,LWMConfig lp) { String thisMethodName = "alterLocalizationPoint"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, lp); } try { _localizer.alterLocalizationPoint(dest,lp); } catch (Exception e) { SibTr.exception(tc, e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName); } }
java
final void deleteLocalizationPoint(JsBus bus, LWMConfig dest) { String thisMethodName = "deleteLocalizationPoint"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, dest); } try { _localizer.deleteLocalizationPoint(bus, dest); } catch (SIBExceptionBase ex) { SibTr.exception(tc, ex); } catch (SIException e) { SibTr.exception(tc, e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName); } }
java
final void setLPConfigObjects(List config) { String thisMethodName = "setLPConfigObjects"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, "Number of LPs =" + config.size()); } _lpConfig.clear(); _lpConfig.addAll(config); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName); } }
java
public boolean isEventNotificationPropertySet() { String thisMethodName = "isEventNotificationPropertySet"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, this); } boolean enabled = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName, Boolean.toString(enabled)); } return enabled; }
java
public JsMainImpl getMainImpl() { String thisMethodName = "getMainImpl"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, this); SibTr.exit(tc, thisMethodName, _mainImpl); } return _mainImpl; }
java
protected final JsEngineComponent loadClass(String className, int stopSeq, boolean reportError) { String thisMethodName = "loadClass"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, new Object[] { className, Integer.toString(stopSeq), Boolean.toString(reportError) }); } Class myClass = null; JsEngineComponent retValue = null; int _seq = stopSeq; if (_seq < 0 || _seq > NUM_STOP_PHASES) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "loadClass: stopSeq is out of bounds " + stopSeq); } else { try { myClass = Class.forName(className); retValue = (JsEngineComponent) myClass.newInstance(); ComponentList compList = new ComponentList(className, retValue); // No need to synchronize on jmeComponents to prevent concurrent // modification from dynamic config and runtime callbacks, because // jmeComponents is now a CopyOnWriteArrayList. jmeComponents.add(compList); stopSequence[_seq].addElement(compList); } catch (ClassNotFoundException e) { // No FFDC code needed if (reportError == true) { com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".loadClass", "3", this); SibTr.error(tc, "CLASS_LOAD_FAILURE_SIAS0013", className); SibTr.exception(tc, e); } } catch (InstantiationException e) { com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".loadClass", "1", this); if (reportError == true) { SibTr.error(tc, "CLASS_LOAD_FAILURE_SIAS0013", className); SibTr.exception(tc, e); } } catch (Throwable e) { com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".loadClass", "2", this); if (reportError == true) { SibTr.error(tc, "CLASS_LOAD_FAILURE_SIAS0013", className); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { if (retValue == null) SibTr.debug(tc, "loadClass: failed"); else SibTr.debug(tc, "loadClass: OK"); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName, retValue); } return retValue; }
java
public void addMember(JSConsumerKey key) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addMember", key); super.addMember(key); // superclass method does most of the work synchronized (criteriaLock) { if (allCriterias != null) { SelectionCriteria[] newCriterias = new SelectionCriteria[allCriterias.length + 1]; System.arraycopy(allCriterias, 0, newCriterias, 0, allCriterias.length); allCriterias = newCriterias; } else { allCriterias = new SelectionCriteria[1]; } allCriterias[allCriterias.length - 1] = ((RemoteQPConsumerKey) key).getSelectionCriteria()[0]; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addMember"); }
java
public static void setCustomPropertyVariables() { UPGRADE_READ_TIMEOUT = Integer.valueOf(customProps.getProperty("upgradereadtimeout", Integer.toString(TCPReadRequestContext.NO_TIMEOUT))).intValue(); UPGRADE_WRITE_TIMEOUT = Integer.valueOf(customProps.getProperty("upgradewritetimeout", Integer.toString(TCPReadRequestContext.NO_TIMEOUT))).intValue(); }
java
public void registerInvalidations(String cacheName, Iterator invalidations) { InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName); if (invalidationTableList != null) { try { invalidationTableList.readWriteLock.writeLock().lock(); while (invalidations.hasNext()) { try { Object invalidation = invalidations.next(); if (invalidation instanceof InvalidateByIdEvent) { InvalidateByIdEvent idEvent = (InvalidateByIdEvent) invalidation; Object id = idEvent.getId(); InvalidateByIdEvent oldIdEvent = (InvalidateByIdEvent) invalidationTableList.presentIdSet.get(id); long timeStamp = idEvent.getTimeStamp(); if ((oldIdEvent != null) && (oldIdEvent.getTimeStamp() >= timeStamp)) { continue; } invalidationTableList.presentIdSet.put(id, idEvent); continue; } InvalidateByTemplateEvent templateEvent = (InvalidateByTemplateEvent) invalidation; String template = templateEvent.getTemplate(); InvalidateByTemplateEvent oldTemplateEvent = (InvalidateByTemplateEvent) invalidationTableList.presentTemplateSet.get(template); long timeStamp = templateEvent.getTimeStamp(); if ((oldTemplateEvent != null) && (oldTemplateEvent.getTimeStamp() >= timeStamp)) { continue; } invalidationTableList.presentTemplateSet.put(template, templateEvent); } catch (Exception ex) { com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.InvalidationAuditDaemon.registerInvalidations", "126", this); } } } finally { invalidationTableList.readWriteLock.writeLock().unlock(); } } }
java
public CacheEntry filterEntry(String cacheName, CacheEntry cacheEntry) { InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName); try { invalidationTableList.readWriteLock.readLock().lock(); return internalFilterEntry(cacheName, invalidationTableList, cacheEntry); } finally { invalidationTableList.readWriteLock.readLock().unlock(); } }
java
public ArrayList filterEntryList(String cacheName, ArrayList incomingList) { InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName); try { invalidationTableList.readWriteLock.readLock().lock(); Iterator it = incomingList.iterator(); while (it.hasNext()) { Object obj = it.next(); if (obj instanceof CacheEntry) {// ignore any "push-pull" String id's in DRS case CacheEntry cacheEntry = (CacheEntry) obj; if (internalFilterEntry(cacheName, invalidationTableList, cacheEntry) == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "filterEntryList(): Filtered OUT cacheName=" + cacheName + " id=" + cacheEntry.id); } it.remove(); } } } return incomingList; } finally { invalidationTableList.readWriteLock.readLock().unlock(); } }
java
private final CacheEntry internalFilterEntry(String cacheName, InvalidationTableList invalidationTableList, CacheEntry cacheEntry) { InvalidateByIdEvent idEvent = null; if (cacheEntry == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "internalFilterEntry(): Filtered cacheName=" + cacheName + " CE == NULL"); } return null; } else if (cacheEntry.id == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "internalFilterEntry(): Filtered cacheName=" + cacheName + " id == NULL"); } return null; } long timeStamp = cacheEntry.getTimeStamp(); idEvent = (InvalidateByIdEvent) invalidationTableList.presentIdSet.get(cacheEntry.id); if ((idEvent != null) && (idEvent.getTimeStamp() > timeStamp)) { if (tc.isDebugEnabled()) { Tr.debug(tc, "internalFilterEntry(): Filtered Found a more recent InvalidateByIdEvent for the cacheEntry in presentIdSet. cacheName=" + cacheName + " id=" + cacheEntry.id); } return null; } if (collision(invalidationTableList.presentTemplateSet, cacheEntry.getTemplates(), timeStamp) || collision(invalidationTableList.presentIdSet, cacheEntry.getDataIds(), timeStamp)) { if (tc.isDebugEnabled()) { Tr.debug(tc, "internalFilterEntry(): Filtered due to preexisting invalidations due to dependencies and templates in present template and IdSet. cacheName=" + cacheName + " id=" + cacheEntry.id); } return null; } if (timeStamp > lastTimeCleared) { return cacheEntry; } //else check past values as well idEvent = (InvalidateByIdEvent) invalidationTableList.pastIdSet.get(cacheEntry.id); if ((idEvent != null) && (idEvent.getTimeStamp() > timeStamp)) { if (tc.isDebugEnabled()) { Tr.debug(tc, "internalFilterEntry(): Filtered Found a more recent InvalidateByIdEvent for the cacheEntry in pastIdSet. cacheName=" + cacheName + " id=" + cacheEntry.id); } return null; } if (collision(invalidationTableList.pastTemplateSet, cacheEntry.getTemplates(), timeStamp) || collision(invalidationTableList.pastIdSet, cacheEntry.getDataIds(), timeStamp)) { if (tc.isDebugEnabled()) { Tr.debug(tc, "internalFilterEntry(): Filtered due to preexisting invalidations due to dependencies and templates in past template and IdSet. cacheName=" + cacheName + " id=" + cacheEntry.id); } return null; } return cacheEntry; }
java
public ExternalInvalidation filterExternalCacheFragment(String cacheName, ExternalInvalidation externalCacheFragment) { InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName); try { invalidationTableList.readWriteLock.readLock().lock(); return internalFilterExternalCacheFragment(cacheName, invalidationTableList, externalCacheFragment); } finally { invalidationTableList.readWriteLock.readLock().unlock(); } }
java
public ArrayList filterExternalCacheFragmentList(String cacheName, ArrayList incomingList) { InvalidationTableList invalidationTableList = getInvalidationTableList(cacheName); try { invalidationTableList.readWriteLock.readLock().lock(); Iterator it = incomingList.iterator(); while (it.hasNext()) { ExternalInvalidation externalCacheFragment = (ExternalInvalidation) it.next(); if (null == internalFilterExternalCacheFragment(cacheName, invalidationTableList, externalCacheFragment)) { if (tc.isDebugEnabled()) { Tr.debug(tc, "filterExternalCacheFragmentList(): Filtered OUT cacheName=" + cacheName + " uri=" + externalCacheFragment.getUri()); } it.remove(); } } return incomingList; } finally { invalidationTableList.readWriteLock.readLock().unlock(); } }
java
private final ExternalInvalidation internalFilterExternalCacheFragment(String cacheName, InvalidationTableList invalidationTableList, ExternalInvalidation externalCacheFragment) { if (externalCacheFragment == null) { return null; } long timeStamp = externalCacheFragment.getTimeStamp(); if (collision(invalidationTableList.presentTemplateSet, externalCacheFragment.getInvalidationIds(), timeStamp) || collision(invalidationTableList.presentIdSet, externalCacheFragment.getTemplates(), timeStamp)) { if (tc.isDebugEnabled()) { Tr.debug(tc, "internalFilterExternalCacheFragment(): Filtered due to preexisting invalidations due to dependencies and templates in present template and IdSet. cacheName=" + cacheName + " url=" + externalCacheFragment.getUri()); } return null; } if (timeStamp > lastTimeCleared) { return externalCacheFragment; } //else check past values as well if (collision(invalidationTableList.pastTemplateSet, externalCacheFragment.getInvalidationIds(), timeStamp) || collision(invalidationTableList.pastIdSet, externalCacheFragment.getTemplates(), timeStamp)) { if (tc.isDebugEnabled()) { Tr.debug(tc, "internalFilterExternalCacheFragment(): Filtered due to preexisting invalidations due to dependencies and templates in past template and IdSet. cacheName=" + cacheName + " url=" + externalCacheFragment.getUri()); } return null; } return externalCacheFragment; }
java
private final boolean collision(Map<Object, InvalidationEvent> hashtable, Enumeration enumeration, long timeStamp) { while (enumeration.hasMoreElements()) { Object key = enumeration.nextElement(); InvalidationEvent invalidationEvent = (InvalidationEvent) hashtable.get(key); if ((invalidationEvent != null) && (invalidationEvent.getTimeStamp() > timeStamp)) { return true; } } return false; }
java
private InvalidationTableList getInvalidationTableList(String cacheName) { InvalidationTableList invalidationTableList = cacheinvalidationTables.get(cacheName); if (invalidationTableList == null) { synchronized (this) { invalidationTableList = new InvalidationTableList(); cacheinvalidationTables.put(cacheName, invalidationTableList); } } return invalidationTableList; }
java
public static File getBootstrapJar() { if (launchHome == null) { if (launchURL == null) { // How were we launched? launchURL = getLocationFromClass(KernelUtils.class); } launchHome = FileUtils.getFile(launchURL); } return launchHome; }
java
public static File getBootstrapLibDir() { if (libDir.get() == null) { libDir = StaticValue.mutateStaticValue(libDir, new Utils.FileInitializer(getBootstrapJar().getParentFile())); } return libDir.get(); }
java
public static Properties getProperties(final InputStream is) throws IOException { Properties p = new Properties(); try { if (is != null) { p.load(is); // Look for "values" and strip the quotes to values for (Entry<Object, Object> entry : p.entrySet()) { String s = ((String) entry.getValue()).trim(); // If first and last characters are ", strip them off.. if (s.length() > 1 && s.startsWith("\"") && s.endsWith("\"")) { entry.setValue(s.substring(1, s.length() - 1)); } } } } finally { Utils.tryToClose(is); } return p; }
java
private static String getClassFromLine(String line) { line = line.trim(); // Skip commented lines if (line.length() == 0 || line.startsWith("#")) return null; // lop off spaces/tabs/end-of-line-comments String[] className = line.split("[\\s#]"); if (className.length >= 1) return className[0]; return null; }
java
public final void checkSpillLimits() { long currentTotal; long currentSize; synchronized(this) { currentTotal = _countTotal; currentSize = _countTotalBytes; } if (!_spilling) { // We are not currently spilling so we need to calculate the moving average // for the number of items on our stream and then check the moving average // and the total size of the items on the stream against our configured limits. // moving total is accumulated value over last 20 calculations minus the // immediately previous value. This saves both a division and storing the // last average. To get the current running total we add the current total // to the _movingTotal _movingTotal = _movingTotal + currentTotal; // we calculate the moving average by dividing moving total by number of // cycles in the moving window. long movingAverage = _movingTotal / MOVING_AVERAGE_LENGTH; // we then diminish the moving total by the moving average leaving it free for next time. _movingTotal = _movingTotal - movingAverage; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream is NOT SPILLING"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current size :" + currentSize); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current total :" + currentTotal); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Moving average:" + movingAverage); if (movingAverage >= _movingAverageHighLimit || // There are too many items on the stream currentSize >= _totalSizeHighLimit) // The size of items on the stream is too large { _spilling = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream has STARTED SPILLING"); } } else { // We are spilling so we just need to check against our configured limits and // if we are below them for both number of items and total size of items then // we can stop spilling. If we do stop spilling we also need to reset our moving // average counter. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream is SPILLING"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current size :" + currentSize); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current total :" + currentTotal); if (currentTotal <= _movingAverageLowLimit && // There are only a few items on the stream currentSize <= _totalSizeLowLimit) // AND The items on the stream are small { _spilling = false; _movingTotal = _movingAverageLowLimit * (MOVING_AVERAGE_LENGTH - 1); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Stream has STOPPED SPILLING"); } } }
java
public final void updateTotal(int oldSizeInBytes, int newSizeInBytes) throws SevereMessageStoreException { boolean doCallback = false; synchronized(this) { // We're only replacing an old size estimation // with a new one so we do not need to change // or inspect the count total and watermark // Check whether we were between our limits before // before this update. boolean wasBelowHighLimit = (_countTotalBytes < _watermarkBytesHigh); boolean wasAboveLowLimit = (_countTotalBytes >= _watermarkBytesLow); // Update our count to the new value by adding the // difference between the old and new sizes _countTotalBytes = _countTotalBytes + (newSizeInBytes - oldSizeInBytes); if ((wasBelowHighLimit && _countTotalBytes >= _watermarkBytesHigh) // Was below the HIGH watermark but now isn't || (wasAboveLowLimit && _countTotalBytes < _watermarkBytesLow)) // OR was above LOW watermark but now isn't { doCallback = true; } } if (doCallback) { _owningStreamLink.eventWatermarkBreached(); } }
java
public static void addUnspecifiedAttributes(FeatureDescriptor descriptor, Tag tag, String[] standardAttributesSorted, FaceletContext ctx) { for (TagAttribute attribute : tag.getAttributes().getAll()) { final String name = attribute.getLocalName(); if (Arrays.binarySearch(standardAttributesSorted, name) < 0) { // attribute not found in standard attributes // --> put it on the BeanDescriptor descriptor.setValue(name, attribute.getValueExpression(ctx, Object.class)); } } }
java
public static boolean containsUnspecifiedAttributes(Tag tag, String[] standardAttributesSorted) { for (TagAttribute attribute : tag.getAttributes().getAll()) { final String name = attribute.getLocalName(); if (Arrays.binarySearch(standardAttributesSorted, name) < 0) { return true; } } return false; }
java
public static void addDevelopmentAttributes(FeatureDescriptor descriptor, FaceletContext ctx, TagAttribute displayName, TagAttribute shortDescription, TagAttribute expert, TagAttribute hidden, TagAttribute preferred) { if (displayName != null) { descriptor.setDisplayName(displayName.getValue(ctx)); } if (shortDescription != null) { descriptor.setShortDescription(shortDescription.getValue(ctx)); } if (expert != null) { descriptor.setExpert(expert.getBoolean(ctx)); } if (hidden != null) { descriptor.setHidden(hidden.getBoolean(ctx)); } if (preferred != null) { descriptor.setPreferred(preferred.getBoolean(ctx)); } }
java
public static void addDevelopmentAttributesLiteral(FeatureDescriptor descriptor, TagAttribute displayName, TagAttribute shortDescription, TagAttribute expert, TagAttribute hidden, TagAttribute preferred) { if (displayName != null) { descriptor.setDisplayName(displayName.getValue()); } if (shortDescription != null) { descriptor.setShortDescription(shortDescription.getValue()); } if (expert != null) { descriptor.setExpert(Boolean.valueOf(expert.getValue())); } if (hidden != null) { descriptor.setHidden(Boolean.valueOf(hidden.getValue())); } if (preferred != null) { descriptor.setPreferred(Boolean.valueOf(preferred.getValue())); } }
java
public static boolean areAttributesLiteral(TagAttribute... attributes) { for (TagAttribute attribute : attributes) { if (attribute != null && !attribute.isLiteral()) { // the attribute exists and is not literal return false; } } // all attributes are literal return true; }
java
protected static FacesServletMapping calculateFacesServletMapping( String servletPath, String pathInfo) { if (pathInfo != null) { // If there is a "extra path", it's definitely no extension mapping. // Now we just have to determine the path which has been specified // in the url-pattern, but that's easy as it's the same as the // current servletPath. It doesn't even matter if "/*" has been used // as in this case the servletPath is just an empty string according // to the Servlet Specification (SRV 4.4). return FacesServletMapping.createPrefixMapping(servletPath); } else { // In the case of extension mapping, no "extra path" is available. // Still it's possible that prefix-based mapping has been used. // Actually, if there was an exact match no "extra path" // is available (e.g. if the url-pattern is "/faces/*" // and the request-uri is "/context/faces"). int slashPos = servletPath.lastIndexOf('/'); int extensionPos = servletPath.lastIndexOf('.'); if (extensionPos > -1 && extensionPos > slashPos) { String extension = servletPath.substring(extensionPos); return FacesServletMapping.createExtensionMapping(extension); } else { // There is no extension in the given servletPath and therefore // we assume that it's an exact match using prefix-based mapping. return FacesServletMapping.createPrefixMapping(servletPath); } } }
java
private boolean isCDIEnabled(Collection<WebSphereBeanDeploymentArchive> bdas) { boolean anyHasBeans = false; for (WebSphereBeanDeploymentArchive bda : bdas) { boolean hasBeans = false; if (bda.getType() != ArchiveType.RUNTIME_EXTENSION) { hasBeans = isCDIEnabled(bda); } anyHasBeans = anyHasBeans || hasBeans; if (anyHasBeans) { break; } } return anyHasBeans; }
java
private boolean isCDIEnabled(WebSphereBeanDeploymentArchive bda) { Boolean hasBeans = cdiStatusMap.get(bda.getId()); if (hasBeans == null) { //it's enabled if it has beans or it is an extension which could add beans hasBeans = bda.hasBeans() || bda.isExtension(); //setting this now should prevent loops when checking children in the next step cdiStatusMap.put(bda.getId(), hasBeans); //it's also enabled if any of it's children are enabled (but not including runtime extensions) hasBeans = hasBeans || isCDIEnabled(bda.getWebSphereBeanDeploymentArchives()); //remember the result cdiStatusMap.put(bda.getId(), hasBeans); } return hasBeans; }
java
@Override public boolean isCDIEnabled(String bdaId) { boolean hasBeans = false; //the top level isCDIEnabled can fail faster if (isCDIEnabled()) { Boolean hasBeansBoolean = cdiStatusMap.get(bdaId); if (hasBeansBoolean == null) { WebSphereBeanDeploymentArchive bda = deploymentDBAs.get(bdaId); if (bda == null) { // turns out that JAXWS create modules dynamically at runtime. That should be the only way // that there is no bda for a valid module/bda id. At the moment, CDI is not supported in // a module unless it exists at startup. hasBeans = false; } else { hasBeans = isCDIEnabled(bda); } } else { hasBeans = hasBeansBoolean; } } return hasBeans; }
java
private BeanDeploymentArchive createBDAOntheFly(Class<?> beanClass) throws CDIException { //Add the class in one of the bdas if an existing bda share the same classloader as the beanClass //Otherwise, we need to create a brand new bda and then add the bda to the graph //when it reaches here, it means no bda found for this class. We need to create a bda //Let's see whether there is a bda with the same classloader as the beanClass, if there is, let's add this class BeanDeploymentArchive bdaToReturn = findCandidateBDAtoAddThisClass(beanClass); if (bdaToReturn != null) { return bdaToReturn; } else { //If it comes here, it means no bda exists with the same classloader as the bean class, so we need to create a bda for it. return createNewBdaAndMakeWiring(beanClass); } }
java
private BeanDeploymentArchive createNewBdaAndMakeWiring(Class<?> beanClass) { try { OnDemandArchive onDemandArchive = new OnDemandArchive(cdiRuntime, application, beanClass); WebSphereBeanDeploymentArchive newBda = BDAFactory.createBDA(this, onDemandArchive, cdiRuntime); ClassLoader beanClassCL = onDemandArchive.getClassLoader(); // need to make this bda to be accessible to other bdas according to classloader hierarchy for (WebSphereBeanDeploymentArchive wbda : getWebSphereBeanDeploymentArchives()) { ClassLoader thisBDACL = wbda.getClassLoader(); //If the current archive is an extension bda, let's add this newly created bda accessible to it if (wbda.getType() == ArchiveType.RUNTIME_EXTENSION) { newBda.addBeanDeploymentArchive(wbda); } else { //let's check to see whether the wbda needs to be accessible to this new bda //The current bda should be accessible to the newly created bda if the newly created bda's classloader // is the same or the child classloader of the current bda makeWiring(newBda, wbda, thisBDACL, beanClassCL); } if ((wbda.getType() == ArchiveType.RUNTIME_EXTENSION) && wbda.extensionCanSeeApplicationBDAs()) { wbda.addBeanDeploymentArchive(newBda); } else { //Let's check whether the wbda's classloader is the descendant classloader of the new bda makeWiring(wbda, newBda, beanClassCL, thisBDACL); } } //Add this new bda to the deployment graph addBeanDeploymentArchive(newBda); return newBda; } catch (CDIException e) { throw new IllegalStateException(e); } }
java
private BeanDeploymentArchive findCandidateBDAtoAddThisClass(Class<?> beanClass) throws CDIException { for (WebSphereBeanDeploymentArchive wbda : getWebSphereBeanDeploymentArchives()) { if (wbda.getClassLoader() == beanClass.getClassLoader()) { wbda.addToBeanClazzes(beanClass); return wbda; } //if the cl is null, which means the classloader is the root classloader //for this kind of bda, its id ends with CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER //all classes loaded by the root classloader should be in a bda with the id ends with CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER if ((beanClass.getClassLoader() == null) && (wbda.getId().endsWith(CDIUtils.BDA_FOR_CLASSES_LOADED_BY_ROOT_CLASSLOADER))) { wbda.addToBeanClazzes(beanClass); return wbda; } } return null; }
java
private void makeWiring(WebSphereBeanDeploymentArchive wireFromBda, WebSphereBeanDeploymentArchive wireToBda, ClassLoader wireToBdaCL, ClassLoader wireFromBdaCL) { while (wireFromBdaCL != null) { if (wireFromBdaCL == wireToBdaCL) { wireFromBda.addBeanDeploymentArchive(wireToBda); break; } else { wireFromBdaCL = wireFromBdaCL.getParent(); } } //if we are here, it means the wireToBdaCL is root classloader, loading java.xx classes. All other bdas should be accessible to this new bda. if (wireFromBdaCL == wireToBdaCL) { wireFromBda.addBeanDeploymentArchive(wireToBda); } }
java
@Override public void addBeanDeploymentArchive(WebSphereBeanDeploymentArchive bda) throws CDIException { deploymentDBAs.put(bda.getId(), bda); extensionClassLoaders.add(bda.getClassLoader()); ArchiveType type = bda.getType(); if (type != ArchiveType.SHARED_LIB && type != ArchiveType.RUNTIME_EXTENSION) { applicationBDAs.add(bda); } }
java
@Override public void addBeanDeploymentArchives(Set<WebSphereBeanDeploymentArchive> bdas) throws CDIException { for (WebSphereBeanDeploymentArchive bda : bdas) { addBeanDeploymentArchive(bda); } }
java
@Override public void scan() throws CDIException { Collection<WebSphereBeanDeploymentArchive> allBDAs = new ArrayList<WebSphereBeanDeploymentArchive>(deploymentDBAs.values()); for (WebSphereBeanDeploymentArchive bda : allBDAs) { bda.scanForBeanDefiningAnnotations(true); } for (WebSphereBeanDeploymentArchive bda : allBDAs) { if (!bda.hasBeenScanned()) { bda.scan(); } } }
java
@Override public void initializeInjectionServices() throws CDIException { Set<ReferenceContext> cdiReferenceContexts = new HashSet<ReferenceContext>(); //first we need to initialize the injection service and collect the reference contexts and the injection classes for (WebSphereBeanDeploymentArchive bda : getApplicationBDAs()) { // Don't initialize child libraries, instead aggregate for the whole module if (bda.getType() != ArchiveType.MANIFEST_CLASSPATH && bda.getType() != ArchiveType.WEB_INF_LIB) { ReferenceContext referenceContext = bda.initializeInjectionServices(); cdiReferenceContexts.add(referenceContext); } } // now we need to process the injections for (ReferenceContext referenceContext : cdiReferenceContexts) { try { referenceContext.process(); } catch (InjectionException e) { throw new CDIException(e); } } }
java
@Override public void shutdown() { if (this.bootstrap != null) { AccessController.doPrivileged(new PrivilegedAction<Void>() { @Override public Void run() { bootstrap.shutdown(); return null; } }); this.bootstrap = null; this.deploymentDBAs.clear(); this.applicationBDAs.clear(); this.classloader = null; this.extensionClassLoaders.clear(); this.cdiEnabled = false; this.cdiStatusMap.clear(); this.application = null; this.classBDAMap.clear(); } }
java
boolean isConfigValid(ConvergedClientConfig config) { boolean valid = true; String clientId = config.getClientId(); String clientSecret = config.getClientSecret(); String authorizationEndpoint = config.getAuthorizationEndpointUrl(); String jwksUri = config.getJwkEndpointUrl(); if (clientId == null || clientId.length() == 0) { Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_clientId, clientId }); //CWWKS5500E valid = false; } if (clientSecret == null || clientSecret.length() == 0) { Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_clientSecret, "" }); //CWWKS5500E valid = false; } if (authorizationEndpoint == null || authorizationEndpoint.length() == 0 || (!authorizationEndpoint.toLowerCase().startsWith("http"))) { Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_authorizationEndpoint, authorizationEndpoint }); //CWWKS5500E valid = false; } // TODO: we need a message when we have bad jwks uri's, but this kind of check fails when jwks uri is not set. /* * if (jwksUri == null || jwksUri.length() == 0 * || (!jwksUri.toLowerCase().startsWith("http"))) { * Tr.error(tc, "INVALID_CONFIG_PARAM", new Object[] { OidcLoginConfigImpl.KEY_jwksUri, jwksUri }); //CWWKS5500E * * } */ return valid; }
java
protected void cleanOutBifurcatedMessages(BifurcatedConsumerSessionImpl owner, boolean bumpRedeliveryOnClose) throws SIResourceException, SISessionDroppedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "cleanOutBifurcatedMessages", new Object[]{new Integer(hashCode()),this}); int unlockedMessages = 0; synchronized(this) { if(firstMsg != null) { LMEMessage message = firstMsg; LMEMessage unlockMsg = null; while(message != null) { unlockMsg = message; message = message.next; // Only unlock messages that are owned by the bifurcated consumer. if(unlockMsg.owner == owner) { // Unlock the message from the message store if(unlockMsg.isStored) { try { unlockMessage(unlockMsg.message, bumpRedeliveryOnClose); } catch (SIMPMessageNotLockedException e) { // No FFDC code needed SibTr.exception(tc, e); // See defect 387591 // We should only get this exception if the message was deleted via // the controllable objects i.e. the admin console. If we are here for // another reason that we have a real error. } } // Remove the element from the liss removeMessage(unlockMsg); unlockedMessages++; } } } } if(unlockedMessages != 0) localConsumerPoint.removeActiveMessages(unlockedMessages); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "cleanOutBifurcatedMessages", this); }
java
protected int getNumberOfLockedMessages() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getNumberOfLockedMessages"); int count = 0; synchronized(this) { LMEMessage message; message = firstMsg; while(message != null) { count++; message = message.next; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getNumberOfLockedMessages", new Integer(count)); return count; }
java
protected void removeMessage(LMEMessage message) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeMessage", new Object[] {new Integer(hashCode()), message, this }); // If this was the message we entered the callback with we need // to move the start point back a bit if(message == callbackEntryMsg) callbackEntryMsg = message.previous; // If this is our current message we need to move the cursor // back a bit if(message == currentMsg) currentMsg = message.previous; // If this message was the next to expire we move the expiry cursor on to // the next eligible message. We leave any alarm registered so that it pops, // when this happens it realises the alarm is not valid for the next expiring // message and re-registers itself for the correct time. This gives us the // best performance when no locks are expiring as we're not continually // registering and de-registering alarms for every message if(message == nextMsgToExpire) { do { nextMsgToExpire = nextMsgToExpire.next; } while((nextMsgToExpire != null) && (nextMsgToExpire.expiryTime == 0)); } if(message == nextMsgReferenceToExpire) { do { nextMsgReferenceToExpire = nextMsgReferenceToExpire.next; } while((nextMsgReferenceToExpire != null) && (nextMsgReferenceToExpire.expiryTime == 0)); } // Unlink this message from the list if(message.previous != null) message.previous.next = message.next; else firstMsg = message.next; if(message.next != null) message.next.previous = message.previous; else lastMsg = message.previous; // Pool the element if there's space if(pooledCount < poolSize) { message.message = null; message.next = pooledMsg; message.previous = null; message.owner = null; message.jsMessage = null; message.expiryTime = 0; message.expiryMsgReferenceTime = 0; pooledMsg = message; pooledCount++; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeMessage", this); }
java
protected void resetCallbackCursor() throws SIResourceException, SISessionDroppedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "resetCallbackCursor", new Integer(hashCode())); synchronized(this) { unlockAllUnread(); callbackEntryMsg = lastMsg; currentMsg = lastMsg; messageAvailable = false; endReached = false; validState = false; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "resetCallbackCursor", this); }
java
final JsMessage setPropertiesInMessage(LMEMessage theMessage) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setPropertiesInMessage", theMessage); boolean copyMade = false; // If this is pubsub we share this message with other subscribers so we have // to make a copy prior to any updates. If this is pt-to-pt then any changes // we make here can be done before the copy, the copy is still required to // prevent a consumer from rolling back after modifying the message but // anything we set here will be reset the next time round so there's no harm // done. It is best to defer the 'copy' until after we've changed it so there // is less likelyhood of a real copy being required. JsMessageWrapper jsMessageWrapper = (JsMessageWrapper) theMessage.message; JsMessage jsMsg = jsMessageWrapper.getMessage(); try { //set the redeliveredCount if required if (jsMessageWrapper.guessRedeliveredCount() != 0) { if(isPubsub) { jsMsg = jsMsg.getReceived(); copyMade = true; } jsMsg.setRedeliveredCount(jsMessageWrapper.guessRedeliveredCount()); } long waitTime = jsMessageWrapper.updateStatisticsMessageWaitTime(); //Only store wait time in message where explicitly // asked if (setWaitTime ) { //defect 256701: we only set the message wait time if it is //a significant value. boolean waitTimeIsSignificant = waitTime > messageProcessor.getCustomProperties().get_message_wait_time_granularity(); if(waitTimeIsSignificant) { if(isPubsub && !copyMade) { jsMsg = jsMsg.getReceived(); copyMade = true; } jsMsg.setMessageWaitTime(waitTime); } } // If we deferred the copy till now we need to see if one is // needed. This will be the case either if the consumer has indicated that // it may change the message (not a comms client) and the message is still // on an itemStream (i.e. they could rollback the message with their changes). // Otherwise we can just give them our copy as we'll never want it back or // give it to anyone else. if(!copyMade && ((theMessage.isStored && copyMsg) || isPubsub)) jsMsg = jsMsg.getReceived(); } catch (MessageCopyFailedException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.setPropertiesInMessage", "1:2086:1.154.3.1", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration", "1:2093:1.154.3.1", e }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setPropertiesInMessage", e); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration", "1:2104:1.154.3.1", e }, null), e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setPropertiesInMessage", jsMsg); return jsMsg; }
java
protected void unlockAll(boolean closingSession) throws SIResourceException, SIMPMessageNotLockedException, SISessionDroppedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "unlockAll", new Object[]{new Integer(hashCode()),this}); int unlockedMessages = 0; SIMPMessageNotLockedException notLockedException = null; int notLockedExceptionMessageIndex = 0; synchronized(this) { messageAvailable = false; if(firstMsg != null) { LMEMessage pointerMsg = firstMsg; LMEMessage removedMsg = null; SIMessageHandle[] messageHandles = new SIMessageHandle[getNumberOfLockedMessages()]; boolean more = true; while(more) { // See if this is the last message in the list if(pointerMsg == lastMsg) more = false; // Only unlock messages that are in the MS (and haven't already // been unlocked by us) if(pointerMsg != currentUnlockedMessage) { if(pointerMsg.isStored) { try { unlockMessage(pointerMsg.message,true); } catch (SIMPMessageNotLockedException e) { // No FFDC code needed SibTr.exception(tc, e); // See defect 387591 // We should only get this exception if the message was deleted via // the controllable objects i.e. the admin console. If we are here for // another reason that we have a real error. SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration", "1:2229:1.154.3.1", e }); messageHandles[notLockedExceptionMessageIndex] = pointerMsg.getJsMessage().getMessageHandle(); notLockedExceptionMessageIndex++; if(notLockedException == null) notLockedException = e; } catch (SISessionDroppedException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.unlockAll", "1:2243:1.154.3.1", this); if(!closingSession) { handleSessionDroppedException(e); } SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration.unlockAll", "1:2255:1.154.3.1", e }); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "unlockAll", e); throw e; } } unlockedMessages++; } removedMsg = pointerMsg; pointerMsg = pointerMsg.next; // Remove the element from the list removeMessage(removedMsg); } currentUnlockedMessage = null; } } if(unlockedMessages != 0) localConsumerPoint.removeActiveMessages(unlockedMessages); if (notLockedException != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "unlockAll", this); throw notLockedException; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "unlockAll", this); }
java
private void unlockAllUnread() throws SIResourceException, SISessionDroppedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "unlockAllUnread", new Object[] { new Integer(hashCode()), this }); int unlockedMessages = 0; synchronized(this) { messageAvailable = false; // Only unlock messages if we have reached the end of the list. if(firstMsg != null && !endReached) { LMEMessage pointerMsg = null; if (currentMsg == null) pointerMsg = firstMsg; else pointerMsg = currentMsg.next; LMEMessage removedMsg = null; boolean more = true; if (pointerMsg != null) { while(more) { // See if this is the last message in the list if(pointerMsg == lastMsg) more = false; // Only unlock messages that are in the MS (and haven't already // been unlocked by us) if(pointerMsg != currentUnlockedMessage) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unlocking Message " + pointerMsg); if(pointerMsg.isStored) { try { unlockMessage(pointerMsg.message,false); } catch (SIMPMessageNotLockedException e) { // No FFDC code needed SibTr.exception(tc, e); // See defect 387591 // We should only get this exception if the message was deleted via // the controllable objects i.e. the admin console. If we are here for // another reason that we have a real error. } } unlockedMessages++; } removedMsg = pointerMsg; pointerMsg = pointerMsg.next; // Remove the element from the list removeMessage(removedMsg); } } } } if(unlockedMessages != 0) localConsumerPoint.removeActiveMessages(unlockedMessages); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "unlockAllUnread", this); }
java
public boolean containsValue(Token value, Transaction transaction) throws ObjectManagerException { try { for (Iterator iterator = entrySet().iterator();;) { Entry entry = (Entry) iterator.next(transaction); Token entryValue = entry.getValue(); if (value == entryValue) { return true; } } } catch (java.util.NoSuchElementException exception) { // No FFDC code needed, just exited search. return false; } // try. }
java
public long countAllMessagesOnStream() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "countAllMessagesOnStream"); long count=0; _targetStream.setCursor(0); // Get the first TickRange TickRange tr = _targetStream.getNext(); while (tr.endstamp < RangeList.INFINITY) { if (tr.type == TickRange.Value) { count++; } if (tr.type == TickRange.Requested) { // If we are an restarted IME (gathering) then we may have to restore msgs from the // DME which were previously Value msgs in this stream. We need to count any re-requests // in our count as they contribute to the total. if (((AIRequestedTick)tr.value).getRestoringAOValue() != null) count++; } tr = _targetStream.getNext(); } // end while if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "countAllMessagesOnStream", Long.valueOf(count)); return count; }
java
public final void incrementUnlockCount(long tick) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "incrementUnlockCount", Long.valueOf(tick)); _targetStream.setCursor(tick); TickRange tickRange = _targetStream.getNext(); if (tickRange.type == TickRange.Value) { AIValueTick valueTick = (AIValueTick) tickRange.value; if (valueTick != null) valueTick.incRMEUnlockCount(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "incrementUnlockCount", tickRange); }
java
public void processRequestAck(long tick, long dmeVersion) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "processRequestAck", new Object[] { Long.valueOf(tick), Long.valueOf(dmeVersion)}); // Only consider non-stale request acks if (dmeVersion >= _latestDMEVersion) { _targetStream.setCursor(tick); TickRange tickRange = _targetStream.getNext(); // Make sure that we still have a Q/G if (tickRange.type == TickRange.Requested) { AIRequestedTick airt = (AIRequestedTick) tickRange.value; // serialize with get repetition and request timeouts synchronized (airt) { // Set the request timer to slow, but only if it is not already slowed if (!airt.isSlowed()) { _eagerGetTOM.removeTimeoutEntry(airt); airt.setSlowed(true); airt.setAckingDMEVersion(dmeVersion); long to = airt.getTimeout(); if (to > 0 || to == _mp.getCustomProperties().get_infinite_timeout()) { _slowedGetTOM.addTimeoutEntry(airt); } } } } else { // This can happen if the request ack got in too late and the Q/G was timed out and rejected } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "processRequestAck"); }
java
public void processResetRequestAck(long dmeVersion, SendDispatcher sendDispatcher) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "processResetRequestAck", Long.valueOf(dmeVersion)); // Only consider non-stale request acks if (dmeVersion >= _latestDMEVersion) { if (dmeVersion > _latestDMEVersion) _latestDMEVersion = dmeVersion; _slowedGetTOM.applyToEachEntry(new AddToEagerTOM(_slowedGetTOM, dmeVersion)); sendDispatcher.sendResetRequestAckAck(dmeVersion); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "processResetRequestAck"); }
java
public AnycastInputHandler getAnycastInputHandler() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getAnycastInputHandler"); SibTr.exit(tc, "getAnycastInputHandler", _parent); } return _parent; }
java
public void messagingEngineStarting(final JsMessagingEngine messagingEngine) { final String methodName = "messagingEngineStarting"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, messagingEngine); } try { addMessagingEngine(messagingEngine); } catch (final ResourceException exception) { FFDCFilter.processException(exception, CLASS_NAME + "." + methodName, "1:608:1.40", this); SibTr.error(TRACE, "MESSAGING_ENGINE_STARTING_CWSIV0555", new Object[] { exception, messagingEngine.getName(), messagingEngine.getBusName(), this }); // To reach this point would mean a more serious error has occurred like // the destination does not exist. Deactivate the MDB so that the user // knows there is a problem. This behaviour is consistent with the MDB // being deactivated if the MDB fails during initial startup (an exception // thrown to J2C and they would deactivate the MDB). deactivate(); } if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } }
java
public void messagingEngineStopping( final JsMessagingEngine messagingEngine, final int mode) { final String methodName = "messagingEngineStopping"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, new Object[] { messagingEngine, mode }); } closeConnection(messagingEngine); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } }
java
private SQLException classNotFound(Object interfaceNames, Set<String> packagesSearched, String dsId, Throwable cause) { if (cause instanceof SQLException) return (SQLException) cause; // TODO need an appropriate message when sharedLib is null and classes are loaded from the application String sharedLibId = sharedLib.id(); // Determine the list of folders that should contain the JDBC driver files. Collection<String> driverJARs = getClasspath(sharedLib, false); String message = sharedLibId.startsWith("com.ibm.ws.jdbc.jdbcDriver-") ? AdapterUtil.getNLSMessage("DSRA4001.no.suitable.driver.nested", interfaceNames, dsId, driverJARs, packagesSearched) : AdapterUtil.getNLSMessage("DSRA4000.no.suitable.driver", interfaceNames, dsId, sharedLibId, driverJARs, packagesSearched); return new SQLNonTransientException(message, cause); }
java
public ConnectionPoolDataSource createConnectionPoolDataSource(Properties props, String dataSourceID) throws SQLException { lock.readLock().lock(); try { if (!isInitialized) try { // Switch to write lock for lazy initialization lock.readLock().unlock(); lock.writeLock().lock(); if (!isInitialized) { if (!loadFromApp()) classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib); isInitialized = true; } } finally { // Downgrade to read lock for rest of method lock.readLock().lock(); lock.writeLock().unlock(); } String className = (String) properties.get(ConnectionPoolDataSource.class.getName()); if (className == null) { String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID; className = JDBCDrivers.getConnectionPoolDataSourceClassName(vendorPropertiesPID); if (className == null) { //if properties.oracle.ucp is configured do not search based on classname or infer because the customer has indicated //they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no ConnectionPoolDataSource) if("com.ibm.ws.jdbc.dataSource.properties.oracle.ucp".equals(vendorPropertiesPID)) { throw new SQLNonTransientException(AdapterUtil.getNLSMessage("DSRA4015.no.ucp.connection.pool.datasource", dataSourceID, ConnectionPoolDataSource.class.getName())); } className = JDBCDrivers.getConnectionPoolDataSourceClassName(getClasspath(sharedLib, true)); if (className == null) { Set<String> packagesSearched = new LinkedHashSet<String>(); SimpleEntry<Integer, String> dsEntry = JDBCDrivers.inferDataSourceClassFromDriver // (classloader, packagesSearched, JDBCDrivers.CONNECTION_POOL_DATA_SOURCE); className = dsEntry == null ? null : dsEntry.getValue(); if (className == null) throw classNotFound(ConnectionPoolDataSource.class.getName(), packagesSearched, dataSourceID, null); } } } return create(className, props, dataSourceID); } finally { lock.readLock().unlock(); } }
java
public DataSource createDataSource(Properties props, String dataSourceID) throws SQLException { lock.readLock().lock(); try { if (!isInitialized) try { // Switch to write lock for lazy initialization lock.readLock().unlock(); lock.writeLock().lock(); if (!isInitialized) { if (!loadFromApp()) classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib); isInitialized = true; } } finally { // Downgrade to read lock for rest of method lock.readLock().lock(); lock.writeLock().unlock(); } String className = (String) properties.get(DataSource.class.getName()); if (className == null) { String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID; className = JDBCDrivers.getDataSourceClassName(vendorPropertiesPID); if (className == null) { className = JDBCDrivers.getDataSourceClassName(getClasspath(sharedLib, true)); if (className == null) { Set<String> packagesSearched = new LinkedHashSet<String>(); SimpleEntry<Integer, String> dsEntry = JDBCDrivers.inferDataSourceClassFromDriver // (classloader, packagesSearched, JDBCDrivers.DATA_SOURCE); className = dsEntry == null ? null : dsEntry.getValue(); if (className == null) throw classNotFound(DataSource.class.getName(), packagesSearched, dataSourceID, null); } } } return create(className, props, dataSourceID); } finally { lock.readLock().unlock(); } }
java
public Object getDriver(String url, Properties props, String dataSourceID) throws Exception { lock.readLock().lock(); try { if (!isInitialized) try { // Switch to write lock for lazy initialization lock.readLock().unlock(); lock.writeLock().lock(); if (!isInitialized) { if (!loadFromApp()) classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib); isInitialized = true; } } finally { // Downgrade to read lock for rest of method lock.readLock().lock(); lock.writeLock().unlock(); } final String className = (String) properties.get(Driver.class.getName()); if (className == null) { String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID; //if properties.oracle.ucp is configured do not search for driver impls because the customer has indicated //they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no Driver interface) if("com.ibm.ws.jdbc.dataSource.properties.oracle.ucp".equals(vendorPropertiesPID)) { throw new SQLNonTransientException(AdapterUtil.getNLSMessage("DSRA4015.no.ucp.connection.pool.datasource", dataSourceID, Driver.class.getName())); } } Driver driver = loadDriver(className, url, classloader, props, dataSourceID); if (driver == null) throw classNotFound(Driver.class.getName(), Collections.singleton("META-INF/services/java.sql.Driver"), dataSourceID, null); return driver; } finally { lock.readLock().unlock(); } }
java
public static Collection<String> getClasspath(Library sharedLib, boolean upperCaseFileNamesOnly) { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(tc, "getClasspath", sharedLib); Collection<String> classpath = new LinkedList<String>(); if (sharedLib != null && sharedLib.getFiles() != null) for (File file : sharedLib.getFiles()) classpath.add(upperCaseFileNamesOnly ? file.getName().toUpperCase() : file.getAbsolutePath()); if (sharedLib != null && sharedLib.getFilesets() != null) for (Fileset fileset : sharedLib.getFilesets()) for (File file : fileset.getFileset()) classpath.add(upperCaseFileNamesOnly ? file.getName().toUpperCase() : file.getAbsolutePath()); if (trace && tc.isEntryEnabled()) Tr.exit(tc, "getClasspath", classpath); return classpath; }
java
private void modified(Dictionary<String, ?> newProperties, boolean logMessage) { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(this, tc, "modified", newProperties); boolean replaced = false; lock.writeLock().lock(); try { if (isInitialized) { if (classloader != null) { if (isDerbyEmbedded.compareAndSet(true, false)) // assume false for any future usage until shown otherwise shutdownDerbyEmbedded(); classloader = null; } for (Iterator<Class<? extends CommonDataSource>> it = introspectedClasses.iterator(); it.hasNext(); it.remove()) Introspector.flushFromCaches(it.next()); replaced = true; isInitialized = false; } if (newProperties != null) properties = newProperties; } finally { lock.writeLock().unlock(); } if (replaced) try { setChanged(); notifyObservers(); } catch (Throwable x) { FFDCFilter.processException(x, getClass().getName(), "254", this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, x.getMessage(), AdapterUtil.stackTraceToString(x)); } if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "modified"); }
java
private static void setProperty(Object obj, PropertyDescriptor pd, String value, boolean doTraceValue) throws Exception { Object param = null; String propName = pd.getName(); if (tc.isDebugEnabled()) { if("URL".equals(propName) || "url".equals(propName)) { Tr.debug(tc, "set " + propName + " = " + PropertyService.filterURL(value)); } else { Tr.debug(tc, "set " + propName + " = " + (doTraceValue ? value : "******")); } } java.lang.reflect.Method setter = pd.getWriteMethod(); if (setter == null) throw new NoSuchMethodException(AdapterUtil.getNLSMessage("NO_SETTER_METHOD", propName)); Class<?> paramType = setter.getParameterTypes()[0]; if (!paramType.isPrimitive()) { if (paramType.equals(String.class)) // the most common case: String param = value; else if (paramType.equals(Properties.class)) // special case: Properties param = AdapterUtil.toProperties(value); else if (paramType.equals(Character.class)) // special case: Character param = Character.valueOf(value.charAt(0)); else // the generic case: any object with a single parameter String constructor param = paramType.getConstructor(String.class).newInstance(value); } else if (paramType.equals(int.class)) param = Integer.valueOf(value); else if (paramType.equals(long.class)) param = Long.valueOf(value); else if (paramType.equals(boolean.class)) param = Boolean.valueOf(value); else if (paramType.equals(double.class)) param = Double.valueOf(value); else if (paramType.equals(float.class)) param = Float.valueOf(value); else if (paramType.equals(short.class)) param = Short.valueOf(value); else if (paramType.equals(byte.class)) param = Byte.valueOf(value); else if (paramType.equals(char.class)) param = Character.valueOf(value.charAt(0)); setter.invoke(obj, new Object[] { param }); }
java
protected void setSharedLib(Library lib) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "setSharedLib", lib); sharedLib = lib; }
java
private void shutdownDerbyEmbedded() { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(this, tc, "shutdownDerbyEmbedded", classloader, embDerbyRefCount); // Shut down Derby embedded if the reference count drops to 0 if (embDerbyRefCount.remove(classloader) && !embDerbyRefCount.contains(classloader)) try { Class<?> EmbDS = AdapterUtil.forNameWithPriv("org.apache.derby.jdbc.EmbeddedDataSource40", true, classloader); DataSource ds = (DataSource) EmbDS.newInstance(); EmbDS.getMethod("setShutdownDatabase", String.class).invoke(ds, "shutdown"); ds.getConnection().close(); if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "shutdownDerbyEmbedded"); } catch (SQLException x) { // expected for shutdown if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "shutdownDerbyEmbedded", x.getSQLState() + ' ' + x.getErrorCode() + ':' + x.getMessage()); } catch (Throwable x) { // Work around Derby issue when the JVM is shutting down while Derby shutdown is requested. if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "shutdownDerbyEmbedded", x); } else if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "shutdownDerbyEmbedded", false); }
java
protected void unsetSharedLib(Library lib) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "unsetSharedLib", lib); modified(null, false); }
java
private static void retrieveManifestData() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "retrieveManifestData"); try { // Set up the defaults that will be overriden if possible. JmsMetaDataImpl.setProblemDefaults(); Package thisPackage = Package.getPackage(packageName); if (thisPackage != null) { // This string will contain something like "IBM". String tempProv = thisPackage.getImplementationVendor(); // Only set it if it is not null. if (tempProv != null) { JmsMetaDataImpl.provName = tempProv; } // d336782 rework of build level processing // // The format for the implementation version will depend on how the jar containing // our package was built. // The builds of sib.api.jmsImpl.jar will contain something like this: // Implementation-Version: WASX.SIB [o0602.101] // Implementation-Vendor: IBM Corp. // However, the product is build into a larger package com.ibm.ws.sib.server.jar // with entries in the manifest like this: // Implementation-Version: 1.0.0 // Implementation-Vendor: IBM Corp. // // We parse the implementation version and if it has the former format // we use that build level, otherwise we will use the build level // reported by the BuildInfo class. // // We will set provVersion to the whole build level string, // provMajorVersion to the 4 numbers before the dot (yyww - year and week) // and provMinorVersion to the two or three numbers after the dot // (build sequence) String version = thisPackage.getImplementationVersion(); if (version != null) { Matcher m = sibOldVersionPattern.matcher(version); if (!(m.matches())) { // is there a valid build level in the version strng? // NO. New format or some unknown format. Use BuildInfo class version = "1.0.0";//BuildInfo.getBuildLevel(); //this will bever be used is the assumption -lohith //lohith liberty change m = sibBuildLevelPattern.matcher(version); // re-match for just the build level } if (m.matches()) { // check again JmsMetaDataImpl.provVersion = m.group(1); // e.g. wwwdddd.ddd try { JmsMetaDataImpl.provMajorVersion = Integer.valueOf(m.group(2)).intValue(); JmsMetaDataImpl.provMinorVersion = Integer.valueOf(m.group(3)).intValue(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "provMajorVersion=" + JmsMetaDataImpl.provMajorVersion + "provMinorVersion=" + JmsMetaDataImpl.provMinorVersion); } catch (RuntimeException e2) { // No FFDC code needed // This exception should never happen if the regex worked properly returning numbers for group 2 and 3 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to convert major or minor version number from build level " + version + " to int", e2); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to find a valid build level in " + version); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Implementation version from manifest was null"); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "The package was null - unable to retrieve information"); } //if package not null } catch (RuntimeException e) { // No FFDC code needed FFDCFilter.processException(e, "com.ibm.ws.sib.api.jms.impl.JmsMetaDataImpl", "retrieveManifestData#1"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Error retrieving manifest information", e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "retrieveManifestData"); }
java
public SIBusMessage nextLocked() throws SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIResourceException, SIConnectionLostException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"nextLocked"); JsMessage retMsg = null; synchronized(lmeOperationMonitor) { checkValid(); // At this point we look at each item in the array up to end of the array for the next // non-null item. This is because some points in the array may be null if they have been // deleted or unlocked. while (nextIndex != messages.length) { retMsg = messages[nextIndex]; nextIndex++; if (retMsg != null) break; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"nextLocked", retMsg); return retMsg; }
java
public void unlockCurrent() throws SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIResourceException, SIConnectionLostException, SIIncorrectCallException, SIMessageNotLockedException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"unlockCurrent"); synchronized(lmeOperationMonitor) { checkValid(); // If nextIndex = 0 then we are pointing at the first item, therefore unlocking the current // is invalid. Also, if the message is null, then we must have deleted - therefore also // invalid. if ((nextIndex == 0) || (messages[nextIndex - 1] == null)) { throw new SIIncorrectCallException( nls.getFormattedMessage("LME_UNLOCK_INVALID_MSG_SICO1017", null, null) ); } JsMessage retMsg = messages[nextIndex - 1]; if (CommsUtils.isRecoverable(retMsg, consumerSession.getUnrecoverableReliability())) { convHelper.unlockSet(new SIMessageHandle[] {retMsg.getMessageHandle()}); } messages[nextIndex - 1] = null; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"unlockCurrent"); }
java
public void deleteCurrent(SITransaction transaction) throws SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIResourceException, SIConnectionLostException, SILimitExceededException, SIIncorrectCallException, SIMessageNotLockedException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"deleteCurrent", transaction); synchronized(lmeOperationMonitor) { checkValid(); // If nextIndex = 0 then we are pointing at the first item, therefore unlocking the current // is invalid. Also, if the message is null, then we must have deleted - therefore also // invalid. if ((nextIndex == 0) || (messages[nextIndex - 1] == null)) { throw new SIIncorrectCallException( nls.getFormattedMessage("LME_DELETE_INVALID_MSG_SICO1018", null, null) ); } JsMessage retMsg = messages[nextIndex - 1]; // Only flow the delete if it would not have been done on the server already. // This will have been done if the message is determined to be 'unrecoverable'. if (CommsUtils.isRecoverable(retMsg, consumerSession.getUnrecoverableReliability())) { // Start d181719 JsMessage[] msgs = new JsMessage[] {retMsg}; // f191114 if (transaction != null) { synchronized (transaction) { // Check transaction is in a valid state. // Enlisted for an XA UOW and not rolledback or // completed for a local transaction. if (!((Transaction)transaction).isValid()) { throw new SIIncorrectCallException( nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null) ); } deleteMessages(msgs, transaction); // f191114 } } else { deleteMessages(msgs, null); // f191114 } // End d181719 } // Now remove it from the LME messages[nextIndex - 1] = null; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"deleteCurrent"); }
java
public void deleteSeen(SITransaction transaction) throws SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIResourceException, SIConnectionLostException, SILimitExceededException, SIIncorrectCallException, SIMessageNotLockedException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"deleteSeen", transaction); synchronized(lmeOperationMonitor) { checkValid(); // If we have seen any messages.... int numSeenMsgs = getSeenMessageCount(); if (numSeenMsgs > 0) { // Start d181719 JsMessage[] seenRecoverableMessages = new JsMessage[numSeenMsgs]; int numOfMessagesNeedingDeleting = 0; // Go through each seen message for (int i=0; i < nextIndex; ++i) { if (messages[i] != null) { // Only add the message to the list of messages to delete if it is recoverable if (CommsUtils.isRecoverable(messages[i], consumerSession.getUnrecoverableReliability())) // f177889 { // f177889 seenRecoverableMessages[numOfMessagesNeedingDeleting] = messages[i]; // f177889 ++numOfMessagesNeedingDeleting; } // f177889 // Delete it from the main pile messages[i] = null; } } if (numOfMessagesNeedingDeleting > 0) { if (transaction != null) { synchronized (transaction) { // Check transaction is in a valid state. // Enlisted for an XA UOW and not rolledback or // completed for a local transaction. if (!((Transaction) transaction).isValid()) { throw new SIIncorrectCallException( nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null) ); } deleteMessages(seenRecoverableMessages, transaction); } } else { deleteMessages(seenRecoverableMessages, null); } } // End d181719 } // End f191114 } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"deleteSeen"); }
java
private void deleteMessages(JsMessage[] messagesToDelete, SITransaction transaction) throws SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIResourceException, SIConnectionLostException, SILimitExceededException, SIIncorrectCallException, SIMessageNotLockedException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"deleteMessages"); int priority = JFapChannelConstants.PRIORITY_MEDIUM; // d178368 if (transaction != null) { Transaction commsTransaction = (Transaction)transaction; priority = commsTransaction.getLowestMessagePriority(); // d178368 // f181927 // Inform the transaction that our consumer session has deleted // a recoverable message under this transaction. This means that if // a rollback is performed (and strict rollback ordering is enabled) // we can ensure that this message will be redelivered in order. commsTransaction.associateConsumer(consumerSession); } // begin F219476.2 SIMessageHandle[] messageHandles = new SIMessageHandle[messagesToDelete.length]; for (int x = 0; x < messagesToDelete.length; x++) // f192215 { if (messagesToDelete[x] != null) { messageHandles[x] = messagesToDelete[x].getMessageHandle(); } } convHelper.deleteMessages(messageHandles, transaction, priority); // d178368 // end F219476.2 // } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"deleteMessages"); }
java
public void resetCursor() throws SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIResourceException, SIConnectionLostException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"resetCursor"); nextIndex = 0; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"resetCursor"); }
java
public int getRemainingMessageCount() throws SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"getRemainingMessageCount"); checkValid(); int remain = getUnSeenMessageCount(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"getRemainingMessageCount", ""+remain); return remain; }
java