repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/xml/XmlUtils.java | XmlUtils.getChildTextList | 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 | 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;
} | [
"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",
";",
"}"
] | Return list of content Strings of all child elements with given tag name.
@param elem
@param childTagName
@return List | [
"Return",
"list",
"of",
"content",
"Strings",
"of",
"all",
"child",
"elements",
"with",
"given",
"tag",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/xml/XmlUtils.java#L87-L103 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java | PubSubInputHandler.sendNackMessage | @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 | @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 ");
} | [
"@",
"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 \"",
")",
";",
"}"
] | Called by one of our input stream data structures when we don't have
any info for a tick and need to nack upstream.
@param startTick
@param endTick | [
"Called",
"by",
"one",
"of",
"our",
"input",
"stream",
"data",
"structures",
"when",
"we",
"don",
"t",
"have",
"any",
"info",
"for",
"a",
"tick",
"and",
"need",
"to",
"nack",
"upstream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java#L450-L487 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java | PubSubInputHandler.processAckExpected | 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 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");
} | [
"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\"",
")",
";",
"}"
] | Process an AckExpected message.
@param ackExpMsg The AckExpected message | [
"Process",
"an",
"AckExpected",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java#L633-L660 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java | PubSubInputHandler.processNackWithReturnValue | 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 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;
} | [
"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",
";",
"}"
] | Process a nack from a PubSubOutputHandler.
@param nack The nack message from one of our PubSubOutputHandlers. | [
"Process",
"a",
"nack",
"from",
"a",
"PubSubOutputHandler",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java#L667-L707 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java | PubSubInputHandler.remotePut | 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 | 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");
} | [
"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\"",
")",
";",
"}"
] | The remote put method is driven when the producer is remote
to this PubSub Input handler.
@param msg The inbound data message.
@param sourceCellule The cellule from which the message was received. We need
this to update the originMap for the inbound stream. | [
"The",
"remote",
"put",
"method",
"is",
"driven",
"when",
"the",
"producer",
"is",
"remote",
"to",
"this",
"PubSub",
"Input",
"handler",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java#L1409-L1477 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java | PubSubInputHandler.remoteToLocalPutSilence | 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 | 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");
} | [
"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\"",
")",
";",
"}"
] | This is a put message that has oringinated from another ME
When there are no matching local consumers we need to write
Silence into the stream instead
@param msgItem The message to be put.
@throws SIResourceException | [
"This",
"is",
"a",
"put",
"message",
"that",
"has",
"oringinated",
"from",
"another",
"ME",
"When",
"there",
"are",
"no",
"matching",
"local",
"consumers",
"we",
"need",
"to",
"write",
"Silence",
"into",
"the",
"stream",
"instead"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java#L1646-L1660 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java | PubSubInputHandler.matchMessage | 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 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;
} | [
"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",
";",
"}"
] | Returns a list of matching OutputHandlers for a particular message.
Note that this method takes a MessageProcessorSearchResults object
from a pool. This object must be returned by the caller when it is
finished with.
@param msg
@return | [
"Returns",
"a",
"list",
"of",
"matching",
"OutputHandlers",
"for",
"a",
"particular",
"message",
".",
"Note",
"that",
"this",
"method",
"takes",
"a",
"MessageProcessorSearchResults",
"object",
"from",
"a",
"pool",
".",
"This",
"object",
"must",
"be",
"returned",
"by",
"the",
"caller",
"when",
"it",
"is",
"finished",
"with",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java#L1671-L1712 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java | PubSubInputHandler.restoreFanOut | 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 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;
} | [
"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",
";",
"}"
] | Restore fan out of the given message to subscribers.
Perform match asks the match space for the matching set of output handlers
based on the topic of the message.
It will send messages to the PubSubOutput handlers for delivery
to remote ME's
@param msg Reference to the message object
@param commitInsert If the message has been committed
@return boolean If the message reference is required | [
"Restore",
"fan",
"out",
"of",
"the",
"given",
"message",
"to",
"subscribers",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java#L1983-L2083 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java | PubSubInputHandler.addProxyReference | 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 | 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;
} | [
"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",
";",
"}"
] | Add a msg reference to the proxy subscription reference stream.
@param msg
@param tran
@throws SIResourceException if there is a message store resource problem
@throws SIStoreException if there is a general problem with the message store. | [
"Add",
"a",
"msg",
"reference",
"to",
"the",
"proxy",
"subscription",
"reference",
"stream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java#L2188-L2244 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java | PubSubInputHandler.setPropertiesInMessage | 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 | 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");
} | [
"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\"",
")",
";",
"}"
] | Sets properties in the message that are common to both
links and non-links.
@param jsMsg
@param destinationUuid
@param producerConnectionUuid
@author tpm | [
"Sets",
"properties",
"in",
"the",
"message",
"that",
"are",
"common",
"to",
"both",
"links",
"and",
"non",
"-",
"links",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java#L2968-L2998 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/BulkheadConfig.java | BulkheadConfig.validate | @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 | @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));
}
} | [
"@",
"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",
")",
")",
";",
"}",
"}"
] | Validate Bulkhead configure and make sure the value and waitingTaskQueue must be greater than or equal to 1. | [
"Validate",
"Bulkhead",
"configure",
"and",
"make",
"sure",
"the",
"value",
"and",
"waitingTaskQueue",
"must",
"be",
"greater",
"than",
"or",
"equal",
"to",
"1",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/BulkheadConfig.java#L50-L63 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java | CacheStatsModule.updateCacheSizes | 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 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);
}
} | [
"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",
")",
";",
"}",
"}"
] | Updates statistics using two supplied arguments - maxInMemoryCacheSize and currentInMemoryCacheSize.
@param max
Maximum # of entries that can be stored in memory
@param current
Current # of in memory cache entries | [
"Updates",
"statistics",
"using",
"two",
"supplied",
"arguments",
"-",
"maxInMemoryCacheSize",
"and",
"currentInMemoryCacheSize",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java#L635-L651 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java | CacheStatsModule.onCacheHit | 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 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;
} | [
"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",
";",
"}"
] | Updates statistics for the cache hit case.
@param template
the template of the cache entry. The template cannot be null for Servlet cache.
@param locality
Whether the miss was local or remote | [
"Updates",
"statistics",
"for",
"the",
"cache",
"hit",
"case",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java#L758-L800 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java | CacheStatsModule.onCacheMiss | 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 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;
} | [
"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",
";",
"}"
] | Updates statistics for the cache miss case.
@param template
the template of the cache entry. The template cannot be null for Servlet cache.
@param locality
Whether the miss was local or remote | [
"Updates",
"statistics",
"for",
"the",
"cache",
"miss",
"case",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java#L810-L823 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java | CacheStatsModule.onEntryCreation | 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 | 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;
} | [
"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",
";",
"}"
] | Updates statistics for the cache entry creation case.
@param template
the template of the cache entry. The template cannot be null for Servlet cache.
@param source
whether the invalidation was generated internally or remotely | [
"Updates",
"statistics",
"for",
"the",
"cache",
"entry",
"creation",
"case",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java#L833-L852 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java | JAXBAnnotationsHelper.applyElement | 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 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);
}
}
} | [
"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",
")",
";",
"}",
"}",
"}"
] | Puts definitions for XML element.
@param member annotations provider
@param property property instance to be updated | [
"Puts",
"definitions",
"for",
"XML",
"element",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java#L55-L70 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java | JAXBAnnotationsHelper.applyAttribute | 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 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);
}
} | [
"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",
")",
";",
"}",
"}"
] | Puts definitions for XML attribute.
@param member annotations provider
@param property property instance to be updated | [
"Puts",
"definitions",
"for",
"XML",
"attribute",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java#L78-L85 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java | JAXBAnnotationsHelper.setName | 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 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;
} | [
"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",
";",
"}"
] | Puts name space and name for XML node or attribute.
@param ns name space
@param name name
@param property property instance to be updated
@return <code>true</code> if name space and name have been set | [
"Puts",
"name",
"space",
"and",
"name",
"for",
"XML",
"node",
"or",
"attribute",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java#L105-L128 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java | JAXBAnnotationsHelper.isAttributeAllowed | 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 | 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;
} | [
"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",
";",
"}"
] | Checks whether the passed property can be represented as node attribute.
@param property property instance to be checked
@return <code>true</code> if the passed property can be represented as
node attribute | [
"Checks",
"whether",
"the",
"passed",
"property",
"can",
"be",
"represented",
"as",
"node",
"attribute",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java#L137-L147 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/x509/Attribute.java | Attribute.getInstance | 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 | 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");
} | [
"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\"",
")",
";",
"}"
] | return an Attribute object from the given object.
@param o the object we want converted.
@exception IllegalArgumentException if the object cannot be converted. | [
"return",
"an",
"Attribute",
"object",
"from",
"the",
"given",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/x509/Attribute.java#L37-L51 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelOptions.java | SSLChannelOptions.unregister | synchronized void unregister() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "unregister", this);
}
if (registration != null) {
registration.unregister();
registration = null;
}
} | java | synchronized void unregister() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "unregister", this);
}
if (registration != null) {
registration.unregister();
registration = null;
}
} | [
"synchronized",
"void",
"unregister",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"unregister\"",
",",
"this",
")",
";",
"}",
"if",
"(",
"registration",
"!=",
"null",
")",
"{",
"registration",
".",
"unregister",
"(",
")",
";",
"registration",
"=",
"null",
";",
"}",
"}"
] | Remove the service registration
Package private. | [
"Remove",
"the",
"service",
"registration",
"Package",
"private",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelOptions.java#L156-L164 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TruncatableThrowable.java | TruncatableThrowable.printStackTrace | @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 | @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);
}
}
} | [
"@",
"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",
")",
";",
"}",
"}",
"}"
] | This method will print a trimmed stack trace to stderr. | [
"This",
"method",
"will",
"print",
"a",
"trimmed",
"stack",
"trace",
"to",
"stderr",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TruncatableThrowable.java#L68-L102 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TruncatableThrowable.java | TruncatableThrowable.getStackTraceEliminatingDuplicateFrames | 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 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();
} | [
"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",
"(",
")",
";",
"}"
] | Useful for exceptions which are the causes of other exceptions. Gets the stack frames, but not only
does it eliminate internal classes, it eliminates frames which are redundant with the parent
exception.
In the case where the exception is not a cause, it returns a normal exception.
If duplicate frames are stripped, it will add an
@DUPLICATE_FRAMES_STACK_TRACE_ELEMENT eyecatcher
@return | [
"Useful",
"for",
"exceptions",
"which",
"are",
"the",
"causes",
"of",
"other",
"exceptions",
".",
"Gets",
"the",
"stack",
"frames",
"but",
"not",
"only",
"does",
"it",
"eliminate",
"internal",
"classes",
"it",
"eliminates",
"frames",
"which",
"are",
"redundant",
"with",
"the",
"parent",
"exception",
".",
"In",
"the",
"case",
"where",
"the",
"exception",
"is",
"not",
"a",
"cause",
"it",
"returns",
"a",
"normal",
"exception",
".",
"If",
"duplicate",
"frames",
"are",
"stripped",
"it",
"will",
"add",
"an"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TruncatableThrowable.java#L211-L239 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/state/impl/CircuitBreakerRollingWindow.java | CircuitBreakerRollingWindow.record | 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 | 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;
}
} | [
"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",
";",
"}",
"}"
] | Record a result in the rolling window
@param result the result to record | [
"Record",
"a",
"result",
"in",
"the",
"rolling",
"window"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/state/impl/CircuitBreakerRollingWindow.java#L87-L109 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/pool/impl/ViewPoolImpl.java | ViewPoolImpl.deriveViewKey | 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 | 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;
} | [
"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",
";",
"}"
] | Generates an unique key according to the metadata information stored
in the passed UIViewRoot instance that can affect the way how the view is generated.
By default, the "view" params are the viewId, the locale, the renderKit and
the contracts associated to the view.
@param facesContext
@param root
@return | [
"Generates",
"an",
"unique",
"key",
"according",
"to",
"the",
"metadata",
"information",
"stored",
"in",
"the",
"passed",
"UIViewRoot",
"instance",
"that",
"can",
"affect",
"the",
"way",
"how",
"the",
"view",
"is",
"generated",
".",
"By",
"default",
"the",
"view",
"params",
"are",
"the",
"viewId",
"the",
"locale",
"the",
"renderKit",
"and",
"the",
"contracts",
"associated",
"to",
"the",
"view",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/pool/impl/ViewPoolImpl.java#L174-L189 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/JsonLogHandler.java | JsonLogHandler.modified | 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 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();
}
} | [
"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",
"(",
")",
";",
"}",
"}"
] | Without osgi, this modified method is called explicility from the update method in
JsonTrService
@param newSources List of the new source list from config | [
"Without",
"osgi",
"this",
"modified",
"method",
"is",
"called",
"explicility",
"from",
"the",
"update",
"method",
"in",
"JsonTrService"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/JsonLogHandler.java#L113-L138 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/StateWriter.java | StateWriter.writingState | public void writingState()
{
if (!this.writtenState)
{
this.writtenState = true;
this.writtenStateWithoutWrapper = false;
this.fast = new FastWriter(this.initialSize);
this.out = this.fast;
}
} | java | public void writingState()
{
if (!this.writtenState)
{
this.writtenState = true;
this.writtenStateWithoutWrapper = false;
this.fast = new FastWriter(this.initialSize);
this.out = this.fast;
}
} | [
"public",
"void",
"writingState",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"writtenState",
")",
"{",
"this",
".",
"writtenState",
"=",
"true",
";",
"this",
".",
"writtenStateWithoutWrapper",
"=",
"false",
";",
"this",
".",
"fast",
"=",
"new",
"FastWriter",
"(",
"this",
".",
"initialSize",
")",
";",
"this",
".",
"out",
"=",
"this",
".",
"fast",
";",
"}",
"}"
] | Mark that state is about to be written. Contrary to what you'd expect, we cannot and should not assume that this
location is really going to have state; it is perfectly legit to have a ResponseWriter that filters out content,
and ignores an attempt to write out state at this point. So, we have to check after the fact to see if there
really are state markers. | [
"Mark",
"that",
"state",
"is",
"about",
"to",
"be",
"written",
".",
"Contrary",
"to",
"what",
"you",
"d",
"expect",
"we",
"cannot",
"and",
"should",
"not",
"assume",
"that",
"this",
"location",
"is",
"really",
"going",
"to",
"have",
"state",
";",
"it",
"is",
"perfectly",
"legit",
"to",
"have",
"a",
"ResponseWriter",
"that",
"filters",
"out",
"content",
"and",
"ignores",
"an",
"attempt",
"to",
"write",
"out",
"state",
"at",
"this",
"point",
".",
"So",
"we",
"have",
"to",
"check",
"after",
"the",
"fact",
"to",
"see",
"if",
"there",
"really",
"are",
"state",
"markers",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/StateWriter.java#L128-L137 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.1.common/src/com/ibm/ws/jaxrs20/component/JaxRsServiceActivator.java | JaxRsServiceActivator.registerExtensionProvider | @Reference(name = "extensionProvider", service = ExtensionProvider.class, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE)
protected void registerExtensionProvider(ExtensionProvider provider) {
LibertyApplicationBusFactory.getInstance().registerExtensionProvider(provider);
} | java | @Reference(name = "extensionProvider", service = ExtensionProvider.class, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE)
protected void registerExtensionProvider(ExtensionProvider provider) {
LibertyApplicationBusFactory.getInstance().registerExtensionProvider(provider);
} | [
"@",
"Reference",
"(",
"name",
"=",
"\"extensionProvider\"",
",",
"service",
"=",
"ExtensionProvider",
".",
"class",
",",
"policy",
"=",
"ReferencePolicy",
".",
"DYNAMIC",
",",
"cardinality",
"=",
"ReferenceCardinality",
".",
"MULTIPLE",
")",
"protected",
"void",
"registerExtensionProvider",
"(",
"ExtensionProvider",
"provider",
")",
"{",
"LibertyApplicationBusFactory",
".",
"getInstance",
"(",
")",
".",
"registerExtensionProvider",
"(",
"provider",
")",
";",
"}"
] | Register a new extension provier
@param provider The extension provider | [
"Register",
"a",
"new",
"extension",
"provier"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.1.common/src/com/ibm/ws/jaxrs20/component/JaxRsServiceActivator.java#L107-L110 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/EndpointServices.java | EndpointServices.dumpMap | @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 | @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();
} | [
"@",
"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",
"(",
")",
";",
"}"
] | dump parameter map for trace. | [
"dump",
"parameter",
"map",
"for",
"trace",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/EndpointServices.java#L195-L210 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/RemoteMessageReceiver.java | RemoteMessageReceiver.forwardMessage | 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 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");
} | [
"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\"",
")",
";",
"}"
] | Forwards a message onto a foreign bus
@param aMessage
@param sourceCellule
@param targetCellule | [
"Forwards",
"a",
"message",
"onto",
"a",
"foreign",
"bus"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/io/RemoteMessageReceiver.java#L653-L702 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.attachAndLockMsg | 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 | 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);
} | [
"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",
")",
";",
"}"
] | Attach and lock a message to this LCP
NOTE: Callers to this method will have the JSLocalConsumerPoint locked
(and their JSKeyGroup locked if applicable)
@param msgItem The message to be attached
@param isOnItemStream true if the message being attached is stored on the
QP's itemStream | [
"Attach",
"and",
"lock",
"a",
"message",
"to",
"this",
"LCP"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L860-L984 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.getAttachedMessage | 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 | 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;
} | [
"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",
";",
"}"
] | If a message has been attached to this LCP, detach it and return it
NOTE: Callers to this method will have the JSLocalConsumerPoint locked
@return The message which was attached
@throws SIResourceException | [
"If",
"a",
"message",
"has",
"been",
"attached",
"to",
"this",
"LCP",
"detach",
"it",
"and",
"return",
"it"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L994-L1025 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.checkReceiveAllowed | 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 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;
} | [
"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",
";",
"}"
] | Checks the destination allows receive
If receive not allowed, and LCP started, stops it
If receive allowed, and LCP stopped, may start it | [
"Checks",
"the",
"destination",
"allows",
"receive"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L1034-L1069 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.checkReceiveState | 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 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");
} | [
"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\"",
")",
";",
"}"
] | Checks the state for the synchronous consumer
Will check for not closed,
AsynchConsumer
and if it is already in a wait
If any of those conditions appear - an exception will be thrown. | [
"Checks",
"the",
"state",
"for",
"the",
"synchronous",
"consumer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L1081-L1124 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.getEligibleMsgLocked | 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 | 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;
} | [
"private",
"SIMPMessage",
"getEligibleMsgLocked",
"(",
"TransactionCommon",
"tranImpl",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getEligibleMsgLocked\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"tranImpl",
"}",
")",
";",
"/*\n * 166829.1 Support for noLocal delivery\n * \n * If we are pubsub and noLocal has been specified we should not deliver the message\n * to this consumer if it was published on the same connection. We cannot do this at\n * fanout stage since we do not know the current connection until delivery time.\n * \n * On delivery we need to iterate through the itemstream until we find an eligible\n * message (i.e. not from this connection). For each message that does not comply, we\n * mark it for deletion. If we find a message, we deliver and delete the marked messages\n * under the given transaction.\n * If we do not find a message, we create a transaction and delete all the marked messages.\n */",
"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",
";",
"}"
] | Retrieves the next eligible message for delivery to this consumer. Performs
a check for noLocal and takes this into account when retrieving the next eligible
message. If any messages are not eligible for delivery, they are deleted from the
itemstream before the first eligble one is returned.
NOTE: Callers to this method will have the JSLocalConsumerPoint locked
@returns SIMPMessage - the next eligible message for this consumer. | [
"Retrieves",
"the",
"next",
"eligible",
"message",
"for",
"delivery",
"to",
"this",
"consumer",
".",
"Performs",
"a",
"check",
"for",
"noLocal",
"and",
"takes",
"this",
"into",
"account",
"when",
"retrieving",
"the",
"next",
"eligible",
"message",
".",
"If",
"any",
"messages",
"are",
"not",
"eligible",
"for",
"delivery",
"they",
"are",
"deleted",
"from",
"the",
"itemstream",
"before",
"the",
"first",
"eligble",
"one",
"is",
"returned",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L1297-L1393 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.waitingNotify | 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 | 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");
} | [
"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\"",
")",
";",
"}"
] | Wakeup our thread if we're waiting on a receive. This method is normally
called as part of remoteDurable when we need to resubmit a get because
a previous get caused a noLocal discard. | [
"Wakeup",
"our",
"thread",
"if",
"we",
"re",
"waiting",
"on",
"a",
"receive",
".",
"This",
"method",
"is",
"normally",
"called",
"as",
"part",
"of",
"remoteDurable",
"when",
"we",
"need",
"to",
"resubmit",
"a",
"get",
"because",
"a",
"previous",
"get",
"caused",
"a",
"noLocal",
"discard",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L1847-L1864 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.retrieveMsgLocked | 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 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;
} | [
"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",
";",
"}"
] | Attempt to retrieve a message from the CD's itemStream in a locked state.
@return A locked message | [
"Attempt",
"to",
"retrieve",
"a",
"message",
"from",
"the",
"CD",
"s",
"itemStream",
"in",
"a",
"locked",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L1871-L1921 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.checkParams | 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 | 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");
} | [
"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\"",
")",
";",
"}"
] | Checks that the maxBatchSize is >0
Checks that messasgeLockExpiry >=0
Checks that maxActiveMessages >=0
@param maxBatchSize
@param max | [
"Checks",
"that",
"the",
"maxBatchSize",
"is",
">",
"0",
"Checks",
"that",
"messasgeLockExpiry",
">",
"=",
"0",
"Checks",
"that",
"maxActiveMessages",
">",
"=",
"0"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L1931-L1982 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.processAttachedMsgs | 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 | 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;
} | [
"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",
";",
"}"
] | Try to asynchronously deliver any attached messages
@return true if a message was delivered
@throws SIResourceException
@throws SISessionDroppedException | [
"Try",
"to",
"asynchronously",
"deliver",
"any",
"attached",
"messages"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L2230-L2344 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.runAsynchConsumer | 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 | 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");
} | [
"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\"",
")",
";",
"}"
] | Go and look for both attached messages and messages on the QP.
If any are found then deliver them via the asynch callback
@param isolatedRun if true then call the Asynch callback at most once
@throws SIResourceException Thrown if there are problems in the msgStore
@throws SISessionDroppedException | [
"Go",
"and",
"look",
"for",
"both",
"attached",
"messages",
"and",
"messages",
"on",
"the",
"QP",
".",
"If",
"any",
"are",
"found",
"then",
"deliver",
"them",
"via",
"the",
"asynch",
"callback"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L3035-L3140 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.close | @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 | @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");
} | [
"@",
"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\"",
")",
";",
"}"
] | Closes the LocalConsumerPoint.
@throws | [
"Closes",
"the",
"LocalConsumerPoint",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L3147-L3317 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.isClosed | public boolean isClosed()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "isClosed", this);
SibTr.exit(tc, "isClosed", Boolean.valueOf(_closed));
}
return _closed;
} | java | public boolean isClosed()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "isClosed", this);
SibTr.exit(tc, "isClosed", Boolean.valueOf(_closed));
}
return _closed;
} | [
"public",
"boolean",
"isClosed",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"isClosed\"",
",",
"this",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"isClosed\"",
",",
"Boolean",
".",
"valueOf",
"(",
"_closed",
")",
")",
";",
"}",
"return",
"_closed",
";",
"}"
] | Returns true if this LCP is closed.
@return | [
"Returns",
"true",
"if",
"this",
"LCP",
"is",
"closed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L3324-L3332 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.start | @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 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");
} | [
"@",
"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\"",
")",
";",
"}"
] | Start this LCP. If there are any synchronous receives waiting, wake them up
If there is a AsynchConsumerCallback registered look on the QP for messages
for asynch delivery. If deliverImmediately is set, this Thread is used to deliver
any initial messages rather than starting up a new Thread. | [
"Start",
"this",
"LCP",
".",
"If",
"there",
"are",
"any",
"synchronous",
"receives",
"waiting",
"wake",
"them",
"up",
"If",
"there",
"is",
"a",
"AsynchConsumerCallback",
"registered",
"look",
"on",
"the",
"QP",
"for",
"messages",
"for",
"asynch",
"delivery",
".",
"If",
"deliverImmediately",
"is",
"set",
"this",
"Thread",
"is",
"used",
"to",
"deliver",
"any",
"initial",
"messages",
"rather",
"than",
"starting",
"up",
"a",
"new",
"Thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L3469-L3484 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.checkForMessages | @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 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");
} | [
"@",
"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\"",
")",
";",
"}"
] | Spin off a thread that checks for any stored messages.
This is called by a consumerKeyGroup to try to kick a group back
into life after a stopped member detaches and makes the group ready
again. | [
"Spin",
"off",
"a",
"thread",
"that",
"checks",
"for",
"any",
"stored",
"messages",
".",
"This",
"is",
"called",
"by",
"a",
"consumerKeyGroup",
"to",
"try",
"to",
"kick",
"a",
"group",
"back",
"into",
"life",
"after",
"a",
"stopped",
"member",
"detaches",
"and",
"makes",
"the",
"group",
"ready",
"again",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L3645-L3672 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.unlockAll | @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 | @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");
} | [
"@",
"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\"",
")",
";",
"}"
] | Unlock all messages which have been locked to this LCP but not consumed
@throws SIResourceException Thrown if there is a problem in the msgStore | [
"Unlock",
"all",
"messages",
"which",
"have",
"been",
"locked",
"to",
"this",
"LCP",
"but",
"not",
"consumed"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L3782-L3815 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.setBaseRecoverability | 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 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");
} | [
"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\"",
")",
";",
"}"
] | Set the consumerSession's recoverability | [
"Set",
"the",
"consumerSession",
"s",
"recoverability"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L3820-L3830 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.resetBaseUnrecoverability | 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 resetBaseUnrecoverability()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "resetBaseUnrecoverability", this);
_unrecoverableOptions = _baseUnrecoverableOptions;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "resetBaseUnrecoverability");
} | [
"private",
"void",
"resetBaseUnrecoverability",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"resetBaseUnrecoverability\"",
",",
"this",
")",
";",
"_unrecoverableOptions",
"=",
"_baseUnrecoverableOptions",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"resetBaseUnrecoverability\"",
")",
";",
"}"
] | Restore the original unrecoverability of the session | [
"Restore",
"the",
"original",
"unrecoverability",
"of",
"the",
"session"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L3835-L3844 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.setReady | 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 | 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");
} | [
"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\"",
")",
";",
"}"
] | Change the Ready state to true | [
"Change",
"the",
"Ready",
"state",
"to",
"true"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L3867-L3891 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.unsetReady | 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 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");
} | [
"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\"",
")",
";",
"}"
] | Change the Ready state to false | [
"Change",
"the",
"Ready",
"state",
"to",
"false"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L3896-L3916 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.getAutoCommitTransaction | 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 | 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;
} | [
"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",
";",
"}"
] | An autocommit transaction is not threadsafe, therefore any users must
either prevent concurrent use or use separate transactions. All
references in JSLocalConsumerPoint to _autoCommitTransaction are threadsafe
so the cached transaction is ok. However, callers to this method are not,
so a new transaction is returned each time.
@return tran A new autocommit transaction | [
"An",
"autocommit",
"transaction",
"is",
"not",
"threadsafe",
"therefore",
"any",
"users",
"must",
"either",
"prevent",
"concurrent",
"use",
"or",
"use",
"separate",
"transactions",
".",
"All",
"references",
"in",
"JSLocalConsumerPoint",
"to",
"_autoCommitTransaction",
"are",
"threadsafe",
"so",
"the",
"cached",
"transaction",
"is",
"ok",
".",
"However",
"callers",
"to",
"this",
"method",
"are",
"not",
"so",
"a",
"new",
"transaction",
"is",
"returned",
"each",
"time",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L4202-L4216 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.getMaxActiveMessages | public int getMaxActiveMessages()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getMaxActiveMessages");
SibTr.exit(tc, "getMaxActiveMessages", Integer.valueOf(_maxActiveMessages));
}
return _maxActiveMessages;
} | java | public int getMaxActiveMessages()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getMaxActiveMessages");
SibTr.exit(tc, "getMaxActiveMessages", Integer.valueOf(_maxActiveMessages));
}
return _maxActiveMessages;
} | [
"public",
"int",
"getMaxActiveMessages",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getMaxActiveMessages\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMaxActiveMessages\"",
",",
"Integer",
".",
"valueOf",
"(",
"_maxActiveMessages",
")",
")",
";",
"}",
"return",
"_maxActiveMessages",
";",
"}"
] | Gets the max active message count,
Currently only used by the unit tests to be sure that the max active count has
been updated
@return | [
"Gets",
"the",
"max",
"active",
"message",
"count",
"Currently",
"only",
"used",
"by",
"the",
"unit",
"tests",
"to",
"be",
"sure",
"that",
"the",
"max",
"active",
"count",
"has",
"been",
"updated"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L4540-L4548 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java | JSLocalConsumerPoint.setMaxActiveMessages | @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 | @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");
} | [
"@",
"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\"",
")",
";",
"}"
] | Update the max active messages field
Set by the MessagePump class to indicate that there has been an update
in the Threadpool class.
WARNING: if the max is ever set to zero (now or on registration) then counting
is disabled (for performance), so if it ever gets reset to a non-zero
value we will not have accounted for any currently active messages so
the count will be out by a certain offset, which could cause it to go
negative.
@param maxActiveMessages | [
"Update",
"the",
"max",
"active",
"messages",
"field"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/JSLocalConsumerPoint.java#L4564-L4619 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.request.probes/src/com/ibm/wsspi/request/probe/bci/TransformDescriptorHelper.java | TransformDescriptorHelper.contextInfoRequired | 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 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;
} | [
"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",
";",
"}"
] | This method will check if context information is required or not by
processing through each active ProbeExtensions available in PE List
@param eventType
@return | [
"This",
"method",
"will",
"check",
"if",
"context",
"information",
"is",
"required",
"or",
"not",
"by",
"processing",
"through",
"each",
"active",
"ProbeExtensions",
"available",
"in",
"PE",
"List"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.request.probes/src/com/ibm/wsspi/request/probe/bci/TransformDescriptorHelper.java#L45-L68 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.request.probes/src/com/ibm/wsspi/request/probe/bci/TransformDescriptorHelper.java | TransformDescriptorHelper.getObjForInstrumentation | public static RequestProbeTransformDescriptor getObjForInstrumentation(
String key) {
RequestProbeTransformDescriptor requestProbeTransformDescriptor = RequestProbeBCIManagerImpl
.getRequestProbeTransformDescriptors().get(key);
return requestProbeTransformDescriptor;
} | java | public static RequestProbeTransformDescriptor getObjForInstrumentation(
String key) {
RequestProbeTransformDescriptor requestProbeTransformDescriptor = RequestProbeBCIManagerImpl
.getRequestProbeTransformDescriptors().get(key);
return requestProbeTransformDescriptor;
} | [
"public",
"static",
"RequestProbeTransformDescriptor",
"getObjForInstrumentation",
"(",
"String",
"key",
")",
"{",
"RequestProbeTransformDescriptor",
"requestProbeTransformDescriptor",
"=",
"RequestProbeBCIManagerImpl",
".",
"getRequestProbeTransformDescriptors",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"return",
"requestProbeTransformDescriptor",
";",
"}"
] | getObjForInstrumentation Returns TransformDescriptor with input
parameters className, methodName and methodDescription
@param classname
@param mInfo
@return | [
"getObjForInstrumentation",
"Returns",
"TransformDescriptor",
"with",
"input",
"parameters",
"className",
"methodName",
"and",
"methodDescription"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.request.probes/src/com/ibm/wsspi/request/probe/bci/TransformDescriptorHelper.java#L208-L213 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessageToken.java | SibRaMessageToken.addHandle | 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 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;
} | [
"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",
";",
"}"
] | Attemts to add the supplied message handle to the token. This is only done if the
context information matches and both messages are BENP or both are not BENP.
@param handle The message handle to try and add to the token
@param ctxInfo The context info associated with the message
@param unrecoveredReliability The unrecovered reliability that the session was created with
@param canBeDeleted If the messages associated with this token cane be deleted or not.
@return true if the handle was added to the token (the context info and BENP
flags matched). | [
"Attemts",
"to",
"add",
"the",
"supplied",
"message",
"handle",
"to",
"the",
"token",
".",
"This",
"is",
"only",
"done",
"if",
"the",
"context",
"information",
"matches",
"and",
"both",
"messages",
"are",
"BENP",
"or",
"both",
"are",
"not",
"BENP",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessageToken.java#L251-L302 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessageToken.java | SibRaMessageToken.matches | 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 | 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;
} | [
"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);\n 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",
";",
"}"
] | This method checks to see if the supplied information from a message handle matches
the information that this token is using.
@param ctxInfo The context info of the new message handle
@param isBENP Whether the new message handle represents a BENP message or not
@return true if the information about the new messages matches the information
stored in this token | [
"This",
"method",
"checks",
"to",
"see",
"if",
"the",
"supplied",
"information",
"from",
"a",
"message",
"handle",
"matches",
"the",
"information",
"that",
"this",
"token",
"is",
"using",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessageToken.java#L313-L360 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/ByteBufferConfiguration.java | ByteBufferConfiguration.updateBufferManager | 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 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
} | [
"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",
"}"
] | This is used to provide the runtime configuration changes to an
existing pool manager, which is a small subset of the possible
creation properties.
@param properties | [
"This",
"is",
"used",
"to",
"provide",
"the",
"runtime",
"configuration",
"changes",
"to",
"an",
"existing",
"pool",
"manager",
"which",
"is",
"a",
"small",
"subset",
"of",
"the",
"possible",
"creation",
"properties",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/ByteBufferConfiguration.java#L175-L183 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java | PerfModules.initConfigs | 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 | 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);
}
} | [
"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",
")",
";",
"}",
"}"
] | Init moduleConfigs with array moduleIDs - use modulePrefix
because they are all websphere default PMI modules | [
"Init",
"moduleConfigs",
"with",
"array",
"moduleIDs",
"-",
"use",
"modulePrefix",
"because",
"they",
"are",
"all",
"websphere",
"default",
"PMI",
"modules"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java#L114-L121 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java | PerfModules.getConfig | 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 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;
} | [
"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",
";",
"}"
] | return PmiModuleConfig for a given moduleID | [
"return",
"PmiModuleConfig",
"for",
"a",
"given",
"moduleID"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java#L130-L155 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java | PerfModules.findConfig | 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 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;
} | [
"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",
";",
"}"
] | return the config for the moduleID | [
"return",
"the",
"config",
"for",
"the",
"moduleID"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java#L158-L168 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java | PerfModules.getConfigFromXMLFile | 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 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
}
} | [
"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!",
"/*\n * File f = new File (xmlFilePath);\n * String fileName = f.getName();\n * int dotLoc = fileName.lastIndexOf(\".\");\n * if (dotLoc != -1)\n * {\n * String modName = fileName.substring (0, dotLoc-1);\n * config = (PmiModuleConfig)moduleConfigs.get (modName);\n * \n * if(config != null)\n * {\n * return config;\n * }\n * }\n */",
"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",
"}",
"}"
] | will parsed one more time | [
"will",
"parsed",
"one",
"more",
"time"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java#L204-L334 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java | PerfModules.getDataName | 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 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();
} | [
"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",
"(",
")",
";",
"}"
] | Convert data id to data name | [
"Convert",
"data",
"id",
"to",
"data",
"name"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java#L356-L366 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java | PerfModules.getDataId | 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 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;
} | [
"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",
";",
"}"
] | Convert data name to dataId | [
"Convert",
"data",
"name",
"to",
"dataId"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PerfModules.java#L371-L381 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/DurableSubscriptionItemStream.java | DurableSubscriptionItemStream.getConsumerDispatcherState | public ConsumerDispatcherState getConsumerDispatcherState()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConsumerDispatcherState");
SibTr.exit(tc, "getConsumerDispatcherState", _subState);
}
return _subState;
} | java | public ConsumerDispatcherState getConsumerDispatcherState()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getConsumerDispatcherState");
SibTr.exit(tc, "getConsumerDispatcherState", _subState);
}
return _subState;
} | [
"public",
"ConsumerDispatcherState",
"getConsumerDispatcherState",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getConsumerDispatcherState\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getConsumerDispatcherState\"",
",",
"_subState",
")",
";",
"}",
"return",
"_subState",
";",
"}"
] | Returns the subState.
@return Object | [
"Returns",
"the",
"subState",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/DurableSubscriptionItemStream.java#L462-L471 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/DurableSubscriptionItemStream.java | DurableSubscriptionItemStream.deleteDurableSubscription | 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 | 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");
} | [
"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\"",
")",
";",
"}"
] | Deletes the durable subscription from the list of durable subscriptions
and calls through to the consumer dispatcher to remove the subscription
from the MatchSpace.
@param callProxyCode If the delete needs to call the proxy handling code. | [
"Deletes",
"the",
"durable",
"subscription",
"from",
"the",
"list",
"of",
"durable",
"subscriptions",
"and",
"calls",
"through",
"to",
"the",
"consumer",
"dispatcher",
"to",
"remove",
"the",
"subscription",
"from",
"the",
"MatchSpace",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/DurableSubscriptionItemStream.java#L540-L599 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/Tr.java | Tr.register | public static TraceComponent register(Class<?> aClass, String group) {
return register(aClass, group, null);
} | java | public static TraceComponent register(Class<?> aClass, String group) {
return register(aClass, group, null);
} | [
"public",
"static",
"TraceComponent",
"register",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"String",
"group",
")",
"{",
"return",
"register",
"(",
"aClass",
",",
"group",
",",
"null",
")",
";",
"}"
] | Register the provided class with the trace service and assign it to the
provided group name.
@param aClass
@param group
@return TraceComponent | [
"Register",
"the",
"provided",
"class",
"with",
"the",
"trace",
"service",
"and",
"assign",
"it",
"to",
"the",
"provided",
"group",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/Tr.java#L125-L127 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/Tr.java | Tr.dump | 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 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);
}
} | [
"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",
")",
";",
"}",
"}"
] | Print the provided message if the input trace component allows dump level
messages.
@param tc
@param msg
@param obj | [
"Print",
"the",
"provided",
"message",
"if",
"the",
"input",
"trace",
"component",
"allows",
"dump",
"level",
"messages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/Tr.java#L227-L233 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/Tr.java | Tr.entry | 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 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);
}
} | [
"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",
")",
";",
"}",
"}"
] | Print the provided message if the input trace component allows entry
level messages.
@param tc
@param methodName
@param obj | [
"Print",
"the",
"provided",
"message",
"if",
"the",
"input",
"trace",
"component",
"allows",
"entry",
"level",
"messages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/Tr.java#L254-L260 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/Tr.java | Tr.error | public static final void error(TraceComponent tc, String msg) {
com.ibm.websphere.ras.Tr.error(tc, msg);
} | java | public static final void error(TraceComponent tc, String msg) {
com.ibm.websphere.ras.Tr.error(tc, msg);
} | [
"public",
"static",
"final",
"void",
"error",
"(",
"TraceComponent",
"tc",
",",
"String",
"msg",
")",
"{",
"com",
".",
"ibm",
".",
"websphere",
".",
"ras",
".",
"Tr",
".",
"error",
"(",
"tc",
",",
"msg",
")",
";",
"}"
] | Print the provided message if the input trace component allows error
level messages.
@param tc
@param msg | [
"Print",
"the",
"provided",
"message",
"if",
"the",
"input",
"trace",
"component",
"allows",
"error",
"level",
"messages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/Tr.java#L269-L271 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/Tr.java | Tr.exit | public static final void exit(TraceComponent tc, String methodName, Object obj) {
com.ibm.websphere.ras.Tr.exit(tc, methodName, obj);
} | java | public static final void exit(TraceComponent tc, String methodName, Object obj) {
com.ibm.websphere.ras.Tr.exit(tc, methodName, obj);
} | [
"public",
"static",
"final",
"void",
"exit",
"(",
"TraceComponent",
"tc",
",",
"String",
"methodName",
",",
"Object",
"obj",
")",
"{",
"com",
".",
"ibm",
".",
"websphere",
".",
"ras",
".",
"Tr",
".",
"exit",
"(",
"tc",
",",
"methodName",
",",
"obj",
")",
";",
"}"
] | Print the provided message if the input trace component allows exit level
messages.
@param tc
@param methodName
@param obj | [
"Print",
"the",
"provided",
"message",
"if",
"the",
"input",
"trace",
"component",
"allows",
"exit",
"level",
"messages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/Tr.java#L335-L337 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/session/internal/IDGenerator.java | IDGenerator.getID | 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 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;
} | [
"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",
";",
"}"
] | Request the next random ID field from the generator.
@return String | [
"Request",
"the",
"next",
"random",
"ID",
"field",
"from",
"the",
"generator",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/session/internal/IDGenerator.java#L95-L105 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/MatchResponse.java | MatchResponse.merge | 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 | 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);
}
} | [
"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",
")",
";",
"}",
"}"
] | Merges the roles, sslRequired, and accessPrecluded fields according to the
Servlet 2.3 and 3.0 specifications.
@param matchResponse
@return | [
"Merges",
"the",
"roles",
"sslRequired",
"and",
"accessPrecluded",
"fields",
"according",
"to",
"the",
"Servlet",
"2",
".",
"3",
"and",
"3",
".",
"0",
"specifications",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/MatchResponse.java#L140-L149 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/MatchResponse.java | MatchResponse.mergeSSLRequired | 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 | 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;
} | [
"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",
";",
"}"
] | Merges the sslRequired fields.
For exact match, SSL not required takes precedence.
For path matches of equal length and extension match, SSL required takes precedence.
@param otherSSLRequired
@return | [
"Merges",
"the",
"sslRequired",
"fields",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/MatchResponse.java#L160-L168 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/StartupServletContextListener.java | StartupServletContextListener._publishManagedBeanDestroyerListener | private void _publishManagedBeanDestroyerListener(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
Map<String, Object> applicationMap = externalContext.getApplicationMap();
applicationMap.put(ManagedBeanDestroyerListener.APPLICATION_MAP_KEY, _detroyerListener);
} | java | private void _publishManagedBeanDestroyerListener(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
Map<String, Object> applicationMap = externalContext.getApplicationMap();
applicationMap.put(ManagedBeanDestroyerListener.APPLICATION_MAP_KEY, _detroyerListener);
} | [
"private",
"void",
"_publishManagedBeanDestroyerListener",
"(",
"FacesContext",
"facesContext",
")",
"{",
"ExternalContext",
"externalContext",
"=",
"facesContext",
".",
"getExternalContext",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"applicationMap",
"=",
"externalContext",
".",
"getApplicationMap",
"(",
")",
";",
"applicationMap",
".",
"put",
"(",
"ManagedBeanDestroyerListener",
".",
"APPLICATION_MAP_KEY",
",",
"_detroyerListener",
")",
";",
"}"
] | Publishes the ManagedBeanDestroyerListener instance in the application map.
This allows the FacesConfigurator to access the instance and to set the
correct ManagedBeanDestroyer instance on it.
@param facesContext | [
"Publishes",
"the",
"ManagedBeanDestroyerListener",
"instance",
"in",
"the",
"application",
"map",
".",
"This",
"allows",
"the",
"FacesConfigurator",
"to",
"access",
"the",
"instance",
"and",
"to",
"set",
"the",
"correct",
"ManagedBeanDestroyer",
"instance",
"on",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/StartupServletContextListener.java#L142-L148 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/StartupServletContextListener.java | StartupServletContextListener.setFacesInitializer | 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 | 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);
}
} | [
"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",
")",
";",
"}",
"}"
] | configure the faces initializer
@param facesInitializer | [
"configure",
"the",
"faces",
"initializer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/StartupServletContextListener.java#L186-L197 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/StartupServletContextListener.java | StartupServletContextListener.dispatchInitializationEvent | 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 | 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");
} | [
"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\"",
")",
";",
"}"
] | the central initialisation event dispatcher which calls
our listeners
@param event
@param operation | [
"the",
"central",
"initialisation",
"event",
"dispatcher",
"which",
"calls",
"our",
"listeners"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/StartupServletContextListener.java#L300-L342 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java | ConversationHelperImpl.unsetAsynchConsumer | 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 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");
} | [
"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\"",
")",
";",
"}"
] | Sends a request to unset the asynchronous consumer. | [
"Sends",
"a",
"request",
"to",
"unset",
"the",
"asynchronous",
"consumer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java#L104-L173 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java | ConversationHelperImpl.setAsynchConsumer | 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 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");
} | [
"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\"",
")",
";",
"}"
] | Sends a request to set the asynchronous consumer.
@param consumer
@param maxActiveMessages
@param messageLockExpiry
@param maxBatchSize
@param orderContext
@param maxSequentialFailures
@param hiddenMessageDelay | [
"Sends",
"a",
"request",
"to",
"set",
"the",
"asynchronous",
"consumer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java#L186-L300 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java | ConversationHelperImpl.exchangeStop | 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 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");
} | [
"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\"",
")",
";",
"}"
] | Sends a request to stop the session. | [
"Sends",
"a",
"request",
"to",
"stop",
"the",
"session",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java#L363-L421 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java | ConversationHelperImpl.deleteMessages | 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 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");
} | [
"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\"",
")",
";",
"}"
] | Deletes a set of messages based on their IDs in the scope
of a specific transaction.
@param msgIDs
@param tran
@param priority | [
"Deletes",
"a",
"set",
"of",
"messages",
"based",
"on",
"their",
"IDs",
"in",
"the",
"scope",
"of",
"a",
"specific",
"transaction",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java#L599-L698 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java | ConversationHelperImpl.setSessionId | 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 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");
} | [
"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\"",
")",
";",
"}"
] | This method will set the ID of the session that we will
flow to the server to identify us.
This method can only be called once.
@param sessionId The session ID. | [
"This",
"method",
"will",
"set",
"the",
"ID",
"of",
"the",
"session",
"that",
"we",
"will",
"flow",
"to",
"the",
"server",
"to",
"identify",
"us",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java#L771-L795 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CacheingMatcher.java | CacheingMatcher.get | 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 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");
} | [
"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\"",
")",
";",
"}"
] | get delegates and also caches and reports whether there are any tests below
this point in the tree. | [
"get",
"delegates",
"and",
"also",
"caches",
"and",
"reports",
"whether",
"there",
"are",
"any",
"tests",
"below",
"this",
"point",
"in",
"the",
"tree",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CacheingMatcher.java#L76-L92 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CacheingMatcher.java | CacheingMatcher.remove | 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 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;
} | [
"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",
";",
"}"
] | Remove just delegates | [
"Remove",
"just",
"delegates"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/CacheingMatcher.java#L95-L110 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java | DynamicPushbackInputStream.shrink | 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 | 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;
} | [
"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",
";",
"}"
] | Shrink the buffer. This will reclaim currently unused space in the buffer, reducing memory but potentially
increasing the cost of resizing the buffer | [
"Shrink",
"the",
"buffer",
".",
"This",
"will",
"reclaim",
"currently",
"unused",
"space",
"in",
"the",
"buffer",
"reducing",
"memory",
"but",
"potentially",
"increasing",
"the",
"cost",
"of",
"resizing",
"the",
"buffer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java#L62-L94 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/RRSNoTransactionWrapper.java | RRSNoTransactionWrapper.isRRSTransactional | @Override
public boolean isRRSTransactional() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, hexId() + ":isRRSTransactional()=" + true);
}
return true;
} | java | @Override
public boolean isRRSTransactional() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, hexId() + ":isRRSTransactional()=" + true);
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"isRRSTransactional",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"hexId",
"(",
")",
"+",
"\":isRRSTransactional()=\"",
"+",
"true",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Indicate whether this TranWrapper is RRS transactional | [
"Indicate",
"whether",
"this",
"TranWrapper",
"is",
"RRS",
"transactional"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/RRSNoTransactionWrapper.java#L81-L87 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java | FaceletViewDeclarationLanguage.createCompiler | 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 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;
} | [
"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",
";",
"}"
] | Creates the Facelet page compiler.
@param context
the current FacesContext
@return the application's Facelet page compiler | [
"Creates",
"the",
"Facelet",
"page",
"compiler",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java#L2173-L2184 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java | FaceletViewDeclarationLanguage.createFaceletFactory | 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 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);
} | [
"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",
")",
";",
"}"
] | Creates a FaceletFactory instance using the specified compiler.
@param context
the current FacesContext
@param compiler
the compiler to be used by the factory
@return the factory used by this VDL to load pages | [
"Creates",
"a",
"FaceletFactory",
"instance",
"using",
"the",
"specified",
"compiler",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java#L2196-L2236 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java | FaceletViewDeclarationLanguage.getResponseContentType | 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 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;
} | [
"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",
";",
"}"
] | Generate the content type
@param context
@param orig
@return | [
"Generate",
"the",
"content",
"type"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java#L2343-L2366 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java | FaceletViewDeclarationLanguage.getResponseEncoding | 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 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;
} | [
"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",
";",
"}"
] | Generate the encoding
@param context
@param orig
@return | [
"Generate",
"the",
"encoding"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java#L2375-L2422 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java | FaceletViewDeclarationLanguage.initialize | 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 | 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");
} | [
"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\"",
")",
";",
"}"
] | Initialize the ViewHandler during its first request. | [
"Initialize",
"the",
"ViewHandler",
"during",
"its",
"first",
"request",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java#L2467-L2494 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java | FaceletViewDeclarationLanguage._getFacelet | 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 | 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);
}
} | [
"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",
")",
";",
"}",
"}"
] | Gets the Facelet representing the specified view identifier.
@param viewId
the view identifier
@return the Facelet representing the specified view identifier
@throws IOException
if a read or parsing error occurs | [
"Gets",
"the",
"Facelet",
"representing",
"the",
"specified",
"view",
"identifier",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java#L2577-L2589 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/jta/embeddable/impl/EmbeddableTMHelper.java | EmbeddableTMHelper.retrieveBundleContext | @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 | @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;
} | [
"@",
"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",
";",
"}"
] | This method retrieves bundle context from the the ws.tx.embeddable bundle so that if that
bundle has started before the tx.jta bundle, then we are still able to access the Service Registry.
@return | [
"This",
"method",
"retrieves",
"bundle",
"context",
"from",
"the",
"the",
"ws",
".",
"tx",
".",
"embeddable",
"bundle",
"so",
"that",
"if",
"that",
"bundle",
"has",
"started",
"before",
"the",
"tx",
".",
"jta",
"bundle",
"then",
"we",
"are",
"still",
"able",
"to",
"access",
"the",
"Service",
"Registry",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/jta/embeddable/impl/EmbeddableTMHelper.java#L46-L58 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.setRequestBufferSize | 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 | 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;
} | [
"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",
";",
"}"
] | Sets the size of the request buffer. If work has been
dispatched on this thread pool, the behavior of this
method and all subsequent calls to this pool are
undefined.
As a result of the request buffer size being set the
expansion limit of the buffer is set to be 10
times greater than the newly configured buffer size. | [
"Sets",
"the",
"size",
"of",
"the",
"request",
"buffer",
".",
"If",
"work",
"has",
"been",
"dispatched",
"on",
"this",
"thread",
"pool",
"the",
"behavior",
"of",
"this",
"method",
"and",
"all",
"subsequent",
"calls",
"to",
"this",
"pool",
"are",
"undefined",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L605-L618 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.addThread | @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
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;
}
} | [
"@",
"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",
";",
"}",
"}"
] | Create and start a thread to handle a new command. Call only
when holding lock.
@deprecated This will be private in a future release. | [
"Create",
"and",
"start",
"a",
"thread",
"to",
"handle",
"a",
"new",
"command",
".",
"Call",
"only",
"when",
"holding",
"lock",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L633-L676 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.createThreads | @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
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;
} | [
"@",
"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",
";",
"}"
] | Create and start up to numberOfThreads threads in the pool.
Return the number created. This may be less than the number
requested if creating more would exceed maximum pool size bound.
@deprecated This method will go away in a future release. All
thread creation should be done lazily. | [
"Create",
"and",
"start",
"up",
"to",
"numberOfThreads",
"threads",
"in",
"the",
"pool",
".",
"Return",
"the",
"number",
"created",
".",
"This",
"may",
"be",
"less",
"than",
"the",
"number",
"requested",
"if",
"creating",
"more",
"would",
"exceed",
"maximum",
"pool",
"size",
"bound",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L709-L725 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.workerDone | @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 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_);
} | [
"@",
"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_",
")",
";",
"}"
] | Cleanup method called upon termination of worker thread.
@deprecated This will become private in a future release. | [
"Cleanup",
"method",
"called",
"upon",
"termination",
"of",
"worker",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L837-L853 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.getTask | @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 | @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;
} | [
"@",
"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",
";",
"}"
] | Get a task from the handoff queue, or null if shutting down.
@deprecated This will become private in a future release. | [
"Get",
"a",
"task",
"from",
"the",
"handoff",
"queue",
"or",
"null",
"if",
"shutting",
"down",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L861-L937 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.setDecoratedZOS | 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 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;
}
} | [
"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",
";",
"}",
"}"
] | sets this thread pool to create threads which are decorated via
setupThreadStub | [
"sets",
"this",
"thread",
"pool",
"to",
"create",
"threads",
"which",
"are",
"decorated",
"via",
"setupThreadStub"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L1010-L1026 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.executeOnDaemon | 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 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();
} | [
"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",
"(",
")",
";",
"}"
] | Dispatch work on a daemon thread. This thread is not accounted
for in the pool. There are no corresponding
ThreadPoolListener events. There is no MonitorPlugin support. | [
"Dispatch",
"work",
"on",
"a",
"daemon",
"thread",
".",
"This",
"thread",
"is",
"not",
"accounted",
"for",
"in",
"the",
"pool",
".",
"There",
"are",
"no",
"corresponding",
"ThreadPoolListener",
"events",
".",
"There",
"is",
"no",
"MonitorPlugin",
"support",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L1066-L1089 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.execute | public void execute(Runnable command, int blockingMode) throws InterruptedException, ThreadPoolQueueIsFullException, IllegalStateException { // D186668
execute(command, blockingMode, 0);
} | java | public void execute(Runnable command, int blockingMode) throws InterruptedException, ThreadPoolQueueIsFullException, IllegalStateException { // D186668
execute(command, blockingMode, 0);
} | [
"public",
"void",
"execute",
"(",
"Runnable",
"command",
",",
"int",
"blockingMode",
")",
"throws",
"InterruptedException",
",",
"ThreadPoolQueueIsFullException",
",",
"IllegalStateException",
"{",
"// D186668",
"execute",
"(",
"command",
",",
"blockingMode",
",",
"0",
")",
";",
"}"
] | Arrange for the given command to be executed by a thread in this
pool. The call's behavior when the pool and its internal request
queue are at full capacity is determined by the blockingMode.
@param command
- the work to be dispatched.
@param blockingMode
- specifies whether this call will block
until capacity becomes available(WAIT_WHEN_QUEUE_IS_FULL) or
throws an exception (ERROR_WHEN_QUEUE_IS_FULL).
@see #WAIT_WHEN_QUEUE_IS_FULL
@see #ERROR_WHEN_QUEUE_IS_FULL | [
"Arrange",
"for",
"the",
"given",
"command",
"to",
"be",
"executed",
"by",
"a",
"thread",
"in",
"this",
"pool",
".",
"The",
"call",
"s",
"behavior",
"when",
"the",
"pool",
"and",
"its",
"internal",
"request",
"queue",
"are",
"at",
"full",
"capacity",
"is",
"determined",
"by",
"the",
"blockingMode",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L1133-L1135 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.