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.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.putString | public synchronized void putString(String item)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putString", item);
checkValid();
// A String is presented by a BIT16 denoting the length followed by encoded bytes. If the
// String is null, then a length of 1, followed by a single null byte (0x00) is written into
// the buffer.
if (item == null)
{
WsByteBuffer currentBuffer = getCurrentByteBuffer(3);
currentBuffer.putShort((short) 1);
currentBuffer.put(new byte[] { (byte) 0 });
}
else
{
try
{
byte[] stringAsBytes = item.getBytes(stringEncoding);
WsByteBuffer currentBuffer = getCurrentByteBuffer(2 + stringAsBytes.length);
currentBuffer.putShort((short) stringAsBytes.length);
currentBuffer.put(stringAsBytes);
}
catch (UnsupportedEncodingException e)
{
FFDCFilter.processException(e, CLASS_NAME + ".putString",
CommsConstants.COMMSBYTEBUFFER_PUTSTRING_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to encode String: ", e);
SibTr.error(tc, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e});
throw new SIErrorException(
TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e}, null)
);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putString");
} | java | public synchronized void putString(String item)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putString", item);
checkValid();
// A String is presented by a BIT16 denoting the length followed by encoded bytes. If the
// String is null, then a length of 1, followed by a single null byte (0x00) is written into
// the buffer.
if (item == null)
{
WsByteBuffer currentBuffer = getCurrentByteBuffer(3);
currentBuffer.putShort((short) 1);
currentBuffer.put(new byte[] { (byte) 0 });
}
else
{
try
{
byte[] stringAsBytes = item.getBytes(stringEncoding);
WsByteBuffer currentBuffer = getCurrentByteBuffer(2 + stringAsBytes.length);
currentBuffer.putShort((short) stringAsBytes.length);
currentBuffer.put(stringAsBytes);
}
catch (UnsupportedEncodingException e)
{
FFDCFilter.processException(e, CLASS_NAME + ".putString",
CommsConstants.COMMSBYTEBUFFER_PUTSTRING_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to encode String: ", e);
SibTr.error(tc, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e});
throw new SIErrorException(
TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e}, null)
);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putString");
} | [
"public",
"synchronized",
"void",
"putString",
"(",
"String",
"item",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"putString\"",
",",
"item",
")",
";",
"checkValid",
"(",
")",
";",
"// A String is presented by a BIT16 denoting the length followed by encoded bytes. If the",
"// String is null, then a length of 1, followed by a single null byte (0x00) is written into",
"// the buffer.",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"WsByteBuffer",
"currentBuffer",
"=",
"getCurrentByteBuffer",
"(",
"3",
")",
";",
"currentBuffer",
".",
"putShort",
"(",
"(",
"short",
")",
"1",
")",
";",
"currentBuffer",
".",
"put",
"(",
"new",
"byte",
"[",
"]",
"{",
"(",
"byte",
")",
"0",
"}",
")",
";",
"}",
"else",
"{",
"try",
"{",
"byte",
"[",
"]",
"stringAsBytes",
"=",
"item",
".",
"getBytes",
"(",
"stringEncoding",
")",
";",
"WsByteBuffer",
"currentBuffer",
"=",
"getCurrentByteBuffer",
"(",
"2",
"+",
"stringAsBytes",
".",
"length",
")",
";",
"currentBuffer",
".",
"putShort",
"(",
"(",
"short",
")",
"stringAsBytes",
".",
"length",
")",
";",
"currentBuffer",
".",
"put",
"(",
"stringAsBytes",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".putString\"",
",",
"CommsConstants",
".",
"COMMSBYTEBUFFER_PUTSTRING_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Unable to encode String: \"",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"UNSUPPORTED_STRING_ENCODING_SICO8005\"",
",",
"new",
"Object",
"[",
"]",
"{",
"stringEncoding",
",",
"e",
"}",
")",
";",
"throw",
"new",
"SIErrorException",
"(",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"CommsConstants",
".",
"MSG_BUNDLE",
",",
"\"UNSUPPORTED_STRING_ENCODING_SICO8005\"",
",",
"new",
"Object",
"[",
"]",
"{",
"stringEncoding",
",",
"e",
"}",
",",
"null",
")",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"putString\"",
")",
";",
"}"
] | Puts a String into the byte buffer encoded in UTF8.
@param item | [
"Puts",
"a",
"String",
"into",
"the",
"byte",
"buffer",
"encoded",
"in",
"UTF8",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L158-L199 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.putSIDestinationAddress | public synchronized void putSIDestinationAddress(SIDestinationAddress destAddr, short fapLevel)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putSIDestinationAddress", new Object[]{destAddr, Short.valueOf(fapLevel)});
checkValid();
String destName = null;
String busName = null;
byte[] uuid = new byte[0];
boolean localOnly = false;
if (destAddr != null)
{
destName = destAddr.getDestinationName();
busName = destAddr.getBusName();
// If the user has passed in something that we do not know how to serialize, do not even
// try and do anything with the other parts of it.
if (destAddr instanceof JsDestinationAddress)
{
JsDestinationAddress jsDestAddr = (JsDestinationAddress) destAddr;
// If the isMediation() flag has been set, ensure we propagate this as a special UUId.
// We can do this because a mediation destination only carries a name and the UUId
// field is actually redundant.
//lohith liberty change
/* if (jsDestAddr.isFromMediation())
{
uuid = new byte[1];
uuid[0] = CommsConstants.DESTADDR_ISFROMMEDIATION;
}
else*/
{
if (jsDestAddr.getME() != null) uuid = jsDestAddr.getME().toByteArray();
localOnly = jsDestAddr.isLocalOnly();
}
}
}
putShort((short) uuid.length);
if (uuid.length != 0) put(uuid);
putString(destName);
putString(busName);
//Only send localOnly field if fapLevel >= 9 so we don't break down-level servers/client.
if(fapLevel >= JFapChannelConstants.FAP_VERSION_9)
{
put(localOnly ? CommsConstants.TRUE_BYTE : CommsConstants.FALSE_BYTE);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putSIDestinationAddress");
} | java | public synchronized void putSIDestinationAddress(SIDestinationAddress destAddr, short fapLevel)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putSIDestinationAddress", new Object[]{destAddr, Short.valueOf(fapLevel)});
checkValid();
String destName = null;
String busName = null;
byte[] uuid = new byte[0];
boolean localOnly = false;
if (destAddr != null)
{
destName = destAddr.getDestinationName();
busName = destAddr.getBusName();
// If the user has passed in something that we do not know how to serialize, do not even
// try and do anything with the other parts of it.
if (destAddr instanceof JsDestinationAddress)
{
JsDestinationAddress jsDestAddr = (JsDestinationAddress) destAddr;
// If the isMediation() flag has been set, ensure we propagate this as a special UUId.
// We can do this because a mediation destination only carries a name and the UUId
// field is actually redundant.
//lohith liberty change
/* if (jsDestAddr.isFromMediation())
{
uuid = new byte[1];
uuid[0] = CommsConstants.DESTADDR_ISFROMMEDIATION;
}
else*/
{
if (jsDestAddr.getME() != null) uuid = jsDestAddr.getME().toByteArray();
localOnly = jsDestAddr.isLocalOnly();
}
}
}
putShort((short) uuid.length);
if (uuid.length != 0) put(uuid);
putString(destName);
putString(busName);
//Only send localOnly field if fapLevel >= 9 so we don't break down-level servers/client.
if(fapLevel >= JFapChannelConstants.FAP_VERSION_9)
{
put(localOnly ? CommsConstants.TRUE_BYTE : CommsConstants.FALSE_BYTE);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putSIDestinationAddress");
} | [
"public",
"synchronized",
"void",
"putSIDestinationAddress",
"(",
"SIDestinationAddress",
"destAddr",
",",
"short",
"fapLevel",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"putSIDestinationAddress\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destAddr",
",",
"Short",
".",
"valueOf",
"(",
"fapLevel",
")",
"}",
")",
";",
"checkValid",
"(",
")",
";",
"String",
"destName",
"=",
"null",
";",
"String",
"busName",
"=",
"null",
";",
"byte",
"[",
"]",
"uuid",
"=",
"new",
"byte",
"[",
"0",
"]",
";",
"boolean",
"localOnly",
"=",
"false",
";",
"if",
"(",
"destAddr",
"!=",
"null",
")",
"{",
"destName",
"=",
"destAddr",
".",
"getDestinationName",
"(",
")",
";",
"busName",
"=",
"destAddr",
".",
"getBusName",
"(",
")",
";",
"// If the user has passed in something that we do not know how to serialize, do not even",
"// try and do anything with the other parts of it.",
"if",
"(",
"destAddr",
"instanceof",
"JsDestinationAddress",
")",
"{",
"JsDestinationAddress",
"jsDestAddr",
"=",
"(",
"JsDestinationAddress",
")",
"destAddr",
";",
"// If the isMediation() flag has been set, ensure we propagate this as a special UUId.",
"// We can do this because a mediation destination only carries a name and the UUId",
"// field is actually redundant.",
"//lohith liberty change",
"/* if (jsDestAddr.isFromMediation())\n {\n uuid = new byte[1];\n uuid[0] = CommsConstants.DESTADDR_ISFROMMEDIATION;\n }\n else*/",
"{",
"if",
"(",
"jsDestAddr",
".",
"getME",
"(",
")",
"!=",
"null",
")",
"uuid",
"=",
"jsDestAddr",
".",
"getME",
"(",
")",
".",
"toByteArray",
"(",
")",
";",
"localOnly",
"=",
"jsDestAddr",
".",
"isLocalOnly",
"(",
")",
";",
"}",
"}",
"}",
"putShort",
"(",
"(",
"short",
")",
"uuid",
".",
"length",
")",
";",
"if",
"(",
"uuid",
".",
"length",
"!=",
"0",
")",
"put",
"(",
"uuid",
")",
";",
"putString",
"(",
"destName",
")",
";",
"putString",
"(",
"busName",
")",
";",
"//Only send localOnly field if fapLevel >= 9 so we don't break down-level servers/client.",
"if",
"(",
"fapLevel",
">=",
"JFapChannelConstants",
".",
"FAP_VERSION_9",
")",
"{",
"put",
"(",
"localOnly",
"?",
"CommsConstants",
".",
"TRUE_BYTE",
":",
"CommsConstants",
".",
"FALSE_BYTE",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"putSIDestinationAddress\"",
")",
";",
"}"
] | Puts an SIDestinationAddress into the byte buffer.
@param destAddr
@param fapLevel the FAP level of this connection. Used to decide what information to flow down the wire. | [
"Puts",
"an",
"SIDestinationAddress",
"into",
"the",
"byte",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L207-L259 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.putSelectionCriteria | public synchronized void putSelectionCriteria(SelectionCriteria criteria)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putSelectionCriteria", criteria);
checkValid();
String discriminator = null;
String selector = null;
short selectorDomain = (short) SelectorDomain.SIMESSAGE.toInt();
if (criteria != null)
{
discriminator = criteria.getDiscriminator();
selector = criteria.getSelectorString();
SelectorDomain selDomain = criteria.getSelectorDomain();
if (selDomain != null)
{
selectorDomain = (short) selDomain.toInt();
}
}
putShort(selectorDomain);
putString(discriminator);
putString(selector);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putSelectionCriteria");
} | java | public synchronized void putSelectionCriteria(SelectionCriteria criteria)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putSelectionCriteria", criteria);
checkValid();
String discriminator = null;
String selector = null;
short selectorDomain = (short) SelectorDomain.SIMESSAGE.toInt();
if (criteria != null)
{
discriminator = criteria.getDiscriminator();
selector = criteria.getSelectorString();
SelectorDomain selDomain = criteria.getSelectorDomain();
if (selDomain != null)
{
selectorDomain = (short) selDomain.toInt();
}
}
putShort(selectorDomain);
putString(discriminator);
putString(selector);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putSelectionCriteria");
} | [
"public",
"synchronized",
"void",
"putSelectionCriteria",
"(",
"SelectionCriteria",
"criteria",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"putSelectionCriteria\"",
",",
"criteria",
")",
";",
"checkValid",
"(",
")",
";",
"String",
"discriminator",
"=",
"null",
";",
"String",
"selector",
"=",
"null",
";",
"short",
"selectorDomain",
"=",
"(",
"short",
")",
"SelectorDomain",
".",
"SIMESSAGE",
".",
"toInt",
"(",
")",
";",
"if",
"(",
"criteria",
"!=",
"null",
")",
"{",
"discriminator",
"=",
"criteria",
".",
"getDiscriminator",
"(",
")",
";",
"selector",
"=",
"criteria",
".",
"getSelectorString",
"(",
")",
";",
"SelectorDomain",
"selDomain",
"=",
"criteria",
".",
"getSelectorDomain",
"(",
")",
";",
"if",
"(",
"selDomain",
"!=",
"null",
")",
"{",
"selectorDomain",
"=",
"(",
"short",
")",
"selDomain",
".",
"toInt",
"(",
")",
";",
"}",
"}",
"putShort",
"(",
"selectorDomain",
")",
";",
"putString",
"(",
"discriminator",
")",
";",
"putString",
"(",
"selector",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"putSelectionCriteria\"",
")",
";",
"}"
] | Puts a SelectionCriteria object into the byte buffer.
@param criteria | [
"Puts",
"a",
"SelectionCriteria",
"object",
"into",
"the",
"byte",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L266-L293 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.putXid | public synchronized void putXid(Xid xid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "putXid", xid);
putInt(xid.getFormatId());
putInt(xid.getGlobalTransactionId().length);
put(xid.getGlobalTransactionId());
putInt(xid.getBranchQualifier().length);
put(xid.getBranchQualifier());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "putXid");
} | java | public synchronized void putXid(Xid xid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "putXid", xid);
putInt(xid.getFormatId());
putInt(xid.getGlobalTransactionId().length);
put(xid.getGlobalTransactionId());
putInt(xid.getBranchQualifier().length);
put(xid.getBranchQualifier());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "putXid");
} | [
"public",
"synchronized",
"void",
"putXid",
"(",
"Xid",
"xid",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"putXid\"",
",",
"xid",
")",
";",
"putInt",
"(",
"xid",
".",
"getFormatId",
"(",
")",
")",
";",
"putInt",
"(",
"xid",
".",
"getGlobalTransactionId",
"(",
")",
".",
"length",
")",
";",
"put",
"(",
"xid",
".",
"getGlobalTransactionId",
"(",
")",
")",
";",
"putInt",
"(",
"xid",
".",
"getBranchQualifier",
"(",
")",
".",
"length",
")",
";",
"put",
"(",
"xid",
".",
"getBranchQualifier",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"putXid\"",
")",
";",
"}"
] | Puts an Xid into the Byte Buffer.
@param xid | [
"Puts",
"an",
"Xid",
"into",
"the",
"Byte",
"Buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L300-L311 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.putSITransaction | public synchronized void putSITransaction(SITransaction transaction)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "putSITransaction", transaction);
Transaction commsTx = (Transaction)transaction;
int flags = -1;
if (transaction == null)
{
// No transaction - add "no transaction" flags to buffer.
putInt(0x00000000);
}
else
{
// First we must search for any optimized transactions as they hold much more information
// than the old-style ones.
OptimizedTransaction optTx = null;
// First see if the transaction is a global one. This could be both optimized or
// unoptimized but the result is buried within it
if (transaction instanceof SuspendableXAResource)
{
SIXAResource suspendableXARes = ((SuspendableXAResource) transaction).getCurrentXAResource();
if (suspendableXARes instanceof OptimizedTransaction)
{
// The current XA Resource is indeed optimized
optTx = (OptimizedTransaction) suspendableXARes;
}
}
// Otherwise the actual transaction itself may be an optimized one - this is in the case
// of an optimized local transaction.
else if (transaction instanceof OptimizedTransaction)
{
optTx = (OptimizedTransaction) transaction;
}
// If we are optimized...
if (optTx != null)
{
// Optimized transaction
flags = CommsConstants.OPTIMIZED_TX_FLAGS_TRANSACTED_BIT;
boolean local = optTx instanceof SIUncoordinatedTransaction;
boolean addXid = false;
boolean endPreviousUow = false;
if (local)
{
flags |= CommsConstants.OPTIMIZED_TX_FLAGS_LOCAL_BIT;
}
if (!optTx.isServerTransactionCreated())
{
flags |= CommsConstants.OPTIMIZED_TX_FLAGS_CREATE_BIT;
if (local && optTx.areSubordinatesAllowed())
flags |= CommsConstants.OPTIMIZED_TX_FLAGS_SUBORDINATES_ALLOWED;
optTx.setServerTransactionCreated();
addXid = !local;
}
if (addXid && (optTx.isEndRequired()))
{
flags |= CommsConstants.OPTIMIZED_TX_END_PREVIOUS_BIT;
endPreviousUow = true;
}
putInt(flags);
putInt(optTx.getCreatingConversationId());
putInt(commsTx.getTransactionId());
if (addXid)
{
if (endPreviousUow)
{
putInt(optTx.getEndFlags());
optTx.setEndNotRequired();
}
putXid(new XidProxy(optTx.getXidForCurrentUow()));
}
}
else
{
// This is an un-optimized transaction - simply append transaction ID.
putInt(commsTx.getTransactionId());
}
}
if (TraceComponent.isAnyTracingEnabled()) {
int commsId = -1;
if (commsTx != null) commsId = commsTx.getTransactionId();
CommsLightTrace.traceTransaction(tc, "PutTxnTrace", commsTx, commsId, flags);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "putSITransaction");
} | java | public synchronized void putSITransaction(SITransaction transaction)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "putSITransaction", transaction);
Transaction commsTx = (Transaction)transaction;
int flags = -1;
if (transaction == null)
{
// No transaction - add "no transaction" flags to buffer.
putInt(0x00000000);
}
else
{
// First we must search for any optimized transactions as they hold much more information
// than the old-style ones.
OptimizedTransaction optTx = null;
// First see if the transaction is a global one. This could be both optimized or
// unoptimized but the result is buried within it
if (transaction instanceof SuspendableXAResource)
{
SIXAResource suspendableXARes = ((SuspendableXAResource) transaction).getCurrentXAResource();
if (suspendableXARes instanceof OptimizedTransaction)
{
// The current XA Resource is indeed optimized
optTx = (OptimizedTransaction) suspendableXARes;
}
}
// Otherwise the actual transaction itself may be an optimized one - this is in the case
// of an optimized local transaction.
else if (transaction instanceof OptimizedTransaction)
{
optTx = (OptimizedTransaction) transaction;
}
// If we are optimized...
if (optTx != null)
{
// Optimized transaction
flags = CommsConstants.OPTIMIZED_TX_FLAGS_TRANSACTED_BIT;
boolean local = optTx instanceof SIUncoordinatedTransaction;
boolean addXid = false;
boolean endPreviousUow = false;
if (local)
{
flags |= CommsConstants.OPTIMIZED_TX_FLAGS_LOCAL_BIT;
}
if (!optTx.isServerTransactionCreated())
{
flags |= CommsConstants.OPTIMIZED_TX_FLAGS_CREATE_BIT;
if (local && optTx.areSubordinatesAllowed())
flags |= CommsConstants.OPTIMIZED_TX_FLAGS_SUBORDINATES_ALLOWED;
optTx.setServerTransactionCreated();
addXid = !local;
}
if (addXid && (optTx.isEndRequired()))
{
flags |= CommsConstants.OPTIMIZED_TX_END_PREVIOUS_BIT;
endPreviousUow = true;
}
putInt(flags);
putInt(optTx.getCreatingConversationId());
putInt(commsTx.getTransactionId());
if (addXid)
{
if (endPreviousUow)
{
putInt(optTx.getEndFlags());
optTx.setEndNotRequired();
}
putXid(new XidProxy(optTx.getXidForCurrentUow()));
}
}
else
{
// This is an un-optimized transaction - simply append transaction ID.
putInt(commsTx.getTransactionId());
}
}
if (TraceComponent.isAnyTracingEnabled()) {
int commsId = -1;
if (commsTx != null) commsId = commsTx.getTransactionId();
CommsLightTrace.traceTransaction(tc, "PutTxnTrace", commsTx, commsId, flags);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "putSITransaction");
} | [
"public",
"synchronized",
"void",
"putSITransaction",
"(",
"SITransaction",
"transaction",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"putSITransaction\"",
",",
"transaction",
")",
";",
"Transaction",
"commsTx",
"=",
"(",
"Transaction",
")",
"transaction",
";",
"int",
"flags",
"=",
"-",
"1",
";",
"if",
"(",
"transaction",
"==",
"null",
")",
"{",
"// No transaction - add \"no transaction\" flags to buffer.",
"putInt",
"(",
"0x00000000",
")",
";",
"}",
"else",
"{",
"// First we must search for any optimized transactions as they hold much more information",
"// than the old-style ones.",
"OptimizedTransaction",
"optTx",
"=",
"null",
";",
"// First see if the transaction is a global one. This could be both optimized or",
"// unoptimized but the result is buried within it",
"if",
"(",
"transaction",
"instanceof",
"SuspendableXAResource",
")",
"{",
"SIXAResource",
"suspendableXARes",
"=",
"(",
"(",
"SuspendableXAResource",
")",
"transaction",
")",
".",
"getCurrentXAResource",
"(",
")",
";",
"if",
"(",
"suspendableXARes",
"instanceof",
"OptimizedTransaction",
")",
"{",
"// The current XA Resource is indeed optimized",
"optTx",
"=",
"(",
"OptimizedTransaction",
")",
"suspendableXARes",
";",
"}",
"}",
"// Otherwise the actual transaction itself may be an optimized one - this is in the case",
"// of an optimized local transaction.",
"else",
"if",
"(",
"transaction",
"instanceof",
"OptimizedTransaction",
")",
"{",
"optTx",
"=",
"(",
"OptimizedTransaction",
")",
"transaction",
";",
"}",
"// If we are optimized...",
"if",
"(",
"optTx",
"!=",
"null",
")",
"{",
"// Optimized transaction",
"flags",
"=",
"CommsConstants",
".",
"OPTIMIZED_TX_FLAGS_TRANSACTED_BIT",
";",
"boolean",
"local",
"=",
"optTx",
"instanceof",
"SIUncoordinatedTransaction",
";",
"boolean",
"addXid",
"=",
"false",
";",
"boolean",
"endPreviousUow",
"=",
"false",
";",
"if",
"(",
"local",
")",
"{",
"flags",
"|=",
"CommsConstants",
".",
"OPTIMIZED_TX_FLAGS_LOCAL_BIT",
";",
"}",
"if",
"(",
"!",
"optTx",
".",
"isServerTransactionCreated",
"(",
")",
")",
"{",
"flags",
"|=",
"CommsConstants",
".",
"OPTIMIZED_TX_FLAGS_CREATE_BIT",
";",
"if",
"(",
"local",
"&&",
"optTx",
".",
"areSubordinatesAllowed",
"(",
")",
")",
"flags",
"|=",
"CommsConstants",
".",
"OPTIMIZED_TX_FLAGS_SUBORDINATES_ALLOWED",
";",
"optTx",
".",
"setServerTransactionCreated",
"(",
")",
";",
"addXid",
"=",
"!",
"local",
";",
"}",
"if",
"(",
"addXid",
"&&",
"(",
"optTx",
".",
"isEndRequired",
"(",
")",
")",
")",
"{",
"flags",
"|=",
"CommsConstants",
".",
"OPTIMIZED_TX_END_PREVIOUS_BIT",
";",
"endPreviousUow",
"=",
"true",
";",
"}",
"putInt",
"(",
"flags",
")",
";",
"putInt",
"(",
"optTx",
".",
"getCreatingConversationId",
"(",
")",
")",
";",
"putInt",
"(",
"commsTx",
".",
"getTransactionId",
"(",
")",
")",
";",
"if",
"(",
"addXid",
")",
"{",
"if",
"(",
"endPreviousUow",
")",
"{",
"putInt",
"(",
"optTx",
".",
"getEndFlags",
"(",
")",
")",
";",
"optTx",
".",
"setEndNotRequired",
"(",
")",
";",
"}",
"putXid",
"(",
"new",
"XidProxy",
"(",
"optTx",
".",
"getXidForCurrentUow",
"(",
")",
")",
")",
";",
"}",
"}",
"else",
"{",
"// This is an un-optimized transaction - simply append transaction ID.",
"putInt",
"(",
"commsTx",
".",
"getTransactionId",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
")",
"{",
"int",
"commsId",
"=",
"-",
"1",
";",
"if",
"(",
"commsTx",
"!=",
"null",
")",
"commsId",
"=",
"commsTx",
".",
"getTransactionId",
"(",
")",
";",
"CommsLightTrace",
".",
"traceTransaction",
"(",
"tc",
",",
"\"PutTxnTrace\"",
",",
"commsTx",
",",
"commsId",
",",
"flags",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"putSITransaction\"",
")",
";",
"}"
] | Puts an SITransaction into the buffer
@param transaction transaction to "serialize" | [
"Puts",
"an",
"SITransaction",
"into",
"the",
"buffer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L318-L407 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.putMessgeWithoutEncode | public int putMessgeWithoutEncode(List<DataSlice> messageParts)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putMessgeWithoutEncode", messageParts);
int messageLength = 0;
// Now we have a list of MessagePart objects. First work out the overall length.
for (int x = 0; x < messageParts.size(); x++)
{
messageLength += messageParts.get(x).getLength();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Message is " + messageLength + "byte(s) in length");
// Write the length
putLong(messageLength);
// Now take the message parts and wrap them into byte buffers using the offset's supplied
for (int x = 0; x < messageParts.size(); x++)
{
DataSlice messPart = messageParts.get(x);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "DataSlice[" + x + "]: " +
"Array: " + Arrays.toString(messPart.getBytes()) + ", " +
"Offset: " + messPart.getOffset() + ", " +
"Length: " + messPart.getLength());
wrap(messPart.getBytes(), messPart.getOffset(), messPart.getLength());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putMessgeWithoutEncode", messageLength);
return messageLength;
} | java | public int putMessgeWithoutEncode(List<DataSlice> messageParts)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putMessgeWithoutEncode", messageParts);
int messageLength = 0;
// Now we have a list of MessagePart objects. First work out the overall length.
for (int x = 0; x < messageParts.size(); x++)
{
messageLength += messageParts.get(x).getLength();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Message is " + messageLength + "byte(s) in length");
// Write the length
putLong(messageLength);
// Now take the message parts and wrap them into byte buffers using the offset's supplied
for (int x = 0; x < messageParts.size(); x++)
{
DataSlice messPart = messageParts.get(x);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "DataSlice[" + x + "]: " +
"Array: " + Arrays.toString(messPart.getBytes()) + ", " +
"Offset: " + messPart.getOffset() + ", " +
"Length: " + messPart.getLength());
wrap(messPart.getBytes(), messPart.getOffset(), messPart.getLength());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putMessgeWithoutEncode", messageLength);
return messageLength;
} | [
"public",
"int",
"putMessgeWithoutEncode",
"(",
"List",
"<",
"DataSlice",
">",
"messageParts",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"putMessgeWithoutEncode\"",
",",
"messageParts",
")",
";",
"int",
"messageLength",
"=",
"0",
";",
"// Now we have a list of MessagePart objects. First work out the overall length.",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"messageParts",
".",
"size",
"(",
")",
";",
"x",
"++",
")",
"{",
"messageLength",
"+=",
"messageParts",
".",
"get",
"(",
"x",
")",
".",
"getLength",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Message is \"",
"+",
"messageLength",
"+",
"\"byte(s) in length\"",
")",
";",
"// Write the length",
"putLong",
"(",
"messageLength",
")",
";",
"// Now take the message parts and wrap them into byte buffers using the offset's supplied",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"messageParts",
".",
"size",
"(",
")",
";",
"x",
"++",
")",
"{",
"DataSlice",
"messPart",
"=",
"messageParts",
".",
"get",
"(",
"x",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"DataSlice[\"",
"+",
"x",
"+",
"\"]: \"",
"+",
"\"Array: \"",
"+",
"Arrays",
".",
"toString",
"(",
"messPart",
".",
"getBytes",
"(",
")",
")",
"+",
"\", \"",
"+",
"\"Offset: \"",
"+",
"messPart",
".",
"getOffset",
"(",
")",
"+",
"\", \"",
"+",
"\"Length: \"",
"+",
"messPart",
".",
"getLength",
"(",
")",
")",
";",
"wrap",
"(",
"messPart",
".",
"getBytes",
"(",
")",
",",
"messPart",
".",
"getOffset",
"(",
")",
",",
"messPart",
".",
"getLength",
"(",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"putMessgeWithoutEncode\"",
",",
"messageLength",
")",
";",
"return",
"messageLength",
";",
"}"
] | This method is used to put a message into the buffer but assumes that the encode has already
been completed. This may be in the case where we would like to send the message in chunks but
we decide that the message would be better sent as an entire message.
@param messageParts
@return Returns the size of the message that was put into the buffer. | [
"This",
"method",
"is",
"used",
"to",
"put",
"a",
"message",
"into",
"the",
"buffer",
"but",
"assumes",
"that",
"the",
"encode",
"has",
"already",
"been",
"completed",
".",
"This",
"may",
"be",
"in",
"the",
"case",
"where",
"we",
"would",
"like",
"to",
"send",
"the",
"message",
"in",
"chunks",
"but",
"we",
"decide",
"that",
"the",
"message",
"would",
"be",
"better",
"sent",
"as",
"an",
"entire",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L453-L483 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.putDataSlice | public synchronized void putDataSlice(DataSlice slice)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putDataSlice", slice);
// First pump in the length
putInt(slice.getLength());
// Now add in the payload
wrap(slice.getBytes(), slice.getOffset(), slice.getLength());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putDataSlice");
} | java | public synchronized void putDataSlice(DataSlice slice)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putDataSlice", slice);
// First pump in the length
putInt(slice.getLength());
// Now add in the payload
wrap(slice.getBytes(), slice.getOffset(), slice.getLength());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putDataSlice");
} | [
"public",
"synchronized",
"void",
"putDataSlice",
"(",
"DataSlice",
"slice",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"putDataSlice\"",
",",
"slice",
")",
";",
"// First pump in the length",
"putInt",
"(",
"slice",
".",
"getLength",
"(",
")",
")",
";",
"// Now add in the payload",
"wrap",
"(",
"slice",
".",
"getBytes",
"(",
")",
",",
"slice",
".",
"getOffset",
"(",
")",
",",
"slice",
".",
"getLength",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"putDataSlice\"",
")",
";",
"}"
] | This method is used to put a data slice into the buffer. A data slice is usually given to us
by MFP as part of a message and this method can be used to add a single slice into the buffer
so that the message can be sent in multiple transmissions. This is preferable to sending the
message in one job lot because we can allocate the memory required in smaller chunks making
life easier on the Java memory manager.
@param slice The slice to add. | [
"This",
"method",
"is",
"used",
"to",
"put",
"a",
"data",
"slice",
"into",
"the",
"buffer",
".",
"A",
"data",
"slice",
"is",
"usually",
"given",
"to",
"us",
"by",
"MFP",
"as",
"part",
"of",
"a",
"message",
"and",
"this",
"method",
"can",
"be",
"used",
"to",
"add",
"a",
"single",
"slice",
"into",
"the",
"buffer",
"so",
"that",
"the",
"message",
"can",
"be",
"sent",
"in",
"multiple",
"transmissions",
".",
"This",
"is",
"preferable",
"to",
"sending",
"the",
"message",
"in",
"one",
"job",
"lot",
"because",
"we",
"can",
"allocate",
"the",
"memory",
"required",
"in",
"smaller",
"chunks",
"making",
"life",
"easier",
"on",
"the",
"Java",
"memory",
"manager",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L560-L571 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.putSIMessageHandles | public synchronized void putSIMessageHandles(SIMessageHandle[] siMsgHandles)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "putSIMessageHandles", siMsgHandles);
putInt(siMsgHandles.length);
for (int handleIndex = 0; handleIndex < siMsgHandles.length; ++handleIndex)
{
JsMessageHandle jsHandle = (JsMessageHandle)siMsgHandles[handleIndex];
putLong(jsHandle.getSystemMessageValue());
put(jsHandle.getSystemMessageSourceUuid().toByteArray());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "message handle: "+siMsgHandles[handleIndex]);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "putSIMessageHandles");
} | java | public synchronized void putSIMessageHandles(SIMessageHandle[] siMsgHandles)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "putSIMessageHandles", siMsgHandles);
putInt(siMsgHandles.length);
for (int handleIndex = 0; handleIndex < siMsgHandles.length; ++handleIndex)
{
JsMessageHandle jsHandle = (JsMessageHandle)siMsgHandles[handleIndex];
putLong(jsHandle.getSystemMessageValue());
put(jsHandle.getSystemMessageSourceUuid().toByteArray());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "message handle: "+siMsgHandles[handleIndex]);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "putSIMessageHandles");
} | [
"public",
"synchronized",
"void",
"putSIMessageHandles",
"(",
"SIMessageHandle",
"[",
"]",
"siMsgHandles",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"putSIMessageHandles\"",
",",
"siMsgHandles",
")",
";",
"putInt",
"(",
"siMsgHandles",
".",
"length",
")",
";",
"for",
"(",
"int",
"handleIndex",
"=",
"0",
";",
"handleIndex",
"<",
"siMsgHandles",
".",
"length",
";",
"++",
"handleIndex",
")",
"{",
"JsMessageHandle",
"jsHandle",
"=",
"(",
"JsMessageHandle",
")",
"siMsgHandles",
"[",
"handleIndex",
"]",
";",
"putLong",
"(",
"jsHandle",
".",
"getSystemMessageValue",
"(",
")",
")",
";",
"put",
"(",
"jsHandle",
".",
"getSystemMessageSourceUuid",
"(",
")",
".",
"toByteArray",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"message handle: \"",
"+",
"siMsgHandles",
"[",
"handleIndex",
"]",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"putSIMessageHandles\"",
")",
";",
"}"
] | Puts the array of message handles into the buffer.
@param siMsgHandles | [
"Puts",
"the",
"array",
"of",
"message",
"handles",
"into",
"the",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L578-L593 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.putException | public synchronized void putException(Throwable throwable, String probeId, Conversation conversation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putException",
new Object[]{throwable, probeId, conversation});
Throwable currentException = throwable;
// First we need to work out how many exceptions to send back
short numberOfExceptions = 0;
while(currentException != null)
{
currentException = currentException.getCause();
numberOfExceptions++;
}
// Now add them to the buffer
currentException = throwable;
// First put in the buffer how many exceptions are being sent back
putShort(numberOfExceptions);
// Now iterate over the rest
while (currentException != null)
{
short exceptionId = getExceptionId(currentException);
addException(currentException,
exceptionId,
probeId);
// Now get the next one in the chain
currentException = currentException.getCause();
// Ensure we null out the probe - this doesn't apply for any more exceptions
probeId = null;
}
final HandshakeProperties handshakeProperties = conversation.getHandshakeProperties();
if ((handshakeProperties != null) &&
((CATHandshakeProperties)handshakeProperties).isFapLevelKnown())
{
// Only do FAP level checking if we know the FAP level - otherwise, assume a pre-FAP
// 9 format for the exception flow. We can find ourselves in a situation where we
// don't know the FAP level if, for example, an exception is thrown during handshaking.
final int fapLevel = ((CATHandshakeProperties)handshakeProperties).getFapLevel();
if (fapLevel >= JFapChannelConstants.FAP_VERSION_9)
{
// At FAP version 9 or greater we transport the reason and inserts
// of any exception which implements the Reasonable interface, or
// inherits from SIException or SIErrorException.
int reason = Reasonable.DEFAULT_REASON;
String inserts[] = Reasonable.DEFAULT_INSERTS;
if (throwable instanceof Reasonable)
{
reason = ((Reasonable)throwable).getExceptionReason();
inserts = ((Reasonable)throwable).getExceptionInserts();
}
else if (throwable instanceof SIException)
{
reason = ((SIException)throwable).getExceptionReason();
inserts = ((SIException)throwable).getExceptionInserts();
}
else if (throwable instanceof SIErrorException)
{
reason = ((SIErrorException)throwable).getExceptionReason();
inserts = ((SIErrorException)throwable).getExceptionInserts();
}
putInt(reason);
putShort(inserts.length);
for (int i=0; i < inserts.length; ++i)
{
putString(inserts[i]);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putException");
} | java | public synchronized void putException(Throwable throwable, String probeId, Conversation conversation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putException",
new Object[]{throwable, probeId, conversation});
Throwable currentException = throwable;
// First we need to work out how many exceptions to send back
short numberOfExceptions = 0;
while(currentException != null)
{
currentException = currentException.getCause();
numberOfExceptions++;
}
// Now add them to the buffer
currentException = throwable;
// First put in the buffer how many exceptions are being sent back
putShort(numberOfExceptions);
// Now iterate over the rest
while (currentException != null)
{
short exceptionId = getExceptionId(currentException);
addException(currentException,
exceptionId,
probeId);
// Now get the next one in the chain
currentException = currentException.getCause();
// Ensure we null out the probe - this doesn't apply for any more exceptions
probeId = null;
}
final HandshakeProperties handshakeProperties = conversation.getHandshakeProperties();
if ((handshakeProperties != null) &&
((CATHandshakeProperties)handshakeProperties).isFapLevelKnown())
{
// Only do FAP level checking if we know the FAP level - otherwise, assume a pre-FAP
// 9 format for the exception flow. We can find ourselves in a situation where we
// don't know the FAP level if, for example, an exception is thrown during handshaking.
final int fapLevel = ((CATHandshakeProperties)handshakeProperties).getFapLevel();
if (fapLevel >= JFapChannelConstants.FAP_VERSION_9)
{
// At FAP version 9 or greater we transport the reason and inserts
// of any exception which implements the Reasonable interface, or
// inherits from SIException or SIErrorException.
int reason = Reasonable.DEFAULT_REASON;
String inserts[] = Reasonable.DEFAULT_INSERTS;
if (throwable instanceof Reasonable)
{
reason = ((Reasonable)throwable).getExceptionReason();
inserts = ((Reasonable)throwable).getExceptionInserts();
}
else if (throwable instanceof SIException)
{
reason = ((SIException)throwable).getExceptionReason();
inserts = ((SIException)throwable).getExceptionInserts();
}
else if (throwable instanceof SIErrorException)
{
reason = ((SIErrorException)throwable).getExceptionReason();
inserts = ((SIErrorException)throwable).getExceptionInserts();
}
putInt(reason);
putShort(inserts.length);
for (int i=0; i < inserts.length; ++i)
{
putString(inserts[i]);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putException");
} | [
"public",
"synchronized",
"void",
"putException",
"(",
"Throwable",
"throwable",
",",
"String",
"probeId",
",",
"Conversation",
"conversation",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"putException\"",
",",
"new",
"Object",
"[",
"]",
"{",
"throwable",
",",
"probeId",
",",
"conversation",
"}",
")",
";",
"Throwable",
"currentException",
"=",
"throwable",
";",
"// First we need to work out how many exceptions to send back",
"short",
"numberOfExceptions",
"=",
"0",
";",
"while",
"(",
"currentException",
"!=",
"null",
")",
"{",
"currentException",
"=",
"currentException",
".",
"getCause",
"(",
")",
";",
"numberOfExceptions",
"++",
";",
"}",
"// Now add them to the buffer",
"currentException",
"=",
"throwable",
";",
"// First put in the buffer how many exceptions are being sent back",
"putShort",
"(",
"numberOfExceptions",
")",
";",
"// Now iterate over the rest",
"while",
"(",
"currentException",
"!=",
"null",
")",
"{",
"short",
"exceptionId",
"=",
"getExceptionId",
"(",
"currentException",
")",
";",
"addException",
"(",
"currentException",
",",
"exceptionId",
",",
"probeId",
")",
";",
"// Now get the next one in the chain",
"currentException",
"=",
"currentException",
".",
"getCause",
"(",
")",
";",
"// Ensure we null out the probe - this doesn't apply for any more exceptions",
"probeId",
"=",
"null",
";",
"}",
"final",
"HandshakeProperties",
"handshakeProperties",
"=",
"conversation",
".",
"getHandshakeProperties",
"(",
")",
";",
"if",
"(",
"(",
"handshakeProperties",
"!=",
"null",
")",
"&&",
"(",
"(",
"CATHandshakeProperties",
")",
"handshakeProperties",
")",
".",
"isFapLevelKnown",
"(",
")",
")",
"{",
"// Only do FAP level checking if we know the FAP level - otherwise, assume a pre-FAP",
"// 9 format for the exception flow. We can find ourselves in a situation where we",
"// don't know the FAP level if, for example, an exception is thrown during handshaking.",
"final",
"int",
"fapLevel",
"=",
"(",
"(",
"CATHandshakeProperties",
")",
"handshakeProperties",
")",
".",
"getFapLevel",
"(",
")",
";",
"if",
"(",
"fapLevel",
">=",
"JFapChannelConstants",
".",
"FAP_VERSION_9",
")",
"{",
"// At FAP version 9 or greater we transport the reason and inserts",
"// of any exception which implements the Reasonable interface, or",
"// inherits from SIException or SIErrorException.",
"int",
"reason",
"=",
"Reasonable",
".",
"DEFAULT_REASON",
";",
"String",
"inserts",
"[",
"]",
"=",
"Reasonable",
".",
"DEFAULT_INSERTS",
";",
"if",
"(",
"throwable",
"instanceof",
"Reasonable",
")",
"{",
"reason",
"=",
"(",
"(",
"Reasonable",
")",
"throwable",
")",
".",
"getExceptionReason",
"(",
")",
";",
"inserts",
"=",
"(",
"(",
"Reasonable",
")",
"throwable",
")",
".",
"getExceptionInserts",
"(",
")",
";",
"}",
"else",
"if",
"(",
"throwable",
"instanceof",
"SIException",
")",
"{",
"reason",
"=",
"(",
"(",
"SIException",
")",
"throwable",
")",
".",
"getExceptionReason",
"(",
")",
";",
"inserts",
"=",
"(",
"(",
"SIException",
")",
"throwable",
")",
".",
"getExceptionInserts",
"(",
")",
";",
"}",
"else",
"if",
"(",
"throwable",
"instanceof",
"SIErrorException",
")",
"{",
"reason",
"=",
"(",
"(",
"SIErrorException",
")",
"throwable",
")",
".",
"getExceptionReason",
"(",
")",
";",
"inserts",
"=",
"(",
"(",
"SIErrorException",
")",
"throwable",
")",
".",
"getExceptionInserts",
"(",
")",
";",
"}",
"putInt",
"(",
"reason",
")",
";",
"putShort",
"(",
"inserts",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"inserts",
".",
"length",
";",
"++",
"i",
")",
"{",
"putString",
"(",
"inserts",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"putException\"",
")",
";",
"}"
] | This method will fill a buffer list with WsByteBuffer's that when put together form a
packet describing an exception and it's linked exceptions. It will traverse down the cause
exceptions until one of them is null.
@param throwable The exception to examine.
@param probeId The probe id (if any) associated with the top level exception.
@param conversation The conversation that the exception data will be sent over. This is
used to determine the level of FAP being used - and hence how to
encode certain exception information. | [
"This",
"method",
"will",
"fill",
"a",
"buffer",
"list",
"with",
"WsByteBuffer",
"s",
"that",
"when",
"put",
"together",
"form",
"a",
"packet",
"describing",
"an",
"exception",
"and",
"it",
"s",
"linked",
"exceptions",
".",
"It",
"will",
"traverse",
"down",
"the",
"cause",
"exceptions",
"until",
"one",
"of",
"them",
"is",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L606-L684 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.getString | public synchronized String getString()
{
checkReleased();
String returningString = null;
// Read the length in
short stringLength = receivedBuffer.getShort();
// Allocate the right amount of space for it
byte[] stringBytes = new byte[stringLength];
// And copy the data in
receivedBuffer.get(stringBytes);
// If the length is 1, and the byte is 0x00, then this is null - so do nothing
if (stringLength == 1 && stringBytes[0] == 0)
{
// String is null...
}
else
{
try
{
returningString = new String(stringBytes, stringEncoding);
}
catch (UnsupportedEncodingException e)
{
FFDCFilter.processException(e, CLASS_NAME + ".getString",
CommsConstants.COMMSBYTEBUFFER_GETSTRING_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "Unable to encode String: ", e);
SibTr.exception(tc, e);
}
SibTr.error(tc, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e});
throw new SIErrorException(
TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e}, null)
);
}
}
return returningString;
} | java | public synchronized String getString()
{
checkReleased();
String returningString = null;
// Read the length in
short stringLength = receivedBuffer.getShort();
// Allocate the right amount of space for it
byte[] stringBytes = new byte[stringLength];
// And copy the data in
receivedBuffer.get(stringBytes);
// If the length is 1, and the byte is 0x00, then this is null - so do nothing
if (stringLength == 1 && stringBytes[0] == 0)
{
// String is null...
}
else
{
try
{
returningString = new String(stringBytes, stringEncoding);
}
catch (UnsupportedEncodingException e)
{
FFDCFilter.processException(e, CLASS_NAME + ".getString",
CommsConstants.COMMSBYTEBUFFER_GETSTRING_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "Unable to encode String: ", e);
SibTr.exception(tc, e);
}
SibTr.error(tc, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e});
throw new SIErrorException(
TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e}, null)
);
}
}
return returningString;
} | [
"public",
"synchronized",
"String",
"getString",
"(",
")",
"{",
"checkReleased",
"(",
")",
";",
"String",
"returningString",
"=",
"null",
";",
"// Read the length in",
"short",
"stringLength",
"=",
"receivedBuffer",
".",
"getShort",
"(",
")",
";",
"// Allocate the right amount of space for it",
"byte",
"[",
"]",
"stringBytes",
"=",
"new",
"byte",
"[",
"stringLength",
"]",
";",
"// And copy the data in",
"receivedBuffer",
".",
"get",
"(",
"stringBytes",
")",
";",
"// If the length is 1, and the byte is 0x00, then this is null - so do nothing",
"if",
"(",
"stringLength",
"==",
"1",
"&&",
"stringBytes",
"[",
"0",
"]",
"==",
"0",
")",
"{",
"// String is null...",
"}",
"else",
"{",
"try",
"{",
"returningString",
"=",
"new",
"String",
"(",
"stringBytes",
",",
"stringEncoding",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".getString\"",
",",
"CommsConstants",
".",
"COMMSBYTEBUFFER_GETSTRING_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Unable to encode String: \"",
",",
"e",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"UNSUPPORTED_STRING_ENCODING_SICO8005\"",
",",
"new",
"Object",
"[",
"]",
"{",
"stringEncoding",
",",
"e",
"}",
")",
";",
"throw",
"new",
"SIErrorException",
"(",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"CommsConstants",
".",
"MSG_BUNDLE",
",",
"\"UNSUPPORTED_STRING_ENCODING_SICO8005\"",
",",
"new",
"Object",
"[",
"]",
"{",
"stringEncoding",
",",
"e",
"}",
",",
"null",
")",
")",
";",
"}",
"}",
"return",
"returningString",
";",
"}"
] | Reads a String from the current position in the byte buffer.
@return Returns the String | [
"Reads",
"a",
"String",
"from",
"the",
"current",
"position",
"in",
"the",
"byte",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L724-L769 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.getSIDestinationAddress | public synchronized SIDestinationAddress getSIDestinationAddress(short fapLevel)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSIDestinationAddress", Short.valueOf(fapLevel)); //469395
checkReleased();
boolean isFromMediation = false;
/**************************************************************/
/* Uuid */
/**************************************************************/
short uuidLength = getShort(); // BIT16 Uuid Length
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid length:", ""+uuidLength);
SIBUuid8 uuid = null;
// Note: In all other cases, a length of -1 would normally indicate a null value.
// However, in this case we use a length 0 to inidicate a null value, mainly
// because the uuid can not be 0 in length, and using 0 makes the code neater.
if (uuidLength != 0)
{
if (uuidLength == 1)
{
byte addressFlags = get();
if (addressFlags == CommsConstants.DESTADDR_ISFROMMEDIATION)
{
isFromMediation = true;
}
}
else
{
byte[] uuidBytes = get(uuidLength); // BYTE[] Uuid
uuid = new SIBUuid8(uuidBytes);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid:", uuid);
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid was null");
}
/**************************************************************/
/* Destination */
/**************************************************************/
String destinationName = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Destination name:", destinationName);
/**************************************************************/
/* Bus name */
/**************************************************************/
String busName = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Bus name:", busName);
/**************************************************************/
/* Local only */
/**************************************************************/
//Only read from buffer if fap 9 or greater
//Default value if not flown is false for backwards compatibility.
boolean localOnly = false;
if(fapLevel >= JFapChannelConstants.FAP_VERSION_9)
{
final byte localOnlyByte = get();
localOnly = (localOnlyByte == CommsConstants.TRUE_BYTE);
}
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "localOnly: ", localOnly);
// If we get a null UUID, a null name and a null bus name, return null
JsDestinationAddress destAddress = null;
if (uuid == null && destinationName == null && busName == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Both UUID, destination name and bus name were null");
}
else
{
//lohith liberty change
/* if (isFromMediation)
{
destAddress =
((JsDestinationAddressFactory) JsDestinationAddressFactory.getInstance()).
createJsMediationdestinationAddress(destinationName);
}
else*/
{
destAddress =
((JsDestinationAddressFactory) JsDestinationAddressFactory.getInstance()).
createJsDestinationAddress(destinationName,
localOnly,
uuid,
busName);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSIDestinationAddress",destAddress); //469395
return destAddress;
} | java | public synchronized SIDestinationAddress getSIDestinationAddress(short fapLevel)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSIDestinationAddress", Short.valueOf(fapLevel)); //469395
checkReleased();
boolean isFromMediation = false;
/**************************************************************/
/* Uuid */
/**************************************************************/
short uuidLength = getShort(); // BIT16 Uuid Length
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid length:", ""+uuidLength);
SIBUuid8 uuid = null;
// Note: In all other cases, a length of -1 would normally indicate a null value.
// However, in this case we use a length 0 to inidicate a null value, mainly
// because the uuid can not be 0 in length, and using 0 makes the code neater.
if (uuidLength != 0)
{
if (uuidLength == 1)
{
byte addressFlags = get();
if (addressFlags == CommsConstants.DESTADDR_ISFROMMEDIATION)
{
isFromMediation = true;
}
}
else
{
byte[] uuidBytes = get(uuidLength); // BYTE[] Uuid
uuid = new SIBUuid8(uuidBytes);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid:", uuid);
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid was null");
}
/**************************************************************/
/* Destination */
/**************************************************************/
String destinationName = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Destination name:", destinationName);
/**************************************************************/
/* Bus name */
/**************************************************************/
String busName = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Bus name:", busName);
/**************************************************************/
/* Local only */
/**************************************************************/
//Only read from buffer if fap 9 or greater
//Default value if not flown is false for backwards compatibility.
boolean localOnly = false;
if(fapLevel >= JFapChannelConstants.FAP_VERSION_9)
{
final byte localOnlyByte = get();
localOnly = (localOnlyByte == CommsConstants.TRUE_BYTE);
}
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "localOnly: ", localOnly);
// If we get a null UUID, a null name and a null bus name, return null
JsDestinationAddress destAddress = null;
if (uuid == null && destinationName == null && busName == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Both UUID, destination name and bus name were null");
}
else
{
//lohith liberty change
/* if (isFromMediation)
{
destAddress =
((JsDestinationAddressFactory) JsDestinationAddressFactory.getInstance()).
createJsMediationdestinationAddress(destinationName);
}
else*/
{
destAddress =
((JsDestinationAddressFactory) JsDestinationAddressFactory.getInstance()).
createJsDestinationAddress(destinationName,
localOnly,
uuid,
busName);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSIDestinationAddress",destAddress); //469395
return destAddress;
} | [
"public",
"synchronized",
"SIDestinationAddress",
"getSIDestinationAddress",
"(",
"short",
"fapLevel",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getSIDestinationAddress\"",
",",
"Short",
".",
"valueOf",
"(",
"fapLevel",
")",
")",
";",
"//469395",
"checkReleased",
"(",
")",
";",
"boolean",
"isFromMediation",
"=",
"false",
";",
"/**************************************************************/",
"/* Uuid */",
"/**************************************************************/",
"short",
"uuidLength",
"=",
"getShort",
"(",
")",
";",
"// BIT16 Uuid Length",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Uuid length:\"",
",",
"\"\"",
"+",
"uuidLength",
")",
";",
"SIBUuid8",
"uuid",
"=",
"null",
";",
"// Note: In all other cases, a length of -1 would normally indicate a null value.",
"// However, in this case we use a length 0 to inidicate a null value, mainly",
"// because the uuid can not be 0 in length, and using 0 makes the code neater.",
"if",
"(",
"uuidLength",
"!=",
"0",
")",
"{",
"if",
"(",
"uuidLength",
"==",
"1",
")",
"{",
"byte",
"addressFlags",
"=",
"get",
"(",
")",
";",
"if",
"(",
"addressFlags",
"==",
"CommsConstants",
".",
"DESTADDR_ISFROMMEDIATION",
")",
"{",
"isFromMediation",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"byte",
"[",
"]",
"uuidBytes",
"=",
"get",
"(",
"uuidLength",
")",
";",
"// BYTE[] Uuid",
"uuid",
"=",
"new",
"SIBUuid8",
"(",
"uuidBytes",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Uuid:\"",
",",
"uuid",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Uuid was null\"",
")",
";",
"}",
"/**************************************************************/",
"/* Destination */",
"/**************************************************************/",
"String",
"destinationName",
"=",
"getString",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Destination name:\"",
",",
"destinationName",
")",
";",
"/**************************************************************/",
"/* Bus name */",
"/**************************************************************/",
"String",
"busName",
"=",
"getString",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Bus name:\"",
",",
"busName",
")",
";",
"/**************************************************************/",
"/* Local only */",
"/**************************************************************/",
"//Only read from buffer if fap 9 or greater",
"//Default value if not flown is false for backwards compatibility.",
"boolean",
"localOnly",
"=",
"false",
";",
"if",
"(",
"fapLevel",
">=",
"JFapChannelConstants",
".",
"FAP_VERSION_9",
")",
"{",
"final",
"byte",
"localOnlyByte",
"=",
"get",
"(",
")",
";",
"localOnly",
"=",
"(",
"localOnlyByte",
"==",
"CommsConstants",
".",
"TRUE_BYTE",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"localOnly: \"",
",",
"localOnly",
")",
";",
"// If we get a null UUID, a null name and a null bus name, return null",
"JsDestinationAddress",
"destAddress",
"=",
"null",
";",
"if",
"(",
"uuid",
"==",
"null",
"&&",
"destinationName",
"==",
"null",
"&&",
"busName",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Both UUID, destination name and bus name were null\"",
")",
";",
"}",
"else",
"{",
"//lohith liberty change",
"/* if (isFromMediation)\n {\n destAddress =\n ((JsDestinationAddressFactory) JsDestinationAddressFactory.getInstance()).\n createJsMediationdestinationAddress(destinationName);\n }\n else*/",
"{",
"destAddress",
"=",
"(",
"(",
"JsDestinationAddressFactory",
")",
"JsDestinationAddressFactory",
".",
"getInstance",
"(",
")",
")",
".",
"createJsDestinationAddress",
"(",
"destinationName",
",",
"localOnly",
",",
"uuid",
",",
"busName",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getSIDestinationAddress\"",
",",
"destAddress",
")",
";",
"//469395",
"return",
"destAddress",
";",
"}"
] | Reads an SIDestinationAddress from the current position in the byte buffer.
@param fapLevel the FAP level of this connection. Used to decide what information has been flowed down the wire.
@return Returns an SIDestinationAddress | [
"Reads",
"an",
"SIDestinationAddress",
"from",
"the",
"current",
"position",
"in",
"the",
"byte",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L778-L873 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.getSelectionCriteria | public synchronized SelectionCriteria getSelectionCriteria()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSelectionCriteria"); //469395
checkReleased();
SelectorDomain selectorDomain = SelectorDomain.getSelectorDomain(getShort());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Selector domain", selectorDomain);
/**************************************************************/
/* Destination */
/**************************************************************/
String discriminator = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Discriminator:", discriminator);
/**************************************************************/
/* Destination */
/**************************************************************/
String selector = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Selector:", selector);
SelectionCriteria selectionCriteria =
CommsClientServiceFacade.getSelectionCriteriaFactory().createSelectionCriteria(discriminator,
selector,
selectorDomain);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSelectionCriteria"); //469395
return selectionCriteria;
} | java | public synchronized SelectionCriteria getSelectionCriteria()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSelectionCriteria"); //469395
checkReleased();
SelectorDomain selectorDomain = SelectorDomain.getSelectorDomain(getShort());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Selector domain", selectorDomain);
/**************************************************************/
/* Destination */
/**************************************************************/
String discriminator = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Discriminator:", discriminator);
/**************************************************************/
/* Destination */
/**************************************************************/
String selector = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Selector:", selector);
SelectionCriteria selectionCriteria =
CommsClientServiceFacade.getSelectionCriteriaFactory().createSelectionCriteria(discriminator,
selector,
selectorDomain);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSelectionCriteria"); //469395
return selectionCriteria;
} | [
"public",
"synchronized",
"SelectionCriteria",
"getSelectionCriteria",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getSelectionCriteria\"",
")",
";",
"//469395",
"checkReleased",
"(",
")",
";",
"SelectorDomain",
"selectorDomain",
"=",
"SelectorDomain",
".",
"getSelectorDomain",
"(",
"getShort",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Selector domain\"",
",",
"selectorDomain",
")",
";",
"/**************************************************************/",
"/* Destination */",
"/**************************************************************/",
"String",
"discriminator",
"=",
"getString",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Discriminator:\"",
",",
"discriminator",
")",
";",
"/**************************************************************/",
"/* Destination */",
"/**************************************************************/",
"String",
"selector",
"=",
"getString",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Selector:\"",
",",
"selector",
")",
";",
"SelectionCriteria",
"selectionCriteria",
"=",
"CommsClientServiceFacade",
".",
"getSelectionCriteriaFactory",
"(",
")",
".",
"createSelectionCriteria",
"(",
"discriminator",
",",
"selector",
",",
"selectorDomain",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getSelectionCriteria\"",
")",
";",
"//469395",
"return",
"selectionCriteria",
";",
"}"
] | Reads a SelectionCriteria from the current position in the byte buffer.
@return Returns a SelectionCriteria | [
"Reads",
"a",
"SelectionCriteria",
"from",
"the",
"current",
"position",
"in",
"the",
"byte",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L880-L910 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.getXid | public synchronized Xid getXid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getXid");
checkReleased();
int formatId = getInt();
int glidLength = getInt();
byte[] globalTransactionId = get(glidLength);
int blqfLength = getInt();
byte[] branchQualifier = get(blqfLength);
XidProxy xidProxy = new XidProxy(formatId, globalTransactionId, branchQualifier);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getXid", xidProxy);
return xidProxy;
} | java | public synchronized Xid getXid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getXid");
checkReleased();
int formatId = getInt();
int glidLength = getInt();
byte[] globalTransactionId = get(glidLength);
int blqfLength = getInt();
byte[] branchQualifier = get(blqfLength);
XidProxy xidProxy = new XidProxy(formatId, globalTransactionId, branchQualifier);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getXid", xidProxy);
return xidProxy;
} | [
"public",
"synchronized",
"Xid",
"getXid",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getXid\"",
")",
";",
"checkReleased",
"(",
")",
";",
"int",
"formatId",
"=",
"getInt",
"(",
")",
";",
"int",
"glidLength",
"=",
"getInt",
"(",
")",
";",
"byte",
"[",
"]",
"globalTransactionId",
"=",
"get",
"(",
"glidLength",
")",
";",
"int",
"blqfLength",
"=",
"getInt",
"(",
")",
";",
"byte",
"[",
"]",
"branchQualifier",
"=",
"get",
"(",
"blqfLength",
")",
";",
"XidProxy",
"xidProxy",
"=",
"new",
"XidProxy",
"(",
"formatId",
",",
"globalTransactionId",
",",
"branchQualifier",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getXid\"",
",",
"xidProxy",
")",
";",
"return",
"xidProxy",
";",
"}"
] | Reads an Xid from the current position in the buffer.
@return Returns an Xid | [
"Reads",
"an",
"Xid",
"from",
"the",
"current",
"position",
"in",
"the",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L917-L933 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.getMessage | public synchronized SIBusMessage getMessage(CommsConnection commsConnection)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getMessage");
checkReleased();
SIBusMessage mess = null;
// Now build a JsMessage from the returned data. Note that a message length of -1 indicates
// that no message has been returned and a null value should be returned to the caller.
// Get length of JsMessage
int messageLen = (int) getLong();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Message length", messageLen);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Remaining in buffer", receivedBuffer.remaining());
if (messageLen > -1)
{
// Build Message from byte array. If the buffer is backed by an array we should simply
// pass that into MFP rather than copying into a new byte[]
try
{
if (receivedBuffer.hasArray())
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received buffer has a backing array");
mess = JsMessageFactory.getInstance().createInboundJsMessage(receivedBuffer.array(),
receivedBuffer.position() + receivedBuffer.arrayOffset(),
messageLen,
commsConnection);
// Move the position to the end of the message so that any data after the message
// can be got
receivedBuffer.position(receivedBuffer.position() + messageLen);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received buffer does NOT have a backing array");
byte[] messageArray = get(messageLen);
mess = JsMessageFactory.getInstance().createInboundJsMessage(messageArray,
0,
messageLen,
commsConnection);
}
}
catch (Exception e)
{
FFDCFilter.processException(e, CLASS_NAME + ".getMessage", CommsConstants.COMMSBYTEBUFFER_GETMESSAGE_01, this,
new Object[] {"messageLen="+messageLen+", position="+receivedBuffer.position()+", limit="+receivedBuffer.limit() + " " +
(receivedBuffer.hasArray()?"arrayOffset="+receivedBuffer.arrayOffset()+" array.length="+receivedBuffer.array().length:"no backing array")});
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "Unable to create message", e);
dump(this, tc, 100);
}
throw new SIResourceException(e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMessage", mess);
return mess;
} | java | public synchronized SIBusMessage getMessage(CommsConnection commsConnection)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getMessage");
checkReleased();
SIBusMessage mess = null;
// Now build a JsMessage from the returned data. Note that a message length of -1 indicates
// that no message has been returned and a null value should be returned to the caller.
// Get length of JsMessage
int messageLen = (int) getLong();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Message length", messageLen);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Remaining in buffer", receivedBuffer.remaining());
if (messageLen > -1)
{
// Build Message from byte array. If the buffer is backed by an array we should simply
// pass that into MFP rather than copying into a new byte[]
try
{
if (receivedBuffer.hasArray())
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received buffer has a backing array");
mess = JsMessageFactory.getInstance().createInboundJsMessage(receivedBuffer.array(),
receivedBuffer.position() + receivedBuffer.arrayOffset(),
messageLen,
commsConnection);
// Move the position to the end of the message so that any data after the message
// can be got
receivedBuffer.position(receivedBuffer.position() + messageLen);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received buffer does NOT have a backing array");
byte[] messageArray = get(messageLen);
mess = JsMessageFactory.getInstance().createInboundJsMessage(messageArray,
0,
messageLen,
commsConnection);
}
}
catch (Exception e)
{
FFDCFilter.processException(e, CLASS_NAME + ".getMessage", CommsConstants.COMMSBYTEBUFFER_GETMESSAGE_01, this,
new Object[] {"messageLen="+messageLen+", position="+receivedBuffer.position()+", limit="+receivedBuffer.limit() + " " +
(receivedBuffer.hasArray()?"arrayOffset="+receivedBuffer.arrayOffset()+" array.length="+receivedBuffer.array().length:"no backing array")});
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "Unable to create message", e);
dump(this, tc, 100);
}
throw new SIResourceException(e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMessage", mess);
return mess;
} | [
"public",
"synchronized",
"SIBusMessage",
"getMessage",
"(",
"CommsConnection",
"commsConnection",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getMessage\"",
")",
";",
"checkReleased",
"(",
")",
";",
"SIBusMessage",
"mess",
"=",
"null",
";",
"// Now build a JsMessage from the returned data. Note that a message length of -1 indicates",
"// that no message has been returned and a null value should be returned to the caller.",
"// Get length of JsMessage",
"int",
"messageLen",
"=",
"(",
"int",
")",
"getLong",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Message length\"",
",",
"messageLen",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Remaining in buffer\"",
",",
"receivedBuffer",
".",
"remaining",
"(",
")",
")",
";",
"if",
"(",
"messageLen",
">",
"-",
"1",
")",
"{",
"// Build Message from byte array. If the buffer is backed by an array we should simply",
"// pass that into MFP rather than copying into a new byte[]",
"try",
"{",
"if",
"(",
"receivedBuffer",
".",
"hasArray",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Received buffer has a backing array\"",
")",
";",
"mess",
"=",
"JsMessageFactory",
".",
"getInstance",
"(",
")",
".",
"createInboundJsMessage",
"(",
"receivedBuffer",
".",
"array",
"(",
")",
",",
"receivedBuffer",
".",
"position",
"(",
")",
"+",
"receivedBuffer",
".",
"arrayOffset",
"(",
")",
",",
"messageLen",
",",
"commsConnection",
")",
";",
"// Move the position to the end of the message so that any data after the message",
"// can be got",
"receivedBuffer",
".",
"position",
"(",
"receivedBuffer",
".",
"position",
"(",
")",
"+",
"messageLen",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Received buffer does NOT have a backing array\"",
")",
";",
"byte",
"[",
"]",
"messageArray",
"=",
"get",
"(",
"messageLen",
")",
";",
"mess",
"=",
"JsMessageFactory",
".",
"getInstance",
"(",
")",
".",
"createInboundJsMessage",
"(",
"messageArray",
",",
"0",
",",
"messageLen",
",",
"commsConnection",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".getMessage\"",
",",
"CommsConstants",
".",
"COMMSBYTEBUFFER_GETMESSAGE_01",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"\"messageLen=\"",
"+",
"messageLen",
"+",
"\", position=\"",
"+",
"receivedBuffer",
".",
"position",
"(",
")",
"+",
"\", limit=\"",
"+",
"receivedBuffer",
".",
"limit",
"(",
")",
"+",
"\" \"",
"+",
"(",
"receivedBuffer",
".",
"hasArray",
"(",
")",
"?",
"\"arrayOffset=\"",
"+",
"receivedBuffer",
".",
"arrayOffset",
"(",
")",
"+",
"\" array.length=\"",
"+",
"receivedBuffer",
".",
"array",
"(",
")",
".",
"length",
":",
"\"no backing array\"",
")",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Unable to create message\"",
",",
"e",
")",
";",
"dump",
"(",
"this",
",",
"tc",
",",
"100",
")",
";",
"}",
"throw",
"new",
"SIResourceException",
"(",
"e",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMessage\"",
",",
"mess",
")",
";",
"return",
"mess",
";",
"}"
] | Reads an SIBusMessage from the current position in the buffer.
@param commsConnection
@return Returns the message, or null if the message length indicated no message.
@throws SIResourceException | [
"Reads",
"an",
"SIBusMessage",
"from",
"the",
"current",
"position",
"in",
"the",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L944-L1008 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.getSIMessageHandles | public synchronized SIMessageHandle[] getSIMessageHandles()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSIMessageHandles");
int arrayCount = getInt(); // BIT32 ArrayCount
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "arrayCount", arrayCount);
SIMessageHandle[] msgHandles = new SIMessageHandle[arrayCount];
JsMessageHandleFactory jsMsgHandleFactory = JsMessageHandleFactory.getInstance();
// Get arrayCount SIMessageHandles
for (int msgHandleIndex = 0; msgHandleIndex < msgHandles.length; ++msgHandleIndex)
{
long msgHandleValue = getLong();
byte[] msgHandleUuid = get(8);
msgHandles[msgHandleIndex] =
jsMsgHandleFactory.createJsMessageHandle(new SIBUuid8(msgHandleUuid),
msgHandleValue);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSIMessageHandles", msgHandles);
return msgHandles;
} | java | public synchronized SIMessageHandle[] getSIMessageHandles()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSIMessageHandles");
int arrayCount = getInt(); // BIT32 ArrayCount
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "arrayCount", arrayCount);
SIMessageHandle[] msgHandles = new SIMessageHandle[arrayCount];
JsMessageHandleFactory jsMsgHandleFactory = JsMessageHandleFactory.getInstance();
// Get arrayCount SIMessageHandles
for (int msgHandleIndex = 0; msgHandleIndex < msgHandles.length; ++msgHandleIndex)
{
long msgHandleValue = getLong();
byte[] msgHandleUuid = get(8);
msgHandles[msgHandleIndex] =
jsMsgHandleFactory.createJsMessageHandle(new SIBUuid8(msgHandleUuid),
msgHandleValue);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSIMessageHandles", msgHandles);
return msgHandles;
} | [
"public",
"synchronized",
"SIMessageHandle",
"[",
"]",
"getSIMessageHandles",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getSIMessageHandles\"",
")",
";",
"int",
"arrayCount",
"=",
"getInt",
"(",
")",
";",
"// BIT32 ArrayCount",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"arrayCount\"",
",",
"arrayCount",
")",
";",
"SIMessageHandle",
"[",
"]",
"msgHandles",
"=",
"new",
"SIMessageHandle",
"[",
"arrayCount",
"]",
";",
"JsMessageHandleFactory",
"jsMsgHandleFactory",
"=",
"JsMessageHandleFactory",
".",
"getInstance",
"(",
")",
";",
"// Get arrayCount SIMessageHandles",
"for",
"(",
"int",
"msgHandleIndex",
"=",
"0",
";",
"msgHandleIndex",
"<",
"msgHandles",
".",
"length",
";",
"++",
"msgHandleIndex",
")",
"{",
"long",
"msgHandleValue",
"=",
"getLong",
"(",
")",
";",
"byte",
"[",
"]",
"msgHandleUuid",
"=",
"get",
"(",
"8",
")",
";",
"msgHandles",
"[",
"msgHandleIndex",
"]",
"=",
"jsMsgHandleFactory",
".",
"createJsMessageHandle",
"(",
"new",
"SIBUuid8",
"(",
"msgHandleUuid",
")",
",",
"msgHandleValue",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getSIMessageHandles\"",
",",
"msgHandles",
")",
";",
"return",
"msgHandles",
";",
"}"
] | Reads some message handles from the buffer.
@return Returns a array of SIMessageHandle objects | [
"Reads",
"some",
"message",
"handles",
"from",
"the",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L1060-L1084 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.peekInt | public synchronized int peekInt()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "peekInt");
checkReleased();
int result = 0;
if (receivedBuffer != null)
{
int currentPosition = receivedBuffer.position();
result = receivedBuffer.getInt();
receivedBuffer.position(currentPosition);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "peekInt", result);
return result;
} | java | public synchronized int peekInt()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "peekInt");
checkReleased();
int result = 0;
if (receivedBuffer != null)
{
int currentPosition = receivedBuffer.position();
result = receivedBuffer.getInt();
receivedBuffer.position(currentPosition);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "peekInt", result);
return result;
} | [
"public",
"synchronized",
"int",
"peekInt",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"peekInt\"",
")",
";",
"checkReleased",
"(",
")",
";",
"int",
"result",
"=",
"0",
";",
"if",
"(",
"receivedBuffer",
"!=",
"null",
")",
"{",
"int",
"currentPosition",
"=",
"receivedBuffer",
".",
"position",
"(",
")",
";",
"result",
"=",
"receivedBuffer",
".",
"getInt",
"(",
")",
";",
"receivedBuffer",
".",
"position",
"(",
"currentPosition",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"peekInt\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | This method will peek at the next 4 bytes in the buffer and return the result as an int.
The buffer position will be unchanged by calling this method.
@return Returns the next four bytes as an int. | [
"This",
"method",
"will",
"peek",
"at",
"the",
"next",
"4",
"bytes",
"in",
"the",
"buffer",
"and",
"return",
"the",
"result",
"as",
"an",
"int",
".",
"The",
"buffer",
"position",
"will",
"be",
"unchanged",
"by",
"calling",
"this",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L1420-L1436 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.peekLong | public synchronized long peekLong()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "peekLong");
checkReleased();
long result = 0;
if (receivedBuffer != null)
{
int currentPosition = receivedBuffer.position();
result = receivedBuffer.getLong();
receivedBuffer.position(currentPosition);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "peekLong", result);
return result;
} | java | public synchronized long peekLong()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "peekLong");
checkReleased();
long result = 0;
if (receivedBuffer != null)
{
int currentPosition = receivedBuffer.position();
result = receivedBuffer.getLong();
receivedBuffer.position(currentPosition);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "peekLong", result);
return result;
} | [
"public",
"synchronized",
"long",
"peekLong",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"peekLong\"",
")",
";",
"checkReleased",
"(",
")",
";",
"long",
"result",
"=",
"0",
";",
"if",
"(",
"receivedBuffer",
"!=",
"null",
")",
"{",
"int",
"currentPosition",
"=",
"receivedBuffer",
".",
"position",
"(",
")",
";",
"result",
"=",
"receivedBuffer",
".",
"getLong",
"(",
")",
";",
"receivedBuffer",
".",
"position",
"(",
"currentPosition",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"peekLong\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | This method will peek at the next 8 bytes in the buffer and return the result as a long.
The buffer position will be unchanged by calling this method.
@return Returns the next eight bytes as a long. | [
"This",
"method",
"will",
"peek",
"at",
"the",
"next",
"8",
"bytes",
"in",
"the",
"buffer",
"and",
"return",
"the",
"result",
"as",
"a",
"long",
".",
"The",
"buffer",
"position",
"will",
"be",
"unchanged",
"by",
"calling",
"this",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L1444-L1460 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.skip | public synchronized void skip(int lengthToSkip)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "skip", lengthToSkip);
checkReleased();
if (receivedBuffer != null)
{
receivedBuffer.position(receivedBuffer.position() + lengthToSkip);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "skip");
} | java | public synchronized void skip(int lengthToSkip)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "skip", lengthToSkip);
checkReleased();
if (receivedBuffer != null)
{
receivedBuffer.position(receivedBuffer.position() + lengthToSkip);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "skip");
} | [
"public",
"synchronized",
"void",
"skip",
"(",
"int",
"lengthToSkip",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"skip\"",
",",
"lengthToSkip",
")",
";",
"checkReleased",
"(",
")",
";",
"if",
"(",
"receivedBuffer",
"!=",
"null",
")",
"{",
"receivedBuffer",
".",
"position",
"(",
"receivedBuffer",
".",
"position",
"(",
")",
"+",
"lengthToSkip",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"skip\"",
")",
";",
"}"
] | Skips over the specified number of bytes in the received byte buffer.
@param lengthToSkip | [
"Skips",
"over",
"the",
"specified",
"number",
"of",
"bytes",
"in",
"the",
"received",
"byte",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L1467-L1479 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.rewind | public synchronized void rewind()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "rewind");
checkReleased();
if (receivedBuffer != null)
{
receivedBuffer.rewind();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rewind");
} | java | public synchronized void rewind()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "rewind");
checkReleased();
if (receivedBuffer != null)
{
receivedBuffer.rewind();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rewind");
} | [
"public",
"synchronized",
"void",
"rewind",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"rewind\"",
")",
";",
"checkReleased",
"(",
")",
";",
"if",
"(",
"receivedBuffer",
"!=",
"null",
")",
"{",
"receivedBuffer",
".",
"rewind",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"rewind\"",
")",
";",
"}"
] | Rewinds the buffer to the beginning of the received data so that the data can be re-read. | [
"Rewinds",
"the",
"buffer",
"to",
"the",
"beginning",
"of",
"the",
"received",
"data",
"so",
"that",
"the",
"data",
"can",
"be",
"re",
"-",
"read",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L1484-L1496 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.encodeFast | public List<DataSlice> encodeFast(AbstractMessage message, CommsConnection commsConnection, Conversation conversation)
throws MessageEncodeFailedException, SIConnectionDroppedException,
IncorrectMessageTypeException, UnsupportedEncodingException, MessageCopyFailedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "encodeFast",
new Object[]{CommsLightTrace.msgToString(message), commsConnection, CommsLightTrace.minimalToString(conversation)});
if(!message.isControlMessage())
{
// Determine capabilities negotiated at handshake time.
short clientCapabilities = ((CATHandshakeProperties) conversation.getHandshakeProperties()).getCapabilites();
boolean requiresJMF = (clientCapabilities & CommsConstants.CAPABILITIY_REQUIRES_JMF_ENCODING) != 0;
boolean requiresJMS = (clientCapabilities & CommsConstants.CAPABILITIY_REQUIRES_JMS_MESSAGES) != 0;
if (requiresJMF || requiresJMS)
{
// If the client requires that we only send it JMS messages, convert the message.
// As we can only transcribe JMS messages to a JMF encoding - if the client requires
// a JMF encoded message then also apply this conversion.
message = ((JsMessage) message).makeInboundJmsMessage();
}
if (requiresJMF)
{
// If the client requires that we only send it JMF encoded messages, perform the
// appropriate transcription. Note: this assumes the message is a JMS message.
message = ((JsMessage) message).transcribeToJmf();
}
}
List<DataSlice> messageParts = null;
try
{
messageParts = message.encodeFast(commsConnection);
}
catch (MessageEncodeFailedException e)
{
// No FFDC Code Needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Caught a MessageEncodeFailedException from MFP:", e);
// We interrogate the MessageEncodeFailedException to see if it hides a problem which we want to reflect back to our caller
// using a different exception
if (e.getCause() != null) {
if (e.getCause() instanceof SIConnectionDroppedException) { // Was the connection dropped under MFP?
throw new SIConnectionDroppedException(TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "CONVERSATION_CLOSED_SICO0065", null, null));
} else if (e.getCause() instanceof IllegalStateException) { // An IllegalStateException may indicate a dropped connection
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "The linked exception IS an IllegalStateException");
if (conversation.isClosed()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "The conversation was closed - rethrowing as SIConnectionDroppedException");
throw new SIConnectionDroppedException(TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "CONVERSATION_CLOSED_SICO0065", null, null));
}
}
}
throw e;
}
if (TraceComponent.isAnyTracingEnabled())
CommsLightTrace.traceMessageId(tc, "EncodeMsgTrace", message);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "encodeFast", messageParts);
return messageParts;
} | java | public List<DataSlice> encodeFast(AbstractMessage message, CommsConnection commsConnection, Conversation conversation)
throws MessageEncodeFailedException, SIConnectionDroppedException,
IncorrectMessageTypeException, UnsupportedEncodingException, MessageCopyFailedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "encodeFast",
new Object[]{CommsLightTrace.msgToString(message), commsConnection, CommsLightTrace.minimalToString(conversation)});
if(!message.isControlMessage())
{
// Determine capabilities negotiated at handshake time.
short clientCapabilities = ((CATHandshakeProperties) conversation.getHandshakeProperties()).getCapabilites();
boolean requiresJMF = (clientCapabilities & CommsConstants.CAPABILITIY_REQUIRES_JMF_ENCODING) != 0;
boolean requiresJMS = (clientCapabilities & CommsConstants.CAPABILITIY_REQUIRES_JMS_MESSAGES) != 0;
if (requiresJMF || requiresJMS)
{
// If the client requires that we only send it JMS messages, convert the message.
// As we can only transcribe JMS messages to a JMF encoding - if the client requires
// a JMF encoded message then also apply this conversion.
message = ((JsMessage) message).makeInboundJmsMessage();
}
if (requiresJMF)
{
// If the client requires that we only send it JMF encoded messages, perform the
// appropriate transcription. Note: this assumes the message is a JMS message.
message = ((JsMessage) message).transcribeToJmf();
}
}
List<DataSlice> messageParts = null;
try
{
messageParts = message.encodeFast(commsConnection);
}
catch (MessageEncodeFailedException e)
{
// No FFDC Code Needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Caught a MessageEncodeFailedException from MFP:", e);
// We interrogate the MessageEncodeFailedException to see if it hides a problem which we want to reflect back to our caller
// using a different exception
if (e.getCause() != null) {
if (e.getCause() instanceof SIConnectionDroppedException) { // Was the connection dropped under MFP?
throw new SIConnectionDroppedException(TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "CONVERSATION_CLOSED_SICO0065", null, null));
} else if (e.getCause() instanceof IllegalStateException) { // An IllegalStateException may indicate a dropped connection
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "The linked exception IS an IllegalStateException");
if (conversation.isClosed()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "The conversation was closed - rethrowing as SIConnectionDroppedException");
throw new SIConnectionDroppedException(TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "CONVERSATION_CLOSED_SICO0065", null, null));
}
}
}
throw e;
}
if (TraceComponent.isAnyTracingEnabled())
CommsLightTrace.traceMessageId(tc, "EncodeMsgTrace", message);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "encodeFast", messageParts);
return messageParts;
} | [
"public",
"List",
"<",
"DataSlice",
">",
"encodeFast",
"(",
"AbstractMessage",
"message",
",",
"CommsConnection",
"commsConnection",
",",
"Conversation",
"conversation",
")",
"throws",
"MessageEncodeFailedException",
",",
"SIConnectionDroppedException",
",",
"IncorrectMessageTypeException",
",",
"UnsupportedEncodingException",
",",
"MessageCopyFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"encodeFast\"",
",",
"new",
"Object",
"[",
"]",
"{",
"CommsLightTrace",
".",
"msgToString",
"(",
"message",
")",
",",
"commsConnection",
",",
"CommsLightTrace",
".",
"minimalToString",
"(",
"conversation",
")",
"}",
")",
";",
"if",
"(",
"!",
"message",
".",
"isControlMessage",
"(",
")",
")",
"{",
"// Determine capabilities negotiated at handshake time.",
"short",
"clientCapabilities",
"=",
"(",
"(",
"CATHandshakeProperties",
")",
"conversation",
".",
"getHandshakeProperties",
"(",
")",
")",
".",
"getCapabilites",
"(",
")",
";",
"boolean",
"requiresJMF",
"=",
"(",
"clientCapabilities",
"&",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_JMF_ENCODING",
")",
"!=",
"0",
";",
"boolean",
"requiresJMS",
"=",
"(",
"clientCapabilities",
"&",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_JMS_MESSAGES",
")",
"!=",
"0",
";",
"if",
"(",
"requiresJMF",
"||",
"requiresJMS",
")",
"{",
"// If the client requires that we only send it JMS messages, convert the message.",
"// As we can only transcribe JMS messages to a JMF encoding - if the client requires",
"// a JMF encoded message then also apply this conversion.",
"message",
"=",
"(",
"(",
"JsMessage",
")",
"message",
")",
".",
"makeInboundJmsMessage",
"(",
")",
";",
"}",
"if",
"(",
"requiresJMF",
")",
"{",
"// If the client requires that we only send it JMF encoded messages, perform the",
"// appropriate transcription. Note: this assumes the message is a JMS message.",
"message",
"=",
"(",
"(",
"JsMessage",
")",
"message",
")",
".",
"transcribeToJmf",
"(",
")",
";",
"}",
"}",
"List",
"<",
"DataSlice",
">",
"messageParts",
"=",
"null",
";",
"try",
"{",
"messageParts",
"=",
"message",
".",
"encodeFast",
"(",
"commsConnection",
")",
";",
"}",
"catch",
"(",
"MessageEncodeFailedException",
"e",
")",
"{",
"// No FFDC Code Needed",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Caught a MessageEncodeFailedException from MFP:\"",
",",
"e",
")",
";",
"// We interrogate the MessageEncodeFailedException to see if it hides a problem which we want to reflect back to our caller",
"// using a different exception",
"if",
"(",
"e",
".",
"getCause",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"e",
".",
"getCause",
"(",
")",
"instanceof",
"SIConnectionDroppedException",
")",
"{",
"// Was the connection dropped under MFP?",
"throw",
"new",
"SIConnectionDroppedException",
"(",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"CommsConstants",
".",
"MSG_BUNDLE",
",",
"\"CONVERSATION_CLOSED_SICO0065\"",
",",
"null",
",",
"null",
")",
")",
";",
"}",
"else",
"if",
"(",
"e",
".",
"getCause",
"(",
")",
"instanceof",
"IllegalStateException",
")",
"{",
"// An IllegalStateException may indicate a dropped connection",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"The linked exception IS an IllegalStateException\"",
")",
";",
"if",
"(",
"conversation",
".",
"isClosed",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"The conversation was closed - rethrowing as SIConnectionDroppedException\"",
")",
";",
"throw",
"new",
"SIConnectionDroppedException",
"(",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"CommsConstants",
".",
"MSG_BUNDLE",
",",
"\"CONVERSATION_CLOSED_SICO0065\"",
",",
"null",
",",
"null",
")",
")",
";",
"}",
"}",
"}",
"throw",
"e",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
")",
"CommsLightTrace",
".",
"traceMessageId",
"(",
"tc",
",",
"\"EncodeMsgTrace\"",
",",
"message",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"encodeFast\"",
",",
"messageParts",
")",
";",
"return",
"messageParts",
";",
"}"
] | This method actually does the fast encode on a JsMessage message.
@param message The message to encode
@param commsConnection
@param conversation The conversation that the encoded message will be sent
@return Returns a list of MessagePart objects.
@throws SIConnectionDroppedException if the connection has gone at the time of encode
@throws IncorrectMessageTypeException
@throws MessageCopyFailedException
@throws MessageEncodeFailedException
@throws UnsupportedEncodingException | [
"This",
"method",
"actually",
"does",
"the",
"fast",
"encode",
"on",
"a",
"JsMessage",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L1569-L1632 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.calculateEncodedStringLength | public static int calculateEncodedStringLength(String s)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "calculateEncodedStringLength", s);
final int length;
if(s == null)
{
length = 3;
}
else
{
try
{
final byte[] stringAsBytes = s.getBytes(stringEncoding);
length = stringAsBytes.length + 2;
}
catch (UnsupportedEncodingException e)
{
FFDCFilter.processException(e, CLASS_NAME + ".calculateEncodedStringLength", CommsConstants.COMMSBYTEBUFFER_CALC_ENC_STRLEN_01);
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to encode String: ", e);
SibTr.error(tc, "UNSUPPORTED_STRING_ENCODING_SICO8023", new Object[] {stringEncoding, e});
throw new SIErrorException(
TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "UNSUPPORTED_STRING_ENCODING_SICO8023", new Object[] {stringEncoding, e}, null)
);
}
}
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "calculateEncodedStringLength", Integer.valueOf(length));
return length;
} | java | public static int calculateEncodedStringLength(String s)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "calculateEncodedStringLength", s);
final int length;
if(s == null)
{
length = 3;
}
else
{
try
{
final byte[] stringAsBytes = s.getBytes(stringEncoding);
length = stringAsBytes.length + 2;
}
catch (UnsupportedEncodingException e)
{
FFDCFilter.processException(e, CLASS_NAME + ".calculateEncodedStringLength", CommsConstants.COMMSBYTEBUFFER_CALC_ENC_STRLEN_01);
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to encode String: ", e);
SibTr.error(tc, "UNSUPPORTED_STRING_ENCODING_SICO8023", new Object[] {stringEncoding, e});
throw new SIErrorException(
TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "UNSUPPORTED_STRING_ENCODING_SICO8023", new Object[] {stringEncoding, e}, null)
);
}
}
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "calculateEncodedStringLength", Integer.valueOf(length));
return length;
} | [
"public",
"static",
"int",
"calculateEncodedStringLength",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"calculateEncodedStringLength\"",
",",
"s",
")",
";",
"final",
"int",
"length",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"length",
"=",
"3",
";",
"}",
"else",
"{",
"try",
"{",
"final",
"byte",
"[",
"]",
"stringAsBytes",
"=",
"s",
".",
"getBytes",
"(",
"stringEncoding",
")",
";",
"length",
"=",
"stringAsBytes",
".",
"length",
"+",
"2",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".calculateEncodedStringLength\"",
",",
"CommsConstants",
".",
"COMMSBYTEBUFFER_CALC_ENC_STRLEN_01",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Unable to encode String: \"",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"UNSUPPORTED_STRING_ENCODING_SICO8023\"",
",",
"new",
"Object",
"[",
"]",
"{",
"stringEncoding",
",",
"e",
"}",
")",
";",
"throw",
"new",
"SIErrorException",
"(",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"CommsConstants",
".",
"MSG_BUNDLE",
",",
"\"UNSUPPORTED_STRING_ENCODING_SICO8023\"",
",",
"new",
"Object",
"[",
"]",
"{",
"stringEncoding",
",",
"e",
"}",
",",
"null",
")",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"calculateEncodedStringLength\"",
",",
"Integer",
".",
"valueOf",
"(",
"length",
")",
")",
";",
"return",
"length",
";",
"}"
] | Calculates the length in bytes of a String when it is placed inside a CommsByteBuffer via the putString method.
A null String can be passed into this method.
@param s the String to calculate the length of.
@return the number of bytes that the String will take up when encoded. | [
"Calculates",
"the",
"length",
"in",
"bytes",
"of",
"a",
"String",
"when",
"it",
"is",
"placed",
"inside",
"a",
"CommsByteBuffer",
"via",
"the",
"putString",
"method",
".",
"A",
"null",
"String",
"can",
"be",
"passed",
"into",
"this",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L2119-L2152 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.getBoolean | public synchronized boolean getBoolean()
{
final byte value = get();
if(value == CommsConstants.TRUE_BYTE) return true;
else if(value == CommsConstants.FALSE_BYTE) return false;
else throw new IllegalStateException("Unexpected byte: " + value);
} | java | public synchronized boolean getBoolean()
{
final byte value = get();
if(value == CommsConstants.TRUE_BYTE) return true;
else if(value == CommsConstants.FALSE_BYTE) return false;
else throw new IllegalStateException("Unexpected byte: " + value);
} | [
"public",
"synchronized",
"boolean",
"getBoolean",
"(",
")",
"{",
"final",
"byte",
"value",
"=",
"get",
"(",
")",
";",
"if",
"(",
"value",
"==",
"CommsConstants",
".",
"TRUE_BYTE",
")",
"return",
"true",
";",
"else",
"if",
"(",
"value",
"==",
"CommsConstants",
".",
"FALSE_BYTE",
")",
"return",
"false",
";",
"else",
"throw",
"new",
"IllegalStateException",
"(",
"\"Unexpected byte: \"",
"+",
"value",
")",
";",
"}"
] | Returns the next value in the buffer interpreted as a boolean. Should only be called when
the next byte in the buffer was written by a call to putBoolean.
@return the next value in the buffer interpreted as a boolean. | [
"Returns",
"the",
"next",
"value",
"in",
"the",
"buffer",
"interpreted",
"as",
"a",
"boolean",
".",
"Should",
"only",
"be",
"called",
"when",
"the",
"next",
"byte",
"in",
"the",
"buffer",
"was",
"written",
"by",
"a",
"call",
"to",
"putBoolean",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L2170-L2176 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java | BootstrapConfig.assertDirectory | protected File assertDirectory(String dirName, String locName) {
File d = new File(dirName);
if (d.isFile())
throw new LocationException("Path must reference a directory", MessageFormat.format(BootstrapConstants.messages.getString("error.specifiedLocation"), locName,
d.getAbsolutePath()));
return d;
} | java | protected File assertDirectory(String dirName, String locName) {
File d = new File(dirName);
if (d.isFile())
throw new LocationException("Path must reference a directory", MessageFormat.format(BootstrapConstants.messages.getString("error.specifiedLocation"), locName,
d.getAbsolutePath()));
return d;
} | [
"protected",
"File",
"assertDirectory",
"(",
"String",
"dirName",
",",
"String",
"locName",
")",
"{",
"File",
"d",
"=",
"new",
"File",
"(",
"dirName",
")",
";",
"if",
"(",
"d",
".",
"isFile",
"(",
")",
")",
"throw",
"new",
"LocationException",
"(",
"\"Path must reference a directory\"",
",",
"MessageFormat",
".",
"format",
"(",
"BootstrapConstants",
".",
"messages",
".",
"getString",
"(",
"\"error.specifiedLocation\"",
")",
",",
"locName",
",",
"d",
".",
"getAbsolutePath",
"(",
")",
")",
")",
";",
"return",
"d",
";",
"}"
] | Ensure that the given directory either does not yet exists,
or exists as a directory.
@param dirName
Name/path to directory
@param locName
Symbol/location associated with directory
@return File for directory location
@throws LocationException
if dirName references an existing File (isFile). | [
"Ensure",
"that",
"the",
"given",
"directory",
"either",
"does",
"not",
"yet",
"exists",
"or",
"exists",
"as",
"a",
"directory",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L372-L378 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java | BootstrapConfig.substituteSymbols | protected void substituteSymbols(Map<String, String> initProps) {
for (Entry<String, String> entry : initProps.entrySet()) {
Object value = entry.getValue();
if (value instanceof String) {
String strValue = (String) value;
Matcher m = SYMBOL_DEF.matcher(strValue);
int i = 0;
while (m.find() && i++ < 4) {
String symbol = m.group(1);
Object expansion = initProps.get(symbol);
if (expansion != null && expansion instanceof String) {
strValue = strValue.replace(m.group(0), (String) expansion);
entry.setValue(strValue);
}
}
}
}
} | java | protected void substituteSymbols(Map<String, String> initProps) {
for (Entry<String, String> entry : initProps.entrySet()) {
Object value = entry.getValue();
if (value instanceof String) {
String strValue = (String) value;
Matcher m = SYMBOL_DEF.matcher(strValue);
int i = 0;
while (m.find() && i++ < 4) {
String symbol = m.group(1);
Object expansion = initProps.get(symbol);
if (expansion != null && expansion instanceof String) {
strValue = strValue.replace(m.group(0), (String) expansion);
entry.setValue(strValue);
}
}
}
}
} | [
"protected",
"void",
"substituteSymbols",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"initProps",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"initProps",
".",
"entrySet",
"(",
")",
")",
"{",
"Object",
"value",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"instanceof",
"String",
")",
"{",
"String",
"strValue",
"=",
"(",
"String",
")",
"value",
";",
"Matcher",
"m",
"=",
"SYMBOL_DEF",
".",
"matcher",
"(",
"strValue",
")",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"m",
".",
"find",
"(",
")",
"&&",
"i",
"++",
"<",
"4",
")",
"{",
"String",
"symbol",
"=",
"m",
".",
"group",
"(",
"1",
")",
";",
"Object",
"expansion",
"=",
"initProps",
".",
"get",
"(",
"symbol",
")",
";",
"if",
"(",
"expansion",
"!=",
"null",
"&&",
"expansion",
"instanceof",
"String",
")",
"{",
"strValue",
"=",
"strValue",
".",
"replace",
"(",
"m",
".",
"group",
"(",
"0",
")",
",",
"(",
"String",
")",
"expansion",
")",
";",
"entry",
".",
"setValue",
"(",
"strValue",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Perform substitution of symbols used in config
@param initProps | [
"Perform",
"substitution",
"of",
"symbols",
"used",
"in",
"config"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L748-L765 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java | BootstrapConfig.checkCleanStart | public boolean checkCleanStart() {
String fwClean = get(BootstrapConstants.INITPROP_OSGI_CLEAN);
if (fwClean != null && fwClean.equals(BootstrapConstants.OSGI_CLEAN_VALUE)) {
return true;
}
String osgiClean = get(BootstrapConstants.OSGI_CLEAN);
return Boolean.valueOf(osgiClean);
} | java | public boolean checkCleanStart() {
String fwClean = get(BootstrapConstants.INITPROP_OSGI_CLEAN);
if (fwClean != null && fwClean.equals(BootstrapConstants.OSGI_CLEAN_VALUE)) {
return true;
}
String osgiClean = get(BootstrapConstants.OSGI_CLEAN);
return Boolean.valueOf(osgiClean);
} | [
"public",
"boolean",
"checkCleanStart",
"(",
")",
"{",
"String",
"fwClean",
"=",
"get",
"(",
"BootstrapConstants",
".",
"INITPROP_OSGI_CLEAN",
")",
";",
"if",
"(",
"fwClean",
"!=",
"null",
"&&",
"fwClean",
".",
"equals",
"(",
"BootstrapConstants",
".",
"OSGI_CLEAN_VALUE",
")",
")",
"{",
"return",
"true",
";",
"}",
"String",
"osgiClean",
"=",
"get",
"(",
"BootstrapConstants",
".",
"OSGI_CLEAN",
")",
";",
"return",
"Boolean",
".",
"valueOf",
"(",
"osgiClean",
")",
";",
"}"
] | Check osgi clean start properties, ensure set correctly for clean start
@see forceCleanStart | [
"Check",
"osgi",
"clean",
"start",
"properties",
"ensure",
"set",
"correctly",
"for",
"clean",
"start"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L1065-L1073 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java | BootstrapConfig.generateServerEnv | protected ReturnCode generateServerEnv(boolean generatePassword) {
double jvmLevel;
String s = null;
try {
s = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<String>() {
@Override
public String run() throws Exception {
String javaSpecVersion = System.getProperty("java.specification.version");
return javaSpecVersion;
}
});
jvmLevel = Double.parseDouble(s);
} catch (Exception ex) {
// If we get here, it is most likely because the java.specification.version property
// is not a valid double. Return bad java version
throw new LaunchException("Invalid java.specification.version, " + s, MessageFormat.format(BootstrapConstants.messages.getString("error.create.unknownJavaLevel"),
s), ex, ReturnCode.ERROR_BAD_JAVA_VERSION);
}
BufferedWriter bw = null;
File serverEnv = getConfigFile("server.env");
try {
char[] keystorePass = PasswordGenerator.generateRandom();
String serverEnvContents = FileUtils.readFile(serverEnv);
String toWrite = "";
if (generatePassword && (serverEnvContents == null || !serverEnvContents.contains("keystore_password="))) {
if (serverEnvContents != null)
toWrite += System.getProperty("line.separator");
toWrite += "keystore_password=" + new String(keystorePass);
}
if (jvmLevel >= 1.8 && (serverEnvContents == null || !serverEnvContents.contains("WLP_SKIP_MAXPERMSIZE="))) {
if (serverEnvContents != null || !toWrite.isEmpty())
toWrite += System.getProperty("line.separator");
toWrite += "WLP_SKIP_MAXPERMSIZE=true";
}
if (serverEnvContents == null)
FileUtils.createFile(serverEnv, new ByteArrayInputStream(toWrite.getBytes("UTF-8")));
else
FileUtils.appendFile(serverEnv, new ByteArrayInputStream(toWrite.getBytes("UTF-8")));
} catch (IOException ex) {
throw new LaunchException("Failed to create/update the server.env file for this server", MessageFormat.format(BootstrapConstants.messages.getString("error.create.java8serverenv"),
serverEnv.getAbsolutePath()), ex, ReturnCode.LAUNCH_EXCEPTION);
} finally {
if (bw != null) {
try {
bw.close();
} catch (IOException ex) {
}
}
}
return ReturnCode.OK;
} | java | protected ReturnCode generateServerEnv(boolean generatePassword) {
double jvmLevel;
String s = null;
try {
s = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<String>() {
@Override
public String run() throws Exception {
String javaSpecVersion = System.getProperty("java.specification.version");
return javaSpecVersion;
}
});
jvmLevel = Double.parseDouble(s);
} catch (Exception ex) {
// If we get here, it is most likely because the java.specification.version property
// is not a valid double. Return bad java version
throw new LaunchException("Invalid java.specification.version, " + s, MessageFormat.format(BootstrapConstants.messages.getString("error.create.unknownJavaLevel"),
s), ex, ReturnCode.ERROR_BAD_JAVA_VERSION);
}
BufferedWriter bw = null;
File serverEnv = getConfigFile("server.env");
try {
char[] keystorePass = PasswordGenerator.generateRandom();
String serverEnvContents = FileUtils.readFile(serverEnv);
String toWrite = "";
if (generatePassword && (serverEnvContents == null || !serverEnvContents.contains("keystore_password="))) {
if (serverEnvContents != null)
toWrite += System.getProperty("line.separator");
toWrite += "keystore_password=" + new String(keystorePass);
}
if (jvmLevel >= 1.8 && (serverEnvContents == null || !serverEnvContents.contains("WLP_SKIP_MAXPERMSIZE="))) {
if (serverEnvContents != null || !toWrite.isEmpty())
toWrite += System.getProperty("line.separator");
toWrite += "WLP_SKIP_MAXPERMSIZE=true";
}
if (serverEnvContents == null)
FileUtils.createFile(serverEnv, new ByteArrayInputStream(toWrite.getBytes("UTF-8")));
else
FileUtils.appendFile(serverEnv, new ByteArrayInputStream(toWrite.getBytes("UTF-8")));
} catch (IOException ex) {
throw new LaunchException("Failed to create/update the server.env file for this server", MessageFormat.format(BootstrapConstants.messages.getString("error.create.java8serverenv"),
serverEnv.getAbsolutePath()), ex, ReturnCode.LAUNCH_EXCEPTION);
} finally {
if (bw != null) {
try {
bw.close();
} catch (IOException ex) {
}
}
}
return ReturnCode.OK;
} | [
"protected",
"ReturnCode",
"generateServerEnv",
"(",
"boolean",
"generatePassword",
")",
"{",
"double",
"jvmLevel",
";",
"String",
"s",
"=",
"null",
";",
"try",
"{",
"s",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"java",
".",
"security",
".",
"PrivilegedExceptionAction",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"run",
"(",
")",
"throws",
"Exception",
"{",
"String",
"javaSpecVersion",
"=",
"System",
".",
"getProperty",
"(",
"\"java.specification.version\"",
")",
";",
"return",
"javaSpecVersion",
";",
"}",
"}",
")",
";",
"jvmLevel",
"=",
"Double",
".",
"parseDouble",
"(",
"s",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"// If we get here, it is most likely because the java.specification.version property",
"// is not a valid double. Return bad java version",
"throw",
"new",
"LaunchException",
"(",
"\"Invalid java.specification.version, \"",
"+",
"s",
",",
"MessageFormat",
".",
"format",
"(",
"BootstrapConstants",
".",
"messages",
".",
"getString",
"(",
"\"error.create.unknownJavaLevel\"",
")",
",",
"s",
")",
",",
"ex",
",",
"ReturnCode",
".",
"ERROR_BAD_JAVA_VERSION",
")",
";",
"}",
"BufferedWriter",
"bw",
"=",
"null",
";",
"File",
"serverEnv",
"=",
"getConfigFile",
"(",
"\"server.env\"",
")",
";",
"try",
"{",
"char",
"[",
"]",
"keystorePass",
"=",
"PasswordGenerator",
".",
"generateRandom",
"(",
")",
";",
"String",
"serverEnvContents",
"=",
"FileUtils",
".",
"readFile",
"(",
"serverEnv",
")",
";",
"String",
"toWrite",
"=",
"\"\"",
";",
"if",
"(",
"generatePassword",
"&&",
"(",
"serverEnvContents",
"==",
"null",
"||",
"!",
"serverEnvContents",
".",
"contains",
"(",
"\"keystore_password=\"",
")",
")",
")",
"{",
"if",
"(",
"serverEnvContents",
"!=",
"null",
")",
"toWrite",
"+=",
"System",
".",
"getProperty",
"(",
"\"line.separator\"",
")",
";",
"toWrite",
"+=",
"\"keystore_password=\"",
"+",
"new",
"String",
"(",
"keystorePass",
")",
";",
"}",
"if",
"(",
"jvmLevel",
">=",
"1.8",
"&&",
"(",
"serverEnvContents",
"==",
"null",
"||",
"!",
"serverEnvContents",
".",
"contains",
"(",
"\"WLP_SKIP_MAXPERMSIZE=\"",
")",
")",
")",
"{",
"if",
"(",
"serverEnvContents",
"!=",
"null",
"||",
"!",
"toWrite",
".",
"isEmpty",
"(",
")",
")",
"toWrite",
"+=",
"System",
".",
"getProperty",
"(",
"\"line.separator\"",
")",
";",
"toWrite",
"+=",
"\"WLP_SKIP_MAXPERMSIZE=true\"",
";",
"}",
"if",
"(",
"serverEnvContents",
"==",
"null",
")",
"FileUtils",
".",
"createFile",
"(",
"serverEnv",
",",
"new",
"ByteArrayInputStream",
"(",
"toWrite",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
")",
")",
";",
"else",
"FileUtils",
".",
"appendFile",
"(",
"serverEnv",
",",
"new",
"ByteArrayInputStream",
"(",
"toWrite",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"LaunchException",
"(",
"\"Failed to create/update the server.env file for this server\"",
",",
"MessageFormat",
".",
"format",
"(",
"BootstrapConstants",
".",
"messages",
".",
"getString",
"(",
"\"error.create.java8serverenv\"",
")",
",",
"serverEnv",
".",
"getAbsolutePath",
"(",
")",
")",
",",
"ex",
",",
"ReturnCode",
".",
"LAUNCH_EXCEPTION",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"bw",
"!=",
"null",
")",
"{",
"try",
"{",
"bw",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"}",
"}",
"}",
"return",
"ReturnCode",
".",
"OK",
";",
"}"
] | For Java 8 and newer JVMs, the PermGen command line parameter is no
longer supported. This method checks the Java level and if it is
less than Java 8, it simply returns OK. If it is Java 8 or higher,
this method will attempt to create a server.env file with
@param bootProps
@return | [
"For",
"Java",
"8",
"and",
"newer",
"JVMs",
"the",
"PermGen",
"command",
"line",
"parameter",
"is",
"no",
"longer",
"supported",
".",
"This",
"method",
"checks",
"the",
"Java",
"level",
"and",
"if",
"it",
"is",
"less",
"than",
"Java",
"8",
"it",
"simply",
"returns",
"OK",
".",
"If",
"it",
"is",
"Java",
"8",
"or",
"higher",
"this",
"method",
"will",
"attempt",
"to",
"create",
"a",
"server",
".",
"env",
"file",
"with"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L1145-L1198 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java | ProbeMethodAdapter.setProbeListeners | protected void setProbeListeners(ProbeImpl probe, Collection<ProbeListener> listeners) {
Set<ProbeListener> enabled = enabledProbes.get(probe);
if (enabled == null) {
enabled = new HashSet<ProbeListener>();
enabledProbes.put(probe, enabled);
}
enabled.addAll(listeners);
} | java | protected void setProbeListeners(ProbeImpl probe, Collection<ProbeListener> listeners) {
Set<ProbeListener> enabled = enabledProbes.get(probe);
if (enabled == null) {
enabled = new HashSet<ProbeListener>();
enabledProbes.put(probe, enabled);
}
enabled.addAll(listeners);
} | [
"protected",
"void",
"setProbeListeners",
"(",
"ProbeImpl",
"probe",
",",
"Collection",
"<",
"ProbeListener",
">",
"listeners",
")",
"{",
"Set",
"<",
"ProbeListener",
">",
"enabled",
"=",
"enabledProbes",
".",
"get",
"(",
"probe",
")",
";",
"if",
"(",
"enabled",
"==",
"null",
")",
"{",
"enabled",
"=",
"new",
"HashSet",
"<",
"ProbeListener",
">",
"(",
")",
";",
"enabledProbes",
".",
"put",
"(",
"probe",
",",
"enabled",
")",
";",
"}",
"enabled",
".",
"addAll",
"(",
"listeners",
")",
";",
"}"
] | Associate a collection of listeners with the specified probe.
@param probe the injected probe
@param listeners the listeners that will receive events from the
injected probe | [
"Associate",
"a",
"collection",
"of",
"listeners",
"with",
"the",
"specified",
"probe",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java#L216-L223 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java | ProbeMethodAdapter.getProbeListeners | protected Set<ProbeListener> getProbeListeners(ProbeImpl probe) {
Set<ProbeListener> listeners = enabledProbes.get(probe);
if (listeners == null) {
listeners = Collections.emptySet();
}
return listeners;
} | java | protected Set<ProbeListener> getProbeListeners(ProbeImpl probe) {
Set<ProbeListener> listeners = enabledProbes.get(probe);
if (listeners == null) {
listeners = Collections.emptySet();
}
return listeners;
} | [
"protected",
"Set",
"<",
"ProbeListener",
">",
"getProbeListeners",
"(",
"ProbeImpl",
"probe",
")",
"{",
"Set",
"<",
"ProbeListener",
">",
"listeners",
"=",
"enabledProbes",
".",
"get",
"(",
"probe",
")",
";",
"if",
"(",
"listeners",
"==",
"null",
")",
"{",
"listeners",
"=",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}",
"return",
"listeners",
";",
"}"
] | Get the set of probe listeners that have been associated with the
specified probe by this adapter.
@param probe the associated probe
@return the set of listeners associated with {@code probe} | [
"Get",
"the",
"set",
"of",
"probe",
"listeners",
"that",
"have",
"been",
"associated",
"with",
"the",
"specified",
"probe",
"by",
"this",
"adapter",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java#L242-L248 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java | ProbeMethodAdapter.unbox | protected void unbox(final Type type) {
switch (type.getSort()) {
case Type.BOOLEAN:
visitTypeInsn(CHECKCAST, "java/lang/Boolean");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false);
break;
case Type.BYTE:
visitTypeInsn(CHECKCAST, "java/lang/Byte");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B", false);
break;
case Type.CHAR:
visitTypeInsn(CHECKCAST, "java/lang/Character");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C", false);
break;
case Type.DOUBLE:
visitTypeInsn(CHECKCAST, "java/lang/Double");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D", false);
break;
case Type.FLOAT:
visitTypeInsn(CHECKCAST, "java/lang/Float");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F", false);
break;
case Type.INT:
visitTypeInsn(CHECKCAST, "java/lang/Integer");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false);
break;
case Type.LONG:
visitTypeInsn(CHECKCAST, "java/lang/Long");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false);
break;
case Type.SHORT:
visitTypeInsn(CHECKCAST, "java/lang/Short");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S", false);
break;
case Type.ARRAY:
case Type.OBJECT:
visitTypeInsn(CHECKCAST, type.getInternalName());
break;
default:
break;
}
} | java | protected void unbox(final Type type) {
switch (type.getSort()) {
case Type.BOOLEAN:
visitTypeInsn(CHECKCAST, "java/lang/Boolean");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false);
break;
case Type.BYTE:
visitTypeInsn(CHECKCAST, "java/lang/Byte");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B", false);
break;
case Type.CHAR:
visitTypeInsn(CHECKCAST, "java/lang/Character");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C", false);
break;
case Type.DOUBLE:
visitTypeInsn(CHECKCAST, "java/lang/Double");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D", false);
break;
case Type.FLOAT:
visitTypeInsn(CHECKCAST, "java/lang/Float");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F", false);
break;
case Type.INT:
visitTypeInsn(CHECKCAST, "java/lang/Integer");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false);
break;
case Type.LONG:
visitTypeInsn(CHECKCAST, "java/lang/Long");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false);
break;
case Type.SHORT:
visitTypeInsn(CHECKCAST, "java/lang/Short");
visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S", false);
break;
case Type.ARRAY:
case Type.OBJECT:
visitTypeInsn(CHECKCAST, type.getInternalName());
break;
default:
break;
}
} | [
"protected",
"void",
"unbox",
"(",
"final",
"Type",
"type",
")",
"{",
"switch",
"(",
"type",
".",
"getSort",
"(",
")",
")",
"{",
"case",
"Type",
".",
"BOOLEAN",
":",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"\"java/lang/Boolean\"",
")",
";",
"visitMethodInsn",
"(",
"INVOKEVIRTUAL",
",",
"\"java/lang/Boolean\"",
",",
"\"booleanValue\"",
",",
"\"()Z\"",
",",
"false",
")",
";",
"break",
";",
"case",
"Type",
".",
"BYTE",
":",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"\"java/lang/Byte\"",
")",
";",
"visitMethodInsn",
"(",
"INVOKEVIRTUAL",
",",
"\"java/lang/Byte\"",
",",
"\"byteValue\"",
",",
"\"()B\"",
",",
"false",
")",
";",
"break",
";",
"case",
"Type",
".",
"CHAR",
":",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"\"java/lang/Character\"",
")",
";",
"visitMethodInsn",
"(",
"INVOKEVIRTUAL",
",",
"\"java/lang/Character\"",
",",
"\"charValue\"",
",",
"\"()C\"",
",",
"false",
")",
";",
"break",
";",
"case",
"Type",
".",
"DOUBLE",
":",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"\"java/lang/Double\"",
")",
";",
"visitMethodInsn",
"(",
"INVOKEVIRTUAL",
",",
"\"java/lang/Double\"",
",",
"\"doubleValue\"",
",",
"\"()D\"",
",",
"false",
")",
";",
"break",
";",
"case",
"Type",
".",
"FLOAT",
":",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"\"java/lang/Float\"",
")",
";",
"visitMethodInsn",
"(",
"INVOKEVIRTUAL",
",",
"\"java/lang/Float\"",
",",
"\"floatValue\"",
",",
"\"()F\"",
",",
"false",
")",
";",
"break",
";",
"case",
"Type",
".",
"INT",
":",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"\"java/lang/Integer\"",
")",
";",
"visitMethodInsn",
"(",
"INVOKEVIRTUAL",
",",
"\"java/lang/Integer\"",
",",
"\"intValue\"",
",",
"\"()I\"",
",",
"false",
")",
";",
"break",
";",
"case",
"Type",
".",
"LONG",
":",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"\"java/lang/Long\"",
")",
";",
"visitMethodInsn",
"(",
"INVOKEVIRTUAL",
",",
"\"java/lang/Long\"",
",",
"\"longValue\"",
",",
"\"()J\"",
",",
"false",
")",
";",
"break",
";",
"case",
"Type",
".",
"SHORT",
":",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"\"java/lang/Short\"",
")",
";",
"visitMethodInsn",
"(",
"INVOKEVIRTUAL",
",",
"\"java/lang/Short\"",
",",
"\"shortValue\"",
",",
"\"()S\"",
",",
"false",
")",
";",
"break",
";",
"case",
"Type",
".",
"ARRAY",
":",
"case",
"Type",
".",
"OBJECT",
":",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"type",
".",
"getInternalName",
"(",
")",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}"
] | Generate the instruction sequence needed to "unbox" the boxed data at
the top of stack.
@param type the <code>Type</code> associated with the unboxed data | [
"Generate",
"the",
"instruction",
"sequence",
"needed",
"to",
"unbox",
"the",
"boxed",
"data",
"at",
"the",
"top",
"of",
"stack",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java#L433-L474 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java | ProbeMethodAdapter.replaceArgsWithArray | void replaceArgsWithArray(String desc) {
Type[] methodArgs = Type.getArgumentTypes(desc);
createObjectArray(methodArgs.length); // [target] args... array
for (int i = methodArgs.length - 1; i >= 0; i--) {
if (methodArgs[i].getSize() == 2) {
visitInsn(DUP_X2); // [target] args... array arg_arg array
visitLdcInsn(Integer.valueOf(i)); // [target] args... array arg_arg array idx
visitInsn(DUP2_X2); // [target] args... array array idx arg_arg array idx
visitInsn(POP2); // [target] args... array array idx arg_arg
} else {
visitInsn(DUP_X1); // [target] args... array arg array
visitInsn(SWAP); // [target] args... array array arg
visitLdcInsn(Integer.valueOf(i)); // [target] args... array array arg idx
visitInsn(SWAP); // [target] args... array array idx arg
}
box(methodArgs[i]); // [target] args... array array idx boxed
visitInsn(AASTORE); // [target] args... array
} // [target] array
} | java | void replaceArgsWithArray(String desc) {
Type[] methodArgs = Type.getArgumentTypes(desc);
createObjectArray(methodArgs.length); // [target] args... array
for (int i = methodArgs.length - 1; i >= 0; i--) {
if (methodArgs[i].getSize() == 2) {
visitInsn(DUP_X2); // [target] args... array arg_arg array
visitLdcInsn(Integer.valueOf(i)); // [target] args... array arg_arg array idx
visitInsn(DUP2_X2); // [target] args... array array idx arg_arg array idx
visitInsn(POP2); // [target] args... array array idx arg_arg
} else {
visitInsn(DUP_X1); // [target] args... array arg array
visitInsn(SWAP); // [target] args... array array arg
visitLdcInsn(Integer.valueOf(i)); // [target] args... array array arg idx
visitInsn(SWAP); // [target] args... array array idx arg
}
box(methodArgs[i]); // [target] args... array array idx boxed
visitInsn(AASTORE); // [target] args... array
} // [target] array
} | [
"void",
"replaceArgsWithArray",
"(",
"String",
"desc",
")",
"{",
"Type",
"[",
"]",
"methodArgs",
"=",
"Type",
".",
"getArgumentTypes",
"(",
"desc",
")",
";",
"createObjectArray",
"(",
"methodArgs",
".",
"length",
")",
";",
"// [target] args... array",
"for",
"(",
"int",
"i",
"=",
"methodArgs",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"methodArgs",
"[",
"i",
"]",
".",
"getSize",
"(",
")",
"==",
"2",
")",
"{",
"visitInsn",
"(",
"DUP_X2",
")",
";",
"// [target] args... array arg_arg array",
"visitLdcInsn",
"(",
"Integer",
".",
"valueOf",
"(",
"i",
")",
")",
";",
"// [target] args... array arg_arg array idx",
"visitInsn",
"(",
"DUP2_X2",
")",
";",
"// [target] args... array array idx arg_arg array idx",
"visitInsn",
"(",
"POP2",
")",
";",
"// [target] args... array array idx arg_arg",
"}",
"else",
"{",
"visitInsn",
"(",
"DUP_X1",
")",
";",
"// [target] args... array arg array",
"visitInsn",
"(",
"SWAP",
")",
";",
"// [target] args... array array arg",
"visitLdcInsn",
"(",
"Integer",
".",
"valueOf",
"(",
"i",
")",
")",
";",
"// [target] args... array array arg idx",
"visitInsn",
"(",
"SWAP",
")",
";",
"// [target] args... array array idx arg",
"}",
"box",
"(",
"methodArgs",
"[",
"i",
"]",
")",
";",
"// [target] args... array array idx boxed",
"visitInsn",
"(",
"AASTORE",
")",
";",
"// [target] args... array",
"}",
"// [target] array",
"}"
] | Create an object array and store the target method arguments in it.
@param desc the target method descriptor | [
"Create",
"an",
"object",
"array",
"and",
"store",
"the",
"target",
"method",
"arguments",
"in",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java#L510-L528 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java | ProbeMethodAdapter.restoreArgsFromArray | void restoreArgsFromArray(String desc) {
Type[] methodArgs = Type.getArgumentTypes(desc);
for (int i = 0; i < methodArgs.length; i++) { // [target] array
visitInsn(DUP); // [target] args... array array
visitLdcInsn(Integer.valueOf(i)); // [target] args... array array idx
visitInsn(AALOAD); // [target] args... array boxed
unbox(methodArgs[i]); // [target] args... array arg
if (methodArgs[i].getSize() == 2) {
visitInsn(DUP2_X1); // [target] args... array arg_arg
visitInsn(POP2); // [target] args... array
} else {
visitInsn(SWAP); // [target] args... array
}
}
visitInsn(POP); // [target] args...
} | java | void restoreArgsFromArray(String desc) {
Type[] methodArgs = Type.getArgumentTypes(desc);
for (int i = 0; i < methodArgs.length; i++) { // [target] array
visitInsn(DUP); // [target] args... array array
visitLdcInsn(Integer.valueOf(i)); // [target] args... array array idx
visitInsn(AALOAD); // [target] args... array boxed
unbox(methodArgs[i]); // [target] args... array arg
if (methodArgs[i].getSize() == 2) {
visitInsn(DUP2_X1); // [target] args... array arg_arg
visitInsn(POP2); // [target] args... array
} else {
visitInsn(SWAP); // [target] args... array
}
}
visitInsn(POP); // [target] args...
} | [
"void",
"restoreArgsFromArray",
"(",
"String",
"desc",
")",
"{",
"Type",
"[",
"]",
"methodArgs",
"=",
"Type",
".",
"getArgumentTypes",
"(",
"desc",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"methodArgs",
".",
"length",
";",
"i",
"++",
")",
"{",
"// [target] array",
"visitInsn",
"(",
"DUP",
")",
";",
"// [target] args... array array",
"visitLdcInsn",
"(",
"Integer",
".",
"valueOf",
"(",
"i",
")",
")",
";",
"// [target] args... array array idx",
"visitInsn",
"(",
"AALOAD",
")",
";",
"// [target] args... array boxed",
"unbox",
"(",
"methodArgs",
"[",
"i",
"]",
")",
";",
"// [target] args... array arg",
"if",
"(",
"methodArgs",
"[",
"i",
"]",
".",
"getSize",
"(",
")",
"==",
"2",
")",
"{",
"visitInsn",
"(",
"DUP2_X1",
")",
";",
"// [target] args... array arg_arg",
"visitInsn",
"(",
"POP2",
")",
";",
"// [target] args... array",
"}",
"else",
"{",
"visitInsn",
"(",
"SWAP",
")",
";",
"// [target] args... array",
"}",
"}",
"visitInsn",
"(",
"POP",
")",
";",
"// [target] args...",
"}"
] | Recreate the parameter list for the target method from an Object array
containing the data.
@param desc the target method descriptor | [
"Recreate",
"the",
"parameter",
"list",
"for",
"the",
"target",
"method",
"from",
"an",
"Object",
"array",
"containing",
"the",
"data",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java#L536-L551 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java | ProbeMethodAdapter.setProbeInProgress | protected void setProbeInProgress(boolean inProgress) {
if (inProgress && !this.probeInProgress) {
this.probeInProgress = true;
if (this.probeMethodAdapter != null) {
this.mv = this.visitor;
}
} else if (!inProgress && this.probeInProgress) {
this.probeInProgress = false;
this.mv = probeMethodAdapter != null ? probeMethodAdapter : this.visitor;
}
} | java | protected void setProbeInProgress(boolean inProgress) {
if (inProgress && !this.probeInProgress) {
this.probeInProgress = true;
if (this.probeMethodAdapter != null) {
this.mv = this.visitor;
}
} else if (!inProgress && this.probeInProgress) {
this.probeInProgress = false;
this.mv = probeMethodAdapter != null ? probeMethodAdapter : this.visitor;
}
} | [
"protected",
"void",
"setProbeInProgress",
"(",
"boolean",
"inProgress",
")",
"{",
"if",
"(",
"inProgress",
"&&",
"!",
"this",
".",
"probeInProgress",
")",
"{",
"this",
".",
"probeInProgress",
"=",
"true",
";",
"if",
"(",
"this",
".",
"probeMethodAdapter",
"!=",
"null",
")",
"{",
"this",
".",
"mv",
"=",
"this",
".",
"visitor",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"inProgress",
"&&",
"this",
".",
"probeInProgress",
")",
"{",
"this",
".",
"probeInProgress",
"=",
"false",
";",
"this",
".",
"mv",
"=",
"probeMethodAdapter",
"!=",
"null",
"?",
"probeMethodAdapter",
":",
"this",
".",
"visitor",
";",
"}",
"}"
] | Called by the project injection adapter to indicate that the probe
instruction stream is being injected. This is used to change the
target of the chain to skip other probe related adapters.
@param inProgress true if the probe injection is starting, false
if ended | [
"Called",
"by",
"the",
"project",
"injection",
"adapter",
"to",
"indicate",
"that",
"the",
"probe",
"instruction",
"stream",
"is",
"being",
"injected",
".",
"This",
"is",
"used",
"to",
"change",
"the",
"target",
"of",
"the",
"chain",
"to",
"skip",
"other",
"probe",
"related",
"adapters",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java#L571-L581 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaActivationSpecImpl.java | SibRaActivationSpecImpl.setTargetSignificance | public void setTargetSignificance(String targetSignificance) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "setTargetSignificance", targetSignificance);
}
_targetSignificance = targetSignificance;
} | java | public void setTargetSignificance(String targetSignificance) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "setTargetSignificance", targetSignificance);
}
_targetSignificance = targetSignificance;
} | [
"public",
"void",
"setTargetSignificance",
"(",
"String",
"targetSignificance",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"TRACE",
",",
"\"setTargetSignificance\"",
",",
"targetSignificance",
")",
";",
"}",
"_targetSignificance",
"=",
"targetSignificance",
";",
"}"
] | Set the target significance property.
@param target significance | [
"Set",
"the",
"target",
"significance",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaActivationSpecImpl.java#L1039-L1046 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaActivationSpecImpl.java | SibRaActivationSpecImpl.setTargetTransportChain | public void setTargetTransportChain(String targetTransportChain) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "setTargetTransportChain", targetTransportChain);
}
_targetTransportChain = targetTransportChain;
} | java | public void setTargetTransportChain(String targetTransportChain) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "setTargetTransportChain", targetTransportChain);
}
_targetTransportChain = targetTransportChain;
} | [
"public",
"void",
"setTargetTransportChain",
"(",
"String",
"targetTransportChain",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"TRACE",
",",
"\"setTargetTransportChain\"",
",",
"targetTransportChain",
")",
";",
"}",
"_targetTransportChain",
"=",
"targetTransportChain",
";",
"}"
] | Set the target transport chain property.
@param target transport chain | [
"Set",
"the",
"target",
"transport",
"chain",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaActivationSpecImpl.java#L1053-L1060 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaActivationSpecImpl.java | SibRaActivationSpecImpl.setUseServerSubject | public void setUseServerSubject(Boolean useServerSubject) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "setUseServerSubject", useServerSubject);
}
_useServerSubject = useServerSubject;
} | java | public void setUseServerSubject(Boolean useServerSubject) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "setUseServerSubject", useServerSubject);
}
_useServerSubject = useServerSubject;
} | [
"public",
"void",
"setUseServerSubject",
"(",
"Boolean",
"useServerSubject",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"TRACE",
",",
"\"setUseServerSubject\"",
",",
"useServerSubject",
")",
";",
"}",
"_useServerSubject",
"=",
"useServerSubject",
";",
"}"
] | Set the useServerSubject property.
@param useServerSubject | [
"Set",
"the",
"useServerSubject",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaActivationSpecImpl.java#L1089-L1096 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaActivationSpecImpl.java | SibRaActivationSpecImpl.setRetryInterval | public void setRetryInterval(String retryInterval)
{
_retryInterval = (retryInterval == null ? null : Integer.valueOf(retryInterval));
} | java | public void setRetryInterval(String retryInterval)
{
_retryInterval = (retryInterval == null ? null : Integer.valueOf(retryInterval));
} | [
"public",
"void",
"setRetryInterval",
"(",
"String",
"retryInterval",
")",
"{",
"_retryInterval",
"=",
"(",
"retryInterval",
"==",
"null",
"?",
"null",
":",
"Integer",
".",
"valueOf",
"(",
"retryInterval",
")",
")",
";",
"}"
] | Sets the retry interval | [
"Sets",
"the",
"retry",
"interval"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaActivationSpecImpl.java#L1196-L1199 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java | JaxWsDDHelper.getPortComponentByEJBLink | static PortComponent getPortComponentByEJBLink(String ejbLink, Adaptable containerToAdapt) throws UnableToAdaptException {
return getHighLevelElementByServiceImplBean(ejbLink, containerToAdapt, PortComponent.class, LinkType.EJB);
} | java | static PortComponent getPortComponentByEJBLink(String ejbLink, Adaptable containerToAdapt) throws UnableToAdaptException {
return getHighLevelElementByServiceImplBean(ejbLink, containerToAdapt, PortComponent.class, LinkType.EJB);
} | [
"static",
"PortComponent",
"getPortComponentByEJBLink",
"(",
"String",
"ejbLink",
",",
"Adaptable",
"containerToAdapt",
")",
"throws",
"UnableToAdaptException",
"{",
"return",
"getHighLevelElementByServiceImplBean",
"(",
"ejbLink",
",",
"containerToAdapt",
",",
"PortComponent",
".",
"class",
",",
"LinkType",
".",
"EJB",
")",
";",
"}"
] | Get the PortComponent by ejb-link.
@param ejbLink
@param containerToAdapt
@return
@throws UnableToAdaptException | [
"Get",
"the",
"PortComponent",
"by",
"ejb",
"-",
"link",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java#L44-L46 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java | JaxWsDDHelper.getPortComponentByServletLink | static PortComponent getPortComponentByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException {
return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, PortComponent.class, LinkType.SERVLET);
} | java | static PortComponent getPortComponentByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException {
return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, PortComponent.class, LinkType.SERVLET);
} | [
"static",
"PortComponent",
"getPortComponentByServletLink",
"(",
"String",
"servletLink",
",",
"Adaptable",
"containerToAdapt",
")",
"throws",
"UnableToAdaptException",
"{",
"return",
"getHighLevelElementByServiceImplBean",
"(",
"servletLink",
",",
"containerToAdapt",
",",
"PortComponent",
".",
"class",
",",
"LinkType",
".",
"SERVLET",
")",
";",
"}"
] | Get the PortComponent by servlet-link.
@param servletLink
@param containerToAdapt
@return
@throws UnableToAdaptException | [
"Get",
"the",
"PortComponent",
"by",
"servlet",
"-",
"link",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java#L56-L58 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java | JaxWsDDHelper.getWebserviceDescriptionByEJBLink | static WebserviceDescription getWebserviceDescriptionByEJBLink(String ejbLink, Adaptable containerToAdapt) throws UnableToAdaptException {
return getHighLevelElementByServiceImplBean(ejbLink, containerToAdapt, WebserviceDescription.class, LinkType.EJB);
} | java | static WebserviceDescription getWebserviceDescriptionByEJBLink(String ejbLink, Adaptable containerToAdapt) throws UnableToAdaptException {
return getHighLevelElementByServiceImplBean(ejbLink, containerToAdapt, WebserviceDescription.class, LinkType.EJB);
} | [
"static",
"WebserviceDescription",
"getWebserviceDescriptionByEJBLink",
"(",
"String",
"ejbLink",
",",
"Adaptable",
"containerToAdapt",
")",
"throws",
"UnableToAdaptException",
"{",
"return",
"getHighLevelElementByServiceImplBean",
"(",
"ejbLink",
",",
"containerToAdapt",
",",
"WebserviceDescription",
".",
"class",
",",
"LinkType",
".",
"EJB",
")",
";",
"}"
] | Get the WebserviceDescription by ejb-link.
@param ejbLink
@param containerToAdapt
@return
@throws UnableToAdaptException | [
"Get",
"the",
"WebserviceDescription",
"by",
"ejb",
"-",
"link",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java#L68-L70 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java | JaxWsDDHelper.getWebserviceDescriptionByServletLink | static WebserviceDescription getWebserviceDescriptionByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException {
return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, WebserviceDescription.class, LinkType.SERVLET);
} | java | static WebserviceDescription getWebserviceDescriptionByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException {
return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, WebserviceDescription.class, LinkType.SERVLET);
} | [
"static",
"WebserviceDescription",
"getWebserviceDescriptionByServletLink",
"(",
"String",
"servletLink",
",",
"Adaptable",
"containerToAdapt",
")",
"throws",
"UnableToAdaptException",
"{",
"return",
"getHighLevelElementByServiceImplBean",
"(",
"servletLink",
",",
"containerToAdapt",
",",
"WebserviceDescription",
".",
"class",
",",
"LinkType",
".",
"SERVLET",
")",
";",
"}"
] | Get the WebserviceDescription by servlet-link.
@param servletLink
@param containerToAdapt
@return
@throws UnableToAdaptException | [
"Get",
"the",
"WebserviceDescription",
"by",
"servlet",
"-",
"link",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java#L80-L82 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java | JaxWsDDHelper.getHighLevelElementByServiceImplBean | @SuppressWarnings("unchecked")
private static <T> T getHighLevelElementByServiceImplBean(String portLink, Adaptable containerToAdapt, Class<T> clazz, LinkType linkType) throws UnableToAdaptException {
if (null == portLink) {
return null;
}
if (PortComponent.class.isAssignableFrom(clazz)
|| WebserviceDescription.class.isAssignableFrom(clazz)) {
Webservices wsXml = containerToAdapt.adapt(Webservices.class);
if (null == wsXml) {
return null;
}
for (WebserviceDescription wsDes : wsXml.getWebServiceDescriptions()) {
if (wsDes.getPortComponents().size() == 0) {
continue;
}
for (PortComponent portCmpt : wsDes.getPortComponents()) {
ServiceImplBean servImplBean = portCmpt.getServiceImplBean();
String serviceLink = LinkType.SERVLET == linkType ? servImplBean.getServletLink() : servImplBean.getEJBLink();
if (serviceLink == null) {
continue;
} else if (serviceLink.equals(portLink)) {
if (PortComponent.class.isAssignableFrom(clazz)) {
return (T) portCmpt;
} else {
return (T) wsDes;
}
}
}
}
return null;
}
return null;
} | java | @SuppressWarnings("unchecked")
private static <T> T getHighLevelElementByServiceImplBean(String portLink, Adaptable containerToAdapt, Class<T> clazz, LinkType linkType) throws UnableToAdaptException {
if (null == portLink) {
return null;
}
if (PortComponent.class.isAssignableFrom(clazz)
|| WebserviceDescription.class.isAssignableFrom(clazz)) {
Webservices wsXml = containerToAdapt.adapt(Webservices.class);
if (null == wsXml) {
return null;
}
for (WebserviceDescription wsDes : wsXml.getWebServiceDescriptions()) {
if (wsDes.getPortComponents().size() == 0) {
continue;
}
for (PortComponent portCmpt : wsDes.getPortComponents()) {
ServiceImplBean servImplBean = portCmpt.getServiceImplBean();
String serviceLink = LinkType.SERVLET == linkType ? servImplBean.getServletLink() : servImplBean.getEJBLink();
if (serviceLink == null) {
continue;
} else if (serviceLink.equals(portLink)) {
if (PortComponent.class.isAssignableFrom(clazz)) {
return (T) portCmpt;
} else {
return (T) wsDes;
}
}
}
}
return null;
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"T",
">",
"T",
"getHighLevelElementByServiceImplBean",
"(",
"String",
"portLink",
",",
"Adaptable",
"containerToAdapt",
",",
"Class",
"<",
"T",
">",
"clazz",
",",
"LinkType",
"linkType",
")",
"throws",
"UnableToAdaptException",
"{",
"if",
"(",
"null",
"==",
"portLink",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"PortComponent",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
"||",
"WebserviceDescription",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
")",
"{",
"Webservices",
"wsXml",
"=",
"containerToAdapt",
".",
"adapt",
"(",
"Webservices",
".",
"class",
")",
";",
"if",
"(",
"null",
"==",
"wsXml",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"WebserviceDescription",
"wsDes",
":",
"wsXml",
".",
"getWebServiceDescriptions",
"(",
")",
")",
"{",
"if",
"(",
"wsDes",
".",
"getPortComponents",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"continue",
";",
"}",
"for",
"(",
"PortComponent",
"portCmpt",
":",
"wsDes",
".",
"getPortComponents",
"(",
")",
")",
"{",
"ServiceImplBean",
"servImplBean",
"=",
"portCmpt",
".",
"getServiceImplBean",
"(",
")",
";",
"String",
"serviceLink",
"=",
"LinkType",
".",
"SERVLET",
"==",
"linkType",
"?",
"servImplBean",
".",
"getServletLink",
"(",
")",
":",
"servImplBean",
".",
"getEJBLink",
"(",
")",
";",
"if",
"(",
"serviceLink",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"else",
"if",
"(",
"serviceLink",
".",
"equals",
"(",
"portLink",
")",
")",
"{",
"if",
"(",
"PortComponent",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
")",
"{",
"return",
"(",
"T",
")",
"portCmpt",
";",
"}",
"else",
"{",
"return",
"(",
"T",
")",
"wsDes",
";",
"}",
"}",
"}",
"}",
"return",
"null",
";",
"}",
"return",
"null",
";",
"}"
] | For internal usage. Can only process the PortComponent.class and WebserviceDescription.class.
@param portLink
@param containerToAdapt
@param clazz
@return
@throws UnableToAdaptException | [
"For",
"internal",
"usage",
".",
"Can",
"only",
"process",
"the",
"PortComponent",
".",
"class",
"and",
"WebserviceDescription",
".",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java#L93-L127 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/runtime/anycast/ReceivedMessageRequestInfo.java | ReceivedMessageRequestInfo.getCompletionTime | public long getCompletionTime()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getCompletionTime");
long completionTime =-1;
//only calculate if the timeout is not infinite
long timeOut = getTimeout();
if(timeOut != SIMPConstants.INFINITE_TIMEOUT)
{
completionTime = getIssueTime() + timeOut;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getCompletionTime", new Long(completionTime));
return completionTime;
} | java | public long getCompletionTime()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getCompletionTime");
long completionTime =-1;
//only calculate if the timeout is not infinite
long timeOut = getTimeout();
if(timeOut != SIMPConstants.INFINITE_TIMEOUT)
{
completionTime = getIssueTime() + timeOut;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getCompletionTime", new Long(completionTime));
return completionTime;
} | [
"public",
"long",
"getCompletionTime",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getCompletionTime\"",
")",
";",
"long",
"completionTime",
"=",
"-",
"1",
";",
"//only calculate if the timeout is not infinite",
"long",
"timeOut",
"=",
"getTimeout",
"(",
")",
";",
"if",
"(",
"timeOut",
"!=",
"SIMPConstants",
".",
"INFINITE_TIMEOUT",
")",
"{",
"completionTime",
"=",
"getIssueTime",
"(",
")",
"+",
"timeOut",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getCompletionTime\"",
",",
"new",
"Long",
"(",
"completionTime",
")",
")",
";",
"return",
"completionTime",
";",
"}"
] | Return the completion time for this request.
-1 means infinite | [
"Return",
"the",
"completion",
"time",
"for",
"this",
"request",
".",
"-",
"1",
"means",
"infinite"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/runtime/anycast/ReceivedMessageRequestInfo.java#L109-L127 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/JNDIEntry.java | JNDIEntry.deactivate | protected synchronized void deactivate(ComponentContext context) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unregistering JNDIEntry " + serviceRegistration);
}
if (this.serviceRegistration != null) {
this.serviceRegistration.unregister();
}
} | java | protected synchronized void deactivate(ComponentContext context) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unregistering JNDIEntry " + serviceRegistration);
}
if (this.serviceRegistration != null) {
this.serviceRegistration.unregister();
}
} | [
"protected",
"synchronized",
"void",
"deactivate",
"(",
"ComponentContext",
"context",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Unregistering JNDIEntry \"",
"+",
"serviceRegistration",
")",
";",
"}",
"if",
"(",
"this",
".",
"serviceRegistration",
"!=",
"null",
")",
"{",
"this",
".",
"serviceRegistration",
".",
"unregister",
"(",
")",
";",
"}",
"}"
] | Unregisters a service if one was registered
@param context | [
"Unregisters",
"a",
"service",
"if",
"one",
"was",
"registered"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi/src/com/ibm/ws/jndi/internal/JNDIEntry.java#L94-L101 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.social/src/com/ibm/websphere/security/social/UserProfileManager.java | UserProfileManager.getUserProfile | public static UserProfile getUserProfile() {
UserProfile userProfile = null;
Subject subject = getSubject();
Iterator<UserProfile> userProfilesIterator = subject.getPrivateCredentials(UserProfile.class).iterator();
if (userProfilesIterator.hasNext()) {
userProfile = userProfilesIterator.next();
}
return userProfile;
} | java | public static UserProfile getUserProfile() {
UserProfile userProfile = null;
Subject subject = getSubject();
Iterator<UserProfile> userProfilesIterator = subject.getPrivateCredentials(UserProfile.class).iterator();
if (userProfilesIterator.hasNext()) {
userProfile = userProfilesIterator.next();
}
return userProfile;
} | [
"public",
"static",
"UserProfile",
"getUserProfile",
"(",
")",
"{",
"UserProfile",
"userProfile",
"=",
"null",
";",
"Subject",
"subject",
"=",
"getSubject",
"(",
")",
";",
"Iterator",
"<",
"UserProfile",
">",
"userProfilesIterator",
"=",
"subject",
".",
"getPrivateCredentials",
"(",
"UserProfile",
".",
"class",
")",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"userProfilesIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"userProfile",
"=",
"userProfilesIterator",
".",
"next",
"(",
")",
";",
"}",
"return",
"userProfile",
";",
"}"
] | Get UserProfile for the subject on the thread.
@return the user profile for the social media authenticated user. | [
"Get",
"UserProfile",
"for",
"the",
"subject",
"on",
"the",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/websphere/security/social/UserProfileManager.java#L37-L45 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java | ClientAsynchEventThreadPool.dispatchAsynchException | public void dispatchAsynchException(ProxyQueue proxyQueue, Exception exception)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dispatchAsynchException",
new Object[] { proxyQueue, exception });
// Create a runnable with the data
AsynchExceptionThread thread = new AsynchExceptionThread(proxyQueue, exception);
dispatchThread(thread);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dispatchAsynchException");
} | java | public void dispatchAsynchException(ProxyQueue proxyQueue, Exception exception)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dispatchAsynchException",
new Object[] { proxyQueue, exception });
// Create a runnable with the data
AsynchExceptionThread thread = new AsynchExceptionThread(proxyQueue, exception);
dispatchThread(thread);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dispatchAsynchException");
} | [
"public",
"void",
"dispatchAsynchException",
"(",
"ProxyQueue",
"proxyQueue",
",",
"Exception",
"exception",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"dispatchAsynchException\"",
",",
"new",
"Object",
"[",
"]",
"{",
"proxyQueue",
",",
"exception",
"}",
")",
";",
"// Create a runnable with the data",
"AsynchExceptionThread",
"thread",
"=",
"new",
"AsynchExceptionThread",
"(",
"proxyQueue",
",",
"exception",
")",
";",
"dispatchThread",
"(",
"thread",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"dispatchAsynchException\"",
")",
";",
"}"
] | Dispatches the exception to the relevant proxy queue.
@param proxyQueue
@param exception | [
"Dispatches",
"the",
"exception",
"to",
"the",
"relevant",
"proxy",
"queue",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L132-L142 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java | ClientAsynchEventThreadPool.dispatchAsynchEvent | public void dispatchAsynchEvent(short eventId, Conversation conversation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchAsynchEvent",
new Object[] { ""+eventId, conversation });
// Create a runnable with the data
AsynchEventThread thread = new AsynchEventThread(eventId, conversation);
dispatchThread(thread);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchAsynchEvent");
} | java | public void dispatchAsynchEvent(short eventId, Conversation conversation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchAsynchEvent",
new Object[] { ""+eventId, conversation });
// Create a runnable with the data
AsynchEventThread thread = new AsynchEventThread(eventId, conversation);
dispatchThread(thread);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchAsynchEvent");
} | [
"public",
"void",
"dispatchAsynchEvent",
"(",
"short",
"eventId",
",",
"Conversation",
"conversation",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"dispatchAsynchEvent\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"\"",
"+",
"eventId",
",",
"conversation",
"}",
")",
";",
"// Create a runnable with the data",
"AsynchEventThread",
"thread",
"=",
"new",
"AsynchEventThread",
"(",
"eventId",
",",
"conversation",
")",
";",
"dispatchThread",
"(",
"thread",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"dispatchAsynchEvent\"",
")",
";",
"}"
] | Dispatches the data to be sent to the connection event listeners on a thread.
@param eventId
@param conversation | [
"Dispatches",
"the",
"data",
"to",
"be",
"sent",
"to",
"the",
"connection",
"event",
"listeners",
"on",
"a",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L150-L160 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java | ClientAsynchEventThreadPool.dispatchCommsException | public void dispatchCommsException(SICoreConnection conn,
ProxyQueueConversationGroup proxyQueueConversationGroup,
SIConnectionLostException exception)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchCommsException");
// Create a runnable with the data
CommsExceptionThread thread = new CommsExceptionThread(conn, proxyQueueConversationGroup, exception);
dispatchThread(thread);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchCommsException");
} | java | public void dispatchCommsException(SICoreConnection conn,
ProxyQueueConversationGroup proxyQueueConversationGroup,
SIConnectionLostException exception)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchCommsException");
// Create a runnable with the data
CommsExceptionThread thread = new CommsExceptionThread(conn, proxyQueueConversationGroup, exception);
dispatchThread(thread);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchCommsException");
} | [
"public",
"void",
"dispatchCommsException",
"(",
"SICoreConnection",
"conn",
",",
"ProxyQueueConversationGroup",
"proxyQueueConversationGroup",
",",
"SIConnectionLostException",
"exception",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"dispatchCommsException\"",
")",
";",
"// Create a runnable with the data",
"CommsExceptionThread",
"thread",
"=",
"new",
"CommsExceptionThread",
"(",
"conn",
",",
"proxyQueueConversationGroup",
",",
"exception",
")",
";",
"dispatchThread",
"(",
"thread",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"dispatchCommsException\"",
")",
";",
"}"
] | Dispatches the exception to be sent to the connection event listeners on a thread.
@param conn
@param exception | [
"Dispatches",
"the",
"exception",
"to",
"be",
"sent",
"to",
"the",
"connection",
"event",
"listeners",
"on",
"a",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L168-L179 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java | ClientAsynchEventThreadPool.dispatchDestinationListenerEvent | public void dispatchDestinationListenerEvent(SICoreConnection conn, SIDestinationAddress destinationAddress,
DestinationAvailability destinationAvailability, DestinationListener destinationListener)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchDestinationListenerEvent",
new Object[]{conn, destinationAddress, destinationAvailability, destinationListener});
//Create a new DestinationListenerThread and dispatch it.
final DestinationListenerThread thread = new DestinationListenerThread(conn, destinationAddress, destinationAvailability, destinationListener);
dispatchThread(thread);
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchDestinationListenerEvent");
} | java | public void dispatchDestinationListenerEvent(SICoreConnection conn, SIDestinationAddress destinationAddress,
DestinationAvailability destinationAvailability, DestinationListener destinationListener)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchDestinationListenerEvent",
new Object[]{conn, destinationAddress, destinationAvailability, destinationListener});
//Create a new DestinationListenerThread and dispatch it.
final DestinationListenerThread thread = new DestinationListenerThread(conn, destinationAddress, destinationAvailability, destinationListener);
dispatchThread(thread);
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchDestinationListenerEvent");
} | [
"public",
"void",
"dispatchDestinationListenerEvent",
"(",
"SICoreConnection",
"conn",
",",
"SIDestinationAddress",
"destinationAddress",
",",
"DestinationAvailability",
"destinationAvailability",
",",
"DestinationListener",
"destinationListener",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"dispatchDestinationListenerEvent\"",
",",
"new",
"Object",
"[",
"]",
"{",
"conn",
",",
"destinationAddress",
",",
"destinationAvailability",
",",
"destinationListener",
"}",
")",
";",
"//Create a new DestinationListenerThread and dispatch it.",
"final",
"DestinationListenerThread",
"thread",
"=",
"new",
"DestinationListenerThread",
"(",
"conn",
",",
"destinationAddress",
",",
"destinationAvailability",
",",
"destinationListener",
")",
";",
"dispatchThread",
"(",
"thread",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"dispatchDestinationListenerEvent\"",
")",
";",
"}"
] | Dispatches a thread which will call the destinationAvailable method on the destinationListener passing in the supplied parameters.
@param conn
@param destinationAddress
@param destinationAvailability
@param destinationListener | [
"Dispatches",
"a",
"thread",
"which",
"will",
"call",
"the",
"destinationAvailable",
"method",
"on",
"the",
"destinationListener",
"passing",
"in",
"the",
"supplied",
"parameters",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L189-L200 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java | ClientAsynchEventThreadPool.dispatchConsumerSetChangeCallbackEvent | public void dispatchConsumerSetChangeCallbackEvent(ConsumerSetChangeCallback consumerSetChangeCallback,boolean isEmpty)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchConsumerSetChangeCallbackEvent",
new Object[]{consumerSetChangeCallback, isEmpty});
//Create a new ConsumerSetChangeCallbackThread and dispatch it.
final ConsumerSetChangeCallbackThread thread = new ConsumerSetChangeCallbackThread(consumerSetChangeCallback,isEmpty);
dispatchThread(thread);
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchConsumerSetChangeCallbackEvent");
} | java | public void dispatchConsumerSetChangeCallbackEvent(ConsumerSetChangeCallback consumerSetChangeCallback,boolean isEmpty)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchConsumerSetChangeCallbackEvent",
new Object[]{consumerSetChangeCallback, isEmpty});
//Create a new ConsumerSetChangeCallbackThread and dispatch it.
final ConsumerSetChangeCallbackThread thread = new ConsumerSetChangeCallbackThread(consumerSetChangeCallback,isEmpty);
dispatchThread(thread);
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchConsumerSetChangeCallbackEvent");
} | [
"public",
"void",
"dispatchConsumerSetChangeCallbackEvent",
"(",
"ConsumerSetChangeCallback",
"consumerSetChangeCallback",
",",
"boolean",
"isEmpty",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"dispatchConsumerSetChangeCallbackEvent\"",
",",
"new",
"Object",
"[",
"]",
"{",
"consumerSetChangeCallback",
",",
"isEmpty",
"}",
")",
";",
"//Create a new ConsumerSetChangeCallbackThread and dispatch it.",
"final",
"ConsumerSetChangeCallbackThread",
"thread",
"=",
"new",
"ConsumerSetChangeCallbackThread",
"(",
"consumerSetChangeCallback",
",",
"isEmpty",
")",
";",
"dispatchThread",
"(",
"thread",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"dispatchConsumerSetChangeCallbackEvent\"",
")",
";",
"}"
] | Dispatches a thread which will call the consumerSetChange method on the ConsumerSetChangeCallback passing in the supplied parameters.
@param consumerSetChangeCallback
@param isEmpty | [
"Dispatches",
"a",
"thread",
"which",
"will",
"call",
"the",
"consumerSetChange",
"method",
"on",
"the",
"ConsumerSetChangeCallback",
"passing",
"in",
"the",
"supplied",
"parameters",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L209-L219 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java | ClientAsynchEventThreadPool.dispatchStoppableConsumerSessionStopped | public void dispatchStoppableConsumerSessionStopped(ConsumerSessionProxy consumerSessionProxy)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchStoppableConsumerSessionStopped", consumerSessionProxy);
//Create a new StoppableAsynchConsumerCallbackThread and dispatch it.
final StoppableAsynchConsumerCallbackThread thread = new StoppableAsynchConsumerCallbackThread(consumerSessionProxy);
dispatchThread(thread);
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchStoppableConsumerSessionStopped");
} | java | public void dispatchStoppableConsumerSessionStopped(ConsumerSessionProxy consumerSessionProxy)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchStoppableConsumerSessionStopped", consumerSessionProxy);
//Create a new StoppableAsynchConsumerCallbackThread and dispatch it.
final StoppableAsynchConsumerCallbackThread thread = new StoppableAsynchConsumerCallbackThread(consumerSessionProxy);
dispatchThread(thread);
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchStoppableConsumerSessionStopped");
} | [
"public",
"void",
"dispatchStoppableConsumerSessionStopped",
"(",
"ConsumerSessionProxy",
"consumerSessionProxy",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"dispatchStoppableConsumerSessionStopped\"",
",",
"consumerSessionProxy",
")",
";",
"//Create a new StoppableAsynchConsumerCallbackThread and dispatch it.",
"final",
"StoppableAsynchConsumerCallbackThread",
"thread",
"=",
"new",
"StoppableAsynchConsumerCallbackThread",
"(",
"consumerSessionProxy",
")",
";",
"dispatchThread",
"(",
"thread",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"dispatchStoppableConsumerSessionStopped\"",
")",
";",
"}"
] | Dispatches a thread which will call the stoppableConsumerSessionStopped method on consumerSessionProxy.
@param consumerSessionProxy | [
"Dispatches",
"a",
"thread",
"which",
"will",
"call",
"the",
"stoppableConsumerSessionStopped",
"method",
"on",
"consumerSessionProxy",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L227-L236 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java | ClientAsynchEventThreadPool.dispatchThread | private void dispatchThread(Runnable runnable)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchThread");
try
{
// Get a thread from the pool to excute it
// By only passing the thread we default to wait if the threadpool queue is full
// We should wait as some callbacks are more important then others but we have no
// way of distinguishing this.
threadPool.execute(runnable);
}
catch (InterruptedException e)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Thread was interrupted", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchThread");
} | java | private void dispatchThread(Runnable runnable)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchThread");
try
{
// Get a thread from the pool to excute it
// By only passing the thread we default to wait if the threadpool queue is full
// We should wait as some callbacks are more important then others but we have no
// way of distinguishing this.
threadPool.execute(runnable);
}
catch (InterruptedException e)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Thread was interrupted", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchThread");
} | [
"private",
"void",
"dispatchThread",
"(",
"Runnable",
"runnable",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"dispatchThread\"",
")",
";",
"try",
"{",
"// Get a thread from the pool to excute it",
"// By only passing the thread we default to wait if the threadpool queue is full",
"// We should wait as some callbacks are more important then others but we have no",
"// way of distinguishing this.",
"threadPool",
".",
"execute",
"(",
"runnable",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"// No FFDC code needed",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Thread was interrupted\"",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"dispatchThread\"",
")",
";",
"}"
] | Actually dispatches the thread.
@param runnable | [
"Actually",
"dispatches",
"the",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L243-L262 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java | ClientAsynchEventThreadPool.invokeCallback | private static void invokeCallback(SICoreConnection conn, ConsumerSession session, // d172528
Exception exception, int eventId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "invokeCallback",
new Object[] { conn, session, exception, eventId });
if (conn != null) // f174318
{ // f174318
try
{
final AsyncCallbackSynchronizer asyncCallbackSynchronizer = ((ConnectionProxy)conn).getAsyncCallbackSynchronizer();
SICoreConnectionListener[] myListeners = conn.getConnectionListeners();
for (int x = 0; x < myListeners.length; x++)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Invoking callback on: " + myListeners[x]);
// Obtain permission from the callback synchronizer to call the application
asyncCallbackSynchronizer.enterAsyncExceptionCallback();
// start f174318
try
{
switch (eventId)
{
// This special event ID will not be received across the wire, but will
// be used internally when we get notified of a JFAP error.
case (0x0000):
myListeners[x].commsFailure(conn, (SIConnectionLostException) exception);
break;
case (CommsConstants.EVENTID_ME_QUIESCING): // f179464
myListeners[x].meQuiescing(conn);
break;
case (CommsConstants.EVENTID_ME_TERMINATED): // f179464
myListeners[x].meTerminated(conn); // f179464
break; // f179464
case (CommsConstants.EVENTID_ASYNC_EXCEPTION): // d172528 // f179464
myListeners[x].asynchronousException(session, exception); // d172528
break; // d172528
default:
// Should never happen
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Invalid event ID: " + eventId);
break;
}
}
catch (Exception e)
{
FFDCFilter.processException(e, CLASS_NAME + ".invokeCallback",
CommsConstants.CLIENTASYNCHEVENTTHREADPOOL_INVOKE_01,
new Object[] { myListeners[x], conn, session, exception, ""+eventId});
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Caught an exception from the callback", e);
} finally {
// Tell the callback synchronizer that we have completed the exception callback
asyncCallbackSynchronizer.exitAsyncExceptionCallback();
}
// end f174318
} // f174318
}
catch (SIException e)
{
// No FFDC Code needed
// We couldn't get hold of the connection listeners for some reason. Not a lot we can
// do here except debug the failure
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to get connection listeners", e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "invokeCallback");
} | java | private static void invokeCallback(SICoreConnection conn, ConsumerSession session, // d172528
Exception exception, int eventId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "invokeCallback",
new Object[] { conn, session, exception, eventId });
if (conn != null) // f174318
{ // f174318
try
{
final AsyncCallbackSynchronizer asyncCallbackSynchronizer = ((ConnectionProxy)conn).getAsyncCallbackSynchronizer();
SICoreConnectionListener[] myListeners = conn.getConnectionListeners();
for (int x = 0; x < myListeners.length; x++)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Invoking callback on: " + myListeners[x]);
// Obtain permission from the callback synchronizer to call the application
asyncCallbackSynchronizer.enterAsyncExceptionCallback();
// start f174318
try
{
switch (eventId)
{
// This special event ID will not be received across the wire, but will
// be used internally when we get notified of a JFAP error.
case (0x0000):
myListeners[x].commsFailure(conn, (SIConnectionLostException) exception);
break;
case (CommsConstants.EVENTID_ME_QUIESCING): // f179464
myListeners[x].meQuiescing(conn);
break;
case (CommsConstants.EVENTID_ME_TERMINATED): // f179464
myListeners[x].meTerminated(conn); // f179464
break; // f179464
case (CommsConstants.EVENTID_ASYNC_EXCEPTION): // d172528 // f179464
myListeners[x].asynchronousException(session, exception); // d172528
break; // d172528
default:
// Should never happen
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Invalid event ID: " + eventId);
break;
}
}
catch (Exception e)
{
FFDCFilter.processException(e, CLASS_NAME + ".invokeCallback",
CommsConstants.CLIENTASYNCHEVENTTHREADPOOL_INVOKE_01,
new Object[] { myListeners[x], conn, session, exception, ""+eventId});
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Caught an exception from the callback", e);
} finally {
// Tell the callback synchronizer that we have completed the exception callback
asyncCallbackSynchronizer.exitAsyncExceptionCallback();
}
// end f174318
} // f174318
}
catch (SIException e)
{
// No FFDC Code needed
// We couldn't get hold of the connection listeners for some reason. Not a lot we can
// do here except debug the failure
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Unable to get connection listeners", e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "invokeCallback");
} | [
"private",
"static",
"void",
"invokeCallback",
"(",
"SICoreConnection",
"conn",
",",
"ConsumerSession",
"session",
",",
"// d172528",
"Exception",
"exception",
",",
"int",
"eventId",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"invokeCallback\"",
",",
"new",
"Object",
"[",
"]",
"{",
"conn",
",",
"session",
",",
"exception",
",",
"eventId",
"}",
")",
";",
"if",
"(",
"conn",
"!=",
"null",
")",
"// f174318",
"{",
"// f174318",
"try",
"{",
"final",
"AsyncCallbackSynchronizer",
"asyncCallbackSynchronizer",
"=",
"(",
"(",
"ConnectionProxy",
")",
"conn",
")",
".",
"getAsyncCallbackSynchronizer",
"(",
")",
";",
"SICoreConnectionListener",
"[",
"]",
"myListeners",
"=",
"conn",
".",
"getConnectionListeners",
"(",
")",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"myListeners",
".",
"length",
";",
"x",
"++",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Invoking callback on: \"",
"+",
"myListeners",
"[",
"x",
"]",
")",
";",
"// Obtain permission from the callback synchronizer to call the application",
"asyncCallbackSynchronizer",
".",
"enterAsyncExceptionCallback",
"(",
")",
";",
"// start f174318",
"try",
"{",
"switch",
"(",
"eventId",
")",
"{",
"// This special event ID will not be received across the wire, but will",
"// be used internally when we get notified of a JFAP error.",
"case",
"(",
"0x0000",
")",
":",
"myListeners",
"[",
"x",
"]",
".",
"commsFailure",
"(",
"conn",
",",
"(",
"SIConnectionLostException",
")",
"exception",
")",
";",
"break",
";",
"case",
"(",
"CommsConstants",
".",
"EVENTID_ME_QUIESCING",
")",
":",
"// f179464",
"myListeners",
"[",
"x",
"]",
".",
"meQuiescing",
"(",
"conn",
")",
";",
"break",
";",
"case",
"(",
"CommsConstants",
".",
"EVENTID_ME_TERMINATED",
")",
":",
"// f179464",
"myListeners",
"[",
"x",
"]",
".",
"meTerminated",
"(",
"conn",
")",
";",
"// f179464",
"break",
";",
"// f179464",
"case",
"(",
"CommsConstants",
".",
"EVENTID_ASYNC_EXCEPTION",
")",
":",
"// d172528 // f179464",
"myListeners",
"[",
"x",
"]",
".",
"asynchronousException",
"(",
"session",
",",
"exception",
")",
";",
"// d172528",
"break",
";",
"// d172528",
"default",
":",
"// Should never happen",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Invalid event ID: \"",
"+",
"eventId",
")",
";",
"break",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".invokeCallback\"",
",",
"CommsConstants",
".",
"CLIENTASYNCHEVENTTHREADPOOL_INVOKE_01",
",",
"new",
"Object",
"[",
"]",
"{",
"myListeners",
"[",
"x",
"]",
",",
"conn",
",",
"session",
",",
"exception",
",",
"\"\"",
"+",
"eventId",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Caught an exception from the callback\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"// Tell the callback synchronizer that we have completed the exception callback",
"asyncCallbackSynchronizer",
".",
"exitAsyncExceptionCallback",
"(",
")",
";",
"}",
"// end f174318",
"}",
"// f174318",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"// No FFDC Code needed",
"// We couldn't get hold of the connection listeners for some reason. Not a lot we can",
"// do here except debug the failure",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Unable to get connection listeners\"",
",",
"e",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"invokeCallback\"",
")",
";",
"}"
] | This method will send a message to the connection listeners associated
with this connection.
@param conn May be null if invoking an async callback
@param session May be null if invoking a connection callback
@param exception May be null if invoking a connection callback
@param eventId The event Id | [
"This",
"method",
"will",
"send",
"a",
"message",
"to",
"the",
"connection",
"listeners",
"associated",
"with",
"this",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L273-L345 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SRTServletRequestUtils.java | SRTServletRequestUtils.getHeader | @Sensitive
public static String getHeader(HttpServletRequest req, String key) {
HttpServletRequest sr = getWrappedServletRequestObject(req);
return sr.getHeader(key);
} | java | @Sensitive
public static String getHeader(HttpServletRequest req, String key) {
HttpServletRequest sr = getWrappedServletRequestObject(req);
return sr.getHeader(key);
} | [
"@",
"Sensitive",
"public",
"static",
"String",
"getHeader",
"(",
"HttpServletRequest",
"req",
",",
"String",
"key",
")",
"{",
"HttpServletRequest",
"sr",
"=",
"getWrappedServletRequestObject",
"(",
"req",
")",
";",
"return",
"sr",
".",
"getHeader",
"(",
"key",
")",
";",
"}"
] | Obtain the value of the specified header.
@param req
@param key
@return The value of the header
@see HttpServletRequest#getHeader(String) | [
"Obtain",
"the",
"value",
"of",
"the",
"specified",
"header",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SRTServletRequestUtils.java#L95-L99 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/remote/TransactionWrapper.java | TransactionWrapper.destroy | @Override
public void destroy() // PK20881
{
if (tc.isEntryEnabled())
Tr.entry(tc, "destroy");
// Dummy transactionWrappers may not be in any table and so
// will not have a resourceCallback registered to remove them.
if (_resourceCallback != null)
_resourceCallback.destroy();
_wrappers.remove(_transaction.getGlobalId());
// Do not remove connection with the TransactionImpl. This will delay garbage
// collection until the TransactionWrapper is garbage collected.
// There is a window when an incoming request can access the remoteable object
// (ie WSCoordinator or CoordinatorResource) and get access to the TransactionWrapper
// while destroy() is called by another thread as the synchronization is on the
// TransactionWrapper. When the incoming request gets control, it will find that
// _transaction is null. Rather than check for this case, we leave the connection
// to the TransactionImpl and its associated TransactionState. The code above will
// then check the transaction state and respond appropriately. These checks are
// already required as the superior may retry requests, etc.
// _transaction = null;
if (tc.isEntryEnabled())
Tr.exit(tc, "destroy");
} | java | @Override
public void destroy() // PK20881
{
if (tc.isEntryEnabled())
Tr.entry(tc, "destroy");
// Dummy transactionWrappers may not be in any table and so
// will not have a resourceCallback registered to remove them.
if (_resourceCallback != null)
_resourceCallback.destroy();
_wrappers.remove(_transaction.getGlobalId());
// Do not remove connection with the TransactionImpl. This will delay garbage
// collection until the TransactionWrapper is garbage collected.
// There is a window when an incoming request can access the remoteable object
// (ie WSCoordinator or CoordinatorResource) and get access to the TransactionWrapper
// while destroy() is called by another thread as the synchronization is on the
// TransactionWrapper. When the incoming request gets control, it will find that
// _transaction is null. Rather than check for this case, we leave the connection
// to the TransactionImpl and its associated TransactionState. The code above will
// then check the transaction state and respond appropriately. These checks are
// already required as the superior may retry requests, etc.
// _transaction = null;
if (tc.isEntryEnabled())
Tr.exit(tc, "destroy");
} | [
"@",
"Override",
"public",
"void",
"destroy",
"(",
")",
"// PK20881",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"destroy\"",
")",
";",
"// Dummy transactionWrappers may not be in any table and so",
"// will not have a resourceCallback registered to remove them.",
"if",
"(",
"_resourceCallback",
"!=",
"null",
")",
"_resourceCallback",
".",
"destroy",
"(",
")",
";",
"_wrappers",
".",
"remove",
"(",
"_transaction",
".",
"getGlobalId",
"(",
")",
")",
";",
"// Do not remove connection with the TransactionImpl. This will delay garbage",
"// collection until the TransactionWrapper is garbage collected.",
"// There is a window when an incoming request can access the remoteable object",
"// (ie WSCoordinator or CoordinatorResource) and get access to the TransactionWrapper",
"// while destroy() is called by another thread as the synchronization is on the",
"// TransactionWrapper. When the incoming request gets control, it will find that",
"// _transaction is null. Rather than check for this case, we leave the connection",
"// to the TransactionImpl and its associated TransactionState. The code above will",
"// then check the transaction state and respond appropriately. These checks are",
"// already required as the superior may retry requests, etc.",
"// _transaction = null;",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"destroy\"",
")",
";",
"}"
] | as another server tried to rollback the transaction. | [
"as",
"another",
"server",
"tried",
"to",
"rollback",
"the",
"transaction",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/remote/TransactionWrapper.java#L982-L1009 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java | FileLogOutput.close | protected void close()
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass
, "close"
);
if (flushHelper != null)
flushHelper.shutdown(); // Complete outstanding work.
if (notifyHelper != null)
notifyHelper.shutdown(); // No longer need a notify thread.
logFile = null;
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "close"
);
} | java | protected void close()
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass
, "close"
);
if (flushHelper != null)
flushHelper.shutdown(); // Complete outstanding work.
if (notifyHelper != null)
notifyHelper.shutdown(); // No longer need a notify thread.
logFile = null;
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "close"
);
} | [
"protected",
"void",
"close",
"(",
")",
"throws",
"ObjectManagerException",
"{",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"close\"",
")",
";",
"if",
"(",
"flushHelper",
"!=",
"null",
")",
"flushHelper",
".",
"shutdown",
"(",
")",
";",
"// Complete outstanding work.",
"if",
"(",
"notifyHelper",
"!=",
"null",
")",
"notifyHelper",
".",
"shutdown",
"(",
")",
";",
"// No longer need a notify thread.",
"logFile",
"=",
"null",
";",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"close\"",
")",
";",
"}"
] | Prohibits further operations on the LogFile.
@throws ObjectManagerException | [
"Prohibits",
"further",
"operations",
"on",
"the",
"LogFile",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java#L580-L599 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java | FileLogOutput.setFileSpaceLeft | private void setFileSpaceLeft()
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass,
"setFileSpaceLeft",
new Object[] { new Long(fileLogHeader.fileSize), new Long(fileLogHeader.startByteAddress),
new Long(filePosition) }
);
// Assume we have wrapped around the end of the file, the space left is between the current
// file position and the start of the log file.
long newFileSpaceLeft = fileLogHeader.startByteAddress - filePosition;
if (newFileSpaceLeft <= 0) // If we have not wrapped.
newFileSpaceLeft = newFileSpaceLeft + fileLogHeader.fileSize - FileLogHeader.headerLength * 2;
fileSpaceLeft = newFileSpaceLeft;
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"setFileSpaceLeft",
new Object[] { new Long(fileSpaceLeft) });
} | java | private void setFileSpaceLeft()
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass,
"setFileSpaceLeft",
new Object[] { new Long(fileLogHeader.fileSize), new Long(fileLogHeader.startByteAddress),
new Long(filePosition) }
);
// Assume we have wrapped around the end of the file, the space left is between the current
// file position and the start of the log file.
long newFileSpaceLeft = fileLogHeader.startByteAddress - filePosition;
if (newFileSpaceLeft <= 0) // If we have not wrapped.
newFileSpaceLeft = newFileSpaceLeft + fileLogHeader.fileSize - FileLogHeader.headerLength * 2;
fileSpaceLeft = newFileSpaceLeft;
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"setFileSpaceLeft",
new Object[] { new Long(fileSpaceLeft) });
} | [
"private",
"void",
"setFileSpaceLeft",
"(",
")",
"throws",
"ObjectManagerException",
"{",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"setFileSpaceLeft\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"fileLogHeader",
".",
"fileSize",
")",
",",
"new",
"Long",
"(",
"fileLogHeader",
".",
"startByteAddress",
")",
",",
"new",
"Long",
"(",
"filePosition",
")",
"}",
")",
";",
"// Assume we have wrapped around the end of the file, the space left is between the current",
"// file position and the start of the log file.",
"long",
"newFileSpaceLeft",
"=",
"fileLogHeader",
".",
"startByteAddress",
"-",
"filePosition",
";",
"if",
"(",
"newFileSpaceLeft",
"<=",
"0",
")",
"// If we have not wrapped. ",
"newFileSpaceLeft",
"=",
"newFileSpaceLeft",
"+",
"fileLogHeader",
".",
"fileSize",
"-",
"FileLogHeader",
".",
"headerLength",
"*",
"2",
";",
"fileSpaceLeft",
"=",
"newFileSpaceLeft",
";",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"setFileSpaceLeft\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"fileSpaceLeft",
")",
"}",
")",
";",
"}"
] | Sets the amount of space still left in the log file.
@throws ObjectManagerException | [
"Sets",
"the",
"amount",
"of",
"space",
"still",
"left",
"in",
"the",
"log",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java#L757-L779 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java | FileLogOutput.flush | final void flush()
throws ObjectManagerException
{
final String methodName = "flush";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
methodName);
int startPage = 0;
// The logBuffer we will wait for.
LogBuffer flushLogBuffer = null;
synchronized (logBufferLock) {
startPage = lastPageFilling;
// // Don't flush a new empty page, where we have stepped past the sector byte
// // but not put anything in it.
// if (nextFreeByteInLogBuffer % pageSize == 1) {
// int newStartPage = startPage -1;
// if (lastPageNotified == newStartPage ) {
// System.out.println("FFFFFFFFFFFFFFF Flush bypassed");
// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
// trace.exit(this,
// cclass,
// "flush");
// return;
// }
// } // if (nextFreeByteInLogBuffer % pageSize == 1).
// Capture the logBuffer containing the page we will flush.
flushLogBuffer = logBuffer;
flushLogBuffer.pageWaiterExists[startPage] = true;
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this,
cclass,
methodName,
new Object[] { "logBuffer_flushing",
new Integer(startPage),
new Integer(firstPageFilling),
new Integer(lastPageFilling),
new Integer(flushLogBuffer.pageWritersActive.get(startPage)) });
} // synchronized (logBufferLock).
flushLogBuffer.waitForFlush(startPage);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
} | java | final void flush()
throws ObjectManagerException
{
final String methodName = "flush";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
methodName);
int startPage = 0;
// The logBuffer we will wait for.
LogBuffer flushLogBuffer = null;
synchronized (logBufferLock) {
startPage = lastPageFilling;
// // Don't flush a new empty page, where we have stepped past the sector byte
// // but not put anything in it.
// if (nextFreeByteInLogBuffer % pageSize == 1) {
// int newStartPage = startPage -1;
// if (lastPageNotified == newStartPage ) {
// System.out.println("FFFFFFFFFFFFFFF Flush bypassed");
// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
// trace.exit(this,
// cclass,
// "flush");
// return;
// }
// } // if (nextFreeByteInLogBuffer % pageSize == 1).
// Capture the logBuffer containing the page we will flush.
flushLogBuffer = logBuffer;
flushLogBuffer.pageWaiterExists[startPage] = true;
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this,
cclass,
methodName,
new Object[] { "logBuffer_flushing",
new Integer(startPage),
new Integer(firstPageFilling),
new Integer(lastPageFilling),
new Integer(flushLogBuffer.pageWritersActive.get(startPage)) });
} // synchronized (logBufferLock).
flushLogBuffer.waitForFlush(startPage);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
} | [
"final",
"void",
"flush",
"(",
")",
"throws",
"ObjectManagerException",
"{",
"final",
"String",
"methodName",
"=",
"\"flush\"",
";",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"methodName",
")",
";",
"int",
"startPage",
"=",
"0",
";",
"// The logBuffer we will wait for.",
"LogBuffer",
"flushLogBuffer",
"=",
"null",
";",
"synchronized",
"(",
"logBufferLock",
")",
"{",
"startPage",
"=",
"lastPageFilling",
";",
"// // Don't flush a new empty page, where we have stepped past the sector byte",
"// // but not put anything in it.",
"// if (nextFreeByteInLogBuffer % pageSize == 1) {",
"// int newStartPage = startPage -1;",
"// if (lastPageNotified == newStartPage ) {",
"// System.out.println(\"FFFFFFFFFFFFFFF Flush bypassed\");",
"// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())",
"// trace.exit(this,",
"// cclass,",
"// \"flush\");",
"// return; ",
"// }",
"// } // if (nextFreeByteInLogBuffer % pageSize == 1).",
"// Capture the logBuffer containing the page we will flush.",
"flushLogBuffer",
"=",
"logBuffer",
";",
"flushLogBuffer",
".",
"pageWaiterExists",
"[",
"startPage",
"]",
"=",
"true",
";",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isDebugEnabled",
"(",
")",
")",
"trace",
".",
"debug",
"(",
"this",
",",
"cclass",
",",
"methodName",
",",
"new",
"Object",
"[",
"]",
"{",
"\"logBuffer_flushing\"",
",",
"new",
"Integer",
"(",
"startPage",
")",
",",
"new",
"Integer",
"(",
"firstPageFilling",
")",
",",
"new",
"Integer",
"(",
"lastPageFilling",
")",
",",
"new",
"Integer",
"(",
"flushLogBuffer",
".",
"pageWritersActive",
".",
"get",
"(",
"startPage",
")",
")",
"}",
")",
";",
"}",
"// synchronized (logBufferLock).",
"flushLogBuffer",
".",
"waitForFlush",
"(",
"startPage",
")",
";",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"methodName",
")",
";",
"}"
] | Writes buffered output to hardened storage. By the time this method returns all
of the data in the logBuffer must have been written to the disk. We mark the
last page as having a thread waiting. If there are no threads currently writing
to any page we wake the flushHelper otherwise we let the writers wake the
flushHelper, if it is stalled. Blocks until the write to disk has completed.
@throws ObjectManagerException | [
"Writes",
"buffered",
"output",
"to",
"hardened",
"storage",
".",
"By",
"the",
"time",
"this",
"method",
"returns",
"all",
"of",
"the",
"data",
"in",
"the",
"logBuffer",
"must",
"have",
"been",
"written",
"to",
"the",
"disk",
".",
"We",
"mark",
"the",
"last",
"page",
"as",
"having",
"a",
"thread",
"waiting",
".",
"If",
"there",
"are",
"no",
"threads",
"currently",
"writing",
"to",
"any",
"page",
"we",
"wake",
"the",
"flushHelper",
"otherwise",
"we",
"let",
"the",
"writers",
"wake",
"the",
"flushHelper",
"if",
"it",
"is",
"stalled",
".",
"Blocks",
"until",
"the",
"write",
"to",
"disk",
"has",
"completed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java#L859-L911 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java | FileLogOutput.reserve | protected void reserve(long reservedDelta)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass,
"reserve",
new Object[] { new Long(reservedDelta) }
);
long unavailable = reserveLogFileSpace(reservedDelta);
if (unavailable != 0) {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass,
"reserve",
new Object[] { "via LogFileFullException", new Long(unavailable), new Long(reservedDelta) }
);
throw new LogFileFullException(this
, reservedDelta
, reservedDelta
, reservedDelta - unavailable);
} // if (unavailable != 0).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"reserve");
} | java | protected void reserve(long reservedDelta)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass,
"reserve",
new Object[] { new Long(reservedDelta) }
);
long unavailable = reserveLogFileSpace(reservedDelta);
if (unavailable != 0) {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass,
"reserve",
new Object[] { "via LogFileFullException", new Long(unavailable), new Long(reservedDelta) }
);
throw new LogFileFullException(this
, reservedDelta
, reservedDelta
, reservedDelta - unavailable);
} // if (unavailable != 0).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"reserve");
} | [
"protected",
"void",
"reserve",
"(",
"long",
"reservedDelta",
")",
"throws",
"ObjectManagerException",
"{",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"reserve\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"reservedDelta",
")",
"}",
")",
";",
"long",
"unavailable",
"=",
"reserveLogFileSpace",
"(",
"reservedDelta",
")",
";",
"if",
"(",
"unavailable",
"!=",
"0",
")",
"{",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"reserve\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"via LogFileFullException\"",
",",
"new",
"Long",
"(",
"unavailable",
")",
",",
"new",
"Long",
"(",
"reservedDelta",
")",
"}",
")",
";",
"throw",
"new",
"LogFileFullException",
"(",
"this",
",",
"reservedDelta",
",",
"reservedDelta",
",",
"reservedDelta",
"-",
"unavailable",
")",
";",
"}",
"// if (unavailable != 0).",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"reserve\"",
")",
";",
"}"
] | Reserve space in the log file.
We don't have to account for sector bytes because those were reserved at startup.
@param reservedDelta the change to the number of reserved bytes if this write is successful.
@throws ObjectManagerException | [
"Reserve",
"space",
"in",
"the",
"log",
"file",
".",
"We",
"don",
"t",
"have",
"to",
"account",
"for",
"sector",
"bytes",
"because",
"those",
"were",
"reserved",
"at",
"startup",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java#L954-L980 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java | FileLogOutput.reserveLogFileSpace | private long reserveLogFileSpace(long reservedDelta)
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"reserveLogFileSpace",
new Object[] { new Long(reservedDelta) });
long stillToReserve = reservedDelta;
// Pick an arbitrary starting point in the array of sub totals.
int index = new java.util.Random(Thread.currentThread().hashCode()).nextInt(fileSpaceAvailable.length);
int startIndex = index;
while (stillToReserve != 0) {
synchronized (fileSpaceAvailableLock[index]) {
if (stillToReserve <= fileSpaceAvailable[index]) {
fileSpaceAvailable[index] = fileSpaceAvailable[index] - stillToReserve;
stillToReserve = 0;
} else {
stillToReserve = stillToReserve - fileSpaceAvailable[index];
fileSpaceAvailable[index] = 0;
// Move on to the next subTotal.
index++;
if (index == fileSpaceAvailable.length)
index = 0;
if (index == startIndex)
break;
} // if (stillToReserve <= fileSpaceAvailable[index]).
} // synchronized (fileSpaceAvailableLock[index]).
} // while...
// Did we get all we needed?
if (stillToReserve != 0) {
// Give back what we got.
long giveBack = reservedDelta - stillToReserve;
for (int i = 0; i < fileSpaceAvailable.length; i++) {
synchronized (fileSpaceAvailableLock[i]) {
fileSpaceAvailable[i] = fileSpaceAvailable[i] + giveBack / fileSpaceAvailable.length;
if (i == startIndex)
fileSpaceAvailable[i] = fileSpaceAvailable[i] + giveBack % fileSpaceAvailable.length;
} // synchronized (fileSpaceAvailableLock[i]).
} // for ..
} // if (stillToReserve != 0).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "reserveLogFileSpace"
, new Object[] { new Long(stillToReserve), new Integer(startIndex) });
return stillToReserve;
} | java | private long reserveLogFileSpace(long reservedDelta)
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"reserveLogFileSpace",
new Object[] { new Long(reservedDelta) });
long stillToReserve = reservedDelta;
// Pick an arbitrary starting point in the array of sub totals.
int index = new java.util.Random(Thread.currentThread().hashCode()).nextInt(fileSpaceAvailable.length);
int startIndex = index;
while (stillToReserve != 0) {
synchronized (fileSpaceAvailableLock[index]) {
if (stillToReserve <= fileSpaceAvailable[index]) {
fileSpaceAvailable[index] = fileSpaceAvailable[index] - stillToReserve;
stillToReserve = 0;
} else {
stillToReserve = stillToReserve - fileSpaceAvailable[index];
fileSpaceAvailable[index] = 0;
// Move on to the next subTotal.
index++;
if (index == fileSpaceAvailable.length)
index = 0;
if (index == startIndex)
break;
} // if (stillToReserve <= fileSpaceAvailable[index]).
} // synchronized (fileSpaceAvailableLock[index]).
} // while...
// Did we get all we needed?
if (stillToReserve != 0) {
// Give back what we got.
long giveBack = reservedDelta - stillToReserve;
for (int i = 0; i < fileSpaceAvailable.length; i++) {
synchronized (fileSpaceAvailableLock[i]) {
fileSpaceAvailable[i] = fileSpaceAvailable[i] + giveBack / fileSpaceAvailable.length;
if (i == startIndex)
fileSpaceAvailable[i] = fileSpaceAvailable[i] + giveBack % fileSpaceAvailable.length;
} // synchronized (fileSpaceAvailableLock[i]).
} // for ..
} // if (stillToReserve != 0).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "reserveLogFileSpace"
, new Object[] { new Long(stillToReserve), new Integer(startIndex) });
return stillToReserve;
} | [
"private",
"long",
"reserveLogFileSpace",
"(",
"long",
"reservedDelta",
")",
"{",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"reserveLogFileSpace\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"reservedDelta",
")",
"}",
")",
";",
"long",
"stillToReserve",
"=",
"reservedDelta",
";",
"// Pick an arbitrary starting point in the array of sub totals.",
"int",
"index",
"=",
"new",
"java",
".",
"util",
".",
"Random",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"hashCode",
"(",
")",
")",
".",
"nextInt",
"(",
"fileSpaceAvailable",
".",
"length",
")",
";",
"int",
"startIndex",
"=",
"index",
";",
"while",
"(",
"stillToReserve",
"!=",
"0",
")",
"{",
"synchronized",
"(",
"fileSpaceAvailableLock",
"[",
"index",
"]",
")",
"{",
"if",
"(",
"stillToReserve",
"<=",
"fileSpaceAvailable",
"[",
"index",
"]",
")",
"{",
"fileSpaceAvailable",
"[",
"index",
"]",
"=",
"fileSpaceAvailable",
"[",
"index",
"]",
"-",
"stillToReserve",
";",
"stillToReserve",
"=",
"0",
";",
"}",
"else",
"{",
"stillToReserve",
"=",
"stillToReserve",
"-",
"fileSpaceAvailable",
"[",
"index",
"]",
";",
"fileSpaceAvailable",
"[",
"index",
"]",
"=",
"0",
";",
"// Move on to the next subTotal.",
"index",
"++",
";",
"if",
"(",
"index",
"==",
"fileSpaceAvailable",
".",
"length",
")",
"index",
"=",
"0",
";",
"if",
"(",
"index",
"==",
"startIndex",
")",
"break",
";",
"}",
"// if (stillToReserve <= fileSpaceAvailable[index]).",
"}",
"// synchronized (fileSpaceAvailableLock[index]).",
"}",
"// while...",
"// Did we get all we needed?",
"if",
"(",
"stillToReserve",
"!=",
"0",
")",
"{",
"// Give back what we got.",
"long",
"giveBack",
"=",
"reservedDelta",
"-",
"stillToReserve",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fileSpaceAvailable",
".",
"length",
";",
"i",
"++",
")",
"{",
"synchronized",
"(",
"fileSpaceAvailableLock",
"[",
"i",
"]",
")",
"{",
"fileSpaceAvailable",
"[",
"i",
"]",
"=",
"fileSpaceAvailable",
"[",
"i",
"]",
"+",
"giveBack",
"/",
"fileSpaceAvailable",
".",
"length",
";",
"if",
"(",
"i",
"==",
"startIndex",
")",
"fileSpaceAvailable",
"[",
"i",
"]",
"=",
"fileSpaceAvailable",
"[",
"i",
"]",
"+",
"giveBack",
"%",
"fileSpaceAvailable",
".",
"length",
";",
"}",
"// synchronized (fileSpaceAvailableLock[i]).",
"}",
"// for ..",
"}",
"// if (stillToReserve != 0).",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"reserveLogFileSpace\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"stillToReserve",
")",
",",
"new",
"Integer",
"(",
"startIndex",
")",
"}",
")",
";",
"return",
"stillToReserve",
";",
"}"
] | Reserve space in the log file. If the required space is not available then
no space is acllocated in the log file. The space of freed when the log file is
truncated.
@param reservedDelta the change to the number allocated if they are available. Can be
negative, if bytes are being returned, in which case the call is always
successful.
@return long zero if the space was available or the number of bytes that could not be found. | [
"Reserve",
"space",
"in",
"the",
"log",
"file",
".",
"If",
"the",
"required",
"space",
"is",
"not",
"available",
"then",
"no",
"space",
"is",
"acllocated",
"in",
"the",
"log",
"file",
".",
"The",
"space",
"of",
"freed",
"when",
"the",
"log",
"file",
"is",
"truncated",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java#L992-L1042 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java | FileLogOutput.paddingReserveLogSpace | private long paddingReserveLogSpace(long spaceToReserve) throws ObjectManagerException
{
if (trace.isEntryEnabled())
trace.entry(this,
cclass,
"paddingReserveLogSpace",
new Object[] { new Long(spaceToReserve) });
synchronized (paddingSpaceLock)
{
// adjust the padding space
paddingSpaceAvailable -= spaceToReserve;
// is this a reserve or unreserve
if (spaceToReserve > 0)
{
// space being reserved
// if paddingSpaceAvailable has gone negative we should do a real reserve for the
// difference. Don't let paddingSpaceAvailable go negative!
// Also cut an FFDC because this should not happen!
if (paddingSpaceAvailable < 0)
{
NegativePaddingSpaceException exception = new NegativePaddingSpaceException(this, paddingSpaceAvailable);
ObjectManager.ffdc.processException(this,
cclass,
"paddingReserveLogSpace",
exception,
"1:1088:1.52");
spaceToReserve = -paddingSpaceAvailable;
paddingSpaceAvailable = 0;
}
else
{
// success case - we don't need to reserve any more
spaceToReserve = 0;
}
}
else
{
// its an unreserve.
if (paddingSpaceAvailable > PADDING_SPACE_TARGET)
{
// space being unreserved and we have exceeded our target so need to give some back
spaceToReserve = PADDING_SPACE_TARGET - paddingSpaceAvailable;
paddingSpaceAvailable = PADDING_SPACE_TARGET;
}
else
{
// space being unreserved and we will keep it all
spaceToReserve = 0;
}
}
} // drop lock before giving back any space
if (spaceToReserve != 0)
{
// this can throw ObjectManagerException, only if spaceToReserve is positive.
// This is good, because not only should spaceToReserve never be positive,
// we must stop now because we are about to write into space that we don't have.
reserve(spaceToReserve);
}
if (trace.isEntryEnabled())
trace.exit(this, cclass
, "paddingReserveLogSpace", new Object[] { new Long(spaceToReserve) });
return spaceToReserve;
} | java | private long paddingReserveLogSpace(long spaceToReserve) throws ObjectManagerException
{
if (trace.isEntryEnabled())
trace.entry(this,
cclass,
"paddingReserveLogSpace",
new Object[] { new Long(spaceToReserve) });
synchronized (paddingSpaceLock)
{
// adjust the padding space
paddingSpaceAvailable -= spaceToReserve;
// is this a reserve or unreserve
if (spaceToReserve > 0)
{
// space being reserved
// if paddingSpaceAvailable has gone negative we should do a real reserve for the
// difference. Don't let paddingSpaceAvailable go negative!
// Also cut an FFDC because this should not happen!
if (paddingSpaceAvailable < 0)
{
NegativePaddingSpaceException exception = new NegativePaddingSpaceException(this, paddingSpaceAvailable);
ObjectManager.ffdc.processException(this,
cclass,
"paddingReserveLogSpace",
exception,
"1:1088:1.52");
spaceToReserve = -paddingSpaceAvailable;
paddingSpaceAvailable = 0;
}
else
{
// success case - we don't need to reserve any more
spaceToReserve = 0;
}
}
else
{
// its an unreserve.
if (paddingSpaceAvailable > PADDING_SPACE_TARGET)
{
// space being unreserved and we have exceeded our target so need to give some back
spaceToReserve = PADDING_SPACE_TARGET - paddingSpaceAvailable;
paddingSpaceAvailable = PADDING_SPACE_TARGET;
}
else
{
// space being unreserved and we will keep it all
spaceToReserve = 0;
}
}
} // drop lock before giving back any space
if (spaceToReserve != 0)
{
// this can throw ObjectManagerException, only if spaceToReserve is positive.
// This is good, because not only should spaceToReserve never be positive,
// we must stop now because we are about to write into space that we don't have.
reserve(spaceToReserve);
}
if (trace.isEntryEnabled())
trace.exit(this, cclass
, "paddingReserveLogSpace", new Object[] { new Long(spaceToReserve) });
return spaceToReserve;
} | [
"private",
"long",
"paddingReserveLogSpace",
"(",
"long",
"spaceToReserve",
")",
"throws",
"ObjectManagerException",
"{",
"if",
"(",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"paddingReserveLogSpace\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"spaceToReserve",
")",
"}",
")",
";",
"synchronized",
"(",
"paddingSpaceLock",
")",
"{",
"// adjust the padding space",
"paddingSpaceAvailable",
"-=",
"spaceToReserve",
";",
"// is this a reserve or unreserve",
"if",
"(",
"spaceToReserve",
">",
"0",
")",
"{",
"// space being reserved ",
"// if paddingSpaceAvailable has gone negative we should do a real reserve for the ",
"// difference. Don't let paddingSpaceAvailable go negative!",
"// Also cut an FFDC because this should not happen!",
"if",
"(",
"paddingSpaceAvailable",
"<",
"0",
")",
"{",
"NegativePaddingSpaceException",
"exception",
"=",
"new",
"NegativePaddingSpaceException",
"(",
"this",
",",
"paddingSpaceAvailable",
")",
";",
"ObjectManager",
".",
"ffdc",
".",
"processException",
"(",
"this",
",",
"cclass",
",",
"\"paddingReserveLogSpace\"",
",",
"exception",
",",
"\"1:1088:1.52\"",
")",
";",
"spaceToReserve",
"=",
"-",
"paddingSpaceAvailable",
";",
"paddingSpaceAvailable",
"=",
"0",
";",
"}",
"else",
"{",
"// success case - we don't need to reserve any more",
"spaceToReserve",
"=",
"0",
";",
"}",
"}",
"else",
"{",
"// its an unreserve.",
"if",
"(",
"paddingSpaceAvailable",
">",
"PADDING_SPACE_TARGET",
")",
"{",
"// space being unreserved and we have exceeded our target so need to give some back",
"spaceToReserve",
"=",
"PADDING_SPACE_TARGET",
"-",
"paddingSpaceAvailable",
";",
"paddingSpaceAvailable",
"=",
"PADDING_SPACE_TARGET",
";",
"}",
"else",
"{",
"// space being unreserved and we will keep it all",
"spaceToReserve",
"=",
"0",
";",
"}",
"}",
"}",
"// drop lock before giving back any space",
"if",
"(",
"spaceToReserve",
"!=",
"0",
")",
"{",
"// this can throw ObjectManagerException, only if spaceToReserve is positive.",
"// This is good, because not only should spaceToReserve never be positive,",
"// we must stop now because we are about to write into space that we don't have.",
"reserve",
"(",
"spaceToReserve",
")",
";",
"}",
"if",
"(",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"paddingReserveLogSpace\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"spaceToReserve",
")",
"}",
")",
";",
"return",
"spaceToReserve",
";",
"}"
] | Reserve or unreserve log space, but keep back an amount used for padding. This method is used to ensure
there is always enough padding space by keeping back space returned by add, delete and replace operations
committing or backing out which was reserved up front.
This never fails. It gives space even if not available.
@param spaceToReseve either positive or negative. If negative we give to paddingSpace first before returning
the rest. If positive we deduct from the space we have held back.
@return the space actually reserved.
@throws ObjectManagerException | [
"Reserve",
"or",
"unreserve",
"log",
"space",
"but",
"keep",
"back",
"an",
"amount",
"used",
"for",
"padding",
".",
"This",
"method",
"is",
"used",
"to",
"ensure",
"there",
"is",
"always",
"enough",
"padding",
"space",
"by",
"keeping",
"back",
"space",
"returned",
"by",
"add",
"delete",
"and",
"replace",
"operations",
"committing",
"or",
"backing",
"out",
"which",
"was",
"reserved",
"up",
"front",
".",
"This",
"never",
"fails",
".",
"It",
"gives",
"space",
"even",
"if",
"not",
"available",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java#L1056-L1124 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java | FileLogOutput.writeNext | protected final long writeNext(LogRecord logRecord
, long reservedDelta
, boolean checkSpace
, boolean flush
)
throws ObjectManagerException
{
// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
// trace.entry(this,
// cclass,
// "writeNext",
// new Object[] {logRecord,
// new Long(reservedDelta),
// new Boolean(checkSpace),
// new Boolean (flush));
long logSequenceNumber = addLogRecord(logRecord,
reservedDelta,
false,
checkSpace,
flush);
// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
// trace.exit(this,
// cclass,
// "writeNext",
// new Object[] {new Long(logSequenceNumber)});
return logSequenceNumber;
} | java | protected final long writeNext(LogRecord logRecord
, long reservedDelta
, boolean checkSpace
, boolean flush
)
throws ObjectManagerException
{
// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
// trace.entry(this,
// cclass,
// "writeNext",
// new Object[] {logRecord,
// new Long(reservedDelta),
// new Boolean(checkSpace),
// new Boolean (flush));
long logSequenceNumber = addLogRecord(logRecord,
reservedDelta,
false,
checkSpace,
flush);
// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
// trace.exit(this,
// cclass,
// "writeNext",
// new Object[] {new Long(logSequenceNumber)});
return logSequenceNumber;
} | [
"protected",
"final",
"long",
"writeNext",
"(",
"LogRecord",
"logRecord",
",",
"long",
"reservedDelta",
",",
"boolean",
"checkSpace",
",",
"boolean",
"flush",
")",
"throws",
"ObjectManagerException",
"{",
"// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) ",
"// trace.entry(this,",
"// cclass,",
"// \"writeNext\",",
"// new Object[] {logRecord,",
"// new Long(reservedDelta),",
"// new Boolean(checkSpace),",
"// new Boolean (flush));",
"long",
"logSequenceNumber",
"=",
"addLogRecord",
"(",
"logRecord",
",",
"reservedDelta",
",",
"false",
",",
"checkSpace",
",",
"flush",
")",
";",
"// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())",
"// trace.exit(this,",
"// cclass,",
"// \"writeNext\",",
"// new Object[] {new Long(logSequenceNumber)});",
"return",
"logSequenceNumber",
";",
"}"
] | Copy a LogRecord into the LogBuffer ready to write to end of the LogFile.
@param logRecord to be appended.
@param reservedDelta the change to the number of reserved bytes if this write is successful.
@param checkSpace true is we should check that log file space is available before filling the buffer.
@param flush true if the logReciord must be forced to disk before we return.
@return long Log Sequence Number identifies the poition in the log.
@throws ObjectManagerException | [
"Copy",
"a",
"LogRecord",
"into",
"the",
"LogBuffer",
"ready",
"to",
"write",
"to",
"end",
"of",
"the",
"LogFile",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java#L1137-L1166 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java | FileLogOutput.markAndWriteNext | protected final long markAndWriteNext(LogRecord logRecord,
long reservedDelta,
boolean checkSpace,
boolean flush)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"markAndWriteNext",
new Object[] { logRecord,
new Long(reservedDelta),
new Boolean(checkSpace),
new Boolean(flush) });
long logSequenceNumber;
synchronized (fileMarkLock) {
logSequenceNumber = addLogRecord(logRecord,
reservedDelta,
true,
checkSpace,
flush);
} // synchronized (fileMarkLock).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "markAndWriteNext"
, new Object[] { new Long(logSequenceNumber), new Long(fileMark) }
);
return logSequenceNumber;
} | java | protected final long markAndWriteNext(LogRecord logRecord,
long reservedDelta,
boolean checkSpace,
boolean flush)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"markAndWriteNext",
new Object[] { logRecord,
new Long(reservedDelta),
new Boolean(checkSpace),
new Boolean(flush) });
long logSequenceNumber;
synchronized (fileMarkLock) {
logSequenceNumber = addLogRecord(logRecord,
reservedDelta,
true,
checkSpace,
flush);
} // synchronized (fileMarkLock).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "markAndWriteNext"
, new Object[] { new Long(logSequenceNumber), new Long(fileMark) }
);
return logSequenceNumber;
} | [
"protected",
"final",
"long",
"markAndWriteNext",
"(",
"LogRecord",
"logRecord",
",",
"long",
"reservedDelta",
",",
"boolean",
"checkSpace",
",",
"boolean",
"flush",
")",
"throws",
"ObjectManagerException",
"{",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"markAndWriteNext\"",
",",
"new",
"Object",
"[",
"]",
"{",
"logRecord",
",",
"new",
"Long",
"(",
"reservedDelta",
")",
",",
"new",
"Boolean",
"(",
"checkSpace",
")",
",",
"new",
"Boolean",
"(",
"flush",
")",
"}",
")",
";",
"long",
"logSequenceNumber",
";",
"synchronized",
"(",
"fileMarkLock",
")",
"{",
"logSequenceNumber",
"=",
"addLogRecord",
"(",
"logRecord",
",",
"reservedDelta",
",",
"true",
",",
"checkSpace",
",",
"flush",
")",
";",
"}",
"// synchronized (fileMarkLock).",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"markAndWriteNext\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"logSequenceNumber",
")",
",",
"new",
"Long",
"(",
"fileMark",
")",
"}",
")",
";",
"return",
"logSequenceNumber",
";",
"}"
] | Includes a LogRecord in a FlushSet for writing to end of the LogFile,
as with writeNext but also sets the truncation mark to immediately befrore
the written logRecord.
@param logRecord to be appended.
@param reservedDelta the change to the number of reserved bytes if this write is successful.
@param checkSpace true is we should check that log file space is available before
filling the buffer.
@param flush true if the logRecord must be forced to disk befpre we return.
@return long Log Sequence Number identifies the poition in the log.
@throws ObjectManagerException | [
"Includes",
"a",
"LogRecord",
"in",
"a",
"FlushSet",
"for",
"writing",
"to",
"end",
"of",
"the",
"LogFile",
"as",
"with",
"writeNext",
"but",
"also",
"sets",
"the",
"truncation",
"mark",
"to",
"immediately",
"befrore",
"the",
"written",
"logRecord",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java#L1181-L1211 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java | FileLogOutput.addPart | private int addPart(LogRecord logRecord,
byte[] fillingBuffer,
boolean completed,
int offset,
int partLength)
throws ObjectManagerException
{
final String methodName = "addPart";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
methodName,
new Object[] { logRecord,
fillingBuffer,
new Boolean(completed),
new Integer(offset),
new Integer(partLength) });
// Make the part header.
byte[] partHeader = new byte[partHeaderLength];
if (completed)
partHeader[0] = PART_Last;
else if (logRecord.atStart())
partHeader[0] = PART_First;
else
partHeader[0] = PART_Middle;
partHeader[1] = logRecord.multiPartID;
partHeader[2] = (byte) (partLength >>> 8);
partHeader[3] = (byte) (partLength >>> 0);
// Place the part header into the logBuffer.
// Calculate how much of the partHeader will fit in this page.
int remainder = pageSize - offset % pageSize;
int length = Math.min(remainder, partHeaderLength);
System.arraycopy(partHeader,
0,
fillingBuffer,
offset,
length);
offset = offset + length;
// If we are now positioned at the first byte in a page, skip over it.
if (remainder <= partHeaderLength)
offset++;
// Have we wrapped the logBuffer?
if (offset >= fillingBuffer.length) {
fillingBuffer = logBuffer.buffer;
offset = 1;
} // if (offset >= logBuffer.length).
// Did the whole part header fit in the previous page, was there any overflow?
if (length < partHeaderLength) {
// Copy the piece covering the page boundary one byte further down the logBuffer.
// We may copy the entire part header.
System.arraycopy(partHeader,
length,
fillingBuffer,
offset,
partHeaderLength - length);
offset = offset + partHeaderLength - length;
} // if (length < partHeaderLength).
// Now copy in the the part of the LogRecord.
int bytesToAdd = Math.min(pageSize - (offset % pageSize)
, partLength
);
// Fill one page at a time.
// If offset leaves us about to write on the first byte in a page then we will write
// zero bytes first time round the loop and step over the sector byte.
for (;;) {
// See if we have stepped past the end of the log buffer.
if (offset >= fillingBuffer.length) {
fillingBuffer = logBuffer.buffer;
offset = 1;
} // if (offset >= logBuffer.length).
offset = logRecord.fillBuffer(fillingBuffer
, offset
, bytesToAdd
);
partLength = partLength - bytesToAdd;
if (partLength == 0)
break;
bytesToAdd = Math.min(pageSize - 1
, partLength
);
offset++; // Step past the next sector bits.
} // for (;;).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName,
new Object[] { new Integer(offset) });
return offset;
} | java | private int addPart(LogRecord logRecord,
byte[] fillingBuffer,
boolean completed,
int offset,
int partLength)
throws ObjectManagerException
{
final String methodName = "addPart";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
methodName,
new Object[] { logRecord,
fillingBuffer,
new Boolean(completed),
new Integer(offset),
new Integer(partLength) });
// Make the part header.
byte[] partHeader = new byte[partHeaderLength];
if (completed)
partHeader[0] = PART_Last;
else if (logRecord.atStart())
partHeader[0] = PART_First;
else
partHeader[0] = PART_Middle;
partHeader[1] = logRecord.multiPartID;
partHeader[2] = (byte) (partLength >>> 8);
partHeader[3] = (byte) (partLength >>> 0);
// Place the part header into the logBuffer.
// Calculate how much of the partHeader will fit in this page.
int remainder = pageSize - offset % pageSize;
int length = Math.min(remainder, partHeaderLength);
System.arraycopy(partHeader,
0,
fillingBuffer,
offset,
length);
offset = offset + length;
// If we are now positioned at the first byte in a page, skip over it.
if (remainder <= partHeaderLength)
offset++;
// Have we wrapped the logBuffer?
if (offset >= fillingBuffer.length) {
fillingBuffer = logBuffer.buffer;
offset = 1;
} // if (offset >= logBuffer.length).
// Did the whole part header fit in the previous page, was there any overflow?
if (length < partHeaderLength) {
// Copy the piece covering the page boundary one byte further down the logBuffer.
// We may copy the entire part header.
System.arraycopy(partHeader,
length,
fillingBuffer,
offset,
partHeaderLength - length);
offset = offset + partHeaderLength - length;
} // if (length < partHeaderLength).
// Now copy in the the part of the LogRecord.
int bytesToAdd = Math.min(pageSize - (offset % pageSize)
, partLength
);
// Fill one page at a time.
// If offset leaves us about to write on the first byte in a page then we will write
// zero bytes first time round the loop and step over the sector byte.
for (;;) {
// See if we have stepped past the end of the log buffer.
if (offset >= fillingBuffer.length) {
fillingBuffer = logBuffer.buffer;
offset = 1;
} // if (offset >= logBuffer.length).
offset = logRecord.fillBuffer(fillingBuffer
, offset
, bytesToAdd
);
partLength = partLength - bytesToAdd;
if (partLength == 0)
break;
bytesToAdd = Math.min(pageSize - 1
, partLength
);
offset++; // Step past the next sector bits.
} // for (;;).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName,
new Object[] { new Integer(offset) });
return offset;
} | [
"private",
"int",
"addPart",
"(",
"LogRecord",
"logRecord",
",",
"byte",
"[",
"]",
"fillingBuffer",
",",
"boolean",
"completed",
",",
"int",
"offset",
",",
"int",
"partLength",
")",
"throws",
"ObjectManagerException",
"{",
"final",
"String",
"methodName",
"=",
"\"addPart\"",
";",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"methodName",
",",
"new",
"Object",
"[",
"]",
"{",
"logRecord",
",",
"fillingBuffer",
",",
"new",
"Boolean",
"(",
"completed",
")",
",",
"new",
"Integer",
"(",
"offset",
")",
",",
"new",
"Integer",
"(",
"partLength",
")",
"}",
")",
";",
"// Make the part header.",
"byte",
"[",
"]",
"partHeader",
"=",
"new",
"byte",
"[",
"partHeaderLength",
"]",
";",
"if",
"(",
"completed",
")",
"partHeader",
"[",
"0",
"]",
"=",
"PART_Last",
";",
"else",
"if",
"(",
"logRecord",
".",
"atStart",
"(",
")",
")",
"partHeader",
"[",
"0",
"]",
"=",
"PART_First",
";",
"else",
"partHeader",
"[",
"0",
"]",
"=",
"PART_Middle",
";",
"partHeader",
"[",
"1",
"]",
"=",
"logRecord",
".",
"multiPartID",
";",
"partHeader",
"[",
"2",
"]",
"=",
"(",
"byte",
")",
"(",
"partLength",
">>>",
"8",
")",
";",
"partHeader",
"[",
"3",
"]",
"=",
"(",
"byte",
")",
"(",
"partLength",
">>>",
"0",
")",
";",
"// Place the part header into the logBuffer.",
"// Calculate how much of the partHeader will fit in this page. ",
"int",
"remainder",
"=",
"pageSize",
"-",
"offset",
"%",
"pageSize",
";",
"int",
"length",
"=",
"Math",
".",
"min",
"(",
"remainder",
",",
"partHeaderLength",
")",
";",
"System",
".",
"arraycopy",
"(",
"partHeader",
",",
"0",
",",
"fillingBuffer",
",",
"offset",
",",
"length",
")",
";",
"offset",
"=",
"offset",
"+",
"length",
";",
"// If we are now positioned at the first byte in a page, skip over it.",
"if",
"(",
"remainder",
"<=",
"partHeaderLength",
")",
"offset",
"++",
";",
"// Have we wrapped the logBuffer?",
"if",
"(",
"offset",
">=",
"fillingBuffer",
".",
"length",
")",
"{",
"fillingBuffer",
"=",
"logBuffer",
".",
"buffer",
";",
"offset",
"=",
"1",
";",
"}",
"// if (offset >= logBuffer.length).",
"// Did the whole part header fit in the previous page, was there any overflow? ",
"if",
"(",
"length",
"<",
"partHeaderLength",
")",
"{",
"// Copy the piece covering the page boundary one byte further down the logBuffer.",
"// We may copy the entire part header.",
"System",
".",
"arraycopy",
"(",
"partHeader",
",",
"length",
",",
"fillingBuffer",
",",
"offset",
",",
"partHeaderLength",
"-",
"length",
")",
";",
"offset",
"=",
"offset",
"+",
"partHeaderLength",
"-",
"length",
";",
"}",
"// if (length < partHeaderLength).",
"// Now copy in the the part of the LogRecord. ",
"int",
"bytesToAdd",
"=",
"Math",
".",
"min",
"(",
"pageSize",
"-",
"(",
"offset",
"%",
"pageSize",
")",
",",
"partLength",
")",
";",
"// Fill one page at a time.",
"// If offset leaves us about to write on the first byte in a page then we will write ",
"// zero bytes first time round the loop and step over the sector byte. ",
"for",
"(",
";",
";",
")",
"{",
"// See if we have stepped past the end of the log buffer.",
"if",
"(",
"offset",
">=",
"fillingBuffer",
".",
"length",
")",
"{",
"fillingBuffer",
"=",
"logBuffer",
".",
"buffer",
";",
"offset",
"=",
"1",
";",
"}",
"// if (offset >= logBuffer.length). ",
"offset",
"=",
"logRecord",
".",
"fillBuffer",
"(",
"fillingBuffer",
",",
"offset",
",",
"bytesToAdd",
")",
";",
"partLength",
"=",
"partLength",
"-",
"bytesToAdd",
";",
"if",
"(",
"partLength",
"==",
"0",
")",
"break",
";",
"bytesToAdd",
"=",
"Math",
".",
"min",
"(",
"pageSize",
"-",
"1",
",",
"partLength",
")",
";",
"offset",
"++",
";",
"// Step past the next sector bits.",
"}",
"// for (;;). ",
"if",
"(",
"Tracing",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"methodName",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"offset",
")",
"}",
")",
";",
"return",
"offset",
";",
"}"
] | Add the partHeader before the logRecord, and then the part of the logRecord.
If necessary wrap round the end of the log buffer back to the start.
@param logRecord from which the data is to be copied.
@param fillingBuffer the logBuffer to fill. @param boolean true if
the logRecord is completed.
@param completed true if this is the last part to add.
@param offset in the logBuffer where the part header is to go.
@param partLength the length of the part of the LogRecord excluding the partHeader.
@return int the offset after addition of the partHeader.
@throws ObjectManagerException | [
"Add",
"the",
"partHeader",
"before",
"the",
"logRecord",
"and",
"then",
"the",
"part",
"of",
"the",
"logRecord",
".",
"If",
"necessary",
"wrap",
"round",
"the",
"end",
"of",
"the",
"log",
"buffer",
"back",
"to",
"the",
"start",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/FileLogOutput.java#L1754-L1848 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/SweepLruEvictionStrategy.java | SweepLruEvictionStrategy.cancel | public void cancel() { //d583637, F73234
synchronized (ivCancelLock) { //d601399
ivIsCanceled = true;
if (ivScheduledFuture != null)
ivScheduledFuture.cancel(false);
ivCache = null;
ivElements = null;
}
} | java | public void cancel() { //d583637, F73234
synchronized (ivCancelLock) { //d601399
ivIsCanceled = true;
if (ivScheduledFuture != null)
ivScheduledFuture.cancel(false);
ivCache = null;
ivElements = null;
}
} | [
"public",
"void",
"cancel",
"(",
")",
"{",
"//d583637, F73234",
"synchronized",
"(",
"ivCancelLock",
")",
"{",
"//d601399",
"ivIsCanceled",
"=",
"true",
";",
"if",
"(",
"ivScheduledFuture",
"!=",
"null",
")",
"ivScheduledFuture",
".",
"cancel",
"(",
"false",
")",
";",
"ivCache",
"=",
"null",
";",
"ivElements",
"=",
"null",
";",
"}",
"}"
] | Cancel the Scheduled Future object | [
"Cancel",
"the",
"Scheduled",
"Future",
"object"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/SweepLruEvictionStrategy.java#L675-L683 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java | HtmlTextareaRendererBase.renderTextAreaValue | protected void renderTextAreaValue(FacesContext facesContext, UIComponent uiComponent) throws IOException
{
ResponseWriter writer = facesContext.getResponseWriter();
Object addNewLineAtStart = uiComponent.getAttributes().get(ADD_NEW_LINE_AT_START_ATTR);
if (addNewLineAtStart != null)
{
boolean addNewLineAtStartBoolean = false;
if (addNewLineAtStart instanceof String)
{
addNewLineAtStartBoolean = Boolean.valueOf((String)addNewLineAtStart);
}
else if (addNewLineAtStart instanceof Boolean)
{
addNewLineAtStartBoolean = (Boolean) addNewLineAtStart;
}
if (addNewLineAtStartBoolean)
{
writer.writeText("\n", null);
}
}
String strValue = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext, uiComponent);
if (strValue != null)
{
writer.writeText(strValue, org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR);
}
} | java | protected void renderTextAreaValue(FacesContext facesContext, UIComponent uiComponent) throws IOException
{
ResponseWriter writer = facesContext.getResponseWriter();
Object addNewLineAtStart = uiComponent.getAttributes().get(ADD_NEW_LINE_AT_START_ATTR);
if (addNewLineAtStart != null)
{
boolean addNewLineAtStartBoolean = false;
if (addNewLineAtStart instanceof String)
{
addNewLineAtStartBoolean = Boolean.valueOf((String)addNewLineAtStart);
}
else if (addNewLineAtStart instanceof Boolean)
{
addNewLineAtStartBoolean = (Boolean) addNewLineAtStart;
}
if (addNewLineAtStartBoolean)
{
writer.writeText("\n", null);
}
}
String strValue = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext, uiComponent);
if (strValue != null)
{
writer.writeText(strValue, org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR);
}
} | [
"protected",
"void",
"renderTextAreaValue",
"(",
"FacesContext",
"facesContext",
",",
"UIComponent",
"uiComponent",
")",
"throws",
"IOException",
"{",
"ResponseWriter",
"writer",
"=",
"facesContext",
".",
"getResponseWriter",
"(",
")",
";",
"Object",
"addNewLineAtStart",
"=",
"uiComponent",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"ADD_NEW_LINE_AT_START_ATTR",
")",
";",
"if",
"(",
"addNewLineAtStart",
"!=",
"null",
")",
"{",
"boolean",
"addNewLineAtStartBoolean",
"=",
"false",
";",
"if",
"(",
"addNewLineAtStart",
"instanceof",
"String",
")",
"{",
"addNewLineAtStartBoolean",
"=",
"Boolean",
".",
"valueOf",
"(",
"(",
"String",
")",
"addNewLineAtStart",
")",
";",
"}",
"else",
"if",
"(",
"addNewLineAtStart",
"instanceof",
"Boolean",
")",
"{",
"addNewLineAtStartBoolean",
"=",
"(",
"Boolean",
")",
"addNewLineAtStart",
";",
"}",
"if",
"(",
"addNewLineAtStartBoolean",
")",
"{",
"writer",
".",
"writeText",
"(",
"\"\\n\"",
",",
"null",
")",
";",
"}",
"}",
"String",
"strValue",
"=",
"org",
".",
"apache",
".",
"myfaces",
".",
"shared",
".",
"renderkit",
".",
"RendererUtils",
".",
"getStringValue",
"(",
"facesContext",
",",
"uiComponent",
")",
";",
"if",
"(",
"strValue",
"!=",
"null",
")",
"{",
"writer",
".",
"writeText",
"(",
"strValue",
",",
"org",
".",
"apache",
".",
"myfaces",
".",
"shared",
".",
"renderkit",
".",
"JSFAttr",
".",
"VALUE_ATTR",
")",
";",
"}",
"}"
] | Subclasses can override the writing of the "text" value of the textarea | [
"Subclasses",
"can",
"override",
"the",
"writing",
"of",
"the",
"text",
"value",
"of",
"the",
"textarea"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java#L162-L189 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java | PriorityQueue.put | public final void put(long priority, Object value)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "put", new Object[] { new Long(priority), value});
PriorityQueueNode node = new PriorityQueueNode(priority,value);
// Resize the array (double it) if we are out of space.
if (size == elements.length)
{
PriorityQueueNode[] tmp = new PriorityQueueNode[2*size];
System.arraycopy(elements,0,tmp,0,size);
elements = tmp;
}
int pos = size++;
setElement(node, pos);
moveUp(pos);
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "put");
} | java | public final void put(long priority, Object value)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "put", new Object[] { new Long(priority), value});
PriorityQueueNode node = new PriorityQueueNode(priority,value);
// Resize the array (double it) if we are out of space.
if (size == elements.length)
{
PriorityQueueNode[] tmp = new PriorityQueueNode[2*size];
System.arraycopy(elements,0,tmp,0,size);
elements = tmp;
}
int pos = size++;
setElement(node, pos);
moveUp(pos);
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "put");
} | [
"public",
"final",
"void",
"put",
"(",
"long",
"priority",
",",
"Object",
"value",
")",
"{",
"// if (tc.isEntryEnabled())",
"// SibTr.entry(tc, \"put\", new Object[] { new Long(priority), value});",
"PriorityQueueNode",
"node",
"=",
"new",
"PriorityQueueNode",
"(",
"priority",
",",
"value",
")",
";",
"// Resize the array (double it) if we are out of space.",
"if",
"(",
"size",
"==",
"elements",
".",
"length",
")",
"{",
"PriorityQueueNode",
"[",
"]",
"tmp",
"=",
"new",
"PriorityQueueNode",
"[",
"2",
"*",
"size",
"]",
";",
"System",
".",
"arraycopy",
"(",
"elements",
",",
"0",
",",
"tmp",
",",
"0",
",",
"size",
")",
";",
"elements",
"=",
"tmp",
";",
"}",
"int",
"pos",
"=",
"size",
"++",
";",
"setElement",
"(",
"node",
",",
"pos",
")",
";",
"moveUp",
"(",
"pos",
")",
";",
"// if (tc.isEntryEnabled())",
"// SibTr.exit(tc, \"put\");",
"}"
] | Insert data with the given priority into the heap and heapify.
@param priority the priority to associate with the new data.
@param value the date to enqueue. | [
"Insert",
"data",
"with",
"the",
"given",
"priority",
"into",
"the",
"heap",
"and",
"heapify",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java#L155-L177 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java | PriorityQueue.moveUp | protected void moveUp(int pos)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "moveUp", new Integer(pos));
PriorityQueueNode node = elements[pos];
long priority = node.priority;
while ((pos > 0) && (elements[parent(pos)].priority > priority))
{
setElement(elements[parent(pos)], pos);
pos = parent(pos);
}
setElement(node, pos);
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "moveUp");
} | java | protected void moveUp(int pos)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "moveUp", new Integer(pos));
PriorityQueueNode node = elements[pos];
long priority = node.priority;
while ((pos > 0) && (elements[parent(pos)].priority > priority))
{
setElement(elements[parent(pos)], pos);
pos = parent(pos);
}
setElement(node, pos);
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "moveUp");
} | [
"protected",
"void",
"moveUp",
"(",
"int",
"pos",
")",
"{",
"// if (tc.isEntryEnabled())",
"// SibTr.entry(tc, \"moveUp\", new Integer(pos));",
"PriorityQueueNode",
"node",
"=",
"elements",
"[",
"pos",
"]",
";",
"long",
"priority",
"=",
"node",
".",
"priority",
";",
"while",
"(",
"(",
"pos",
">",
"0",
")",
"&&",
"(",
"elements",
"[",
"parent",
"(",
"pos",
")",
"]",
".",
"priority",
">",
"priority",
")",
")",
"{",
"setElement",
"(",
"elements",
"[",
"parent",
"(",
"pos",
")",
"]",
",",
"pos",
")",
";",
"pos",
"=",
"parent",
"(",
"pos",
")",
";",
"}",
"setElement",
"(",
"node",
",",
"pos",
")",
";",
"// if (tc.isEntryEnabled())",
"// SibTr.exit(tc, \"moveUp\");",
"}"
] | Advance a node in the queue based on its priority.
@param pos the index of the nod to advance. | [
"Advance",
"a",
"node",
"in",
"the",
"queue",
"based",
"on",
"its",
"priority",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java#L184-L202 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java | PriorityQueue.getMin | public final Object getMin()
throws NoSuchElementException
{
PriorityQueueNode max = null;
if (size == 0)
throw new NoSuchElementException();
max = elements[0];
setElement(elements[--size], 0);
heapify(0);
return max.value;
} | java | public final Object getMin()
throws NoSuchElementException
{
PriorityQueueNode max = null;
if (size == 0)
throw new NoSuchElementException();
max = elements[0];
setElement(elements[--size], 0);
heapify(0);
return max.value;
} | [
"public",
"final",
"Object",
"getMin",
"(",
")",
"throws",
"NoSuchElementException",
"{",
"PriorityQueueNode",
"max",
"=",
"null",
";",
"if",
"(",
"size",
"==",
"0",
")",
"throw",
"new",
"NoSuchElementException",
"(",
")",
";",
"max",
"=",
"elements",
"[",
"0",
"]",
";",
"setElement",
"(",
"elements",
"[",
"--",
"size",
"]",
",",
"0",
")",
";",
"heapify",
"(",
"0",
")",
";",
"return",
"max",
".",
"value",
";",
"}"
] | Dequeue the highest priority element from the queue.
@return the highest priority object.
@throws NoSuchElementException if the queue is empty. | [
"Dequeue",
"the",
"highest",
"priority",
"element",
"from",
"the",
"queue",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java#L210-L222 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java | PriorityQueue.setElement | protected final void setElement(PriorityQueueNode node, int pos)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "setElement", new Object[] { node, new Integer(pos)});
elements[pos] = node;
node.pos = pos;
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "setElement");
} | java | protected final void setElement(PriorityQueueNode node, int pos)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "setElement", new Object[] { node, new Integer(pos)});
elements[pos] = node;
node.pos = pos;
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "setElement");
} | [
"protected",
"final",
"void",
"setElement",
"(",
"PriorityQueueNode",
"node",
",",
"int",
"pos",
")",
"{",
"// if (tc.isEntryEnabled())",
"// SibTr.entry(tc, \"setElement\", new Object[] { node, new Integer(pos)});",
"elements",
"[",
"pos",
"]",
"=",
"node",
";",
"node",
".",
"pos",
"=",
"pos",
";",
"// if (tc.isEntryEnabled())",
"// SibTr.exit(tc, \"setElement\");",
"}"
] | Set an element in the queue.
@param node the element to place.
@param pos the position of the element. | [
"Set",
"an",
"element",
"in",
"the",
"queue",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java#L230-L240 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java | PriorityQueue.heapify | protected void heapify(int position)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "heapify", new Integer(position));
// Heapify the remaining heap
int i = -1;
int l;
int r;
int smallest = position;
// Heapify routine from CMR.
// This was done without recursion.
while (smallest != i)
{
i = smallest;
l = left(i);
r = right(i);
if ((l < size) && (elements[l].priority < elements[i].priority))
smallest = l;
else smallest = i;
if ((r < size) && (elements[r].priority < elements[smallest].priority))
smallest = r;
if (smallest != i)
{
PriorityQueueNode tmp = elements[smallest];
setElement(elements[i], smallest);
setElement(tmp, i);
}
}
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "heapify");
} | java | protected void heapify(int position)
{
// if (tc.isEntryEnabled())
// SibTr.entry(tc, "heapify", new Integer(position));
// Heapify the remaining heap
int i = -1;
int l;
int r;
int smallest = position;
// Heapify routine from CMR.
// This was done without recursion.
while (smallest != i)
{
i = smallest;
l = left(i);
r = right(i);
if ((l < size) && (elements[l].priority < elements[i].priority))
smallest = l;
else smallest = i;
if ((r < size) && (elements[r].priority < elements[smallest].priority))
smallest = r;
if (smallest != i)
{
PriorityQueueNode tmp = elements[smallest];
setElement(elements[i], smallest);
setElement(tmp, i);
}
}
// if (tc.isEntryEnabled())
// SibTr.exit(tc, "heapify");
} | [
"protected",
"void",
"heapify",
"(",
"int",
"position",
")",
"{",
"// if (tc.isEntryEnabled())",
"// SibTr.entry(tc, \"heapify\", new Integer(position));",
"// Heapify the remaining heap",
"int",
"i",
"=",
"-",
"1",
";",
"int",
"l",
";",
"int",
"r",
";",
"int",
"smallest",
"=",
"position",
";",
"// Heapify routine from CMR.",
"// This was done without recursion.",
"while",
"(",
"smallest",
"!=",
"i",
")",
"{",
"i",
"=",
"smallest",
";",
"l",
"=",
"left",
"(",
"i",
")",
";",
"r",
"=",
"right",
"(",
"i",
")",
";",
"if",
"(",
"(",
"l",
"<",
"size",
")",
"&&",
"(",
"elements",
"[",
"l",
"]",
".",
"priority",
"<",
"elements",
"[",
"i",
"]",
".",
"priority",
")",
")",
"smallest",
"=",
"l",
";",
"else",
"smallest",
"=",
"i",
";",
"if",
"(",
"(",
"r",
"<",
"size",
")",
"&&",
"(",
"elements",
"[",
"r",
"]",
".",
"priority",
"<",
"elements",
"[",
"smallest",
"]",
".",
"priority",
")",
")",
"smallest",
"=",
"r",
";",
"if",
"(",
"smallest",
"!=",
"i",
")",
"{",
"PriorityQueueNode",
"tmp",
"=",
"elements",
"[",
"smallest",
"]",
";",
"setElement",
"(",
"elements",
"[",
"i",
"]",
",",
"smallest",
")",
";",
"setElement",
"(",
"tmp",
",",
"i",
")",
";",
"}",
"}",
"// if (tc.isEntryEnabled())",
"// SibTr.exit(tc, \"heapify\");",
"}"
] | Reheap the queue.
@param position The position from which to start reheaping. | [
"Reheap",
"the",
"queue",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java#L247-L280 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/JPAAccessor.java | JPAAccessor.setJPAComponent | public static void setJPAComponent(JPAComponent instance)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "setJPAComponent", instance);
jpaComponent = instance;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "setJPAComponent");
} | java | public static void setJPAComponent(JPAComponent instance)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "setJPAComponent", instance);
jpaComponent = instance;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "setJPAComponent");
} | [
"public",
"static",
"void",
"setJPAComponent",
"(",
"JPAComponent",
"instance",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"setJPAComponent\"",
",",
"instance",
")",
";",
"jpaComponent",
"=",
"instance",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"setJPAComponent\"",
")",
";",
"}"
] | Return the default JPAComponent object in the application server. | [
"Return",
"the",
"default",
"JPAComponent",
"object",
"in",
"the",
"application",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/JPAAccessor.java#L37-L46 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/CompositeTagDecorator.java | CompositeTagDecorator.decorate | public Tag decorate(Tag tag)
{
Tag t = null;
for (int i = 0; i < this.decorators.length; i++)
{
t = this.decorators[i].decorate(tag);
if (t != null)
{
return t;
}
}
return tag;
} | java | public Tag decorate(Tag tag)
{
Tag t = null;
for (int i = 0; i < this.decorators.length; i++)
{
t = this.decorators[i].decorate(tag);
if (t != null)
{
return t;
}
}
return tag;
} | [
"public",
"Tag",
"decorate",
"(",
"Tag",
"tag",
")",
"{",
"Tag",
"t",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"decorators",
".",
"length",
";",
"i",
"++",
")",
"{",
"t",
"=",
"this",
".",
"decorators",
"[",
"i",
"]",
".",
"decorate",
"(",
"tag",
")",
";",
"if",
"(",
"t",
"!=",
"null",
")",
"{",
"return",
"t",
";",
"}",
"}",
"return",
"tag",
";",
"}"
] | Uses the chain of responsibility pattern to stop processing if any of the TagDecorators return a value other than
null.
@see javax.faces.view.facelets.TagDecorator#decorate(javax.faces.view.facelets.Tag) | [
"Uses",
"the",
"chain",
"of",
"responsibility",
"pattern",
"to",
"stop",
"processing",
"if",
"any",
"of",
"the",
"TagDecorators",
"return",
"a",
"value",
"other",
"than",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/CompositeTagDecorator.java#L50-L62 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractConfigBuilder.java | AbstractConfigBuilder.getConverters | protected PriorityConverterMap getConverters() {
//the map to be returned
PriorityConverterMap allConverters = new PriorityConverterMap();
//add the default converters
if (addDefaultConvertersFlag()) {
allConverters.addAll(getDefaultConverters());
}
//add the discovered converters
if (addDiscoveredConvertersFlag()) {
allConverters.addAll(DefaultConverters.getDiscoveredConverters(getClassLoader()));
}
//finally add the programatically added converters
allConverters.addAll(userConverters);
allConverters.setUnmodifiable();
return allConverters;
} | java | protected PriorityConverterMap getConverters() {
//the map to be returned
PriorityConverterMap allConverters = new PriorityConverterMap();
//add the default converters
if (addDefaultConvertersFlag()) {
allConverters.addAll(getDefaultConverters());
}
//add the discovered converters
if (addDiscoveredConvertersFlag()) {
allConverters.addAll(DefaultConverters.getDiscoveredConverters(getClassLoader()));
}
//finally add the programatically added converters
allConverters.addAll(userConverters);
allConverters.setUnmodifiable();
return allConverters;
} | [
"protected",
"PriorityConverterMap",
"getConverters",
"(",
")",
"{",
"//the map to be returned",
"PriorityConverterMap",
"allConverters",
"=",
"new",
"PriorityConverterMap",
"(",
")",
";",
"//add the default converters",
"if",
"(",
"addDefaultConvertersFlag",
"(",
")",
")",
"{",
"allConverters",
".",
"addAll",
"(",
"getDefaultConverters",
"(",
")",
")",
";",
"}",
"//add the discovered converters",
"if",
"(",
"addDiscoveredConvertersFlag",
"(",
")",
")",
"{",
"allConverters",
".",
"addAll",
"(",
"DefaultConverters",
".",
"getDiscoveredConverters",
"(",
"getClassLoader",
"(",
")",
")",
")",
";",
"}",
"//finally add the programatically added converters",
"allConverters",
".",
"addAll",
"(",
"userConverters",
")",
";",
"allConverters",
".",
"setUnmodifiable",
"(",
")",
";",
"return",
"allConverters",
";",
"}"
] | Get the converters, default, discovered and user registered converters are
included as appropriate.
Call this method only from within a 'synchronized(this) block
@return converters as a Map keyed on Type | [
"Get",
"the",
"converters",
"default",
"discovered",
"and",
"user",
"registered",
"converters",
"are",
"included",
"as",
"appropriate",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractConfigBuilder.java#L226-L244 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaColocatingEndpointActivation.java | SibRaColocatingEndpointActivation.getMEsToCheck | JsMessagingEngine[] getMEsToCheck()
{
final String methodName = "getMEsToCheck";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName);
}
JsMessagingEngine[] retVal = SibRaEngineComponent.getMessagingEngines (_endpointConfiguration.getBusName ());
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(this, TRACE, methodName, retVal);
}
return retVal;
} | java | JsMessagingEngine[] getMEsToCheck()
{
final String methodName = "getMEsToCheck";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName);
}
JsMessagingEngine[] retVal = SibRaEngineComponent.getMessagingEngines (_endpointConfiguration.getBusName ());
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(this, TRACE, methodName, retVal);
}
return retVal;
} | [
"JsMessagingEngine",
"[",
"]",
"getMEsToCheck",
"(",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"getMEsToCheck\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"JsMessagingEngine",
"[",
"]",
"retVal",
"=",
"SibRaEngineComponent",
".",
"getMessagingEngines",
"(",
"_endpointConfiguration",
".",
"getBusName",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"retVal",
")",
";",
"}",
"return",
"retVal",
";",
"}"
] | All Messaging engines, including those that are not running, should be considered part of the list
that the MDB should look at before trying a remote connection.
@return The list of MEs that should be looked at by the RA to see if a connection can be made to them. | [
"All",
"Messaging",
"engines",
"including",
"those",
"that",
"are",
"not",
"running",
"should",
"be",
"considered",
"part",
"of",
"the",
"list",
"that",
"the",
"MDB",
"should",
"look",
"at",
"before",
"trying",
"a",
"remote",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaColocatingEndpointActivation.java#L96-L111 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaColocatingEndpointActivation.java | SibRaColocatingEndpointActivation.removeStoppedMEs | JsMessagingEngine[] removeStoppedMEs (JsMessagingEngine[] MEList)
{
final String methodName = "removeStoppedMEs";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName, MEList);
}
JsMessagingEngine[] startedMEs = SibRaEngineComponent.getActiveMessagingEngines(_endpointConfiguration.getBusName());
List<JsMessagingEngine> runningMEs = Arrays.asList(startedMEs);
List<JsMessagingEngine> newList = new ArrayList<JsMessagingEngine> ();
for (int i = 0; i < MEList.length; i++)
{
JsMessagingEngine nextME = MEList [i];
if (runningMEs.contains(nextME))
{
newList.add (nextME);
}
}
JsMessagingEngine[] retVal = new JsMessagingEngine[newList.size ()];
retVal = newList.toArray (retVal);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(this, TRACE, methodName, retVal);
}
return retVal;
} | java | JsMessagingEngine[] removeStoppedMEs (JsMessagingEngine[] MEList)
{
final String methodName = "removeStoppedMEs";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName, MEList);
}
JsMessagingEngine[] startedMEs = SibRaEngineComponent.getActiveMessagingEngines(_endpointConfiguration.getBusName());
List<JsMessagingEngine> runningMEs = Arrays.asList(startedMEs);
List<JsMessagingEngine> newList = new ArrayList<JsMessagingEngine> ();
for (int i = 0; i < MEList.length; i++)
{
JsMessagingEngine nextME = MEList [i];
if (runningMEs.contains(nextME))
{
newList.add (nextME);
}
}
JsMessagingEngine[] retVal = new JsMessagingEngine[newList.size ()];
retVal = newList.toArray (retVal);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(this, TRACE, methodName, retVal);
}
return retVal;
} | [
"JsMessagingEngine",
"[",
"]",
"removeStoppedMEs",
"(",
"JsMessagingEngine",
"[",
"]",
"MEList",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"removeStoppedMEs\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"MEList",
")",
";",
"}",
"JsMessagingEngine",
"[",
"]",
"startedMEs",
"=",
"SibRaEngineComponent",
".",
"getActiveMessagingEngines",
"(",
"_endpointConfiguration",
".",
"getBusName",
"(",
")",
")",
";",
"List",
"<",
"JsMessagingEngine",
">",
"runningMEs",
"=",
"Arrays",
".",
"asList",
"(",
"startedMEs",
")",
";",
"List",
"<",
"JsMessagingEngine",
">",
"newList",
"=",
"new",
"ArrayList",
"<",
"JsMessagingEngine",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"MEList",
".",
"length",
";",
"i",
"++",
")",
"{",
"JsMessagingEngine",
"nextME",
"=",
"MEList",
"[",
"i",
"]",
";",
"if",
"(",
"runningMEs",
".",
"contains",
"(",
"nextME",
")",
")",
"{",
"newList",
".",
"add",
"(",
"nextME",
")",
";",
"}",
"}",
"JsMessagingEngine",
"[",
"]",
"retVal",
"=",
"new",
"JsMessagingEngine",
"[",
"newList",
".",
"size",
"(",
")",
"]",
";",
"retVal",
"=",
"newList",
".",
"toArray",
"(",
"retVal",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"retVal",
")",
";",
"}",
"return",
"retVal",
";",
"}"
] | This method will remove non running MEs from the supplied array of MEs
@param MEList The list of MEs
@return A new array of MEs which only contain the running MEs from the supplied Array. | [
"This",
"method",
"will",
"remove",
"non",
"running",
"MEs",
"from",
"the",
"supplied",
"array",
"of",
"MEs"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaColocatingEndpointActivation.java#L118-L145 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaColocatingEndpointActivation.java | SibRaColocatingEndpointActivation.messagingEngineDestroyed | public void messagingEngineDestroyed(JsMessagingEngine messagingEngine)
{
final String methodName = "messagingEngineDestroyed";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName, messagingEngine);
}
/*
* If there are no longer any local messaging engines on the required
* bus, switch to a remote messaging engine
*/
final JsMessagingEngine[] localMessagingEngines = SibRaEngineComponent
.getMessagingEngines(_endpointConfiguration.getBusName());
if (0 == localMessagingEngines.length)
{
/*
* The last local messaging engine for the required bus has been
* destroyed; we may be able to now connect remotely so kick off
* a check.
*/
SibTr.info(TRACE, "ME_DESTROYED_CWSIV0779", new Object[] {
messagingEngine.getName(),
_endpointConfiguration.getBusName() });
try
{
clearTimer ();
timerLoop ();
}
catch (final ResourceException exception)
{
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, FFDC_PROBE_1, this);
SibTr.error(TRACE, "MESSAGING_ENGINE_STOPPING_CWSIV0765",
new Object[] { exception, messagingEngine.getName(),
messagingEngine.getBusName() });
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(this, TRACE, methodName);
}
} | java | public void messagingEngineDestroyed(JsMessagingEngine messagingEngine)
{
final String methodName = "messagingEngineDestroyed";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName, messagingEngine);
}
/*
* If there are no longer any local messaging engines on the required
* bus, switch to a remote messaging engine
*/
final JsMessagingEngine[] localMessagingEngines = SibRaEngineComponent
.getMessagingEngines(_endpointConfiguration.getBusName());
if (0 == localMessagingEngines.length)
{
/*
* The last local messaging engine for the required bus has been
* destroyed; we may be able to now connect remotely so kick off
* a check.
*/
SibTr.info(TRACE, "ME_DESTROYED_CWSIV0779", new Object[] {
messagingEngine.getName(),
_endpointConfiguration.getBusName() });
try
{
clearTimer ();
timerLoop ();
}
catch (final ResourceException exception)
{
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, FFDC_PROBE_1, this);
SibTr.error(TRACE, "MESSAGING_ENGINE_STOPPING_CWSIV0765",
new Object[] { exception, messagingEngine.getName(),
messagingEngine.getBusName() });
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(this, TRACE, methodName);
}
} | [
"public",
"void",
"messagingEngineDestroyed",
"(",
"JsMessagingEngine",
"messagingEngine",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"messagingEngineDestroyed\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"messagingEngine",
")",
";",
"}",
"/*\n * If there are no longer any local messaging engines on the required\n * bus, switch to a remote messaging engine\n */",
"final",
"JsMessagingEngine",
"[",
"]",
"localMessagingEngines",
"=",
"SibRaEngineComponent",
".",
"getMessagingEngines",
"(",
"_endpointConfiguration",
".",
"getBusName",
"(",
")",
")",
";",
"if",
"(",
"0",
"==",
"localMessagingEngines",
".",
"length",
")",
"{",
"/*\n * The last local messaging engine for the required bus has been\n * destroyed; we may be able to now connect remotely so kick off\n * a check.\n */",
"SibTr",
".",
"info",
"(",
"TRACE",
",",
"\"ME_DESTROYED_CWSIV0779\"",
",",
"new",
"Object",
"[",
"]",
"{",
"messagingEngine",
".",
"getName",
"(",
")",
",",
"_endpointConfiguration",
".",
"getBusName",
"(",
")",
"}",
")",
";",
"try",
"{",
"clearTimer",
"(",
")",
";",
"timerLoop",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"ResourceException",
"exception",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exception",
",",
"CLASS_NAME",
"+",
"\".\"",
"+",
"methodName",
",",
"FFDC_PROBE_1",
",",
"this",
")",
";",
"SibTr",
".",
"error",
"(",
"TRACE",
",",
"\"MESSAGING_ENGINE_STOPPING_CWSIV0765\"",
",",
"new",
"Object",
"[",
"]",
"{",
"exception",
",",
"messagingEngine",
".",
"getName",
"(",
")",
",",
"messagingEngine",
".",
"getBusName",
"(",
")",
"}",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"}"
] | If a messaging engine is destroyed and there are now no local messaging engines
on the server, then kick off a check to see if we can connect to one. | [
"If",
"a",
"messaging",
"engine",
"is",
"destroyed",
"and",
"there",
"are",
"now",
"no",
"local",
"messaging",
"engines",
"on",
"the",
"server",
"then",
"kick",
"off",
"a",
"check",
"to",
"see",
"if",
"we",
"can",
"connect",
"to",
"one",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaColocatingEndpointActivation.java#L151-L198 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/ServerInstanceLogRecordListImpl.java | ServerInstanceLogRecordListImpl.getCache | public RemoteListCache getCache() {
RemoteRepositoryCache logCache = getLogResult()==null ? null : getLogResult().getCache();
RemoteRepositoryCache traceCache = getTraceResult()==null ? null : getTraceResult().getCache();
return switched ? new RemoteListCacheImpl(traceCache, logCache) : new RemoteListCacheImpl(logCache, traceCache);
} | java | public RemoteListCache getCache() {
RemoteRepositoryCache logCache = getLogResult()==null ? null : getLogResult().getCache();
RemoteRepositoryCache traceCache = getTraceResult()==null ? null : getTraceResult().getCache();
return switched ? new RemoteListCacheImpl(traceCache, logCache) : new RemoteListCacheImpl(logCache, traceCache);
} | [
"public",
"RemoteListCache",
"getCache",
"(",
")",
"{",
"RemoteRepositoryCache",
"logCache",
"=",
"getLogResult",
"(",
")",
"==",
"null",
"?",
"null",
":",
"getLogResult",
"(",
")",
".",
"getCache",
"(",
")",
";",
"RemoteRepositoryCache",
"traceCache",
"=",
"getTraceResult",
"(",
")",
"==",
"null",
"?",
"null",
":",
"getTraceResult",
"(",
")",
".",
"getCache",
"(",
")",
";",
"return",
"switched",
"?",
"new",
"RemoteListCacheImpl",
"(",
"traceCache",
",",
"logCache",
")",
":",
"new",
"RemoteListCacheImpl",
"(",
"logCache",
",",
"traceCache",
")",
";",
"}"
] | returns this result cache usable for remote transport
@return cache instance used in remote log reading | [
"returns",
"this",
"result",
"cache",
"usable",
"for",
"remote",
"transport"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/ServerInstanceLogRecordListImpl.java#L75-L79 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/ServerInstanceLogRecordListImpl.java | ServerInstanceLogRecordListImpl.setCache | public void setCache(RemoteListCache cache) {
if (cache instanceof RemoteListCacheImpl) {
RemoteListCacheImpl cacheImpl = (RemoteListCacheImpl)cache;
if (getLogResult() != null) {
RemoteRepositoryCache logCache = switched ? cacheImpl.getTraceCache() : cacheImpl.getLogCache();
if (logCache != null) {
getLogResult().setCache(logCache);
}
}
if (getTraceResult() != null) {
RemoteRepositoryCache traceCache = switched ? cacheImpl.getLogCache() : cacheImpl.getTraceCache();
if (traceCache != null) {
getTraceResult().setCache(traceCache);
}
}
} else {
throw new IllegalArgumentException("Unknown implementation of the RemoteListCache instance");
}
} | java | public void setCache(RemoteListCache cache) {
if (cache instanceof RemoteListCacheImpl) {
RemoteListCacheImpl cacheImpl = (RemoteListCacheImpl)cache;
if (getLogResult() != null) {
RemoteRepositoryCache logCache = switched ? cacheImpl.getTraceCache() : cacheImpl.getLogCache();
if (logCache != null) {
getLogResult().setCache(logCache);
}
}
if (getTraceResult() != null) {
RemoteRepositoryCache traceCache = switched ? cacheImpl.getLogCache() : cacheImpl.getTraceCache();
if (traceCache != null) {
getTraceResult().setCache(traceCache);
}
}
} else {
throw new IllegalArgumentException("Unknown implementation of the RemoteListCache instance");
}
} | [
"public",
"void",
"setCache",
"(",
"RemoteListCache",
"cache",
")",
"{",
"if",
"(",
"cache",
"instanceof",
"RemoteListCacheImpl",
")",
"{",
"RemoteListCacheImpl",
"cacheImpl",
"=",
"(",
"RemoteListCacheImpl",
")",
"cache",
";",
"if",
"(",
"getLogResult",
"(",
")",
"!=",
"null",
")",
"{",
"RemoteRepositoryCache",
"logCache",
"=",
"switched",
"?",
"cacheImpl",
".",
"getTraceCache",
"(",
")",
":",
"cacheImpl",
".",
"getLogCache",
"(",
")",
";",
"if",
"(",
"logCache",
"!=",
"null",
")",
"{",
"getLogResult",
"(",
")",
".",
"setCache",
"(",
"logCache",
")",
";",
"}",
"}",
"if",
"(",
"getTraceResult",
"(",
")",
"!=",
"null",
")",
"{",
"RemoteRepositoryCache",
"traceCache",
"=",
"switched",
"?",
"cacheImpl",
".",
"getLogCache",
"(",
")",
":",
"cacheImpl",
".",
"getTraceCache",
"(",
")",
";",
"if",
"(",
"traceCache",
"!=",
"null",
")",
"{",
"getTraceResult",
"(",
")",
".",
"setCache",
"(",
"traceCache",
")",
";",
"}",
"}",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknown implementation of the RemoteListCache instance\"",
")",
";",
"}",
"}"
] | sets cache for this result based on the provided one
@param cache cache instance received in a remote call | [
"sets",
"cache",
"for",
"this",
"result",
"based",
"on",
"the",
"provided",
"one"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/ServerInstanceLogRecordListImpl.java#L86-L104 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/ServerInstanceLogRecordListImpl.java | ServerInstanceLogRecordListImpl.getNewIterator | protected Iterator<RepositoryLogRecord> getNewIterator(int offset, int length) {
OnePidRecordListImpl logResult = getLogResult();
OnePidRecordListImpl traceResult = getTraceResult();
if (logResult == null && traceResult == null) {
return EMPTY_ITERATOR;
} else if (traceResult == null) {
return logResult.getNewIterator(offset, length);
} else if (logResult == null) {
return traceResult.getNewIterator(offset, length);
} else {
MergedServerInstanceLogRecordIterator result = new MergedServerInstanceLogRecordIterator(logResult, traceResult);
result.setRange(offset, length);
return result;
}
} | java | protected Iterator<RepositoryLogRecord> getNewIterator(int offset, int length) {
OnePidRecordListImpl logResult = getLogResult();
OnePidRecordListImpl traceResult = getTraceResult();
if (logResult == null && traceResult == null) {
return EMPTY_ITERATOR;
} else if (traceResult == null) {
return logResult.getNewIterator(offset, length);
} else if (logResult == null) {
return traceResult.getNewIterator(offset, length);
} else {
MergedServerInstanceLogRecordIterator result = new MergedServerInstanceLogRecordIterator(logResult, traceResult);
result.setRange(offset, length);
return result;
}
} | [
"protected",
"Iterator",
"<",
"RepositoryLogRecord",
">",
"getNewIterator",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"OnePidRecordListImpl",
"logResult",
"=",
"getLogResult",
"(",
")",
";",
"OnePidRecordListImpl",
"traceResult",
"=",
"getTraceResult",
"(",
")",
";",
"if",
"(",
"logResult",
"==",
"null",
"&&",
"traceResult",
"==",
"null",
")",
"{",
"return",
"EMPTY_ITERATOR",
";",
"}",
"else",
"if",
"(",
"traceResult",
"==",
"null",
")",
"{",
"return",
"logResult",
".",
"getNewIterator",
"(",
"offset",
",",
"length",
")",
";",
"}",
"else",
"if",
"(",
"logResult",
"==",
"null",
")",
"{",
"return",
"traceResult",
".",
"getNewIterator",
"(",
"offset",
",",
"length",
")",
";",
"}",
"else",
"{",
"MergedServerInstanceLogRecordIterator",
"result",
"=",
"new",
"MergedServerInstanceLogRecordIterator",
"(",
"logResult",
",",
"traceResult",
")",
";",
"result",
".",
"setRange",
"(",
"offset",
",",
"length",
")",
";",
"return",
"result",
";",
"}",
"}"
] | Creates new OnePidRecordIterator returning records in the range.
@param offset the number of records skipped from the beginning of the list.
@param length the number of records to return.
@return OnePidRecordIterator instance. | [
"Creates",
"new",
"OnePidRecordIterator",
"returning",
"records",
"in",
"the",
"range",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/ServerInstanceLogRecordListImpl.java#L221-L235 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/injection/WebServiceRefProcessor.java | WebServiceRefProcessor.processXML | @Override
public void processXML() throws InjectionException {
@SuppressWarnings("unchecked")
List<ServiceRef> serviceRefs = (List<ServiceRef>) ivNameSpaceConfig.getWebServiceRefs();
// no need to do any work if there are no service refs in the XML
if (serviceRefs == null || serviceRefs.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No service-refs in XML for module: " + ivNameSpaceConfig.getModuleName());
}
return;
}
ClassLoader moduleClassLoader = ivNameSpaceConfig.getClassLoader();
if (moduleClassLoader == null) {
throw new InjectionException("Internal Error: The classloader of module " + ivNameSpaceConfig.getModuleName() + " is null.");
}
// get all JAX-WS service refs from deployment descriptor
List<ServiceRef> jaxwsServiceRefs = InjectionHelper.normalizeJaxWsServiceRefs(serviceRefs, moduleClassLoader);
if (jaxwsServiceRefs.isEmpty()) {
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found JAX-WS service refs in XML for module: " + ivNameSpaceConfig.getModuleName());
}
// build up the metadata and create WebServiceRefBinding instances that will be used by the injection engine,
// then we will be saving off this metadata in the module or component metadata slot for later use by our ServiceRefObjectFactory
List<InjectionBinding<WebServiceRef>> bindingList = WebServiceRefBindingBuilder.buildJaxWsWebServiceRefBindings(jaxwsServiceRefs, ivNameSpaceConfig);
// now add all the bindings that were created
if (bindingList != null && !bindingList.isEmpty()) {
for (InjectionBinding<WebServiceRef> binding : bindingList) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Adding binding for JAX-WS service-ref: " + binding.getJndiName());
}
addInjectionBinding(binding);
}
}
} | java | @Override
public void processXML() throws InjectionException {
@SuppressWarnings("unchecked")
List<ServiceRef> serviceRefs = (List<ServiceRef>) ivNameSpaceConfig.getWebServiceRefs();
// no need to do any work if there are no service refs in the XML
if (serviceRefs == null || serviceRefs.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No service-refs in XML for module: " + ivNameSpaceConfig.getModuleName());
}
return;
}
ClassLoader moduleClassLoader = ivNameSpaceConfig.getClassLoader();
if (moduleClassLoader == null) {
throw new InjectionException("Internal Error: The classloader of module " + ivNameSpaceConfig.getModuleName() + " is null.");
}
// get all JAX-WS service refs from deployment descriptor
List<ServiceRef> jaxwsServiceRefs = InjectionHelper.normalizeJaxWsServiceRefs(serviceRefs, moduleClassLoader);
if (jaxwsServiceRefs.isEmpty()) {
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found JAX-WS service refs in XML for module: " + ivNameSpaceConfig.getModuleName());
}
// build up the metadata and create WebServiceRefBinding instances that will be used by the injection engine,
// then we will be saving off this metadata in the module or component metadata slot for later use by our ServiceRefObjectFactory
List<InjectionBinding<WebServiceRef>> bindingList = WebServiceRefBindingBuilder.buildJaxWsWebServiceRefBindings(jaxwsServiceRefs, ivNameSpaceConfig);
// now add all the bindings that were created
if (bindingList != null && !bindingList.isEmpty()) {
for (InjectionBinding<WebServiceRef> binding : bindingList) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Adding binding for JAX-WS service-ref: " + binding.getJndiName());
}
addInjectionBinding(binding);
}
}
} | [
"@",
"Override",
"public",
"void",
"processXML",
"(",
")",
"throws",
"InjectionException",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"List",
"<",
"ServiceRef",
">",
"serviceRefs",
"=",
"(",
"List",
"<",
"ServiceRef",
">",
")",
"ivNameSpaceConfig",
".",
"getWebServiceRefs",
"(",
")",
";",
"// no need to do any work if there are no service refs in the XML",
"if",
"(",
"serviceRefs",
"==",
"null",
"||",
"serviceRefs",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"No service-refs in XML for module: \"",
"+",
"ivNameSpaceConfig",
".",
"getModuleName",
"(",
")",
")",
";",
"}",
"return",
";",
"}",
"ClassLoader",
"moduleClassLoader",
"=",
"ivNameSpaceConfig",
".",
"getClassLoader",
"(",
")",
";",
"if",
"(",
"moduleClassLoader",
"==",
"null",
")",
"{",
"throw",
"new",
"InjectionException",
"(",
"\"Internal Error: The classloader of module \"",
"+",
"ivNameSpaceConfig",
".",
"getModuleName",
"(",
")",
"+",
"\" is null.\"",
")",
";",
"}",
"// get all JAX-WS service refs from deployment descriptor",
"List",
"<",
"ServiceRef",
">",
"jaxwsServiceRefs",
"=",
"InjectionHelper",
".",
"normalizeJaxWsServiceRefs",
"(",
"serviceRefs",
",",
"moduleClassLoader",
")",
";",
"if",
"(",
"jaxwsServiceRefs",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Found JAX-WS service refs in XML for module: \"",
"+",
"ivNameSpaceConfig",
".",
"getModuleName",
"(",
")",
")",
";",
"}",
"// build up the metadata and create WebServiceRefBinding instances that will be used by the injection engine, ",
"// then we will be saving off this metadata in the module or component metadata slot for later use by our ServiceRefObjectFactory",
"List",
"<",
"InjectionBinding",
"<",
"WebServiceRef",
">",
">",
"bindingList",
"=",
"WebServiceRefBindingBuilder",
".",
"buildJaxWsWebServiceRefBindings",
"(",
"jaxwsServiceRefs",
",",
"ivNameSpaceConfig",
")",
";",
"// now add all the bindings that were created",
"if",
"(",
"bindingList",
"!=",
"null",
"&&",
"!",
"bindingList",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"InjectionBinding",
"<",
"WebServiceRef",
">",
"binding",
":",
"bindingList",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Adding binding for JAX-WS service-ref: \"",
"+",
"binding",
".",
"getJndiName",
"(",
")",
")",
";",
"}",
"addInjectionBinding",
"(",
"binding",
")",
";",
"}",
"}",
"}"
] | This method will process any service-ref elements in the client's deployment descriptor. | [
"This",
"method",
"will",
"process",
"any",
"service",
"-",
"ref",
"elements",
"in",
"the",
"client",
"s",
"deployment",
"descriptor",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/injection/WebServiceRefProcessor.java#L81-L126 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/injection/WebServiceRefProcessor.java | WebServiceRefProcessor.resolve | @Override
public void resolve(InjectionBinding<WebServiceRef> binding) throws InjectionException {
// This was a JAX-WS service reference, we need to do some setup for
// our object factory, and we also need to make sure we store the
// metadata away in the appropriate location.
WebServiceRefInfo wsrInfo = ((WebServiceRefBinding) binding).getWebServiceRefInfo();
Reference ref = null;
// If the "lookup-name" attribute was specified for this service-ref, then we'll bind into the namespace
// an instance of the IndirectJndiLookup reference that will be resolved by the IndirectJndiLookupObjectFactory.
// If a JNDI lookup is performed on this "service-ref", then the IndirectJndiLookupObjectFactory will simply
// turn around and handle the extra level of indirection by looking up the referenced service-ref, which
// will in turn cause our ServiceRefObjectFactory to be invoked.
if (wsrInfo.getLookupName() != null && !wsrInfo.getLookupName().isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Build IndirectJndiLookup(" + wsrInfo.getLookupName() + ") for service-ref '" + wsrInfo.getJndiName());
}
IndirectJndiLookupReferenceFactory factory = ivNameSpaceConfig.getIndirectJndiLookupReferenceFactory();
ref = factory.createIndirectJndiLookup(binding.getJndiName(), wsrInfo.getLookupName(), Object.class.getName());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Obtained Reference from IndirectJndiLookup object: " + ref.toString());
}
} else { // Otherwise, we'll build a reference that will be resolved by our own object factory.
ref = new Reference(WebServiceRefProcessor.class.getName(), ServiceRefObjectFactory.class.getName(), null);
// Add our serializable service-ref metadata to the Reference.
WebServiceRefInfoRefAddr wsrInfoRefAddr = new WebServiceRefInfoRefAddr(wsrInfo);
ref.add(wsrInfoRefAddr);
// If our classloader is not null, then that means we're being called under the context of an application module.
// In this case, we want to store away the module-specific metadata in the module's metadata slot.
// This has been moved to LibertyProviderImpl since in that time slot, clientMetadata will always be available
// If CDI is enabled, the injections happens before JaxwsModuleMetaDataLister.metaDataCreated()
/*
* if (ivNameSpaceConfig.getClassLoader() != null) {
* // get the client metadata. in client side, here should be the first time get the client metadata, so will create one.
* JaxWsClientMetaData clientMetaData = JaxWsMetaDataManager.getJaxWsClientMetaData(ivNameSpaceConfig.getModuleMetaData());
*
* // parsing and merge the client configuration from the ibm-ws-bnd.xml
* if (clientMetaData != null)
* {
* mergeWebServicesBndInfo(wsrInfo, clientMetaData);
* }
*
* }
*/
J2EEName j2eeName = ivNameSpaceConfig.getJ2EEName();
String componenetName = (null != j2eeName) ? j2eeName.getComponent() : null;
wsrInfo.setComponenetName(componenetName);
}
WebServiceRefInfoBuilder.configureWebServiceRefPartialInfo(wsrInfo, ivNameSpaceConfig.getClassLoader());
binding.setObjects(null, ref);
} | java | @Override
public void resolve(InjectionBinding<WebServiceRef> binding) throws InjectionException {
// This was a JAX-WS service reference, we need to do some setup for
// our object factory, and we also need to make sure we store the
// metadata away in the appropriate location.
WebServiceRefInfo wsrInfo = ((WebServiceRefBinding) binding).getWebServiceRefInfo();
Reference ref = null;
// If the "lookup-name" attribute was specified for this service-ref, then we'll bind into the namespace
// an instance of the IndirectJndiLookup reference that will be resolved by the IndirectJndiLookupObjectFactory.
// If a JNDI lookup is performed on this "service-ref", then the IndirectJndiLookupObjectFactory will simply
// turn around and handle the extra level of indirection by looking up the referenced service-ref, which
// will in turn cause our ServiceRefObjectFactory to be invoked.
if (wsrInfo.getLookupName() != null && !wsrInfo.getLookupName().isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Build IndirectJndiLookup(" + wsrInfo.getLookupName() + ") for service-ref '" + wsrInfo.getJndiName());
}
IndirectJndiLookupReferenceFactory factory = ivNameSpaceConfig.getIndirectJndiLookupReferenceFactory();
ref = factory.createIndirectJndiLookup(binding.getJndiName(), wsrInfo.getLookupName(), Object.class.getName());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Obtained Reference from IndirectJndiLookup object: " + ref.toString());
}
} else { // Otherwise, we'll build a reference that will be resolved by our own object factory.
ref = new Reference(WebServiceRefProcessor.class.getName(), ServiceRefObjectFactory.class.getName(), null);
// Add our serializable service-ref metadata to the Reference.
WebServiceRefInfoRefAddr wsrInfoRefAddr = new WebServiceRefInfoRefAddr(wsrInfo);
ref.add(wsrInfoRefAddr);
// If our classloader is not null, then that means we're being called under the context of an application module.
// In this case, we want to store away the module-specific metadata in the module's metadata slot.
// This has been moved to LibertyProviderImpl since in that time slot, clientMetadata will always be available
// If CDI is enabled, the injections happens before JaxwsModuleMetaDataLister.metaDataCreated()
/*
* if (ivNameSpaceConfig.getClassLoader() != null) {
* // get the client metadata. in client side, here should be the first time get the client metadata, so will create one.
* JaxWsClientMetaData clientMetaData = JaxWsMetaDataManager.getJaxWsClientMetaData(ivNameSpaceConfig.getModuleMetaData());
*
* // parsing and merge the client configuration from the ibm-ws-bnd.xml
* if (clientMetaData != null)
* {
* mergeWebServicesBndInfo(wsrInfo, clientMetaData);
* }
*
* }
*/
J2EEName j2eeName = ivNameSpaceConfig.getJ2EEName();
String componenetName = (null != j2eeName) ? j2eeName.getComponent() : null;
wsrInfo.setComponenetName(componenetName);
}
WebServiceRefInfoBuilder.configureWebServiceRefPartialInfo(wsrInfo, ivNameSpaceConfig.getClassLoader());
binding.setObjects(null, ref);
} | [
"@",
"Override",
"public",
"void",
"resolve",
"(",
"InjectionBinding",
"<",
"WebServiceRef",
">",
"binding",
")",
"throws",
"InjectionException",
"{",
"// This was a JAX-WS service reference, we need to do some setup for",
"// our object factory, and we also need to make sure we store the",
"// metadata away in the appropriate location.",
"WebServiceRefInfo",
"wsrInfo",
"=",
"(",
"(",
"WebServiceRefBinding",
")",
"binding",
")",
".",
"getWebServiceRefInfo",
"(",
")",
";",
"Reference",
"ref",
"=",
"null",
";",
"// If the \"lookup-name\" attribute was specified for this service-ref, then we'll bind into the namespace",
"// an instance of the IndirectJndiLookup reference that will be resolved by the IndirectJndiLookupObjectFactory.",
"// If a JNDI lookup is performed on this \"service-ref\", then the IndirectJndiLookupObjectFactory will simply",
"// turn around and handle the extra level of indirection by looking up the referenced service-ref, which",
"// will in turn cause our ServiceRefObjectFactory to be invoked.",
"if",
"(",
"wsrInfo",
".",
"getLookupName",
"(",
")",
"!=",
"null",
"&&",
"!",
"wsrInfo",
".",
"getLookupName",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Build IndirectJndiLookup(\"",
"+",
"wsrInfo",
".",
"getLookupName",
"(",
")",
"+",
"\") for service-ref '\"",
"+",
"wsrInfo",
".",
"getJndiName",
"(",
")",
")",
";",
"}",
"IndirectJndiLookupReferenceFactory",
"factory",
"=",
"ivNameSpaceConfig",
".",
"getIndirectJndiLookupReferenceFactory",
"(",
")",
";",
"ref",
"=",
"factory",
".",
"createIndirectJndiLookup",
"(",
"binding",
".",
"getJndiName",
"(",
")",
",",
"wsrInfo",
".",
"getLookupName",
"(",
")",
",",
"Object",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Obtained Reference from IndirectJndiLookup object: \"",
"+",
"ref",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"// Otherwise, we'll build a reference that will be resolved by our own object factory.",
"ref",
"=",
"new",
"Reference",
"(",
"WebServiceRefProcessor",
".",
"class",
".",
"getName",
"(",
")",
",",
"ServiceRefObjectFactory",
".",
"class",
".",
"getName",
"(",
")",
",",
"null",
")",
";",
"// Add our serializable service-ref metadata to the Reference.",
"WebServiceRefInfoRefAddr",
"wsrInfoRefAddr",
"=",
"new",
"WebServiceRefInfoRefAddr",
"(",
"wsrInfo",
")",
";",
"ref",
".",
"add",
"(",
"wsrInfoRefAddr",
")",
";",
"// If our classloader is not null, then that means we're being called under the context of an application module.",
"// In this case, we want to store away the module-specific metadata in the module's metadata slot.",
"// This has been moved to LibertyProviderImpl since in that time slot, clientMetadata will always be available",
"// If CDI is enabled, the injections happens before JaxwsModuleMetaDataLister.metaDataCreated()",
"/*\n * if (ivNameSpaceConfig.getClassLoader() != null) {\n * // get the client metadata. in client side, here should be the first time get the client metadata, so will create one.\n * JaxWsClientMetaData clientMetaData = JaxWsMetaDataManager.getJaxWsClientMetaData(ivNameSpaceConfig.getModuleMetaData());\n * \n * // parsing and merge the client configuration from the ibm-ws-bnd.xml\n * if (clientMetaData != null)\n * {\n * mergeWebServicesBndInfo(wsrInfo, clientMetaData);\n * }\n * \n * }\n */",
"J2EEName",
"j2eeName",
"=",
"ivNameSpaceConfig",
".",
"getJ2EEName",
"(",
")",
";",
"String",
"componenetName",
"=",
"(",
"null",
"!=",
"j2eeName",
")",
"?",
"j2eeName",
".",
"getComponent",
"(",
")",
":",
"null",
";",
"wsrInfo",
".",
"setComponenetName",
"(",
"componenetName",
")",
";",
"}",
"WebServiceRefInfoBuilder",
".",
"configureWebServiceRefPartialInfo",
"(",
"wsrInfo",
",",
"ivNameSpaceConfig",
".",
"getClassLoader",
"(",
")",
")",
";",
"binding",
".",
"setObjects",
"(",
"null",
",",
"ref",
")",
";",
"}"
] | This method will resolve the InjectionBinding it is given. This involves storing the correct information within
the binding instance so that later on the injection can occur. It also enables JNDI lookups to occur on the
resource that is indicated in the binding. | [
"This",
"method",
"will",
"resolve",
"the",
"InjectionBinding",
"it",
"is",
"given",
".",
"This",
"involves",
"storing",
"the",
"correct",
"information",
"within",
"the",
"binding",
"instance",
"so",
"that",
"later",
"on",
"the",
"injection",
"can",
"occur",
".",
"It",
"also",
"enables",
"JNDI",
"lookups",
"to",
"occur",
"on",
"the",
"resource",
"that",
"is",
"indicated",
"in",
"the",
"binding",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/client/injection/WebServiceRefProcessor.java#L236-L300 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java | SelfExtractor.checkResponseCode | private static void checkResponseCode(URLConnection uc) throws IOException {
if (uc instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnection) uc;
int rc = httpConnection.getResponseCode();
if (rc != HttpURLConnection.HTTP_OK && rc != HttpURLConnection.HTTP_MOVED_TEMP) {
throw new IOException();
}
}
} | java | private static void checkResponseCode(URLConnection uc) throws IOException {
if (uc instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnection) uc;
int rc = httpConnection.getResponseCode();
if (rc != HttpURLConnection.HTTP_OK && rc != HttpURLConnection.HTTP_MOVED_TEMP) {
throw new IOException();
}
}
} | [
"private",
"static",
"void",
"checkResponseCode",
"(",
"URLConnection",
"uc",
")",
"throws",
"IOException",
"{",
"if",
"(",
"uc",
"instanceof",
"HttpURLConnection",
")",
"{",
"HttpURLConnection",
"httpConnection",
"=",
"(",
"HttpURLConnection",
")",
"uc",
";",
"int",
"rc",
"=",
"httpConnection",
".",
"getResponseCode",
"(",
")",
";",
"if",
"(",
"rc",
"!=",
"HttpURLConnection",
".",
"HTTP_OK",
"&&",
"rc",
"!=",
"HttpURLConnection",
".",
"HTTP_MOVED_TEMP",
")",
"{",
"throw",
"new",
"IOException",
"(",
")",
";",
"}",
"}",
"}"
] | If URLConnection is an HTTP connection, check that the response code is HTTP_OK
@param uc the URLConnection
@throws IOException if the URLConnection is an HttpURLConnection and the response code is not HTTP_OK (200) or HTTP_MOVED_TEMP (302) | [
"If",
"URLConnection",
"is",
"an",
"HTTP",
"connection",
"check",
"that",
"the",
"response",
"code",
"is",
"HTTP_OK"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L851-L859 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java | SelfExtractor.getCommonRootDir | private String getCommonRootDir(String filePath, HashMap validFilePaths) {
for (Iterator it = validFilePaths.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
String path = (String) ((entry).getKey());
if (filePath.startsWith(path))
return (String) entry.getValue();
}
return null;
} | java | private String getCommonRootDir(String filePath, HashMap validFilePaths) {
for (Iterator it = validFilePaths.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
String path = (String) ((entry).getKey());
if (filePath.startsWith(path))
return (String) entry.getValue();
}
return null;
} | [
"private",
"String",
"getCommonRootDir",
"(",
"String",
"filePath",
",",
"HashMap",
"validFilePaths",
")",
"{",
"for",
"(",
"Iterator",
"it",
"=",
"validFilePaths",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"it",
".",
"next",
"(",
")",
";",
"String",
"path",
"=",
"(",
"String",
")",
"(",
"(",
"entry",
")",
".",
"getKey",
"(",
")",
")",
";",
"if",
"(",
"filePath",
".",
"startsWith",
"(",
"path",
")",
")",
"return",
"(",
"String",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Retrieves the directory in common between the specified path and the archive root directory.
If the file path cannot be found among the valid paths then null is returned.
@param filePath Path to the file to check
@param validFilePaths A list of valid file paths and their common directories with the root
@return The directory in common between the specified path and the root directory | [
"Retrieves",
"the",
"directory",
"in",
"common",
"between",
"the",
"specified",
"path",
"and",
"the",
"archive",
"root",
"directory",
".",
"If",
"the",
"file",
"path",
"cannot",
"be",
"found",
"among",
"the",
"valid",
"paths",
"then",
"null",
"is",
"returned",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L982-L991 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java | SelfExtractor.getExtensionInstallDirs | private ArrayList<String> getExtensionInstallDirs() throws IOException {
String extensiondir = root + "etc/extensions/";
ArrayList<String> extensionDirs = new ArrayList<String>();
for (Entry entry : container) {
if (entry.getName().startsWith(extensiondir) && entry.getName().endsWith(".properties")) {
Properties prop = new Properties();
prop.load(entry.getInputStream());
String installDir = (prop.getProperty("com.ibm.websphere.productInstall"));
if (null != installDir && !installDir.equals("")) {
extensionDirs.add(installDir);
}
}
}
return extensionDirs;
} | java | private ArrayList<String> getExtensionInstallDirs() throws IOException {
String extensiondir = root + "etc/extensions/";
ArrayList<String> extensionDirs = new ArrayList<String>();
for (Entry entry : container) {
if (entry.getName().startsWith(extensiondir) && entry.getName().endsWith(".properties")) {
Properties prop = new Properties();
prop.load(entry.getInputStream());
String installDir = (prop.getProperty("com.ibm.websphere.productInstall"));
if (null != installDir && !installDir.equals("")) {
extensionDirs.add(installDir);
}
}
}
return extensionDirs;
} | [
"private",
"ArrayList",
"<",
"String",
">",
"getExtensionInstallDirs",
"(",
")",
"throws",
"IOException",
"{",
"String",
"extensiondir",
"=",
"root",
"+",
"\"etc/extensions/\"",
";",
"ArrayList",
"<",
"String",
">",
"extensionDirs",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Entry",
"entry",
":",
"container",
")",
"{",
"if",
"(",
"entry",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"extensiondir",
")",
"&&",
"entry",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\".properties\"",
")",
")",
"{",
"Properties",
"prop",
"=",
"new",
"Properties",
"(",
")",
";",
"prop",
".",
"load",
"(",
"entry",
".",
"getInputStream",
"(",
")",
")",
";",
"String",
"installDir",
"=",
"(",
"prop",
".",
"getProperty",
"(",
"\"com.ibm.websphere.productInstall\"",
")",
")",
";",
"if",
"(",
"null",
"!=",
"installDir",
"&&",
"!",
"installDir",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"extensionDirs",
".",
"add",
"(",
"installDir",
")",
";",
"}",
"}",
"}",
"return",
"extensionDirs",
";",
"}"
] | Retrieves all the extension products' install directories as indicated their properties file.
@return List of extension products' install directories.
@throws IOException | [
"Retrieves",
"all",
"the",
"extension",
"products",
"install",
"directories",
"as",
"indicated",
"their",
"properties",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L999-L1016 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java | SelfExtractor.printNeededIFixes | public static void printNeededIFixes(File outputDir, List extractedFiles) {
try {
// To get the ifix information we run the productInfo validate command which as well as
// listing the state of the runtime, also displays any ifixes that need to be reapplied.
Runtime runtime = Runtime.getRuntime();
// Set up the command depending on the OS we're running on.
final String productInfo = new File(outputDir, isWindows ? "bin/productInfo.bat" : "bin/productInfo").getAbsolutePath();
final String[] runtimeCmd = { productInfo, "validate" };
Process process = runtime.exec(runtimeCmd, null, new File(outputDir, "bin"));
Thread stderrCopier = new Thread(new OutputStreamCopier(process.getErrorStream(), System.err));
stderrCopier.start();
new OutputStreamCopier(process.getInputStream(), System.out).run();
try {
stderrCopier.join();
process.waitFor();
} catch (InterruptedException e) {
// Auto FFDC
}
} catch (IOException ioe) {
System.out.println(ioe.getMessage());
}
} | java | public static void printNeededIFixes(File outputDir, List extractedFiles) {
try {
// To get the ifix information we run the productInfo validate command which as well as
// listing the state of the runtime, also displays any ifixes that need to be reapplied.
Runtime runtime = Runtime.getRuntime();
// Set up the command depending on the OS we're running on.
final String productInfo = new File(outputDir, isWindows ? "bin/productInfo.bat" : "bin/productInfo").getAbsolutePath();
final String[] runtimeCmd = { productInfo, "validate" };
Process process = runtime.exec(runtimeCmd, null, new File(outputDir, "bin"));
Thread stderrCopier = new Thread(new OutputStreamCopier(process.getErrorStream(), System.err));
stderrCopier.start();
new OutputStreamCopier(process.getInputStream(), System.out).run();
try {
stderrCopier.join();
process.waitFor();
} catch (InterruptedException e) {
// Auto FFDC
}
} catch (IOException ioe) {
System.out.println(ioe.getMessage());
}
} | [
"public",
"static",
"void",
"printNeededIFixes",
"(",
"File",
"outputDir",
",",
"List",
"extractedFiles",
")",
"{",
"try",
"{",
"// To get the ifix information we run the productInfo validate command which as well as",
"// listing the state of the runtime, also displays any ifixes that need to be reapplied.",
"Runtime",
"runtime",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
";",
"// Set up the command depending on the OS we're running on.",
"final",
"String",
"productInfo",
"=",
"new",
"File",
"(",
"outputDir",
",",
"isWindows",
"?",
"\"bin/productInfo.bat\"",
":",
"\"bin/productInfo\"",
")",
".",
"getAbsolutePath",
"(",
")",
";",
"final",
"String",
"[",
"]",
"runtimeCmd",
"=",
"{",
"productInfo",
",",
"\"validate\"",
"}",
";",
"Process",
"process",
"=",
"runtime",
".",
"exec",
"(",
"runtimeCmd",
",",
"null",
",",
"new",
"File",
"(",
"outputDir",
",",
"\"bin\"",
")",
")",
";",
"Thread",
"stderrCopier",
"=",
"new",
"Thread",
"(",
"new",
"OutputStreamCopier",
"(",
"process",
".",
"getErrorStream",
"(",
")",
",",
"System",
".",
"err",
")",
")",
";",
"stderrCopier",
".",
"start",
"(",
")",
";",
"new",
"OutputStreamCopier",
"(",
"process",
".",
"getInputStream",
"(",
")",
",",
"System",
".",
"out",
")",
".",
"run",
"(",
")",
";",
"try",
"{",
"stderrCopier",
".",
"join",
"(",
")",
";",
"process",
".",
"waitFor",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"// Auto FFDC",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"ioe",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | If necessary this will print a message saying that the installed files mean that an iFix needs to be re-installed.
@param outputDir The directory where the files were extracted to (typically the "wlp" directory)
@param extractedFiles A list of Strings which are file paths within the directory | [
"If",
"necessary",
"this",
"will",
"print",
"a",
"message",
"saying",
"that",
"the",
"installed",
"files",
"mean",
"that",
"an",
"iFix",
"needs",
"to",
"be",
"re",
"-",
"installed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L1143-L1166 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java | SelfExtractor.listMissingCoreFeatures | protected Set listMissingCoreFeatures(File outputDir) throws SelfExtractorFileException {
Set missingFeatures = new HashSet();
// If we have a Require Feature manifest header, we need to check that the runtime we're extracting into contains the
// required features. If the customer has minified their runtime to a smaller set of features, then we may
// not be able to install this extract into the runtime.
// If we don't have a list of features then this is probably because we're not an extended install, and we don't need to check anymore.
if (requiredFeatures != null && !"".equals(requiredFeatures)) {
// Break the required feature headers value into indiviual strings and load them into a set.
StringTokenizer tokenizer = new StringTokenizer(requiredFeatures, ",");
while (tokenizer.hasMoreElements()) {
String nextFeature = tokenizer.nextToken();
if (nextFeature.indexOf(";") >= 0)
nextFeature = nextFeature.substring(0, nextFeature.indexOf(";"));
missingFeatures.add(nextFeature.trim());
}
// Create fileFilter to get just the manifest files.
FilenameFilter manifestFilter = createManifestFilter();
File featuresDir = new File(outputDir + "/lib/features");
File[] manifestFiles = featuresDir.listFiles(manifestFilter);
// Iterate over each manifest in the runtime we're extracting to, until we've read all manifests or until we've found all of the
// required features.
if (manifestFiles != null) {
for (int i = 0; i < manifestFiles.length && !missingFeatures.isEmpty(); i++) {
FileInputStream fis = null;
File currentManifestFile = null;
try {
currentManifestFile = manifestFiles[i];
fis = new FileInputStream(currentManifestFile);
Manifest currentManifest = new Manifest(fis);
Attributes attrs = currentManifest.getMainAttributes();
String manifestSymbolicName = attrs.getValue("Subsystem-SymbolicName");
if (manifestSymbolicName.indexOf(";") >= 0)
manifestSymbolicName = manifestSymbolicName.substring(0, manifestSymbolicName.indexOf(";"));
// Remove the current manifest from the list of required features. We may need to remove the short name depending on what has
// been stored.
missingFeatures.remove(manifestSymbolicName.trim());
} catch (FileNotFoundException fnfe) {
throw new SelfExtractorFileException(currentManifestFile.getAbsolutePath(), fnfe);
} catch (IOException ioe) {
throw new SelfExtractorFileException(currentManifestFile.getAbsolutePath(), ioe);
} finally {
SelfExtractUtils.tryToClose(fis);
}
}
}
}
return missingFeatures;
} | java | protected Set listMissingCoreFeatures(File outputDir) throws SelfExtractorFileException {
Set missingFeatures = new HashSet();
// If we have a Require Feature manifest header, we need to check that the runtime we're extracting into contains the
// required features. If the customer has minified their runtime to a smaller set of features, then we may
// not be able to install this extract into the runtime.
// If we don't have a list of features then this is probably because we're not an extended install, and we don't need to check anymore.
if (requiredFeatures != null && !"".equals(requiredFeatures)) {
// Break the required feature headers value into indiviual strings and load them into a set.
StringTokenizer tokenizer = new StringTokenizer(requiredFeatures, ",");
while (tokenizer.hasMoreElements()) {
String nextFeature = tokenizer.nextToken();
if (nextFeature.indexOf(";") >= 0)
nextFeature = nextFeature.substring(0, nextFeature.indexOf(";"));
missingFeatures.add(nextFeature.trim());
}
// Create fileFilter to get just the manifest files.
FilenameFilter manifestFilter = createManifestFilter();
File featuresDir = new File(outputDir + "/lib/features");
File[] manifestFiles = featuresDir.listFiles(manifestFilter);
// Iterate over each manifest in the runtime we're extracting to, until we've read all manifests or until we've found all of the
// required features.
if (manifestFiles != null) {
for (int i = 0; i < manifestFiles.length && !missingFeatures.isEmpty(); i++) {
FileInputStream fis = null;
File currentManifestFile = null;
try {
currentManifestFile = manifestFiles[i];
fis = new FileInputStream(currentManifestFile);
Manifest currentManifest = new Manifest(fis);
Attributes attrs = currentManifest.getMainAttributes();
String manifestSymbolicName = attrs.getValue("Subsystem-SymbolicName");
if (manifestSymbolicName.indexOf(";") >= 0)
manifestSymbolicName = manifestSymbolicName.substring(0, manifestSymbolicName.indexOf(";"));
// Remove the current manifest from the list of required features. We may need to remove the short name depending on what has
// been stored.
missingFeatures.remove(manifestSymbolicName.trim());
} catch (FileNotFoundException fnfe) {
throw new SelfExtractorFileException(currentManifestFile.getAbsolutePath(), fnfe);
} catch (IOException ioe) {
throw new SelfExtractorFileException(currentManifestFile.getAbsolutePath(), ioe);
} finally {
SelfExtractUtils.tryToClose(fis);
}
}
}
}
return missingFeatures;
} | [
"protected",
"Set",
"listMissingCoreFeatures",
"(",
"File",
"outputDir",
")",
"throws",
"SelfExtractorFileException",
"{",
"Set",
"missingFeatures",
"=",
"new",
"HashSet",
"(",
")",
";",
"// If we have a Require Feature manifest header, we need to check that the runtime we're extracting into contains the",
"// required features. If the customer has minified their runtime to a smaller set of features, then we may",
"// not be able to install this extract into the runtime.",
"// If we don't have a list of features then this is probably because we're not an extended install, and we don't need to check anymore.",
"if",
"(",
"requiredFeatures",
"!=",
"null",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"requiredFeatures",
")",
")",
"{",
"// Break the required feature headers value into indiviual strings and load them into a set.",
"StringTokenizer",
"tokenizer",
"=",
"new",
"StringTokenizer",
"(",
"requiredFeatures",
",",
"\",\"",
")",
";",
"while",
"(",
"tokenizer",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"String",
"nextFeature",
"=",
"tokenizer",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"nextFeature",
".",
"indexOf",
"(",
"\";\"",
")",
">=",
"0",
")",
"nextFeature",
"=",
"nextFeature",
".",
"substring",
"(",
"0",
",",
"nextFeature",
".",
"indexOf",
"(",
"\";\"",
")",
")",
";",
"missingFeatures",
".",
"add",
"(",
"nextFeature",
".",
"trim",
"(",
")",
")",
";",
"}",
"// Create fileFilter to get just the manifest files.",
"FilenameFilter",
"manifestFilter",
"=",
"createManifestFilter",
"(",
")",
";",
"File",
"featuresDir",
"=",
"new",
"File",
"(",
"outputDir",
"+",
"\"/lib/features\"",
")",
";",
"File",
"[",
"]",
"manifestFiles",
"=",
"featuresDir",
".",
"listFiles",
"(",
"manifestFilter",
")",
";",
"// Iterate over each manifest in the runtime we're extracting to, until we've read all manifests or until we've found all of the",
"// required features.",
"if",
"(",
"manifestFiles",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"manifestFiles",
".",
"length",
"&&",
"!",
"missingFeatures",
".",
"isEmpty",
"(",
")",
";",
"i",
"++",
")",
"{",
"FileInputStream",
"fis",
"=",
"null",
";",
"File",
"currentManifestFile",
"=",
"null",
";",
"try",
"{",
"currentManifestFile",
"=",
"manifestFiles",
"[",
"i",
"]",
";",
"fis",
"=",
"new",
"FileInputStream",
"(",
"currentManifestFile",
")",
";",
"Manifest",
"currentManifest",
"=",
"new",
"Manifest",
"(",
"fis",
")",
";",
"Attributes",
"attrs",
"=",
"currentManifest",
".",
"getMainAttributes",
"(",
")",
";",
"String",
"manifestSymbolicName",
"=",
"attrs",
".",
"getValue",
"(",
"\"Subsystem-SymbolicName\"",
")",
";",
"if",
"(",
"manifestSymbolicName",
".",
"indexOf",
"(",
"\";\"",
")",
">=",
"0",
")",
"manifestSymbolicName",
"=",
"manifestSymbolicName",
".",
"substring",
"(",
"0",
",",
"manifestSymbolicName",
".",
"indexOf",
"(",
"\";\"",
")",
")",
";",
"// Remove the current manifest from the list of required features. We may need to remove the short name depending on what has",
"// been stored.",
"missingFeatures",
".",
"remove",
"(",
"manifestSymbolicName",
".",
"trim",
"(",
")",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"fnfe",
")",
"{",
"throw",
"new",
"SelfExtractorFileException",
"(",
"currentManifestFile",
".",
"getAbsolutePath",
"(",
")",
",",
"fnfe",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"SelfExtractorFileException",
"(",
"currentManifestFile",
".",
"getAbsolutePath",
"(",
")",
",",
"ioe",
")",
";",
"}",
"finally",
"{",
"SelfExtractUtils",
".",
"tryToClose",
"(",
"fis",
")",
";",
"}",
"}",
"}",
"}",
"return",
"missingFeatures",
";",
"}"
] | This method checks that all the core features defined in the the manifest header exist in the server runtime
we're extracting into, and returns any features that don't.
If the coreFeatures header is blank it means we're not an extended jar.
@return A Set of Strings containing the features that are missing from the installation runtime. | [
"This",
"method",
"checks",
"that",
"all",
"the",
"core",
"features",
"defined",
"in",
"the",
"the",
"manifest",
"header",
"exist",
"in",
"the",
"server",
"runtime",
"we",
"re",
"extracting",
"into",
"and",
"returns",
"any",
"features",
"that",
"don",
"t",
".",
"If",
"the",
"coreFeatures",
"header",
"is",
"blank",
"it",
"means",
"we",
"re",
"not",
"an",
"extended",
"jar",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L1211-L1266 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java | SelfExtractor.argIsOption | protected static boolean argIsOption(String arg, String option) {
return arg.equalsIgnoreCase(option) || arg.equalsIgnoreCase('-' + option);
} | java | protected static boolean argIsOption(String arg, String option) {
return arg.equalsIgnoreCase(option) || arg.equalsIgnoreCase('-' + option);
} | [
"protected",
"static",
"boolean",
"argIsOption",
"(",
"String",
"arg",
",",
"String",
"option",
")",
"{",
"return",
"arg",
".",
"equalsIgnoreCase",
"(",
"option",
")",
"||",
"arg",
".",
"equalsIgnoreCase",
"(",
"'",
"'",
"+",
"option",
")",
";",
"}"
] | Test if the argument is an option. Allow single or double leading -, be
case insensitive.
@param arg
User specified argument
@param option
Option for test/comparison
@return true if the argument matches the option | [
"Test",
"if",
"the",
"argument",
"is",
"an",
"option",
".",
"Allow",
"single",
"or",
"double",
"leading",
"-",
"be",
"case",
"insensitive",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L1334-L1336 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java | SelfExtractor.displayCommandLineHelp | protected static void displayCommandLineHelp(SelfExtractor extractor) {
// This method takes a SelfExtractor in case we want to tailor the help to the current archive
// Get the name of the JAR file to display in the command syntax");
String jarName = System.getProperty("sun.java.command", "wlp-liberty-developers-core.jar");
String[] s = jarName.split(" ");
jarName = s[0];
System.out.println("\n" + SelfExtract.format("usage"));
System.out.println("\njava -jar " + jarName + " [" + SelfExtract.format("options") + "] [" + SelfExtract.format("installLocation") + "]\n");
System.out.println(SelfExtract.format("options"));
System.out.println(" --acceptLicense");
System.out.println(" " + SelfExtract.format("helpAcceptLicense"));
System.out.println(" --verbose");
System.out.println(" " + SelfExtract.format("helpVerbose"));
System.out.println(" --viewLicenseAgreement");
System.out.println(" " + SelfExtract.format("helpAgreement"));
System.out.println(" --viewLicenseInfo");
System.out.println(" " + SelfExtract.format("helpInformation"));
if (extractor.isUserSample()) {
System.out.println(" --downloadDependencies");
System.out.println(" " + SelfExtract.format("helpDownloadDependencies"));
}
} | java | protected static void displayCommandLineHelp(SelfExtractor extractor) {
// This method takes a SelfExtractor in case we want to tailor the help to the current archive
// Get the name of the JAR file to display in the command syntax");
String jarName = System.getProperty("sun.java.command", "wlp-liberty-developers-core.jar");
String[] s = jarName.split(" ");
jarName = s[0];
System.out.println("\n" + SelfExtract.format("usage"));
System.out.println("\njava -jar " + jarName + " [" + SelfExtract.format("options") + "] [" + SelfExtract.format("installLocation") + "]\n");
System.out.println(SelfExtract.format("options"));
System.out.println(" --acceptLicense");
System.out.println(" " + SelfExtract.format("helpAcceptLicense"));
System.out.println(" --verbose");
System.out.println(" " + SelfExtract.format("helpVerbose"));
System.out.println(" --viewLicenseAgreement");
System.out.println(" " + SelfExtract.format("helpAgreement"));
System.out.println(" --viewLicenseInfo");
System.out.println(" " + SelfExtract.format("helpInformation"));
if (extractor.isUserSample()) {
System.out.println(" --downloadDependencies");
System.out.println(" " + SelfExtract.format("helpDownloadDependencies"));
}
} | [
"protected",
"static",
"void",
"displayCommandLineHelp",
"(",
"SelfExtractor",
"extractor",
")",
"{",
"// This method takes a SelfExtractor in case we want to tailor the help to the current archive",
"// Get the name of the JAR file to display in the command syntax\");",
"String",
"jarName",
"=",
"System",
".",
"getProperty",
"(",
"\"sun.java.command\"",
",",
"\"wlp-liberty-developers-core.jar\"",
")",
";",
"String",
"[",
"]",
"s",
"=",
"jarName",
".",
"split",
"(",
"\" \"",
")",
";",
"jarName",
"=",
"s",
"[",
"0",
"]",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\\n\"",
"+",
"SelfExtract",
".",
"format",
"(",
"\"usage\"",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\\njava -jar \"",
"+",
"jarName",
"+",
"\" [\"",
"+",
"SelfExtract",
".",
"format",
"(",
"\"options\"",
")",
"+",
"\"] [\"",
"+",
"SelfExtract",
".",
"format",
"(",
"\"installLocation\"",
")",
"+",
"\"]\\n\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"SelfExtract",
".",
"format",
"(",
"\"options\"",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" --acceptLicense\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" \"",
"+",
"SelfExtract",
".",
"format",
"(",
"\"helpAcceptLicense\"",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" --verbose\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" \"",
"+",
"SelfExtract",
".",
"format",
"(",
"\"helpVerbose\"",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" --viewLicenseAgreement\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" \"",
"+",
"SelfExtract",
".",
"format",
"(",
"\"helpAgreement\"",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" --viewLicenseInfo\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" \"",
"+",
"SelfExtract",
".",
"format",
"(",
"\"helpInformation\"",
")",
")",
";",
"if",
"(",
"extractor",
".",
"isUserSample",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\" --downloadDependencies\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" \"",
"+",
"SelfExtract",
".",
"format",
"(",
"\"helpDownloadDependencies\"",
")",
")",
";",
"}",
"}"
] | Display command line usage. | [
"Display",
"command",
"line",
"usage",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L1341-L1364 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java | SelfExtractor.handleLicenseAcceptance | public void handleLicenseAcceptance(LicenseProvider licenseProvider, boolean acceptLicense) {
//
// Display license requirement
//
SelfExtract.wordWrappedOut(SelfExtract.format("licenseStatement", new Object[] { licenseProvider.getProgramName(), licenseProvider.getLicenseName() }));
System.out.println();
if (acceptLicense) {
// Indicate license acceptance via option
SelfExtract.wordWrappedOut(SelfExtract.format("licenseAccepted", "--acceptLicense"));
System.out.println();
} else {
// Check for license agreement: exit if not accepted.
if (!obtainLicenseAgreement(licenseProvider)) {
System.exit(0);
}
}
} | java | public void handleLicenseAcceptance(LicenseProvider licenseProvider, boolean acceptLicense) {
//
// Display license requirement
//
SelfExtract.wordWrappedOut(SelfExtract.format("licenseStatement", new Object[] { licenseProvider.getProgramName(), licenseProvider.getLicenseName() }));
System.out.println();
if (acceptLicense) {
// Indicate license acceptance via option
SelfExtract.wordWrappedOut(SelfExtract.format("licenseAccepted", "--acceptLicense"));
System.out.println();
} else {
// Check for license agreement: exit if not accepted.
if (!obtainLicenseAgreement(licenseProvider)) {
System.exit(0);
}
}
} | [
"public",
"void",
"handleLicenseAcceptance",
"(",
"LicenseProvider",
"licenseProvider",
",",
"boolean",
"acceptLicense",
")",
"{",
"//",
"// Display license requirement",
"//",
"SelfExtract",
".",
"wordWrappedOut",
"(",
"SelfExtract",
".",
"format",
"(",
"\"licenseStatement\"",
",",
"new",
"Object",
"[",
"]",
"{",
"licenseProvider",
".",
"getProgramName",
"(",
")",
",",
"licenseProvider",
".",
"getLicenseName",
"(",
")",
"}",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"if",
"(",
"acceptLicense",
")",
"{",
"// Indicate license acceptance via option",
"SelfExtract",
".",
"wordWrappedOut",
"(",
"SelfExtract",
".",
"format",
"(",
"\"licenseAccepted\"",
",",
"\"--acceptLicense\"",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"}",
"else",
"{",
"// Check for license agreement: exit if not accepted.",
"if",
"(",
"!",
"obtainLicenseAgreement",
"(",
"licenseProvider",
")",
")",
"{",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"}",
"}"
] | This method will print out information about the license and if necessary prompt the user to accept it.
@param licenseProvider The license provider to use to get information about the license from the archive
@param acceptLicense <code>true</code> if the license should be automatically accepted | [
"This",
"method",
"will",
"print",
"out",
"information",
"about",
"the",
"license",
"and",
"if",
"necessary",
"prompt",
"the",
"user",
"to",
"accept",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L1390-L1407 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java | SelfExtractor.obtainLicenseAgreement | private static boolean obtainLicenseAgreement(LicenseProvider licenseProvider) {
// Prompt for word-wrapped display of license agreement & information
boolean view;
SelfExtract.wordWrappedOut(SelfExtract.format("showAgreement", "--viewLicenseAgreement"));
view = SelfExtract.getResponse(SelfExtract.format("promptAgreement"), "", "xX");
if (view) {
SelfExtract.showLicenseFile(licenseProvider.getLicenseAgreement());
System.out.println();
}
SelfExtract.wordWrappedOut(SelfExtract.format("showInformation", "--viewLicenseInfo"));
view = SelfExtract.getResponse(SelfExtract.format("promptInfo"), "", "xX");
if (view) {
SelfExtract.showLicenseFile(licenseProvider.getLicenseInformation());
System.out.println();
}
System.out.println();
SelfExtract.wordWrappedOut(SelfExtract.format("licenseOptionDescription"));
System.out.println();
boolean accept = SelfExtract.getResponse(SelfExtract.format("licensePrompt", new Object[] { "[1]", "[2]" }),
"1", "2");
System.out.println();
return accept;
} | java | private static boolean obtainLicenseAgreement(LicenseProvider licenseProvider) {
// Prompt for word-wrapped display of license agreement & information
boolean view;
SelfExtract.wordWrappedOut(SelfExtract.format("showAgreement", "--viewLicenseAgreement"));
view = SelfExtract.getResponse(SelfExtract.format("promptAgreement"), "", "xX");
if (view) {
SelfExtract.showLicenseFile(licenseProvider.getLicenseAgreement());
System.out.println();
}
SelfExtract.wordWrappedOut(SelfExtract.format("showInformation", "--viewLicenseInfo"));
view = SelfExtract.getResponse(SelfExtract.format("promptInfo"), "", "xX");
if (view) {
SelfExtract.showLicenseFile(licenseProvider.getLicenseInformation());
System.out.println();
}
System.out.println();
SelfExtract.wordWrappedOut(SelfExtract.format("licenseOptionDescription"));
System.out.println();
boolean accept = SelfExtract.getResponse(SelfExtract.format("licensePrompt", new Object[] { "[1]", "[2]" }),
"1", "2");
System.out.println();
return accept;
} | [
"private",
"static",
"boolean",
"obtainLicenseAgreement",
"(",
"LicenseProvider",
"licenseProvider",
")",
"{",
"// Prompt for word-wrapped display of license agreement & information",
"boolean",
"view",
";",
"SelfExtract",
".",
"wordWrappedOut",
"(",
"SelfExtract",
".",
"format",
"(",
"\"showAgreement\"",
",",
"\"--viewLicenseAgreement\"",
")",
")",
";",
"view",
"=",
"SelfExtract",
".",
"getResponse",
"(",
"SelfExtract",
".",
"format",
"(",
"\"promptAgreement\"",
")",
",",
"\"\"",
",",
"\"xX\"",
")",
";",
"if",
"(",
"view",
")",
"{",
"SelfExtract",
".",
"showLicenseFile",
"(",
"licenseProvider",
".",
"getLicenseAgreement",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"}",
"SelfExtract",
".",
"wordWrappedOut",
"(",
"SelfExtract",
".",
"format",
"(",
"\"showInformation\"",
",",
"\"--viewLicenseInfo\"",
")",
")",
";",
"view",
"=",
"SelfExtract",
".",
"getResponse",
"(",
"SelfExtract",
".",
"format",
"(",
"\"promptInfo\"",
")",
",",
"\"\"",
",",
"\"xX\"",
")",
";",
"if",
"(",
"view",
")",
"{",
"SelfExtract",
".",
"showLicenseFile",
"(",
"licenseProvider",
".",
"getLicenseInformation",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"SelfExtract",
".",
"wordWrappedOut",
"(",
"SelfExtract",
".",
"format",
"(",
"\"licenseOptionDescription\"",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"boolean",
"accept",
"=",
"SelfExtract",
".",
"getResponse",
"(",
"SelfExtract",
".",
"format",
"(",
"\"licensePrompt\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"[1]\"",
",",
"\"[2]\"",
"}",
")",
",",
"\"1\"",
",",
"\"2\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"return",
"accept",
";",
"}"
] | Display and obtain agreement for the license terms | [
"Display",
"and",
"obtain",
"agreement",
"for",
"the",
"license",
"terms"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L1412-L1439 | train |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java | SelfExtractor.close | public String close() {
if (instance == null) {
return null;
}
try {
container.close();
instance = null;
} catch (IOException e) {
return e.getMessage();
}
return null;
} | java | public String close() {
if (instance == null) {
return null;
}
try {
container.close();
instance = null;
} catch (IOException e) {
return e.getMessage();
}
return null;
} | [
"public",
"String",
"close",
"(",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"container",
".",
"close",
"(",
")",
";",
"instance",
"=",
"null",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"e",
".",
"getMessage",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Release the jar file and null instance so that it can be deleted | [
"Release",
"the",
"jar",
"file",
"and",
"null",
"instance",
"so",
"that",
"it",
"can",
"be",
"deleted"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L1463-L1474 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java | EventLocalMap.clear | public void clear() {
// TODO not currently used since EventImpl itself doesn't have a clear
this.parentMap = null;
if (null != this.values) {
for (int i = 0; i < this.values.length; i++) {
this.values[i] = null;
}
this.values = null;
}
} | java | public void clear() {
// TODO not currently used since EventImpl itself doesn't have a clear
this.parentMap = null;
if (null != this.values) {
for (int i = 0; i < this.values.length; i++) {
this.values[i] = null;
}
this.values = null;
}
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"// TODO not currently used since EventImpl itself doesn't have a clear",
"this",
".",
"parentMap",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"this",
".",
"values",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"values",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"values",
"[",
"i",
"]",
"=",
"null",
";",
"}",
"this",
".",
"values",
"=",
"null",
";",
"}",
"}"
] | Clear all content from this map. This will disconnect from any parent
map as well. | [
"Clear",
"all",
"content",
"from",
"this",
"map",
".",
"This",
"will",
"disconnect",
"from",
"any",
"parent",
"map",
"as",
"well",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java#L58-L67 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java | EventLocalMap.get | public V get(String name) {
V rc = null;
K key = getKey(name);
if (null != key) {
rc = get(key);
}
return rc;
} | java | public V get(String name) {
V rc = null;
K key = getKey(name);
if (null != key) {
rc = get(key);
}
return rc;
} | [
"public",
"V",
"get",
"(",
"String",
"name",
")",
"{",
"V",
"rc",
"=",
"null",
";",
"K",
"key",
"=",
"getKey",
"(",
"name",
")",
";",
"if",
"(",
"null",
"!=",
"key",
")",
"{",
"rc",
"=",
"get",
"(",
"key",
")",
";",
"}",
"return",
"rc",
";",
"}"
] | Query the possible value associated with a named EventLocal. A null is
returned if the name does not match any stored value or if that stored
value is explicitly null.
@param name
@return V | [
"Query",
"the",
"possible",
"value",
"associated",
"with",
"a",
"named",
"EventLocal",
".",
"A",
"null",
"is",
"returned",
"if",
"the",
"name",
"does",
"not",
"match",
"any",
"stored",
"value",
"or",
"if",
"that",
"stored",
"value",
"is",
"explicitly",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java#L77-L84 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java | EventLocalMap.getKey | private K getKey(String name) {
if (null != this.keys) {
// we have locally stored values
final K[] temp = this.keys;
K key;
for (int i = 0; i < temp.length; i++) {
key = temp[i];
if (null != key && name.equals(key.toString())) {
return key;
}
}
}
// if nothing found locally and we have a parent, check that
if (null != this.parentMap) {
return this.parentMap.getKey(name);
}
return null;
} | java | private K getKey(String name) {
if (null != this.keys) {
// we have locally stored values
final K[] temp = this.keys;
K key;
for (int i = 0; i < temp.length; i++) {
key = temp[i];
if (null != key && name.equals(key.toString())) {
return key;
}
}
}
// if nothing found locally and we have a parent, check that
if (null != this.parentMap) {
return this.parentMap.getKey(name);
}
return null;
} | [
"private",
"K",
"getKey",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"null",
"!=",
"this",
".",
"keys",
")",
"{",
"// we have locally stored values",
"final",
"K",
"[",
"]",
"temp",
"=",
"this",
".",
"keys",
";",
"K",
"key",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"temp",
".",
"length",
";",
"i",
"++",
")",
"{",
"key",
"=",
"temp",
"[",
"i",
"]",
";",
"if",
"(",
"null",
"!=",
"key",
"&&",
"name",
".",
"equals",
"(",
"key",
".",
"toString",
"(",
")",
")",
")",
"{",
"return",
"key",
";",
"}",
"}",
"}",
"// if nothing found locally and we have a parent, check that",
"if",
"(",
"null",
"!=",
"this",
".",
"parentMap",
")",
"{",
"return",
"this",
".",
"parentMap",
".",
"getKey",
"(",
"name",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Look for the key with the provided name. This returns null if no match
is found.
@param name
@return K | [
"Look",
"for",
"the",
"key",
"with",
"the",
"provided",
"name",
".",
"This",
"returns",
"null",
"if",
"no",
"match",
"is",
"found",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java#L93-L110 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java | EventLocalMap.get | public V get(K key) {
return get(key.hashCode() / SIZE_ROW, key.hashCode() % SIZE_ROW);
} | java | public V get(K key) {
return get(key.hashCode() / SIZE_ROW, key.hashCode() % SIZE_ROW);
} | [
"public",
"V",
"get",
"(",
"K",
"key",
")",
"{",
"return",
"get",
"(",
"key",
".",
"hashCode",
"(",
")",
"/",
"SIZE_ROW",
",",
"key",
".",
"hashCode",
"(",
")",
"%",
"SIZE_ROW",
")",
";",
"}"
] | Query the value for the provided key.
@param key
@return V | [
"Query",
"the",
"value",
"for",
"the",
"provided",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java#L118-L120 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java | EventLocalMap.put | public void put(K key, V value) {
final int hash = key.hashCode();
final int row = hash / SIZE_ROW;
final int column = hash & (SIZE_ROW - 1); // DON'T use the % operator as we
// need the result to be
// non-negative (-1%16 is -1 for
// example)
validateKey(hash);
validateTable(row);
this.values[row][column] = value;
this.keys[hash] = key;
} | java | public void put(K key, V value) {
final int hash = key.hashCode();
final int row = hash / SIZE_ROW;
final int column = hash & (SIZE_ROW - 1); // DON'T use the % operator as we
// need the result to be
// non-negative (-1%16 is -1 for
// example)
validateKey(hash);
validateTable(row);
this.values[row][column] = value;
this.keys[hash] = key;
} | [
"public",
"void",
"put",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"final",
"int",
"hash",
"=",
"key",
".",
"hashCode",
"(",
")",
";",
"final",
"int",
"row",
"=",
"hash",
"/",
"SIZE_ROW",
";",
"final",
"int",
"column",
"=",
"hash",
"&",
"(",
"SIZE_ROW",
"-",
"1",
")",
";",
"// DON'T use the % operator as we",
"// need the result to be",
"// non-negative (-1%16 is -1 for",
"// example)",
"validateKey",
"(",
"hash",
")",
";",
"validateTable",
"(",
"row",
")",
";",
"this",
".",
"values",
"[",
"row",
"]",
"[",
"column",
"]",
"=",
"value",
";",
"this",
".",
"keys",
"[",
"hash",
"]",
"=",
"key",
";",
"}"
] | Put a key and value pair into the storage map.
@param key
@param value | [
"Put",
"a",
"key",
"and",
"value",
"pair",
"into",
"the",
"storage",
"map",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java#L147-L158 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java | EventLocalMap.remove | public V remove(K key) {
final int hash = key.hashCode();
final int row = hash / SIZE_ROW;
final int column = hash & (SIZE_ROW - 1); // DON'T use the % operator as we
// need the result to be
// non-negative (-1%16 is -1 for
// example)
final V rc = get(row, column);
validateKey(hash);
validateTable(row);
this.values[row][column] = null;
this.keys[hash] = null;
return rc;
} | java | public V remove(K key) {
final int hash = key.hashCode();
final int row = hash / SIZE_ROW;
final int column = hash & (SIZE_ROW - 1); // DON'T use the % operator as we
// need the result to be
// non-negative (-1%16 is -1 for
// example)
final V rc = get(row, column);
validateKey(hash);
validateTable(row);
this.values[row][column] = null;
this.keys[hash] = null;
return rc;
} | [
"public",
"V",
"remove",
"(",
"K",
"key",
")",
"{",
"final",
"int",
"hash",
"=",
"key",
".",
"hashCode",
"(",
")",
";",
"final",
"int",
"row",
"=",
"hash",
"/",
"SIZE_ROW",
";",
"final",
"int",
"column",
"=",
"hash",
"&",
"(",
"SIZE_ROW",
"-",
"1",
")",
";",
"// DON'T use the % operator as we",
"// need the result to be",
"// non-negative (-1%16 is -1 for",
"// example)",
"final",
"V",
"rc",
"=",
"get",
"(",
"row",
",",
"column",
")",
";",
"validateKey",
"(",
"hash",
")",
";",
"validateTable",
"(",
"row",
")",
";",
"this",
".",
"values",
"[",
"row",
"]",
"[",
"column",
"]",
"=",
"null",
";",
"this",
".",
"keys",
"[",
"hash",
"]",
"=",
"null",
";",
"return",
"rc",
";",
"}"
] | Remove a key from the storage.
@param key
@return V, existing object, null if none present | [
"Remove",
"a",
"key",
"from",
"the",
"storage",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java#L166-L179 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java | EventLocalMap.validateKey | @SuppressWarnings("unchecked")
private void validateKey(int index) {
final int size = (index + 1);
if (null == this.keys) {
// nothing has been created yet
this.keys = (K[]) new Object[size];
} else if (index >= this.keys.length) {
// this row puts us beyond the current storage
Object[] newKeys = new Object[size];
System.arraycopy(this.keys, 0, newKeys, 0, this.keys.length);
this.keys = (K[]) newKeys;
}
} | java | @SuppressWarnings("unchecked")
private void validateKey(int index) {
final int size = (index + 1);
if (null == this.keys) {
// nothing has been created yet
this.keys = (K[]) new Object[size];
} else if (index >= this.keys.length) {
// this row puts us beyond the current storage
Object[] newKeys = new Object[size];
System.arraycopy(this.keys, 0, newKeys, 0, this.keys.length);
this.keys = (K[]) newKeys;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"validateKey",
"(",
"int",
"index",
")",
"{",
"final",
"int",
"size",
"=",
"(",
"index",
"+",
"1",
")",
";",
"if",
"(",
"null",
"==",
"this",
".",
"keys",
")",
"{",
"// nothing has been created yet",
"this",
".",
"keys",
"=",
"(",
"K",
"[",
"]",
")",
"new",
"Object",
"[",
"size",
"]",
";",
"}",
"else",
"if",
"(",
"index",
">=",
"this",
".",
"keys",
".",
"length",
")",
"{",
"// this row puts us beyond the current storage",
"Object",
"[",
"]",
"newKeys",
"=",
"new",
"Object",
"[",
"size",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"keys",
",",
"0",
",",
"newKeys",
",",
"0",
",",
"this",
".",
"keys",
".",
"length",
")",
";",
"this",
".",
"keys",
"=",
"(",
"K",
"[",
"]",
")",
"newKeys",
";",
"}",
"}"
] | Ensure that we have space in the local key array for the target index.
@param index | [
"Ensure",
"that",
"we",
"have",
"space",
"in",
"the",
"local",
"key",
"array",
"for",
"the",
"target",
"index",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java#L186-L198 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java | EventLocalMap.validateTable | @SuppressWarnings("unchecked")
private void validateTable(int targetRow) {
// TODO pooling of the arrays?
if (null == this.values) {
// nothing has been created yet
int size = (targetRow + 1);
if (SIZE_TABLE > size) {
size = SIZE_TABLE;
}
this.values = (V[][]) new Object[size][];
} else if (targetRow >= this.values.length) {
// this row puts us beyond the current storage
final int size = (targetRow + 1);
Object[][] newTable = new Object[size][];
System.arraycopy(this.values, 0, newTable, 0, this.values.length);
this.values = (V[][]) newTable;
} else if (null != this.values[targetRow]) {
// we already have this row created and are set
return;
}
// need to create the new row in the table
this.values[targetRow] = (V[]) new Object[SIZE_ROW];
for (int i = 0; i < SIZE_ROW; i++) {
this.values[targetRow][i] = (V) NO_VALUE;
}
} | java | @SuppressWarnings("unchecked")
private void validateTable(int targetRow) {
// TODO pooling of the arrays?
if (null == this.values) {
// nothing has been created yet
int size = (targetRow + 1);
if (SIZE_TABLE > size) {
size = SIZE_TABLE;
}
this.values = (V[][]) new Object[size][];
} else if (targetRow >= this.values.length) {
// this row puts us beyond the current storage
final int size = (targetRow + 1);
Object[][] newTable = new Object[size][];
System.arraycopy(this.values, 0, newTable, 0, this.values.length);
this.values = (V[][]) newTable;
} else if (null != this.values[targetRow]) {
// we already have this row created and are set
return;
}
// need to create the new row in the table
this.values[targetRow] = (V[]) new Object[SIZE_ROW];
for (int i = 0; i < SIZE_ROW; i++) {
this.values[targetRow][i] = (V) NO_VALUE;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"validateTable",
"(",
"int",
"targetRow",
")",
"{",
"// TODO pooling of the arrays?",
"if",
"(",
"null",
"==",
"this",
".",
"values",
")",
"{",
"// nothing has been created yet",
"int",
"size",
"=",
"(",
"targetRow",
"+",
"1",
")",
";",
"if",
"(",
"SIZE_TABLE",
">",
"size",
")",
"{",
"size",
"=",
"SIZE_TABLE",
";",
"}",
"this",
".",
"values",
"=",
"(",
"V",
"[",
"]",
"[",
"]",
")",
"new",
"Object",
"[",
"size",
"]",
"[",
"",
"]",
";",
"}",
"else",
"if",
"(",
"targetRow",
">=",
"this",
".",
"values",
".",
"length",
")",
"{",
"// this row puts us beyond the current storage",
"final",
"int",
"size",
"=",
"(",
"targetRow",
"+",
"1",
")",
";",
"Object",
"[",
"]",
"[",
"]",
"newTable",
"=",
"new",
"Object",
"[",
"size",
"]",
"[",
"",
"]",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"values",
",",
"0",
",",
"newTable",
",",
"0",
",",
"this",
".",
"values",
".",
"length",
")",
";",
"this",
".",
"values",
"=",
"(",
"V",
"[",
"]",
"[",
"]",
")",
"newTable",
";",
"}",
"else",
"if",
"(",
"null",
"!=",
"this",
".",
"values",
"[",
"targetRow",
"]",
")",
"{",
"// we already have this row created and are set",
"return",
";",
"}",
"// need to create the new row in the table",
"this",
".",
"values",
"[",
"targetRow",
"]",
"=",
"(",
"V",
"[",
"]",
")",
"new",
"Object",
"[",
"SIZE_ROW",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"SIZE_ROW",
";",
"i",
"++",
")",
"{",
"this",
".",
"values",
"[",
"targetRow",
"]",
"[",
"i",
"]",
"=",
"(",
"V",
")",
"NO_VALUE",
";",
"}",
"}"
] | Validate that the storage table contains the provided row. This will
allocate new space if that is required.
@param targetRow | [
"Validate",
"that",
"the",
"storage",
"table",
"contains",
"the",
"provided",
"row",
".",
"This",
"will",
"allocate",
"new",
"space",
"if",
"that",
"is",
"required",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventLocalMap.java#L206-L231 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/runtime/impl/AttachedRemoteSubscriberControl.java | AttachedRemoteSubscriberControl.getRemoteEngineUuid | public String getRemoteEngineUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getRemoteEngineUuid");
String engineUUID = _anycastInputHandler.getLocalisationUuid().toString();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getRemoteEngineUuid", engineUUID);
return engineUUID;
} | java | public String getRemoteEngineUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getRemoteEngineUuid");
String engineUUID = _anycastInputHandler.getLocalisationUuid().toString();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getRemoteEngineUuid", engineUUID);
return engineUUID;
} | [
"public",
"String",
"getRemoteEngineUuid",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getRemoteEngineUuid\"",
")",
";",
"String",
"engineUUID",
"=",
"_anycastInputHandler",
".",
"getLocalisationUuid",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getRemoteEngineUuid\"",
",",
"engineUUID",
")",
";",
"return",
"engineUUID",
";",
"}"
] | Return the remote engine uuid | [
"Return",
"the",
"remote",
"engine",
"uuid"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/runtime/impl/AttachedRemoteSubscriberControl.java#L112-L122 | train |
Subsets and Splits