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
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/DeferredService.java | DeferredService.deregisterDeferredService | public void deregisterDeferredService() {
Object obj = serviceReg.get();
if (obj == null) {
// already deregistered so there is nothing to be done
return;
}
if (obj instanceof CountDownLatch) {
// If someone else has the latch, then let them do whatever they are doing and we pretend
// we've already done the deregister.
return;
} else if (obj instanceof ServiceRegistration<?>) {
CountDownLatch latch = new CountDownLatch(1);
if (serviceReg.compareAndSet(obj, latch)) {
// This thread won the right to deregister the service
try {
((ServiceRegistration<?>) obj).unregister();
// successfully deregistered - nothing more to do
return;
} finally {
// if the serviceReg was not updated for any reason, we need to restore the previous value
serviceReg.compareAndSet(latch, obj);
// in any case we need to allow any blocked threads to proceed
latch.countDown();
}
}
}
} | java | public void deregisterDeferredService() {
Object obj = serviceReg.get();
if (obj == null) {
// already deregistered so there is nothing to be done
return;
}
if (obj instanceof CountDownLatch) {
// If someone else has the latch, then let them do whatever they are doing and we pretend
// we've already done the deregister.
return;
} else if (obj instanceof ServiceRegistration<?>) {
CountDownLatch latch = new CountDownLatch(1);
if (serviceReg.compareAndSet(obj, latch)) {
// This thread won the right to deregister the service
try {
((ServiceRegistration<?>) obj).unregister();
// successfully deregistered - nothing more to do
return;
} finally {
// if the serviceReg was not updated for any reason, we need to restore the previous value
serviceReg.compareAndSet(latch, obj);
// in any case we need to allow any blocked threads to proceed
latch.countDown();
}
}
}
} | [
"public",
"void",
"deregisterDeferredService",
"(",
")",
"{",
"Object",
"obj",
"=",
"serviceReg",
".",
"get",
"(",
")",
";",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"// already deregistered so there is nothing to be done",
"return",
";",
"}",
"if",
"(",
"obj",
"instanceof",
"CountDownLatch",
")",
"{",
"// If someone else has the latch, then let them do whatever they are doing and we pretend",
"// we've already done the deregister.",
"return",
";",
"}",
"else",
"if",
"(",
"obj",
"instanceof",
"ServiceRegistration",
"<",
"?",
">",
")",
"{",
"CountDownLatch",
"latch",
"=",
"new",
"CountDownLatch",
"(",
"1",
")",
";",
"if",
"(",
"serviceReg",
".",
"compareAndSet",
"(",
"obj",
",",
"latch",
")",
")",
"{",
"// This thread won the right to deregister the service",
"try",
"{",
"(",
"(",
"ServiceRegistration",
"<",
"?",
">",
")",
"obj",
")",
".",
"unregister",
"(",
")",
";",
"// successfully deregistered - nothing more to do",
"return",
";",
"}",
"finally",
"{",
"// if the serviceReg was not updated for any reason, we need to restore the previous value",
"serviceReg",
".",
"compareAndSet",
"(",
"latch",
",",
"obj",
")",
";",
"// in any case we need to allow any blocked threads to proceed",
"latch",
".",
"countDown",
"(",
")",
";",
"}",
"}",
"}",
"}"
] | Unregister information provided after class loader was created | [
"Unregister",
"information",
"provided",
"after",
"class",
"loader",
"was",
"created"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/DeferredService.java#L89-L116 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc_fat_postgresql/fat/src/com/ibm/ws/jdbc/fat/postgresql/CustomPostgreSQLContainer.java | CustomPostgreSQLContainer.withConfigOption | public SELF withConfigOption(String key, String value) {
if (key == null) {
throw new java.lang.NullPointerException("key marked @NonNull but is null");
}
if (value == null) {
throw new java.lang.NullPointerException("value marked @NonNull but is null");
}
options.put(key, value);
return self();
} | java | public SELF withConfigOption(String key, String value) {
if (key == null) {
throw new java.lang.NullPointerException("key marked @NonNull but is null");
}
if (value == null) {
throw new java.lang.NullPointerException("value marked @NonNull but is null");
}
options.put(key, value);
return self();
} | [
"public",
"SELF",
"withConfigOption",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"java",
".",
"lang",
".",
"NullPointerException",
"(",
"\"key marked @NonNull but is null\"",
")",
";",
"}",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"java",
".",
"lang",
".",
"NullPointerException",
"(",
"\"value marked @NonNull but is null\"",
")",
";",
"}",
"options",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"self",
"(",
")",
";",
"}"
] | Add additional configuration options that should be used for this container.
@param key The PostgreSQL configuration option key. For example: "max_connections"
@param value The PostgreSQL configuration option value. For example: "200"
@return this | [
"Add",
"additional",
"configuration",
"options",
"that",
"should",
"be",
"used",
"for",
"this",
"container",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc_fat_postgresql/fat/src/com/ibm/ws/jdbc/fat/postgresql/CustomPostgreSQLContainer.java#L26-L35 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.getStateStream | public StateStream getStateStream()
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "getStateStream");
SibTr.exit(tc, "getStateStream", oststream);
}
return oststream;
} | java | public StateStream getStateStream()
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "getStateStream");
SibTr.exit(tc, "getStateStream", oststream);
}
return oststream;
} | [
"public",
"StateStream",
"getStateStream",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getStateStream\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getStateStream\"",
",",
"oststream",
")",
";",
"}",
"return",
"oststream",
";",
"}"
] | Used for debug | [
"Used",
"for",
"debug"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L355-L363 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.writeSilence | public boolean writeSilence(SIMPMessage m) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilence", new Object[] { m });
boolean sendMessage = true;
JsMessage jsMsg = m.getMessage();
// There may be Completed ticks after the Value, if so then
// write these into the stream too
long stamp = jsMsg.getGuaranteedValueValueTick();
long start = jsMsg.getGuaranteedValueStartTick();
long end = jsMsg.getGuaranteedValueEndTick();
if (end < stamp)
end = stamp;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeSilence from: " + start + " to " + end + " on Stream " + stream);
}
TickRange tr =
new TickRange(
TickRange.Completed,
start,
end);
// used to send message if it moves inside inDoubt window
List sendList = null;
synchronized (this)
{
oststream.writeCompletedRange(tr);
sendMessage = msgCanBeSent(stamp, false);
if( sendMessage )
{
if ( stamp > lastMsgSent )
lastMsgSent = stamp;
}
// Check whether removing this message means we have
// a message to send
TickRange tr1 = null;
if ((tr1 = msgRemoved(stamp, oststream, null)) != null)
{
sendList = new ArrayList();
sendList.add(tr1);
if(tr1.valuestamp > lastMsgSent)
lastMsgSent = tr1.valuestamp;
}
// SIB0105
// Message silenced so reset the health state if we've solved a blocking problem
if (blockedStreamAlarm != null)
blockedStreamAlarm.checkState(false);
} // synchronized
// Do the send outside of the synchronise
if (sendList != null)
{
sendMsgs( sendList, false );
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilence");
return sendMessage;
} | java | public boolean writeSilence(SIMPMessage m) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilence", new Object[] { m });
boolean sendMessage = true;
JsMessage jsMsg = m.getMessage();
// There may be Completed ticks after the Value, if so then
// write these into the stream too
long stamp = jsMsg.getGuaranteedValueValueTick();
long start = jsMsg.getGuaranteedValueStartTick();
long end = jsMsg.getGuaranteedValueEndTick();
if (end < stamp)
end = stamp;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeSilence from: " + start + " to " + end + " on Stream " + stream);
}
TickRange tr =
new TickRange(
TickRange.Completed,
start,
end);
// used to send message if it moves inside inDoubt window
List sendList = null;
synchronized (this)
{
oststream.writeCompletedRange(tr);
sendMessage = msgCanBeSent(stamp, false);
if( sendMessage )
{
if ( stamp > lastMsgSent )
lastMsgSent = stamp;
}
// Check whether removing this message means we have
// a message to send
TickRange tr1 = null;
if ((tr1 = msgRemoved(stamp, oststream, null)) != null)
{
sendList = new ArrayList();
sendList.add(tr1);
if(tr1.valuestamp > lastMsgSent)
lastMsgSent = tr1.valuestamp;
}
// SIB0105
// Message silenced so reset the health state if we've solved a blocking problem
if (blockedStreamAlarm != null)
blockedStreamAlarm.checkState(false);
} // synchronized
// Do the send outside of the synchronise
if (sendList != null)
{
sendMsgs( sendList, false );
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilence");
return sendMessage;
} | [
"public",
"boolean",
"writeSilence",
"(",
"SIMPMessage",
"m",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"writeSilence\"",
",",
"new",
"Object",
"[",
"]",
"{",
"m",
"}",
")",
";",
"boolean",
"sendMessage",
"=",
"true",
";",
"JsMessage",
"jsMsg",
"=",
"m",
".",
"getMessage",
"(",
")",
";",
"// There may be Completed ticks after the Value, if so then",
"// write these into the stream too",
"long",
"stamp",
"=",
"jsMsg",
".",
"getGuaranteedValueValueTick",
"(",
")",
";",
"long",
"start",
"=",
"jsMsg",
".",
"getGuaranteedValueStartTick",
"(",
")",
";",
"long",
"end",
"=",
"jsMsg",
".",
"getGuaranteedValueEndTick",
"(",
")",
";",
"if",
"(",
"end",
"<",
"stamp",
")",
"end",
"=",
"stamp",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"writeSilence from: \"",
"+",
"start",
"+",
"\" to \"",
"+",
"end",
"+",
"\" on Stream \"",
"+",
"stream",
")",
";",
"}",
"TickRange",
"tr",
"=",
"new",
"TickRange",
"(",
"TickRange",
".",
"Completed",
",",
"start",
",",
"end",
")",
";",
"// used to send message if it moves inside inDoubt window",
"List",
"sendList",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"oststream",
".",
"writeCompletedRange",
"(",
"tr",
")",
";",
"sendMessage",
"=",
"msgCanBeSent",
"(",
"stamp",
",",
"false",
")",
";",
"if",
"(",
"sendMessage",
")",
"{",
"if",
"(",
"stamp",
">",
"lastMsgSent",
")",
"lastMsgSent",
"=",
"stamp",
";",
"}",
"// Check whether removing this message means we have",
"// a message to send",
"TickRange",
"tr1",
"=",
"null",
";",
"if",
"(",
"(",
"tr1",
"=",
"msgRemoved",
"(",
"stamp",
",",
"oststream",
",",
"null",
")",
")",
"!=",
"null",
")",
"{",
"sendList",
"=",
"new",
"ArrayList",
"(",
")",
";",
"sendList",
".",
"add",
"(",
"tr1",
")",
";",
"if",
"(",
"tr1",
".",
"valuestamp",
">",
"lastMsgSent",
")",
"lastMsgSent",
"=",
"tr1",
".",
"valuestamp",
";",
"}",
"// SIB0105",
"// Message silenced so reset the health state if we've solved a blocking problem",
"if",
"(",
"blockedStreamAlarm",
"!=",
"null",
")",
"blockedStreamAlarm",
".",
"checkState",
"(",
"false",
")",
";",
"}",
"// synchronized",
"// Do the send outside of the synchronise",
"if",
"(",
"sendList",
"!=",
"null",
")",
"{",
"sendMsgs",
"(",
"sendList",
",",
"false",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"writeSilence\"",
")",
";",
"return",
"sendMessage",
";",
"}"
] | This method uses a Value message to write Silence into the stream,
because a message has been rolled back
@param m The value message
@exception GDException Can be thrown from the writeCompletedRange method
@return boolean true if the message can be sent downstream
this is determined by the sendWindow | [
"This",
"method",
"uses",
"a",
"Value",
"message",
"to",
"write",
"Silence",
"into",
"the",
"stream",
"because",
"a",
"message",
"has",
"been",
"rolled",
"back"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L546-L615 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.writeSilenceForced | public boolean writeSilenceForced(SIMPMessage m) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilenceForced", new Object[] { m });
boolean msgRemoved = true;
JsMessage jsMsg = m.getMessage();
long start = jsMsg.getGuaranteedValueStartTick();
long end = jsMsg.getGuaranteedValueEndTick();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeSilenceForced from: " + start + " to " + end + " on Stream " + stream);
}
TickRange tr =
new TickRange(
TickRange.Completed,
start,
end);
// used to send message if it moves inside inDoubt window
List sendList = null;
synchronized (this)
{
// If the tick of the new silence has already been set to completed then
// the message must already have been processed (either sent+acked or already
// silenced) either way, we should class it as a 'removed' message.
// This fixes a problem where a message is nacked,sent and acked all in the
// window between setting it as a value and actually trying to lock it (in PtoPOutputHandler)
// prior to sending it. In this situation, the message no longer exists in the
// MsgStore, so PtoPOutputHandler believed it had expired, which then calls this
// method to try to remove it - decrementing the totalMessage count and messing
// up future sendWindow calculations (which can leave messages left unsent).
if(end <= getCompletedPrefix())
{
msgRemoved = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Message " + end + " already completed", m);
}
else
{
oststream.writeCompletedRangeForced(tr);
// Check whether removing this message means we have
// a message to send
TickRange str = null;
if ( (str = msgRemoved(jsMsg.getGuaranteedValueValueTick(), oststream, null)) != null)
{
sendList = new LinkedList();
sendList.add(str);
if(str.valuestamp > lastMsgSent)
lastMsgSent = str.valuestamp;
}
}
}
// Do the send outside of the synchronise
if (sendList != null)
{
sendMsgs( sendList, false );
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilenceForced", Boolean.valueOf(msgRemoved));
return msgRemoved;
} | java | public boolean writeSilenceForced(SIMPMessage m) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilenceForced", new Object[] { m });
boolean msgRemoved = true;
JsMessage jsMsg = m.getMessage();
long start = jsMsg.getGuaranteedValueStartTick();
long end = jsMsg.getGuaranteedValueEndTick();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeSilenceForced from: " + start + " to " + end + " on Stream " + stream);
}
TickRange tr =
new TickRange(
TickRange.Completed,
start,
end);
// used to send message if it moves inside inDoubt window
List sendList = null;
synchronized (this)
{
// If the tick of the new silence has already been set to completed then
// the message must already have been processed (either sent+acked or already
// silenced) either way, we should class it as a 'removed' message.
// This fixes a problem where a message is nacked,sent and acked all in the
// window between setting it as a value and actually trying to lock it (in PtoPOutputHandler)
// prior to sending it. In this situation, the message no longer exists in the
// MsgStore, so PtoPOutputHandler believed it had expired, which then calls this
// method to try to remove it - decrementing the totalMessage count and messing
// up future sendWindow calculations (which can leave messages left unsent).
if(end <= getCompletedPrefix())
{
msgRemoved = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Message " + end + " already completed", m);
}
else
{
oststream.writeCompletedRangeForced(tr);
// Check whether removing this message means we have
// a message to send
TickRange str = null;
if ( (str = msgRemoved(jsMsg.getGuaranteedValueValueTick(), oststream, null)) != null)
{
sendList = new LinkedList();
sendList.add(str);
if(str.valuestamp > lastMsgSent)
lastMsgSent = str.valuestamp;
}
}
}
// Do the send outside of the synchronise
if (sendList != null)
{
sendMsgs( sendList, false );
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilenceForced", Boolean.valueOf(msgRemoved));
return msgRemoved;
} | [
"public",
"boolean",
"writeSilenceForced",
"(",
"SIMPMessage",
"m",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"writeSilenceForced\"",
",",
"new",
"Object",
"[",
"]",
"{",
"m",
"}",
")",
";",
"boolean",
"msgRemoved",
"=",
"true",
";",
"JsMessage",
"jsMsg",
"=",
"m",
".",
"getMessage",
"(",
")",
";",
"long",
"start",
"=",
"jsMsg",
".",
"getGuaranteedValueStartTick",
"(",
")",
";",
"long",
"end",
"=",
"jsMsg",
".",
"getGuaranteedValueEndTick",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"writeSilenceForced from: \"",
"+",
"start",
"+",
"\" to \"",
"+",
"end",
"+",
"\" on Stream \"",
"+",
"stream",
")",
";",
"}",
"TickRange",
"tr",
"=",
"new",
"TickRange",
"(",
"TickRange",
".",
"Completed",
",",
"start",
",",
"end",
")",
";",
"// used to send message if it moves inside inDoubt window",
"List",
"sendList",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"// If the tick of the new silence has already been set to completed then",
"// the message must already have been processed (either sent+acked or already",
"// silenced) either way, we should class it as a 'removed' message.",
"// This fixes a problem where a message is nacked,sent and acked all in the",
"// window between setting it as a value and actually trying to lock it (in PtoPOutputHandler)",
"// prior to sending it. In this situation, the message no longer exists in the",
"// MsgStore, so PtoPOutputHandler believed it had expired, which then calls this",
"// method to try to remove it - decrementing the totalMessage count and messing",
"// up future sendWindow calculations (which can leave messages left unsent).",
"if",
"(",
"end",
"<=",
"getCompletedPrefix",
"(",
")",
")",
"{",
"msgRemoved",
"=",
"false",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Message \"",
"+",
"end",
"+",
"\" already completed\"",
",",
"m",
")",
";",
"}",
"else",
"{",
"oststream",
".",
"writeCompletedRangeForced",
"(",
"tr",
")",
";",
"// Check whether removing this message means we have",
"// a message to send",
"TickRange",
"str",
"=",
"null",
";",
"if",
"(",
"(",
"str",
"=",
"msgRemoved",
"(",
"jsMsg",
".",
"getGuaranteedValueValueTick",
"(",
")",
",",
"oststream",
",",
"null",
")",
")",
"!=",
"null",
")",
"{",
"sendList",
"=",
"new",
"LinkedList",
"(",
")",
";",
"sendList",
".",
"add",
"(",
"str",
")",
";",
"if",
"(",
"str",
".",
"valuestamp",
">",
"lastMsgSent",
")",
"lastMsgSent",
"=",
"str",
".",
"valuestamp",
";",
"}",
"}",
"}",
"// Do the send outside of the synchronise",
"if",
"(",
"sendList",
"!=",
"null",
")",
"{",
"sendMsgs",
"(",
"sendList",
",",
"false",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"writeSilenceForced\"",
",",
"Boolean",
".",
"valueOf",
"(",
"msgRemoved",
")",
")",
";",
"return",
"msgRemoved",
";",
"}"
] | This method uses a Value message to write Silence into the stream,
because a message which was a Guess is being removed from the stream
It forces the stream to be updated to Silence without checking the
existing state
@param m The value message | [
"This",
"method",
"uses",
"a",
"Value",
"message",
"to",
"write",
"Silence",
"into",
"the",
"stream",
"because",
"a",
"message",
"which",
"was",
"a",
"Guess",
"is",
"being",
"removed",
"from",
"the",
"stream",
"It",
"forces",
"the",
"stream",
"to",
"be",
"updated",
"to",
"Silence",
"without",
"checking",
"the",
"existing",
"state"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L627-L699 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.writeSilenceForced | public void writeSilenceForced(TickRange vtr) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilenceForced", new Object[] { vtr });
long start = vtr.startstamp;
long end = vtr.endstamp;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeSilenceForced from: " + start + " to " + end + " on Stream " + stream);
}
TickRange tr =
new TickRange(
TickRange.Completed,
start,
end );
// used to send message if it moves inside inDoubt window
List sendList = null;
synchronized (this)
{
oststream.writeCompletedRangeForced(tr);
// Check whether removing this message means we have
// a message to send
TickRange str = null;
if ( (str = msgRemoved(vtr.valuestamp, oststream, null)) != null)
{
sendList = new LinkedList();
sendList.add(str);
if(str.valuestamp > lastMsgSent)
lastMsgSent = str.valuestamp;
}
}
// Do the send outside of the synchronise
if (sendList != null)
{
sendMsgs( sendList, false );
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilenceForced");
} | java | public void writeSilenceForced(TickRange vtr) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilenceForced", new Object[] { vtr });
long start = vtr.startstamp;
long end = vtr.endstamp;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeSilenceForced from: " + start + " to " + end + " on Stream " + stream);
}
TickRange tr =
new TickRange(
TickRange.Completed,
start,
end );
// used to send message if it moves inside inDoubt window
List sendList = null;
synchronized (this)
{
oststream.writeCompletedRangeForced(tr);
// Check whether removing this message means we have
// a message to send
TickRange str = null;
if ( (str = msgRemoved(vtr.valuestamp, oststream, null)) != null)
{
sendList = new LinkedList();
sendList.add(str);
if(str.valuestamp > lastMsgSent)
lastMsgSent = str.valuestamp;
}
}
// Do the send outside of the synchronise
if (sendList != null)
{
sendMsgs( sendList, false );
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilenceForced");
} | [
"public",
"void",
"writeSilenceForced",
"(",
"TickRange",
"vtr",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"writeSilenceForced\"",
",",
"new",
"Object",
"[",
"]",
"{",
"vtr",
"}",
")",
";",
"long",
"start",
"=",
"vtr",
".",
"startstamp",
";",
"long",
"end",
"=",
"vtr",
".",
"endstamp",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"writeSilenceForced from: \"",
"+",
"start",
"+",
"\" to \"",
"+",
"end",
"+",
"\" on Stream \"",
"+",
"stream",
")",
";",
"}",
"TickRange",
"tr",
"=",
"new",
"TickRange",
"(",
"TickRange",
".",
"Completed",
",",
"start",
",",
"end",
")",
";",
"// used to send message if it moves inside inDoubt window",
"List",
"sendList",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"oststream",
".",
"writeCompletedRangeForced",
"(",
"tr",
")",
";",
"// Check whether removing this message means we have",
"// a message to send",
"TickRange",
"str",
"=",
"null",
";",
"if",
"(",
"(",
"str",
"=",
"msgRemoved",
"(",
"vtr",
".",
"valuestamp",
",",
"oststream",
",",
"null",
")",
")",
"!=",
"null",
")",
"{",
"sendList",
"=",
"new",
"LinkedList",
"(",
")",
";",
"sendList",
".",
"add",
"(",
"str",
")",
";",
"if",
"(",
"str",
".",
"valuestamp",
">",
"lastMsgSent",
")",
"lastMsgSent",
"=",
"str",
".",
"valuestamp",
";",
"}",
"}",
"// Do the send outside of the synchronise",
"if",
"(",
"sendList",
"!=",
"null",
")",
"{",
"sendMsgs",
"(",
"sendList",
",",
"false",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"writeSilenceForced\"",
")",
";",
"}"
] | This method uses a Value TickRange to write Silence into the stream,
because a message has expired before it was sent and so needs to be removed
from the stream
It forces the stream to be updated to Silence without checking the
existing state
@param m The value tickRange | [
"This",
"method",
"uses",
"a",
"Value",
"TickRange",
"to",
"write",
"Silence",
"into",
"the",
"stream",
"because",
"a",
"message",
"has",
"expired",
"before",
"it",
"was",
"sent",
"and",
"so",
"needs",
"to",
"be",
"removed",
"from",
"the",
"stream",
"It",
"forces",
"the",
"stream",
"to",
"be",
"updated",
"to",
"Silence",
"without",
"checking",
"the",
"existing",
"state"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L712-L759 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.writeSilenceForced | public void writeSilenceForced(long tick) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilenceForced", Long.valueOf(tick) );
// Details of the new silence
long startTick = -1;
long endTick = -1;
long completedPrefix = -1;
// used to send message if it moves inside inDoubt window
List sendList = null;
synchronized (this)
{
oststream.setCursor(tick);
// Get the TickRange containing this tick
TickRange tr = oststream.getNext();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeSilenceForced from: " + tr.startstamp + " to " + tr.endstamp + " on Stream " + stream);
}
TickRange silenceRange = oststream.writeCompletedRangeForced(tr);
// While we have the stream locked cache the details of the new completed
// range
if(silenceRange != null)
{
startTick = silenceRange.startstamp;
endTick = silenceRange.endstamp;
completedPrefix = getCompletedPrefix();
}
// Check whether removing this message means we have
// a message to send
TickRange str = null;
if ( (str = msgRemoved(tick, oststream, null)) != null)
{
sendList = new LinkedList();
sendList.add(str);
if(str.valuestamp > lastMsgSent)
lastMsgSent = str.valuestamp;
}
}
// Do the send outside of the synchronise
// If we created a new completed (silenced) range then we actually send this to the
// target ME. If we don't do this it's possible for the target to never realise that
// this message has been explicitly deleted (via the MBeans), and therefore, if there's
// a problem with the message it will never know to give up trying to process it, which
// could leave the stream blocked until an ME re-start.
if(startTick != -1)
{
downControl.sendSilenceMessage(startTick,
endTick,
completedPrefix,
false,
priority,
reliability,
stream);
}
if (sendList != null)
{
sendMsgs( sendList, false );
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilenceForced");
} | java | public void writeSilenceForced(long tick) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeSilenceForced", Long.valueOf(tick) );
// Details of the new silence
long startTick = -1;
long endTick = -1;
long completedPrefix = -1;
// used to send message if it moves inside inDoubt window
List sendList = null;
synchronized (this)
{
oststream.setCursor(tick);
// Get the TickRange containing this tick
TickRange tr = oststream.getNext();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeSilenceForced from: " + tr.startstamp + " to " + tr.endstamp + " on Stream " + stream);
}
TickRange silenceRange = oststream.writeCompletedRangeForced(tr);
// While we have the stream locked cache the details of the new completed
// range
if(silenceRange != null)
{
startTick = silenceRange.startstamp;
endTick = silenceRange.endstamp;
completedPrefix = getCompletedPrefix();
}
// Check whether removing this message means we have
// a message to send
TickRange str = null;
if ( (str = msgRemoved(tick, oststream, null)) != null)
{
sendList = new LinkedList();
sendList.add(str);
if(str.valuestamp > lastMsgSent)
lastMsgSent = str.valuestamp;
}
}
// Do the send outside of the synchronise
// If we created a new completed (silenced) range then we actually send this to the
// target ME. If we don't do this it's possible for the target to never realise that
// this message has been explicitly deleted (via the MBeans), and therefore, if there's
// a problem with the message it will never know to give up trying to process it, which
// could leave the stream blocked until an ME re-start.
if(startTick != -1)
{
downControl.sendSilenceMessage(startTick,
endTick,
completedPrefix,
false,
priority,
reliability,
stream);
}
if (sendList != null)
{
sendMsgs( sendList, false );
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeSilenceForced");
} | [
"public",
"void",
"writeSilenceForced",
"(",
"long",
"tick",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"writeSilenceForced\"",
",",
"Long",
".",
"valueOf",
"(",
"tick",
")",
")",
";",
"// Details of the new silence",
"long",
"startTick",
"=",
"-",
"1",
";",
"long",
"endTick",
"=",
"-",
"1",
";",
"long",
"completedPrefix",
"=",
"-",
"1",
";",
"// used to send message if it moves inside inDoubt window",
"List",
"sendList",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"oststream",
".",
"setCursor",
"(",
"tick",
")",
";",
"// Get the TickRange containing this tick ",
"TickRange",
"tr",
"=",
"oststream",
".",
"getNext",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"writeSilenceForced from: \"",
"+",
"tr",
".",
"startstamp",
"+",
"\" to \"",
"+",
"tr",
".",
"endstamp",
"+",
"\" on Stream \"",
"+",
"stream",
")",
";",
"}",
"TickRange",
"silenceRange",
"=",
"oststream",
".",
"writeCompletedRangeForced",
"(",
"tr",
")",
";",
"// While we have the stream locked cache the details of the new completed",
"// range",
"if",
"(",
"silenceRange",
"!=",
"null",
")",
"{",
"startTick",
"=",
"silenceRange",
".",
"startstamp",
";",
"endTick",
"=",
"silenceRange",
".",
"endstamp",
";",
"completedPrefix",
"=",
"getCompletedPrefix",
"(",
")",
";",
"}",
"// Check whether removing this message means we have",
"// a message to send",
"TickRange",
"str",
"=",
"null",
";",
"if",
"(",
"(",
"str",
"=",
"msgRemoved",
"(",
"tick",
",",
"oststream",
",",
"null",
")",
")",
"!=",
"null",
")",
"{",
"sendList",
"=",
"new",
"LinkedList",
"(",
")",
";",
"sendList",
".",
"add",
"(",
"str",
")",
";",
"if",
"(",
"str",
".",
"valuestamp",
">",
"lastMsgSent",
")",
"lastMsgSent",
"=",
"str",
".",
"valuestamp",
";",
"}",
"}",
"// Do the send outside of the synchronise",
"// If we created a new completed (silenced) range then we actually send this to the",
"// target ME. If we don't do this it's possible for the target to never realise that",
"// this message has been explicitly deleted (via the MBeans), and therefore, if there's",
"// a problem with the message it will never know to give up trying to process it, which",
"// could leave the stream blocked until an ME re-start.",
"if",
"(",
"startTick",
"!=",
"-",
"1",
")",
"{",
"downControl",
".",
"sendSilenceMessage",
"(",
"startTick",
",",
"endTick",
",",
"completedPrefix",
",",
"false",
",",
"priority",
",",
"reliability",
",",
"stream",
")",
";",
"}",
"if",
"(",
"sendList",
"!=",
"null",
")",
"{",
"sendMsgs",
"(",
"sendList",
",",
"false",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"writeSilenceForced\"",
")",
";",
"}"
] | This replaces the specified tick with Silence
without checking the existing state
@param m The tick to be removed from the stream | [
"This",
"replaces",
"the",
"specified",
"tick",
"with",
"Silence",
"without",
"checking",
"the",
"existing",
"state"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L769-L843 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.writeAckPrefix | public List writeAckPrefix(long stamp)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeAckPrefix", Long.valueOf(stamp));
// Holds TickRanges of all Value ticks between AckPrefix
// and completedPrefix
// This is returned to the caller
List<TickRange> indexList = new ArrayList<TickRange>();
synchronized (this)
{
// SIB0105
// Update controllable health state if poss
if (stamp >= lastAckExpTick)
{
getControlAdapter().getHealthState().updateHealth(HealthStateListener.ACK_EXPECTED_STATE,
HealthState.GREEN);
// Disable the checking until another ackExpected is sent
lastAckExpTick = Long.MAX_VALUE;
}
if (stamp >= lastNackReceivedTick)
{
getControlAdapter().getHealthState().updateHealth(HealthStateListener.NACK_RECEIVED_STATE,
HealthState.GREEN);
// Disable the checking until another ackExpected is sent
lastNackReceivedTick = Long.MAX_VALUE;
}
inboundFlow = true;
long completedPrefix = oststream.getCompletedPrefix();
if (stamp > completedPrefix)
{
// Retrieve all Value ticks between completedPrefix and stamp
oststream.setCursor(completedPrefix + 1);
// Get the first TickRange
TickRange tr = oststream.getNext();
TickRange tr2 = null;
while ((tr.startstamp <= stamp) && (tr != tr2))
{
if (tr.type == TickRange.Value)
{
indexList.add(tr);
totalMessagesSent++;
timeLastMsgSent = System.currentTimeMillis();
}
else if (tr.type != TickRange.Completed)
{
//See defect 278043:
//The remote ME is trying to ACK a tick that we do not understand.
//Perhaps we went down just after the message was sent and the
//message was lost from our message store, so that it is now UNKNOWN.
//We do not want to stop processing this ACK however, as that
//would mean that there will always be a hole and we will eventually
//hit the sendMsgWindow.
//We should log the event in trace & FFDC and then continue
//to process the ack.
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc,
"Invalid message found processing ack stamp "
+ stamp + ": completed prefix " + completedPrefix,
tr);
}
//ffdc incase trace is not enabled, but we do not go on to
//throw this exception
InvalidMessageException invalidMessageException =
new InvalidMessageException();
FFDCFilter.processException(
invalidMessageException,
"com.ibm.ws.sib.processor.gd.SourceStream.writeAckPrefix",
"1:981:1.138",
this,
new Object[]{Long.valueOf(stamp), Long.valueOf(completedPrefix), tr});
// We only want to force any unknown ranges to 'completed' up to
// the ack'd tick, beyond that should stay 'unknown' so we crop the
// current TickRange to be up to the ack'd tick.
long endstamp = tr.endstamp;
if(endstamp > stamp)
endstamp = stamp;
TickRange completedTr =
new TickRange(
TickRange.Completed,
tr.startstamp,
endstamp );
oststream.writeCompletedRangeForced(completedTr);
}
tr2 = tr;
tr = oststream.getNext(); // get next TickRange
} // end while
// 513948
// If we acked more messages than the sendWindow then we need to grow the sendwindow
// to be bigger than the definedSendWindow. This will reduce back down to the correct value
// when the msgs are removed. We also set the correct firstMsgOutsideWindow at this point.
if (indexList.size() > sendWindow)
{
sendWindow = indexList.size(); // Dont need to persist - this will be done when msg removed
// Find the firstMsgOutsideWindow if it exists
while( tr.type == TickRange.Completed && tr.endstamp != RangeList.INFINITY)
tr = oststream.getNext();
firstMsgOutsideWindow = tr.valuestamp;
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "firstMsgOutsideWindow: " + firstMsgOutsideWindow + ", sendWindow: " + sendWindow);
}
oststream.setCompletedPrefix(stamp);
// May have moved beyond stamp if there were adjacent
// Completed ticks
oack = oststream.getCompletedPrefix();
}
} // end sync
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeAckPrefix", Boolean.FALSE);
return indexList;
} | java | public List writeAckPrefix(long stamp)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeAckPrefix", Long.valueOf(stamp));
// Holds TickRanges of all Value ticks between AckPrefix
// and completedPrefix
// This is returned to the caller
List<TickRange> indexList = new ArrayList<TickRange>();
synchronized (this)
{
// SIB0105
// Update controllable health state if poss
if (stamp >= lastAckExpTick)
{
getControlAdapter().getHealthState().updateHealth(HealthStateListener.ACK_EXPECTED_STATE,
HealthState.GREEN);
// Disable the checking until another ackExpected is sent
lastAckExpTick = Long.MAX_VALUE;
}
if (stamp >= lastNackReceivedTick)
{
getControlAdapter().getHealthState().updateHealth(HealthStateListener.NACK_RECEIVED_STATE,
HealthState.GREEN);
// Disable the checking until another ackExpected is sent
lastNackReceivedTick = Long.MAX_VALUE;
}
inboundFlow = true;
long completedPrefix = oststream.getCompletedPrefix();
if (stamp > completedPrefix)
{
// Retrieve all Value ticks between completedPrefix and stamp
oststream.setCursor(completedPrefix + 1);
// Get the first TickRange
TickRange tr = oststream.getNext();
TickRange tr2 = null;
while ((tr.startstamp <= stamp) && (tr != tr2))
{
if (tr.type == TickRange.Value)
{
indexList.add(tr);
totalMessagesSent++;
timeLastMsgSent = System.currentTimeMillis();
}
else if (tr.type != TickRange.Completed)
{
//See defect 278043:
//The remote ME is trying to ACK a tick that we do not understand.
//Perhaps we went down just after the message was sent and the
//message was lost from our message store, so that it is now UNKNOWN.
//We do not want to stop processing this ACK however, as that
//would mean that there will always be a hole and we will eventually
//hit the sendMsgWindow.
//We should log the event in trace & FFDC and then continue
//to process the ack.
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc,
"Invalid message found processing ack stamp "
+ stamp + ": completed prefix " + completedPrefix,
tr);
}
//ffdc incase trace is not enabled, but we do not go on to
//throw this exception
InvalidMessageException invalidMessageException =
new InvalidMessageException();
FFDCFilter.processException(
invalidMessageException,
"com.ibm.ws.sib.processor.gd.SourceStream.writeAckPrefix",
"1:981:1.138",
this,
new Object[]{Long.valueOf(stamp), Long.valueOf(completedPrefix), tr});
// We only want to force any unknown ranges to 'completed' up to
// the ack'd tick, beyond that should stay 'unknown' so we crop the
// current TickRange to be up to the ack'd tick.
long endstamp = tr.endstamp;
if(endstamp > stamp)
endstamp = stamp;
TickRange completedTr =
new TickRange(
TickRange.Completed,
tr.startstamp,
endstamp );
oststream.writeCompletedRangeForced(completedTr);
}
tr2 = tr;
tr = oststream.getNext(); // get next TickRange
} // end while
// 513948
// If we acked more messages than the sendWindow then we need to grow the sendwindow
// to be bigger than the definedSendWindow. This will reduce back down to the correct value
// when the msgs are removed. We also set the correct firstMsgOutsideWindow at this point.
if (indexList.size() > sendWindow)
{
sendWindow = indexList.size(); // Dont need to persist - this will be done when msg removed
// Find the firstMsgOutsideWindow if it exists
while( tr.type == TickRange.Completed && tr.endstamp != RangeList.INFINITY)
tr = oststream.getNext();
firstMsgOutsideWindow = tr.valuestamp;
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "firstMsgOutsideWindow: " + firstMsgOutsideWindow + ", sendWindow: " + sendWindow);
}
oststream.setCompletedPrefix(stamp);
// May have moved beyond stamp if there were adjacent
// Completed ticks
oack = oststream.getCompletedPrefix();
}
} // end sync
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeAckPrefix", Boolean.FALSE);
return indexList;
} | [
"public",
"List",
"writeAckPrefix",
"(",
"long",
"stamp",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"writeAckPrefix\"",
",",
"Long",
".",
"valueOf",
"(",
"stamp",
")",
")",
";",
"// Holds TickRanges of all Value ticks between AckPrefix",
"// and completedPrefix",
"// This is returned to the caller",
"List",
"<",
"TickRange",
">",
"indexList",
"=",
"new",
"ArrayList",
"<",
"TickRange",
">",
"(",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"// SIB0105",
"// Update controllable health state if poss",
"if",
"(",
"stamp",
">=",
"lastAckExpTick",
")",
"{",
"getControlAdapter",
"(",
")",
".",
"getHealthState",
"(",
")",
".",
"updateHealth",
"(",
"HealthStateListener",
".",
"ACK_EXPECTED_STATE",
",",
"HealthState",
".",
"GREEN",
")",
";",
"// Disable the checking until another ackExpected is sent",
"lastAckExpTick",
"=",
"Long",
".",
"MAX_VALUE",
";",
"}",
"if",
"(",
"stamp",
">=",
"lastNackReceivedTick",
")",
"{",
"getControlAdapter",
"(",
")",
".",
"getHealthState",
"(",
")",
".",
"updateHealth",
"(",
"HealthStateListener",
".",
"NACK_RECEIVED_STATE",
",",
"HealthState",
".",
"GREEN",
")",
";",
"// Disable the checking until another ackExpected is sent",
"lastNackReceivedTick",
"=",
"Long",
".",
"MAX_VALUE",
";",
"}",
"inboundFlow",
"=",
"true",
";",
"long",
"completedPrefix",
"=",
"oststream",
".",
"getCompletedPrefix",
"(",
")",
";",
"if",
"(",
"stamp",
">",
"completedPrefix",
")",
"{",
"// Retrieve all Value ticks between completedPrefix and stamp",
"oststream",
".",
"setCursor",
"(",
"completedPrefix",
"+",
"1",
")",
";",
"// Get the first TickRange",
"TickRange",
"tr",
"=",
"oststream",
".",
"getNext",
"(",
")",
";",
"TickRange",
"tr2",
"=",
"null",
";",
"while",
"(",
"(",
"tr",
".",
"startstamp",
"<=",
"stamp",
")",
"&&",
"(",
"tr",
"!=",
"tr2",
")",
")",
"{",
"if",
"(",
"tr",
".",
"type",
"==",
"TickRange",
".",
"Value",
")",
"{",
"indexList",
".",
"add",
"(",
"tr",
")",
";",
"totalMessagesSent",
"++",
";",
"timeLastMsgSent",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"}",
"else",
"if",
"(",
"tr",
".",
"type",
"!=",
"TickRange",
".",
"Completed",
")",
"{",
"//See defect 278043:",
"//The remote ME is trying to ACK a tick that we do not understand.",
"//Perhaps we went down just after the message was sent and the",
"//message was lost from our message store, so that it is now UNKNOWN.",
"//We do not want to stop processing this ACK however, as that",
"//would mean that there will always be a hole and we will eventually",
"//hit the sendMsgWindow.",
"//We should log the event in trace & FFDC and then continue",
"//to process the ack.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Invalid message found processing ack stamp \"",
"+",
"stamp",
"+",
"\": completed prefix \"",
"+",
"completedPrefix",
",",
"tr",
")",
";",
"}",
"//ffdc incase trace is not enabled, but we do not go on to",
"//throw this exception",
"InvalidMessageException",
"invalidMessageException",
"=",
"new",
"InvalidMessageException",
"(",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"invalidMessageException",
",",
"\"com.ibm.ws.sib.processor.gd.SourceStream.writeAckPrefix\"",
",",
"\"1:981:1.138\"",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"Long",
".",
"valueOf",
"(",
"stamp",
")",
",",
"Long",
".",
"valueOf",
"(",
"completedPrefix",
")",
",",
"tr",
"}",
")",
";",
"// We only want to force any unknown ranges to 'completed' up to",
"// the ack'd tick, beyond that should stay 'unknown' so we crop the",
"// current TickRange to be up to the ack'd tick.",
"long",
"endstamp",
"=",
"tr",
".",
"endstamp",
";",
"if",
"(",
"endstamp",
">",
"stamp",
")",
"endstamp",
"=",
"stamp",
";",
"TickRange",
"completedTr",
"=",
"new",
"TickRange",
"(",
"TickRange",
".",
"Completed",
",",
"tr",
".",
"startstamp",
",",
"endstamp",
")",
";",
"oststream",
".",
"writeCompletedRangeForced",
"(",
"completedTr",
")",
";",
"}",
"tr2",
"=",
"tr",
";",
"tr",
"=",
"oststream",
".",
"getNext",
"(",
")",
";",
"// get next TickRange",
"}",
"// end while",
"// 513948",
"// If we acked more messages than the sendWindow then we need to grow the sendwindow",
"// to be bigger than the definedSendWindow. This will reduce back down to the correct value",
"// when the msgs are removed. We also set the correct firstMsgOutsideWindow at this point.",
"if",
"(",
"indexList",
".",
"size",
"(",
")",
">",
"sendWindow",
")",
"{",
"sendWindow",
"=",
"indexList",
".",
"size",
"(",
")",
";",
"// Dont need to persist - this will be done when msg removed",
"// Find the firstMsgOutsideWindow if it exists",
"while",
"(",
"tr",
".",
"type",
"==",
"TickRange",
".",
"Completed",
"&&",
"tr",
".",
"endstamp",
"!=",
"RangeList",
".",
"INFINITY",
")",
"tr",
"=",
"oststream",
".",
"getNext",
"(",
")",
";",
"firstMsgOutsideWindow",
"=",
"tr",
".",
"valuestamp",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"firstMsgOutsideWindow: \"",
"+",
"firstMsgOutsideWindow",
"+",
"\", sendWindow: \"",
"+",
"sendWindow",
")",
";",
"}",
"oststream",
".",
"setCompletedPrefix",
"(",
"stamp",
")",
";",
"// May have moved beyond stamp if there were adjacent",
"// Completed ticks",
"oack",
"=",
"oststream",
".",
"getCompletedPrefix",
"(",
")",
";",
"}",
"}",
"// end sync",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"writeAckPrefix\"",
",",
"Boolean",
".",
"FALSE",
")",
";",
"return",
"indexList",
";",
"}"
] | This method is called when all the messages up to the ackPrefix
have been acknowledged. For pointTopoint this is called when an Ack
message is recieved from the target. For pubsub this is called when
all the InternalOutputStreams associated with this SourceStream have
received Ack messages.
@param stamp The ackPrefix
@exception GDException
@return List of MessagesIds of messages to delete from the ItemStream | [
"This",
"method",
"is",
"called",
"when",
"all",
"the",
"messages",
"up",
"to",
"the",
"ackPrefix",
"have",
"been",
"acknowledged",
".",
"For",
"pointTopoint",
"this",
"is",
"called",
"when",
"an",
"Ack",
"message",
"is",
"recieved",
"from",
"the",
"target",
".",
"For",
"pubsub",
"this",
"is",
"called",
"when",
"all",
"the",
"InternalOutputStreams",
"associated",
"with",
"this",
"SourceStream",
"have",
"received",
"Ack",
"messages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L859-L987 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.restoreUncommitted | public void restoreUncommitted(SIMPMessage m)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "restoreUncommitted", new Object[] { m });
TickRange tr = null;
JsMessage jsMsg = m.getMessage();
long stamp = jsMsg.getGuaranteedValueValueTick();
long starts = jsMsg.getGuaranteedValueStartTick();
long ends = jsMsg.getGuaranteedValueEndTick();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "restoreUncommitted at: " + stamp + " on Stream " + stream);
}
synchronized (this)
{
// write into stream
tr = TickRange.newUncommittedTick(stamp);
tr.startstamp = starts;
tr.endstamp = ends;
// Save message in the stream while it is Uncommitted
// It will be replaced by its index in the ItemStream once it becomes a Value
tr.value = m;
oststream.writeCombinedRange(tr);
} // end synchronized
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restoreUncommitted");
} | java | public void restoreUncommitted(SIMPMessage m)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "restoreUncommitted", new Object[] { m });
TickRange tr = null;
JsMessage jsMsg = m.getMessage();
long stamp = jsMsg.getGuaranteedValueValueTick();
long starts = jsMsg.getGuaranteedValueStartTick();
long ends = jsMsg.getGuaranteedValueEndTick();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "restoreUncommitted at: " + stamp + " on Stream " + stream);
}
synchronized (this)
{
// write into stream
tr = TickRange.newUncommittedTick(stamp);
tr.startstamp = starts;
tr.endstamp = ends;
// Save message in the stream while it is Uncommitted
// It will be replaced by its index in the ItemStream once it becomes a Value
tr.value = m;
oststream.writeCombinedRange(tr);
} // end synchronized
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restoreUncommitted");
} | [
"public",
"void",
"restoreUncommitted",
"(",
"SIMPMessage",
"m",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"restoreUncommitted\"",
",",
"new",
"Object",
"[",
"]",
"{",
"m",
"}",
")",
";",
"TickRange",
"tr",
"=",
"null",
";",
"JsMessage",
"jsMsg",
"=",
"m",
".",
"getMessage",
"(",
")",
";",
"long",
"stamp",
"=",
"jsMsg",
".",
"getGuaranteedValueValueTick",
"(",
")",
";",
"long",
"starts",
"=",
"jsMsg",
".",
"getGuaranteedValueStartTick",
"(",
")",
";",
"long",
"ends",
"=",
"jsMsg",
".",
"getGuaranteedValueEndTick",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"restoreUncommitted at: \"",
"+",
"stamp",
"+",
"\" on Stream \"",
"+",
"stream",
")",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"// write into stream",
"tr",
"=",
"TickRange",
".",
"newUncommittedTick",
"(",
"stamp",
")",
";",
"tr",
".",
"startstamp",
"=",
"starts",
";",
"tr",
".",
"endstamp",
"=",
"ends",
";",
"// Save message in the stream while it is Uncommitted",
"// It will be replaced by its index in the ItemStream once it becomes a Value",
"tr",
".",
"value",
"=",
"m",
";",
"oststream",
".",
"writeCombinedRange",
"(",
"tr",
")",
";",
"}",
"// end synchronized",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"restoreUncommitted\"",
")",
";",
"}"
] | This method uses a Value message to write an Uncommitted tick
into the stream.
It is called at retore time.
@param m The value message to write to the stream | [
"This",
"method",
"uses",
"a",
"Value",
"message",
"to",
"write",
"an",
"Uncommitted",
"tick",
"into",
"the",
"stream",
".",
"It",
"is",
"called",
"at",
"retore",
"time",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L1371-L1407 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.restoreValue | public void restoreValue(SIMPMessage m) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "restoreValue", m);
TickRange tr = null;
long msgStoreId = AbstractItem.NO_ID;
try
{
if (m.isInStore())
msgStoreId = m.getID();
}
catch(MessageStoreException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.gd.SourceStream.restoreValue",
"1:1484:1.138",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restoreValue", e);
throw new SIResourceException(e);
}
JsMessage jsMsg = m.getMessage();
long stamp = jsMsg.getGuaranteedValueValueTick();
long starts = jsMsg.getGuaranteedValueStartTick();
long ends = jsMsg.getGuaranteedValueEndTick();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "restoreValue at: " + stamp + " with Silence from: " + starts + " to " + ends + " on Stream " + stream);
}
synchronized (this)
{
// Now update Value tick to indicate it is now committed
tr = TickRange.newValueTick(stamp, null, msgStoreId);
tr.startstamp = starts;
tr.endstamp = ends;
oststream.writeCombinedRange(tr);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restoreValue");
} | java | public void restoreValue(SIMPMessage m) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "restoreValue", m);
TickRange tr = null;
long msgStoreId = AbstractItem.NO_ID;
try
{
if (m.isInStore())
msgStoreId = m.getID();
}
catch(MessageStoreException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.gd.SourceStream.restoreValue",
"1:1484:1.138",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restoreValue", e);
throw new SIResourceException(e);
}
JsMessage jsMsg = m.getMessage();
long stamp = jsMsg.getGuaranteedValueValueTick();
long starts = jsMsg.getGuaranteedValueStartTick();
long ends = jsMsg.getGuaranteedValueEndTick();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "restoreValue at: " + stamp + " with Silence from: " + starts + " to " + ends + " on Stream " + stream);
}
synchronized (this)
{
// Now update Value tick to indicate it is now committed
tr = TickRange.newValueTick(stamp, null, msgStoreId);
tr.startstamp = starts;
tr.endstamp = ends;
oststream.writeCombinedRange(tr);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restoreValue");
} | [
"public",
"void",
"restoreValue",
"(",
"SIMPMessage",
"m",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"restoreValue\"",
",",
"m",
")",
";",
"TickRange",
"tr",
"=",
"null",
";",
"long",
"msgStoreId",
"=",
"AbstractItem",
".",
"NO_ID",
";",
"try",
"{",
"if",
"(",
"m",
".",
"isInStore",
"(",
")",
")",
"msgStoreId",
"=",
"m",
".",
"getID",
"(",
")",
";",
"}",
"catch",
"(",
"MessageStoreException",
"e",
")",
"{",
"// FFDC",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.gd.SourceStream.restoreValue\"",
",",
"\"1:1484:1.138\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"restoreValue\"",
",",
"e",
")",
";",
"throw",
"new",
"SIResourceException",
"(",
"e",
")",
";",
"}",
"JsMessage",
"jsMsg",
"=",
"m",
".",
"getMessage",
"(",
")",
";",
"long",
"stamp",
"=",
"jsMsg",
".",
"getGuaranteedValueValueTick",
"(",
")",
";",
"long",
"starts",
"=",
"jsMsg",
".",
"getGuaranteedValueStartTick",
"(",
")",
";",
"long",
"ends",
"=",
"jsMsg",
".",
"getGuaranteedValueEndTick",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"restoreValue at: \"",
"+",
"stamp",
"+",
"\" with Silence from: \"",
"+",
"starts",
"+",
"\" to \"",
"+",
"ends",
"+",
"\" on Stream \"",
"+",
"stream",
")",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"// Now update Value tick to indicate it is now committed",
"tr",
"=",
"TickRange",
".",
"newValueTick",
"(",
"stamp",
",",
"null",
",",
"msgStoreId",
")",
";",
"tr",
".",
"startstamp",
"=",
"starts",
";",
"tr",
".",
"endstamp",
"=",
"ends",
";",
"oststream",
".",
"writeCombinedRange",
"(",
"tr",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"restoreValue\"",
")",
";",
"}"
] | This method uses a Value message to write a Value tick
into the stream.
It is called at retore time.
@param m The value message to write to the stream | [
"This",
"method",
"uses",
"a",
"Value",
"message",
"to",
"write",
"a",
"Value",
"tick",
"into",
"the",
"stream",
".",
"It",
"is",
"called",
"at",
"retore",
"time",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L1417-L1472 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.newGuessInStream | public synchronized void newGuessInStream(long tick) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "newGuessInStream", new Object[] { Long.valueOf(tick),
Boolean.valueOf(containsGuesses),
Long.valueOf(sendWindow),
Long.valueOf(totalMessages),
Long.valueOf(firstMsgOutsideWindow)});
// If this is the first guess in the stream
if( !containsGuesses)
{
containsGuesses=true;
if( sendWindow > totalMessages )
{
sendWindow = totalMessages;
persistSendWindow(sendWindow, null);
firstMsgOutsideWindow = tick;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "newGuessInStream", new Object[] {Boolean.valueOf(containsGuesses),
Long.valueOf(sendWindow),
Long.valueOf(firstMsgOutsideWindow)});
} | java | public synchronized void newGuessInStream(long tick) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "newGuessInStream", new Object[] { Long.valueOf(tick),
Boolean.valueOf(containsGuesses),
Long.valueOf(sendWindow),
Long.valueOf(totalMessages),
Long.valueOf(firstMsgOutsideWindow)});
// If this is the first guess in the stream
if( !containsGuesses)
{
containsGuesses=true;
if( sendWindow > totalMessages )
{
sendWindow = totalMessages;
persistSendWindow(sendWindow, null);
firstMsgOutsideWindow = tick;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "newGuessInStream", new Object[] {Boolean.valueOf(containsGuesses),
Long.valueOf(sendWindow),
Long.valueOf(firstMsgOutsideWindow)});
} | [
"public",
"synchronized",
"void",
"newGuessInStream",
"(",
"long",
"tick",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"newGuessInStream\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Long",
".",
"valueOf",
"(",
"tick",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"containsGuesses",
")",
",",
"Long",
".",
"valueOf",
"(",
"sendWindow",
")",
",",
"Long",
".",
"valueOf",
"(",
"totalMessages",
")",
",",
"Long",
".",
"valueOf",
"(",
"firstMsgOutsideWindow",
")",
"}",
")",
";",
"// If this is the first guess in the stream ",
"if",
"(",
"!",
"containsGuesses",
")",
"{",
"containsGuesses",
"=",
"true",
";",
"if",
"(",
"sendWindow",
">",
"totalMessages",
")",
"{",
"sendWindow",
"=",
"totalMessages",
";",
"persistSendWindow",
"(",
"sendWindow",
",",
"null",
")",
";",
"firstMsgOutsideWindow",
"=",
"tick",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"newGuessInStream\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Boolean",
".",
"valueOf",
"(",
"containsGuesses",
")",
",",
"Long",
".",
"valueOf",
"(",
"sendWindow",
")",
",",
"Long",
".",
"valueOf",
"(",
"firstMsgOutsideWindow",
")",
"}",
")",
";",
"}"
] | Also called by writeUncomitted when a guess is written into the stream | [
"Also",
"called",
"by",
"writeUncomitted",
"when",
"a",
"guess",
"is",
"written",
"into",
"the",
"stream"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L1815-L1841 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.guessesInStream | public synchronized void guessesInStream()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "guessesInStream", Boolean.valueOf(containsGuesses));
containsGuesses = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "guessesInStream", Boolean.valueOf(containsGuesses));
} | java | public synchronized void guessesInStream()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "guessesInStream", Boolean.valueOf(containsGuesses));
containsGuesses = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "guessesInStream", Boolean.valueOf(containsGuesses));
} | [
"public",
"synchronized",
"void",
"guessesInStream",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"guessesInStream\"",
",",
"Boolean",
".",
"valueOf",
"(",
"containsGuesses",
")",
")",
";",
"containsGuesses",
"=",
"true",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"guessesInStream\"",
",",
"Boolean",
".",
"valueOf",
"(",
"containsGuesses",
")",
")",
";",
"}"
] | any messages while some are being reallocated | [
"any",
"messages",
"while",
"some",
"are",
"being",
"reallocated"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L1845-L1854 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.noGuessesInStream | public synchronized void noGuessesInStream() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "noGuessesInStream");
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "oldContainesGuesses:" + containsGuesses +
"firstMsgOutsideWindow: " + firstMsgOutsideWindow +
", oldSendWindow: " + sendWindow);
containsGuesses = false;
// If we have reduced our sendWindow below the definedSendWindow
// we now need to send all the messages between the two
if( definedSendWindow > sendWindow )
{
long oldSendWindow = sendWindow;
sendWindow = definedSendWindow;
persistSendWindow(sendWindow, null);
// Send the messages up to the new send window
// this will update firstMsgOutsideWindow
sendMsgsInWindow(oldSendWindow, sendWindow);
}
else
{
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc,
"no processing : definedSendWindow=" + definedSendWindow +
", sendWindow=" +sendWindow);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "noGuessesInStream");
} | java | public synchronized void noGuessesInStream() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "noGuessesInStream");
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "oldContainesGuesses:" + containsGuesses +
"firstMsgOutsideWindow: " + firstMsgOutsideWindow +
", oldSendWindow: " + sendWindow);
containsGuesses = false;
// If we have reduced our sendWindow below the definedSendWindow
// we now need to send all the messages between the two
if( definedSendWindow > sendWindow )
{
long oldSendWindow = sendWindow;
sendWindow = definedSendWindow;
persistSendWindow(sendWindow, null);
// Send the messages up to the new send window
// this will update firstMsgOutsideWindow
sendMsgsInWindow(oldSendWindow, sendWindow);
}
else
{
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc,
"no processing : definedSendWindow=" + definedSendWindow +
", sendWindow=" +sendWindow);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "noGuessesInStream");
} | [
"public",
"synchronized",
"void",
"noGuessesInStream",
"(",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"noGuessesInStream\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"oldContainesGuesses:\"",
"+",
"containsGuesses",
"+",
"\"firstMsgOutsideWindow: \"",
"+",
"firstMsgOutsideWindow",
"+",
"\", oldSendWindow: \"",
"+",
"sendWindow",
")",
";",
"containsGuesses",
"=",
"false",
";",
"// If we have reduced our sendWindow below the definedSendWindow",
"// we now need to send all the messages between the two ",
"if",
"(",
"definedSendWindow",
">",
"sendWindow",
")",
"{",
"long",
"oldSendWindow",
"=",
"sendWindow",
";",
"sendWindow",
"=",
"definedSendWindow",
";",
"persistSendWindow",
"(",
"sendWindow",
",",
"null",
")",
";",
"// Send the messages up to the new send window",
"// this will update firstMsgOutsideWindow",
"sendMsgsInWindow",
"(",
"oldSendWindow",
",",
"sendWindow",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"no processing : definedSendWindow=\"",
"+",
"definedSendWindow",
"+",
"\", sendWindow=\"",
"+",
"sendWindow",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"noGuessesInStream\"",
")",
";",
"}"
] | ours to send | [
"ours",
"to",
"send"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L1859-L1895 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.initialiseSendWindow | public synchronized void initialiseSendWindow(long sendWindow, long definedSendWindow)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "initialiseSendWindow", new Object[] {Long.valueOf(sendWindow), Long.valueOf(definedSendWindow)} );
// Prior to V7 the sendWindow was not persisted unless it was modified due to a change in
// reachability, otherwise it was stored as INFINITY (Long.MAX_VALUE). Therefore, if the
// defined sendWindow was modified we could be in the situation where before a restart we
// had 1000 messages indoubt, then shut the ME down, changes the defined sendWindow to 50
// and restarted. At that point we'd set the sendWindow to 50 and suddenly we'd have 950
// available messages again (not indoubt). We'd then be allowed to reallocate them elsewhere!
// Luckily, the ability to modify the sendWindow wasn't correctly exposed prior to V7 (it's
// now a custom property), so no-one could have modified it. So, we can interpret a value
// of INFINITY as the original sendWindow value, which is 1000. And use that when we see it.
if( sendWindow == RangeList.INFINITY )
{
this.definedSendWindow = definedSendWindow;
this.sendWindow = 1000; // Original default sendWindow
// Now persist the 1000 to make it clearer
persistSendWindow(this.sendWindow, null);
}
else
{
this.sendWindow = sendWindow;
this.definedSendWindow = definedSendWindow;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialiseSendWindow");
} | java | public synchronized void initialiseSendWindow(long sendWindow, long definedSendWindow)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "initialiseSendWindow", new Object[] {Long.valueOf(sendWindow), Long.valueOf(definedSendWindow)} );
// Prior to V7 the sendWindow was not persisted unless it was modified due to a change in
// reachability, otherwise it was stored as INFINITY (Long.MAX_VALUE). Therefore, if the
// defined sendWindow was modified we could be in the situation where before a restart we
// had 1000 messages indoubt, then shut the ME down, changes the defined sendWindow to 50
// and restarted. At that point we'd set the sendWindow to 50 and suddenly we'd have 950
// available messages again (not indoubt). We'd then be allowed to reallocate them elsewhere!
// Luckily, the ability to modify the sendWindow wasn't correctly exposed prior to V7 (it's
// now a custom property), so no-one could have modified it. So, we can interpret a value
// of INFINITY as the original sendWindow value, which is 1000. And use that when we see it.
if( sendWindow == RangeList.INFINITY )
{
this.definedSendWindow = definedSendWindow;
this.sendWindow = 1000; // Original default sendWindow
// Now persist the 1000 to make it clearer
persistSendWindow(this.sendWindow, null);
}
else
{
this.sendWindow = sendWindow;
this.definedSendWindow = definedSendWindow;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialiseSendWindow");
} | [
"public",
"synchronized",
"void",
"initialiseSendWindow",
"(",
"long",
"sendWindow",
",",
"long",
"definedSendWindow",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"initialiseSendWindow\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Long",
".",
"valueOf",
"(",
"sendWindow",
")",
",",
"Long",
".",
"valueOf",
"(",
"definedSendWindow",
")",
"}",
")",
";",
"// Prior to V7 the sendWindow was not persisted unless it was modified due to a change in",
"// reachability, otherwise it was stored as INFINITY (Long.MAX_VALUE). Therefore, if the",
"// defined sendWindow was modified we could be in the situation where before a restart we",
"// had 1000 messages indoubt, then shut the ME down, changes the defined sendWindow to 50",
"// and restarted. At that point we'd set the sendWindow to 50 and suddenly we'd have 950",
"// available messages again (not indoubt). We'd then be allowed to reallocate them elsewhere!",
"// Luckily, the ability to modify the sendWindow wasn't correctly exposed prior to V7 (it's",
"// now a custom property), so no-one could have modified it. So, we can interpret a value",
"// of INFINITY as the original sendWindow value, which is 1000. And use that when we see it.",
"if",
"(",
"sendWindow",
"==",
"RangeList",
".",
"INFINITY",
")",
"{",
"this",
".",
"definedSendWindow",
"=",
"definedSendWindow",
";",
"this",
".",
"sendWindow",
"=",
"1000",
";",
"// Original default sendWindow",
"// Now persist the 1000 to make it clearer",
"persistSendWindow",
"(",
"this",
".",
"sendWindow",
",",
"null",
")",
";",
"}",
"else",
"{",
"this",
".",
"sendWindow",
"=",
"sendWindow",
";",
"this",
".",
"definedSendWindow",
"=",
"definedSendWindow",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"initialiseSendWindow\"",
")",
";",
"}"
] | this value straight away and also that we don't need to persist it | [
"this",
"value",
"straight",
"away",
"and",
"also",
"that",
"we",
"don",
"t",
"need",
"to",
"persist",
"it"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L1900-L1933 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.setDefinedSendWindow | public synchronized void setDefinedSendWindow(long newSendWindow)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setDefinedSendWindow", Long.valueOf(newSendWindow) );
definedSendWindow = newSendWindow;
// PK41355 - Commenting out - should not be sending stuff at reconstitute
// updateAndPersistSendWindow();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setDefinedSendWindow",Long.valueOf(newSendWindow));
} | java | public synchronized void setDefinedSendWindow(long newSendWindow)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setDefinedSendWindow", Long.valueOf(newSendWindow) );
definedSendWindow = newSendWindow;
// PK41355 - Commenting out - should not be sending stuff at reconstitute
// updateAndPersistSendWindow();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setDefinedSendWindow",Long.valueOf(newSendWindow));
} | [
"public",
"synchronized",
"void",
"setDefinedSendWindow",
"(",
"long",
"newSendWindow",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setDefinedSendWindow\"",
",",
"Long",
".",
"valueOf",
"(",
"newSendWindow",
")",
")",
";",
"definedSendWindow",
"=",
"newSendWindow",
";",
"// PK41355 - Commenting out - should not be sending stuff at reconstitute",
"// updateAndPersistSendWindow();",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setDefinedSendWindow\"",
",",
"Long",
".",
"valueOf",
"(",
"newSendWindow",
")",
")",
";",
"}"
] | This is used to set the sendWindow defined in Admin panels | [
"This",
"is",
"used",
"to",
"set",
"the",
"sendWindow",
"defined",
"in",
"Admin",
"panels"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L1936-L1949 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.updateAndPersistSendWindow | public synchronized void updateAndPersistSendWindow() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "updateAndPersistSendWindow" );
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "definedSendWindow is: " + definedSendWindow
+ " sendWindow is " + sendWindow + " containsGuesses is " + containsGuesses
+ " totalMessages is " + totalMessages);
}
// If our current sendWindow is less than this new value
// we can move to the new value straight away and send
// any messages which were between the two
if( definedSendWindow > sendWindow )
{
// If the stream containsGuesses we can't send
// anything at the moment so we do the code
// below in noGuessesInStream() instead
if (!containsGuesses)
{
long oldSendWindow = sendWindow;
sendWindow = definedSendWindow;
persistSendWindow(sendWindow, null);
// Send the messages up to the new send window
// this will update firstMsgOutsideWindow
sendMsgsInWindow(oldSendWindow, sendWindow);
}
}
else
{
// sendWindow is being reduced
if ( definedSendWindow > totalMessages )
{
// sendWindow is being reduced but is bigger than
// totalMessages so we can just set it
sendWindow = definedSendWindow;
persistSendWindow(sendWindow, null);
}
else if ( totalMessages < sendWindow)
{
sendWindow = totalMessages;
persistSendWindow(sendWindow, null);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "updateAndPersistSendWindow");
} | java | public synchronized void updateAndPersistSendWindow() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "updateAndPersistSendWindow" );
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "definedSendWindow is: " + definedSendWindow
+ " sendWindow is " + sendWindow + " containsGuesses is " + containsGuesses
+ " totalMessages is " + totalMessages);
}
// If our current sendWindow is less than this new value
// we can move to the new value straight away and send
// any messages which were between the two
if( definedSendWindow > sendWindow )
{
// If the stream containsGuesses we can't send
// anything at the moment so we do the code
// below in noGuessesInStream() instead
if (!containsGuesses)
{
long oldSendWindow = sendWindow;
sendWindow = definedSendWindow;
persistSendWindow(sendWindow, null);
// Send the messages up to the new send window
// this will update firstMsgOutsideWindow
sendMsgsInWindow(oldSendWindow, sendWindow);
}
}
else
{
// sendWindow is being reduced
if ( definedSendWindow > totalMessages )
{
// sendWindow is being reduced but is bigger than
// totalMessages so we can just set it
sendWindow = definedSendWindow;
persistSendWindow(sendWindow, null);
}
else if ( totalMessages < sendWindow)
{
sendWindow = totalMessages;
persistSendWindow(sendWindow, null);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "updateAndPersistSendWindow");
} | [
"public",
"synchronized",
"void",
"updateAndPersistSendWindow",
"(",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"updateAndPersistSendWindow\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"definedSendWindow is: \"",
"+",
"definedSendWindow",
"+",
"\" sendWindow is \"",
"+",
"sendWindow",
"+",
"\" containsGuesses is \"",
"+",
"containsGuesses",
"+",
"\" totalMessages is \"",
"+",
"totalMessages",
")",
";",
"}",
"// If our current sendWindow is less than this new value",
"// we can move to the new value straight away and send",
"// any messages which were between the two",
"if",
"(",
"definedSendWindow",
">",
"sendWindow",
")",
"{",
"// If the stream containsGuesses we can't send",
"// anything at the moment so we do the code",
"// below in noGuessesInStream() instead",
"if",
"(",
"!",
"containsGuesses",
")",
"{",
"long",
"oldSendWindow",
"=",
"sendWindow",
";",
"sendWindow",
"=",
"definedSendWindow",
";",
"persistSendWindow",
"(",
"sendWindow",
",",
"null",
")",
";",
"// Send the messages up to the new send window",
"// this will update firstMsgOutsideWindow",
"sendMsgsInWindow",
"(",
"oldSendWindow",
",",
"sendWindow",
")",
";",
"}",
"}",
"else",
"{",
"// sendWindow is being reduced",
"if",
"(",
"definedSendWindow",
">",
"totalMessages",
")",
"{",
"// sendWindow is being reduced but is bigger than ",
"// totalMessages so we can just set it",
"sendWindow",
"=",
"definedSendWindow",
";",
"persistSendWindow",
"(",
"sendWindow",
",",
"null",
")",
";",
"}",
"else",
"if",
"(",
"totalMessages",
"<",
"sendWindow",
")",
"{",
"sendWindow",
"=",
"totalMessages",
";",
"persistSendWindow",
"(",
"sendWindow",
",",
"null",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"updateAndPersistSendWindow\"",
")",
";",
"}"
] | ONLY called from tests | [
"ONLY",
"called",
"from",
"tests"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L1952-L2002 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.msgCanBeSent | private synchronized boolean msgCanBeSent( long stamp, boolean nackMsg )
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "msgCanBeSent", new Object[] { Long.valueOf(stamp),
Boolean.valueOf(nackMsg),
Long.valueOf(firstMsgOutsideWindow),
Boolean.valueOf(containsGuesses)});
boolean sendMessage = true;
// Check whether we can send the message
// Don't send any messages once there is a guess in the stream (unless a NACK)
if ((stamp >= firstMsgOutsideWindow) || (containsGuesses && !nackMsg))
{
sendMessage = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "firstMsgOutsideWindow is: " + firstMsgOutsideWindow
+ " sendWindow is " + sendWindow + " containsGuesses is " + containsGuesses);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "msgCanBeSent", Boolean.valueOf(sendMessage));
return sendMessage;
} | java | private synchronized boolean msgCanBeSent( long stamp, boolean nackMsg )
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "msgCanBeSent", new Object[] { Long.valueOf(stamp),
Boolean.valueOf(nackMsg),
Long.valueOf(firstMsgOutsideWindow),
Boolean.valueOf(containsGuesses)});
boolean sendMessage = true;
// Check whether we can send the message
// Don't send any messages once there is a guess in the stream (unless a NACK)
if ((stamp >= firstMsgOutsideWindow) || (containsGuesses && !nackMsg))
{
sendMessage = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "firstMsgOutsideWindow is: " + firstMsgOutsideWindow
+ " sendWindow is " + sendWindow + " containsGuesses is " + containsGuesses);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "msgCanBeSent", Boolean.valueOf(sendMessage));
return sendMessage;
} | [
"private",
"synchronized",
"boolean",
"msgCanBeSent",
"(",
"long",
"stamp",
",",
"boolean",
"nackMsg",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"msgCanBeSent\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Long",
".",
"valueOf",
"(",
"stamp",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"nackMsg",
")",
",",
"Long",
".",
"valueOf",
"(",
"firstMsgOutsideWindow",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"containsGuesses",
")",
"}",
")",
";",
"boolean",
"sendMessage",
"=",
"true",
";",
"// Check whether we can send the message",
"// Don't send any messages once there is a guess in the stream (unless a NACK)",
"if",
"(",
"(",
"stamp",
">=",
"firstMsgOutsideWindow",
")",
"||",
"(",
"containsGuesses",
"&&",
"!",
"nackMsg",
")",
")",
"{",
"sendMessage",
"=",
"false",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"firstMsgOutsideWindow is: \"",
"+",
"firstMsgOutsideWindow",
"+",
"\" sendWindow is \"",
"+",
"sendWindow",
"+",
"\" containsGuesses is \"",
"+",
"containsGuesses",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"msgCanBeSent\"",
",",
"Boolean",
".",
"valueOf",
"(",
"sendMessage",
")",
")",
";",
"return",
"sendMessage",
";",
"}"
] | Method that determines if the message can be sent.
If the message is a NACK message then we should not check the stream for guesses,
but we should still follow the other checks for the stream.
@param stamp
@return | [
"Method",
"that",
"determines",
"if",
"the",
"message",
"can",
"be",
"sent",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L2037-L2063 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.msgRemoved | private synchronized TickRange msgRemoved(long tick, StateStream ststream, TransactionCommon tran) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "msgRemoved",
new Object[]{Long.valueOf(tick),
ststream,
tran});
TickRange tr1 = null;
boolean sendMessage = false;
long stamp = tick;
// We know we have reduced the number of messages in the stream
totalMessages--;
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "totalMessages: " + totalMessages +
", sendWindow: " + sendWindow +
", definedSendWindow: " + definedSendWindow +
", firstMsgOutsideSendWindow: " + firstMsgOutsideWindow);
// We may not send any messages if our stream contains guesses
// or if we are supposed to be reducing the sendWindow
if( ( (containsGuesses) || (sendWindow > definedSendWindow ) )
&& ( stamp < firstMsgOutsideWindow ) )
{
// Just shrink the sendWindow
if( sendWindow > 0)
{
sendWindow--;
persistSendWindow(sendWindow, tran);
}
}
else
{
// If the message we have just removed from the stream was
// inside the sendWindow then we can move up our
// firstMsgOutsideWindow and possibly send the message which
// moves inside the window
// If it actually was the first message outside the window
// the code below will also work
// If it was beyond the window we can afford to ignore it
if (stamp <= firstMsgOutsideWindow)
{
// send firstMsgOutsideWindow
// first need to get it and check that it is in Value state
ststream.setCursor(firstMsgOutsideWindow);
// Get the first TickRange outside the inDoubt window
tr1 = ststream.getNext();
// This range must be either Uncommitted or Value as that is how
// we set the firstMsgOutsideWindow pointer
// Only want to send this message if it is
// committed. Otherwise do nothing as it will
// get sent when it commits
if (tr1.type == TickRange.Value)
{
sendMessage = true;
}
TickRange tr = null;
if (totalMessages > sendWindow)
{
// Get the next Value or Uncommitted tick from the stream
tr = ststream.getNext();
while( tr.type == TickRange.Completed && tr.endstamp != RangeList.INFINITY)
{
tr = ststream.getNext();
}
firstMsgOutsideWindow = tr.valuestamp;
}
// That was the last message outside the send window, so put us back into a state
// ignorant of guesses, otherwise we may not realise to re-calculate the firstMsgOutSideWindow
// the next time we get a guess.
else
{
firstMsgOutsideWindow = RangeList.INFINITY;
containsGuesses = false;
}
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "firstMsgOutsideSendWindow: " + firstMsgOutsideWindow);
}
}
// Return a null if nothing to send
if (!sendMessage)
tr1 = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "msgRemoved", tr1);
return tr1;
} | java | private synchronized TickRange msgRemoved(long tick, StateStream ststream, TransactionCommon tran) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "msgRemoved",
new Object[]{Long.valueOf(tick),
ststream,
tran});
TickRange tr1 = null;
boolean sendMessage = false;
long stamp = tick;
// We know we have reduced the number of messages in the stream
totalMessages--;
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "totalMessages: " + totalMessages +
", sendWindow: " + sendWindow +
", definedSendWindow: " + definedSendWindow +
", firstMsgOutsideSendWindow: " + firstMsgOutsideWindow);
// We may not send any messages if our stream contains guesses
// or if we are supposed to be reducing the sendWindow
if( ( (containsGuesses) || (sendWindow > definedSendWindow ) )
&& ( stamp < firstMsgOutsideWindow ) )
{
// Just shrink the sendWindow
if( sendWindow > 0)
{
sendWindow--;
persistSendWindow(sendWindow, tran);
}
}
else
{
// If the message we have just removed from the stream was
// inside the sendWindow then we can move up our
// firstMsgOutsideWindow and possibly send the message which
// moves inside the window
// If it actually was the first message outside the window
// the code below will also work
// If it was beyond the window we can afford to ignore it
if (stamp <= firstMsgOutsideWindow)
{
// send firstMsgOutsideWindow
// first need to get it and check that it is in Value state
ststream.setCursor(firstMsgOutsideWindow);
// Get the first TickRange outside the inDoubt window
tr1 = ststream.getNext();
// This range must be either Uncommitted or Value as that is how
// we set the firstMsgOutsideWindow pointer
// Only want to send this message if it is
// committed. Otherwise do nothing as it will
// get sent when it commits
if (tr1.type == TickRange.Value)
{
sendMessage = true;
}
TickRange tr = null;
if (totalMessages > sendWindow)
{
// Get the next Value or Uncommitted tick from the stream
tr = ststream.getNext();
while( tr.type == TickRange.Completed && tr.endstamp != RangeList.INFINITY)
{
tr = ststream.getNext();
}
firstMsgOutsideWindow = tr.valuestamp;
}
// That was the last message outside the send window, so put us back into a state
// ignorant of guesses, otherwise we may not realise to re-calculate the firstMsgOutSideWindow
// the next time we get a guess.
else
{
firstMsgOutsideWindow = RangeList.INFINITY;
containsGuesses = false;
}
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "firstMsgOutsideSendWindow: " + firstMsgOutsideWindow);
}
}
// Return a null if nothing to send
if (!sendMessage)
tr1 = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "msgRemoved", tr1);
return tr1;
} | [
"private",
"synchronized",
"TickRange",
"msgRemoved",
"(",
"long",
"tick",
",",
"StateStream",
"ststream",
",",
"TransactionCommon",
"tran",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"msgRemoved\"",
",",
"new",
"Object",
"[",
"]",
"{",
"Long",
".",
"valueOf",
"(",
"tick",
")",
",",
"ststream",
",",
"tran",
"}",
")",
";",
"TickRange",
"tr1",
"=",
"null",
";",
"boolean",
"sendMessage",
"=",
"false",
";",
"long",
"stamp",
"=",
"tick",
";",
"// We know we have reduced the number of messages in the stream",
"totalMessages",
"--",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"totalMessages: \"",
"+",
"totalMessages",
"+",
"\", sendWindow: \"",
"+",
"sendWindow",
"+",
"\", definedSendWindow: \"",
"+",
"definedSendWindow",
"+",
"\", firstMsgOutsideSendWindow: \"",
"+",
"firstMsgOutsideWindow",
")",
";",
"// We may not send any messages if our stream contains guesses",
"// or if we are supposed to be reducing the sendWindow",
"if",
"(",
"(",
"(",
"containsGuesses",
")",
"||",
"(",
"sendWindow",
">",
"definedSendWindow",
")",
")",
"&&",
"(",
"stamp",
"<",
"firstMsgOutsideWindow",
")",
")",
"{",
"// Just shrink the sendWindow",
"if",
"(",
"sendWindow",
">",
"0",
")",
"{",
"sendWindow",
"--",
";",
"persistSendWindow",
"(",
"sendWindow",
",",
"tran",
")",
";",
"}",
"}",
"else",
"{",
"// If the message we have just removed from the stream was",
"// inside the sendWindow then we can move up our ",
"// firstMsgOutsideWindow and possibly send the message which",
"// moves inside the window",
"// If it actually was the first message outside the window",
"// the code below will also work",
"// If it was beyond the window we can afford to ignore it ",
"if",
"(",
"stamp",
"<=",
"firstMsgOutsideWindow",
")",
"{",
"// send firstMsgOutsideWindow",
"// first need to get it and check that it is in Value state",
"ststream",
".",
"setCursor",
"(",
"firstMsgOutsideWindow",
")",
";",
"// Get the first TickRange outside the inDoubt window",
"tr1",
"=",
"ststream",
".",
"getNext",
"(",
")",
";",
"// This range must be either Uncommitted or Value as that is how",
"// we set the firstMsgOutsideWindow pointer ",
"// Only want to send this message if it is ",
"// committed. Otherwise do nothing as it will",
"// get sent when it commits",
"if",
"(",
"tr1",
".",
"type",
"==",
"TickRange",
".",
"Value",
")",
"{",
"sendMessage",
"=",
"true",
";",
"}",
"TickRange",
"tr",
"=",
"null",
";",
"if",
"(",
"totalMessages",
">",
"sendWindow",
")",
"{",
"// Get the next Value or Uncommitted tick from the stream",
"tr",
"=",
"ststream",
".",
"getNext",
"(",
")",
";",
"while",
"(",
"tr",
".",
"type",
"==",
"TickRange",
".",
"Completed",
"&&",
"tr",
".",
"endstamp",
"!=",
"RangeList",
".",
"INFINITY",
")",
"{",
"tr",
"=",
"ststream",
".",
"getNext",
"(",
")",
";",
"}",
"firstMsgOutsideWindow",
"=",
"tr",
".",
"valuestamp",
";",
"}",
"// That was the last message outside the send window, so put us back into a state",
"// ignorant of guesses, otherwise we may not realise to re-calculate the firstMsgOutSideWindow",
"// the next time we get a guess.",
"else",
"{",
"firstMsgOutsideWindow",
"=",
"RangeList",
".",
"INFINITY",
";",
"containsGuesses",
"=",
"false",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"firstMsgOutsideSendWindow: \"",
"+",
"firstMsgOutsideWindow",
")",
";",
"}",
"}",
"// Return a null if nothing to send",
"if",
"(",
"!",
"sendMessage",
")",
"tr1",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"msgRemoved\"",
",",
"tr1",
")",
";",
"return",
"tr1",
";",
"}"
] | This method is called when the totalMessages on the stream
falls and we have the possibility of sending a message
because it is now inside the sendWindow | [
"This",
"method",
"is",
"called",
"when",
"the",
"totalMessages",
"on",
"the",
"stream",
"falls",
"and",
"we",
"have",
"the",
"possibility",
"of",
"sending",
"a",
"message",
"because",
"it",
"is",
"now",
"inside",
"the",
"sendWindow"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L2072-L2168 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.getAllMessagesOnStream | public synchronized List getAllMessagesOnStream()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getAllMessagesOnStream");
List<Long> msgs = new LinkedList<Long>();
oststream.setCursor(0);
// Get the first TickRange
TickRange tr = oststream.getNext();
while (tr.endstamp < RangeList.INFINITY)
{
if (tr.type == TickRange.Value)
{
msgs.add(Long.valueOf(tr.itemStreamIndex));
}
if (tr.type == TickRange.Uncommitted)
{
// Reallocator needs to be run again when this commits
tr.reallocateOnCommit();
}
tr = oststream.getNext();
} // end while
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getAllMessagesOnStream");
return Collections.unmodifiableList(msgs);
} | java | public synchronized List getAllMessagesOnStream()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getAllMessagesOnStream");
List<Long> msgs = new LinkedList<Long>();
oststream.setCursor(0);
// Get the first TickRange
TickRange tr = oststream.getNext();
while (tr.endstamp < RangeList.INFINITY)
{
if (tr.type == TickRange.Value)
{
msgs.add(Long.valueOf(tr.itemStreamIndex));
}
if (tr.type == TickRange.Uncommitted)
{
// Reallocator needs to be run again when this commits
tr.reallocateOnCommit();
}
tr = oststream.getNext();
} // end while
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getAllMessagesOnStream");
return Collections.unmodifiableList(msgs);
} | [
"public",
"synchronized",
"List",
"getAllMessagesOnStream",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getAllMessagesOnStream\"",
")",
";",
"List",
"<",
"Long",
">",
"msgs",
"=",
"new",
"LinkedList",
"<",
"Long",
">",
"(",
")",
";",
"oststream",
".",
"setCursor",
"(",
"0",
")",
";",
"// Get the first TickRange",
"TickRange",
"tr",
"=",
"oststream",
".",
"getNext",
"(",
")",
";",
"while",
"(",
"tr",
".",
"endstamp",
"<",
"RangeList",
".",
"INFINITY",
")",
"{",
"if",
"(",
"tr",
".",
"type",
"==",
"TickRange",
".",
"Value",
")",
"{",
"msgs",
".",
"add",
"(",
"Long",
".",
"valueOf",
"(",
"tr",
".",
"itemStreamIndex",
")",
")",
";",
"}",
"if",
"(",
"tr",
".",
"type",
"==",
"TickRange",
".",
"Uncommitted",
")",
"{",
"// Reallocator needs to be run again when this commits",
"tr",
".",
"reallocateOnCommit",
"(",
")",
";",
"}",
"tr",
"=",
"oststream",
".",
"getNext",
"(",
")",
";",
"}",
"// end while",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getAllMessagesOnStream\"",
")",
";",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"msgs",
")",
";",
"}"
] | Get an unmodifiable list of all of the messages in the VALUE
state on this stream | [
"Get",
"an",
"unmodifiable",
"list",
"of",
"all",
"of",
"the",
"messages",
"in",
"the",
"VALUE",
"state",
"on",
"this",
"stream"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L2314-L2341 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.getAllMessageItemsOnStream | public synchronized List<TickRange> getAllMessageItemsOnStream(boolean includeUncommitted)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getAllMessageItemsOnStream", Boolean.valueOf(includeUncommitted));
List<TickRange> msgs = new LinkedList<TickRange>();
oststream.setCursor(0);
// Get the first TickRange
TickRange tr = oststream.getNext();
while (tr.endstamp < RangeList.INFINITY)
{
if (tr.type == TickRange.Value)
{
//get this msg from the downstream control
msgs.add((TickRange)tr.clone());
}
else if (tr.type == TickRange.Uncommitted && includeUncommitted)
{
//get this msg directly
if(tr.value!=null)
msgs.add((TickRange)tr.clone());
}
tr = oststream.getNext();
} // end while
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getAllMessageItemsOnStream", msgs);
return Collections.unmodifiableList(msgs);
} | java | public synchronized List<TickRange> getAllMessageItemsOnStream(boolean includeUncommitted)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getAllMessageItemsOnStream", Boolean.valueOf(includeUncommitted));
List<TickRange> msgs = new LinkedList<TickRange>();
oststream.setCursor(0);
// Get the first TickRange
TickRange tr = oststream.getNext();
while (tr.endstamp < RangeList.INFINITY)
{
if (tr.type == TickRange.Value)
{
//get this msg from the downstream control
msgs.add((TickRange)tr.clone());
}
else if (tr.type == TickRange.Uncommitted && includeUncommitted)
{
//get this msg directly
if(tr.value!=null)
msgs.add((TickRange)tr.clone());
}
tr = oststream.getNext();
} // end while
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getAllMessageItemsOnStream", msgs);
return Collections.unmodifiableList(msgs);
} | [
"public",
"synchronized",
"List",
"<",
"TickRange",
">",
"getAllMessageItemsOnStream",
"(",
"boolean",
"includeUncommitted",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getAllMessageItemsOnStream\"",
",",
"Boolean",
".",
"valueOf",
"(",
"includeUncommitted",
")",
")",
";",
"List",
"<",
"TickRange",
">",
"msgs",
"=",
"new",
"LinkedList",
"<",
"TickRange",
">",
"(",
")",
";",
"oststream",
".",
"setCursor",
"(",
"0",
")",
";",
"// Get the first TickRange",
"TickRange",
"tr",
"=",
"oststream",
".",
"getNext",
"(",
")",
";",
"while",
"(",
"tr",
".",
"endstamp",
"<",
"RangeList",
".",
"INFINITY",
")",
"{",
"if",
"(",
"tr",
".",
"type",
"==",
"TickRange",
".",
"Value",
")",
"{",
"//get this msg from the downstream control",
"msgs",
".",
"add",
"(",
"(",
"TickRange",
")",
"tr",
".",
"clone",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"tr",
".",
"type",
"==",
"TickRange",
".",
"Uncommitted",
"&&",
"includeUncommitted",
")",
"{",
"//get this msg directly",
"if",
"(",
"tr",
".",
"value",
"!=",
"null",
")",
"msgs",
".",
"add",
"(",
"(",
"TickRange",
")",
"tr",
".",
"clone",
"(",
")",
")",
";",
"}",
"tr",
"=",
"oststream",
".",
"getNext",
"(",
")",
";",
"}",
"// end while",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getAllMessageItemsOnStream\"",
",",
"msgs",
")",
";",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"msgs",
")",
";",
"}"
] | Get an unmodifiable list of all of the message items in the VALUE
state on this stream and, optionally, in the Uncommitted state | [
"Get",
"an",
"unmodifiable",
"list",
"of",
"all",
"of",
"the",
"message",
"items",
"in",
"the",
"VALUE",
"state",
"on",
"this",
"stream",
"and",
"optionally",
"in",
"the",
"Uncommitted",
"state"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L2347-L2375 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java | SourceStream.getTickRange | public synchronized TickRange getTickRange(long tick)
{
oststream.setCursor(tick);
// Get the TickRange
return (TickRange) oststream.getNext().clone();
} | java | public synchronized TickRange getTickRange(long tick)
{
oststream.setCursor(tick);
// Get the TickRange
return (TickRange) oststream.getNext().clone();
} | [
"public",
"synchronized",
"TickRange",
"getTickRange",
"(",
"long",
"tick",
")",
"{",
"oststream",
".",
"setCursor",
"(",
"tick",
")",
";",
"// Get the TickRange",
"return",
"(",
"TickRange",
")",
"oststream",
".",
"getNext",
"(",
")",
".",
"clone",
"(",
")",
";",
"}"
] | Get a tick range given a tick value
@param tick
@return TickRange | [
"Get",
"a",
"tick",
"range",
"given",
"a",
"tick",
"value"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStream.java#L2406-L2412 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/Reader.java | Reader.read | public OpenAPI read(Set<Class<?>> classes) {
Set<Class<?>> sortedClasses = new TreeSet<>(new Comparator<Class<?>>() {
@Override
public int compare(Class<?> class1, Class<?> class2) {
if (class1.equals(class2)) {
return 0;
} else if (class1.isAssignableFrom(class2)) {
return -1;
} else if (class2.isAssignableFrom(class1)) {
return 1;
}
return class1.getName().compareTo(class2.getName());
}
});
sortedClasses.addAll(classes);
for (Class<?> cls : sortedClasses) {
read(cls, this.applicationPath != null ? applicationPath : "");
}
return openAPI;
} | java | public OpenAPI read(Set<Class<?>> classes) {
Set<Class<?>> sortedClasses = new TreeSet<>(new Comparator<Class<?>>() {
@Override
public int compare(Class<?> class1, Class<?> class2) {
if (class1.equals(class2)) {
return 0;
} else if (class1.isAssignableFrom(class2)) {
return -1;
} else if (class2.isAssignableFrom(class1)) {
return 1;
}
return class1.getName().compareTo(class2.getName());
}
});
sortedClasses.addAll(classes);
for (Class<?> cls : sortedClasses) {
read(cls, this.applicationPath != null ? applicationPath : "");
}
return openAPI;
} | [
"public",
"OpenAPI",
"read",
"(",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
")",
"{",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"sortedClasses",
"=",
"new",
"TreeSet",
"<>",
"(",
"new",
"Comparator",
"<",
"Class",
"<",
"?",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"Class",
"<",
"?",
">",
"class1",
",",
"Class",
"<",
"?",
">",
"class2",
")",
"{",
"if",
"(",
"class1",
".",
"equals",
"(",
"class2",
")",
")",
"{",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"class1",
".",
"isAssignableFrom",
"(",
"class2",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"class2",
".",
"isAssignableFrom",
"(",
"class1",
")",
")",
"{",
"return",
"1",
";",
"}",
"return",
"class1",
".",
"getName",
"(",
")",
".",
"compareTo",
"(",
"class2",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"sortedClasses",
".",
"addAll",
"(",
"classes",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"cls",
":",
"sortedClasses",
")",
"{",
"read",
"(",
"cls",
",",
"this",
".",
"applicationPath",
"!=",
"null",
"?",
"applicationPath",
":",
"\"\"",
")",
";",
"}",
"return",
"openAPI",
";",
"}"
] | Scans a set of classes for both ReaderListeners and OpenAPI annotations. All found listeners will
be instantiated before any of the classes are scanned for OpenAPI annotations - so they can be invoked
accordingly.
@param classes a set of classes to scan
@return the generated OpenAPI definition | [
"Scans",
"a",
"set",
"of",
"classes",
"for",
"both",
"ReaderListeners",
"and",
"OpenAPI",
"annotations",
".",
"All",
"found",
"listeners",
"will",
"be",
"instantiated",
"before",
"any",
"of",
"the",
"classes",
"are",
"scanned",
"for",
"OpenAPI",
"annotations",
"-",
"so",
"they",
"can",
"be",
"invoked",
"accordingly",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/Reader.java#L169-L189 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/MfpDiagnostics.java | MfpDiagnostics.initialize | public static MfpDiagnostics initialize() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "initialize");
// We should only do this once
if (singleton == null) {
singleton = new MfpDiagnostics();
singleton.register(packageList);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "initialize");
return singleton;
} | java | public static MfpDiagnostics initialize() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "initialize");
// We should only do this once
if (singleton == null) {
singleton = new MfpDiagnostics();
singleton.register(packageList);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "initialize");
return singleton;
} | [
"public",
"static",
"MfpDiagnostics",
"initialize",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"initialize\"",
")",
";",
"// We should only do this once",
"if",
"(",
"singleton",
"==",
"null",
")",
"{",
"singleton",
"=",
"new",
"MfpDiagnostics",
"(",
")",
";",
"singleton",
".",
"register",
"(",
"packageList",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"initialize\"",
")",
";",
"return",
"singleton",
";",
"}"
] | Initialise the diagnostic module by creating the singleton instance and registering
it with the diagnostic engine in Websphere. | [
"Initialise",
"the",
"diagnostic",
"module",
"by",
"creating",
"the",
"singleton",
"instance",
"and",
"registering",
"it",
"with",
"the",
"diagnostic",
"engine",
"in",
"Websphere",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/MfpDiagnostics.java#L93-L104 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/MfpDiagnostics.java | MfpDiagnostics.ffdcDumpDefault | public void ffdcDumpDefault(Throwable t, IncidentStream is, Object callerThis, Object[] objs, String sourceId) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "ffdcDumpDefault");
// First trace the Throwable, so that we can actually spot the exception in the trace
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "FFDC for " + t);
// Trace the first line of the stacktrace too, as it'll help debugging
if (t != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, " at... " + t.getStackTrace()[0]);
}
// Capture the Messaging Engine Name and other default information
super.captureDefaultInformation(is);
// The objs parm may contain one request or several. Each call to dumpUsefulStuff()
// deals with a single request. If it contains several requests, each entry
// in objs is itself an Object[]. If not, the first entry is just an Object.
if (objs != null && objs.length > 0) {
if (objs[0] instanceof Object[]) {
for (int i = 0; i < objs.length; i++) {
// Belt & braces - we don't want FFDC to fail because someone inserted something invalid
if (objs[i] instanceof Object[]) dumpUsefulStuff(is, (Object[])objs[i]);
}
}
else {
dumpUsefulStuff(is, objs);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "ffdcDumpDefault");
} | java | public void ffdcDumpDefault(Throwable t, IncidentStream is, Object callerThis, Object[] objs, String sourceId) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "ffdcDumpDefault");
// First trace the Throwable, so that we can actually spot the exception in the trace
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "FFDC for " + t);
// Trace the first line of the stacktrace too, as it'll help debugging
if (t != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, " at... " + t.getStackTrace()[0]);
}
// Capture the Messaging Engine Name and other default information
super.captureDefaultInformation(is);
// The objs parm may contain one request or several. Each call to dumpUsefulStuff()
// deals with a single request. If it contains several requests, each entry
// in objs is itself an Object[]. If not, the first entry is just an Object.
if (objs != null && objs.length > 0) {
if (objs[0] instanceof Object[]) {
for (int i = 0; i < objs.length; i++) {
// Belt & braces - we don't want FFDC to fail because someone inserted something invalid
if (objs[i] instanceof Object[]) dumpUsefulStuff(is, (Object[])objs[i]);
}
}
else {
dumpUsefulStuff(is, objs);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "ffdcDumpDefault");
} | [
"public",
"void",
"ffdcDumpDefault",
"(",
"Throwable",
"t",
",",
"IncidentStream",
"is",
",",
"Object",
"callerThis",
",",
"Object",
"[",
"]",
"objs",
",",
"String",
"sourceId",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"ffdcDumpDefault\"",
")",
";",
"// First trace the Throwable, so that we can actually spot the exception in the trace",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"FFDC for \"",
"+",
"t",
")",
";",
"// Trace the first line of the stacktrace too, as it'll help debugging",
"if",
"(",
"t",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\" at... \"",
"+",
"t",
".",
"getStackTrace",
"(",
")",
"[",
"0",
"]",
")",
";",
"}",
"// Capture the Messaging Engine Name and other default information",
"super",
".",
"captureDefaultInformation",
"(",
"is",
")",
";",
"// The objs parm may contain one request or several. Each call to dumpUsefulStuff()",
"// deals with a single request. If it contains several requests, each entry",
"// in objs is itself an Object[]. If not, the first entry is just an Object.",
"if",
"(",
"objs",
"!=",
"null",
"&&",
"objs",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"objs",
"[",
"0",
"]",
"instanceof",
"Object",
"[",
"]",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"objs",
".",
"length",
";",
"i",
"++",
")",
"{",
"// Belt & braces - we don't want FFDC to fail because someone inserted something invalid",
"if",
"(",
"objs",
"[",
"i",
"]",
"instanceof",
"Object",
"[",
"]",
")",
"dumpUsefulStuff",
"(",
"is",
",",
"(",
"Object",
"[",
"]",
")",
"objs",
"[",
"i",
"]",
")",
";",
"}",
"}",
"else",
"{",
"dumpUsefulStuff",
"(",
"is",
",",
"objs",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"ffdcDumpDefault\"",
")",
";",
"}"
] | Default ffdc dump routine - always invoked | [
"Default",
"ffdc",
"dump",
"routine",
"-",
"always",
"invoked"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/MfpDiagnostics.java#L123-L152 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/MfpDiagnostics.java | MfpDiagnostics.dumpUsefulStuff | private void dumpUsefulStuff(IncidentStream is, Object[] objs) {
// The first parameter is a marker telling us what sort of data we have in subsequent
// parameters.
if (objs != null && objs.length > 0) {
if (objs[0] == MfpConstants.DM_BUFFER && objs.length >= 4)
dumpJmfBuffer(is, (byte[])objs[1], ((Integer)objs[2]).intValue(), ((Integer)objs[3]).intValue());
else if (objs[0] == MfpConstants.DM_MESSAGE && objs.length >= 2)
dumpJmfMessage(is, (JMFMessage)objs[1], objs[2]);
else if (objs[0] == MfpConstants.DM_SLICES && objs.length >= 2)
dumpJmfSlices(is, (List<DataSlice>)objs[1]);
}
} | java | private void dumpUsefulStuff(IncidentStream is, Object[] objs) {
// The first parameter is a marker telling us what sort of data we have in subsequent
// parameters.
if (objs != null && objs.length > 0) {
if (objs[0] == MfpConstants.DM_BUFFER && objs.length >= 4)
dumpJmfBuffer(is, (byte[])objs[1], ((Integer)objs[2]).intValue(), ((Integer)objs[3]).intValue());
else if (objs[0] == MfpConstants.DM_MESSAGE && objs.length >= 2)
dumpJmfMessage(is, (JMFMessage)objs[1], objs[2]);
else if (objs[0] == MfpConstants.DM_SLICES && objs.length >= 2)
dumpJmfSlices(is, (List<DataSlice>)objs[1]);
}
} | [
"private",
"void",
"dumpUsefulStuff",
"(",
"IncidentStream",
"is",
",",
"Object",
"[",
"]",
"objs",
")",
"{",
"// The first parameter is a marker telling us what sort of data we have in subsequent",
"// parameters.",
"if",
"(",
"objs",
"!=",
"null",
"&&",
"objs",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"objs",
"[",
"0",
"]",
"==",
"MfpConstants",
".",
"DM_BUFFER",
"&&",
"objs",
".",
"length",
">=",
"4",
")",
"dumpJmfBuffer",
"(",
"is",
",",
"(",
"byte",
"[",
"]",
")",
"objs",
"[",
"1",
"]",
",",
"(",
"(",
"Integer",
")",
"objs",
"[",
"2",
"]",
")",
".",
"intValue",
"(",
")",
",",
"(",
"(",
"Integer",
")",
"objs",
"[",
"3",
"]",
")",
".",
"intValue",
"(",
")",
")",
";",
"else",
"if",
"(",
"objs",
"[",
"0",
"]",
"==",
"MfpConstants",
".",
"DM_MESSAGE",
"&&",
"objs",
".",
"length",
">=",
"2",
")",
"dumpJmfMessage",
"(",
"is",
",",
"(",
"JMFMessage",
")",
"objs",
"[",
"1",
"]",
",",
"objs",
"[",
"2",
"]",
")",
";",
"else",
"if",
"(",
"objs",
"[",
"0",
"]",
"==",
"MfpConstants",
".",
"DM_SLICES",
"&&",
"objs",
".",
"length",
">=",
"2",
")",
"dumpJmfSlices",
"(",
"is",
",",
"(",
"List",
"<",
"DataSlice",
">",
")",
"objs",
"[",
"1",
"]",
")",
";",
"}",
"}"
] | routine to dump it. | [
"routine",
"to",
"dump",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/MfpDiagnostics.java#L157-L170 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/MfpDiagnostics.java | MfpDiagnostics.dumpJmfBuffer | private void dumpJmfBuffer(IncidentStream is, byte[] frame, int offset, int length) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dumpJmfBuffer");
if (frame != null) {
// If the length passed in is 0 we probably have rubbish in both the length
// and the offset so display the entire buffer (or at least the first 4k)
if (length == 0) {
is.writeLine("Request to dump offset=" + offset + " length=" + length + " implies bad data so dumping buffer from offset 0.","");
offset = 0;
length = frame.length;
}
// otherwise ensure we can't fall off the end of the buffer
else if ((offset + length) > frame.length) {
length = frame.length - offset;
}
try {
String buffer = SibTr.formatBytes(frame, offset, length, getDiagnosticDataLimitInt());
is.writeLine("JMF data buffer", buffer);
} catch (Exception e) {
// No FFDC code needed - we are FFDCing!
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "dumpJmfBuffer failed: " + e);
}
} else
is.writeLine("No JMF buffer data available", "");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dumpJmfBuffer");
} | java | private void dumpJmfBuffer(IncidentStream is, byte[] frame, int offset, int length) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dumpJmfBuffer");
if (frame != null) {
// If the length passed in is 0 we probably have rubbish in both the length
// and the offset so display the entire buffer (or at least the first 4k)
if (length == 0) {
is.writeLine("Request to dump offset=" + offset + " length=" + length + " implies bad data so dumping buffer from offset 0.","");
offset = 0;
length = frame.length;
}
// otherwise ensure we can't fall off the end of the buffer
else if ((offset + length) > frame.length) {
length = frame.length - offset;
}
try {
String buffer = SibTr.formatBytes(frame, offset, length, getDiagnosticDataLimitInt());
is.writeLine("JMF data buffer", buffer);
} catch (Exception e) {
// No FFDC code needed - we are FFDCing!
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "dumpJmfBuffer failed: " + e);
}
} else
is.writeLine("No JMF buffer data available", "");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dumpJmfBuffer");
} | [
"private",
"void",
"dumpJmfBuffer",
"(",
"IncidentStream",
"is",
",",
"byte",
"[",
"]",
"frame",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"dumpJmfBuffer\"",
")",
";",
"if",
"(",
"frame",
"!=",
"null",
")",
"{",
"// If the length passed in is 0 we probably have rubbish in both the length",
"// and the offset so display the entire buffer (or at least the first 4k)",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"is",
".",
"writeLine",
"(",
"\"Request to dump offset=\"",
"+",
"offset",
"+",
"\" length=\"",
"+",
"length",
"+",
"\" implies bad data so dumping buffer from offset 0.\"",
",",
"\"\"",
")",
";",
"offset",
"=",
"0",
";",
"length",
"=",
"frame",
".",
"length",
";",
"}",
"// otherwise ensure we can't fall off the end of the buffer",
"else",
"if",
"(",
"(",
"offset",
"+",
"length",
")",
">",
"frame",
".",
"length",
")",
"{",
"length",
"=",
"frame",
".",
"length",
"-",
"offset",
";",
"}",
"try",
"{",
"String",
"buffer",
"=",
"SibTr",
".",
"formatBytes",
"(",
"frame",
",",
"offset",
",",
"length",
",",
"getDiagnosticDataLimitInt",
"(",
")",
")",
";",
"is",
".",
"writeLine",
"(",
"\"JMF data buffer\"",
",",
"buffer",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// No FFDC code needed - we are FFDCing!",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"dumpJmfBuffer failed: \"",
"+",
"e",
")",
";",
"}",
"}",
"else",
"is",
".",
"writeLine",
"(",
"\"No JMF buffer data available\"",
",",
"\"\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"dumpJmfBuffer\"",
")",
";",
"}"
] | to contain the Jetstream headers etc. | [
"to",
"contain",
"the",
"Jetstream",
"headers",
"etc",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/MfpDiagnostics.java#L176-L202 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/MfpDiagnostics.java | MfpDiagnostics.dumpJmfSlices | private void dumpJmfSlices(IncidentStream is, List<DataSlice> slices) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dumpJmfSlices");
if (slices != null) {
try {
is.writeLine("JMF data slices", SibTr.formatSlices(slices, getDiagnosticDataLimitInt()));
}
catch (Exception e) {
// No FFDC code needed - we are FFDCing!
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "dumpJmfSlices failed: " + e);
}
}
else {
is.writeLine("No JMF DataSlices available", "");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dumpJmfSlices");
} | java | private void dumpJmfSlices(IncidentStream is, List<DataSlice> slices) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dumpJmfSlices");
if (slices != null) {
try {
is.writeLine("JMF data slices", SibTr.formatSlices(slices, getDiagnosticDataLimitInt()));
}
catch (Exception e) {
// No FFDC code needed - we are FFDCing!
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "dumpJmfSlices failed: " + e);
}
}
else {
is.writeLine("No JMF DataSlices available", "");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dumpJmfSlices");
} | [
"private",
"void",
"dumpJmfSlices",
"(",
"IncidentStream",
"is",
",",
"List",
"<",
"DataSlice",
">",
"slices",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"dumpJmfSlices\"",
")",
";",
"if",
"(",
"slices",
"!=",
"null",
")",
"{",
"try",
"{",
"is",
".",
"writeLine",
"(",
"\"JMF data slices\"",
",",
"SibTr",
".",
"formatSlices",
"(",
"slices",
",",
"getDiagnosticDataLimitInt",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// No FFDC code needed - we are FFDCing!",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"dumpJmfSlices failed: \"",
"+",
"e",
")",
";",
"}",
"}",
"else",
"{",
"is",
".",
"writeLine",
"(",
"\"No JMF DataSlices available\"",
",",
"\"\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"dumpJmfSlices\"",
")",
";",
"}"
] | user data - so we only dump at most the first 4K bytes of each slice. | [
"user",
"data",
"-",
"so",
"we",
"only",
"dump",
"at",
"most",
"the",
"first",
"4K",
"bytes",
"of",
"each",
"slice",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/MfpDiagnostics.java#L230-L247 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.initializeNonPersistent | protected void initializeNonPersistent(MessageProcessor messageProcessor)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initializeNonPersistent", messageProcessor);
/*
* Keep a local reference to the MessageProcessor object, as this allows us
* to find the message store and to generate units of work when required.
*/
this.messageProcessor = messageProcessor;
txManager = messageProcessor.getTXManager();
destinationIndex = new DestinationIndex(messageProcessor.getMessagingEngineBus());
foreignBusIndex = new ForeignBusIndex();
linkIndex = new LinkIndex();
/*
* Create the system-wide hashmap for durable subscriptions. This MUST be available
* to every TopicSpace since a subsriptionId is unique across the system.
*/
durableSubscriptions = new HashMap();
//initializing nondurableSharedSubscriptions here as it is common flow for cold and warm start
//however nondurableSharedSubscriptions not be restored from Message Store.
nondurableSharedSubscriptions = new ConcurrentHashMap<String, Object>();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initializeNonPersistent");
} | java | protected void initializeNonPersistent(MessageProcessor messageProcessor)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initializeNonPersistent", messageProcessor);
/*
* Keep a local reference to the MessageProcessor object, as this allows us
* to find the message store and to generate units of work when required.
*/
this.messageProcessor = messageProcessor;
txManager = messageProcessor.getTXManager();
destinationIndex = new DestinationIndex(messageProcessor.getMessagingEngineBus());
foreignBusIndex = new ForeignBusIndex();
linkIndex = new LinkIndex();
/*
* Create the system-wide hashmap for durable subscriptions. This MUST be available
* to every TopicSpace since a subsriptionId is unique across the system.
*/
durableSubscriptions = new HashMap();
//initializing nondurableSharedSubscriptions here as it is common flow for cold and warm start
//however nondurableSharedSubscriptions not be restored from Message Store.
nondurableSharedSubscriptions = new ConcurrentHashMap<String, Object>();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initializeNonPersistent");
} | [
"protected",
"void",
"initializeNonPersistent",
"(",
"MessageProcessor",
"messageProcessor",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"initializeNonPersistent\"",
",",
"messageProcessor",
")",
";",
"/*\n * Keep a local reference to the MessageProcessor object, as this allows us\n * to find the message store and to generate units of work when required.\n */",
"this",
".",
"messageProcessor",
"=",
"messageProcessor",
";",
"txManager",
"=",
"messageProcessor",
".",
"getTXManager",
"(",
")",
";",
"destinationIndex",
"=",
"new",
"DestinationIndex",
"(",
"messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
")",
";",
"foreignBusIndex",
"=",
"new",
"ForeignBusIndex",
"(",
")",
";",
"linkIndex",
"=",
"new",
"LinkIndex",
"(",
")",
";",
"/*\n * Create the system-wide hashmap for durable subscriptions. This MUST be available\n * to every TopicSpace since a subsriptionId is unique across the system.\n */",
"durableSubscriptions",
"=",
"new",
"HashMap",
"(",
")",
";",
"//initializing nondurableSharedSubscriptions here as it is common flow for cold and warm start",
"//however nondurableSharedSubscriptions not be restored from Message Store.",
"nondurableSharedSubscriptions",
"=",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"initializeNonPersistent\"",
")",
";",
"}"
] | Initialize non-persistent fields. These fields are common to both MS
reconstitution of DestinationManagers and initial creation.
Feature 174199.2.4
@param MessageProcessor | [
"Initialize",
"non",
"-",
"persistent",
"fields",
".",
"These",
"fields",
"are",
"common",
"to",
"both",
"MS",
"reconstitution",
"of",
"DestinationManagers",
"and",
"initial",
"creation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L324-L352 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.moveAllInDoubtToUnreconciled | public void moveAllInDoubtToUnreconciled()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "moveAllInDoubtToUnreconciled");
DestinationTypeFilter filter = new DestinationTypeFilter();
filter.LOCAL = Boolean.TRUE;
filter.INDOUBT = Boolean.TRUE;
SIMPIterator itr = destinationIndex.iterator(filter);
while (itr.hasNext())
{
BaseDestinationHandler destHand = (BaseDestinationHandler) itr.next();
destinationIndex.putUnreconciled(destHand);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "moveAllInDoubtToUnreconciled");
} | java | public void moveAllInDoubtToUnreconciled()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "moveAllInDoubtToUnreconciled");
DestinationTypeFilter filter = new DestinationTypeFilter();
filter.LOCAL = Boolean.TRUE;
filter.INDOUBT = Boolean.TRUE;
SIMPIterator itr = destinationIndex.iterator(filter);
while (itr.hasNext())
{
BaseDestinationHandler destHand = (BaseDestinationHandler) itr.next();
destinationIndex.putUnreconciled(destHand);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "moveAllInDoubtToUnreconciled");
} | [
"public",
"void",
"moveAllInDoubtToUnreconciled",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"moveAllInDoubtToUnreconciled\"",
")",
";",
"DestinationTypeFilter",
"filter",
"=",
"new",
"DestinationTypeFilter",
"(",
")",
";",
"filter",
".",
"LOCAL",
"=",
"Boolean",
".",
"TRUE",
";",
"filter",
".",
"INDOUBT",
"=",
"Boolean",
".",
"TRUE",
";",
"SIMPIterator",
"itr",
"=",
"destinationIndex",
".",
"iterator",
"(",
"filter",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"BaseDestinationHandler",
"destHand",
"=",
"(",
"BaseDestinationHandler",
")",
"itr",
".",
"next",
"(",
")",
";",
"destinationIndex",
".",
"putUnreconciled",
"(",
"destHand",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"moveAllInDoubtToUnreconciled\"",
")",
";",
"}"
] | Before reconciliation, we need to move any inDoubt handlers
to the Unreconciled state.
If the destination gets reconciled then we have recovered.
If not, we might get moved back to the inDoubt state, arguing
that the corrupt WCCM file is stil causing problems,
or finally WCCM might now tell us to remove the destination
@author tpm | [
"Before",
"reconciliation",
"we",
"need",
"to",
"move",
"any",
"inDoubt",
"handlers",
"to",
"the",
"Unreconciled",
"state",
".",
"If",
"the",
"destination",
"gets",
"reconciled",
"then",
"we",
"have",
"recovered",
".",
"If",
"not",
"we",
"might",
"get",
"moved",
"back",
"to",
"the",
"inDoubt",
"state",
"arguing",
"that",
"the",
"corrupt",
"WCCM",
"file",
"is",
"stil",
"causing",
"problems",
"or",
"finally",
"WCCM",
"might",
"now",
"tell",
"us",
"to",
"remove",
"the",
"destination"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L409-L425 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.validateUnreconciled | public void validateUnreconciled()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "validateUnreconciled");
JsMessagingEngine engine =
messageProcessor.getMessagingEngine();
//find all local, unreconciled destinations
DestinationTypeFilter filter = new DestinationTypeFilter();
filter.LOCAL = Boolean.TRUE;
filter.UNRECONCILED = Boolean.TRUE;
SIMPIterator itr = destinationIndex.iterator(filter);
while (itr.hasNext())
{
BaseDestinationHandler bdh = (BaseDestinationHandler) itr.next();
try
{
BaseDestinationDefinition baseDestDef =
engine.getSIBDestination(engine.getBusName(),
bdh.getName());
//if no exception was thrown then
//the destination does exist, so we need to
//figure out why createDestLoclisationLocal was not called
if (baseDestDef.getUUID().equals(bdh.getUuid()))
{
//Only do this if the UUID of the destination is the same
Set<String> localitySet =
engine.getSIBDestinationLocalitySet(engine.getBusName(),
baseDestDef.getUUID().toString());
boolean qLocalisation = localitySet.contains(engine.getUuid().toString());
//Venu temp
// removing the code as it is for PEV
// has to be deleted at later point
//if this destination isn't truely local then we'll check to see if
//it is a PEV destination, in which case we will treat it as local anyway
DestinationDefinition destDef = (DestinationDefinition) baseDestDef;
SIBUuid12 destUUID = destDef.getUUID();
if (qLocalisation)
{
//So we do localise, either a qPt or MedPt
//but yet createDestLocalisation was not called.
//Possibly a corrupt file in WCCM - we put the destination
//into the "InDoubt" state and make it invisible
//and then throw an exception
try
{
putDestinationIntoIndoubtState(destUUID);
SibTr.error(tc, "DESTINATION_INDOUBT_ERROR_CWSIP0062",
new Object[] { destDef.getName(), destUUID });
throw new SIErrorException(nls.getFormattedMessage(
"DESTINATION_INDOUBT_ERROR_CWSIP0062",
new Object[] { destDef.getName(), destUUID },
null));
} catch (SIErrorException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.DestinationManager.validateUnreconciled",
"1:582:1.508.1.7",
this);
SibTr.exception(tc, e);
}
}
else
{
//the reason for missing the createDestLoc call is that,
//since we were last running,
//the destination has changed so that it is no longer
//localised on this ME.
try
{
deleteDestinationLocalization(bdh.getDefinition().getUUID().toString(),
destDef,
localitySet);
} catch (SIException exception)
{
FFDCFilter.processException(
exception,
"com.ibm.ws.sib.processor.impl.DestinationManager.validateUnreconciled",
"1:607:1.508.1.7",
this);
SibTr.exception(tc, exception);
//play it safe
//and put the destination into indoubt (rather than delete)
putDestinationIntoIndoubtState(destUUID);
}
}
}
} catch (SIBExceptionDestinationNotFound e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//the destination does not exist
//it is ok to delete this exception, so we do nothing
//(all unreconciled destinations are eventually deleted)
} catch (SIBExceptionBase base)
{
FFDCFilter.processException(
base,
"com.ibm.ws.sib.processor.impl.DestinationManager.validateUnreconciled",
"1:634:1.508.1.7",
this);
SibTr.exception(tc, base);
//play it safe and put the destination into indoubt
putDestinationIntoIndoubtState(bdh.getUuid());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "validateUnreconciled");
} | java | public void validateUnreconciled()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "validateUnreconciled");
JsMessagingEngine engine =
messageProcessor.getMessagingEngine();
//find all local, unreconciled destinations
DestinationTypeFilter filter = new DestinationTypeFilter();
filter.LOCAL = Boolean.TRUE;
filter.UNRECONCILED = Boolean.TRUE;
SIMPIterator itr = destinationIndex.iterator(filter);
while (itr.hasNext())
{
BaseDestinationHandler bdh = (BaseDestinationHandler) itr.next();
try
{
BaseDestinationDefinition baseDestDef =
engine.getSIBDestination(engine.getBusName(),
bdh.getName());
//if no exception was thrown then
//the destination does exist, so we need to
//figure out why createDestLoclisationLocal was not called
if (baseDestDef.getUUID().equals(bdh.getUuid()))
{
//Only do this if the UUID of the destination is the same
Set<String> localitySet =
engine.getSIBDestinationLocalitySet(engine.getBusName(),
baseDestDef.getUUID().toString());
boolean qLocalisation = localitySet.contains(engine.getUuid().toString());
//Venu temp
// removing the code as it is for PEV
// has to be deleted at later point
//if this destination isn't truely local then we'll check to see if
//it is a PEV destination, in which case we will treat it as local anyway
DestinationDefinition destDef = (DestinationDefinition) baseDestDef;
SIBUuid12 destUUID = destDef.getUUID();
if (qLocalisation)
{
//So we do localise, either a qPt or MedPt
//but yet createDestLocalisation was not called.
//Possibly a corrupt file in WCCM - we put the destination
//into the "InDoubt" state and make it invisible
//and then throw an exception
try
{
putDestinationIntoIndoubtState(destUUID);
SibTr.error(tc, "DESTINATION_INDOUBT_ERROR_CWSIP0062",
new Object[] { destDef.getName(), destUUID });
throw new SIErrorException(nls.getFormattedMessage(
"DESTINATION_INDOUBT_ERROR_CWSIP0062",
new Object[] { destDef.getName(), destUUID },
null));
} catch (SIErrorException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.DestinationManager.validateUnreconciled",
"1:582:1.508.1.7",
this);
SibTr.exception(tc, e);
}
}
else
{
//the reason for missing the createDestLoc call is that,
//since we were last running,
//the destination has changed so that it is no longer
//localised on this ME.
try
{
deleteDestinationLocalization(bdh.getDefinition().getUUID().toString(),
destDef,
localitySet);
} catch (SIException exception)
{
FFDCFilter.processException(
exception,
"com.ibm.ws.sib.processor.impl.DestinationManager.validateUnreconciled",
"1:607:1.508.1.7",
this);
SibTr.exception(tc, exception);
//play it safe
//and put the destination into indoubt (rather than delete)
putDestinationIntoIndoubtState(destUUID);
}
}
}
} catch (SIBExceptionDestinationNotFound e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//the destination does not exist
//it is ok to delete this exception, so we do nothing
//(all unreconciled destinations are eventually deleted)
} catch (SIBExceptionBase base)
{
FFDCFilter.processException(
base,
"com.ibm.ws.sib.processor.impl.DestinationManager.validateUnreconciled",
"1:634:1.508.1.7",
this);
SibTr.exception(tc, base);
//play it safe and put the destination into indoubt
putDestinationIntoIndoubtState(bdh.getUuid());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "validateUnreconciled");
} | [
"public",
"void",
"validateUnreconciled",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"validateUnreconciled\"",
")",
";",
"JsMessagingEngine",
"engine",
"=",
"messageProcessor",
".",
"getMessagingEngine",
"(",
")",
";",
"//find all local, unreconciled destinations",
"DestinationTypeFilter",
"filter",
"=",
"new",
"DestinationTypeFilter",
"(",
")",
";",
"filter",
".",
"LOCAL",
"=",
"Boolean",
".",
"TRUE",
";",
"filter",
".",
"UNRECONCILED",
"=",
"Boolean",
".",
"TRUE",
";",
"SIMPIterator",
"itr",
"=",
"destinationIndex",
".",
"iterator",
"(",
"filter",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"BaseDestinationHandler",
"bdh",
"=",
"(",
"BaseDestinationHandler",
")",
"itr",
".",
"next",
"(",
")",
";",
"try",
"{",
"BaseDestinationDefinition",
"baseDestDef",
"=",
"engine",
".",
"getSIBDestination",
"(",
"engine",
".",
"getBusName",
"(",
")",
",",
"bdh",
".",
"getName",
"(",
")",
")",
";",
"//if no exception was thrown then",
"//the destination does exist, so we need to",
"//figure out why createDestLoclisationLocal was not called",
"if",
"(",
"baseDestDef",
".",
"getUUID",
"(",
")",
".",
"equals",
"(",
"bdh",
".",
"getUuid",
"(",
")",
")",
")",
"{",
"//Only do this if the UUID of the destination is the same",
"Set",
"<",
"String",
">",
"localitySet",
"=",
"engine",
".",
"getSIBDestinationLocalitySet",
"(",
"engine",
".",
"getBusName",
"(",
")",
",",
"baseDestDef",
".",
"getUUID",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"boolean",
"qLocalisation",
"=",
"localitySet",
".",
"contains",
"(",
"engine",
".",
"getUuid",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"//Venu temp",
"// removing the code as it is for PEV",
"// has to be deleted at later point",
"//if this destination isn't truely local then we'll check to see if",
"//it is a PEV destination, in which case we will treat it as local anyway",
"DestinationDefinition",
"destDef",
"=",
"(",
"DestinationDefinition",
")",
"baseDestDef",
";",
"SIBUuid12",
"destUUID",
"=",
"destDef",
".",
"getUUID",
"(",
")",
";",
"if",
"(",
"qLocalisation",
")",
"{",
"//So we do localise, either a qPt or MedPt",
"//but yet createDestLocalisation was not called.",
"//Possibly a corrupt file in WCCM - we put the destination",
"//into the \"InDoubt\" state and make it invisible",
"//and then throw an exception",
"try",
"{",
"putDestinationIntoIndoubtState",
"(",
"destUUID",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"DESTINATION_INDOUBT_ERROR_CWSIP0062\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destDef",
".",
"getName",
"(",
")",
",",
"destUUID",
"}",
")",
";",
"throw",
"new",
"SIErrorException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"DESTINATION_INDOUBT_ERROR_CWSIP0062\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destDef",
".",
"getName",
"(",
")",
",",
"destUUID",
"}",
",",
"null",
")",
")",
";",
"}",
"catch",
"(",
"SIErrorException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.DestinationManager.validateUnreconciled\"",
",",
"\"1:582:1.508.1.7\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"}",
"else",
"{",
"//the reason for missing the createDestLoc call is that,",
"//since we were last running,",
"//the destination has changed so that it is no longer",
"//localised on this ME.",
"try",
"{",
"deleteDestinationLocalization",
"(",
"bdh",
".",
"getDefinition",
"(",
")",
".",
"getUUID",
"(",
")",
".",
"toString",
"(",
")",
",",
"destDef",
",",
"localitySet",
")",
";",
"}",
"catch",
"(",
"SIException",
"exception",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exception",
",",
"\"com.ibm.ws.sib.processor.impl.DestinationManager.validateUnreconciled\"",
",",
"\"1:607:1.508.1.7\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"exception",
")",
";",
"//play it safe",
"//and put the destination into indoubt (rather than delete)",
"putDestinationIntoIndoubtState",
"(",
"destUUID",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"SIBExceptionDestinationNotFound",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"//the destination does not exist",
"//it is ok to delete this exception, so we do nothing",
"//(all unreconciled destinations are eventually deleted)",
"}",
"catch",
"(",
"SIBExceptionBase",
"base",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"base",
",",
"\"com.ibm.ws.sib.processor.impl.DestinationManager.validateUnreconciled\"",
",",
"\"1:634:1.508.1.7\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"base",
")",
";",
"//play it safe and put the destination into indoubt",
"putDestinationIntoIndoubtState",
"(",
"bdh",
".",
"getUuid",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"validateUnreconciled\"",
")",
";",
"}"
] | At the end of the reconciliation phase of MessageProcessor startup,
we need to check each unreconciled destination to see if it is safe
to delete that destination, whether the destination should be
altered to a new locality set, or whether the destination should be put
into a InDoubt state.
@author tpm | [
"At",
"the",
"end",
"of",
"the",
"reconciliation",
"phase",
"of",
"MessageProcessor",
"startup",
"we",
"need",
"to",
"check",
"each",
"unreconciled",
"destination",
"to",
"see",
"if",
"it",
"is",
"safe",
"to",
"delete",
"that",
"destination",
"whether",
"the",
"destination",
"should",
"be",
"altered",
"to",
"a",
"new",
"locality",
"set",
"or",
"whether",
"the",
"destination",
"should",
"be",
"put",
"into",
"a",
"InDoubt",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L436-L561 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.startNewReconstituteThread | private void startNewReconstituteThread(Runnable runnable) throws InterruptedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "startNewReconstituteThread");
if (_reconstituteThreadpool == null)
{
createReconstituteThreadPool();
}
_reconstituteThreadpool.execute(runnable);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "startNewReconstituteThread");
} | java | private void startNewReconstituteThread(Runnable runnable) throws InterruptedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "startNewReconstituteThread");
if (_reconstituteThreadpool == null)
{
createReconstituteThreadPool();
}
_reconstituteThreadpool.execute(runnable);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "startNewReconstituteThread");
} | [
"private",
"void",
"startNewReconstituteThread",
"(",
"Runnable",
"runnable",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"startNewReconstituteThread\"",
")",
";",
"if",
"(",
"_reconstituteThreadpool",
"==",
"null",
")",
"{",
"createReconstituteThreadPool",
"(",
")",
";",
"}",
"_reconstituteThreadpool",
".",
"execute",
"(",
"runnable",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"startNewReconstituteThread\"",
")",
";",
"}"
] | Starts a new thread for reconstitution
@param runnable
@throws InterruptedException | [
"Starts",
"a",
"new",
"thread",
"for",
"reconstitution"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L569-L583 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.waitUntilReconstitutionIsCompleted | private void waitUntilReconstitutionIsCompleted()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "waitUntilReconstitutionISCompleted");
// gracefully shutdown the pool
_reconstituteThreadpool.shutdown();
//awaitTermination() is a blocking call and caller thread will be blocked
//until all tasks in pool have completed execution after a shutdown request
try
{
_reconstituteThreadpool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
} catch (InterruptedException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
}
//Destroy the thread pool
_reconstituteThreadpool = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "waitUntilReconstitutionISCompleted");
} | java | private void waitUntilReconstitutionIsCompleted()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "waitUntilReconstitutionISCompleted");
// gracefully shutdown the pool
_reconstituteThreadpool.shutdown();
//awaitTermination() is a blocking call and caller thread will be blocked
//until all tasks in pool have completed execution after a shutdown request
try
{
_reconstituteThreadpool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
} catch (InterruptedException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
}
//Destroy the thread pool
_reconstituteThreadpool = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "waitUntilReconstitutionISCompleted");
} | [
"private",
"void",
"waitUntilReconstitutionIsCompleted",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"waitUntilReconstitutionISCompleted\"",
")",
";",
"// gracefully shutdown the pool",
"_reconstituteThreadpool",
".",
"shutdown",
"(",
")",
";",
"//awaitTermination() is a blocking call and caller thread will be blocked",
"//until all tasks in pool have completed execution after a shutdown request",
"try",
"{",
"_reconstituteThreadpool",
".",
"awaitTermination",
"(",
"Long",
".",
"MAX_VALUE",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"//Destroy the thread pool",
"_reconstituteThreadpool",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"waitUntilReconstitutionISCompleted\"",
")",
";",
"}"
] | Will wait until the reconstitution is completed
This will be called for each of BaseDestinationHandler, LinkHandler and MQLinkHandler
The threadpool will be destroyed | [
"Will",
"wait",
"until",
"the",
"reconstitution",
"is",
"completed",
"This",
"will",
"be",
"called",
"for",
"each",
"of",
"BaseDestinationHandler",
"LinkHandler",
"and",
"MQLinkHandler",
"The",
"threadpool",
"will",
"be",
"destroyed"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1067-L1091 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.getLink | public final LinkHandler getLink(String linkName)
{
LinkTypeFilter filter = new LinkTypeFilter();
return (LinkHandler) linkIndex.findByName(linkName, filter);
} | java | public final LinkHandler getLink(String linkName)
{
LinkTypeFilter filter = new LinkTypeFilter();
return (LinkHandler) linkIndex.findByName(linkName, filter);
} | [
"public",
"final",
"LinkHandler",
"getLink",
"(",
"String",
"linkName",
")",
"{",
"LinkTypeFilter",
"filter",
"=",
"new",
"LinkTypeFilter",
"(",
")",
";",
"return",
"(",
"LinkHandler",
")",
"linkIndex",
".",
"findByName",
"(",
"linkName",
",",
"filter",
")",
";",
"}"
] | Gets the link destination from the set of destinations
@param linkName
@return | [
"Gets",
"the",
"link",
"destination",
"from",
"the",
"set",
"of",
"destinations"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1099-L1103 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.getDestination | public DestinationHandler getDestination(JsDestinationAddress destinationAddr, boolean includeInvisible)
throws SITemporaryDestinationNotFoundException, SIResourceException, SINotPossibleInCurrentConfigurationException
{
return getDestination(destinationAddr.getDestinationName(),
destinationAddr.getBusName(),
includeInvisible,
false);
} | java | public DestinationHandler getDestination(JsDestinationAddress destinationAddr, boolean includeInvisible)
throws SITemporaryDestinationNotFoundException, SIResourceException, SINotPossibleInCurrentConfigurationException
{
return getDestination(destinationAddr.getDestinationName(),
destinationAddr.getBusName(),
includeInvisible,
false);
} | [
"public",
"DestinationHandler",
"getDestination",
"(",
"JsDestinationAddress",
"destinationAddr",
",",
"boolean",
"includeInvisible",
")",
"throws",
"SITemporaryDestinationNotFoundException",
",",
"SIResourceException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"return",
"getDestination",
"(",
"destinationAddr",
".",
"getDestinationName",
"(",
")",
",",
"destinationAddr",
".",
"getBusName",
"(",
")",
",",
"includeInvisible",
",",
"false",
")",
";",
"}"
] | This method provides lookup of a destination by its address.
If the destination is not
found, it throws SIDestinationNotFoundException.
@param destinationAddr
@return Destination
@throws SIDestinationNotFoundException
@throws SIMPNullParameterException
@throws SIMPDestinationCorruptException | [
"This",
"method",
"provides",
"lookup",
"of",
"a",
"destination",
"by",
"its",
"address",
".",
"If",
"the",
"destination",
"is",
"not",
"found",
"it",
"throws",
"SIDestinationNotFoundException",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1116-L1124 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.removePseudoDestination | public final void removePseudoDestination(SIBUuid12 destinationUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removePseudoDestination", destinationUuid);
destinationIndex.removePseudoUuid(destinationUuid);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removePseudoDestination");
} | java | public final void removePseudoDestination(SIBUuid12 destinationUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removePseudoDestination", destinationUuid);
destinationIndex.removePseudoUuid(destinationUuid);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removePseudoDestination");
} | [
"public",
"final",
"void",
"removePseudoDestination",
"(",
"SIBUuid12",
"destinationUuid",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removePseudoDestination\"",
",",
"destinationUuid",
")",
";",
"destinationIndex",
".",
"removePseudoUuid",
"(",
"destinationUuid",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removePseudoDestination\"",
")",
";",
"}"
] | Remove a link for a pseudo desintation ID.
@param destinationUuid The ID of the pseudo destination to remove. | [
"Remove",
"a",
"link",
"for",
"a",
"pseudo",
"desintation",
"ID",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1652-L1659 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.resetDestination | public void resetDestination(String destName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "resetDestination", destName);
try
{
DestinationHandler dh = destinationIndex.findByName(
destName,
messageProcessor.getMessagingEngineBus(),
null);
checkDestinationHandlerExists(
dh != null,
destName,
messageProcessor.getMessagingEngineBus());
// Only applicable to BaseDestinationHandlers
if (dh instanceof BaseDestinationHandler)
{
BaseDestinationHandler bdh = (BaseDestinationHandler) dh;
// Need to ensure that this change is persisted - specifically that the
// BDH "toBeIgnored" flag is persisted
LocalTransaction siTran = txManager.createLocalTransaction(true);
// Drive the object's reset method
bdh.reset();
// Change our entry in the appropriate index.
destinationIndex.reset(dh);
// Persist the change
bdh.requestUpdate((Transaction) siTran);
// commit the transaction
siTran.commit();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Have reset destination " + bdh.getName());
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Not a BDH, cannot reset destination " + dh.getName());
}
} catch (MessageStoreException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//throw e;
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//handleRollback(siTran);
// throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "resetDestination");
} | java | public void resetDestination(String destName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "resetDestination", destName);
try
{
DestinationHandler dh = destinationIndex.findByName(
destName,
messageProcessor.getMessagingEngineBus(),
null);
checkDestinationHandlerExists(
dh != null,
destName,
messageProcessor.getMessagingEngineBus());
// Only applicable to BaseDestinationHandlers
if (dh instanceof BaseDestinationHandler)
{
BaseDestinationHandler bdh = (BaseDestinationHandler) dh;
// Need to ensure that this change is persisted - specifically that the
// BDH "toBeIgnored" flag is persisted
LocalTransaction siTran = txManager.createLocalTransaction(true);
// Drive the object's reset method
bdh.reset();
// Change our entry in the appropriate index.
destinationIndex.reset(dh);
// Persist the change
bdh.requestUpdate((Transaction) siTran);
// commit the transaction
siTran.commit();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Have reset destination " + bdh.getName());
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Not a BDH, cannot reset destination " + dh.getName());
}
} catch (MessageStoreException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//throw e;
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//handleRollback(siTran);
// throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "resetDestination");
} | [
"public",
"void",
"resetDestination",
"(",
"String",
"destName",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"resetDestination\"",
",",
"destName",
")",
";",
"try",
"{",
"DestinationHandler",
"dh",
"=",
"destinationIndex",
".",
"findByName",
"(",
"destName",
",",
"messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
",",
"null",
")",
";",
"checkDestinationHandlerExists",
"(",
"dh",
"!=",
"null",
",",
"destName",
",",
"messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
")",
";",
"// Only applicable to BaseDestinationHandlers",
"if",
"(",
"dh",
"instanceof",
"BaseDestinationHandler",
")",
"{",
"BaseDestinationHandler",
"bdh",
"=",
"(",
"BaseDestinationHandler",
")",
"dh",
";",
"// Need to ensure that this change is persisted - specifically that the",
"// BDH \"toBeIgnored\" flag is persisted",
"LocalTransaction",
"siTran",
"=",
"txManager",
".",
"createLocalTransaction",
"(",
"true",
")",
";",
"// Drive the object's reset method",
"bdh",
".",
"reset",
"(",
")",
";",
"// Change our entry in the appropriate index.",
"destinationIndex",
".",
"reset",
"(",
"dh",
")",
";",
"// Persist the change",
"bdh",
".",
"requestUpdate",
"(",
"(",
"Transaction",
")",
"siTran",
")",
";",
"// commit the transaction",
"siTran",
".",
"commit",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Have reset destination \"",
"+",
"bdh",
".",
"getName",
"(",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Not a BDH, cannot reset destination \"",
"+",
"dh",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"MessageStoreException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"//throw e;",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"//handleRollback(siTran);",
"// throw e;",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"resetDestination\"",
")",
";",
"}"
] | Reset a destination.
@param destName
@throws InvalidOperationException if the destination is not one which can
be reset (e.g. it is an alias destination).
@throws SIDestinationNotFoundException | [
"Reset",
"a",
"destination",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1670-L1735 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.resetLink | public void resetLink(String linkName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "resetLink", linkName);
try
{
DestinationHandler link = linkIndex.findByName(linkName, null);
checkDestinationHandlerExists(
link != null,
linkName,
messageProcessor.getMessagingEngineBus());
// Only applicable to BaseDestinationHandlers and their children
if (link instanceof LinkHandler)
{
LinkHandler linkhandler = (LinkHandler) link;
// Need to ensure that this change is persisted - specifically that the
// BDH "toBeIgnored" flag is persisted
LocalTransaction siTran = txManager.createLocalTransaction(true);
linkhandler.reset();
// Change our entry in the appropriate index.
linkIndex.reset(link);
// Persist the change
linkhandler.requestUpdate((Transaction) siTran);
// commit the transaction
siTran.commit();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Have reset link " + linkhandler.getName());
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Not a LinkHandler, cannot reset handler for " + link.getName());
}
} catch (MessageStoreException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//throw e;
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//handleRollback(siTran);
// throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "resetLink");
} | java | public void resetLink(String linkName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "resetLink", linkName);
try
{
DestinationHandler link = linkIndex.findByName(linkName, null);
checkDestinationHandlerExists(
link != null,
linkName,
messageProcessor.getMessagingEngineBus());
// Only applicable to BaseDestinationHandlers and their children
if (link instanceof LinkHandler)
{
LinkHandler linkhandler = (LinkHandler) link;
// Need to ensure that this change is persisted - specifically that the
// BDH "toBeIgnored" flag is persisted
LocalTransaction siTran = txManager.createLocalTransaction(true);
linkhandler.reset();
// Change our entry in the appropriate index.
linkIndex.reset(link);
// Persist the change
linkhandler.requestUpdate((Transaction) siTran);
// commit the transaction
siTran.commit();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Have reset link " + linkhandler.getName());
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Not a LinkHandler, cannot reset handler for " + link.getName());
}
} catch (MessageStoreException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//throw e;
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//handleRollback(siTran);
// throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "resetLink");
} | [
"public",
"void",
"resetLink",
"(",
"String",
"linkName",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"resetLink\"",
",",
"linkName",
")",
";",
"try",
"{",
"DestinationHandler",
"link",
"=",
"linkIndex",
".",
"findByName",
"(",
"linkName",
",",
"null",
")",
";",
"checkDestinationHandlerExists",
"(",
"link",
"!=",
"null",
",",
"linkName",
",",
"messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
")",
";",
"// Only applicable to BaseDestinationHandlers and their children",
"if",
"(",
"link",
"instanceof",
"LinkHandler",
")",
"{",
"LinkHandler",
"linkhandler",
"=",
"(",
"LinkHandler",
")",
"link",
";",
"// Need to ensure that this change is persisted - specifically that the",
"// BDH \"toBeIgnored\" flag is persisted",
"LocalTransaction",
"siTran",
"=",
"txManager",
".",
"createLocalTransaction",
"(",
"true",
")",
";",
"linkhandler",
".",
"reset",
"(",
")",
";",
"// Change our entry in the appropriate index.",
"linkIndex",
".",
"reset",
"(",
"link",
")",
";",
"// Persist the change",
"linkhandler",
".",
"requestUpdate",
"(",
"(",
"Transaction",
")",
"siTran",
")",
";",
"// commit the transaction",
"siTran",
".",
"commit",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Have reset link \"",
"+",
"linkhandler",
".",
"getName",
"(",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Not a LinkHandler, cannot reset handler for \"",
"+",
"link",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"MessageStoreException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"//throw e;",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"//handleRollback(siTran);",
"// throw e;",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"resetLink\"",
")",
";",
"}"
] | Reset a link.
@param linkName
@throws InvalidOperationException if the link is not one which can
be reset.
@throws SINotPossibleInCurrentConfigurationException | [
"Reset",
"a",
"link",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1746-L1807 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.getLinkDefinition | public VirtualLinkDefinition getLinkDefinition(String busName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getLinkDefinition", busName);
ForeignBusDefinition foreignBus = messageProcessor.getForeignBus(busName);
VirtualLinkDefinition link = null;
if (foreignBus != null && foreignBus.hasLink())
{
try
{
link = foreignBus.getLink();
} catch (SIBExceptionNoLinkExists e)
{
// SIBExceptionNoLinkExists shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.DestinationManager.getLinkDefinition",
"1:1951:1.508.1.7",
this);
SibTr.exception(tc, e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getLinkDefinition", link);
return link;
} | java | public VirtualLinkDefinition getLinkDefinition(String busName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getLinkDefinition", busName);
ForeignBusDefinition foreignBus = messageProcessor.getForeignBus(busName);
VirtualLinkDefinition link = null;
if (foreignBus != null && foreignBus.hasLink())
{
try
{
link = foreignBus.getLink();
} catch (SIBExceptionNoLinkExists e)
{
// SIBExceptionNoLinkExists shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.DestinationManager.getLinkDefinition",
"1:1951:1.508.1.7",
this);
SibTr.exception(tc, e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getLinkDefinition", link);
return link;
} | [
"public",
"VirtualLinkDefinition",
"getLinkDefinition",
"(",
"String",
"busName",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getLinkDefinition\"",
",",
"busName",
")",
";",
"ForeignBusDefinition",
"foreignBus",
"=",
"messageProcessor",
".",
"getForeignBus",
"(",
"busName",
")",
";",
"VirtualLinkDefinition",
"link",
"=",
"null",
";",
"if",
"(",
"foreignBus",
"!=",
"null",
"&&",
"foreignBus",
".",
"hasLink",
"(",
")",
")",
"{",
"try",
"{",
"link",
"=",
"foreignBus",
".",
"getLink",
"(",
")",
";",
"}",
"catch",
"(",
"SIBExceptionNoLinkExists",
"e",
")",
"{",
"// SIBExceptionNoLinkExists shouldn't occur so FFDC.",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.DestinationManager.getLinkDefinition\"",
",",
"\"1:1951:1.508.1.7\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getLinkDefinition\"",
",",
"link",
")",
";",
"return",
"link",
";",
"}"
] | Returns the link definition of the link used to connect to the given busname
@return VirtualLinkDefinition | [
"Returns",
"the",
"link",
"definition",
"of",
"the",
"link",
"used",
"to",
"connect",
"to",
"the",
"given",
"busname"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1814-L1845 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.getTopicSpaceMapping | public String getTopicSpaceMapping(String busName, SIBUuid12 topicSpace)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getTopicSpaceMapping", new Object[] { busName, topicSpace });
VirtualLinkDefinition linkDef = getLinkDefinition(busName);
//this is only called internally so we shall include invisible dests in the lookup
String topicSpaceName = getDestinationInternal(topicSpace, true).getName();
String mapping = null;
if (linkDef != null && linkDef.getTopicSpaceMappings() != null)
mapping = (String) linkDef.getTopicSpaceMappings().get(topicSpaceName);
else
// Local ME
mapping = topicSpaceName;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getTopicSpaceMapping", mapping);
return mapping;
} | java | public String getTopicSpaceMapping(String busName, SIBUuid12 topicSpace)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getTopicSpaceMapping", new Object[] { busName, topicSpace });
VirtualLinkDefinition linkDef = getLinkDefinition(busName);
//this is only called internally so we shall include invisible dests in the lookup
String topicSpaceName = getDestinationInternal(topicSpace, true).getName();
String mapping = null;
if (linkDef != null && linkDef.getTopicSpaceMappings() != null)
mapping = (String) linkDef.getTopicSpaceMappings().get(topicSpaceName);
else
// Local ME
mapping = topicSpaceName;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getTopicSpaceMapping", mapping);
return mapping;
} | [
"public",
"String",
"getTopicSpaceMapping",
"(",
"String",
"busName",
",",
"SIBUuid12",
"topicSpace",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getTopicSpaceMapping\"",
",",
"new",
"Object",
"[",
"]",
"{",
"busName",
",",
"topicSpace",
"}",
")",
";",
"VirtualLinkDefinition",
"linkDef",
"=",
"getLinkDefinition",
"(",
"busName",
")",
";",
"//this is only called internally so we shall include invisible dests in the lookup",
"String",
"topicSpaceName",
"=",
"getDestinationInternal",
"(",
"topicSpace",
",",
"true",
")",
".",
"getName",
"(",
")",
";",
"String",
"mapping",
"=",
"null",
";",
"if",
"(",
"linkDef",
"!=",
"null",
"&&",
"linkDef",
".",
"getTopicSpaceMappings",
"(",
")",
"!=",
"null",
")",
"mapping",
"=",
"(",
"String",
")",
"linkDef",
".",
"getTopicSpaceMappings",
"(",
")",
".",
"get",
"(",
"topicSpaceName",
")",
";",
"else",
"// Local ME",
"mapping",
"=",
"topicSpaceName",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getTopicSpaceMapping\"",
",",
"mapping",
")",
";",
"return",
"mapping",
";",
"}"
] | Returns the topicSpaceName of the foreign topicSpace
@param String The busname of the foreign TS
@param SIBUuid12 The uuid of the TS on this bus
@return String The foreign TS name | [
"Returns",
"the",
"topicSpaceName",
"of",
"the",
"foreign",
"topicSpace"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1854-L1873 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.createNewTemporaryDestinationName | String createNewTemporaryDestinationName(String destinationPrefix,
SIBUuid8 meUuid,
Distribution distribution)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createNewTemporaryDestinationName",
new Object[] { destinationPrefix, meUuid, distribution });
if (destinationPrefix != null)
{
if (destinationPrefix.length() > 12)
destinationPrefix = destinationPrefix.substring(0, 12);
}
else
destinationPrefix = "";
// Get the next available temporary destination count.
long count = messageProcessor.nextTick();
// Suffix is the tempdest count as 8 char hex with leading zeros
StringBuffer sb = new StringBuffer("0000000000000000" + Long.toHexString(count).toUpperCase());
String uniqueSuffix = sb.substring(sb.length() - 16).toString();
String tempPrefix = null;
if (distribution == Distribution.ONE)
tempPrefix = SIMPConstants.TEMPORARY_QUEUE_DESTINATION_PREFIX;
else
tempPrefix = SIMPConstants.TEMPORARY_PUBSUB_DESTINATION_PREFIX;
// Generate the unique name for the temporary destination.
String name =
tempPrefix
+ destinationPrefix
+ SIMPConstants.SYSTEM_DESTINATION_SEPARATOR
+ meUuid
+ uniqueSuffix;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createNewTemporaryDestinationName", name);
return name;
} | java | String createNewTemporaryDestinationName(String destinationPrefix,
SIBUuid8 meUuid,
Distribution distribution)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createNewTemporaryDestinationName",
new Object[] { destinationPrefix, meUuid, distribution });
if (destinationPrefix != null)
{
if (destinationPrefix.length() > 12)
destinationPrefix = destinationPrefix.substring(0, 12);
}
else
destinationPrefix = "";
// Get the next available temporary destination count.
long count = messageProcessor.nextTick();
// Suffix is the tempdest count as 8 char hex with leading zeros
StringBuffer sb = new StringBuffer("0000000000000000" + Long.toHexString(count).toUpperCase());
String uniqueSuffix = sb.substring(sb.length() - 16).toString();
String tempPrefix = null;
if (distribution == Distribution.ONE)
tempPrefix = SIMPConstants.TEMPORARY_QUEUE_DESTINATION_PREFIX;
else
tempPrefix = SIMPConstants.TEMPORARY_PUBSUB_DESTINATION_PREFIX;
// Generate the unique name for the temporary destination.
String name =
tempPrefix
+ destinationPrefix
+ SIMPConstants.SYSTEM_DESTINATION_SEPARATOR
+ meUuid
+ uniqueSuffix;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createNewTemporaryDestinationName", name);
return name;
} | [
"String",
"createNewTemporaryDestinationName",
"(",
"String",
"destinationPrefix",
",",
"SIBUuid8",
"meUuid",
",",
"Distribution",
"distribution",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createNewTemporaryDestinationName\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destinationPrefix",
",",
"meUuid",
",",
"distribution",
"}",
")",
";",
"if",
"(",
"destinationPrefix",
"!=",
"null",
")",
"{",
"if",
"(",
"destinationPrefix",
".",
"length",
"(",
")",
">",
"12",
")",
"destinationPrefix",
"=",
"destinationPrefix",
".",
"substring",
"(",
"0",
",",
"12",
")",
";",
"}",
"else",
"destinationPrefix",
"=",
"\"\"",
";",
"// Get the next available temporary destination count.",
"long",
"count",
"=",
"messageProcessor",
".",
"nextTick",
"(",
")",
";",
"// Suffix is the tempdest count as 8 char hex with leading zeros",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"\"0000000000000000\"",
"+",
"Long",
".",
"toHexString",
"(",
"count",
")",
".",
"toUpperCase",
"(",
")",
")",
";",
"String",
"uniqueSuffix",
"=",
"sb",
".",
"substring",
"(",
"sb",
".",
"length",
"(",
")",
"-",
"16",
")",
".",
"toString",
"(",
")",
";",
"String",
"tempPrefix",
"=",
"null",
";",
"if",
"(",
"distribution",
"==",
"Distribution",
".",
"ONE",
")",
"tempPrefix",
"=",
"SIMPConstants",
".",
"TEMPORARY_QUEUE_DESTINATION_PREFIX",
";",
"else",
"tempPrefix",
"=",
"SIMPConstants",
".",
"TEMPORARY_PUBSUB_DESTINATION_PREFIX",
";",
"// Generate the unique name for the temporary destination.",
"String",
"name",
"=",
"tempPrefix",
"+",
"destinationPrefix",
"+",
"SIMPConstants",
".",
"SYSTEM_DESTINATION_SEPARATOR",
"+",
"meUuid",
"+",
"uniqueSuffix",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createNewTemporaryDestinationName\"",
",",
"name",
")",
";",
"return",
"name",
";",
"}"
] | Creates a new name for a temporary destination.
Uses the Message Store Tick count to generate the unique suffix for the temporary destination
@param destinationPrefix
@param meUuid
@param distribution
@return
@throws SILimitExceededException | [
"Creates",
"a",
"new",
"name",
"for",
"a",
"temporary",
"destination",
".",
"Uses",
"the",
"Message",
"Store",
"Tick",
"count",
"to",
"generate",
"the",
"unique",
"suffix",
"for",
"the",
"temporary",
"destination"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L2054-L2097 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.removeDestination | protected void removeDestination(DestinationHandler dh)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeDestination", dh);
if (dh.isLink())
{
if (linkIndex.containsKey(dh))
{
linkIndex.remove(dh);
}
}
else
{
if (destinationIndex.containsKey(dh))
{
destinationIndex.remove(dh);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeDestination");
} | java | protected void removeDestination(DestinationHandler dh)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeDestination", dh);
if (dh.isLink())
{
if (linkIndex.containsKey(dh))
{
linkIndex.remove(dh);
}
}
else
{
if (destinationIndex.containsKey(dh))
{
destinationIndex.remove(dh);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeDestination");
} | [
"protected",
"void",
"removeDestination",
"(",
"DestinationHandler",
"dh",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removeDestination\"",
",",
"dh",
")",
";",
"if",
"(",
"dh",
".",
"isLink",
"(",
")",
")",
"{",
"if",
"(",
"linkIndex",
".",
"containsKey",
"(",
"dh",
")",
")",
"{",
"linkIndex",
".",
"remove",
"(",
"dh",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"destinationIndex",
".",
"containsKey",
"(",
"dh",
")",
")",
"{",
"destinationIndex",
".",
"remove",
"(",
"dh",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeDestination\"",
")",
";",
"}"
] | Remove the given destination from the DestinationManager.
This will only be a BaseDestinationHandler removing either a link
or a destination.
@param dh The DestinationHandler to remove. | [
"Remove",
"the",
"given",
"destination",
"from",
"the",
"DestinationManager",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L2201-L2223 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.createTransmissionDestination | protected void createTransmissionDestination(SIBUuid8 remoteMEUuid) throws SIResourceException, SIMPDestinationAlreadyExistsException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createTransmissionDestination", remoteMEUuid);
String destinationName = remoteMEUuid.toString();
DestinationDefinition destinationDefinition;
destinationDefinition = messageProcessor.createDestinationDefinition(DestinationType.QUEUE, destinationName);
destinationDefinition.setMaxReliability(Reliability.ASSURED_PERSISTENT);
destinationDefinition.setDefaultReliability(Reliability.ASSURED_PERSISTENT);
Set<String> destinationLocalizingSet = new HashSet<String>();
destinationLocalizingSet.add(messageProcessor.getMessagingEngineUuid().toString());
// Create the transmission destination
createDestinationLocalization(
destinationDefinition,
messageProcessor.createLocalizationDefinition(destinationDefinition.getName()),
destinationLocalizingSet,
false);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createTransmissionDestination");
} | java | protected void createTransmissionDestination(SIBUuid8 remoteMEUuid) throws SIResourceException, SIMPDestinationAlreadyExistsException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createTransmissionDestination", remoteMEUuid);
String destinationName = remoteMEUuid.toString();
DestinationDefinition destinationDefinition;
destinationDefinition = messageProcessor.createDestinationDefinition(DestinationType.QUEUE, destinationName);
destinationDefinition.setMaxReliability(Reliability.ASSURED_PERSISTENT);
destinationDefinition.setDefaultReliability(Reliability.ASSURED_PERSISTENT);
Set<String> destinationLocalizingSet = new HashSet<String>();
destinationLocalizingSet.add(messageProcessor.getMessagingEngineUuid().toString());
// Create the transmission destination
createDestinationLocalization(
destinationDefinition,
messageProcessor.createLocalizationDefinition(destinationDefinition.getName()),
destinationLocalizingSet,
false);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createTransmissionDestination");
} | [
"protected",
"void",
"createTransmissionDestination",
"(",
"SIBUuid8",
"remoteMEUuid",
")",
"throws",
"SIResourceException",
",",
"SIMPDestinationAlreadyExistsException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createTransmissionDestination\"",
",",
"remoteMEUuid",
")",
";",
"String",
"destinationName",
"=",
"remoteMEUuid",
".",
"toString",
"(",
")",
";",
"DestinationDefinition",
"destinationDefinition",
";",
"destinationDefinition",
"=",
"messageProcessor",
".",
"createDestinationDefinition",
"(",
"DestinationType",
".",
"QUEUE",
",",
"destinationName",
")",
";",
"destinationDefinition",
".",
"setMaxReliability",
"(",
"Reliability",
".",
"ASSURED_PERSISTENT",
")",
";",
"destinationDefinition",
".",
"setDefaultReliability",
"(",
"Reliability",
".",
"ASSURED_PERSISTENT",
")",
";",
"Set",
"<",
"String",
">",
"destinationLocalizingSet",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"destinationLocalizingSet",
".",
"add",
"(",
"messageProcessor",
".",
"getMessagingEngineUuid",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"// Create the transmission destination",
"createDestinationLocalization",
"(",
"destinationDefinition",
",",
"messageProcessor",
".",
"createLocalizationDefinition",
"(",
"destinationDefinition",
".",
"getName",
"(",
")",
")",
",",
"destinationLocalizingSet",
",",
"false",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createTransmissionDestination\"",
")",
";",
"}"
] | Method createTransmissionDestination.
<p>Create a transmission queue destination for the remote ME
uuid specified.</p>
@param remoteMEUuid | [
"Method",
"createTransmissionDestination",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L2233-L2254 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.reconcileRemote | public void reconcileRemote()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reconcileRemote");
DestinationTypeFilter filter = new DestinationTypeFilter();
//filter.REMOTE = Boolean.TRUE;
filter.UNRECONCILED = Boolean.TRUE;
SIMPIterator itr = destinationIndex.iterator(filter);
while (itr.hasNext())
{
BaseDestinationHandler dh = (BaseDestinationHandler) itr.next();
//Dont reconcile destinations awaiting deletion
if (!dh.isToBeDeleted())
{
String destName = dh.getName();
SIBUuid12 destUuid = dh.getUuid();
// CallBack to Admin
try
{
// Note: Currently alias and foreign destinations are the only destinations that might
// have a busname other than the local bus, but aliases are not persisted
// over a restart so we can always look up destinations on the local bus.
// Passing in null, assumes the local bus.
BaseDestinationDefinition dDef =
messageProcessor.getMessagingEngine().getSIBDestination(null, destName);
if (!(dDef.getUUID().equals(dh.getUuid())))
{
//The destination has a different uuid. Mark the existing one for deletion
try
{
// Set the deletion flag in the DH persistently. A transaction per DH??
LocalTransaction siTran = txManager.createLocalTransaction(true);
dh.setToBeDeleted(true);
destinationIndex.delete(dh);
dh.requestUpdate((Transaction) siTran);
// commit the transaction
siTran.commit();
SibTr.info(tc, "REMOTE_DEST_DELETE_INFO_CWSIP0066",
new Object[] { dh.getName(), dh.getUuid() });
} catch (MessageStoreException me)
{
// No FFDC code needed
SibTr.exception(tc, me);
//throw e;
} catch (SIException ce)
{
// No FFDC code needed
SibTr.exception(tc, ce);
//handleRollback(siTran);
// throw e;
}
}
else
{
// Passing in null, assumes the local bus.
Set<String> queuePointLocalisationSet =
messageProcessor.getMessagingEngine().getSIBDestinationLocalitySet(null, destUuid.toString());
// Need to update the destination definition
dh.updateDefinition(dDef);
// Update the set of localising messaging engines for the destinationHandler.
// Dont create remote localisations up front. This can be done
// if WLM picks one of them
dh.updateLocalizationSet(queuePointLocalisationSet);
// Alert the lookups object to handle the re-definition
destinationIndex.setLocalizationFlags(dh);
destinationIndex.create(dh);
// If we have localization streams that need to be deleted for a destination
// that still exists, we should mark the destination for cleanup.
if (dh.getHasReconciledStreamsToBeDeleted())
{
destinationIndex.cleanup(dh);
}
}
} catch (SIBExceptionDestinationNotFound e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// Admin could not find the destination, mark it for deletion
try
{
// Set the deletion flag in the DH persistently. A transaction per DH??
LocalTransaction siTran = txManager.createLocalTransaction(true);
dh.setToBeDeleted(true);
destinationIndex.delete(dh);
dh.requestUpdate((Transaction) siTran);
// commit the transaction
siTran.commit();
SibTr.info(tc, "REMOTE_DEST_DELETE_INFO_CWSIP0066",
new Object[] { dh.getName(), dh.getUuid() });
} catch (MessageStoreException me)
{
// No FFDC code needed
SibTr.exception(tc, e);
//throw e;
} catch (SIException ce)
{
// No FFDC code needed
SibTr.exception(tc, e);
//handleRollback(siTran);
// throw e;
}
} catch (SIBExceptionBase e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// TO DO - handle this
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// TO DO - handle this
}
}
else
{
// This destination doesn't have any streams left to reconcile (they must
// have been removed prior to shutting down the ME) but we still need to
// get the root DestinationHandler deleted, so set the state to DELETE_PENDING
// so that the AsynchDeletionThread picks it up and removes it (524796).
destinationIndex.delete(dh);
}
}
itr.finished();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconcileRemote");
} | java | public void reconcileRemote()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reconcileRemote");
DestinationTypeFilter filter = new DestinationTypeFilter();
//filter.REMOTE = Boolean.TRUE;
filter.UNRECONCILED = Boolean.TRUE;
SIMPIterator itr = destinationIndex.iterator(filter);
while (itr.hasNext())
{
BaseDestinationHandler dh = (BaseDestinationHandler) itr.next();
//Dont reconcile destinations awaiting deletion
if (!dh.isToBeDeleted())
{
String destName = dh.getName();
SIBUuid12 destUuid = dh.getUuid();
// CallBack to Admin
try
{
// Note: Currently alias and foreign destinations are the only destinations that might
// have a busname other than the local bus, but aliases are not persisted
// over a restart so we can always look up destinations on the local bus.
// Passing in null, assumes the local bus.
BaseDestinationDefinition dDef =
messageProcessor.getMessagingEngine().getSIBDestination(null, destName);
if (!(dDef.getUUID().equals(dh.getUuid())))
{
//The destination has a different uuid. Mark the existing one for deletion
try
{
// Set the deletion flag in the DH persistently. A transaction per DH??
LocalTransaction siTran = txManager.createLocalTransaction(true);
dh.setToBeDeleted(true);
destinationIndex.delete(dh);
dh.requestUpdate((Transaction) siTran);
// commit the transaction
siTran.commit();
SibTr.info(tc, "REMOTE_DEST_DELETE_INFO_CWSIP0066",
new Object[] { dh.getName(), dh.getUuid() });
} catch (MessageStoreException me)
{
// No FFDC code needed
SibTr.exception(tc, me);
//throw e;
} catch (SIException ce)
{
// No FFDC code needed
SibTr.exception(tc, ce);
//handleRollback(siTran);
// throw e;
}
}
else
{
// Passing in null, assumes the local bus.
Set<String> queuePointLocalisationSet =
messageProcessor.getMessagingEngine().getSIBDestinationLocalitySet(null, destUuid.toString());
// Need to update the destination definition
dh.updateDefinition(dDef);
// Update the set of localising messaging engines for the destinationHandler.
// Dont create remote localisations up front. This can be done
// if WLM picks one of them
dh.updateLocalizationSet(queuePointLocalisationSet);
// Alert the lookups object to handle the re-definition
destinationIndex.setLocalizationFlags(dh);
destinationIndex.create(dh);
// If we have localization streams that need to be deleted for a destination
// that still exists, we should mark the destination for cleanup.
if (dh.getHasReconciledStreamsToBeDeleted())
{
destinationIndex.cleanup(dh);
}
}
} catch (SIBExceptionDestinationNotFound e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// Admin could not find the destination, mark it for deletion
try
{
// Set the deletion flag in the DH persistently. A transaction per DH??
LocalTransaction siTran = txManager.createLocalTransaction(true);
dh.setToBeDeleted(true);
destinationIndex.delete(dh);
dh.requestUpdate((Transaction) siTran);
// commit the transaction
siTran.commit();
SibTr.info(tc, "REMOTE_DEST_DELETE_INFO_CWSIP0066",
new Object[] { dh.getName(), dh.getUuid() });
} catch (MessageStoreException me)
{
// No FFDC code needed
SibTr.exception(tc, e);
//throw e;
} catch (SIException ce)
{
// No FFDC code needed
SibTr.exception(tc, e);
//handleRollback(siTran);
// throw e;
}
} catch (SIBExceptionBase e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// TO DO - handle this
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// TO DO - handle this
}
}
else
{
// This destination doesn't have any streams left to reconcile (they must
// have been removed prior to shutting down the ME) but we still need to
// get the root DestinationHandler deleted, so set the state to DELETE_PENDING
// so that the AsynchDeletionThread picks it up and removes it (524796).
destinationIndex.delete(dh);
}
}
itr.finished();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconcileRemote");
} | [
"public",
"void",
"reconcileRemote",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"reconcileRemote\"",
")",
";",
"DestinationTypeFilter",
"filter",
"=",
"new",
"DestinationTypeFilter",
"(",
")",
";",
"//filter.REMOTE = Boolean.TRUE;",
"filter",
".",
"UNRECONCILED",
"=",
"Boolean",
".",
"TRUE",
";",
"SIMPIterator",
"itr",
"=",
"destinationIndex",
".",
"iterator",
"(",
"filter",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"BaseDestinationHandler",
"dh",
"=",
"(",
"BaseDestinationHandler",
")",
"itr",
".",
"next",
"(",
")",
";",
"//Dont reconcile destinations awaiting deletion",
"if",
"(",
"!",
"dh",
".",
"isToBeDeleted",
"(",
")",
")",
"{",
"String",
"destName",
"=",
"dh",
".",
"getName",
"(",
")",
";",
"SIBUuid12",
"destUuid",
"=",
"dh",
".",
"getUuid",
"(",
")",
";",
"// CallBack to Admin",
"try",
"{",
"// Note: Currently alias and foreign destinations are the only destinations that might",
"// have a busname other than the local bus, but aliases are not persisted",
"// over a restart so we can always look up destinations on the local bus.",
"// Passing in null, assumes the local bus.",
"BaseDestinationDefinition",
"dDef",
"=",
"messageProcessor",
".",
"getMessagingEngine",
"(",
")",
".",
"getSIBDestination",
"(",
"null",
",",
"destName",
")",
";",
"if",
"(",
"!",
"(",
"dDef",
".",
"getUUID",
"(",
")",
".",
"equals",
"(",
"dh",
".",
"getUuid",
"(",
")",
")",
")",
")",
"{",
"//The destination has a different uuid. Mark the existing one for deletion",
"try",
"{",
"// Set the deletion flag in the DH persistently. A transaction per DH??",
"LocalTransaction",
"siTran",
"=",
"txManager",
".",
"createLocalTransaction",
"(",
"true",
")",
";",
"dh",
".",
"setToBeDeleted",
"(",
"true",
")",
";",
"destinationIndex",
".",
"delete",
"(",
"dh",
")",
";",
"dh",
".",
"requestUpdate",
"(",
"(",
"Transaction",
")",
"siTran",
")",
";",
"// commit the transaction",
"siTran",
".",
"commit",
"(",
")",
";",
"SibTr",
".",
"info",
"(",
"tc",
",",
"\"REMOTE_DEST_DELETE_INFO_CWSIP0066\"",
",",
"new",
"Object",
"[",
"]",
"{",
"dh",
".",
"getName",
"(",
")",
",",
"dh",
".",
"getUuid",
"(",
")",
"}",
")",
";",
"}",
"catch",
"(",
"MessageStoreException",
"me",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"me",
")",
";",
"//throw e;",
"}",
"catch",
"(",
"SIException",
"ce",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"ce",
")",
";",
"//handleRollback(siTran);",
"// throw e;",
"}",
"}",
"else",
"{",
"// Passing in null, assumes the local bus.",
"Set",
"<",
"String",
">",
"queuePointLocalisationSet",
"=",
"messageProcessor",
".",
"getMessagingEngine",
"(",
")",
".",
"getSIBDestinationLocalitySet",
"(",
"null",
",",
"destUuid",
".",
"toString",
"(",
")",
")",
";",
"// Need to update the destination definition",
"dh",
".",
"updateDefinition",
"(",
"dDef",
")",
";",
"// Update the set of localising messaging engines for the destinationHandler.",
"// Dont create remote localisations up front. This can be done",
"// if WLM picks one of them",
"dh",
".",
"updateLocalizationSet",
"(",
"queuePointLocalisationSet",
")",
";",
"// Alert the lookups object to handle the re-definition",
"destinationIndex",
".",
"setLocalizationFlags",
"(",
"dh",
")",
";",
"destinationIndex",
".",
"create",
"(",
"dh",
")",
";",
"// If we have localization streams that need to be deleted for a destination",
"// that still exists, we should mark the destination for cleanup.",
"if",
"(",
"dh",
".",
"getHasReconciledStreamsToBeDeleted",
"(",
")",
")",
"{",
"destinationIndex",
".",
"cleanup",
"(",
"dh",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"SIBExceptionDestinationNotFound",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// Admin could not find the destination, mark it for deletion",
"try",
"{",
"// Set the deletion flag in the DH persistently. A transaction per DH??",
"LocalTransaction",
"siTran",
"=",
"txManager",
".",
"createLocalTransaction",
"(",
"true",
")",
";",
"dh",
".",
"setToBeDeleted",
"(",
"true",
")",
";",
"destinationIndex",
".",
"delete",
"(",
"dh",
")",
";",
"dh",
".",
"requestUpdate",
"(",
"(",
"Transaction",
")",
"siTran",
")",
";",
"// commit the transaction",
"siTran",
".",
"commit",
"(",
")",
";",
"SibTr",
".",
"info",
"(",
"tc",
",",
"\"REMOTE_DEST_DELETE_INFO_CWSIP0066\"",
",",
"new",
"Object",
"[",
"]",
"{",
"dh",
".",
"getName",
"(",
")",
",",
"dh",
".",
"getUuid",
"(",
")",
"}",
")",
";",
"}",
"catch",
"(",
"MessageStoreException",
"me",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"//throw e;",
"}",
"catch",
"(",
"SIException",
"ce",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"//handleRollback(siTran);",
"// throw e;",
"}",
"}",
"catch",
"(",
"SIBExceptionBase",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// TO DO - handle this",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// TO DO - handle this",
"}",
"}",
"else",
"{",
"// This destination doesn't have any streams left to reconcile (they must",
"// have been removed prior to shutting down the ME) but we still need to",
"// get the root DestinationHandler deleted, so set the state to DELETE_PENDING",
"// so that the AsynchDeletionThread picks it up and removes it (524796).",
"destinationIndex",
".",
"delete",
"(",
"dh",
")",
";",
"}",
"}",
"itr",
".",
"finished",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"reconcileRemote\"",
")",
";",
"}"
] | This method is used to perform remote Destination reconciliation tasks | [
"This",
"method",
"is",
"used",
"to",
"perform",
"remote",
"Destination",
"reconciliation",
"tasks"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L2462-L2617 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.checkDestinationHandlerExists | private void checkDestinationHandlerExists(
boolean condition, String destName, String engineName) throws SINotPossibleInCurrentConfigurationException, SITemporaryDestinationNotFoundException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkDestinationHandlerExists",
new Object[] { new Boolean(condition), destName, engineName });
if (!condition)
{
if (destName.startsWith(SIMPConstants.TEMPORARY_QUEUE_DESTINATION_PREFIX) ||
destName.startsWith(SIMPConstants.TEMPORARY_PUBSUB_DESTINATION_PREFIX))
{
SIMPTemporaryDestinationNotFoundException e = new SIMPTemporaryDestinationNotFoundException(
nls.getFormattedMessage(
"TEMPORARY_DESTINATION_NAME_ERROR_CWSIP0097",
new Object[] { destName },
null));
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationHandlerExists", e);
throw e;
}
SIMPNotPossibleInCurrentConfigurationException e = new SIMPNotPossibleInCurrentConfigurationException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_15", // DESTINATION_NOT_FOUND_ERROR_CWSIP0042
new Object[] { destName, engineName },
null));
e.setExceptionReason(SIRCConstants.SIRC0015_DESTINATION_NOT_FOUND_ERROR);
e.setExceptionInserts(new String[] { destName, engineName });
SibTr.exception(tc, e);
// Log a warning message to assist in PD. We use the suppressor to avoid
// multiple messages for the same destination.
SibTr.warning(tc_cwsik,
SibTr.Suppressor.ALL_FOR_A_WHILE_SIMILAR_INSERTS,
"DELIVERY_ERROR_SIRC_15",
new Object[] { destName, engineName });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationHandlerExists", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationHandlerExists");
} | java | private void checkDestinationHandlerExists(
boolean condition, String destName, String engineName) throws SINotPossibleInCurrentConfigurationException, SITemporaryDestinationNotFoundException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkDestinationHandlerExists",
new Object[] { new Boolean(condition), destName, engineName });
if (!condition)
{
if (destName.startsWith(SIMPConstants.TEMPORARY_QUEUE_DESTINATION_PREFIX) ||
destName.startsWith(SIMPConstants.TEMPORARY_PUBSUB_DESTINATION_PREFIX))
{
SIMPTemporaryDestinationNotFoundException e = new SIMPTemporaryDestinationNotFoundException(
nls.getFormattedMessage(
"TEMPORARY_DESTINATION_NAME_ERROR_CWSIP0097",
new Object[] { destName },
null));
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationHandlerExists", e);
throw e;
}
SIMPNotPossibleInCurrentConfigurationException e = new SIMPNotPossibleInCurrentConfigurationException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_15", // DESTINATION_NOT_FOUND_ERROR_CWSIP0042
new Object[] { destName, engineName },
null));
e.setExceptionReason(SIRCConstants.SIRC0015_DESTINATION_NOT_FOUND_ERROR);
e.setExceptionInserts(new String[] { destName, engineName });
SibTr.exception(tc, e);
// Log a warning message to assist in PD. We use the suppressor to avoid
// multiple messages for the same destination.
SibTr.warning(tc_cwsik,
SibTr.Suppressor.ALL_FOR_A_WHILE_SIMILAR_INSERTS,
"DELIVERY_ERROR_SIRC_15",
new Object[] { destName, engineName });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationHandlerExists", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationHandlerExists");
} | [
"private",
"void",
"checkDestinationHandlerExists",
"(",
"boolean",
"condition",
",",
"String",
"destName",
",",
"String",
"engineName",
")",
"throws",
"SINotPossibleInCurrentConfigurationException",
",",
"SITemporaryDestinationNotFoundException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkDestinationHandlerExists\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Boolean",
"(",
"condition",
")",
",",
"destName",
",",
"engineName",
"}",
")",
";",
"if",
"(",
"!",
"condition",
")",
"{",
"if",
"(",
"destName",
".",
"startsWith",
"(",
"SIMPConstants",
".",
"TEMPORARY_QUEUE_DESTINATION_PREFIX",
")",
"||",
"destName",
".",
"startsWith",
"(",
"SIMPConstants",
".",
"TEMPORARY_PUBSUB_DESTINATION_PREFIX",
")",
")",
"{",
"SIMPTemporaryDestinationNotFoundException",
"e",
"=",
"new",
"SIMPTemporaryDestinationNotFoundException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"TEMPORARY_DESTINATION_NAME_ERROR_CWSIP0097\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destName",
"}",
",",
"null",
")",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkDestinationHandlerExists\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"SIMPNotPossibleInCurrentConfigurationException",
"e",
"=",
"new",
"SIMPNotPossibleInCurrentConfigurationException",
"(",
"nls_cwsik",
".",
"getFormattedMessage",
"(",
"\"DELIVERY_ERROR_SIRC_15\"",
",",
"// DESTINATION_NOT_FOUND_ERROR_CWSIP0042",
"new",
"Object",
"[",
"]",
"{",
"destName",
",",
"engineName",
"}",
",",
"null",
")",
")",
";",
"e",
".",
"setExceptionReason",
"(",
"SIRCConstants",
".",
"SIRC0015_DESTINATION_NOT_FOUND_ERROR",
")",
";",
"e",
".",
"setExceptionInserts",
"(",
"new",
"String",
"[",
"]",
"{",
"destName",
",",
"engineName",
"}",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// Log a warning message to assist in PD. We use the suppressor to avoid",
"// multiple messages for the same destination.",
"SibTr",
".",
"warning",
"(",
"tc_cwsik",
",",
"SibTr",
".",
"Suppressor",
".",
"ALL_FOR_A_WHILE_SIMILAR_INSERTS",
",",
"\"DELIVERY_ERROR_SIRC_15\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destName",
",",
"engineName",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkDestinationHandlerExists\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkDestinationHandlerExists\"",
")",
";",
"}"
] | Asserts that a DestinationHandler exists. Throws out the
appropriate exception if the condition has failed.
@param condition This is the existence check. An expression here should
evaluate to true if the destination exists, false otherwise.
For example, a simple expression here could be (dh != null).
@param destName The destination we were looking for.
@param engineName The engine name for the destination we were looking for.
@throws SITemporaryDestinationNotFoundException
@throws SINotPossibleInCurrentConfigurationException | [
"Asserts",
"that",
"a",
"DestinationHandler",
"exists",
".",
"Throws",
"out",
"the",
"appropriate",
"exception",
"if",
"the",
"condition",
"has",
"failed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L4117-L4171 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.checkBusExists | private void checkBusExists(boolean condition, String foreignBusName, boolean linkError, Throwable cause)
throws SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkBusExists",
new Object[] { new Boolean(condition), foreignBusName, Boolean.valueOf(linkError), cause });
if (!condition)
{
String errorMsg = "DELIVERY_ERROR_SIRC_38";
int reason = SIRCConstants.SIRC0038_FOREIGN_BUS_NOT_FOUND_ERROR;
if (linkError && cause != null)
{
reason = SIRCConstants.SIRC0041_FOREIGN_BUS_LINK_NOT_DEFINED_ERROR;
errorMsg = "DELIVERY_ERROR_SIRC_41";
}
else if (cause != null)
{
reason = SIRCConstants.SIRC0039_FOREIGN_BUS_NOT_FOUND_ERROR;
errorMsg = "DELIVERY_ERROR_SIRC_39";
}
SIMPNotPossibleInCurrentConfigurationException e = null;
if (cause == null)
{
e = new SIMPNotPossibleInCurrentConfigurationException(
nls_cwsik.getFormattedMessage(
errorMsg,
new Object[] { foreignBusName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus() },
null));
e.setExceptionInserts(new String[] { foreignBusName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus() });
e.setExceptionReason(reason);
}
else
{
e = new SIMPNotPossibleInCurrentConfigurationException(
nls_cwsik.getFormattedMessage(
errorMsg,
new Object[] { foreignBusName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus(),
SIMPUtils.getStackTrace(cause) },
null));
e.setExceptionInserts(new String[] { foreignBusName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus(),
SIMPUtils.getStackTrace(cause) });
e.setExceptionReason(reason);
}
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkBusExists", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkBusExists");
} | java | private void checkBusExists(boolean condition, String foreignBusName, boolean linkError, Throwable cause)
throws SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkBusExists",
new Object[] { new Boolean(condition), foreignBusName, Boolean.valueOf(linkError), cause });
if (!condition)
{
String errorMsg = "DELIVERY_ERROR_SIRC_38";
int reason = SIRCConstants.SIRC0038_FOREIGN_BUS_NOT_FOUND_ERROR;
if (linkError && cause != null)
{
reason = SIRCConstants.SIRC0041_FOREIGN_BUS_LINK_NOT_DEFINED_ERROR;
errorMsg = "DELIVERY_ERROR_SIRC_41";
}
else if (cause != null)
{
reason = SIRCConstants.SIRC0039_FOREIGN_BUS_NOT_FOUND_ERROR;
errorMsg = "DELIVERY_ERROR_SIRC_39";
}
SIMPNotPossibleInCurrentConfigurationException e = null;
if (cause == null)
{
e = new SIMPNotPossibleInCurrentConfigurationException(
nls_cwsik.getFormattedMessage(
errorMsg,
new Object[] { foreignBusName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus() },
null));
e.setExceptionInserts(new String[] { foreignBusName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus() });
e.setExceptionReason(reason);
}
else
{
e = new SIMPNotPossibleInCurrentConfigurationException(
nls_cwsik.getFormattedMessage(
errorMsg,
new Object[] { foreignBusName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus(),
SIMPUtils.getStackTrace(cause) },
null));
e.setExceptionInserts(new String[] { foreignBusName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus(),
SIMPUtils.getStackTrace(cause) });
e.setExceptionReason(reason);
}
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkBusExists", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkBusExists");
} | [
"private",
"void",
"checkBusExists",
"(",
"boolean",
"condition",
",",
"String",
"foreignBusName",
",",
"boolean",
"linkError",
",",
"Throwable",
"cause",
")",
"throws",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkBusExists\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Boolean",
"(",
"condition",
")",
",",
"foreignBusName",
",",
"Boolean",
".",
"valueOf",
"(",
"linkError",
")",
",",
"cause",
"}",
")",
";",
"if",
"(",
"!",
"condition",
")",
"{",
"String",
"errorMsg",
"=",
"\"DELIVERY_ERROR_SIRC_38\"",
";",
"int",
"reason",
"=",
"SIRCConstants",
".",
"SIRC0038_FOREIGN_BUS_NOT_FOUND_ERROR",
";",
"if",
"(",
"linkError",
"&&",
"cause",
"!=",
"null",
")",
"{",
"reason",
"=",
"SIRCConstants",
".",
"SIRC0041_FOREIGN_BUS_LINK_NOT_DEFINED_ERROR",
";",
"errorMsg",
"=",
"\"DELIVERY_ERROR_SIRC_41\"",
";",
"}",
"else",
"if",
"(",
"cause",
"!=",
"null",
")",
"{",
"reason",
"=",
"SIRCConstants",
".",
"SIRC0039_FOREIGN_BUS_NOT_FOUND_ERROR",
";",
"errorMsg",
"=",
"\"DELIVERY_ERROR_SIRC_39\"",
";",
"}",
"SIMPNotPossibleInCurrentConfigurationException",
"e",
"=",
"null",
";",
"if",
"(",
"cause",
"==",
"null",
")",
"{",
"e",
"=",
"new",
"SIMPNotPossibleInCurrentConfigurationException",
"(",
"nls_cwsik",
".",
"getFormattedMessage",
"(",
"errorMsg",
",",
"new",
"Object",
"[",
"]",
"{",
"foreignBusName",
",",
"messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
",",
"messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"e",
".",
"setExceptionInserts",
"(",
"new",
"String",
"[",
"]",
"{",
"foreignBusName",
",",
"messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
",",
"messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
"}",
")",
";",
"e",
".",
"setExceptionReason",
"(",
"reason",
")",
";",
"}",
"else",
"{",
"e",
"=",
"new",
"SIMPNotPossibleInCurrentConfigurationException",
"(",
"nls_cwsik",
".",
"getFormattedMessage",
"(",
"errorMsg",
",",
"new",
"Object",
"[",
"]",
"{",
"foreignBusName",
",",
"messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
",",
"messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
",",
"SIMPUtils",
".",
"getStackTrace",
"(",
"cause",
")",
"}",
",",
"null",
")",
")",
";",
"e",
".",
"setExceptionInserts",
"(",
"new",
"String",
"[",
"]",
"{",
"foreignBusName",
",",
"messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
",",
"messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
",",
"SIMPUtils",
".",
"getStackTrace",
"(",
"cause",
")",
"}",
")",
";",
"e",
".",
"setExceptionReason",
"(",
"reason",
")",
";",
"}",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkBusExists\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkBusExists\"",
")",
";",
"}"
] | Asserts that a Bus exists. Throws out the
appropriate exception if the condition has failed.
@param condition This is the existence check. An expression here should
evaluate to true if the destination exists, false otherwise.
For example, a simple expression here could be (dh != null).
@param foreignBusName The name of the foreign bus we were looking for.
@param cause Another exception that was the real cause of the non
existence of a DestinationHandler. Make this null if there is no prior
causing exception.
@throws SINotPossibleInCurrentConfigurationException | [
"Asserts",
"that",
"a",
"Bus",
"exists",
".",
"Throws",
"out",
"the",
"appropriate",
"exception",
"if",
"the",
"condition",
"has",
"failed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L4187-L4247 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.checkMQLinkExists | private void checkMQLinkExists(boolean condition, String mqlinkName)
throws SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkMQLinkExists",
new Object[] { new Boolean(condition), mqlinkName });
if (!condition)
{
SIMPNotPossibleInCurrentConfigurationException e =
new SIMPNotPossibleInCurrentConfigurationException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_42",
new Object[] { mqlinkName, messageProcessor.getMessagingEngineName(),
messageProcessor.getMessagingEngineBus() },
null));
e.setExceptionInserts(new String[] { mqlinkName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus() });
e.setExceptionReason(SIRCConstants.SIRC0042_MQ_LINK_NOT_FOUND_ERROR);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkMQLinkExists", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkMQLinkExists");
} | java | private void checkMQLinkExists(boolean condition, String mqlinkName)
throws SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkMQLinkExists",
new Object[] { new Boolean(condition), mqlinkName });
if (!condition)
{
SIMPNotPossibleInCurrentConfigurationException e =
new SIMPNotPossibleInCurrentConfigurationException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_42",
new Object[] { mqlinkName, messageProcessor.getMessagingEngineName(),
messageProcessor.getMessagingEngineBus() },
null));
e.setExceptionInserts(new String[] { mqlinkName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus() });
e.setExceptionReason(SIRCConstants.SIRC0042_MQ_LINK_NOT_FOUND_ERROR);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkMQLinkExists", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkMQLinkExists");
} | [
"private",
"void",
"checkMQLinkExists",
"(",
"boolean",
"condition",
",",
"String",
"mqlinkName",
")",
"throws",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkMQLinkExists\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Boolean",
"(",
"condition",
")",
",",
"mqlinkName",
"}",
")",
";",
"if",
"(",
"!",
"condition",
")",
"{",
"SIMPNotPossibleInCurrentConfigurationException",
"e",
"=",
"new",
"SIMPNotPossibleInCurrentConfigurationException",
"(",
"nls_cwsik",
".",
"getFormattedMessage",
"(",
"\"DELIVERY_ERROR_SIRC_42\"",
",",
"new",
"Object",
"[",
"]",
"{",
"mqlinkName",
",",
"messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
",",
"messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"e",
".",
"setExceptionInserts",
"(",
"new",
"String",
"[",
"]",
"{",
"mqlinkName",
",",
"messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
",",
"messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
"}",
")",
";",
"e",
".",
"setExceptionReason",
"(",
"SIRCConstants",
".",
"SIRC0042_MQ_LINK_NOT_FOUND_ERROR",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkMQLinkExists\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkMQLinkExists\"",
")",
";",
"}"
] | Asserts that an MQLink exists. Throws out the
appropriate exception if the condition has failed.
@param condition This is the existence check. An expression here should
evaluate to true if the destination exists, false otherwise.
For example, a simple expression here could be (dh != null).
@param mqLinkName The name of the link we were looking for.
@throws SINotPossibleInCurrentConfigurationException | [
"Asserts",
"that",
"an",
"MQLink",
"exists",
".",
"Throws",
"out",
"the",
"appropriate",
"exception",
"if",
"the",
"condition",
"has",
"failed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L4260-L4294 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.checkQueuePointContainsLocalME | private void checkQueuePointContainsLocalME(Set<String> queuePointLocalizingMEs,
SIBUuid8 messagingEngineUuid,
DestinationDefinition destinationDefinition,
LocalizationDefinition destinationLocalizationDefinition)
{
if (isQueue(destinationDefinition.getDestinationType())
&& (destinationLocalizationDefinition != null))
{
//Queue point locality set must contain local ME
if ((queuePointLocalizingMEs == null) ||
(!queuePointLocalizingMEs.contains(messagingEngineUuid.toString())))
{
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_CONFIGURATION_ERROR_CWSIP0006",
new Object[] { "DestinationManager", "1:4845:1.508.1.7", destinationDefinition.getName() },
null));
}
}
} | java | private void checkQueuePointContainsLocalME(Set<String> queuePointLocalizingMEs,
SIBUuid8 messagingEngineUuid,
DestinationDefinition destinationDefinition,
LocalizationDefinition destinationLocalizationDefinition)
{
if (isQueue(destinationDefinition.getDestinationType())
&& (destinationLocalizationDefinition != null))
{
//Queue point locality set must contain local ME
if ((queuePointLocalizingMEs == null) ||
(!queuePointLocalizingMEs.contains(messagingEngineUuid.toString())))
{
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_CONFIGURATION_ERROR_CWSIP0006",
new Object[] { "DestinationManager", "1:4845:1.508.1.7", destinationDefinition.getName() },
null));
}
}
} | [
"private",
"void",
"checkQueuePointContainsLocalME",
"(",
"Set",
"<",
"String",
">",
"queuePointLocalizingMEs",
",",
"SIBUuid8",
"messagingEngineUuid",
",",
"DestinationDefinition",
"destinationDefinition",
",",
"LocalizationDefinition",
"destinationLocalizationDefinition",
")",
"{",
"if",
"(",
"isQueue",
"(",
"destinationDefinition",
".",
"getDestinationType",
"(",
")",
")",
"&&",
"(",
"destinationLocalizationDefinition",
"!=",
"null",
")",
")",
"{",
"//Queue point locality set must contain local ME",
"if",
"(",
"(",
"queuePointLocalizingMEs",
"==",
"null",
")",
"||",
"(",
"!",
"queuePointLocalizingMEs",
".",
"contains",
"(",
"messagingEngineUuid",
".",
"toString",
"(",
")",
")",
")",
")",
"{",
"throw",
"new",
"SIErrorException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"INTERNAL_CONFIGURATION_ERROR_CWSIP0006\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"DestinationManager\"",
",",
"\"1:4845:1.508.1.7\"",
",",
"destinationDefinition",
".",
"getName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"}",
"}",
"}"
] | Checks that the Local ME is in the queue point localizing set
@param queuePointLocalizingMEs | [
"Checks",
"that",
"the",
"Local",
"ME",
"is",
"in",
"the",
"queue",
"point",
"localizing",
"set"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L4348-L4367 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.checkQueuePointLocalizingSize | private void checkQueuePointLocalizingSize(Set<String> queuePointLocalizingMEs,
DestinationDefinition destinationDefinition)
{
//There must be at least one queue point
if (((destinationDefinition.getDestinationType() != DestinationType.SERVICE) &&
(queuePointLocalizingMEs.size() == 0)) ||
((destinationDefinition.getDestinationType() == DestinationType.SERVICE) &&
(queuePointLocalizingMEs.size() != 0)))
{
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_CONFIGURATION_ERROR_CWSIP0006",
new Object[] { "DestinationManager", "1:4867:1.508.1.7", destinationDefinition.getName() },
null));
}
} | java | private void checkQueuePointLocalizingSize(Set<String> queuePointLocalizingMEs,
DestinationDefinition destinationDefinition)
{
//There must be at least one queue point
if (((destinationDefinition.getDestinationType() != DestinationType.SERVICE) &&
(queuePointLocalizingMEs.size() == 0)) ||
((destinationDefinition.getDestinationType() == DestinationType.SERVICE) &&
(queuePointLocalizingMEs.size() != 0)))
{
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_CONFIGURATION_ERROR_CWSIP0006",
new Object[] { "DestinationManager", "1:4867:1.508.1.7", destinationDefinition.getName() },
null));
}
} | [
"private",
"void",
"checkQueuePointLocalizingSize",
"(",
"Set",
"<",
"String",
">",
"queuePointLocalizingMEs",
",",
"DestinationDefinition",
"destinationDefinition",
")",
"{",
"//There must be at least one queue point",
"if",
"(",
"(",
"(",
"destinationDefinition",
".",
"getDestinationType",
"(",
")",
"!=",
"DestinationType",
".",
"SERVICE",
")",
"&&",
"(",
"queuePointLocalizingMEs",
".",
"size",
"(",
")",
"==",
"0",
")",
")",
"||",
"(",
"(",
"destinationDefinition",
".",
"getDestinationType",
"(",
")",
"==",
"DestinationType",
".",
"SERVICE",
")",
"&&",
"(",
"queuePointLocalizingMEs",
".",
"size",
"(",
")",
"!=",
"0",
")",
")",
")",
"{",
"throw",
"new",
"SIErrorException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"INTERNAL_CONFIGURATION_ERROR_CWSIP0006\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"DestinationManager\"",
",",
"\"1:4867:1.508.1.7\"",
",",
"destinationDefinition",
".",
"getName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"}",
"}"
] | Checks that the queuePointLocalising size is valid | [
"Checks",
"that",
"the",
"queuePointLocalising",
"size",
"is",
"valid"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L4372-L4389 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.setIsAsyncDeletionThreadStartable | private void setIsAsyncDeletionThreadStartable(boolean isStartable)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setIsAsyncDeletionThreadStartable", new Boolean(isStartable));
synchronized (deletionThreadLock)
{
_isAsyncDeletionThreadStartable = isStartable;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setIsAsyncDeletionThreadStartable");
} | java | private void setIsAsyncDeletionThreadStartable(boolean isStartable)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setIsAsyncDeletionThreadStartable", new Boolean(isStartable));
synchronized (deletionThreadLock)
{
_isAsyncDeletionThreadStartable = isStartable;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setIsAsyncDeletionThreadStartable");
} | [
"private",
"void",
"setIsAsyncDeletionThreadStartable",
"(",
"boolean",
"isStartable",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setIsAsyncDeletionThreadStartable\"",
",",
"new",
"Boolean",
"(",
"isStartable",
")",
")",
";",
"synchronized",
"(",
"deletionThreadLock",
")",
"{",
"_isAsyncDeletionThreadStartable",
"=",
"isStartable",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setIsAsyncDeletionThreadStartable\"",
")",
";",
"}"
] | Indicates whether the async deletion thread should be startable or not.
@param isStartable | [
"Indicates",
"whether",
"the",
"async",
"deletion",
"thread",
"should",
"be",
"startable",
"or",
"not",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L4776-L4788 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.createSystemDestination | public JsDestinationAddress createSystemDestination(String prefix, Reliability reliability) throws SIResourceException, SIMPDestinationAlreadyExistsException, SIIncorrectCallException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createSystemDestination", new Object[] { prefix, reliability });
//there is no detailed prefix validation here as System Destinations are purely
//internal
if (prefix == null || prefix.length() > 24)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createSystemDestination", "SIInvalidDestinationPrefixException");
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] { "com.ibm.ws.sib.processor.impl.DestinationManager", "1:5324:1.508.1.7", prefix });
throw new SIInvalidDestinationPrefixException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] { "com.ibm.ws.sib.processor.impl.DestinationManager", "1:5329:1.508.1.7", prefix },
null));
}
JsDestinationAddress destAddr =
SIMPUtils.createJsSystemDestinationAddress(prefix, messageProcessor.getMessagingEngineUuid());
destAddr.setBusName(messageProcessor.getMessagingEngineBus());
// Check and see if the destination already exists.
//note that this is treated as an application call so we don't want to see
//those that are being deleted
DestinationHandler handler = getDestinationInternal(destAddr.getDestinationName(), destAddr.getBusName(), false);
if (handler != null)
{
// The system destination exists for the destination prefix set so
// just return.
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createSystemDestination", destAddr);
return destAddr;
}
DestinationDefinition destDef =
messageProcessor.createDestinationDefinition(DestinationType.QUEUE, destAddr.getDestinationName());
destDef.setMaxReliability(reliability);
destDef.setDefaultReliability(reliability);
destDef.setUUID(new SIBUuid12());
Set<String> destinationLocalizingSet = new HashSet<String>();
destinationLocalizingSet.add(messageProcessor.getMessagingEngineUuid().toString());
createDestinationLocalization(
destDef,
messageProcessor.createLocalizationDefinition(destDef.getName()),
destinationLocalizingSet,
false);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createSystemDestination", destAddr);
return destAddr;
} | java | public JsDestinationAddress createSystemDestination(String prefix, Reliability reliability) throws SIResourceException, SIMPDestinationAlreadyExistsException, SIIncorrectCallException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createSystemDestination", new Object[] { prefix, reliability });
//there is no detailed prefix validation here as System Destinations are purely
//internal
if (prefix == null || prefix.length() > 24)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createSystemDestination", "SIInvalidDestinationPrefixException");
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] { "com.ibm.ws.sib.processor.impl.DestinationManager", "1:5324:1.508.1.7", prefix });
throw new SIInvalidDestinationPrefixException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] { "com.ibm.ws.sib.processor.impl.DestinationManager", "1:5329:1.508.1.7", prefix },
null));
}
JsDestinationAddress destAddr =
SIMPUtils.createJsSystemDestinationAddress(prefix, messageProcessor.getMessagingEngineUuid());
destAddr.setBusName(messageProcessor.getMessagingEngineBus());
// Check and see if the destination already exists.
//note that this is treated as an application call so we don't want to see
//those that are being deleted
DestinationHandler handler = getDestinationInternal(destAddr.getDestinationName(), destAddr.getBusName(), false);
if (handler != null)
{
// The system destination exists for the destination prefix set so
// just return.
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createSystemDestination", destAddr);
return destAddr;
}
DestinationDefinition destDef =
messageProcessor.createDestinationDefinition(DestinationType.QUEUE, destAddr.getDestinationName());
destDef.setMaxReliability(reliability);
destDef.setDefaultReliability(reliability);
destDef.setUUID(new SIBUuid12());
Set<String> destinationLocalizingSet = new HashSet<String>();
destinationLocalizingSet.add(messageProcessor.getMessagingEngineUuid().toString());
createDestinationLocalization(
destDef,
messageProcessor.createLocalizationDefinition(destDef.getName()),
destinationLocalizingSet,
false);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createSystemDestination", destAddr);
return destAddr;
} | [
"public",
"JsDestinationAddress",
"createSystemDestination",
"(",
"String",
"prefix",
",",
"Reliability",
"reliability",
")",
"throws",
"SIResourceException",
",",
"SIMPDestinationAlreadyExistsException",
",",
"SIIncorrectCallException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createSystemDestination\"",
",",
"new",
"Object",
"[",
"]",
"{",
"prefix",
",",
"reliability",
"}",
")",
";",
"//there is no detailed prefix validation here as System Destinations are purely",
"//internal",
"if",
"(",
"prefix",
"==",
"null",
"||",
"prefix",
".",
"length",
"(",
")",
">",
"24",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createSystemDestination\"",
",",
"\"SIInvalidDestinationPrefixException\"",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0005\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.DestinationManager\"",
",",
"\"1:5324:1.508.1.7\"",
",",
"prefix",
"}",
")",
";",
"throw",
"new",
"SIInvalidDestinationPrefixException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0005\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.DestinationManager\"",
",",
"\"1:5329:1.508.1.7\"",
",",
"prefix",
"}",
",",
"null",
")",
")",
";",
"}",
"JsDestinationAddress",
"destAddr",
"=",
"SIMPUtils",
".",
"createJsSystemDestinationAddress",
"(",
"prefix",
",",
"messageProcessor",
".",
"getMessagingEngineUuid",
"(",
")",
")",
";",
"destAddr",
".",
"setBusName",
"(",
"messageProcessor",
".",
"getMessagingEngineBus",
"(",
")",
")",
";",
"// Check and see if the destination already exists.",
"//note that this is treated as an application call so we don't want to see",
"//those that are being deleted",
"DestinationHandler",
"handler",
"=",
"getDestinationInternal",
"(",
"destAddr",
".",
"getDestinationName",
"(",
")",
",",
"destAddr",
".",
"getBusName",
"(",
")",
",",
"false",
")",
";",
"if",
"(",
"handler",
"!=",
"null",
")",
"{",
"// The system destination exists for the destination prefix set so",
"// just return.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createSystemDestination\"",
",",
"destAddr",
")",
";",
"return",
"destAddr",
";",
"}",
"DestinationDefinition",
"destDef",
"=",
"messageProcessor",
".",
"createDestinationDefinition",
"(",
"DestinationType",
".",
"QUEUE",
",",
"destAddr",
".",
"getDestinationName",
"(",
")",
")",
";",
"destDef",
".",
"setMaxReliability",
"(",
"reliability",
")",
";",
"destDef",
".",
"setDefaultReliability",
"(",
"reliability",
")",
";",
"destDef",
".",
"setUUID",
"(",
"new",
"SIBUuid12",
"(",
")",
")",
";",
"Set",
"<",
"String",
">",
"destinationLocalizingSet",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"destinationLocalizingSet",
".",
"add",
"(",
"messageProcessor",
".",
"getMessagingEngineUuid",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"createDestinationLocalization",
"(",
"destDef",
",",
"messageProcessor",
".",
"createLocalizationDefinition",
"(",
"destDef",
".",
"getName",
"(",
")",
")",
",",
"destinationLocalizingSet",
",",
"false",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createSystemDestination\"",
",",
"destAddr",
")",
";",
"return",
"destAddr",
";",
"}"
] | Creates a System destination with the given prefix and reliability | [
"Creates",
"a",
"System",
"destination",
"with",
"the",
"given",
"prefix",
"and",
"reliability"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L4821-L4881 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.addSubscriptionToDelete | public void addSubscriptionToDelete(SubscriptionItemStream stream)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addSubscriptionToDelete", stream);
synchronized (deletableSubscriptions)
{
deletableSubscriptions.add(stream);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addSubscriptionToDelete");
} | java | public void addSubscriptionToDelete(SubscriptionItemStream stream)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "addSubscriptionToDelete", stream);
synchronized (deletableSubscriptions)
{
deletableSubscriptions.add(stream);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addSubscriptionToDelete");
} | [
"public",
"void",
"addSubscriptionToDelete",
"(",
"SubscriptionItemStream",
"stream",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"addSubscriptionToDelete\"",
",",
"stream",
")",
";",
"synchronized",
"(",
"deletableSubscriptions",
")",
"{",
"deletableSubscriptions",
".",
"add",
"(",
"stream",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"addSubscriptionToDelete\"",
")",
";",
"}"
] | Add a subscription to the list of subscriptions to be deleted. | [
"Add",
"a",
"subscription",
"to",
"the",
"list",
"of",
"subscriptions",
"to",
"be",
"deleted",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L5051-L5061 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.getDestination | public DestinationHandler getDestination(SIBUuid12 destinationUuid, boolean includeInvisible) throws SITemporaryDestinationNotFoundException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getDestination", destinationUuid);
// Get the destination, include invisible dests
DestinationHandler destinationHandler = getDestinationInternal(destinationUuid, includeInvisible);
checkDestinationHandlerExists(
destinationHandler != null,
destinationUuid.toString(),
messageProcessor.getMessagingEngineName());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getDestination", destinationHandler);
return destinationHandler;
} | java | public DestinationHandler getDestination(SIBUuid12 destinationUuid, boolean includeInvisible) throws SITemporaryDestinationNotFoundException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getDestination", destinationUuid);
// Get the destination, include invisible dests
DestinationHandler destinationHandler = getDestinationInternal(destinationUuid, includeInvisible);
checkDestinationHandlerExists(
destinationHandler != null,
destinationUuid.toString(),
messageProcessor.getMessagingEngineName());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getDestination", destinationHandler);
return destinationHandler;
} | [
"public",
"DestinationHandler",
"getDestination",
"(",
"SIBUuid12",
"destinationUuid",
",",
"boolean",
"includeInvisible",
")",
"throws",
"SITemporaryDestinationNotFoundException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getDestination\"",
",",
"destinationUuid",
")",
";",
"// Get the destination, include invisible dests",
"DestinationHandler",
"destinationHandler",
"=",
"getDestinationInternal",
"(",
"destinationUuid",
",",
"includeInvisible",
")",
";",
"checkDestinationHandlerExists",
"(",
"destinationHandler",
"!=",
"null",
",",
"destinationUuid",
".",
"toString",
"(",
")",
",",
"messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getDestination\"",
",",
"destinationHandler",
")",
";",
"return",
"destinationHandler",
";",
"}"
] | Method getDestination.
@param destinationUuid
@return Destination
@throws SIDestinationNotFoundException
<p>This method provides lookup of a destination by its uuid.
If the destination is not
found, it throws SIDestinationNotFoundException.</p> | [
"Method",
"getDestination",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L5184-L5201 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.getMQLinkLocalization | public MQLinkHandler getMQLinkLocalization(SIBUuid8 mqLinkUuid, boolean includeInvisible) throws SIMPMQLinkCorruptException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getMQLinkLocalization", mqLinkUuid);
// Get the destination
LinkTypeFilter filter = new LinkTypeFilter();
filter.MQLINK = Boolean.TRUE;
if (!includeInvisible)
filter.VISIBLE = Boolean.TRUE;
MQLinkHandler mqLinkHandler = (MQLinkHandler) linkIndex.findByMQLinkUuid(mqLinkUuid, filter);
checkMQLinkExists(
mqLinkHandler != null,
mqLinkUuid.toString());
if (mqLinkHandler.isCorruptOrIndoubt())
{
String message =
nls.getFormattedMessage(
"LINK_HANDLER_CORRUPT_ERROR_CWSIP0054",
new Object[] { mqLinkHandler.getName(), mqLinkUuid.toString() },
null);
SIMPMQLinkCorruptException e = new SIMPMQLinkCorruptException(message);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMQLinkLocalization", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMQLinkLocalization", mqLinkHandler);
return mqLinkHandler;
} | java | public MQLinkHandler getMQLinkLocalization(SIBUuid8 mqLinkUuid, boolean includeInvisible) throws SIMPMQLinkCorruptException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getMQLinkLocalization", mqLinkUuid);
// Get the destination
LinkTypeFilter filter = new LinkTypeFilter();
filter.MQLINK = Boolean.TRUE;
if (!includeInvisible)
filter.VISIBLE = Boolean.TRUE;
MQLinkHandler mqLinkHandler = (MQLinkHandler) linkIndex.findByMQLinkUuid(mqLinkUuid, filter);
checkMQLinkExists(
mqLinkHandler != null,
mqLinkUuid.toString());
if (mqLinkHandler.isCorruptOrIndoubt())
{
String message =
nls.getFormattedMessage(
"LINK_HANDLER_CORRUPT_ERROR_CWSIP0054",
new Object[] { mqLinkHandler.getName(), mqLinkUuid.toString() },
null);
SIMPMQLinkCorruptException e = new SIMPMQLinkCorruptException(message);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMQLinkLocalization", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMQLinkLocalization", mqLinkHandler);
return mqLinkHandler;
} | [
"public",
"MQLinkHandler",
"getMQLinkLocalization",
"(",
"SIBUuid8",
"mqLinkUuid",
",",
"boolean",
"includeInvisible",
")",
"throws",
"SIMPMQLinkCorruptException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getMQLinkLocalization\"",
",",
"mqLinkUuid",
")",
";",
"// Get the destination",
"LinkTypeFilter",
"filter",
"=",
"new",
"LinkTypeFilter",
"(",
")",
";",
"filter",
".",
"MQLINK",
"=",
"Boolean",
".",
"TRUE",
";",
"if",
"(",
"!",
"includeInvisible",
")",
"filter",
".",
"VISIBLE",
"=",
"Boolean",
".",
"TRUE",
";",
"MQLinkHandler",
"mqLinkHandler",
"=",
"(",
"MQLinkHandler",
")",
"linkIndex",
".",
"findByMQLinkUuid",
"(",
"mqLinkUuid",
",",
"filter",
")",
";",
"checkMQLinkExists",
"(",
"mqLinkHandler",
"!=",
"null",
",",
"mqLinkUuid",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"mqLinkHandler",
".",
"isCorruptOrIndoubt",
"(",
")",
")",
"{",
"String",
"message",
"=",
"nls",
".",
"getFormattedMessage",
"(",
"\"LINK_HANDLER_CORRUPT_ERROR_CWSIP0054\"",
",",
"new",
"Object",
"[",
"]",
"{",
"mqLinkHandler",
".",
"getName",
"(",
")",
",",
"mqLinkUuid",
".",
"toString",
"(",
")",
"}",
",",
"null",
")",
";",
"SIMPMQLinkCorruptException",
"e",
"=",
"new",
"SIMPMQLinkCorruptException",
"(",
"message",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMQLinkLocalization\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMQLinkLocalization\"",
",",
"mqLinkHandler",
")",
";",
"return",
"mqLinkHandler",
";",
"}"
] | Lookup a destination by its uuid.
@param mqLinkUuid
@param includeInvisible
@return MQLinkHandler
@throws SIDestinationNotFoundException The link was not found
@throws SIMPMQLinkCorruptException | [
"Lookup",
"a",
"destination",
"by",
"its",
"uuid",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L5237-L5277 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.announceMPStarted | void announceMPStarted(int startMode)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "announceMPStarted");
DestinationTypeFilter destFilter = new DestinationTypeFilter();
SIMPIterator itr = destinationIndex.iterator(destFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.announceMPStarted();
}
itr.finished();
LinkTypeFilter linkFilter = new LinkTypeFilter();
linkFilter.LOCAL = Boolean.TRUE;
itr = linkIndex.iterator(linkFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.announceMPStarted();
}
itr.finished();
itr = foreignBusIndex.iterator();
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.announceMPStarted();
}
itr.finished();
// Iterate over the MQLinks, calling the MQLink component to
// alert it that MP has started
LinkTypeFilter mqLinkFilter = new LinkTypeFilter();
mqLinkFilter.MQLINK = Boolean.TRUE;
itr = linkIndex.iterator(mqLinkFilter);
while (itr.hasNext())
{
MQLinkHandler mqLinkHandler = (MQLinkHandler) itr.next();
try
{
mqLinkHandler.
announceMPStarted(startMode,
messageProcessor.getMessagingEngine());
} catch (SIResourceException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// The MQLink component will have FFDC'd we'll trace
// the problem but allow processing to continue
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// The MQLink component will have FFDC'd we'll trace
// the problem but allow processing to continue
}
}
itr.finished();
//Allow the async deletion thread to start up now if it wants.
setIsAsyncDeletionThreadStartable(true);
// Explicitly start the async deletion thread if there is anything to do.
startAsynchDeletion();
//start DeletePubSubMsgsThread.
startDeletePubSubMsgsThread();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "announceMPStarted");
} | java | void announceMPStarted(int startMode)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "announceMPStarted");
DestinationTypeFilter destFilter = new DestinationTypeFilter();
SIMPIterator itr = destinationIndex.iterator(destFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.announceMPStarted();
}
itr.finished();
LinkTypeFilter linkFilter = new LinkTypeFilter();
linkFilter.LOCAL = Boolean.TRUE;
itr = linkIndex.iterator(linkFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.announceMPStarted();
}
itr.finished();
itr = foreignBusIndex.iterator();
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.announceMPStarted();
}
itr.finished();
// Iterate over the MQLinks, calling the MQLink component to
// alert it that MP has started
LinkTypeFilter mqLinkFilter = new LinkTypeFilter();
mqLinkFilter.MQLINK = Boolean.TRUE;
itr = linkIndex.iterator(mqLinkFilter);
while (itr.hasNext())
{
MQLinkHandler mqLinkHandler = (MQLinkHandler) itr.next();
try
{
mqLinkHandler.
announceMPStarted(startMode,
messageProcessor.getMessagingEngine());
} catch (SIResourceException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// The MQLink component will have FFDC'd we'll trace
// the problem but allow processing to continue
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// The MQLink component will have FFDC'd we'll trace
// the problem but allow processing to continue
}
}
itr.finished();
//Allow the async deletion thread to start up now if it wants.
setIsAsyncDeletionThreadStartable(true);
// Explicitly start the async deletion thread if there is anything to do.
startAsynchDeletion();
//start DeletePubSubMsgsThread.
startDeletePubSubMsgsThread();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "announceMPStarted");
} | [
"void",
"announceMPStarted",
"(",
"int",
"startMode",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"announceMPStarted\"",
")",
";",
"DestinationTypeFilter",
"destFilter",
"=",
"new",
"DestinationTypeFilter",
"(",
")",
";",
"SIMPIterator",
"itr",
"=",
"destinationIndex",
".",
"iterator",
"(",
"destFilter",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"DestinationHandler",
"dh",
"=",
"(",
"DestinationHandler",
")",
"itr",
".",
"next",
"(",
")",
";",
"dh",
".",
"announceMPStarted",
"(",
")",
";",
"}",
"itr",
".",
"finished",
"(",
")",
";",
"LinkTypeFilter",
"linkFilter",
"=",
"new",
"LinkTypeFilter",
"(",
")",
";",
"linkFilter",
".",
"LOCAL",
"=",
"Boolean",
".",
"TRUE",
";",
"itr",
"=",
"linkIndex",
".",
"iterator",
"(",
"linkFilter",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"DestinationHandler",
"dh",
"=",
"(",
"DestinationHandler",
")",
"itr",
".",
"next",
"(",
")",
";",
"dh",
".",
"announceMPStarted",
"(",
")",
";",
"}",
"itr",
".",
"finished",
"(",
")",
";",
"itr",
"=",
"foreignBusIndex",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"DestinationHandler",
"dh",
"=",
"(",
"DestinationHandler",
")",
"itr",
".",
"next",
"(",
")",
";",
"dh",
".",
"announceMPStarted",
"(",
")",
";",
"}",
"itr",
".",
"finished",
"(",
")",
";",
"// Iterate over the MQLinks, calling the MQLink component to",
"// alert it that MP has started",
"LinkTypeFilter",
"mqLinkFilter",
"=",
"new",
"LinkTypeFilter",
"(",
")",
";",
"mqLinkFilter",
".",
"MQLINK",
"=",
"Boolean",
".",
"TRUE",
";",
"itr",
"=",
"linkIndex",
".",
"iterator",
"(",
"mqLinkFilter",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"MQLinkHandler",
"mqLinkHandler",
"=",
"(",
"MQLinkHandler",
")",
"itr",
".",
"next",
"(",
")",
";",
"try",
"{",
"mqLinkHandler",
".",
"announceMPStarted",
"(",
"startMode",
",",
"messageProcessor",
".",
"getMessagingEngine",
"(",
")",
")",
";",
"}",
"catch",
"(",
"SIResourceException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// The MQLink component will have FFDC'd we'll trace",
"// the problem but allow processing to continue",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// No FFDC code needed",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// The MQLink component will have FFDC'd we'll trace",
"// the problem but allow processing to continue",
"}",
"}",
"itr",
".",
"finished",
"(",
")",
";",
"//Allow the async deletion thread to start up now if it wants.",
"setIsAsyncDeletionThreadStartable",
"(",
"true",
")",
";",
"// Explicitly start the async deletion thread if there is anything to do.",
"startAsynchDeletion",
"(",
")",
";",
"//start DeletePubSubMsgsThread.",
"startDeletePubSubMsgsThread",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"announceMPStarted\"",
")",
";",
"}"
] | Find the mediated destinations and tell them that the MP is now ready
for mediations to start work. In addition alert the MQLink component
that MP has started and set the flag to allow asynch deletion.
Feature 176658.3.8 | [
"Find",
"the",
"mediated",
"destinations",
"and",
"tell",
"them",
"that",
"the",
"MP",
"is",
"now",
"ready",
"for",
"mediations",
"to",
"start",
"work",
".",
"In",
"addition",
"alert",
"the",
"MQLink",
"component",
"that",
"MP",
"has",
"started",
"and",
"set",
"the",
"flag",
"to",
"allow",
"asynch",
"deletion",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L5409-L5485 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.findBus | public BusHandler findBus(String busName) throws SIResourceException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "findBus", new Object[] { busName });
// Get the bus
ForeignBusTypeFilter filter = new ForeignBusTypeFilter();
filter.VISIBLE = Boolean.TRUE;
BusHandler busHandler = (BusHandler) foreignBusIndex.findByName(busName, filter);
// If the bus was not found in DestinationLookups, ask Admin
if (busHandler == null)
{
busHandler = findBusInternal(busName);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "findBus", busHandler);
return busHandler;
} | java | public BusHandler findBus(String busName) throws SIResourceException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "findBus", new Object[] { busName });
// Get the bus
ForeignBusTypeFilter filter = new ForeignBusTypeFilter();
filter.VISIBLE = Boolean.TRUE;
BusHandler busHandler = (BusHandler) foreignBusIndex.findByName(busName, filter);
// If the bus was not found in DestinationLookups, ask Admin
if (busHandler == null)
{
busHandler = findBusInternal(busName);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "findBus", busHandler);
return busHandler;
} | [
"public",
"BusHandler",
"findBus",
"(",
"String",
"busName",
")",
"throws",
"SIResourceException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"findBus\"",
",",
"new",
"Object",
"[",
"]",
"{",
"busName",
"}",
")",
";",
"// Get the bus",
"ForeignBusTypeFilter",
"filter",
"=",
"new",
"ForeignBusTypeFilter",
"(",
")",
";",
"filter",
".",
"VISIBLE",
"=",
"Boolean",
".",
"TRUE",
";",
"BusHandler",
"busHandler",
"=",
"(",
"BusHandler",
")",
"foreignBusIndex",
".",
"findByName",
"(",
"busName",
",",
"filter",
")",
";",
"// If the bus was not found in DestinationLookups, ask Admin",
"if",
"(",
"busHandler",
"==",
"null",
")",
"{",
"busHandler",
"=",
"findBusInternal",
"(",
"busName",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"findBus\"",
",",
"busHandler",
")",
";",
"return",
"busHandler",
";",
"}"
] | Method findBus.
@param busName
@return busHandler
@throws SIDestinationNotFoundException
@throws SIMPNullParameterException
<p>This method provides lookup of a foreign bus by its name.
If the bus is not known to the ME, the method queries
admin to see if the bus is a known foreign bus, if the
address can still not be found the method throws
SIDestinationNotFoundException.</p> | [
"Method",
"findBus",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L5897-L5917 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.isLocalizationAvailable | private boolean isLocalizationAvailable(
BaseDestinationHandler baseDestinationHandler,
DestinationAvailability destinationAvailability)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isLocalizationAvailable", new Object[] { baseDestinationHandler, destinationAvailability });
boolean available = false;
if (baseDestinationHandler.hasLocal())
{
// Look at the stream for the destination which represents all localizations
LocalizationPoint localizationPoint = baseDestinationHandler.getQueuePoint(messageProcessor.getMessagingEngineUuid());
if (destinationAvailability == DestinationAvailability.SEND)
{
available = localizationPoint.isSendAllowed();
}
else
{
available = true;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isLocalizationAvailable", new Object[] { new Boolean(available) });
return available;
} | java | private boolean isLocalizationAvailable(
BaseDestinationHandler baseDestinationHandler,
DestinationAvailability destinationAvailability)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "isLocalizationAvailable", new Object[] { baseDestinationHandler, destinationAvailability });
boolean available = false;
if (baseDestinationHandler.hasLocal())
{
// Look at the stream for the destination which represents all localizations
LocalizationPoint localizationPoint = baseDestinationHandler.getQueuePoint(messageProcessor.getMessagingEngineUuid());
if (destinationAvailability == DestinationAvailability.SEND)
{
available = localizationPoint.isSendAllowed();
}
else
{
available = true;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "isLocalizationAvailable", new Object[] { new Boolean(available) });
return available;
} | [
"private",
"boolean",
"isLocalizationAvailable",
"(",
"BaseDestinationHandler",
"baseDestinationHandler",
",",
"DestinationAvailability",
"destinationAvailability",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"isLocalizationAvailable\"",
",",
"new",
"Object",
"[",
"]",
"{",
"baseDestinationHandler",
",",
"destinationAvailability",
"}",
")",
";",
"boolean",
"available",
"=",
"false",
";",
"if",
"(",
"baseDestinationHandler",
".",
"hasLocal",
"(",
")",
")",
"{",
"// Look at the stream for the destination which represents all localizations",
"LocalizationPoint",
"localizationPoint",
"=",
"baseDestinationHandler",
".",
"getQueuePoint",
"(",
"messageProcessor",
".",
"getMessagingEngineUuid",
"(",
")",
")",
";",
"if",
"(",
"destinationAvailability",
"==",
"DestinationAvailability",
".",
"SEND",
")",
"{",
"available",
"=",
"localizationPoint",
".",
"isSendAllowed",
"(",
")",
";",
"}",
"else",
"{",
"available",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"isLocalizationAvailable\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Boolean",
"(",
"available",
")",
"}",
")",
";",
"return",
"available",
";",
"}"
] | This method determines whether a localization for a destination is available. | [
"This",
"method",
"determines",
"whether",
"a",
"localization",
"for",
"a",
"destination",
"is",
"available",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L6955-L6981 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.getAllSystemDestinations | public List<JsDestinationAddress> getAllSystemDestinations(SIBUuid8 meUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getAllSystemDestinations", meUuid);
DestinationTypeFilter filter = new DestinationTypeFilter();
filter.LOCAL = Boolean.FALSE;
filter.DELETE_PENDING = Boolean.FALSE;
filter.DELETE_DEFERED = Boolean.FALSE;
filter.ACTIVE = Boolean.TRUE;
List<JsDestinationAddress> destAddresses = new ArrayList<JsDestinationAddress>();
Iterator itr = getDestinationIndex().iterator(filter);
while (itr.hasNext())
{
DestinationHandler destinationHandler = (DestinationHandler) itr.next();
String destinationHandlerName = destinationHandler.getName();
SIBUuid8 found = SIMPUtils.parseME(destinationHandlerName);
if (found == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Couldn't parse uuid from " + destinationHandlerName);
}
if (found != null
&& found.equals(meUuid))
{
if (destinationHandler.isSystem())
{
destAddresses.add(SIMPUtils.createJsDestinationAddress(destinationHandler.getName(), meUuid));
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getAllSystemDestinations", destAddresses);
return destAddresses;
} | java | public List<JsDestinationAddress> getAllSystemDestinations(SIBUuid8 meUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getAllSystemDestinations", meUuid);
DestinationTypeFilter filter = new DestinationTypeFilter();
filter.LOCAL = Boolean.FALSE;
filter.DELETE_PENDING = Boolean.FALSE;
filter.DELETE_DEFERED = Boolean.FALSE;
filter.ACTIVE = Boolean.TRUE;
List<JsDestinationAddress> destAddresses = new ArrayList<JsDestinationAddress>();
Iterator itr = getDestinationIndex().iterator(filter);
while (itr.hasNext())
{
DestinationHandler destinationHandler = (DestinationHandler) itr.next();
String destinationHandlerName = destinationHandler.getName();
SIBUuid8 found = SIMPUtils.parseME(destinationHandlerName);
if (found == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Couldn't parse uuid from " + destinationHandlerName);
}
if (found != null
&& found.equals(meUuid))
{
if (destinationHandler.isSystem())
{
destAddresses.add(SIMPUtils.createJsDestinationAddress(destinationHandler.getName(), meUuid));
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getAllSystemDestinations", destAddresses);
return destAddresses;
} | [
"public",
"List",
"<",
"JsDestinationAddress",
">",
"getAllSystemDestinations",
"(",
"SIBUuid8",
"meUuid",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getAllSystemDestinations\"",
",",
"meUuid",
")",
";",
"DestinationTypeFilter",
"filter",
"=",
"new",
"DestinationTypeFilter",
"(",
")",
";",
"filter",
".",
"LOCAL",
"=",
"Boolean",
".",
"FALSE",
";",
"filter",
".",
"DELETE_PENDING",
"=",
"Boolean",
".",
"FALSE",
";",
"filter",
".",
"DELETE_DEFERED",
"=",
"Boolean",
".",
"FALSE",
";",
"filter",
".",
"ACTIVE",
"=",
"Boolean",
".",
"TRUE",
";",
"List",
"<",
"JsDestinationAddress",
">",
"destAddresses",
"=",
"new",
"ArrayList",
"<",
"JsDestinationAddress",
">",
"(",
")",
";",
"Iterator",
"itr",
"=",
"getDestinationIndex",
"(",
")",
".",
"iterator",
"(",
"filter",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"DestinationHandler",
"destinationHandler",
"=",
"(",
"DestinationHandler",
")",
"itr",
".",
"next",
"(",
")",
";",
"String",
"destinationHandlerName",
"=",
"destinationHandler",
".",
"getName",
"(",
")",
";",
"SIBUuid8",
"found",
"=",
"SIMPUtils",
".",
"parseME",
"(",
"destinationHandlerName",
")",
";",
"if",
"(",
"found",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Couldn't parse uuid from \"",
"+",
"destinationHandlerName",
")",
";",
"}",
"if",
"(",
"found",
"!=",
"null",
"&&",
"found",
".",
"equals",
"(",
"meUuid",
")",
")",
"{",
"if",
"(",
"destinationHandler",
".",
"isSystem",
"(",
")",
")",
"{",
"destAddresses",
".",
"add",
"(",
"SIMPUtils",
".",
"createJsDestinationAddress",
"(",
"destinationHandler",
".",
"getName",
"(",
")",
",",
"meUuid",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getAllSystemDestinations\"",
",",
"destAddresses",
")",
";",
"return",
"destAddresses",
";",
"}"
] | Finds all the JsDestinationAddresses that belong to system destinations for the
ME that was passed in.
@param meUuid
@return List of all the system destination addresses for the meUuid passed | [
"Finds",
"all",
"the",
"JsDestinationAddresses",
"that",
"belong",
"to",
"system",
"destinations",
"for",
"the",
"ME",
"that",
"was",
"passed",
"in",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L7132-L7170 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.activateDestination | protected void activateDestination(DestinationHandler dh)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "activateDestination", dh);
if (dh.isLink())
{
linkIndex.create(dh);
}
else
{
destinationIndex.create(dh);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "activateDestination");
} | java | protected void activateDestination(DestinationHandler dh)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "activateDestination", dh);
if (dh.isLink())
{
linkIndex.create(dh);
}
else
{
destinationIndex.create(dh);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "activateDestination");
} | [
"protected",
"void",
"activateDestination",
"(",
"DestinationHandler",
"dh",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"activateDestination\"",
",",
"dh",
")",
";",
"if",
"(",
"dh",
".",
"isLink",
"(",
")",
")",
"{",
"linkIndex",
".",
"create",
"(",
"dh",
")",
";",
"}",
"else",
"{",
"destinationIndex",
".",
"create",
"(",
"dh",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"activateDestination\"",
")",
";",
"}"
] | Move the destination into ACTIVE state | [
"Move",
"the",
"destination",
"into",
"ACTIVE",
"state"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L7173-L7189 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.corruptDestination | protected void corruptDestination(DestinationHandler dh)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "corruptDestination", dh);
if (!dh.isLink() && destinationIndex.containsDestination(dh))
{
destinationIndex.corrupt(dh);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "corruptDestination");
} | java | protected void corruptDestination(DestinationHandler dh)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "corruptDestination", dh);
if (!dh.isLink() && destinationIndex.containsDestination(dh))
{
destinationIndex.corrupt(dh);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "corruptDestination");
} | [
"protected",
"void",
"corruptDestination",
"(",
"DestinationHandler",
"dh",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"corruptDestination\"",
",",
"dh",
")",
";",
"if",
"(",
"!",
"dh",
".",
"isLink",
"(",
")",
"&&",
"destinationIndex",
".",
"containsDestination",
"(",
"dh",
")",
")",
"{",
"destinationIndex",
".",
"corrupt",
"(",
"dh",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"corruptDestination\"",
")",
";",
"}"
] | PK54812 Move the destination into CORRUPT state | [
"PK54812",
"Move",
"the",
"destination",
"into",
"CORRUPT",
"state"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L7192-L7204 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DeletePubSubMsgsThread.stopThread | @Override
public void stopThread(StoppableThreadCache cache) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stopThread");
this.hasToStop = true;
//Remove this thread from the thread cache
cache.deregisterThread(this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stopThread");
} | java | @Override
public void stopThread(StoppableThreadCache cache) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stopThread");
this.hasToStop = true;
//Remove this thread from the thread cache
cache.deregisterThread(this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stopThread");
} | [
"@",
"Override",
"public",
"void",
"stopThread",
"(",
"StoppableThreadCache",
"cache",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"stopThread\"",
")",
";",
"this",
".",
"hasToStop",
"=",
"true",
";",
"//Remove this thread from the thread cache",
"cache",
".",
"deregisterThread",
"(",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"stopThread\"",
")",
";",
"}"
] | This get called from MessageProcessor on ME getting stopped. | [
"This",
"get",
"called",
"from",
"MessageProcessor",
"on",
"ME",
"getting",
"stopped",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L7520-L7532 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSDeployedSupport.java | EJSDeployedSupport.setUncheckedLocalException | public final void setUncheckedLocalException(Throwable ex) throws EJBException {
ExceptionMappingStrategy exceptionStrategy = getExceptionMappingStrategy();
Throwable mappedException = exceptionStrategy.setUncheckedException(this, ex);
if (mappedException != null) {
if (mappedException instanceof EJBException) {
throw (EJBException) mappedException;
} else if (mappedException instanceof RuntimeException) {
throw (RuntimeException) mappedException;
} else if (mappedException instanceof Error) {
throw (Error) mappedException;
} else {
// Unless there is a defect in mapping strategy, this should
// never happen. But if it does, we are going to
// wrap what is returned with a EJBException. This is added
// measure to ensure we do not break applications that
// existed prior to EJB 3.
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "unexpected Throwable returned by exception mapping strategy", new Object[] { mappedException, exceptionStrategy });
}
throw ExceptionUtil.EJBException(mappedException);
}
}
} | java | public final void setUncheckedLocalException(Throwable ex) throws EJBException {
ExceptionMappingStrategy exceptionStrategy = getExceptionMappingStrategy();
Throwable mappedException = exceptionStrategy.setUncheckedException(this, ex);
if (mappedException != null) {
if (mappedException instanceof EJBException) {
throw (EJBException) mappedException;
} else if (mappedException instanceof RuntimeException) {
throw (RuntimeException) mappedException;
} else if (mappedException instanceof Error) {
throw (Error) mappedException;
} else {
// Unless there is a defect in mapping strategy, this should
// never happen. But if it does, we are going to
// wrap what is returned with a EJBException. This is added
// measure to ensure we do not break applications that
// existed prior to EJB 3.
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "unexpected Throwable returned by exception mapping strategy", new Object[] { mappedException, exceptionStrategy });
}
throw ExceptionUtil.EJBException(mappedException);
}
}
} | [
"public",
"final",
"void",
"setUncheckedLocalException",
"(",
"Throwable",
"ex",
")",
"throws",
"EJBException",
"{",
"ExceptionMappingStrategy",
"exceptionStrategy",
"=",
"getExceptionMappingStrategy",
"(",
")",
";",
"Throwable",
"mappedException",
"=",
"exceptionStrategy",
".",
"setUncheckedException",
"(",
"this",
",",
"ex",
")",
";",
"if",
"(",
"mappedException",
"!=",
"null",
")",
"{",
"if",
"(",
"mappedException",
"instanceof",
"EJBException",
")",
"{",
"throw",
"(",
"EJBException",
")",
"mappedException",
";",
"}",
"else",
"if",
"(",
"mappedException",
"instanceof",
"RuntimeException",
")",
"{",
"throw",
"(",
"RuntimeException",
")",
"mappedException",
";",
"}",
"else",
"if",
"(",
"mappedException",
"instanceof",
"Error",
")",
"{",
"throw",
"(",
"Error",
")",
"mappedException",
";",
"}",
"else",
"{",
"// Unless there is a defect in mapping strategy, this should",
"// never happen. But if it does, we are going to",
"// wrap what is returned with a EJBException. This is added",
"// measure to ensure we do not break applications that",
"// existed prior to EJB 3.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"unexpected Throwable returned by exception mapping strategy\"",
",",
"new",
"Object",
"[",
"]",
"{",
"mappedException",
",",
"exceptionStrategy",
"}",
")",
";",
"}",
"throw",
"ExceptionUtil",
".",
"EJBException",
"(",
"mappedException",
")",
";",
"}",
"}",
"}"
] | d395666 - rewrote entire method. | [
"d395666",
"-",
"rewrote",
"entire",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSDeployedSupport.java#L447-L469 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSDeployedSupport.java | EJSDeployedSupport.getApplicationExceptionRollback | protected Boolean getApplicationExceptionRollback(Throwable t) {
Boolean rollback;
if (ivIgnoreApplicationExceptions) {
rollback = null;
} else {
ComponentMetaData cmd = getComponentMetaData();
EJBModuleMetaDataImpl mmd = (EJBModuleMetaDataImpl) cmd.getModuleMetaData();
rollback = mmd.getApplicationExceptionRollback(t);
}
return rollback;
} | java | protected Boolean getApplicationExceptionRollback(Throwable t) {
Boolean rollback;
if (ivIgnoreApplicationExceptions) {
rollback = null;
} else {
ComponentMetaData cmd = getComponentMetaData();
EJBModuleMetaDataImpl mmd = (EJBModuleMetaDataImpl) cmd.getModuleMetaData();
rollback = mmd.getApplicationExceptionRollback(t);
}
return rollback;
} | [
"protected",
"Boolean",
"getApplicationExceptionRollback",
"(",
"Throwable",
"t",
")",
"{",
"Boolean",
"rollback",
";",
"if",
"(",
"ivIgnoreApplicationExceptions",
")",
"{",
"rollback",
"=",
"null",
";",
"}",
"else",
"{",
"ComponentMetaData",
"cmd",
"=",
"getComponentMetaData",
"(",
")",
";",
"EJBModuleMetaDataImpl",
"mmd",
"=",
"(",
"EJBModuleMetaDataImpl",
")",
"cmd",
".",
"getModuleMetaData",
"(",
")",
";",
"rollback",
"=",
"mmd",
".",
"getApplicationExceptionRollback",
"(",
"t",
")",
";",
"}",
"return",
"rollback",
";",
"}"
] | d395666 - added entire method. | [
"d395666",
"-",
"added",
"entire",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSDeployedSupport.java#L537-L547 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSDeployedSupport.java | EJSDeployedSupport.getContextData | public Map<String, Object> getContextData() {
if (ivContextData == null) {
ivContextData = new HashMap<String, Object>();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getContextData: created empty");
}
return ivContextData;
} | java | public Map<String, Object> getContextData() {
if (ivContextData == null) {
ivContextData = new HashMap<String, Object>();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getContextData: created empty");
}
return ivContextData;
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getContextData",
"(",
")",
"{",
"if",
"(",
"ivContextData",
"==",
"null",
")",
"{",
"ivContextData",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getContextData: created empty\"",
")",
";",
"}",
"return",
"ivContextData",
";",
"}"
] | Returns the context data associated with this method invocation. | [
"Returns",
"the",
"context",
"data",
"associated",
"with",
"this",
"method",
"invocation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSDeployedSupport.java#L721-L730 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsCreator.java | StatsCreator.addSubStatsToParent | public static void addSubStatsToParent(SPIStats parentStats, SPIStats subStats) {
StatsImpl p = (StatsImpl) parentStats;
StatsImpl s = (StatsImpl) subStats;
p.add(s);
} | java | public static void addSubStatsToParent(SPIStats parentStats, SPIStats subStats) {
StatsImpl p = (StatsImpl) parentStats;
StatsImpl s = (StatsImpl) subStats;
p.add(s);
} | [
"public",
"static",
"void",
"addSubStatsToParent",
"(",
"SPIStats",
"parentStats",
",",
"SPIStats",
"subStats",
")",
"{",
"StatsImpl",
"p",
"=",
"(",
"StatsImpl",
")",
"parentStats",
";",
"StatsImpl",
"s",
"=",
"(",
"StatsImpl",
")",
"subStats",
";",
"p",
".",
"add",
"(",
"s",
")",
";",
"}"
] | This method adds one Stats object as a subStats of another Stats object
@param parentStats This Stats is the parent
@param subStats This Stats is the child | [
"This",
"method",
"adds",
"one",
"Stats",
"object",
"as",
"a",
"subStats",
"of",
"another",
"Stats",
"object"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsCreator.java#L135-L139 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsCreator.java | StatsCreator.addStatisticsToParent | public static void addStatisticsToParent(SPIStats parentStats, SPIStatistic statistic) {
StatsImpl p = (StatsImpl) parentStats;
StatisticImpl s = (StatisticImpl) statistic;
p.add(s);
} | java | public static void addStatisticsToParent(SPIStats parentStats, SPIStatistic statistic) {
StatsImpl p = (StatsImpl) parentStats;
StatisticImpl s = (StatisticImpl) statistic;
p.add(s);
} | [
"public",
"static",
"void",
"addStatisticsToParent",
"(",
"SPIStats",
"parentStats",
",",
"SPIStatistic",
"statistic",
")",
"{",
"StatsImpl",
"p",
"=",
"(",
"StatsImpl",
")",
"parentStats",
";",
"StatisticImpl",
"s",
"=",
"(",
"StatisticImpl",
")",
"statistic",
";",
"p",
".",
"add",
"(",
"s",
")",
";",
"}"
] | This method adds one Statistic object as the child of a Stats object
@param parentStats This stats is the parent
@param statistic This statistic should be added | [
"This",
"method",
"adds",
"one",
"Statistic",
"object",
"as",
"the",
"child",
"of",
"a",
"Stats",
"object"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsCreator.java#L147-L151 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/AutoBindNode.java | AutoBindNode.addLastEntry | void addLastEntry(Object entry) {
if (multiple == null) {
if (!single.equals(entry)) {
multiple = new LinkedList<Object>();
multiple.addLast(single);
multiple.addLast(entry);
}
} else {
if (!multiple.contains(entry)) {
multiple.addLast(entry);
}
}
single = entry;
} | java | void addLastEntry(Object entry) {
if (multiple == null) {
if (!single.equals(entry)) {
multiple = new LinkedList<Object>();
multiple.addLast(single);
multiple.addLast(entry);
}
} else {
if (!multiple.contains(entry)) {
multiple.addLast(entry);
}
}
single = entry;
} | [
"void",
"addLastEntry",
"(",
"Object",
"entry",
")",
"{",
"if",
"(",
"multiple",
"==",
"null",
")",
"{",
"if",
"(",
"!",
"single",
".",
"equals",
"(",
"entry",
")",
")",
"{",
"multiple",
"=",
"new",
"LinkedList",
"<",
"Object",
">",
"(",
")",
";",
"multiple",
".",
"addLast",
"(",
"single",
")",
";",
"multiple",
".",
"addLast",
"(",
"entry",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"multiple",
".",
"contains",
"(",
"entry",
")",
")",
"{",
"multiple",
".",
"addLast",
"(",
"entry",
")",
";",
"}",
"}",
"single",
"=",
"entry",
";",
"}"
] | This method is used to add an entry to the AutoBindNode
Note that the node can contain multiple entries. This method
is not thread safe and should be externally synchronized such that
other modifications do not happen concurrently on another thread.
@param entry The entry to add | [
"This",
"method",
"is",
"used",
"to",
"add",
"an",
"entry",
"to",
"the",
"AutoBindNode",
"Note",
"that",
"the",
"node",
"can",
"contain",
"multiple",
"entries",
".",
"This",
"method",
"is",
"not",
"thread",
"safe",
"and",
"should",
"be",
"externally",
"synchronized",
"such",
"that",
"other",
"modifications",
"do",
"not",
"happen",
"concurrently",
"on",
"another",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/AutoBindNode.java#L48-L61 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/AutoBindNode.java | AutoBindNode.removeEntry | boolean removeEntry(Object entry) {
if (multiple == null) {
if (entry.equals(single)) {
single = null;
return true;
}
} else {
multiple.remove(entry);
if (single.equals(entry)) {
single = multiple.peekLast();
}
if (multiple.size() == 1) {
multiple = null;
}
}
return false;
} | java | boolean removeEntry(Object entry) {
if (multiple == null) {
if (entry.equals(single)) {
single = null;
return true;
}
} else {
multiple.remove(entry);
if (single.equals(entry)) {
single = multiple.peekLast();
}
if (multiple.size() == 1) {
multiple = null;
}
}
return false;
} | [
"boolean",
"removeEntry",
"(",
"Object",
"entry",
")",
"{",
"if",
"(",
"multiple",
"==",
"null",
")",
"{",
"if",
"(",
"entry",
".",
"equals",
"(",
"single",
")",
")",
"{",
"single",
"=",
"null",
";",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"multiple",
".",
"remove",
"(",
"entry",
")",
";",
"if",
"(",
"single",
".",
"equals",
"(",
"entry",
")",
")",
"{",
"single",
"=",
"multiple",
".",
"peekLast",
"(",
")",
";",
"}",
"if",
"(",
"multiple",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"multiple",
"=",
"null",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | This method is used to remove an entry from the AutoBindNode.
This method is not thread safe and should be externally synchronized
such that other modifications do not happen concurrently on another
thread.
@param entry The entry to remove
@return boolean representing whether the AutoBindNode is empty and
can be removed | [
"This",
"method",
"is",
"used",
"to",
"remove",
"an",
"entry",
"from",
"the",
"AutoBindNode",
".",
"This",
"method",
"is",
"not",
"thread",
"safe",
"and",
"should",
"be",
"externally",
"synchronized",
"such",
"that",
"other",
"modifications",
"do",
"not",
"happen",
"concurrently",
"on",
"another",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/AutoBindNode.java#L73-L89 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/RealTimeDaemon.java | RealTimeDaemon.alarm | public void alarm(final Object context) {
long sleepInterval = 0;
do {
long startWakeUpTime = System.currentTimeMillis();
try {
wakeUp(startDaemonTime, startWakeUpTime);
} catch (Exception ex) {
com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.RealTimeDaemon.alarm", "83", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "exception during wakeUp", ex);
}
sleepInterval = timeInterval - (System.currentTimeMillis() - startWakeUpTime);
// keep looping while we are behind... (i.e. execution time is greater than the time interval)
} while (sleepInterval <= 0);
if (false == stopDaemon){
Scheduler.createNonDeferrable(sleepInterval, context,
new Runnable() {
@Override
public void run() {
alarm(context);
}
});
}
} | java | public void alarm(final Object context) {
long sleepInterval = 0;
do {
long startWakeUpTime = System.currentTimeMillis();
try {
wakeUp(startDaemonTime, startWakeUpTime);
} catch (Exception ex) {
com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.RealTimeDaemon.alarm", "83", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "exception during wakeUp", ex);
}
sleepInterval = timeInterval - (System.currentTimeMillis() - startWakeUpTime);
// keep looping while we are behind... (i.e. execution time is greater than the time interval)
} while (sleepInterval <= 0);
if (false == stopDaemon){
Scheduler.createNonDeferrable(sleepInterval, context,
new Runnable() {
@Override
public void run() {
alarm(context);
}
});
}
} | [
"public",
"void",
"alarm",
"(",
"final",
"Object",
"context",
")",
"{",
"long",
"sleepInterval",
"=",
"0",
";",
"do",
"{",
"long",
"startWakeUpTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"wakeUp",
"(",
"startDaemonTime",
",",
"startWakeUpTime",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"com.ibm.ws.cache.RealTimeDaemon.alarm\"",
",",
"\"83\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"exception during wakeUp\"",
",",
"ex",
")",
";",
"}",
"sleepInterval",
"=",
"timeInterval",
"-",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"startWakeUpTime",
")",
";",
"// keep looping while we are behind... (i.e. execution time is greater than the time interval)",
"}",
"while",
"(",
"sleepInterval",
"<=",
"0",
")",
";",
"if",
"(",
"false",
"==",
"stopDaemon",
")",
"{",
"Scheduler",
".",
"createNonDeferrable",
"(",
"sleepInterval",
",",
"context",
",",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"alarm",
"(",
"context",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] | It runs in a loop that tries to wake every timeInterval.
If it gets behind due to an overload, the subclass' implementation
of the wakeUp method is responsible for resynching itself based
on the startDaemonTime and startWakeUpTime. | [
"It",
"runs",
"in",
"a",
"loop",
"that",
"tries",
"to",
"wake",
"every",
"timeInterval",
".",
"If",
"it",
"gets",
"behind",
"due",
"to",
"an",
"overload",
"the",
"subclass",
"implementation",
"of",
"the",
"wakeUp",
"method",
"is",
"responsible",
"for",
"resynching",
"itself",
"based",
"on",
"the",
"startDaemonTime",
"and",
"startWakeUpTime",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/RealTimeDaemon.java#L91-L115 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java | PasswordUtil.encode | public static String encode(String decoded_string, String crypto_algorithm, String crypto_key)
throws InvalidPasswordEncodingException, UnsupportedCryptoAlgorithmException {
HashMap<String, String> props = new HashMap<String, String>();
if (crypto_key != null) {
props.put(PROPERTY_CRYPTO_KEY, crypto_key);
}
return encode(decoded_string, crypto_algorithm, props);
} | java | public static String encode(String decoded_string, String crypto_algorithm, String crypto_key)
throws InvalidPasswordEncodingException, UnsupportedCryptoAlgorithmException {
HashMap<String, String> props = new HashMap<String, String>();
if (crypto_key != null) {
props.put(PROPERTY_CRYPTO_KEY, crypto_key);
}
return encode(decoded_string, crypto_algorithm, props);
} | [
"public",
"static",
"String",
"encode",
"(",
"String",
"decoded_string",
",",
"String",
"crypto_algorithm",
",",
"String",
"crypto_key",
")",
"throws",
"InvalidPasswordEncodingException",
",",
"UnsupportedCryptoAlgorithmException",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"props",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"if",
"(",
"crypto_key",
"!=",
"null",
")",
"{",
"props",
".",
"put",
"(",
"PROPERTY_CRYPTO_KEY",
",",
"crypto_key",
")",
";",
"}",
"return",
"encode",
"(",
"decoded_string",
",",
"crypto_algorithm",
",",
"props",
")",
";",
"}"
] | Encode the provided string with the specified algorithm and the crypto key
If the decoded_string is already encoded, the string will be decoded and then encoded by using the specified crypto algorithm.
Use this method for encoding the string by using the AES encryption with the specific crypto key.
Note that this method is only avaiable for the Liberty profile.
@param decoded_string the string to be encoded.
@param crypto_algorithm the algorithm to be used for encoding.
@param crypto_key the key for the encryption. This value is only valid for aes algorithm.
@return The encoded string.
@throws InvalidPasswordEncodingException If the decoded_string is null or invalid. Or the encoded_string is null.
@throws UnsupportedCryptoAlgorithmException If the algorithm is not supported. | [
"Encode",
"the",
"provided",
"string",
"with",
"the",
"specified",
"algorithm",
"and",
"the",
"crypto",
"key",
"If",
"the",
"decoded_string",
"is",
"already",
"encoded",
"the",
"string",
"will",
"be",
"decoded",
"and",
"then",
"encoded",
"by",
"using",
"the",
"specified",
"crypto",
"algorithm",
".",
"Use",
"this",
"method",
"for",
"encoding",
"the",
"string",
"by",
"using",
"the",
"AES",
"encryption",
"with",
"the",
"specific",
"crypto",
"key",
".",
"Note",
"that",
"this",
"method",
"is",
"only",
"avaiable",
"for",
"the",
"Liberty",
"profile",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java#L194-L201 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java | PasswordUtil.encode | public static String encode(String decoded_string, String crypto_algorithm, Map<String, String> properties)
throws InvalidPasswordEncodingException, UnsupportedCryptoAlgorithmException {
/*
* check input:
*
* -- decoded_string: any string, any length, cannot be null,
* cannot start with crypto algorithm tag
*
* -- crypto_algorithm: any string, any length, cannot be null,
* must be valid (supported) crypto algorithm
*/
if (!isValidCryptoAlgorithm(crypto_algorithm)) {
// don't accept unsupported crypto algorithm
throw new UnsupportedCryptoAlgorithmException();
}
if (decoded_string == null) {
// don't accept null password
throw new InvalidPasswordEncodingException();
}
String current_crypto_algorithm = getCryptoAlgorithm(decoded_string);
if ((current_crypto_algorithm != null && current_crypto_algorithm.startsWith(crypto_algorithm)) || isHashed(decoded_string)) {
// don't accept encoded password
throw new InvalidPasswordEncodingException();
} else if (current_crypto_algorithm != null) {
decoded_string = passwordDecode(decoded_string);
}
if (properties == null || !properties.containsKey(PROPERTY_NO_TRIM) || !"true".equalsIgnoreCase(properties.get(PROPERTY_NO_TRIM))) {
decoded_string = decoded_string.trim();
}
String encoded_string = encode_password(decoded_string, crypto_algorithm.trim(), properties);
if (encoded_string == null) {
throw new InvalidPasswordEncodingException();
}
return encoded_string;
} | java | public static String encode(String decoded_string, String crypto_algorithm, Map<String, String> properties)
throws InvalidPasswordEncodingException, UnsupportedCryptoAlgorithmException {
/*
* check input:
*
* -- decoded_string: any string, any length, cannot be null,
* cannot start with crypto algorithm tag
*
* -- crypto_algorithm: any string, any length, cannot be null,
* must be valid (supported) crypto algorithm
*/
if (!isValidCryptoAlgorithm(crypto_algorithm)) {
// don't accept unsupported crypto algorithm
throw new UnsupportedCryptoAlgorithmException();
}
if (decoded_string == null) {
// don't accept null password
throw new InvalidPasswordEncodingException();
}
String current_crypto_algorithm = getCryptoAlgorithm(decoded_string);
if ((current_crypto_algorithm != null && current_crypto_algorithm.startsWith(crypto_algorithm)) || isHashed(decoded_string)) {
// don't accept encoded password
throw new InvalidPasswordEncodingException();
} else if (current_crypto_algorithm != null) {
decoded_string = passwordDecode(decoded_string);
}
if (properties == null || !properties.containsKey(PROPERTY_NO_TRIM) || !"true".equalsIgnoreCase(properties.get(PROPERTY_NO_TRIM))) {
decoded_string = decoded_string.trim();
}
String encoded_string = encode_password(decoded_string, crypto_algorithm.trim(), properties);
if (encoded_string == null) {
throw new InvalidPasswordEncodingException();
}
return encoded_string;
} | [
"public",
"static",
"String",
"encode",
"(",
"String",
"decoded_string",
",",
"String",
"crypto_algorithm",
",",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"throws",
"InvalidPasswordEncodingException",
",",
"UnsupportedCryptoAlgorithmException",
"{",
"/*\n * check input:\n * \n * -- decoded_string: any string, any length, cannot be null,\n * cannot start with crypto algorithm tag\n * \n * -- crypto_algorithm: any string, any length, cannot be null,\n * must be valid (supported) crypto algorithm\n */",
"if",
"(",
"!",
"isValidCryptoAlgorithm",
"(",
"crypto_algorithm",
")",
")",
"{",
"// don't accept unsupported crypto algorithm",
"throw",
"new",
"UnsupportedCryptoAlgorithmException",
"(",
")",
";",
"}",
"if",
"(",
"decoded_string",
"==",
"null",
")",
"{",
"// don't accept null password",
"throw",
"new",
"InvalidPasswordEncodingException",
"(",
")",
";",
"}",
"String",
"current_crypto_algorithm",
"=",
"getCryptoAlgorithm",
"(",
"decoded_string",
")",
";",
"if",
"(",
"(",
"current_crypto_algorithm",
"!=",
"null",
"&&",
"current_crypto_algorithm",
".",
"startsWith",
"(",
"crypto_algorithm",
")",
")",
"||",
"isHashed",
"(",
"decoded_string",
")",
")",
"{",
"// don't accept encoded password",
"throw",
"new",
"InvalidPasswordEncodingException",
"(",
")",
";",
"}",
"else",
"if",
"(",
"current_crypto_algorithm",
"!=",
"null",
")",
"{",
"decoded_string",
"=",
"passwordDecode",
"(",
"decoded_string",
")",
";",
"}",
"if",
"(",
"properties",
"==",
"null",
"||",
"!",
"properties",
".",
"containsKey",
"(",
"PROPERTY_NO_TRIM",
")",
"||",
"!",
"\"true\"",
".",
"equalsIgnoreCase",
"(",
"properties",
".",
"get",
"(",
"PROPERTY_NO_TRIM",
")",
")",
")",
"{",
"decoded_string",
"=",
"decoded_string",
".",
"trim",
"(",
")",
";",
"}",
"String",
"encoded_string",
"=",
"encode_password",
"(",
"decoded_string",
",",
"crypto_algorithm",
".",
"trim",
"(",
")",
",",
"properties",
")",
";",
"if",
"(",
"encoded_string",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidPasswordEncodingException",
"(",
")",
";",
"}",
"return",
"encoded_string",
";",
"}"
] | Encode the provided string with the specified algorithm and the properties
If the decoded_string is already encoded, the string will be decoded and then encoded by using the specified crypto algorithm.
Note that this method is only avaiable for the Liberty profile.
@param decoded_string the string to be encoded.
@param crypto_algorithm the algorithm to be used for encoding. The supported values are xor, aes, or hash.
@param properties the properties for the encryption.
@return The encoded string.
@throws InvalidPasswordEncodingException If the decoded_string is null or invalid. Or the encoded_string is null.
@throws UnsupportedCryptoAlgorithmException If the algorithm is not supported. | [
"Encode",
"the",
"provided",
"string",
"with",
"the",
"specified",
"algorithm",
"and",
"the",
"properties",
"If",
"the",
"decoded_string",
"is",
"already",
"encoded",
"the",
"string",
"will",
"be",
"decoded",
"and",
"then",
"encoded",
"by",
"using",
"the",
"specified",
"crypto",
"algorithm",
".",
"Note",
"that",
"this",
"method",
"is",
"only",
"avaiable",
"for",
"the",
"Liberty",
"profile",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java#L215-L255 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java | PasswordUtil.isHashed | public static boolean isHashed(String encoded_string) {
String algorithm = getCryptoAlgorithm(encoded_string);
return isValidAlgorithm(algorithm, PasswordCipherUtil.getSupportedHashAlgorithms());
} | java | public static boolean isHashed(String encoded_string) {
String algorithm = getCryptoAlgorithm(encoded_string);
return isValidAlgorithm(algorithm, PasswordCipherUtil.getSupportedHashAlgorithms());
} | [
"public",
"static",
"boolean",
"isHashed",
"(",
"String",
"encoded_string",
")",
"{",
"String",
"algorithm",
"=",
"getCryptoAlgorithm",
"(",
"encoded_string",
")",
";",
"return",
"isValidAlgorithm",
"(",
"algorithm",
",",
"PasswordCipherUtil",
".",
"getSupportedHashAlgorithms",
"(",
")",
")",
";",
"}"
] | Determine if the provided string is hashed by examining the algorithm tag.
Note that this method is only avaiable for the Liberty profile.
@param encoded_string the string with the encoded algorithm tag.
@return true if the encoded algorithm is hash. false otherwise. | [
"Determine",
"if",
"the",
"provided",
"string",
"is",
"hashed",
"by",
"examining",
"the",
"algorithm",
"tag",
".",
"Note",
"that",
"this",
"method",
"is",
"only",
"avaiable",
"for",
"the",
"Liberty",
"profile",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java#L371-L374 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java | PasswordUtil.passwordEncode | public static String passwordEncode(String decoded_string, String crypto_algorithm) {
/*
* check input:
*
* -- decoded_string: any string, any length, cannot be null,
* may start with valid (supported) crypto algorithm tag
*
* -- crypto_algorithm: any string, any length, cannot be null,
* must be valid (supported) crypto algorithm
*/
if (decoded_string == null) {
// don't accept null password
return null;
}
String current_crypto_algorithm = getCryptoAlgorithm(decoded_string);
if (current_crypto_algorithm != null && current_crypto_algorithm.equals(crypto_algorithm)) {
// Return the decoded_string if it is tagged with a valid crypto algorithm.
if (isValidCryptoAlgorithm(current_crypto_algorithm))
return decoded_string.trim();
return null;
} else if (current_crypto_algorithm != null) {
decoded_string = passwordDecode(decoded_string);
}
// valid input ... encode password
return encode_password(decoded_string.trim(), crypto_algorithm.trim(), null); // TODO check this
} | java | public static String passwordEncode(String decoded_string, String crypto_algorithm) {
/*
* check input:
*
* -- decoded_string: any string, any length, cannot be null,
* may start with valid (supported) crypto algorithm tag
*
* -- crypto_algorithm: any string, any length, cannot be null,
* must be valid (supported) crypto algorithm
*/
if (decoded_string == null) {
// don't accept null password
return null;
}
String current_crypto_algorithm = getCryptoAlgorithm(decoded_string);
if (current_crypto_algorithm != null && current_crypto_algorithm.equals(crypto_algorithm)) {
// Return the decoded_string if it is tagged with a valid crypto algorithm.
if (isValidCryptoAlgorithm(current_crypto_algorithm))
return decoded_string.trim();
return null;
} else if (current_crypto_algorithm != null) {
decoded_string = passwordDecode(decoded_string);
}
// valid input ... encode password
return encode_password(decoded_string.trim(), crypto_algorithm.trim(), null); // TODO check this
} | [
"public",
"static",
"String",
"passwordEncode",
"(",
"String",
"decoded_string",
",",
"String",
"crypto_algorithm",
")",
"{",
"/*\n * check input:\n * \n * -- decoded_string: any string, any length, cannot be null,\n * may start with valid (supported) crypto algorithm tag\n * \n * -- crypto_algorithm: any string, any length, cannot be null,\n * must be valid (supported) crypto algorithm\n */",
"if",
"(",
"decoded_string",
"==",
"null",
")",
"{",
"// don't accept null password",
"return",
"null",
";",
"}",
"String",
"current_crypto_algorithm",
"=",
"getCryptoAlgorithm",
"(",
"decoded_string",
")",
";",
"if",
"(",
"current_crypto_algorithm",
"!=",
"null",
"&&",
"current_crypto_algorithm",
".",
"equals",
"(",
"crypto_algorithm",
")",
")",
"{",
"// Return the decoded_string if it is tagged with a valid crypto algorithm.",
"if",
"(",
"isValidCryptoAlgorithm",
"(",
"current_crypto_algorithm",
")",
")",
"return",
"decoded_string",
".",
"trim",
"(",
")",
";",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"current_crypto_algorithm",
"!=",
"null",
")",
"{",
"decoded_string",
"=",
"passwordDecode",
"(",
"decoded_string",
")",
";",
"}",
"// valid input ... encode password",
"return",
"encode_password",
"(",
"decoded_string",
".",
"trim",
"(",
")",
",",
"crypto_algorithm",
".",
"trim",
"(",
")",
",",
"null",
")",
";",
"// TODO check this",
"}"
] | Encode the provided password with the algorithm. If another algorithm
is already applied, it will be removed and replaced with the new algorithm.
@param decoded_string the string to be encoded, or the encoded string.
@param crypto_algorithm the algorithm to be used for encoding. The supported values are xor, aes, or hash.
@return The encoded string. Null if there is any failure during encoding, or invalid or null decoded_string | [
"Encode",
"the",
"provided",
"password",
"with",
"the",
"algorithm",
".",
"If",
"another",
"algorithm",
"is",
"already",
"applied",
"it",
"will",
"be",
"removed",
"and",
"replaced",
"with",
"the",
"new",
"algorithm",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java#L442-L471 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java | PasswordUtil.removeCryptoAlgorithmTag | public static String removeCryptoAlgorithmTag(String password) {
if (null == password) {
return null;
}
String rc = null;
String data = password.trim();
if (data.length() >= 2) {
if ('{' == data.charAt(0)) {
int end = data.indexOf('}', 1);
if (end > 0) {
end++; // we want to jump past the end marker
if (end == data.length()) {
rc = EMPTY_STRING;
} else {
rc = data.substring(end).trim();
}
}
}
}
return rc;
} | java | public static String removeCryptoAlgorithmTag(String password) {
if (null == password) {
return null;
}
String rc = null;
String data = password.trim();
if (data.length() >= 2) {
if ('{' == data.charAt(0)) {
int end = data.indexOf('}', 1);
if (end > 0) {
end++; // we want to jump past the end marker
if (end == data.length()) {
rc = EMPTY_STRING;
} else {
rc = data.substring(end).trim();
}
}
}
}
return rc;
} | [
"public",
"static",
"String",
"removeCryptoAlgorithmTag",
"(",
"String",
"password",
")",
"{",
"if",
"(",
"null",
"==",
"password",
")",
"{",
"return",
"null",
";",
"}",
"String",
"rc",
"=",
"null",
";",
"String",
"data",
"=",
"password",
".",
"trim",
"(",
")",
";",
"if",
"(",
"data",
".",
"length",
"(",
")",
">=",
"2",
")",
"{",
"if",
"(",
"'",
"'",
"==",
"data",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"int",
"end",
"=",
"data",
".",
"indexOf",
"(",
"'",
"'",
",",
"1",
")",
";",
"if",
"(",
"end",
">",
"0",
")",
"{",
"end",
"++",
";",
"// we want to jump past the end marker",
"if",
"(",
"end",
"==",
"data",
".",
"length",
"(",
")",
")",
"{",
"rc",
"=",
"EMPTY_STRING",
";",
"}",
"else",
"{",
"rc",
"=",
"data",
".",
"substring",
"(",
"end",
")",
".",
"trim",
"(",
")",
";",
"}",
"}",
"}",
"}",
"return",
"rc",
";",
"}"
] | Remove the algorithm tag from the input encoded password.
@param password the string which contains the crypto algorithm tag.
@return The string which the crypto algorithm tag is removed. | [
"Remove",
"the",
"algorithm",
"tag",
"from",
"the",
"input",
"encoded",
"password",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java#L479-L501 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java | PasswordUtil.convert_viewable_to_bytes | private static byte[] convert_viewable_to_bytes(String string) {
if (null == string) {
return null;
}
if (0 == string.length()) {
return EMPTY_BYTE_ARRAY;
}
return Base64Coder.base64Decode(convert_to_bytes(string));
} | java | private static byte[] convert_viewable_to_bytes(String string) {
if (null == string) {
return null;
}
if (0 == string.length()) {
return EMPTY_BYTE_ARRAY;
}
return Base64Coder.base64Decode(convert_to_bytes(string));
} | [
"private",
"static",
"byte",
"[",
"]",
"convert_viewable_to_bytes",
"(",
"String",
"string",
")",
"{",
"if",
"(",
"null",
"==",
"string",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"0",
"==",
"string",
".",
"length",
"(",
")",
")",
"{",
"return",
"EMPTY_BYTE_ARRAY",
";",
"}",
"return",
"Base64Coder",
".",
"base64Decode",
"(",
"convert_to_bytes",
"(",
"string",
")",
")",
";",
"}"
] | Convert the string to bytes using UTF-8 encoding and then run it through
the base64 decoding.
@param string
@return byte[] - null if null input or an error in the conversion happens | [
"Convert",
"the",
"string",
"to",
"bytes",
"using",
"UTF",
"-",
"8",
"encoding",
"and",
"then",
"run",
"it",
"through",
"the",
"base64",
"decoding",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java#L552-L560 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java | PasswordUtil.convert_viewable_to_string | private static String convert_viewable_to_string(byte[] bytes) {
String string = null;
if (bytes != null) {
if (bytes.length == 0) {
string = EMPTY_STRING;
} else {
string = convert_to_string(Base64Coder.base64Encode(bytes));
}
}
return string;
} | java | private static String convert_viewable_to_string(byte[] bytes) {
String string = null;
if (bytes != null) {
if (bytes.length == 0) {
string = EMPTY_STRING;
} else {
string = convert_to_string(Base64Coder.base64Encode(bytes));
}
}
return string;
} | [
"private",
"static",
"String",
"convert_viewable_to_string",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"String",
"string",
"=",
"null",
";",
"if",
"(",
"bytes",
"!=",
"null",
")",
"{",
"if",
"(",
"bytes",
".",
"length",
"==",
"0",
")",
"{",
"string",
"=",
"EMPTY_STRING",
";",
"}",
"else",
"{",
"string",
"=",
"convert_to_string",
"(",
"Base64Coder",
".",
"base64Encode",
"(",
"bytes",
")",
")",
";",
"}",
"}",
"return",
"string",
";",
"}"
] | Use base64 encoding on the bytes and then convert them to a string using
UTF-8 encoding.
@param bytes
@return String - null if input is null or an error happens during the conversion | [
"Use",
"base64",
"encoding",
"on",
"the",
"bytes",
"and",
"then",
"convert",
"them",
"to",
"a",
"string",
"using",
"UTF",
"-",
"8",
"encoding",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java#L569-L580 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java | PasswordUtil.decode_password | private static String decode_password(String encoded_string, String crypto_algorithm) {
/*
* decoding process:
*
* -- check for empty algorithm tag
* -- convert input String to byte[] using base64 decoding
* -- decipher byte[]
* -- convert byte[] to String using UTF8 conversion code
*/
StringBuilder buffer = new StringBuilder();
if (crypto_algorithm.length() == 0) {
// crypto algorithm is empty ... don't decode password
buffer.append(encoded_string);
} else {
// decode password with specified crypto algorithm
String decoded_string = null;
if (encoded_string.length() > 0) {
// convert viewable string to encrypted password byte[]
byte[] encrypted_bytes = convert_viewable_to_bytes(encoded_string);
logger.logp(Level.FINEST, PasswordUtil.class.getName(), "decode_password", "byte array before decoding\n" + PasswordHashGenerator.hexDump(encrypted_bytes));
if (encrypted_bytes == null) {
// base64 decoding failed
logger.logp(Level.SEVERE, PasswordUtil.class.getName(), "decode_password", "PASSWORDUTIL_INVALID_BASE64_STRING");
return null;
}
if (encrypted_bytes.length > 0) {
// decrypt encrypted password byte[] with specified crypto algorithm
byte[] decrypted_bytes = null;
try {
decrypted_bytes = PasswordCipherUtil.decipher(encrypted_bytes, crypto_algorithm);
} catch (InvalidPasswordCipherException e) {
logger.logp(Level.SEVERE, PasswordUtil.class.getName(), "decode_password", "PASSWORDUTIL_CYPHER_EXCEPTION", e);
return null;
} catch (UnsupportedCryptoAlgorithmException e) {
logger.logp(Level.SEVERE, PasswordUtil.class.getName(), "decode_password", "PASSWORDUTIL_UNKNOWN_ALGORITHM_EXCEPTION", e);
return null;
}
if ((decrypted_bytes != null) && (decrypted_bytes.length > 0)) {
// convert decrypted password byte[] to string
decoded_string = convert_to_string(decrypted_bytes);
}
}
}
if ((decoded_string != null) && (decoded_string.length() > 0)) {
// append decoded string
buffer.append(decoded_string);
}
}
return buffer.toString();
} | java | private static String decode_password(String encoded_string, String crypto_algorithm) {
/*
* decoding process:
*
* -- check for empty algorithm tag
* -- convert input String to byte[] using base64 decoding
* -- decipher byte[]
* -- convert byte[] to String using UTF8 conversion code
*/
StringBuilder buffer = new StringBuilder();
if (crypto_algorithm.length() == 0) {
// crypto algorithm is empty ... don't decode password
buffer.append(encoded_string);
} else {
// decode password with specified crypto algorithm
String decoded_string = null;
if (encoded_string.length() > 0) {
// convert viewable string to encrypted password byte[]
byte[] encrypted_bytes = convert_viewable_to_bytes(encoded_string);
logger.logp(Level.FINEST, PasswordUtil.class.getName(), "decode_password", "byte array before decoding\n" + PasswordHashGenerator.hexDump(encrypted_bytes));
if (encrypted_bytes == null) {
// base64 decoding failed
logger.logp(Level.SEVERE, PasswordUtil.class.getName(), "decode_password", "PASSWORDUTIL_INVALID_BASE64_STRING");
return null;
}
if (encrypted_bytes.length > 0) {
// decrypt encrypted password byte[] with specified crypto algorithm
byte[] decrypted_bytes = null;
try {
decrypted_bytes = PasswordCipherUtil.decipher(encrypted_bytes, crypto_algorithm);
} catch (InvalidPasswordCipherException e) {
logger.logp(Level.SEVERE, PasswordUtil.class.getName(), "decode_password", "PASSWORDUTIL_CYPHER_EXCEPTION", e);
return null;
} catch (UnsupportedCryptoAlgorithmException e) {
logger.logp(Level.SEVERE, PasswordUtil.class.getName(), "decode_password", "PASSWORDUTIL_UNKNOWN_ALGORITHM_EXCEPTION", e);
return null;
}
if ((decrypted_bytes != null) && (decrypted_bytes.length > 0)) {
// convert decrypted password byte[] to string
decoded_string = convert_to_string(decrypted_bytes);
}
}
}
if ((decoded_string != null) && (decoded_string.length() > 0)) {
// append decoded string
buffer.append(decoded_string);
}
}
return buffer.toString();
} | [
"private",
"static",
"String",
"decode_password",
"(",
"String",
"encoded_string",
",",
"String",
"crypto_algorithm",
")",
"{",
"/*\n * decoding process:\n * \n * -- check for empty algorithm tag\n * -- convert input String to byte[] using base64 decoding\n * -- decipher byte[]\n * -- convert byte[] to String using UTF8 conversion code\n */",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"crypto_algorithm",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"// crypto algorithm is empty ... don't decode password",
"buffer",
".",
"append",
"(",
"encoded_string",
")",
";",
"}",
"else",
"{",
"// decode password with specified crypto algorithm",
"String",
"decoded_string",
"=",
"null",
";",
"if",
"(",
"encoded_string",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"// convert viewable string to encrypted password byte[]",
"byte",
"[",
"]",
"encrypted_bytes",
"=",
"convert_viewable_to_bytes",
"(",
"encoded_string",
")",
";",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINEST",
",",
"PasswordUtil",
".",
"class",
".",
"getName",
"(",
")",
",",
"\"decode_password\"",
",",
"\"byte array before decoding\\n\"",
"+",
"PasswordHashGenerator",
".",
"hexDump",
"(",
"encrypted_bytes",
")",
")",
";",
"if",
"(",
"encrypted_bytes",
"==",
"null",
")",
"{",
"// base64 decoding failed",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"PasswordUtil",
".",
"class",
".",
"getName",
"(",
")",
",",
"\"decode_password\"",
",",
"\"PASSWORDUTIL_INVALID_BASE64_STRING\"",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"encrypted_bytes",
".",
"length",
">",
"0",
")",
"{",
"// decrypt encrypted password byte[] with specified crypto algorithm",
"byte",
"[",
"]",
"decrypted_bytes",
"=",
"null",
";",
"try",
"{",
"decrypted_bytes",
"=",
"PasswordCipherUtil",
".",
"decipher",
"(",
"encrypted_bytes",
",",
"crypto_algorithm",
")",
";",
"}",
"catch",
"(",
"InvalidPasswordCipherException",
"e",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"PasswordUtil",
".",
"class",
".",
"getName",
"(",
")",
",",
"\"decode_password\"",
",",
"\"PASSWORDUTIL_CYPHER_EXCEPTION\"",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"catch",
"(",
"UnsupportedCryptoAlgorithmException",
"e",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"PasswordUtil",
".",
"class",
".",
"getName",
"(",
")",
",",
"\"decode_password\"",
",",
"\"PASSWORDUTIL_UNKNOWN_ALGORITHM_EXCEPTION\"",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"(",
"decrypted_bytes",
"!=",
"null",
")",
"&&",
"(",
"decrypted_bytes",
".",
"length",
">",
"0",
")",
")",
"{",
"// convert decrypted password byte[] to string",
"decoded_string",
"=",
"convert_to_string",
"(",
"decrypted_bytes",
")",
";",
"}",
"}",
"}",
"if",
"(",
"(",
"decoded_string",
"!=",
"null",
")",
"&&",
"(",
"decoded_string",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"{",
"// append decoded string",
"buffer",
".",
"append",
"(",
"decoded_string",
")",
";",
"}",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] | Decode the provided string with the specified algorithm.
@param encoded_string
@param crypto_algorithm
@return String | [
"Decode",
"the",
"provided",
"string",
"with",
"the",
"specified",
"algorithm",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java#L589-L647 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java | PasswordUtil.encode_password | public static String encode_password(String decoded_string, String crypto_algorithm, Map<String, String> properties) {
/*
* encoding process:
*
* -- check for empty algorithm tag
* -- convert input String to byte[] UTF8 conversion code
* -- encipher byte[]
* -- convert byte[] to String using using base64 encoding
*/
StringBuilder buffer = new StringBuilder();
buffer.append(CRYPTO_ALGORITHM_STARTED);
if (crypto_algorithm.length() == 0) {
// crypto algorithm is empty ... don't encode password
buffer.append(CRYPTO_ALGORITHM_STOPPED).append(decoded_string);
} else {
// encode password with specified crypto algorithm
String encoded_string = null;
EncryptedInfo info = null;
if (decoded_string.length() > 0) {
// convert decoded password string to byte[]
byte[] decrypted_bytes = convert_to_bytes(decoded_string);
if (decrypted_bytes.length > 0) {
// encrypt decrypted password byte[] with specified crypto algorithm
byte[] encrypted_bytes = null;
boolean done = false;
while (!done) {
try {
info = PasswordCipherUtil.encipher_internal(decrypted_bytes, crypto_algorithm, properties);
if (info != null) {
encrypted_bytes = info.getEncryptedBytes();
}
done = true;
} catch (InvalidPasswordCipherException e) {
logger.logp(Level.SEVERE, PasswordUtil.class.getName(), "encode_password", "PASSWORDUTIL_CYPHER_EXCEPTION", e);
return null;
} catch (UnsupportedCryptoAlgorithmException e) {
logger.logp(Level.SEVERE, PasswordUtil.class.getName(), "encode_password", "PASSWORDUTIL_UNKNOWN_ALGORITHM_EXCEPTION", e);
return null;
}
}
if ((encrypted_bytes != null) && (encrypted_bytes.length > 0)) {
// convert encrypted password byte[] to viewable string
encoded_string = convert_viewable_to_string(encrypted_bytes);
if (encoded_string == null) {
// base64 encoding failed
return null;
}
}
}
}
buffer.append(crypto_algorithm);
String alias = (null == info) ? null : info.getKeyAlias();
if (alias != null && 0 < alias.length()) {
buffer.append(':').append(alias);
}
buffer.append(CRYPTO_ALGORITHM_STOPPED);
if ((encoded_string != null) && (encoded_string.length() > 0)) {
// append encoded string
buffer.append(encoded_string);
}
}
return buffer.toString();
} | java | public static String encode_password(String decoded_string, String crypto_algorithm, Map<String, String> properties) {
/*
* encoding process:
*
* -- check for empty algorithm tag
* -- convert input String to byte[] UTF8 conversion code
* -- encipher byte[]
* -- convert byte[] to String using using base64 encoding
*/
StringBuilder buffer = new StringBuilder();
buffer.append(CRYPTO_ALGORITHM_STARTED);
if (crypto_algorithm.length() == 0) {
// crypto algorithm is empty ... don't encode password
buffer.append(CRYPTO_ALGORITHM_STOPPED).append(decoded_string);
} else {
// encode password with specified crypto algorithm
String encoded_string = null;
EncryptedInfo info = null;
if (decoded_string.length() > 0) {
// convert decoded password string to byte[]
byte[] decrypted_bytes = convert_to_bytes(decoded_string);
if (decrypted_bytes.length > 0) {
// encrypt decrypted password byte[] with specified crypto algorithm
byte[] encrypted_bytes = null;
boolean done = false;
while (!done) {
try {
info = PasswordCipherUtil.encipher_internal(decrypted_bytes, crypto_algorithm, properties);
if (info != null) {
encrypted_bytes = info.getEncryptedBytes();
}
done = true;
} catch (InvalidPasswordCipherException e) {
logger.logp(Level.SEVERE, PasswordUtil.class.getName(), "encode_password", "PASSWORDUTIL_CYPHER_EXCEPTION", e);
return null;
} catch (UnsupportedCryptoAlgorithmException e) {
logger.logp(Level.SEVERE, PasswordUtil.class.getName(), "encode_password", "PASSWORDUTIL_UNKNOWN_ALGORITHM_EXCEPTION", e);
return null;
}
}
if ((encrypted_bytes != null) && (encrypted_bytes.length > 0)) {
// convert encrypted password byte[] to viewable string
encoded_string = convert_viewable_to_string(encrypted_bytes);
if (encoded_string == null) {
// base64 encoding failed
return null;
}
}
}
}
buffer.append(crypto_algorithm);
String alias = (null == info) ? null : info.getKeyAlias();
if (alias != null && 0 < alias.length()) {
buffer.append(':').append(alias);
}
buffer.append(CRYPTO_ALGORITHM_STOPPED);
if ((encoded_string != null) && (encoded_string.length() > 0)) {
// append encoded string
buffer.append(encoded_string);
}
}
return buffer.toString();
} | [
"public",
"static",
"String",
"encode_password",
"(",
"String",
"decoded_string",
",",
"String",
"crypto_algorithm",
",",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"/*\n * encoding process:\n * \n * -- check for empty algorithm tag\n * -- convert input String to byte[] UTF8 conversion code\n * -- encipher byte[]\n * -- convert byte[] to String using using base64 encoding\n */",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"CRYPTO_ALGORITHM_STARTED",
")",
";",
"if",
"(",
"crypto_algorithm",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"// crypto algorithm is empty ... don't encode password",
"buffer",
".",
"append",
"(",
"CRYPTO_ALGORITHM_STOPPED",
")",
".",
"append",
"(",
"decoded_string",
")",
";",
"}",
"else",
"{",
"// encode password with specified crypto algorithm",
"String",
"encoded_string",
"=",
"null",
";",
"EncryptedInfo",
"info",
"=",
"null",
";",
"if",
"(",
"decoded_string",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"// convert decoded password string to byte[]",
"byte",
"[",
"]",
"decrypted_bytes",
"=",
"convert_to_bytes",
"(",
"decoded_string",
")",
";",
"if",
"(",
"decrypted_bytes",
".",
"length",
">",
"0",
")",
"{",
"// encrypt decrypted password byte[] with specified crypto algorithm",
"byte",
"[",
"]",
"encrypted_bytes",
"=",
"null",
";",
"boolean",
"done",
"=",
"false",
";",
"while",
"(",
"!",
"done",
")",
"{",
"try",
"{",
"info",
"=",
"PasswordCipherUtil",
".",
"encipher_internal",
"(",
"decrypted_bytes",
",",
"crypto_algorithm",
",",
"properties",
")",
";",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"encrypted_bytes",
"=",
"info",
".",
"getEncryptedBytes",
"(",
")",
";",
"}",
"done",
"=",
"true",
";",
"}",
"catch",
"(",
"InvalidPasswordCipherException",
"e",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"PasswordUtil",
".",
"class",
".",
"getName",
"(",
")",
",",
"\"encode_password\"",
",",
"\"PASSWORDUTIL_CYPHER_EXCEPTION\"",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"catch",
"(",
"UnsupportedCryptoAlgorithmException",
"e",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"SEVERE",
",",
"PasswordUtil",
".",
"class",
".",
"getName",
"(",
")",
",",
"\"encode_password\"",
",",
"\"PASSWORDUTIL_UNKNOWN_ALGORITHM_EXCEPTION\"",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"}",
"if",
"(",
"(",
"encrypted_bytes",
"!=",
"null",
")",
"&&",
"(",
"encrypted_bytes",
".",
"length",
">",
"0",
")",
")",
"{",
"// convert encrypted password byte[] to viewable string",
"encoded_string",
"=",
"convert_viewable_to_string",
"(",
"encrypted_bytes",
")",
";",
"if",
"(",
"encoded_string",
"==",
"null",
")",
"{",
"// base64 encoding failed",
"return",
"null",
";",
"}",
"}",
"}",
"}",
"buffer",
".",
"append",
"(",
"crypto_algorithm",
")",
";",
"String",
"alias",
"=",
"(",
"null",
"==",
"info",
")",
"?",
"null",
":",
"info",
".",
"getKeyAlias",
"(",
")",
";",
"if",
"(",
"alias",
"!=",
"null",
"&&",
"0",
"<",
"alias",
".",
"length",
"(",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"alias",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"CRYPTO_ALGORITHM_STOPPED",
")",
";",
"if",
"(",
"(",
"encoded_string",
"!=",
"null",
")",
"&&",
"(",
"encoded_string",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"{",
"// append encoded string",
"buffer",
".",
"append",
"(",
"encoded_string",
")",
";",
"}",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] | Encode the provided string by using the specified encoding algorithm and properties
@param decoded_string the string to be encoded.
@param crypto_algorithm the algorithm to be used for encoding. The supported values are xor, aes, or hash.
@param properties the properties for the encryption.
@return The encoded string. null if there is any failure during encoding, or invalid or null decoded_string | [
"Encode",
"the",
"provided",
"string",
"by",
"using",
"the",
"specified",
"encoding",
"algorithm",
"and",
"properties"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java#L657-L732 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractFileClient.java | AbstractFileClient.getAsset | protected Asset getAsset(final String assetId, final boolean includeAttachments) throws FileNotFoundException, IOException, BadVersionException {
Asset ass = readJson(assetId);
ass.set_id(assetId);
// We always get a wlp info when read back from Massive so create one if there isnt already one
WlpInformation wlpInfo = ass.getWlpInformation();
if (wlpInfo == null) {
wlpInfo = new WlpInformation();
ass.setWlpInformation(wlpInfo);
}
if (wlpInfo.getAppliesToFilterInfo() == null) {
wlpInfo.setAppliesToFilterInfo(Collections.<AppliesToFilterInfo> emptyList());
}
if (includeAttachments) {
if (exists(assetId)) {
Attachment at = new Attachment();
at.set_id(assetId);
at.setLinkType(AttachmentLinkType.DIRECT);
at.setType(AttachmentType.CONTENT);
at.setName(getName(assetId));
at.setSize(getSize(assetId));
at.setUrl(at.get_id());
ass.addAttachement(at);
if (assetId.toLowerCase().endsWith(".jar") || assetId.toLowerCase().endsWith(".esa")) {
// Create attachment objects for each license
if (hasLicenses(assetId)) {
Map<String, Long> licensesMap = getLicenses(assetId);
for (Map.Entry<String, Long> e : licensesMap.entrySet()) {
String lic = e.getKey();
String name = getName(lic);
String licId = assetId.concat(String.format("#licenses" + File.separator + "%s", name));
Attachment licAt = new Attachment();
licAt.set_id(licId);
licAt.setLinkType(AttachmentLinkType.DIRECT);
licAt.setName(name);
licAt.setSize(e.getValue());
String locString = name.substring(3);
if (name.startsWith("LI")) {
licAt.setType(AttachmentType.LICENSE_INFORMATION);
} else if (name.startsWith("LA")) {
licAt.setType(AttachmentType.LICENSE_AGREEMENT);
} else if (name.endsWith(".html")) {
licAt.setType(AttachmentType.LICENSE);
locString = name.substring(0, name.lastIndexOf("."));
}
// Make sure we've found one
if (licAt.getType() != null) {
Locale locale = RepositoryCommonUtils.localeForString(locString);
licAt.setLocale(locale);
ass.addAttachement(licAt);
licAt.setUrl(licAt.get_id());
}
}
}
}
}
}
return ass;
} | java | protected Asset getAsset(final String assetId, final boolean includeAttachments) throws FileNotFoundException, IOException, BadVersionException {
Asset ass = readJson(assetId);
ass.set_id(assetId);
// We always get a wlp info when read back from Massive so create one if there isnt already one
WlpInformation wlpInfo = ass.getWlpInformation();
if (wlpInfo == null) {
wlpInfo = new WlpInformation();
ass.setWlpInformation(wlpInfo);
}
if (wlpInfo.getAppliesToFilterInfo() == null) {
wlpInfo.setAppliesToFilterInfo(Collections.<AppliesToFilterInfo> emptyList());
}
if (includeAttachments) {
if (exists(assetId)) {
Attachment at = new Attachment();
at.set_id(assetId);
at.setLinkType(AttachmentLinkType.DIRECT);
at.setType(AttachmentType.CONTENT);
at.setName(getName(assetId));
at.setSize(getSize(assetId));
at.setUrl(at.get_id());
ass.addAttachement(at);
if (assetId.toLowerCase().endsWith(".jar") || assetId.toLowerCase().endsWith(".esa")) {
// Create attachment objects for each license
if (hasLicenses(assetId)) {
Map<String, Long> licensesMap = getLicenses(assetId);
for (Map.Entry<String, Long> e : licensesMap.entrySet()) {
String lic = e.getKey();
String name = getName(lic);
String licId = assetId.concat(String.format("#licenses" + File.separator + "%s", name));
Attachment licAt = new Attachment();
licAt.set_id(licId);
licAt.setLinkType(AttachmentLinkType.DIRECT);
licAt.setName(name);
licAt.setSize(e.getValue());
String locString = name.substring(3);
if (name.startsWith("LI")) {
licAt.setType(AttachmentType.LICENSE_INFORMATION);
} else if (name.startsWith("LA")) {
licAt.setType(AttachmentType.LICENSE_AGREEMENT);
} else if (name.endsWith(".html")) {
licAt.setType(AttachmentType.LICENSE);
locString = name.substring(0, name.lastIndexOf("."));
}
// Make sure we've found one
if (licAt.getType() != null) {
Locale locale = RepositoryCommonUtils.localeForString(locString);
licAt.setLocale(locale);
ass.addAttachement(licAt);
licAt.setUrl(licAt.get_id());
}
}
}
}
}
}
return ass;
} | [
"protected",
"Asset",
"getAsset",
"(",
"final",
"String",
"assetId",
",",
"final",
"boolean",
"includeAttachments",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
",",
"BadVersionException",
"{",
"Asset",
"ass",
"=",
"readJson",
"(",
"assetId",
")",
";",
"ass",
".",
"set_id",
"(",
"assetId",
")",
";",
"// We always get a wlp info when read back from Massive so create one if there isnt already one",
"WlpInformation",
"wlpInfo",
"=",
"ass",
".",
"getWlpInformation",
"(",
")",
";",
"if",
"(",
"wlpInfo",
"==",
"null",
")",
"{",
"wlpInfo",
"=",
"new",
"WlpInformation",
"(",
")",
";",
"ass",
".",
"setWlpInformation",
"(",
"wlpInfo",
")",
";",
"}",
"if",
"(",
"wlpInfo",
".",
"getAppliesToFilterInfo",
"(",
")",
"==",
"null",
")",
"{",
"wlpInfo",
".",
"setAppliesToFilterInfo",
"(",
"Collections",
".",
"<",
"AppliesToFilterInfo",
">",
"emptyList",
"(",
")",
")",
";",
"}",
"if",
"(",
"includeAttachments",
")",
"{",
"if",
"(",
"exists",
"(",
"assetId",
")",
")",
"{",
"Attachment",
"at",
"=",
"new",
"Attachment",
"(",
")",
";",
"at",
".",
"set_id",
"(",
"assetId",
")",
";",
"at",
".",
"setLinkType",
"(",
"AttachmentLinkType",
".",
"DIRECT",
")",
";",
"at",
".",
"setType",
"(",
"AttachmentType",
".",
"CONTENT",
")",
";",
"at",
".",
"setName",
"(",
"getName",
"(",
"assetId",
")",
")",
";",
"at",
".",
"setSize",
"(",
"getSize",
"(",
"assetId",
")",
")",
";",
"at",
".",
"setUrl",
"(",
"at",
".",
"get_id",
"(",
")",
")",
";",
"ass",
".",
"addAttachement",
"(",
"at",
")",
";",
"if",
"(",
"assetId",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"\".jar\"",
")",
"||",
"assetId",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"\".esa\"",
")",
")",
"{",
"// Create attachment objects for each license",
"if",
"(",
"hasLicenses",
"(",
"assetId",
")",
")",
"{",
"Map",
"<",
"String",
",",
"Long",
">",
"licensesMap",
"=",
"getLicenses",
"(",
"assetId",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Long",
">",
"e",
":",
"licensesMap",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"lic",
"=",
"e",
".",
"getKey",
"(",
")",
";",
"String",
"name",
"=",
"getName",
"(",
"lic",
")",
";",
"String",
"licId",
"=",
"assetId",
".",
"concat",
"(",
"String",
".",
"format",
"(",
"\"#licenses\"",
"+",
"File",
".",
"separator",
"+",
"\"%s\"",
",",
"name",
")",
")",
";",
"Attachment",
"licAt",
"=",
"new",
"Attachment",
"(",
")",
";",
"licAt",
".",
"set_id",
"(",
"licId",
")",
";",
"licAt",
".",
"setLinkType",
"(",
"AttachmentLinkType",
".",
"DIRECT",
")",
";",
"licAt",
".",
"setName",
"(",
"name",
")",
";",
"licAt",
".",
"setSize",
"(",
"e",
".",
"getValue",
"(",
")",
")",
";",
"String",
"locString",
"=",
"name",
".",
"substring",
"(",
"3",
")",
";",
"if",
"(",
"name",
".",
"startsWith",
"(",
"\"LI\"",
")",
")",
"{",
"licAt",
".",
"setType",
"(",
"AttachmentType",
".",
"LICENSE_INFORMATION",
")",
";",
"}",
"else",
"if",
"(",
"name",
".",
"startsWith",
"(",
"\"LA\"",
")",
")",
"{",
"licAt",
".",
"setType",
"(",
"AttachmentType",
".",
"LICENSE_AGREEMENT",
")",
";",
"}",
"else",
"if",
"(",
"name",
".",
"endsWith",
"(",
"\".html\"",
")",
")",
"{",
"licAt",
".",
"setType",
"(",
"AttachmentType",
".",
"LICENSE",
")",
";",
"locString",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"name",
".",
"lastIndexOf",
"(",
"\".\"",
")",
")",
";",
"}",
"// Make sure we've found one",
"if",
"(",
"licAt",
".",
"getType",
"(",
")",
"!=",
"null",
")",
"{",
"Locale",
"locale",
"=",
"RepositoryCommonUtils",
".",
"localeForString",
"(",
"locString",
")",
";",
"licAt",
".",
"setLocale",
"(",
"locale",
")",
";",
"ass",
".",
"addAttachement",
"(",
"licAt",
")",
";",
"licAt",
".",
"setUrl",
"(",
"licAt",
".",
"get_id",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"return",
"ass",
";",
"}"
] | Gets the specified asset
@param assetId The asset id to get
@param includeAttachments Flag to specify if the attachments should be read as well.
@return
@throws FileNotFoundException
@throws IOException
@throws BadVersionException | [
"Gets",
"the",
"specified",
"asset"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractFileClient.java#L108-L169 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractFileClient.java | AbstractFileClient.getName | protected String getName(final String relative) {
return relative.substring(relative.lastIndexOf(File.separator) + 1);
} | java | protected String getName(final String relative) {
return relative.substring(relative.lastIndexOf(File.separator) + 1);
} | [
"protected",
"String",
"getName",
"(",
"final",
"String",
"relative",
")",
"{",
"return",
"relative",
".",
"substring",
"(",
"relative",
".",
"lastIndexOf",
"(",
"File",
".",
"separator",
")",
"+",
"1",
")",
";",
"}"
] | Gets the name from the relative path of the asset
@param relative
@return | [
"Gets",
"the",
"name",
"from",
"the",
"relative",
"path",
"of",
"the",
"asset"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractFileClient.java#L214-L216 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractFileClient.java | AbstractFileClient.getInputStreamToLicenseInsideZip | protected InputStream getInputStreamToLicenseInsideZip(final ZipInputStream zis, final String assetId, final String attachmentId) throws IOException {
InputStream is = null;
try {
ZipEntry ze = zis.getNextEntry();
while (ze != null) {
if (ze.isDirectory()) {
//do nothing
} else {
String name = getName(ze.getName().replace("/", File.separator));
String licId = assetId.concat(String.format("#licenses" + File.separator + "%s", name));
if (licId.equals(attachmentId)) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int read;
int total = 0;
while ((read = zis.read(buffer)) != -1) {
baos.write(buffer, 0, read);
total += read;
}
//ZipEntry sometimes returns -1 when unable to get original size, in this case we want to proceed
if (ze.getSize() != -1 && total != ze.getSize()) {
throw new IOException("The size of the retrieved license was wrong. Expected : " + ze.getSize()
+ " bytes, but actually was " + total + " bytes.");
}
byte[] content = baos.toByteArray();
is = new ByteArrayInputStream(content);
}
}
ze = zis.getNextEntry();
}
} finally {
zis.closeEntry();
zis.close();
}
return is;
} | java | protected InputStream getInputStreamToLicenseInsideZip(final ZipInputStream zis, final String assetId, final String attachmentId) throws IOException {
InputStream is = null;
try {
ZipEntry ze = zis.getNextEntry();
while (ze != null) {
if (ze.isDirectory()) {
//do nothing
} else {
String name = getName(ze.getName().replace("/", File.separator));
String licId = assetId.concat(String.format("#licenses" + File.separator + "%s", name));
if (licId.equals(attachmentId)) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int read;
int total = 0;
while ((read = zis.read(buffer)) != -1) {
baos.write(buffer, 0, read);
total += read;
}
//ZipEntry sometimes returns -1 when unable to get original size, in this case we want to proceed
if (ze.getSize() != -1 && total != ze.getSize()) {
throw new IOException("The size of the retrieved license was wrong. Expected : " + ze.getSize()
+ " bytes, but actually was " + total + " bytes.");
}
byte[] content = baos.toByteArray();
is = new ByteArrayInputStream(content);
}
}
ze = zis.getNextEntry();
}
} finally {
zis.closeEntry();
zis.close();
}
return is;
} | [
"protected",
"InputStream",
"getInputStreamToLicenseInsideZip",
"(",
"final",
"ZipInputStream",
"zis",
",",
"final",
"String",
"assetId",
",",
"final",
"String",
"attachmentId",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"ZipEntry",
"ze",
"=",
"zis",
".",
"getNextEntry",
"(",
")",
";",
"while",
"(",
"ze",
"!=",
"null",
")",
"{",
"if",
"(",
"ze",
".",
"isDirectory",
"(",
")",
")",
"{",
"//do nothing",
"}",
"else",
"{",
"String",
"name",
"=",
"getName",
"(",
"ze",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"\"/\"",
",",
"File",
".",
"separator",
")",
")",
";",
"String",
"licId",
"=",
"assetId",
".",
"concat",
"(",
"String",
".",
"format",
"(",
"\"#licenses\"",
"+",
"File",
".",
"separator",
"+",
"\"%s\"",
",",
"name",
")",
")",
";",
"if",
"(",
"licId",
".",
"equals",
"(",
"attachmentId",
")",
")",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"1024",
"]",
";",
"int",
"read",
";",
"int",
"total",
"=",
"0",
";",
"while",
"(",
"(",
"read",
"=",
"zis",
".",
"read",
"(",
"buffer",
")",
")",
"!=",
"-",
"1",
")",
"{",
"baos",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"read",
")",
";",
"total",
"+=",
"read",
";",
"}",
"//ZipEntry sometimes returns -1 when unable to get original size, in this case we want to proceed",
"if",
"(",
"ze",
".",
"getSize",
"(",
")",
"!=",
"-",
"1",
"&&",
"total",
"!=",
"ze",
".",
"getSize",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"The size of the retrieved license was wrong. Expected : \"",
"+",
"ze",
".",
"getSize",
"(",
")",
"+",
"\" bytes, but actually was \"",
"+",
"total",
"+",
"\" bytes.\"",
")",
";",
"}",
"byte",
"[",
"]",
"content",
"=",
"baos",
".",
"toByteArray",
"(",
")",
";",
"is",
"=",
"new",
"ByteArrayInputStream",
"(",
"content",
")",
";",
"}",
"}",
"ze",
"=",
"zis",
".",
"getNextEntry",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"zis",
".",
"closeEntry",
"(",
")",
";",
"zis",
".",
"close",
"(",
")",
";",
"}",
"return",
"is",
";",
"}"
] | Given a ZipInputStream to an asset within the repo get an input stream to the license attachment within the
asset.
@param zis ZipInputStream to the container for the asset (i.e. ZipInputStream to an ESA file inside a repo).
@param assetId The id of the asset
@param attachmentId The id of the license to get an input stream to.
@return
@throws IOException | [
"Given",
"a",
"ZipInputStream",
"to",
"an",
"asset",
"within",
"the",
"repo",
"get",
"an",
"input",
"stream",
"to",
"the",
"license",
"attachment",
"within",
"the",
"asset",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractFileClient.java#L232-L270 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.reset | void reset(
Object key)
{
_nodeKey[0] = key;
_nodeKey[midPoint()] = key;
_population = 1;
_rightChild = null;
_leftChild = null;
_balance = 0;
} | java | void reset(
Object key)
{
_nodeKey[0] = key;
_nodeKey[midPoint()] = key;
_population = 1;
_rightChild = null;
_leftChild = null;
_balance = 0;
} | [
"void",
"reset",
"(",
"Object",
"key",
")",
"{",
"_nodeKey",
"[",
"0",
"]",
"=",
"key",
";",
"_nodeKey",
"[",
"midPoint",
"(",
")",
"]",
"=",
"key",
";",
"_population",
"=",
"1",
";",
"_rightChild",
"=",
"null",
";",
"_leftChild",
"=",
"null",
";",
"_balance",
"=",
"0",
";",
"}"
] | Return the node to its post-construction state.
@param key The key that would have been passed in to the constructor
for the newly allocated node. | [
"Return",
"the",
"node",
"to",
"its",
"post",
"-",
"construction",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L67-L76 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.hasChild | boolean hasChild()
{
boolean has = false;
if ( (leftChild() != null) || (rightChild() != null) )
has = true;
return has;
} | java | boolean hasChild()
{
boolean has = false;
if ( (leftChild() != null) || (rightChild() != null) )
has = true;
return has;
} | [
"boolean",
"hasChild",
"(",
")",
"{",
"boolean",
"has",
"=",
"false",
";",
"if",
"(",
"(",
"leftChild",
"(",
")",
"!=",
"null",
")",
"||",
"(",
"rightChild",
"(",
")",
"!=",
"null",
")",
")",
"has",
"=",
"true",
";",
"return",
"has",
";",
"}"
] | Return true if the node has either a right child or a left child. | [
"Return",
"true",
"if",
"the",
"node",
"has",
"either",
"a",
"right",
"child",
"or",
"a",
"left",
"child",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L171-L177 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.balance | public short balance()
{
if ( (_balance == -1) || (_balance == 0) || (_balance == 1) )
return _balance;
else
{
String x = "Found invalid balance factor: " + _balance;
throw new RuntimeException(x);
}
} | java | public short balance()
{
if ( (_balance == -1) || (_balance == 0) || (_balance == 1) )
return _balance;
else
{
String x = "Found invalid balance factor: " + _balance;
throw new RuntimeException(x);
}
} | [
"public",
"short",
"balance",
"(",
")",
"{",
"if",
"(",
"(",
"_balance",
"==",
"-",
"1",
")",
"||",
"(",
"_balance",
"==",
"0",
")",
"||",
"(",
"_balance",
"==",
"1",
")",
")",
"return",
"_balance",
";",
"else",
"{",
"String",
"x",
"=",
"\"Found invalid balance factor: \"",
"+",
"_balance",
";",
"throw",
"new",
"RuntimeException",
"(",
"x",
")",
";",
"}",
"}"
] | Return the balance factor for the node. | [
"Return",
"the",
"balance",
"factor",
"for",
"the",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L193-L202 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.setBalance | void setBalance(
int b)
{
if ( (b == -1) || (b == 0) || (b == 1) )
_balance = (short) b;
else
{
String x = "Attempt to set invalid balance factor: " + b;
throw new IllegalArgumentException(x);
}
} | java | void setBalance(
int b)
{
if ( (b == -1) || (b == 0) || (b == 1) )
_balance = (short) b;
else
{
String x = "Attempt to set invalid balance factor: " + b;
throw new IllegalArgumentException(x);
}
} | [
"void",
"setBalance",
"(",
"int",
"b",
")",
"{",
"if",
"(",
"(",
"b",
"==",
"-",
"1",
")",
"||",
"(",
"b",
"==",
"0",
")",
"||",
"(",
"b",
"==",
"1",
")",
")",
"_balance",
"=",
"(",
"short",
")",
"b",
";",
"else",
"{",
"String",
"x",
"=",
"\"Attempt to set invalid balance factor: \"",
"+",
"b",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"x",
")",
";",
"}",
"}"
] | Set the node's balance factor to a new value.
@param b The value to set, which must be 0, -1, or +1. | [
"Set",
"the",
"node",
"s",
"balance",
"factor",
"to",
"a",
"new",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L215-L225 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.isLeafNode | public boolean isLeafNode()
{
boolean leaf = false;
if ( (_leftChild == null) &&
(_rightChild == null) )
leaf = true;
return leaf;
} | java | public boolean isLeafNode()
{
boolean leaf = false;
if ( (_leftChild == null) &&
(_rightChild == null) )
leaf = true;
return leaf;
} | [
"public",
"boolean",
"isLeafNode",
"(",
")",
"{",
"boolean",
"leaf",
"=",
"false",
";",
"if",
"(",
"(",
"_leftChild",
"==",
"null",
")",
"&&",
"(",
"_rightChild",
"==",
"null",
")",
")",
"leaf",
"=",
"true",
";",
"return",
"leaf",
";",
"}"
] | Return true if the node is a leaf node. | [
"Return",
"true",
"if",
"the",
"node",
"is",
"a",
"leaf",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L273-L280 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.findInsertPointInLeft | void findInsertPointInLeft(
Object new1,
NodeInsertPoint point)
{
int endp = endPoint();
findIndex(0, endp, new1, point);
} | java | void findInsertPointInLeft(
Object new1,
NodeInsertPoint point)
{
int endp = endPoint();
findIndex(0, endp, new1, point);
} | [
"void",
"findInsertPointInLeft",
"(",
"Object",
"new1",
",",
"NodeInsertPoint",
"point",
")",
"{",
"int",
"endp",
"=",
"endPoint",
"(",
")",
";",
"findIndex",
"(",
"0",
",",
"endp",
",",
"new1",
",",
"point",
")",
";",
"}"
] | Find the insert point in the left half of the node for a new key.
@param new1 New Object to be inserted
@param point Found insertion point | [
"Find",
"the",
"insert",
"point",
"in",
"the",
"left",
"half",
"of",
"the",
"node",
"for",
"a",
"new",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L336-L342 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.searchLeft | public int searchLeft(
SearchComparator comp,
Object searchKey)
{
int idx = -1;
int top = middleIndex();
if (comp.type() == SearchComparator.EQ)
idx = findEqual(comp, 0, top, searchKey);
else
idx = findGreater(comp, 0, top, searchKey);
return idx;
} | java | public int searchLeft(
SearchComparator comp,
Object searchKey)
{
int idx = -1;
int top = middleIndex();
if (comp.type() == SearchComparator.EQ)
idx = findEqual(comp, 0, top, searchKey);
else
idx = findGreater(comp, 0, top, searchKey);
return idx;
} | [
"public",
"int",
"searchLeft",
"(",
"SearchComparator",
"comp",
",",
"Object",
"searchKey",
")",
"{",
"int",
"idx",
"=",
"-",
"1",
";",
"int",
"top",
"=",
"middleIndex",
"(",
")",
";",
"if",
"(",
"comp",
".",
"type",
"(",
")",
"==",
"SearchComparator",
".",
"EQ",
")",
"idx",
"=",
"findEqual",
"(",
"comp",
",",
"0",
",",
"top",
",",
"searchKey",
")",
";",
"else",
"idx",
"=",
"findGreater",
"(",
"comp",
",",
"0",
",",
"top",
",",
"searchKey",
")",
";",
"return",
"idx",
";",
"}"
] | Search the left half of the node.
<p>Look in the left half of the node to find an index entry that is
one of
<ol>
<li>an exact match for the supplied key,
<li>greater than the supplied key, or
<li>greater than or equal to the supplied key.
</ol>
The type of the supplied SearchComparator indicate which of the
above three conditions apply</p>.
@param comp The SearchComparator to use for the key comparisons.
@param searchKey The key to find.
@return Index of key within node. -1 if key does not exist. | [
"Search",
"the",
"left",
"half",
"of",
"the",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L424-L436 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.searchRight | public int searchRight(
SearchComparator comp,
Object searchKey)
{
int idx = -1;
int bot = middleIndex();
int right = rightMostIndex();
if (bot > right)
{
String x =
"bot = " + bot + ", right = " + right;
throw new OptimisticDepthException(x);
}
if (comp.type() == SearchComparator.EQ)
idx = findEqual(comp, bot, right, searchKey);
else
idx = findGreater(comp, bot, right, searchKey);
return idx;
} | java | public int searchRight(
SearchComparator comp,
Object searchKey)
{
int idx = -1;
int bot = middleIndex();
int right = rightMostIndex();
if (bot > right)
{
String x =
"bot = " + bot + ", right = " + right;
throw new OptimisticDepthException(x);
}
if (comp.type() == SearchComparator.EQ)
idx = findEqual(comp, bot, right, searchKey);
else
idx = findGreater(comp, bot, right, searchKey);
return idx;
} | [
"public",
"int",
"searchRight",
"(",
"SearchComparator",
"comp",
",",
"Object",
"searchKey",
")",
"{",
"int",
"idx",
"=",
"-",
"1",
";",
"int",
"bot",
"=",
"middleIndex",
"(",
")",
";",
"int",
"right",
"=",
"rightMostIndex",
"(",
")",
";",
"if",
"(",
"bot",
">",
"right",
")",
"{",
"String",
"x",
"=",
"\"bot = \"",
"+",
"bot",
"+",
"\", right = \"",
"+",
"right",
";",
"throw",
"new",
"OptimisticDepthException",
"(",
"x",
")",
";",
"}",
"if",
"(",
"comp",
".",
"type",
"(",
")",
"==",
"SearchComparator",
".",
"EQ",
")",
"idx",
"=",
"findEqual",
"(",
"comp",
",",
"bot",
",",
"right",
",",
"searchKey",
")",
";",
"else",
"idx",
"=",
"findGreater",
"(",
"comp",
",",
"bot",
",",
"right",
",",
"searchKey",
")",
";",
"return",
"idx",
";",
"}"
] | Search the right half of the node.
<p>Look in the right half of the node to find an index entry that is
one of
<ol>
<li>an exact match for the supplied key,
<li>greater than the supplied key, or
<li>greater than or equal to the supplied key.
</ol>
The type of the supplied SearchComparator indicate which of the
above three conditions apply</p>.
@param comp The SearchComparator to use for the key comparisons.
@param searchKey The key to find.
@return Index of key within node. -1 if key does not exist. | [
"Search",
"the",
"right",
"half",
"of",
"the",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L456-L475 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.searchAll | int searchAll(
SearchComparator comp,
Object searchKey)
{
int idx = -1;
if (comp.type() == SearchComparator.EQ)
idx = findEqual(comp, 0, rightMostIndex(), searchKey);
else
idx = findGreater(comp, 0, rightMostIndex(), searchKey);
return idx;
} | java | int searchAll(
SearchComparator comp,
Object searchKey)
{
int idx = -1;
if (comp.type() == SearchComparator.EQ)
idx = findEqual(comp, 0, rightMostIndex(), searchKey);
else
idx = findGreater(comp, 0, rightMostIndex(), searchKey);
return idx;
} | [
"int",
"searchAll",
"(",
"SearchComparator",
"comp",
",",
"Object",
"searchKey",
")",
"{",
"int",
"idx",
"=",
"-",
"1",
";",
"if",
"(",
"comp",
".",
"type",
"(",
")",
"==",
"SearchComparator",
".",
"EQ",
")",
"idx",
"=",
"findEqual",
"(",
"comp",
",",
"0",
",",
"rightMostIndex",
"(",
")",
",",
"searchKey",
")",
";",
"else",
"idx",
"=",
"findGreater",
"(",
"comp",
",",
"0",
",",
"rightMostIndex",
"(",
")",
",",
"searchKey",
")",
";",
"return",
"idx",
";",
"}"
] | Search the whole node.
<p>Look in the whole node to find an index entry that is one of</p>
<ol>
<li>an exact match for the supplied key,
<li>greater than the supplied key, or
<li>greater than or equal to the supplied key.
</ol>
<p>The type of the supplied SearchComparator indicate which of the
above three conditions apply</p>.
@param comp The SearchComparator to use for the key comparisons.
@param searchKey The key to find.
@return Index of key within node. -1 if key does not exist. | [
"Search",
"the",
"whole",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L494-L505 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.findEqual | private int findEqual(
SearchComparator comp,
int lower,
int upper,
Object searchKey)
{
int nkeys = numKeys(lower, upper);
int idx = -1;
if (nkeys < 4)
idx = sequentialSearchEqual(comp, lower, upper, searchKey);
else
idx = binarySearchEqual(comp, lower, upper, searchKey);
return idx;
} | java | private int findEqual(
SearchComparator comp,
int lower,
int upper,
Object searchKey)
{
int nkeys = numKeys(lower, upper);
int idx = -1;
if (nkeys < 4)
idx = sequentialSearchEqual(comp, lower, upper, searchKey);
else
idx = binarySearchEqual(comp, lower, upper, searchKey);
return idx;
} | [
"private",
"int",
"findEqual",
"(",
"SearchComparator",
"comp",
",",
"int",
"lower",
",",
"int",
"upper",
",",
"Object",
"searchKey",
")",
"{",
"int",
"nkeys",
"=",
"numKeys",
"(",
"lower",
",",
"upper",
")",
";",
"int",
"idx",
"=",
"-",
"1",
";",
"if",
"(",
"nkeys",
"<",
"4",
")",
"idx",
"=",
"sequentialSearchEqual",
"(",
"comp",
",",
"lower",
",",
"upper",
",",
"searchKey",
")",
";",
"else",
"idx",
"=",
"binarySearchEqual",
"(",
"comp",
",",
"lower",
",",
"upper",
",",
"searchKey",
")",
";",
"return",
"idx",
";",
"}"
] | Find an index entry that is equal to the supplied key.
@param searchKey The key to find.
@return Index of key within node. -1 if key does not exist. | [
"Find",
"an",
"index",
"entry",
"that",
"is",
"equal",
"to",
"the",
"supplied",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L514-L527 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.sequentialSearchEqual | private int sequentialSearchEqual(
SearchComparator comp,
int lower,
int upper,
Object searchKey)
{
int xcc; /* Current compare result */
int idx = -1; /* The returned index (-1 if not found) */
for (int i = lower; i <= upper; i++)
{
xcc = comp.compare(searchKey, _nodeKey[i]);
if (xcc == 0) /* Found a match */
{
idx = i; /* Remember current point */
break;
}
}
return idx;
} | java | private int sequentialSearchEqual(
SearchComparator comp,
int lower,
int upper,
Object searchKey)
{
int xcc; /* Current compare result */
int idx = -1; /* The returned index (-1 if not found) */
for (int i = lower; i <= upper; i++)
{
xcc = comp.compare(searchKey, _nodeKey[i]);
if (xcc == 0) /* Found a match */
{
idx = i; /* Remember current point */
break;
}
}
return idx;
} | [
"private",
"int",
"sequentialSearchEqual",
"(",
"SearchComparator",
"comp",
",",
"int",
"lower",
",",
"int",
"upper",
",",
"Object",
"searchKey",
")",
"{",
"int",
"xcc",
";",
"/* Current compare result */",
"int",
"idx",
"=",
"-",
"1",
";",
"/* The returned index (-1 if not found) */",
"for",
"(",
"int",
"i",
"=",
"lower",
";",
"i",
"<=",
"upper",
";",
"i",
"++",
")",
"{",
"xcc",
"=",
"comp",
".",
"compare",
"(",
"searchKey",
",",
"_nodeKey",
"[",
"i",
"]",
")",
";",
"if",
"(",
"xcc",
"==",
"0",
")",
"/* Found a match */",
"{",
"idx",
"=",
"i",
";",
"/* Remember current point */",
"break",
";",
"}",
"}",
"return",
"idx",
";",
"}"
] | Use sequential search to find a matched key. | [
"Use",
"sequential",
"search",
"to",
"find",
"a",
"matched",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L532-L550 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.findGreater | private int findGreater(
SearchComparator comp,
int lower,
int upper,
Object searchKey)
{
int nkeys = numKeys(lower, upper);
int idx = -1;
if (nkeys < 4)
idx = sequentialSearchGreater(comp, lower, upper, searchKey);
else
idx = binarySearchGreater(comp, lower, upper, searchKey);
return idx;
} | java | private int findGreater(
SearchComparator comp,
int lower,
int upper,
Object searchKey)
{
int nkeys = numKeys(lower, upper);
int idx = -1;
if (nkeys < 4)
idx = sequentialSearchGreater(comp, lower, upper, searchKey);
else
idx = binarySearchGreater(comp, lower, upper, searchKey);
return idx;
} | [
"private",
"int",
"findGreater",
"(",
"SearchComparator",
"comp",
",",
"int",
"lower",
",",
"int",
"upper",
",",
"Object",
"searchKey",
")",
"{",
"int",
"nkeys",
"=",
"numKeys",
"(",
"lower",
",",
"upper",
")",
";",
"int",
"idx",
"=",
"-",
"1",
";",
"if",
"(",
"nkeys",
"<",
"4",
")",
"idx",
"=",
"sequentialSearchGreater",
"(",
"comp",
",",
"lower",
",",
"upper",
",",
"searchKey",
")",
";",
"else",
"idx",
"=",
"binarySearchGreater",
"(",
"comp",
",",
"lower",
",",
"upper",
",",
"searchKey",
")",
";",
"return",
"idx",
";",
"}"
] | Find an index entry that is either greater than or greater
than or equal to the supplied key.
@param searchKey The key to find.
@return Index of key within node. -1 if key does not exist. | [
"Find",
"an",
"index",
"entry",
"that",
"is",
"either",
"greater",
"than",
"or",
"greater",
"than",
"or",
"equal",
"to",
"the",
"supplied",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L592-L605 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.findIndex | private void findIndex(
int lower,
int upper,
Object new1,
NodeInsertPoint point)
{
int nkeys = numKeys(lower, upper);
if (nkeys < 4)
sequentialFindIndex(lower, upper, new1, point);
else
binaryFindIndex(lower, upper, new1, point);
} | java | private void findIndex(
int lower,
int upper,
Object new1,
NodeInsertPoint point)
{
int nkeys = numKeys(lower, upper);
if (nkeys < 4)
sequentialFindIndex(lower, upper, new1, point);
else
binaryFindIndex(lower, upper, new1, point);
} | [
"private",
"void",
"findIndex",
"(",
"int",
"lower",
",",
"int",
"upper",
",",
"Object",
"new1",
",",
"NodeInsertPoint",
"point",
")",
"{",
"int",
"nkeys",
"=",
"numKeys",
"(",
"lower",
",",
"upper",
")",
";",
"if",
"(",
"nkeys",
"<",
"4",
")",
"sequentialFindIndex",
"(",
"lower",
",",
"upper",
",",
"new1",
",",
"point",
")",
";",
"else",
"binaryFindIndex",
"(",
"lower",
",",
"upper",
",",
"new1",
",",
"point",
")",
";",
"}"
] | Find the insert point for a new key.
<p>Find the insert point for a new key. This method finds the point
AFTER which the new key should be inserted. The key does not
need to be bounded by the node value and duplicates are allowed.
If the new key is less than the lowest value already in the node,
-1 is returned as the insert point.</p>
<p>If the node is full, the PRE-insert point returned may be the
right-most slot in the node. In that case, the new key REPLACES
the maximum value in the node.</p>
@param lower Lower bound for search
@param upper Upper bound for search
@param new1 New Object to be inserted
@param point Found insertion point | [
"Find",
"the",
"insert",
"point",
"for",
"a",
"new",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L681-L692 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.binaryFindIndex | private void binaryFindIndex(
int lower,
int upper,
Object new1,
NodeInsertPoint point)
{
java.util.Comparator comp = insertComparator();
int xcc; /* Current compare result */
int lxcc = +1; /* Remembered compare result */
int i;
int idx = upper + 1; /* Found index plus one */
while (lower <= upper) /* Until they cross */
{
i = (lower + upper) >>> 1; /* Mid-point of current range */
xcc = comp.compare(new1, _nodeKey[i]);
if ( !(xcc > 0) ) /* SEARCH_KEY <= NODE_KEY */
{
upper = i - 1; /* Discard upper half of range */
idx = i; /* Remember last upper bound */
lxcc = xcc; /* Remember last upper compare result */
}
else /* SEARCH_KEY >= NODE_KEY */
lower = i + 1; /* Discard lower half of range */
}
if (lxcc != 0) /* Never had an equal compare */
point.setInsertPoint(idx-1); /* Desired point is previous one */
else /* Had an equal compare */
point.markDuplicate(idx); /* Key is a duplicate at point "idx" */
} | java | private void binaryFindIndex(
int lower,
int upper,
Object new1,
NodeInsertPoint point)
{
java.util.Comparator comp = insertComparator();
int xcc; /* Current compare result */
int lxcc = +1; /* Remembered compare result */
int i;
int idx = upper + 1; /* Found index plus one */
while (lower <= upper) /* Until they cross */
{
i = (lower + upper) >>> 1; /* Mid-point of current range */
xcc = comp.compare(new1, _nodeKey[i]);
if ( !(xcc > 0) ) /* SEARCH_KEY <= NODE_KEY */
{
upper = i - 1; /* Discard upper half of range */
idx = i; /* Remember last upper bound */
lxcc = xcc; /* Remember last upper compare result */
}
else /* SEARCH_KEY >= NODE_KEY */
lower = i + 1; /* Discard lower half of range */
}
if (lxcc != 0) /* Never had an equal compare */
point.setInsertPoint(idx-1); /* Desired point is previous one */
else /* Had an equal compare */
point.markDuplicate(idx); /* Key is a duplicate at point "idx" */
} | [
"private",
"void",
"binaryFindIndex",
"(",
"int",
"lower",
",",
"int",
"upper",
",",
"Object",
"new1",
",",
"NodeInsertPoint",
"point",
")",
"{",
"java",
".",
"util",
".",
"Comparator",
"comp",
"=",
"insertComparator",
"(",
")",
";",
"int",
"xcc",
";",
"/* Current compare result */",
"int",
"lxcc",
"=",
"+",
"1",
";",
"/* Remembered compare result */",
"int",
"i",
";",
"int",
"idx",
"=",
"upper",
"+",
"1",
";",
"/* Found index plus one */",
"while",
"(",
"lower",
"<=",
"upper",
")",
"/* Until they cross */",
"{",
"i",
"=",
"(",
"lower",
"+",
"upper",
")",
">>>",
"1",
";",
"/* Mid-point of current range */",
"xcc",
"=",
"comp",
".",
"compare",
"(",
"new1",
",",
"_nodeKey",
"[",
"i",
"]",
")",
";",
"if",
"(",
"!",
"(",
"xcc",
">",
"0",
")",
")",
"/* SEARCH_KEY <= NODE_KEY */",
"{",
"upper",
"=",
"i",
"-",
"1",
";",
"/* Discard upper half of range */",
"idx",
"=",
"i",
";",
"/* Remember last upper bound */",
"lxcc",
"=",
"xcc",
";",
"/* Remember last upper compare result */",
"}",
"else",
"/* SEARCH_KEY >= NODE_KEY */",
"lower",
"=",
"i",
"+",
"1",
";",
"/* Discard lower half of range */",
"}",
"if",
"(",
"lxcc",
"!=",
"0",
")",
"/* Never had an equal compare */",
"point",
".",
"setInsertPoint",
"(",
"idx",
"-",
"1",
")",
";",
"/* Desired point is previous one */",
"else",
"/* Had an equal compare */",
"point",
".",
"markDuplicate",
"(",
"idx",
")",
";",
"/* Key is a duplicate at point \"idx\" */",
"}"
] | Use binary search to find the insert point. | [
"Use",
"binary",
"search",
"to",
"find",
"the",
"insert",
"point",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L726-L754 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.findDeleteInRight | int findDeleteInRight(
Object delKey)
{
int idx = -1;
int r = rightMostIndex();
int m = midPoint();
if (r > m)
idx = findDelete(m, r, delKey);
return idx;
} | java | int findDeleteInRight(
Object delKey)
{
int idx = -1;
int r = rightMostIndex();
int m = midPoint();
if (r > m)
idx = findDelete(m, r, delKey);
return idx;
} | [
"int",
"findDeleteInRight",
"(",
"Object",
"delKey",
")",
"{",
"int",
"idx",
"=",
"-",
"1",
";",
"int",
"r",
"=",
"rightMostIndex",
"(",
")",
";",
"int",
"m",
"=",
"midPoint",
"(",
")",
";",
"if",
"(",
"r",
">",
"m",
")",
"idx",
"=",
"findDelete",
"(",
"m",
",",
"r",
",",
"delKey",
")",
";",
"return",
"idx",
";",
"}"
] | Find the delete key in the right half of the node.
<p>The key to be found is known to be greater than the key
at the mid point. If the key at the mid point is the last
key in the node then the delete key is not here.</p> | [
"Find",
"the",
"delete",
"key",
"in",
"the",
"right",
"half",
"of",
"the",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L763-L772 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.findDelete | int findDelete(
int lower,
int upper,
Object delKey)
{
int nkeys = numKeys(lower, upper);
int idx = -1;
if (nkeys < 4)
idx = sequentialFindDelete(lower, upper, delKey);
else
idx = binaryFindDelete(lower, upper, delKey);
return idx;
} | java | int findDelete(
int lower,
int upper,
Object delKey)
{
int nkeys = numKeys(lower, upper);
int idx = -1;
if (nkeys < 4)
idx = sequentialFindDelete(lower, upper, delKey);
else
idx = binaryFindDelete(lower, upper, delKey);
return idx;
} | [
"int",
"findDelete",
"(",
"int",
"lower",
",",
"int",
"upper",
",",
"Object",
"delKey",
")",
"{",
"int",
"nkeys",
"=",
"numKeys",
"(",
"lower",
",",
"upper",
")",
";",
"int",
"idx",
"=",
"-",
"1",
";",
"if",
"(",
"nkeys",
"<",
"4",
")",
"idx",
"=",
"sequentialFindDelete",
"(",
"lower",
",",
"upper",
",",
"delKey",
")",
";",
"else",
"idx",
"=",
"binaryFindDelete",
"(",
"lower",
",",
"upper",
",",
"delKey",
")",
";",
"return",
"idx",
";",
"}"
] | Find the index of the key to delete.
@param delKey The key to delete.
@return Index of key within node. -1 if key does not exist. | [
"Find",
"the",
"index",
"of",
"the",
"key",
"to",
"delete",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L791-L803 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.sequentialFindDelete | private int sequentialFindDelete(
int lower,
int upper,
Object delKey)
{
java.util.Comparator comp = deleteComparator();
int xcc; /* Current compare result */
int idx = -1; /* The returned index (-1 if not found) */
for (int i = lower; i <= upper; i++)
{
xcc = comp.compare(delKey, _nodeKey[i]);
if (xcc == 0) /* Found a match */
{
idx = i; /* Remember current point */
break;
}
}
return idx;
} | java | private int sequentialFindDelete(
int lower,
int upper,
Object delKey)
{
java.util.Comparator comp = deleteComparator();
int xcc; /* Current compare result */
int idx = -1; /* The returned index (-1 if not found) */
for (int i = lower; i <= upper; i++)
{
xcc = comp.compare(delKey, _nodeKey[i]);
if (xcc == 0) /* Found a match */
{
idx = i; /* Remember current point */
break;
}
}
return idx;
} | [
"private",
"int",
"sequentialFindDelete",
"(",
"int",
"lower",
",",
"int",
"upper",
",",
"Object",
"delKey",
")",
"{",
"java",
".",
"util",
".",
"Comparator",
"comp",
"=",
"deleteComparator",
"(",
")",
";",
"int",
"xcc",
";",
"/* Current compare result */",
"int",
"idx",
"=",
"-",
"1",
";",
"/* The returned index (-1 if not found) */",
"for",
"(",
"int",
"i",
"=",
"lower",
";",
"i",
"<=",
"upper",
";",
"i",
"++",
")",
"{",
"xcc",
"=",
"comp",
".",
"compare",
"(",
"delKey",
",",
"_nodeKey",
"[",
"i",
"]",
")",
";",
"if",
"(",
"xcc",
"==",
"0",
")",
"/* Found a match */",
"{",
"idx",
"=",
"i",
";",
"/* Remember current point */",
"break",
";",
"}",
"}",
"return",
"idx",
";",
"}"
] | Use sequential search to find the delete key. | [
"Use",
"sequential",
"search",
"to",
"find",
"the",
"delete",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L808-L826 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.binaryFindDelete | private int binaryFindDelete(
int lower,
int upper,
Object delKey)
{
java.util.Comparator comp = insertComparator();
int xcc; /* Current compare result */
int i;
int idx = -1; /* Returned index (-1 if not found) */
while (lower <= upper) /* Until they cross */
{
i = (lower + upper) >>> 1; /* Mid-point of current range */
xcc = comp.compare(delKey, _nodeKey[i]);
if (xcc < 0) /* SEARCH_KEY < NODE_KEY */
upper = i - 1; /* Discard upper half of range */
else /* SEARCH_KEY >= NODE_KEY */
{
if (xcc > 0) /* SEARCH_KEY > NODE_KEY */
lower = i + 1; /* Discard lower half of range */
else /* SEARCH_KEY FOUND */
{
idx = i; /* Remember the index */
break; /* We're done */
}
}
}
return idx;
} | java | private int binaryFindDelete(
int lower,
int upper,
Object delKey)
{
java.util.Comparator comp = insertComparator();
int xcc; /* Current compare result */
int i;
int idx = -1; /* Returned index (-1 if not found) */
while (lower <= upper) /* Until they cross */
{
i = (lower + upper) >>> 1; /* Mid-point of current range */
xcc = comp.compare(delKey, _nodeKey[i]);
if (xcc < 0) /* SEARCH_KEY < NODE_KEY */
upper = i - 1; /* Discard upper half of range */
else /* SEARCH_KEY >= NODE_KEY */
{
if (xcc > 0) /* SEARCH_KEY > NODE_KEY */
lower = i + 1; /* Discard lower half of range */
else /* SEARCH_KEY FOUND */
{
idx = i; /* Remember the index */
break; /* We're done */
}
}
}
return idx;
} | [
"private",
"int",
"binaryFindDelete",
"(",
"int",
"lower",
",",
"int",
"upper",
",",
"Object",
"delKey",
")",
"{",
"java",
".",
"util",
".",
"Comparator",
"comp",
"=",
"insertComparator",
"(",
")",
";",
"int",
"xcc",
";",
"/* Current compare result */",
"int",
"i",
";",
"int",
"idx",
"=",
"-",
"1",
";",
"/* Returned index (-1 if not found) */",
"while",
"(",
"lower",
"<=",
"upper",
")",
"/* Until they cross */",
"{",
"i",
"=",
"(",
"lower",
"+",
"upper",
")",
">>>",
"1",
";",
"/* Mid-point of current range */",
"xcc",
"=",
"comp",
".",
"compare",
"(",
"delKey",
",",
"_nodeKey",
"[",
"i",
"]",
")",
";",
"if",
"(",
"xcc",
"<",
"0",
")",
"/* SEARCH_KEY < NODE_KEY */",
"upper",
"=",
"i",
"-",
"1",
";",
"/* Discard upper half of range */",
"else",
"/* SEARCH_KEY >= NODE_KEY */",
"{",
"if",
"(",
"xcc",
">",
"0",
")",
"/* SEARCH_KEY > NODE_KEY */",
"lower",
"=",
"i",
"+",
"1",
";",
"/* Discard lower half of range */",
"else",
"/* SEARCH_KEY FOUND */",
"{",
"idx",
"=",
"i",
";",
"/* Remember the index */",
"break",
";",
"/* We're done */",
"}",
"}",
"}",
"return",
"idx",
";",
"}"
] | Use binary search to find the delete key. | [
"Use",
"binary",
"search",
"to",
"find",
"the",
"delete",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L831-L858 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.middleIndex | public int middleIndex()
{
int x = midPoint();
int r = rightMostIndex();
if (r < midPoint())
x = r;
return x;
} | java | public int middleIndex()
{
int x = midPoint();
int r = rightMostIndex();
if (r < midPoint())
x = r;
return x;
} | [
"public",
"int",
"middleIndex",
"(",
")",
"{",
"int",
"x",
"=",
"midPoint",
"(",
")",
";",
"int",
"r",
"=",
"rightMostIndex",
"(",
")",
";",
"if",
"(",
"r",
"<",
"midPoint",
"(",
")",
")",
"x",
"=",
"r",
";",
"return",
"x",
";",
"}"
] | Return the index to the key at the median position in the node. | [
"Return",
"the",
"index",
"to",
"the",
"key",
"at",
"the",
"median",
"position",
"in",
"the",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L923-L930 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.addRightLeaf | void addRightLeaf(
Object new1)
{
GBSNode p = _index.getNode(new1);
if (rightChild() != null)
throw new RuntimeException("Help!");
setRightChild(p);
} | java | void addRightLeaf(
Object new1)
{
GBSNode p = _index.getNode(new1);
if (rightChild() != null)
throw new RuntimeException("Help!");
setRightChild(p);
} | [
"void",
"addRightLeaf",
"(",
"Object",
"new1",
")",
"{",
"GBSNode",
"p",
"=",
"_index",
".",
"getNode",
"(",
"new1",
")",
";",
"if",
"(",
"rightChild",
"(",
")",
"!=",
"null",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Help!\"",
")",
";",
"setRightChild",
"(",
"p",
")",
";",
"}"
] | Add a right child to the node placing in the new right child
the supplied key. | [
"Add",
"a",
"right",
"child",
"to",
"the",
"node",
"placing",
"in",
"the",
"new",
"right",
"child",
"the",
"supplied",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L954-L961 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.