code
stringlengths 73
34.1k
| label
stringclasses 1
value |
|---|---|
public static List getChildTextList(Element elem, String childTagName)
{
NodeList nodeList = elem.getElementsByTagName(childTagName);
int len = nodeList.getLength();
if (len == 0)
{
return Collections.EMPTY_LIST;
}
List list = new ArrayList(len);
for (int i = 0; i < len; i++)
{
list.add(getElementText((Element)nodeList.item(i)));
}
return list;
}
|
java
|
@Override
public void sendNackMessage(
SIBUuid8 upstream,
SIBUuid12 destUuid,
SIBUuid8 busUuid,
long startTick,
long endTick,
int priority,
Reliability reliability,
SIBUuid12 stream) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"sendNackMessage",
new Object[] { new Long(startTick), new Long(endTick) });
ControlNack nackMsg = createControlNackMessage(priority, reliability, stream);
nackMsg.setStartTick(startTick);
nackMsg.setEndTick(endTick);
if (upstream == null)
{
upstream = _originStreamMap.get(stream);
}
// Send this to MPIO
// Send Nack messages at message priority +2
_mpio.sendToMe(
upstream,
priority + 2,
nackMsg);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendNackMessage ");
}
|
java
|
private void processAckExpected(ControlAckExpected ackExpMsg)
throws SIResourceException
{
// This is called by a PubSubOutputHandler when it finds Unknown
// ticks in it's own stream and need the InputStream to resend them
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "processAckExpected", ackExpMsg);
// The upstream cellule for this stream is stored in the originStreamMap
// unless we were the originator.
SIBUuid12 streamID = ackExpMsg.getGuaranteedStreamUUID();
int priority = ackExpMsg.getPriority().intValue();
Reliability reliability = ackExpMsg.getReliability();
if (_internalInputStreamManager.hasStream(streamID, priority, reliability))
{
_internalInputStreamManager.processAckExpected(ackExpMsg);
}
else
{
_targetStreamManager.handleAckExpectedMessage(ackExpMsg);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processAckExpected");
}
|
java
|
private long processNackWithReturnValue(ControlNack nackMsg)
throws SIResourceException
{
// This is called by a PubSubOutputHandler when it finds Unknown
// ticks in it's own stream and need the InputStream to resend them
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "processNackWithReturnValue", nackMsg);
long returnValue = -1;
// The upstream cellule for this stream is stored in the originStreamMap
// unless we were the originator.
SIBUuid12 stream = nackMsg.getGuaranteedStreamUUID();
if (_sourceStreamManager.hasStream(stream))
{
// 242139: Currently we get back to here for every processNack
// that the InternalOutputStream handles. This is an error but
// a harmles one. For now the fix is to avoid throwing an exception
// as the InternalOutputstream has in fact satisfied the Nack correctly.
// The longer term fix is to writeCombined range into the IOS not just the
// value
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Ignoring processNack on sourceStream at PubSubInputHandler");
returnValue = _sourceStreamManager.getStreamSet().getStream(nackMsg.getPriority(), nackMsg.getReliability()).getCompletedPrefix();
}
else
{
// Else we are an IME
// send nacks if necessary
_internalInputStreamManager.processNack(nackMsg);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processNackWithReturnValue", new Long(returnValue));
return returnValue;
}
|
java
|
private void remotePut(
MessageItem msg,
SIBUuid8 sourceMEUuid)
throws
SIResourceException,
SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"remotePut",
new Object[] { msg, sourceMEUuid });
// Update the origin map if this is a new stream.
// This unsynchronized update is ok until multiple paths
// are possible (in which case there could be a race
// for the same stream on this method).
SIBUuid12 stream = msg.getMessage().getGuaranteedStreamUUID();
if (!_originStreamMap.containsKey(stream))
_originStreamMap.put(stream, sourceMEUuid);
// First get matches
// Match Consumers is only called for PubSub targets.
MessageProcessorSearchResults searchResults = matchMessage(msg);
String topic = msg.getMessage().getDiscriminator();
//First the remote to remote case (forwarding)
HashMap allPubSubOutputHandlers = _destination.getAllPubSubOutputHandlers();
List matchingPubsubOutputHandlers = searchResults.getPubSubOutputHandlers(topic);
// Check to see if we have any Neighbours
if (allPubSubOutputHandlers != null &&
allPubSubOutputHandlers.size() > 0)
{
remoteToRemotePut(msg, allPubSubOutputHandlers, matchingPubsubOutputHandlers);
}
// Calling getAllPubSubOutputHandlers() locks the handlers
// so now we have finished we need to unlock
_destination.unlockPubsubOutputHandlers();
// Now handle remote to local case
// If there are any ConsumerDispatchers we will need to save the
// list in the Targetstream with the message
Set consumerDispatchers = searchResults.getConsumerDispatchers(topic);
// Check to see if we have any matching Neighbours
if (consumerDispatchers != null &&
consumerDispatchers.size() > 0)
{
// Add the list of consumerDispatchers to the MessageItem
// as we will need it in DeliverOrdered messages
msg.setSearchResults(searchResults);
// This will add the message to the TargetStream
remoteToLocalPut(msg);
}
else
{
// This will add Silence to the TargetStream
remoteToLocalPutSilence(msg);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "remotePut");
}
|
java
|
protected void remoteToLocalPutSilence(MessageItem msgItem) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"remoteToLocalPutSilence",
new Object[] { msgItem });
// Write Silence to the targetStream instead
// If the targetStream does not exist this will just return
_targetStreamManager.handleSilence(msgItem);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "remoteToLocalPutSilence");
}
|
java
|
private MessageProcessorSearchResults matchMessage(MessageItem msg)
throws SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"matchMessage",
new Object[] { msg });
//Extract the message from the MessageItem
JsMessage jsMsg = msg.getMessage();
// Match Consumers is only called for PubSub targets.
TopicAuthorization topicAuth = _messageProcessor.getDiscriminatorAccessChecker();
MessageProcessorSearchResults searchResults = new MessageProcessorSearchResults(topicAuth);
// Defect 382250, set the unlockCount from MsgStore into the message
// in the case where the message is being redelivered.
int redelCount = msg.guessRedeliveredCount();
if (redelCount > 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Set deliverycount into message: " + redelCount);
jsMsg.setDeliveryCount(redelCount);
}
// Get the matching consumers from the matchspace
_matchspace.retrieveMatchingOutputHandlers(
_destination,
jsMsg.getDiscriminator(),
(MatchSpaceKey) jsMsg,
searchResults);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(
tc,
"matchMessage",
new Object[] { searchResults });
return searchResults;
}
|
java
|
private boolean restoreFanOut(
MessageItemReference ref,
boolean commitInsert)
throws
SIDiscriminatorSyntaxException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"restoreFanOut",
new Object[] { ref, new Boolean(commitInsert) });
boolean keepReference = true;
MessageItem msg = null;
try
{
msg = (MessageItem) ref.getReferredItem();
} catch (MessageStoreException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.PubSubInputHandler.restoreFanOut",
"1:2102:1.329.1.1",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restoreFanOut", e);
throw new SIResourceException(e);
}
//Find matching output handlers
MessageProcessorSearchResults searchResults = matchMessage(msg);
String topic = msg.getMessage().getDiscriminator();
// cycle through the Neighbouring ME's
List matchingPubsubOutputHandlers = searchResults.getPubSubOutputHandlers(topic);
// Check to see if we have any matching Neighbours
if (matchingPubsubOutputHandlers != null &&
matchingPubsubOutputHandlers.size() > 0)
{
HashMap allPubSubOutputHandlers = _destination.getAllPubSubOutputHandlers();
try
{
Iterator itr = allPubSubOutputHandlers.values().iterator();
while (itr.hasNext())
{
PubSubOutputHandler handler = (PubSubOutputHandler) itr.next();
if (handler.okToForward(msg))
{
if (matchingPubsubOutputHandlers.contains(handler))
{
// Put the message to the Neighbour.
handler.putInsert(msg, commitInsert);
}
else
{
// Put Completed into stream
// Set "create" to true in case this is the first time
// this stream has seen a tick.
handler.putSilence(msg);
}
}
//else
//{
// defect 260440:
// 601 used to now remove this OH from
// the set of matching outputhandlers, but it is cheaper
// instead to merely repeat the 'okToForward' check later on
//}
}
} finally
{
// unlock as the getAllPubSubOutputHandlers locks it.
_destination.unlockPubsubOutputHandlers();
}
}
else
// no matching Neighbours, mark itemReference to be removed from referenceStream
{
keepReference = false;
}
// If we have OutputHandlers to deliver this to, and ref is indoubt,
// then we keep searchResults for use in the eventPostAdd() callback
if (keepReference && !commitInsert)
{
ref.setSearchResults(searchResults);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restoreFanOut");
return keepReference;
}
|
java
|
private MessageItemReference addProxyReference(MessageItem msg,
MessageProcessorSearchResults matchingPubsubOutputHandlers,
TransactionCommon tran) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addProxyReference", new Object[] { msg, tran });
MessageItemReference ref = new MessageItemReference(msg);
// This ensures that the persitence of the MessageItem cannot be downgaded
// by the consumerDispatcher because we have remote subscribers.
msg.addPersistentRef();
ref.setSearchResults(matchingPubsubOutputHandlers);
try
{
ref.registerMessageEventListener(MessageEvents.POST_COMMIT_ADD, this);
ref.registerMessageEventListener(MessageEvents.POST_ROLLBACK_ADD, this);
Transaction msTran = _messageProcessor.resolveAndEnlistMsgStoreTransaction(tran);
_proxyReferenceStream.add(ref, msTran);
} catch (OutOfCacheSpace e)
{
// No FFDC code needed
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addProxyReference", "SIResourceException");
throw new SIResourceException(e);
} catch (MessageStoreException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.PubSubInputHandler.addProxyReference",
"1:2315:1.329.1.1",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubInputHandler",
"1:2322:1.329.1.1",
e });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addProxyReference", e);
throw new SIResourceException(nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubInputHandler",
"1:2332:1.329.1.1",
e },
null));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addProxyReference");
return ref;
}
|
java
|
public void setPropertiesInMessage(JsMessage jsMsg,
SIBUuid12 destinationUuid,
SIBUuid12 producerConnectionUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setPropertiesInMessage",
new Object[] { jsMsg, destinationUuid, producerConnectionUuid });
SIMPUtils.setGuaranteedDeliveryProperties(jsMsg,
_messageProcessor.getMessagingEngineUuid(),
null,
null,
null,
destinationUuid,
ProtocolType.PUBSUBINPUT,
GDConfig.PROTOCOL_VERSION);
if (jsMsg.getConnectionUuid() == null)
{
//defect 278038:
//The producerSession will have set this in the msgItem for pub sub
//destinations. However, the field may not have been set in the
//jsMsg if the msg was not persisted before this point.
//Since the message is going off the box, we have no choice but to set it now.
jsMsg.setConnectionUuid(producerConnectionUuid);
}
//NOTE: the 'bus' field is not set in this method as it should
//only be set once the message has been stored
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setPropertiesInMessage");
}
|
java
|
@Override
public void validate() {
//validate the parameters
String target = getTargetName();
if (value() < 1) {
throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "bulkhead.parameter.invalid.value.CWMFT5016E", "value ", value(), target));
}
//validate the parameters
if (waitingTaskQueue() < 1) {
throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "bulkhead.parameter.invalid.value.CWMFT5016E", "waitingTaskQueue", waitingTaskQueue(),
target));
}
}
|
java
|
public void updateCacheSizes(long max, long current) {
final String methodName = "updateCacheSizes()";
if (tc.isDebugEnabled() && null != _maxInMemoryCacheEntryCount && null != _inMemoryCacheEntryCount) {
if (max != _maxInMemoryCacheEntryCount.getCount() && _inMemoryCacheEntryCount.getCount() != current)
Tr.debug(tc, methodName + " cacheName=" + _sCacheName + " max=" + max + " current=" + current + " enable=" + this._enable, this);
}
if (_enable) {
if (_maxInMemoryCacheEntryCount != null)
_maxInMemoryCacheEntryCount.setCount(max);
if (_inMemoryCacheEntryCount != null)
_inMemoryCacheEntryCount.setCount(current);
}
}
|
java
|
public void onCacheHit(String template, int locality) {
final String methodName = "onCacheHit()";
CacheStatsModule csm = null;
if ((csm = getCSM(template)) == null) {
return;
}
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + " cacheName=" + _sCacheName + " template=" + template + " locality=" + locality + " enable=" + csm._enable
+ " parentEnable=" + _enable + " " + this);
switch (locality) {
case REMOTE:
if (csm._enable) {
if (csm._remoteHitCount != null) {
csm._remoteHitCount.increment();
}
if (csm._inMemoryAndDiskCacheEntryCount != null) {
csm._inMemoryAndDiskCacheEntryCount.increment();
}
if (csm._remoteCreationCount != null) {
csm._remoteCreationCount.increment();
}
}
break;
case MEMORY:
if (csm._enable && csm._hitsInMemoryCount != null)
csm._hitsInMemoryCount.increment();
break;
case DISK:
if (_csmDisk != null && _csmDisk._enable && _csmDisk._hitsOnDisk != null) {
_csmDisk._hitsOnDisk.increment();
}
if (csm._enable && csm._hitsOnDiskCount != null)
csm._hitsOnDiskCount.increment();
break;
default:
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + " Error - Unrecognized locality " + locality + " cacheName=" + _sCacheName);
break;
}
return;
}
|
java
|
public void onCacheMiss(String template, int locality) {
final String methodName = "onCacheMiss()";
CacheStatsModule csm = null;
if ((csm = getCSM(template)) == null) {
return;
}
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + " cacheName=" + _sCacheName + " template=" + template + " locality=" + locality + " enable=" + csm._enable
+ " " + this);
if (csm._enable && csm._missCount != null)
csm._missCount.increment();
return;
}
|
java
|
public void onEntryCreation(String template, int source) {
final String methodName = "onEntryCreation()";
CacheStatsModule csm = null;
if ((csm = getCSM(template)) == null) {
return;
}
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + " cacheName=" + _sCacheName + " template=" + template + " source=" + source + " enable=" + csm._enable + " "
+ this);
if (csm._enable) {
if (source == REMOTE) {
if (csm._remoteCreationCount != null)
csm._remoteCreationCount.increment();
}
if (csm._inMemoryAndDiskCacheEntryCount != null)
csm._inMemoryAndDiskCacheEntryCount.increment();
}
return;
}
|
java
|
private static void applyElement(Annotated member, Schema property) {
final XmlElementWrapper wrapper = member.getAnnotation(XmlElementWrapper.class);
if (wrapper != null) {
final XML xml = getXml(property);
xml.setWrapped(true);
// No need to set the xml name if the name provided by xmlelementwrapper annotation is ##default or equal to the property name | https://github.com/swagger-api/swagger-core/pull/2050
if (!"##default".equals(wrapper.name()) && !wrapper.name().isEmpty() && !wrapper.name().equals(((SchemaImpl) property).getName())) {
xml.setName(wrapper.name());
}
} else {
final XmlElement element = member.getAnnotation(XmlElement.class);
if (element != null) {
setName(element.namespace(), element.name(), property);
}
}
}
|
java
|
private static void applyAttribute(Annotated member, Schema property) {
final XmlAttribute attribute = member.getAnnotation(XmlAttribute.class);
if (attribute != null) {
final XML xml = getXml(property);
xml.setAttribute(true);
setName(attribute.namespace(), attribute.name(), property);
}
}
|
java
|
private static boolean setName(String ns, String name, Schema property) {
boolean apply = false;
final String cleanName = StringUtils.trimToNull(name);
final String useName;
if (!isEmpty(cleanName) && !cleanName.equals(((SchemaImpl) property).getName())) {
useName = cleanName;
apply = true;
} else {
useName = null;
}
final String cleanNS = StringUtils.trimToNull(ns);
final String useNS;
if (!isEmpty(cleanNS)) {
useNS = cleanNS;
apply = true;
} else {
useNS = null;
}
// Set everything or nothing
if (apply) {
getXml(property).name(useName).namespace(useNS);
}
return apply;
}
|
java
|
private static boolean isAttributeAllowed(Schema property) {
if (property.getType() == SchemaType.ARRAY || property.getType() == SchemaType.OBJECT) {
return false;
}
if (!StringUtils.isBlank(property.getRef())) {
return false;
}
return true;
}
|
java
|
public static Attribute getInstance(
Object o)
{
if (o == null || o instanceof Attribute)
{
return (Attribute)o;
}
if (o instanceof ASN1Sequence)
{
return new Attribute((ASN1Sequence)o);
}
throw new IllegalArgumentException("unknown object in factory");
}
|
java
|
synchronized void unregister() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "unregister", this);
}
if (registration != null) {
registration.unregister();
registration = null;
}
}
|
java
|
@Override
public void printStackTrace(PrintWriter p) {
if (wrapped == null) {
p.println("none");
} else {
StackTraceElement[] stackElements = getStackTraceEliminatingDuplicateFrames();
// format and print
p.println(wrapped);
for (int i = 0; i < stackElements.length; i++) {
StackTraceElement stackTraceElement = stackElements[i];
final String toString = printStackTraceElement(stackTraceElement);
p.println("\t" + toString);
}
TruncatableThrowable cause = getCause();
// We know the cause will be truncatable, so not much extra work to do here
// There's a super-class method we could call, but it's private :(
if (cause != null) {
// Non-internationalised string in what we're trying to imitate
if (cause.isIntermediateCausesStripped()) {
p.print("Caused by (repeated) ... : ");
} else {
p.print(CAUSED_BY);
}
cause.printStackTrace(p);
}
}
}
|
java
|
public StackTraceElement[] getStackTraceEliminatingDuplicateFrames() {
// If this isn't a cause, there can't be any duplicate frames, so proceed no further
if (parentFrames == null) {
return getStackTrace();
}
if (noduplicatesStackTrace == null) {
List<StackTraceElement> list = new ArrayList<StackTraceElement>();
// Only put the comment saying there are other classes in the stack if there actually are,
// and if this isn't a 'cause' exception
StackTraceElement[] stackElements = getStackTrace();
// Now do a second trimming, if necessary, to eliminate any duplication in 'caused by' traces
int numberToInclude = countNonDuplicatedFrames(parentFrames, stackElements);
for (int i = 0; i < numberToInclude; i++) {
list.add(stackElements[i]);
}
// Only put the comment saying there are other classes in the stack if there actually are
boolean duplicateFramesRemoved = numberToInclude < stackElements.length;
if (duplicateFramesRemoved) {
// Use shonky eyecatchers since we can't subclass StackTraceElement
list.add(new StackTraceElement("... " + (stackElements.length - numberToInclude) + " more", DUPLICATE_FRAMES_EYECATCHER, null, 0));
}
noduplicatesStackTrace = list.toArray(new StackTraceElement[0]);
}
return noduplicatesStackTrace.clone();
}
|
java
|
public void record(CircuitBreakerStateImpl.CircuitBreakerResult result) {
boolean isFailure = (result == FAILURE);
if (resultCount < size) {
// Window is not yet full
resultCount++;
} else {
// Window is full, roll off the oldest result
boolean oldestResultIsFailure = results.get(nextResultIndex);
if (oldestResultIsFailure) {
failures--;
}
}
results.set(nextResultIndex, isFailure);
if (isFailure) {
failures++;
}
nextResultIndex++;
if (nextResultIndex >= size) {
nextResultIndex = 0;
}
}
|
java
|
protected MetadataViewKey deriveViewKey(FacesContext facesContext,
UIViewRoot root)
{
MetadataViewKey viewKey;
if (!facesContext.getResourceLibraryContracts().isEmpty())
{
String[] contracts = new String[facesContext.getResourceLibraryContracts().size()];
contracts = facesContext.getResourceLibraryContracts().toArray(contracts);
viewKey = new MetadataViewKeyImpl(root.getViewId(), root.getRenderKitId(), root.getLocale(), contracts);
}
else
{
viewKey = new MetadataViewKeyImpl(root.getViewId(), root.getRenderKitId(), root.getLocale());
}
return viewKey;
}
|
java
|
public void modified(List<String> newSources) {
if (collectorMgr == null || isInit == false) {
this.sourcesList = newSources;
return;
}
try {
//Old sources
ArrayList<String> oldSources = new ArrayList<String>(sourcesList);
//Sources to remove -> In Old Sources, the difference between oldSource and newSource
ArrayList<String> sourcesToRemove = new ArrayList<String>(oldSources);
sourcesToRemove.removeAll(newSources);
collectorMgr.unsubscribe(this, convertToSourceIDList(sourcesToRemove));
//Sources to Add -> In New Sources, the difference bewteen newSource and oldSource
ArrayList<String> sourcesToAdd = new ArrayList<String>(newSources);
sourcesToAdd.removeAll(oldSources);
collectorMgr.subscribe(this, convertToSourceIDList(sourcesToAdd));
sourcesList = newSources; //new master sourcesList
} catch (Exception e) {
e.printStackTrace();
}
}
|
java
|
public void writingState()
{
if (!this.writtenState)
{
this.writtenState = true;
this.writtenStateWithoutWrapper = false;
this.fast = new FastWriter(this.initialSize);
this.out = this.fast;
}
}
|
java
|
@Reference(name = "extensionProvider", service = ExtensionProvider.class, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE)
protected void registerExtensionProvider(ExtensionProvider provider) {
LibertyApplicationBusFactory.getInstance().registerExtensionProvider(provider);
}
|
java
|
@Trivial
private String dumpMap(Map<String, String[]> m) {
StringBuffer sb = new StringBuffer();
sb.append(" --- request parameters: ---\n");
Iterator<String> it = m.keySet().iterator();
while (it.hasNext()) {
String key = it.next();
String[] values = m.get(key);
sb.append(key + ": ");
for (String s : values) {
sb.append("[" + s + "] ");
}
sb.append("\n");
}
return sb.toString();
}
|
java
|
private void forwardMessage(AbstractMessage aMessage,
SIBUuid8 targetMEUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "forwardMessage",
new Object[]{aMessage, targetMEUuid});
if (TraceComponent.isAnyTracingEnabled() && UserTrace.tc_mt.isDebugEnabled() && !aMessage.isControlMessage())
{
JsMessage jsMsg = (JsMessage) aMessage;
JsDestinationAddress routingDestination = jsMsg.getRoutingDestination();
if(routingDestination != null)
{
String destId = routingDestination.getDestinationName();
boolean temporary = false;
if(destId.startsWith(SIMPConstants.TEMPORARY_PUBSUB_DESTINATION_PREFIX))
temporary = true;
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
destId,
temporary);
}
else
{
DestinationHandler dest =
_destinationManager.getDestinationInternal(aMessage.getGuaranteedTargetDestinationDefinitionUUID(), false);
if (dest != null)
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
dest.getName(),
dest.isTemporary());
else
UserTrace.forwardJSMessage(jsMsg,
targetMEUuid,
jsMsg.getGuaranteedTargetDestinationDefinitionUUID().toString(),
false);
}
}
// Send this to MPIO
_mpio.sendToMe( targetMEUuid,
aMessage.getPriority().intValue(),
aMessage );
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "forwardMessage");
}
|
java
|
private boolean attachAndLockMsg(SIMPMessage msgItem, boolean isOnItemStream)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"attachAndLockMsg",
new Object[] { msgItem, Boolean.valueOf(isOnItemStream), this });
// If we're attaching a message and we already have one something's gone really bad.
// It's too late to stop it so all we can do is issue an FFDC so that when they
// finally spot a message is stuck in locked state we can see why (although how we
// got here is still unknown).
if (_msgAttached)
{
String text = "Message already attached [";
if (_attachedMessage != null)
text = text + _attachedMessage.getMessage().getMessageHandle();
text = text + "," + msgItem.getMessage().getMessageHandle() + "]";
SIErrorException e = new SIErrorException(text);
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.attachAndLockMsg",
"1:1057:1.22.5.1",
this);
}
// If the message is in the Message Store we need to remember the MS ID
// of this message so that we can retrieve it by ID later
if (isOnItemStream)
{
// If the consumer is a forward scanning consumer then it has to
// use the MS cursor to find the message (this message may be behind
// the cursor) so we don't lock it here
if (_consumerSession.getForwardScanning())
{
_msgLocked = false; // We can't lock a message for a FS consumer
_msgAttached = true;
_msgOnItemStream = true; // But it is on the itemstream
_attachedMessage = null; // Let the consumer find the actual message
}
// Otherwise the consumer can go directly to the message
else
{
// Determine which cursor to use
LockingCursor cursor = _consumerKey.getGetCursor(msgItem);
// We need to lock the message here so that another consumer does
// not snatch it after we tell the CD that we'll take it, if it did
// it could potentially result in this consumer being unsatisfied
// even when there was a matching message available
try
{
_msgLocked = msgItem.lockItemIfAvailable(cursor.getLockID());
} catch (MessageStoreException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.attachAndLockMsg",
"1:1094:1.22.5.1",
this);
SibTr.exception(tc, e);
_msgLocked = false;
_msgAttached = true;
_msgOnItemStream = true;
_attachedMessage = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "attachAndLockMsg", e);
throw new SIResourceException(e);
}
if (_msgLocked)
{
_msgAttached = true;
_msgOnItemStream = true;
_attachedMessage = msgItem;
}
// If we fail to lock it then someone else must have got in there before
// us. But because we've already removed this consumer from the ready list
// we're going to have to follow through and wake up the consumer so that
// they go round the loop of making themselves ready, checking the queue
// for messages, and waiting. Otherwise we could miss a message that was
// put on the queue while we weren't ready.
else
{
// We set the strange combination of _msgAttached and _msgOnItemStream
// (but not _msgLocked) so that we force the consumer to check the queue
// for more messages before continueing (see getAttachedMessage).
_msgAttached = true;
_msgOnItemStream = true;
_attachedMessage = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Missed the message!");
}
}
}
// We locked the message (if it was never on the itemStream we've sort of
// locked it by default).
else
{
_msgLocked = false;
_msgAttached = true;
_msgOnItemStream = false;
_attachedMessage = msgItem;
}
// If we are a member of a key group we must make the group aware that a
// message has been attached to one of its members
if (_msgAttached && (_keyGroup != null))
_keyGroup.attachMessage(_consumerKey);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "attachAndLockMsg", Boolean.valueOf(_attachedMessage != null));
return (_attachedMessage != null);
}
|
java
|
SIMPMessage getAttachedMessage() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getAttachedMessage", this);
SIMPMessage msg = null;
//check if there really is a message attached
if (_msgAttached)
{
// If the message wasn't locked when it was attached (we are a forwardScanning
// consumer) we need to go and look for it now.
if (_msgOnItemStream && !_msgLocked)
{
// Attempt to lock the attached message on the itemstream
msg = getEligibleMsgLocked(null);
}
else
msg = _attachedMessage;
//show that there is no longer an attached message available
_msgAttached = false;
_msgLocked = false;
_attachedMessage = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getAttachedMessage", msg);
//simply return the attached message (if there is one)
return msg;
}
|
java
|
private boolean checkReceiveAllowed() throws SISessionUnavailableException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkReceiveAllowed");
boolean allowed = _destinationAttachedTo.isReceiveAllowed();
if (!allowed)
{
// Register that LCP stopped for Receive Allowed
_stoppedForReceiveAllowed = true;
// Stop LCP for Receive Allowed
if (!_stopped)
{
internalStop();
}
}
else
{
// Register that LCP not stopped for Receive Allowed
_stoppedForReceiveAllowed = false;
// Start LCP if no reason to be stopped
if ((_stopped)
&& (!_stoppedByRequest))
{
internalStart(false);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkReceiveAllowed", Boolean.valueOf(allowed));
return allowed;
}
|
java
|
private void checkReceiveState()
throws SIIncorrectCallException, SISessionUnavailableException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkReceiveState");
// Only valid if the consumer session is still open
checkNotClosed();
//if there is an AsynchConsumerCallback registered, throw an exception
if (_asynchConsumerRegistered)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkReceiveState", "asynchConsumerRegistered == true ");
throw new SIIncorrectCallException(
nls.getFormattedMessage(
"RECEIVE_USAGE_ERROR_CWSIP0171",
new Object[] { _consumerDispatcher.getDestination().getName(),
_messageProcessor.getMessagingEngineName() },
null));
}
// If we already have the waiting bit set it implies another
// thread is sat waiting in a receive for this consumer (we release
// the consumer lock while waiting so this is possible).
else if (_waiting)
{
SIIncorrectCallException e =
new SIIncorrectCallException(
nls.getFormattedMessage(
"RECEIVE_USAGE_ERROR_CWSIP0178",
new Object[] { _consumerDispatcher.getDestination().getName(),
_messageProcessor.getMessagingEngineName() },
null));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkReceiveState", "receive already in progress");
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkReceiveState");
}
|
java
|
private SIMPMessage getEligibleMsgLocked(TransactionCommon tranImpl) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getEligibleMsgLocked", new Object[] { this, tranImpl });
/*
* 166829.1 Support for noLocal delivery
*
* If we are pubsub and noLocal has been specified we should not deliver the message
* to this consumer if it was published on the same connection. We cannot do this at
* fanout stage since we do not know the current connection until delivery time.
*
* On delivery we need to iterate through the itemstream until we find an eligible
* message (i.e. not from this connection). For each message that does not comply, we
* mark it for deletion. If we find a message, we deliver and delete the marked messages
* under the given transaction.
* If we do not find a message, we create a transaction and delete all the marked messages.
*/
SIMPMessage msg = null;
// Before we try to lock a message we need to know that this consumer or its
// ConsumerSet will allow it (they haven't reached their maxActiveMessage limits).
// If they will accept it we have to, in th case of a ConsumerSet, 'reserve' the
// space upfront because multiple members of the set could be concurrently adding
// active messages. If this add happens to take the last available slot in the set's
// quota it will keep the set write-locked for the duration of the message lookup. During
// this time no other consumers in the set will be able to add any more messages.
// This is done to ensure that the set's suspend/resume state is consistent and we don't
// have to un-suspend consumers when we find there isn't a message on the queue
// after all.
boolean msgAccepted = prepareAddActiveMessage();
if (!msgAccepted)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "The consumer (or its set) is currently maxed out");
}
else
{
// We do the following in a try so that we're guaranteed to release any activeMessage
// lock that we may hold (in JSConsumerSet.addActiveMessage())
try
{
// Retrieve the next message on the itemstream
msg = retrieveMsgLocked();
// If noLocal is set, then we check if this message came from the same connection.
// If so, we mark it for deletion.
if (msg != null && _consumerDispatcher.getConsumerDispatcherState().isNoLocal())
{
LinkedList<SIMPMessage> markedForDeletion = new LinkedList<SIMPMessage>();
int msgCount = 0;
while (msg != null && _connectionUuid.equals(msg.getProducerConnectionUuid()))
{
markedForDeletion.add(msg);
msgCount++;
if (msgCount >= NO_LOCAL_BATCH_SIZE)
{
removeUnwantedMsgs(markedForDeletion, null);
markedForDeletion.clear();
msgCount = 0;
}
// If we weren't looking for a particular message then we can just lock the
// next available one.
msg = retrieveMsgLocked();
}
// If any messages were marked for deletion, then delete them.
if (!markedForDeletion.isEmpty())
{
//If we reached the end of the itemstream (and therefore have a null message) then
//we need to create our own transaction under which to delete the marked messages. If
//not, we have a message and we deliver and delete under the given transaction.
TransactionCommon tran = null;
if (tranImpl != null && msg != null)
tran = tranImpl;
removeUnwantedMsgs(markedForDeletion, tran);
}
}
} finally
{
// If a message was locked we commit the adding of it to the maxActiveMessage
// quotas
if (msg != null)
commitAddActiveMessage();
// If no message was there then we rollback the prepared add that we did above.
else
rollbackAddActiveMessage();
}
} // msgAccepted
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getEligibleMsgLocked", msg);
return msg;
}
|
java
|
protected void waitingNotify()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "waitingNotify");
this.lock();
try
{
if (_waiting)
_waiter.signal();
} finally
{
this.unlock();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "waitingNotify");
}
|
java
|
private SIMPMessage retrieveMsgLocked() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "retrieveMsgLocked", new Object[] { this });
SIMPMessage msg = null;
// Look in the Cd's ItenStream for the next available message
try
{
msg = _consumerKey.getMessageLocked();
if (msg != null)
msg.eventLocked();
} catch (MessageStoreException e)
{
// MessageStoreException shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.retrieveMsgLocked",
"1:2101:1.22.5.1",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint",
"1:2108:1.22.5.1",
SIMPUtils.getStackTrace(e) });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveMsgLocked", e);
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint",
"1:2119:1.22.5.1",
e },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveMsgLocked", msg);
//return the locked message
return msg;
}
|
java
|
private void checkParams(int maxActiveMessages,
long messageLockExpiry,
int maxBatchSize)
throws SIIncorrectCallException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkParams",
new Object[] {
Integer.valueOf(maxActiveMessages),
Long.valueOf(messageLockExpiry),
Integer.valueOf(maxBatchSize) });
if (maxActiveMessages < 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkParams", "SIIncorrectCallException maxActiveMessages < 0");
throw new SIIncorrectCallException(
nls_cwsir.getFormattedMessage(
"REG_ASYNCH_CONSUMER_ERROR_CWSIR0141",
new Object[] { Integer.valueOf(maxActiveMessages) },
null));
}
if (messageLockExpiry < 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkParams", "SIIncorrectCallException messageLockExpiry < 0");
throw new SIIncorrectCallException(
nls_cwsir.getFormattedMessage(
"REG_ASYNCH_CONSUMER_ERROR_CWSIR0142",
new Object[] { Long.valueOf(messageLockExpiry) },
null));
}
if (maxBatchSize <= 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkParams", "SIIncorrectCallException maxBatchSize <= 0");
throw new SIIncorrectCallException(
nls_cwsir.getFormattedMessage(
"REG_ASYNCH_CONSUMER_ERROR_CWSIR0143",
new Object[] { Integer.valueOf(maxBatchSize) },
null));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkParams");
}
|
java
|
boolean processAttachedMsgs() throws SIResourceException, SISessionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "processAttachedMsgs", this);
SIMPMessage msg = null;
// Check if there is a message attached to this consumer, we synchronize to make sure we
// pick up the current settings and not something from our memory cache (we also do this
// before we check the keyGroup as that is also changed under this lock)
this.lock();
try
{
msg = getAttachedMessage();
} finally
{
this.unlock();
}
// If we're a member of a group there may be a message attached to one of
// the members other than us
if (_keyGroup != null)
{
ConsumableKey attachedKey = _keyGroup.getAttachedMember();
// Another member of the group has a message attached for it so let
// them process it.
if ((attachedKey != null) && (attachedKey != _consumerKey))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processAttachedMsgs");
return ((JSLocalConsumerPoint) attachedKey.getConsumerPoint()).processAttachedMsgs();
}
}
//if we actually have a message attached, process it
if (msg != null)
{
// Is it a MessageItem or an ItemReference?
// Or bifurcatable: We can't do this if it's bifurcatable because the
// bifurcated consumers need to be able to call readSet() on the LME and
// get the message back, so we HAVE to add it to the real LME rather than
// the SingleLockedMessageEnumeration.
if (!_msgOnItemStream && !_bifurcatable)
{
// As the message never got to the MS we won't get a callback to
// generate a COD from, instead we generate one now using the
// autoCommitTransaction
if (!msg.isItemReference() && msg.getReportCOD() != null)
{
((MessageItem) msg).beforeCompletion(_autoCommitTransaction);
}
//if it is not on an itemStream then it is a single attached message.
//This means that it's not locked in the traditional msgStore sense but
//we can handle it as if it were because we should be the only ones to
//have a reference to it at the moment.
// Have to turn this into a LockedMessageEnumeration
// Use single unlocked Message version of LME
// We used the cached one if we have it
if (_singleLockedMessageEnum != null)
_singleLockedMessageEnum.newMessage(msg);
else
_singleLockedMessageEnum = new SingleLockedMessageEnumerationImpl(this, msg);
//initiate the callback via the AsynchConsumer wrapper
_asynchConsumer.processMsgs(_singleLockedMessageEnum, _consumerSession);
// Now that we've processed the message remove it from our active message
// count (if we're counting). We know we can always do it here because there's no
// chance of the consumer holding onto the message past exiting consumeMessages()
// as it's an unrecoverable message.
removeActiveMessages(1);
// Clear the message from the cached enum
_singleLockedMessageEnum.clearMessage();
}
else
{
// Do we really need this message in the MS?
boolean isRecoverable = true;
if ((_unrecoverableOptions != Reliability.NONE) &&
(msg.getReliability().compareTo(_unrecoverableOptions) <= 0))
isRecoverable = false;
registerForEvents(msg);
//store a reference to the locked message in the LME
_allLockedMessages.addNewMessage(msg, _msgOnItemStream, isRecoverable);
//initiate the callback via the AsynchConsumer wrapper
_asynchConsumer.processMsgs(_allLockedMessages, _consumerSession);
_allLockedMessages.resetCallbackCursor();
}
// Now we've processed one message we better check to see if there is
// someone waiting for the asynch lock
if (_externalConsumerLock != null)
_interruptConsumer = _externalConsumerLock.isLockYieldRequested();
//a message was delivered, return true
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processAttachedMsgs", Boolean.TRUE);
return true;
}
// no message was delivered, return false
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processAttachedMsgs", Boolean.FALSE);
return false;
}
|
java
|
void runAsynchConsumer(boolean isolatedRun) throws SIResourceException, SISessionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "runAsynchConsumer", new Object[] { this, Boolean.valueOf(isolatedRun) });
JSLocalConsumerPoint nextConsumer = this;
boolean firstTimeRound = true;
// We continue processing messages until we're told not to (we, or a
// member of our group stops) or we run out of messages on our queue.
// Each time round we drop the async lock
do // while(nextConsumer != null)
{
// If we've been asked to yield, we yield
if (_interruptConsumer)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "External yield requested");
Thread.yield();
// We would expect to be stopped by the interrupting thread
if (!_stopped)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Yield appears to have been ignored");
}
}
synchronized (_asynchConsumerBusyLock)
{
// Another runAsynchConsumer thread could get kicked off in parallel due to a suspended
// active-message consumer being resumed or maybe a message being attached by
// the ConsumerDispatcher.
// As we release and re-take the asynch lock each time round we need to keep
// a track of who was here first and let them continue, killing off any threads
// that come in halfway through.
if (!_runningAsynchConsumer || (!firstTimeRound && _runningAsynchConsumer))
{
// check to see if we still want to do this, if we dropped the lock it's possible
// someone else came in and stopped/closed us. In which case, they'll still be waiting
// for us to come back to them to say we've finished. So we need to notify them
// on our way out
if ((_stopped && !(isolatedRun))
|| (!_stopped && isolatedRun) // We have to be stopped while in an isolated run
|| _closed
|| !_asynchConsumerRegistered)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "We've been interferred with: " + _stopped + ", " + _closed + ", " + _asynchConsumerRegistered);
// Obviously not, so bomb out...
nextConsumer = null;
_runningAsynchConsumer = false;
}
else
{
if (firstTimeRound)
{
firstTimeRound = false;
//process any messages which are already attached to this LCP
boolean msgDelivered = processAttachedMsgs();
//Process any msgs that built up while we were busy
//but not if this was an isolatedRun and we already delivered a message
if (!(msgDelivered && isolatedRun))
{
nextConsumer = processQueuedMsgs(isolatedRun);
}
}
if (!isolatedRun && (nextConsumer != null))
{
// Every time we transfer a message to a different member of the keyGroup
// (the last message matched someone else's selector) we have to re-run
// processQueuedmsgs() to make sure nothing is left on the queue after
// processing
nextConsumer = nextConsumer.processQueuedMsgs(isolatedRun);
}
// Indicate that this consumer is about to go round again
if (nextConsumer != null)
_runningAsynchConsumer = true;
else
_runningAsynchConsumer = false;
}
// If we're on our way out and we were interupted by another thread then we need
// to wake them up on our way out as they may be waiting for us to finish.
if (!_runningAsynchConsumer && _runAsynchConsumerInterupted)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "We've been told to stop, wake up whoever asked us");
_runAsynchConsumerInterupted = false;
_asynchConsumerBusyLock.notifyAll();
}
}
else
nextConsumer = null;
} // synchronized
} while (nextConsumer != null);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "runAsynchConsumer");
}
|
java
|
@Override
public void close() throws SIResourceException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "close", this);
// On closing, we need to run the async consumer a final time to process
// any messages it has attached.
//
// We need to take the async consumer lock so we don't step on a currently
// running consumer (so that running asyncs can complete with all their
// resources available - i.e. without object closed exceptions - as per the
// JMS 1.1 spec).
//
// Taking this lock also prevents other invocations of close which take
// place before this invocation has completed from proceeding (as per the
// JMS 1.1 spec).
//
// We also taken the consumer session lock for most of the method. In
// theory, we could release this lock while running the async consumer,
// but this makes things a little more complicated and there seems little
// point when we're closing down anyway.
//
// The async consumer could concievably spin forever and prevent the close.
// This is an accepted fact.
// We need to get any asynch thread to stop looping round the queue to
// allow us to have a chance of closing this consumer. We have to do this outside
// of the asynch lock as that will be held by the other thread at this time.
_interruptConsumer = true;
synchronized (_asynchConsumerBusyLock)
{
if (_closed || _closing)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "close", "Already Closed");
return;
}
_lockRequested = true;
// Lock the KeyGroup if we have one before we lock this consumer
if (_keyGroup != null)
_keyGroup.lock();
try
{
this.lock();
try
{
_lockRequested = false;
_consumerKey.stop();
// We don't want new messages to be attached if we're closing.
unsetReady();
// We need to release the LCP lock while we process attached messages
// but first we mark the consumer as closing to stop other calls succeeding
_closing = true;
} finally
{
this.unlock();
}
} finally
{
if (_keyGroup != null)
_keyGroup.unlock();
}
// Process any attached messages already on the async consumer.
if (_asynchConsumerRegistered)
{
// If we reach here and an async consumer is running, close() must
// have been called from the async consumer callback as we have been
// able to acquire the asynchConsumer lock.
//
// Therefore, do not erroneously recursively invoke the callback.
if (!_asynchConsumer.isAsynchConsumerRunning())
{
try
{
processAttachedMsgs();
} catch (SISessionDroppedException e)
{
//No FFDC code needed
//essentially the session is already closed but we'll try to carry
//cleaning up
}
}
// If we are a member of an ordering group then we need to leave it
// before we close
if (_keyGroup != null)
{
_consumerKey.leaveKeyGroup();
_keyGroup = null;
}
}
//Now take the lock back and unlock any locked messages and kick out
// any waiting receiver
this.lock();
try
{
synchronized (_allLockedMessages)
{
try
{
// Unlock any remaining locked messages
_allLockedMessages.unlockAll();
} catch (SIMPMessageNotLockedException e)
{
// No FFDC code needed
// This exception has occurred beause someone has deleted the
// message(s). Ignore this exception as it is unlocked anyway
} catch (SISessionDroppedException e)
{
//No FFDC code needed
//essentially the session is already closed but we'll try to carry
//cleaning up
}
// Mark this consumer session (point) as closed
_closed = true;
}
// If we have a synchronous receive we need to wake it up
if (_waiting)
{
_waiter.signal();
}
} // synchronized(this)
finally
{
this.unlock();
}
_interruptConsumer = false;
// If we've managed to interupt another thread that's currently checking for messages
// to give to a consumer (runAsynchConsumer) then we need to wait until they realise
// that we've interupted them before we return. Otherwise we'll have a dangling thread
// that's technically 'working', even though the consumer is closed
if (_runningAsynchConsumer && !_asynchConsumer.isAsynchConsumerRunning())
{
_runAsynchConsumerInterupted = true;
try
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Waiting for runAsynchConsumer to complete");
_asynchConsumerBusyLock.wait();
} catch (InterruptedException e)
{
// No FFDC code needed
}
}
} // synchronized(asynch)
// Now we no longer hold a lock, unlock any messages we happen
// to have hidden for this consumer (SIB0115)
unlockAllHiddenMessages();
//detach from the CD - we CANNOT hold any consumer locks at this point!
_consumerKey.detach();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "close");
}
|
java
|
public boolean isClosed()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "isClosed", this);
SibTr.exit(tc, "isClosed", Boolean.valueOf(_closed));
}
return _closed;
}
|
java
|
@Override
public void start(boolean deliverImmediately) throws SISessionUnavailableException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "start", new Object[] {
Boolean.valueOf(deliverImmediately), this });
// Register that LCP has been stopped by a request to stop
_stoppedByRequest = false;
// Run the private method
internalStart(deliverImmediately);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "start");
}
|
java
|
@Override
public void checkForMessages()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkForMessages", this);
try
{
//start a new thread to run the callback
_messageProcessor.startNewThread(new AsynchThread(this, false));
} catch (InterruptedException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.checkForMessages",
"1:3881:1.22.5.1",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkForMessages", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkForMessages");
}
|
java
|
@Override
public void unlockAll() throws SISessionUnavailableException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "unlockAll", this);
synchronized (_asynchConsumerBusyLock)
{
this.lock();
try
{
// Only valid if the consumer session is still open
checkNotClosed();
try
{
// Unlock the messages (take this lock to ensure we don't have a problem
// getting it if we need it to re-deliver the unlocked messages to ourselves)
_allLockedMessages.unlockAll();
} catch (SIMPMessageNotLockedException e)
{
// No FFDC code needed
// This exception has occurred beause someone has deleted the
// message(s). Ignore this exception as it is unlocked anyway
}
} finally
{
this.unlock();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unlockAll");
}
|
java
|
private void setBaseRecoverability(Reliability unrecoverableReliability)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setBaseRecoverability", new Object[] { this, unrecoverableReliability });
setUnrecoverability(unrecoverableReliability);
_baseUnrecoverableOptions = _unrecoverableOptions;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setBaseRecoverability");
}
|
java
|
private void resetBaseUnrecoverability()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "resetBaseUnrecoverability", this);
_unrecoverableOptions = _baseUnrecoverableOptions;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "resetBaseUnrecoverability");
}
|
java
|
private void setReady() throws SINotPossibleInCurrentConfigurationException
{
// If we're not transacted no messages are recoverable
Reliability unrecoverable = Reliability.ASSURED_PERSISTENT;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setReady", this);
// If the consumer is transacted inform the CD what
// recoverability is required.
if (_transacted)
unrecoverable = _unrecoverableOptions;
//set the ready state
_ready = true;
if (_keyGroup != null)
_keyGroup.groupReady();
//and inform the consumerDispatcher that we are ready
_consumerKey.ready(unrecoverable);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setReady");
}
|
java
|
protected void unsetReady()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "unsetReady", this);
//set the ready state
_ready = false;
if (_keyGroup != null)
_keyGroup.groupNotReady();
// if consumerKey is null then it can't be already in ready state!
if (_consumerKey != null)
{
//tell the consumerDispatcher that we are no longer ready
_consumerKey.notReady();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "unsetReady");
}
|
java
|
protected TransactionCommon getAutoCommitTransaction()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getAutoCommitTransaction", this);
}
TransactionCommon tran =
_messageProcessor.getTXManager().createAutoCommitTransaction();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exit(tc, "getAutoCommitTransaction", tran);
}
return tran;
}
|
java
|
public int getMaxActiveMessages()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getMaxActiveMessages");
SibTr.exit(tc, "getMaxActiveMessages", Integer.valueOf(_maxActiveMessages));
}
return _maxActiveMessages;
}
|
java
|
@Override
public void setMaxActiveMessages(int maxActiveMessages)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setMaxActiveMessages", Integer.valueOf(maxActiveMessages));
synchronized (_asynchConsumerBusyLock)
{
this.lock();
try
{
synchronized (_maxActiveMessageLock)
{
// If the new value is > previous value and
// check if consumer is suspended and resume consumer.
// But only do this if the message count is less than the curent active count
if (maxActiveMessages > _maxActiveMessages && maxActiveMessages < _currentActiveMessages)
{
// If the consumer was suspended - reenable it
if (_consumerSuspended)
{
// If this is part of an asynch callback we don't need to try and kick
// off a new thread as the nextLocked will return us another message on
// exit of the consumeMessages() method.
if (_runningAsynchConsumer)
{
_consumerSuspended = false;
_suspendFlags &= ~DispatchableConsumerPoint.SUSPEND_FLAG_ACTIVE_MSGS;
}
// Otherwise perform a full resume
else
{
resumeConsumer(DispatchableConsumerPoint.SUSPEND_FLAG_ACTIVE_MSGS);
}
}
}
else if (maxActiveMessages <= _currentActiveMessages && !_consumerSuspended)
{
// If the maxActiveMessages has been set to something lower than the current active message
// count, then suspend the consumer until the messages have been processed
_consumerSuspended = true;
_suspendFlags |= DispatchableConsumerPoint.SUSPEND_FLAG_ACTIVE_MSGS;
}
_maxActiveMessages = maxActiveMessages;
} // active message lock
} // this lock
finally
{
this.unlock();
}
} // async lock
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setMaxActiveMessages");
}
|
java
|
public boolean contextInfoRequired(String eventType, long requestNumber) {
boolean needContextInfo = false;
List<ProbeExtension> probeExtnList = RequestProbeService
.getProbeExtensions();
for (int i = 0; i < probeExtnList.size(); i++) {
ProbeExtension probeExtension = probeExtnList.get(i);
if (requestNumber % probeExtension.getRequestSampleRate() == 0) {
if (probeExtension.getContextInfoRequirement() == ContextInfoRequirement.ALL_EVENTS) {
needContextInfo = true;
break;
} else if (probeExtension.getContextInfoRequirement() == ContextInfoRequirement.EVENTS_MATCHING_SPECIFIED_EVENT_TYPES
&& (probeExtension.invokeForEventTypes() == null || probeExtension
.invokeForEventTypes().contains(eventType))) {
needContextInfo = true;
break;
}
}
}
return needContextInfo;
}
|
java
|
public static RequestProbeTransformDescriptor getObjForInstrumentation(
String key) {
RequestProbeTransformDescriptor requestProbeTransformDescriptor = RequestProbeBCIManagerImpl
.getRequestProbeTransformDescriptors().get(key);
return requestProbeTransformDescriptor;
}
|
java
|
boolean addHandle (SIMessageHandle handle,
Map ctxInfo,
final boolean canBeDeleted) {
final String methodName = "addHandle";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object [] { handle, ctxInfo, canBeDeleted });
}
boolean addedToThisToken = false;
if (_messageHandles.isEmpty())
{
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(TRACE, "No existing message handles - using current message as template <ctxInfo="
+ ctxInfo + "> <canBeDeleted=" + canBeDeleted + "> <handle= " + handle + ">");
}
_messageHandles.add (handle);
_contextInfo = ctxInfo;
_deleteMessagesWhenRead = canBeDeleted;
// Work out once whether this map is default size so we can optimize
// the matches method later on.
_contextInfoContainsDefaultEntries = (_contextInfo.size() == 2 //&&
//lohith liberty change
// _contextInfo.containsKey(WlmClassifierConstants.CONTEXT_MAP_KEY) &&
/* _contextInfo.containsKey(ExitPointConstants.TYPE_NAME)*/);
addedToThisToken = true;
} else {
if (matches (ctxInfo, canBeDeleted)) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(TRACE, "Message matched token for supplied handle - adding handle to the token <handle=" + handle + ">");
}
_messageHandles.add (handle);
addedToThisToken = true;
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName, addedToThisToken);
}
return addedToThisToken;
}
|
java
|
boolean matches (Map ctxInfo, boolean canBeDeleted)
{
final String methodName = "matches";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object [] { ctxInfo, canBeDeleted });
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(TRACE, "Attempting to match againgst token <context=" + _contextInfo +
"> <isBENP=" + _deleteMessagesWhenRead);
}
boolean doesMatch = false;
// For the message to match the token the following must be true:
//
// * They must have the same BENP flag
// * Both context maps must be of the same length
// * They must be of size two.
// * The values must be for the WLM Classifier and the MDB Type.
// * The WLM classifiers must be equal in both maps.
//
// If all of these are true then we can batch and matches returns true.
//
// The value of the MDB type can be ignored as it is guaranteed to be the
// same for any one MDB.
//
// If we have more than two items in the map then it contains other context
// information - this other information may effect whether or not the messages
// can be batched so we do not batch them.
if (canBeDeleted == _deleteMessagesWhenRead &&
_contextInfoContainsDefaultEntries &&
(ctxInfo.size () == _contextInfo.size ())// &&
// ctxInfo.containsKey(WlmClassifierConstants.CONTEXT_MAP_KEY) &&
/*ctxInfo.containsKey(ExitPointConstants.TYPE_NAME)*/)
{
//lohith liberty change
/* Object WLMClassifier1 = _contextInfo.get(WlmClassifierConstants.CONTEXT_MAP_KEY);
Object WLMClassifier2 = ctxInfo.get(WlmClassifierConstants.CONTEXT_MAP_KEY);*/
// doesMatch = (WLMClassifier1 != null) && (WLMClassifier1.equals (WLMClassifier2));
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName, doesMatch);
}
return doesMatch;
}
|
java
|
private void updateBufferManager(Map<String, Object> properties) {
if (properties.isEmpty()) {
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Ignoring runtime changes to WSBB config; " + properties);
}
// TODO: should be able to flip leak detection on or off
}
|
java
|
private synchronized static void initConfigs() {
for (int i = 0; i < moduleIDs.length; i++) {
// add module configs one by one
//addModuleInfo(moduleIDs[i] + modulePrefix);
// don't do validation since in pre-defined module
getConfigFromXMLFile(getXmlFileName(modulePrefix + moduleIDs[i]), true, false);
}
}
|
java
|
public static PmiModuleConfig getConfig(String moduleID) {
if (moduleID == null)
return null;
PmiModuleConfig config = (PmiModuleConfig) moduleConfigs.get(moduleID);
if (config == null) {
// beanModule and com.ibm.websphere.pmi.xml.beanModule will work
// if moduleID doesn't have a '.' then use pre-defined modulePrefix
int hasDot = moduleID.indexOf('.');
if (hasDot == -1) {
// not found in moduleConfigs; try as a pre-defined module
// prepend com.ibm.websphere.pmi.xml. to moduleID
String preDefinedMod = DEFAULT_MODULE_PREFIX + moduleID;
config = getConfigFromXMLFile(getXmlFileName(preDefinedMod), true, false);
}
}
if (config == null) {
// input moduleID has '.' in it. use as it is
// do validation since its NOT pre-defined module
config = getConfigFromXMLFile(getXmlFileName(moduleID), true, true);
}
return config;
}
|
java
|
public static PmiModuleConfig findConfig(PmiModuleConfig[] configs, String moduleID) {
if (moduleID == null)
return null;
for (int i = 0; i < configs.length; i++) {
if (configs[i].getUID().equals(moduleID)) // VELA
//configs[i].getShortName().equals(moduleID))
return configs[i];
}
return null;
}
|
java
|
public synchronized static PmiModuleConfig getConfigFromXMLFile(String xmlFilePath, boolean bFromCache, boolean bValidate) {
//System.out.println ("[PerfModules] getConfigFromXMLFile(): " +xmlFilePath);
PmiModuleConfig config = null;
// if xmlFilePath = /com/ibm/websphere/pmi/customMod.xml
// the moduleName/ID = customMod
// Check in HashMap only if "bFromCache" is true
// Otherwise, create a new instance of PmiModuleConfig - used in StatsImpl
// to return the translated static info
// VELA: PmiModuleConfig is cached with UID and not the shortName
String modUID = getModuleUID(xmlFilePath);
//System.out.println("### ModUID="+modUID);
config = (PmiModuleConfig) moduleConfigs.get(modUID);
//System.out.println("### config="+config);
if (bFromCache) {
// PmiModuleConfig is cached with moduleID (last part of the xml file name) as key.
// This ASSUMES that moduleID is same as the XML file name
// If moduleID and xml file names are different then XML will be parsed and loaded each time
// NOTE:Module Name *MUST* be unique!
/*
* File f = new File (xmlFilePath);
* String fileName = f.getName();
* int dotLoc = fileName.lastIndexOf(".");
* if (dotLoc != -1)
* {
* String modName = fileName.substring (0, dotLoc-1);
* config = (PmiModuleConfig)moduleConfigs.get (modName);
*
* if(config != null)
* {
* return config;
* }
* }
*/
if (config != null) {
return config;
}
} else {
// FIXED: When bFromCache = false and create a copy of the PmiModuleConfig instead of parsing the XML file again
// added copy () to PmiModuleConfig and PmiDataInfo
if (config != null) {
return config.copy();
}
}
//System.out.println("#### not found in cache");
// Not found in cache. Try StatsTemplateLookup before loading from disk.
if (bEnableStatsTemplateLookup) {
int lookupCount = lookupList.size();
for (int i = 0; i < lookupCount; i++) {
config = ((StatsTemplateLookup) lookupList.get(i)).getTemplate(modUID);
if (config != null)
break;
else {
// may be pre-defined. cut "com.ibm.websphere.pmi.xml." - 26 chars
if (modUID.startsWith(DEFAULT_MODULE_PREFIX)) {
config = ((StatsTemplateLookup) lookupList.get(i)).getTemplate(modUID.substring(26));
if (config != null)
break;
}
}
}
if (config != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "StatsTemplateLookup available for: " + xmlFilePath);
config.setMbeanType("");
moduleConfigs.put(config.getUID(), config);
if (!bFromCache)
return config.copy();
else
return config;
} else {
//System.out.println("---1 StatsTemplateLookup NOT available for: " + xmlFilePath );
if (tc.isDebugEnabled())
Tr.debug(tc, "StatsTemplateLookup NOT available for: " + xmlFilePath);
}
}
//System.out.println("StatsTemplateLookup NOT available for: " + xmlFilePath );
// Not found in hard-coded lookup class. Load file from disk and parse it
// d175652: ------ security code
final String _xmlFile = xmlFilePath;
final boolean _bDTDValidation = bValidate;
parseException = null;
try {
//System.out.println("######## tryingt to get Config for "+_xmlFile);
config = (PmiModuleConfig)
AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
{
return parser.parse(_xmlFile, _bDTDValidation);
}
});
} catch (PrivilegedActionException e) {
parseException = e.getException();
}
// ------ security code
// Not in HashMap. Parse file
//config = parser.parse(xmlFilePath, bValidate); // validate with DTD
//System.out.println("######## Config ="+config);
if (config != null) {
if (bFromCache) {
// there is no mbean type defined in template for custom pmi template
// so set to none - to avoid PMI0006W in PmiJmxMapper
config.setMbeanType("");
//String moduleID = config.getShortName();
//moduleConfigs.put(moduleID, config);
// VELA: cache using UID as key "com.ibm.websphere.pmi.xml.beanModule"
moduleConfigs.put(config.getUID(), config);
if (tc.isDebugEnabled())
Tr.debug(tc, "Read PMI config for stats type: " + config.getUID());
return config;
} else
return config.copy();
} else {
return config; // null
}
}
|
java
|
public static String getDataName(String moduleName, int dataId) {
PmiModuleConfig config = PerfModules.getConfig(moduleName);
if (config == null)
return null;
PmiDataInfo info = config.getDataInfo(dataId);
if (info == null)
return null;
else
return info.getName();
}
|
java
|
public static int getDataId(String moduleName, String dataName) {
PmiModuleConfig config = PerfModules.getConfig(moduleName);
// attach module name to it - this has to be consistent with the PMI xml config files
// under com/ibm/websphere/pmi/xxModule.xml
if (dataName.indexOf('.') < 0)
dataName = moduleName + "." + dataName;
if (config != null)
return config.getDataId(dataName);
else
return -1;
}
|
java
|
public ConsumerDispatcherState getConsumerDispatcherState()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConsumerDispatcherState");
SibTr.exit(tc, "getConsumerDispatcherState", _subState);
}
return _subState;
}
|
java
|
private void deleteDurableSubscription(
boolean callProxyCode)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "deleteDurableSubscription",
new Object[] {
new Boolean(callProxyCode) });
HashMap durableSubsTable =
_destinationManager.getDurableSubscriptionsTable();
synchronized (durableSubsTable)
{
// Get the consumerDispatcher from the durable subscriptions table
ConsumerDispatcher consumerDispatcher =
(ConsumerDispatcher) durableSubsTable.get(
_subState.getSubscriberID());
//If entire topicspace has been deleted, the subscription will have already
//been removed.
if (consumerDispatcher != null)
{
// Check if the subscription from the durable subscriptions table is this
// subscription. Its possible that the topicspace this subscription was on
// was deleted and a new subscription with the same id has been added into
// the table
if (consumerDispatcher.dispatcherStateEquals(_subState))
{
// Remove consumerDispatcher from durable subscriptions table
durableSubsTable.remove(_subState.getSubscriberID());
// Delete consumerDispatcher ( implicit remove from matchspace)
try
{
// Don't need to send the proxy delete event message
// just need to reset the memory to the stat
consumerDispatcher.deleteConsumerDispatcher(
callProxyCode);
}
catch (SIException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.itemstreams.DurableSubscriptionItemStream.deleteDurableSubscription",
"1:626:1.95",
this);
SibTr.exception(tc, e);
// Could not delete consumer dispatcher
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deleteDurableSubscription", e);
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deleteDurableSubscription");
}
|
java
|
public static TraceComponent register(Class<?> aClass, String group) {
return register(aClass, group, null);
}
|
java
|
public static final void dump(TraceComponent tc, String msg, Object obj) {
if (obj != null && obj instanceof Object[]) {
com.ibm.websphere.ras.Tr.dump(tc, msg, (Object[]) obj);
} else {
com.ibm.websphere.ras.Tr.dump(tc, msg, obj);
}
}
|
java
|
public static final void entry(TraceComponent tc, String methodName, Object obj) {
if (obj != null && obj instanceof Object[]) {
com.ibm.websphere.ras.Tr.entry(tc, methodName, (Object[]) obj);
} else {
com.ibm.websphere.ras.Tr.entry(tc, methodName, obj);
}
}
|
java
|
public static final void error(TraceComponent tc, String msg) {
com.ibm.websphere.ras.Tr.error(tc, msg);
}
|
java
|
public static final void exit(TraceComponent tc, String methodName, Object obj) {
com.ibm.websphere.ras.Tr.exit(tc, methodName, obj);
}
|
java
|
public String getID() {
byte[] genBytes = new byte[this.outputSize];
synchronized (this.generator) {
this.generator.nextBytes(genBytes);
}
String id = convertSessionIdBytesToSessionId(genBytes, this.idLength);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getID: " + id);
}
return id;
}
|
java
|
public MatchResponse merge(MatchResponse matchResponse) {
if (matchResponse == null || matchResponse == this) {
return this;
} else {
boolean mergedSSLRequired = mergeSSLRequired(matchResponse.isSSLRequired());
boolean mergedAccessPrecluded = mergeAccessPrecluded(matchResponse.isAccessPrecluded());
List<String> mergedRoles = mergeRoles(matchResponse.getRoles(), mergedAccessPrecluded);
return new MatchResponse(mergedRoles, mergedSSLRequired, mergedAccessPrecluded);
}
}
|
java
|
protected boolean mergeSSLRequired(boolean otherSSLRequired) {
boolean mergedSSLRequired = false;
if (collectionMatch.isExactMatch()) {
mergedSSLRequired = sslRequired && otherSSLRequired;
} else if (collectionMatch.isPathMatch() || collectionMatch.isExtensionMatch()) {
mergedSSLRequired = sslRequired || otherSSLRequired;
}
return mergedSSLRequired;
}
|
java
|
private void _publishManagedBeanDestroyerListener(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
Map<String, Object> applicationMap = externalContext.getApplicationMap();
applicationMap.put(ManagedBeanDestroyerListener.APPLICATION_MAP_KEY, _detroyerListener);
}
|
java
|
public void setFacesInitializer(FacesInitializer facesInitializer) // TODO who uses this method?
{
if (_facesInitializer != null && _facesInitializer != facesInitializer && _servletContext != null)
{
_facesInitializer.destroyFaces(_servletContext);
}
_facesInitializer = facesInitializer;
if (_servletContext != null)
{
facesInitializer.initFaces(_servletContext);
}
}
|
java
|
private void dispatchInitializationEvent(ServletContextEvent event, int operation)
{
if (operation == FACES_INIT_PHASE_PREINIT)
{
if (!loadFacesInitPluginsJDK6())
{
loadFacesInitPluginsJDK5();
}
}
List<StartupListener> pluginEntries = (List<StartupListener>) _servletContext.getAttribute(FACES_INIT_PLUGINS);
if (pluginEntries == null)
{
return;
}
//now we process the plugins
for (StartupListener initializer : pluginEntries)
{
log.info("Processing plugin");
//for now the initializers have to be stateless to
//so that we do not have to enforce that the initializer
//must be serializable
switch (operation)
{
case FACES_INIT_PHASE_PREINIT:
initializer.preInit(event);
break;
case FACES_INIT_PHASE_POSTINIT:
initializer.postInit(event);
break;
case FACES_INIT_PHASE_PREDESTROY:
initializer.preDestroy(event);
break;
default:
initializer.postDestroy(event);
break;
}
}
log.info("Processing MyFaces plugins done");
}
|
java
|
public void unsetAsynchConsumer(boolean stoppable) //SIB0115d.comms
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIErrorException,
SIIncorrectCallException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unsetAsynchConsumer");
if (sessionId == 0)
{
// If the session Id = 0, then no one called setSessionId(). As such we are unable to flow
// to the server as we do not know which session to instruct the server to use.
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null)
);
FFDCFilter.processException(e, CLASS_NAME + ".unsetAsyncConsumer",
CommsConstants.CONVERSATIONHELPERIMPL_01, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e);
throw e;
}
CommsByteBuffer request = getCommsByteBuffer();
// Connection object id
request.putShort(connectionObjectId);
// Consumer session id
request.putShort(sessionId);
// Pass on call to server
CommsByteBuffer reply = null;
try
{
reply = jfapExchange(request,
(stoppable ? JFapChannelConstants.SEG_DEREGISTER_STOPPABLE_ASYNC_CONSUMER : JFapChannelConstants.SEG_DEREGISTER_ASYNC_CONSUMER), //SIB0115d.comms
JFapChannelConstants.PRIORITY_MEDIUM,
true);
}
catch (SIConnectionLostException e)
{
// No FFDC Code needed
// Converting this to a connection dropped as that is all we can throw
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Connection was lost", e);
throw new SIConnectionDroppedException(e.getMessage(), e);
}
// Confirm appropriate data returned
try
{
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_DEREGISTER_ASYNC_CONSUMER_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SISessionUnavailableException(reply, err);
checkFor_SISessionDroppedException(reply, err);
checkFor_SIConnectionUnavailableException(reply, err);
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIIncorrectCallException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unsetAsynchConsumer");
}
|
java
|
public void setAsynchConsumer(AsynchConsumerCallback consumer,
int maxActiveMessages,
long messageLockExpiry,
int maxBatchSize,
OrderingContext orderContext,
int maxSequentialFailures, //SIB0115d.comms
long hiddenMessageDelay,
boolean stoppable) //472879
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIErrorException,
SIIncorrectCallException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setAsynchConsumer",
new Object[]
{
consumer,
maxActiveMessages,
messageLockExpiry,
maxBatchSize,
orderContext,
maxSequentialFailures, //SIB0115d.comms
hiddenMessageDelay,
stoppable //472879
});
if (sessionId == 0)
{
// If the session Id = 0, then no one called setSessionId(). As such we are unable to flow
// to the server as we do not know which session to instruct the server to use.
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null)
);
FFDCFilter.processException(e, CLASS_NAME + ".setAsyncConsumer",
CommsConstants.CONVERSATIONHELPERIMPL_02, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Session Id was 0", e);
throw e;
}
CommsByteBuffer request = getCommsByteBuffer();
// Connection object id
request.putShort(connectionObjectId);
// Consumer session id
request.putShort(sessionId);
// Now put the message order context id if we have one
if (orderContext != null)
{
request.putShort(((OrderingContextProxy)orderContext).getId());
}
else
{
request.putShort(CommsConstants.NO_ORDER_CONTEXT);
}
// Client session id - this is the proxy queue ID
request.putShort(proxyQueueId);
// Max active messages
request.putInt(maxActiveMessages);
// Message lock expiry
request.putLong(messageLockExpiry);
// Max batch size
request.putInt(maxBatchSize);
// If callback is Stoppable then send maxSequentialFailures & hiddenMessageDelay then change the
// Segment Id to Stoppable SIB0115d.comms
int JFapSegmentId = JFapChannelConstants.SEG_REGISTER_ASYNC_CONSUMER; //SIB0115d.comms
if (stoppable) { //SIB0115d.comms,472879
request.putInt(maxSequentialFailures); //SIB0115d.comms
request.putLong(hiddenMessageDelay);
JFapSegmentId = JFapChannelConstants.SEG_REGISTER_STOPPABLE_ASYNC_CONSUMER; //SIB0115d.comms
} //SIB0115d.comms
CommsByteBuffer reply = null;
try
{
// Pass on call to server
reply = jfapExchange(request,
JFapSegmentId, //SIB0115d.comms
JFapChannelConstants.PRIORITY_MEDIUM,
true);
}
catch (SIConnectionLostException e)
{
// No FFDC Code needed
// Converting this to a connection dropped as that is all we can throw
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Connection was lost", e);
throw new SIConnectionDroppedException(e.getMessage(), e);
}
// Confirm appropriate data returned
try
{
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_REGISTER_ASYNC_CONSUMER_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SISessionUnavailableException(reply, err);
checkFor_SISessionDroppedException(reply, err);
checkFor_SIConnectionUnavailableException(reply, err);
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIIncorrectCallException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setAsynchConsumer");
}
|
java
|
public void exchangeStop()
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "exchangeStop");
if (sessionId == 0)
{
// If the session Id = 0, then no one called setSessionId(). As such we are unable to flow
// to the server as we do not know which session to instruct the server to use.
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null)
);
FFDCFilter.processException(e, CLASS_NAME + ".exchangeStop",
CommsConstants.CONVERSATIONHELPERIMPL_04, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e);
throw e;
}
CommsByteBuffer request = getCommsByteBuffer();
// Connection object id
request.putShort(connectionObjectId);
// Consumer session id
request.putShort(sessionId);
// Pass on call to server
final CommsByteBuffer reply = jfapExchange(request,
JFapChannelConstants.SEG_STOP_SESS,
JFapChannelConstants.PRIORITY_MEDIUM,
true);
// Confirm appropriate data returned
try
{
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_STOP_SESS_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SISessionUnavailableException(reply, err);
checkFor_SISessionDroppedException(reply, err);
checkFor_SIConnectionUnavailableException(reply, err);
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "exchangeStop");
}
|
java
|
public void deleteMessages(SIMessageHandle[] msgHandles,
SITransaction tran,
int priority)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "deleteMessages", new Object[]{msgHandles, tran, priority});
if (TraceComponent.isAnyTracingEnabled()) {
CommsLightTrace.traceMessageIds(tc, "DeleteMsgTrace", msgHandles);
}
if (sessionId == 0)
{
// If the session Id = 0, then no one called setSessionId(). As such we are unable to flow
// to the server as we do not know which session to instruct the server to use.
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null)
);
FFDCFilter.processException(e, CLASS_NAME + ".deleteMessages",
CommsConstants.CONVERSATIONHELPERIMPL_08, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e);
throw e;
}
if (msgHandles == null)
{
// Some null message id's are no good to us
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("NULL_MESSAGE_IDS_PASSED_IN_SICO1044", null, null)
);
FFDCFilter.processException(e, CLASS_NAME + ".deleteMessages",
CommsConstants.CONVERSATIONHELPERIMPL_09, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e);
throw e;
}
CommsByteBuffer request = getCommsByteBuffer();
// Connection object id
request.putShort(connectionObjectId);
// Consumer session id
request.putShort(sessionId);
// Transaction id
request.putSITransaction(tran);
// Number of msgIds sent
request.putSIMessageHandles(msgHandles);
// Pass on call to server - note that if we are transacted we only fire and forget.
// If not, we exchange.
if (tran == null)
{
final CommsByteBuffer reply = jfapExchange(request,
JFapChannelConstants.SEG_DELETE_SET,
priority,
true);
// Confirm appropriate data returned
try
{
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_DELETE_SET_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SISessionUnavailableException(reply, err);
checkFor_SISessionDroppedException(reply, err);
checkFor_SIConnectionUnavailableException(reply, err);
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SILimitExceededException(reply, err);
checkFor_SIIncorrectCallException(reply, err);
checkFor_SIMessageNotLockedException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
}
else
{
jfapSend(request,
JFapChannelConstants.SEG_DELETE_SET_NOREPLY,
priority,
true,
ThrottlingPolicy.BLOCK_THREAD);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "deleteMessages");
}
|
java
|
public void setSessionId(short sessionId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setSessionId", ""+sessionId);
if (this.sessionId == 0 && sessionId != 0)
{
this.sessionId = sessionId;
}
else
{
// If the session Id is being set twice this is badness. The conversation helper is
// associated one to one to a proxy queue, that in turn is associated one to one with a
// consumer session. They aren't re-used, so calling this twice indicates some bug.
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("SESSION_ID_HAS_ALREADY_BEEN_SET_SICO1045", null, null)
);
FFDCFilter.processException(e, CLASS_NAME + ".setSessionId",
CommsConstants.CONVERSATIONHELPERIMPL_11, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setSessionId");
}
|
java
|
public void get(Object rootVal,
MatchSpaceKey msg,
EvalCache cache,
Object contextValue,
SearchResults result)
throws MatchingException,BadMessageFormatMatchingException
{
if (tc.isEntryEnabled())
tc.entry(this,cclass, "get", new Object[]{rootVal,msg,cache,result});
if (result instanceof CacheingSearchResults)
((CacheingSearchResults) result).setMatcher(vacantChild);
vacantChild.get(null, msg, cache, contextValue, result);
if (tc.isEntryEnabled())
tc.exit(this,cclass, "get");
}
|
java
|
public ContentMatcher remove(Conjunction selector, MatchTarget object, InternTable subExpr, OrdinalPosition parentId)
throws MatchingException
{
if (tc.isEntryEnabled())
tc.entry(this,cclass, "remove","selector: "+selector+", object: "+object);
vacantChild = vacantChild.remove(selector, object, subExpr, ordinalPosition);
ContentMatcher result = this;
if (vacantChild == null)
result = null;
if (tc.isEntryEnabled())
tc.exit(this,cclass, "remove","result: " + result);
return result;
}
|
java
|
public int shrink()
{
byte[] old = buf;
if (pos == 0)
{
return 0; // nothing to do
}
int n = old.length - pos;
int m;
int p;
int s;
int l;
if (n < origsize)
{
buf = new byte[origsize];
p = pos;
s = origsize - n;
l = old.length - p;
m = old.length - origsize;
pos = s;
}
else
{
buf = new byte[n];
p = pos;
s = 0;
l = n;
m = old.length - l;
pos = 0;
}
System.arraycopy(old, p, buf, s, l);
return m;
}
|
java
|
@Override
public boolean isRRSTransactional() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, hexId() + ":isRRSTransactional()=" + true);
}
return true;
}
|
java
|
protected Compiler createCompiler(FacesContext context)
{
Compiler compiler = new SAXCompiler();
compiler.setDevelopmentProjectStage(context.isProjectStage(ProjectStage.Development));
loadLibraries(context, compiler);
loadDecorators(context, compiler);
loadOptions(context, compiler);
return compiler;
}
|
java
|
protected FaceletFactory createFaceletFactory(FacesContext context, Compiler compiler)
{
ExternalContext eContext = context.getExternalContext();
// refresh period
long refreshPeriod;
if (context.isProjectStage(ProjectStage.Production))
{
refreshPeriod = WebConfigParamUtils.getLongInitParameter(eContext, PARAMS_REFRESH_PERIOD,
DEFAULT_REFRESH_PERIOD_PRODUCTION);
}
else
{
refreshPeriod = WebConfigParamUtils.getLongInitParameter(eContext, PARAMS_REFRESH_PERIOD,
DEFAULT_REFRESH_PERIOD);
}
// resource resolver
ResourceResolver resolver = new DefaultResourceResolver();
ArrayList<String> classNames = new ArrayList<String>();
String faceletsResourceResolverClassName = WebConfigParamUtils.getStringInitParameter(eContext,
PARAMS_RESOURCE_RESOLVER, null);
List<String> resourceResolversFromAnnotations = RuntimeConfig.getCurrentInstance(
context.getExternalContext()).getResourceResolvers();
if (faceletsResourceResolverClassName != null)
{
classNames.add(faceletsResourceResolverClassName);
}
if (!resourceResolversFromAnnotations.isEmpty())
{
classNames.addAll(resourceResolversFromAnnotations);
}
if (!classNames.isEmpty())
{
resolver = ClassUtils.buildApplicationObject(ResourceResolver.class, classNames, resolver);
}
_resourceResolver = resolver;
return new DefaultFaceletFactory(compiler, resolver, refreshPeriod);
}
|
java
|
protected String getResponseContentType(FacesContext context, String orig)
{
String contentType = orig;
// see if we need to override the contentType
Map<Object, Object> m = context.getAttributes();
if (m.containsKey("facelets.ContentType"))
{
contentType = (String) m.get("facelets.ContentType");
if (log.isLoggable(Level.FINEST))
{
log.finest("Facelet specified alternate contentType '" + contentType + "'");
}
}
// safety check
if (contentType == null)
{
contentType = "text/html";
log.finest("ResponseWriter created had a null ContentType, defaulting to text/html");
}
return contentType;
}
|
java
|
protected String getResponseEncoding(FacesContext context, String orig)
{
String encoding = orig;
// see if we need to override the encoding
Map<Object, Object> m = context.getAttributes();
Map<String, Object> sm = context.getExternalContext().getSessionMap();
// 1. check the request attribute
if (m.containsKey(PARAM_ENCODING))
{
encoding = (String) m.get(PARAM_ENCODING);
if (encoding != null && log.isLoggable(Level.FINEST))
{
log.finest("Facelet specified alternate encoding '" + encoding + "'");
}
sm.put(CHARACTER_ENCODING_KEY, encoding);
}
// 2. get it from request
if (encoding == null)
{
encoding = context.getExternalContext().getRequestCharacterEncoding();
}
// 3. get it from the session
if (encoding == null)
{
encoding = (String) sm.get(CHARACTER_ENCODING_KEY);
if (encoding != null && log.isLoggable(Level.FINEST))
{
log.finest("Session specified alternate encoding '" + encoding + "'");
}
}
// 4. default it
if (encoding == null)
{
encoding = DEFAULT_CHARACTER_ENCODING;
if (log.isLoggable(Level.FINEST))
{
log.finest("ResponseWriter created had a null CharacterEncoding, defaulting to " + encoding);
}
}
return encoding;
}
|
java
|
protected void initialize(FacesContext context)
{
log.finest("Initializing");
Compiler compiler = createCompiler(context);
_faceletFactory = createFaceletFactory(context, compiler);
ExternalContext eContext = context.getExternalContext();
_initializeBuffer(eContext);
_initializeMode(eContext);
_initializeContractMappings(eContext);
// Create a component ids cache and store it on application map to
// reduce the overhead associated with create such ids over and over.
MyfacesConfig mfConfig = MyfacesConfig.getCurrentInstance(eContext);
if (mfConfig.getComponentUniqueIdsCacheSize() > 0)
{
String[] componentIdsCached = SectionUniqueIdCounter.generateUniqueIdCache("_",
mfConfig.getComponentUniqueIdsCacheSize());
eContext.getApplicationMap().put(
CACHED_COMPONENT_IDS, componentIdsCached);
}
_viewPoolProcessor = ViewPoolProcessor.getInstance(context);
log.finest("Initialization Successful");
}
|
java
|
private Facelet _getFacelet(FacesContext context, String viewId) throws IOException
{
// grab our FaceletFactory and create a Facelet
FaceletFactory.setInstance(_faceletFactory);
try
{
return _faceletFactory.getFacelet(context, viewId);
}
finally
{
FaceletFactory.setInstance(null);
}
}
|
java
|
@Override
protected void retrieveBundleContext() {
BundleContext bc = TxBundleTools.getBundleContext();
if (tc.isDebugEnabled())
Tr.debug(tc, "retrieveBundleContext from TxBundleTools, bc " + bc);
if (bc == null) {
bc = EmbeddableTxBundleTools.getBundleContext();
if (tc.isDebugEnabled())
Tr.debug(tc, "retrieveBundleContext from EmbeddableTxBundleTools, bc " + bc);
}
_bc = bc;
}
|
java
|
public synchronized void setRequestBufferSize(int size) {
if (size <= 0) {
throw new IllegalArgumentException("request buffer size must be greater than zero");
}
if (this.requestBuffer.size() != 0) {
throw new IllegalStateException("cannot resize non-empty ThreadPool request buffer");
}
this.requestBuffer = new BoundedBuffer(size);
requestBufferInitialCapacity_ = size;
requestBufferExpansionLimit_ = requestBufferInitialCapacity_ * 10;
}
|
java
|
@Deprecated
protected void addThread(Runnable command) {
Worker worker;
if (_isDecoratedZOS) // 331761A
worker = new DecoratedZOSWorker(command, threadid++); // 331761A
else
// 331761A
worker = new Worker(command, threadid++); // LIDB1855-58
// D527355.3 - If the current thread is an application thread, then the
// creation of a new thread will copy the application class loader as the
// context class loader. If the new thread is long-lived in this pool, the
// application class loader will be leaked.
if (contextClassLoader != null && THREAD_CONTEXT_ACCESSOR.getContextClassLoader(worker) != contextClassLoader) {
THREAD_CONTEXT_ACCESSOR.setContextClassLoader(worker, contextClassLoader);
}
Thread.interrupted(); // PK27301
threads_.put(worker, worker);
++poolSize_;
++activeThreads;
// PK77809 Tell the buffer that we have created a new thread waiting for
// work
if (command == null) {
requestBuffer.incrementWaitingThreads();
}
// must fire before it is started
fireThreadCreated(poolSize_);
try {
worker.start();
} catch (OutOfMemoryError error) {
// 394200 - If an OutOfMemoryError is thrown because too many threads
// have already been created, undo everything we've done.
// Alex Ffdc.log(error, this, ThreadPool.class.getName(), "626"); //
// D477704.2
threads_.remove(worker);
--poolSize_;
--activeThreads;
fireThreadDestroyed(poolSize_);
throw error;
}
}
|
java
|
@Deprecated
public int createThreads(int numberOfThreads) {
int ncreated = 0;
for (int i = 0; i < numberOfThreads; ++i) {
synchronized (this) {
if (poolSize_ < maximumPoolSize_) {
addThread(null);
++ncreated;
} else
break;
}
}
return ncreated;
}
|
java
|
@Deprecated
protected synchronized void workerDone(Worker w, boolean taskDied) {
threads_.remove(w);
if (taskDied) {
--activeThreads;
--poolSize_;
}
if (poolSize_ == 0 && shutdown_) {
maximumPoolSize_ = minimumPoolSize_ = 0; // disable new threads
notifyAll(); // notify awaitTerminationAfterShutdown
}
fireThreadDestroyed(poolSize_);
}
|
java
|
@Deprecated
protected Runnable getTask(boolean oldThread) throws InterruptedException { // PK77809
long waitTime;
Runnable r = null;
boolean firstTime = true;
while (true) {
synchronized (this) {
// System.out.println("1 " + activeThreads + " : " + poolSize_);
if (firstTime) {
--activeThreads;
// PK77809 Let the buffer know we have a waiting thread
if (oldThread) {
requestBuffer.incrementWaitingThreads();
}
}
if (poolSize_ > maximumPoolSize_) {
// Cause to die if too many threads
if (!growasneeded || !firstTime) {
// System.out.println("2 die");
--poolSize_;
// PK77809 Let the buffer know we have a waiting thread
requestBuffer.decrementWaitingThreads();
return null;
}
}
// infinite timeout if we are below the minimum size
waitTime = (shutdown_) ? 0 : (poolSize_ <= minimumPoolSize_) ? -1 : keepAliveTime_;
}
// PK27301 start
try {
r = (waitTime >= 0) ? (Runnable) (requestBuffer.poll(waitTime)) : (Runnable) (requestBuffer.take());
} catch (InterruptedException e) {
++activeThreads;
// PK77809 Let the buffer know we have a waiting thread
synchronized (this) {
requestBuffer.decrementWaitingThreads();
};
throw e;
}
// PK27301 end
synchronized (this) {
// System.out.println("3 r=" + r);
if (r == null) {
r = (Runnable) requestBuffer.poll(0);
}
if (r != null) {
++activeThreads;
break;
} else if (poolSize_ > minimumPoolSize_) {
// discount the current thread
// System.out.println("4 die");
poolSize_--;
// PK77809 Signal the buffer we have removed a thread
requestBuffer.decrementWaitingThreads();
break;
}
// System.out.println("going again");
}
firstTime = false;
}
return r;
}
|
java
|
public void setDecoratedZOS() { // 331761A
if (xMemSetupThread == null) {
try {
final Class xMemCRBridgeClass = Class.forName("com.ibm.ws390.xmem.XMemCRBridgeImpl");
xMemSetupThread = xMemCRBridgeClass.getMethod("setupThreadStub", new Class[] { java.lang.Object.class });
} catch (Throwable t) {
if (tc.isEventEnabled())
Tr.event(tc, "Unexpected exception caught accessing XMemCRBridgeImpl.setupThreadStub", t);
// Alex Ffdc.log(t, this, "com.ibm.ws.util.ThreadPool.setDecoratedZOS",
// "893"); // D477704.2
}
}
if (xMemSetupThread != null) {
_isDecoratedZOS = true;
}
}
|
java
|
public void executeOnDaemon(Runnable command) {
int id = 0;
final Runnable commandToRun = command;
synchronized (this) {
this.daemonId++;
id = this.daemonId;
}
final String runId = name + " : DMN" + id; // d185137.2
Thread t = (Thread) AccessController.doPrivileged(new PrivilegedAction()
{ // d185137.2
public Object run()
{
// return new Thread(commandToRun); // d185137.2
Thread temp = new Thread(commandToRun, runId); // d185137.2
temp.setDaemon(true);
return temp;
}
});
t.start();
}
|
java
|
public void execute(Runnable command, int blockingMode) throws InterruptedException, ThreadPoolQueueIsFullException, IllegalStateException { // D186668
execute(command, blockingMode, 0);
}
|
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.