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.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java | DataFormatHelper.getThreadId | public static final String getThreadId() {
String id = threadids.get();
if (null == id) {
// Pad the tid out to 8 characters
id = getThreadId(Thread.currentThread());
threadids.set(id);
}
return id;
} | java | public static final String getThreadId() {
String id = threadids.get();
if (null == id) {
// Pad the tid out to 8 characters
id = getThreadId(Thread.currentThread());
threadids.set(id);
}
return id;
} | [
"public",
"static",
"final",
"String",
"getThreadId",
"(",
")",
"{",
"String",
"id",
"=",
"threadids",
".",
"get",
"(",
")",
";",
"if",
"(",
"null",
"==",
"id",
")",
"{",
"// Pad the tid out to 8 characters",
"id",
"=",
"getThreadId",
"(",
"Thread",
".",
"currentThread",
"(",
")",
")",
";",
"threadids",
".",
"set",
"(",
"id",
")",
";",
"}",
"return",
"id",
";",
"}"
] | Get and return the thread id, padded to 8 characters.
@return 8 character string representation of thread id | [
"Get",
"and",
"return",
"the",
"thread",
"id",
"padded",
"to",
"8",
"characters",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java#L173-L181 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java | DataFormatHelper.padHexString | public static final String padHexString(int num, int width) {
final String zeroPad = "0000000000000000";
String str = Integer.toHexString(num);
final int length = str.length();
if (length >= width)
return str;
StringBuilder buffer = new StringBuilder(zeroPad.substring(0, width));
buffer.replace(width - length, width, str);
return buffer.toString();
} | java | public static final String padHexString(int num, int width) {
final String zeroPad = "0000000000000000";
String str = Integer.toHexString(num);
final int length = str.length();
if (length >= width)
return str;
StringBuilder buffer = new StringBuilder(zeroPad.substring(0, width));
buffer.replace(width - length, width, str);
return buffer.toString();
} | [
"public",
"static",
"final",
"String",
"padHexString",
"(",
"int",
"num",
",",
"int",
"width",
")",
"{",
"final",
"String",
"zeroPad",
"=",
"\"0000000000000000\"",
";",
"String",
"str",
"=",
"Integer",
".",
"toHexString",
"(",
"num",
")",
";",
"final",
"int",
"length",
"=",
"str",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
">=",
"width",
")",
"return",
"str",
";",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
"zeroPad",
".",
"substring",
"(",
"0",
",",
"width",
")",
")",
";",
"buffer",
".",
"replace",
"(",
"width",
"-",
"length",
",",
"width",
",",
"str",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] | Returns the provided integer, padded to the specified number of characters with zeros.
@param num
Input number as an integer
@param width
Number of characters to return, including padding
@return input number as zero-padded string | [
"Returns",
"the",
"provided",
"integer",
"padded",
"to",
"the",
"specified",
"number",
"of",
"characters",
"with",
"zeros",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java#L202-L214 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java | DataFormatHelper.throwableToString | public static final String throwableToString(Throwable t) {
final StringWriter s = new StringWriter();
final PrintWriter p = new PrintWriter(s);
if (t == null) {
p.println("none");
} else {
printStackTrace(p, t);
}
return DataFormatHelper.escape(s.toString());
} | java | public static final String throwableToString(Throwable t) {
final StringWriter s = new StringWriter();
final PrintWriter p = new PrintWriter(s);
if (t == null) {
p.println("none");
} else {
printStackTrace(p, t);
}
return DataFormatHelper.escape(s.toString());
} | [
"public",
"static",
"final",
"String",
"throwableToString",
"(",
"Throwable",
"t",
")",
"{",
"final",
"StringWriter",
"s",
"=",
"new",
"StringWriter",
"(",
")",
";",
"final",
"PrintWriter",
"p",
"=",
"new",
"PrintWriter",
"(",
"s",
")",
";",
"if",
"(",
"t",
"==",
"null",
")",
"{",
"p",
".",
"println",
"(",
"\"none\"",
")",
";",
"}",
"else",
"{",
"printStackTrace",
"(",
"p",
",",
"t",
")",
";",
"}",
"return",
"DataFormatHelper",
".",
"escape",
"(",
"s",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Returns a string containing the formatted exception stack
@param t throwable
@return formatted exception stack as a string | [
"Returns",
"a",
"string",
"containing",
"the",
"formatted",
"exception",
"stack"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java#L223-L234 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java | DataFormatHelper.printFieldStackTrace | private static final boolean printFieldStackTrace(PrintWriter p, Throwable t, String className, String fieldName) {
for (Class<?> c = t.getClass(); c != Object.class; c = c.getSuperclass()) {
if (c.getName().equals(className)) {
try {
Object value = c.getField(fieldName).get(t);
if (value instanceof Throwable && value != t.getCause()) {
p.append(fieldName).append(": ");
printStackTrace(p, (Throwable) value);
}
return true;
} catch (NoSuchFieldException e) {
} catch (IllegalAccessException e) {
}
}
}
return false;
} | java | private static final boolean printFieldStackTrace(PrintWriter p, Throwable t, String className, String fieldName) {
for (Class<?> c = t.getClass(); c != Object.class; c = c.getSuperclass()) {
if (c.getName().equals(className)) {
try {
Object value = c.getField(fieldName).get(t);
if (value instanceof Throwable && value != t.getCause()) {
p.append(fieldName).append(": ");
printStackTrace(p, (Throwable) value);
}
return true;
} catch (NoSuchFieldException e) {
} catch (IllegalAccessException e) {
}
}
}
return false;
} | [
"private",
"static",
"final",
"boolean",
"printFieldStackTrace",
"(",
"PrintWriter",
"p",
",",
"Throwable",
"t",
",",
"String",
"className",
",",
"String",
"fieldName",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"c",
"=",
"t",
".",
"getClass",
"(",
")",
";",
"c",
"!=",
"Object",
".",
"class",
";",
"c",
"=",
"c",
".",
"getSuperclass",
"(",
")",
")",
"{",
"if",
"(",
"c",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"className",
")",
")",
"{",
"try",
"{",
"Object",
"value",
"=",
"c",
".",
"getField",
"(",
"fieldName",
")",
".",
"get",
"(",
"t",
")",
";",
"if",
"(",
"value",
"instanceof",
"Throwable",
"&&",
"value",
"!=",
"t",
".",
"getCause",
"(",
")",
")",
"{",
"p",
".",
"append",
"(",
"fieldName",
")",
".",
"append",
"(",
"\": \"",
")",
";",
"printStackTrace",
"(",
"p",
",",
"(",
"Throwable",
")",
"value",
")",
";",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"e",
")",
"{",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | Find a field value in the class hierarchy of an exception, and if the
field contains another Throwable, then print its stack trace.
@param p the writer to print to
@param t the outer throwable
@param className the name of the class to look for
@param fieldName the field in the class to look for
@return true if the field was found | [
"Find",
"a",
"field",
"value",
"in",
"the",
"class",
"hierarchy",
"of",
"an",
"exception",
"and",
"if",
"the",
"field",
"contains",
"another",
"Throwable",
"then",
"print",
"its",
"stack",
"trace",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java#L260-L277 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JikesJspCompiler.java | JikesJspCompiler.createErrorMsg | private String createErrorMsg(JspLineId jspLineId, int errorLineNr) {
StringBuffer compilerOutput = new StringBuffer();
if (jspLineId.getSourceLineCount() <= 1) {
Object[] objArray = new Object[] { new Integer(jspLineId.getStartSourceLineNum()), jspLineId.getFilePath()};
if (jspLineId.getFilePath().equals(jspLineId.getParentFile())) {
compilerOutput.append(separatorString+JspCoreException.getMsg("jsp.error.single.line.number", objArray)); // Defect 211450
}
else {
compilerOutput.append(separatorString+JspCoreException.getMsg("jsp.error.single.line.number.included.file", objArray)); // Defect 211450
}
}
else {
// compute exact JSP line number
int actualLineNum=jspLineId.getStartSourceLineNum()+(errorLineNr-jspLineId.getStartGeneratedLineNum());
if (actualLineNum>=jspLineId.getStartSourceLineNum() && actualLineNum <=(jspLineId.getStartSourceLineNum() + jspLineId.getSourceLineCount() - 1)) {
Object[] objArray = new Object[] { new Integer(actualLineNum), jspLineId.getFilePath()};
if (jspLineId.getFilePath().equals(jspLineId.getParentFile())) {
compilerOutput.append(separatorString+JspCoreException.getMsg("jsp.error.single.line.number", objArray)); // Defect 211450
}
else {
compilerOutput.append(separatorString+JspCoreException.getMsg("jsp.error.single.line.number.included.file", objArray)); // Defect 211450
}
}
else {
Object[] objArray = new Object[] {
new Integer(jspLineId.getStartSourceLineNum()),
new Integer((jspLineId.getStartSourceLineNum()) + jspLineId.getSourceLineCount() - 1),
jspLineId.getFilePath()};
if (jspLineId.getFilePath().equals(jspLineId.getParentFile())) {
compilerOutput.append(separatorString+ // Defect 211450
JspCoreException.getMsg(
"jsp.error.multiple.line.number", objArray));
}
else {
compilerOutput.append(separatorString+ // Defect 211450
JspCoreException.getMsg(
"jsp.error.multiple.line.number.included.file",objArray));
}
}
}
compilerOutput.append(separatorString+JspCoreException.getMsg("jsp.error.corresponding.servlet",new Object[] { jspLineId.getParentFile()})); // Defect 211450
//152470 starts
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "createErrorMsg", "The value of the JSP attribute jdkSourceLevel is ["+ jdkSourceLevel +"]");
}
//152470 ends
return compilerOutput.toString();
} | java | private String createErrorMsg(JspLineId jspLineId, int errorLineNr) {
StringBuffer compilerOutput = new StringBuffer();
if (jspLineId.getSourceLineCount() <= 1) {
Object[] objArray = new Object[] { new Integer(jspLineId.getStartSourceLineNum()), jspLineId.getFilePath()};
if (jspLineId.getFilePath().equals(jspLineId.getParentFile())) {
compilerOutput.append(separatorString+JspCoreException.getMsg("jsp.error.single.line.number", objArray)); // Defect 211450
}
else {
compilerOutput.append(separatorString+JspCoreException.getMsg("jsp.error.single.line.number.included.file", objArray)); // Defect 211450
}
}
else {
// compute exact JSP line number
int actualLineNum=jspLineId.getStartSourceLineNum()+(errorLineNr-jspLineId.getStartGeneratedLineNum());
if (actualLineNum>=jspLineId.getStartSourceLineNum() && actualLineNum <=(jspLineId.getStartSourceLineNum() + jspLineId.getSourceLineCount() - 1)) {
Object[] objArray = new Object[] { new Integer(actualLineNum), jspLineId.getFilePath()};
if (jspLineId.getFilePath().equals(jspLineId.getParentFile())) {
compilerOutput.append(separatorString+JspCoreException.getMsg("jsp.error.single.line.number", objArray)); // Defect 211450
}
else {
compilerOutput.append(separatorString+JspCoreException.getMsg("jsp.error.single.line.number.included.file", objArray)); // Defect 211450
}
}
else {
Object[] objArray = new Object[] {
new Integer(jspLineId.getStartSourceLineNum()),
new Integer((jspLineId.getStartSourceLineNum()) + jspLineId.getSourceLineCount() - 1),
jspLineId.getFilePath()};
if (jspLineId.getFilePath().equals(jspLineId.getParentFile())) {
compilerOutput.append(separatorString+ // Defect 211450
JspCoreException.getMsg(
"jsp.error.multiple.line.number", objArray));
}
else {
compilerOutput.append(separatorString+ // Defect 211450
JspCoreException.getMsg(
"jsp.error.multiple.line.number.included.file",objArray));
}
}
}
compilerOutput.append(separatorString+JspCoreException.getMsg("jsp.error.corresponding.servlet",new Object[] { jspLineId.getParentFile()})); // Defect 211450
//152470 starts
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "createErrorMsg", "The value of the JSP attribute jdkSourceLevel is ["+ jdkSourceLevel +"]");
}
//152470 ends
return compilerOutput.toString();
} | [
"private",
"String",
"createErrorMsg",
"(",
"JspLineId",
"jspLineId",
",",
"int",
"errorLineNr",
")",
"{",
"StringBuffer",
"compilerOutput",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"jspLineId",
".",
"getSourceLineCount",
"(",
")",
"<=",
"1",
")",
"{",
"Object",
"[",
"]",
"objArray",
"=",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"jspLineId",
".",
"getStartSourceLineNum",
"(",
")",
")",
",",
"jspLineId",
".",
"getFilePath",
"(",
")",
"}",
";",
"if",
"(",
"jspLineId",
".",
"getFilePath",
"(",
")",
".",
"equals",
"(",
"jspLineId",
".",
"getParentFile",
"(",
")",
")",
")",
"{",
"compilerOutput",
".",
"append",
"(",
"separatorString",
"+",
"JspCoreException",
".",
"getMsg",
"(",
"\"jsp.error.single.line.number\"",
",",
"objArray",
")",
")",
";",
"// Defect 211450",
"}",
"else",
"{",
"compilerOutput",
".",
"append",
"(",
"separatorString",
"+",
"JspCoreException",
".",
"getMsg",
"(",
"\"jsp.error.single.line.number.included.file\"",
",",
"objArray",
")",
")",
";",
"// Defect 211450",
"}",
"}",
"else",
"{",
"// compute exact JSP line number ",
"int",
"actualLineNum",
"=",
"jspLineId",
".",
"getStartSourceLineNum",
"(",
")",
"+",
"(",
"errorLineNr",
"-",
"jspLineId",
".",
"getStartGeneratedLineNum",
"(",
")",
")",
";",
"if",
"(",
"actualLineNum",
">=",
"jspLineId",
".",
"getStartSourceLineNum",
"(",
")",
"&&",
"actualLineNum",
"<=",
"(",
"jspLineId",
".",
"getStartSourceLineNum",
"(",
")",
"+",
"jspLineId",
".",
"getSourceLineCount",
"(",
")",
"-",
"1",
")",
")",
"{",
"Object",
"[",
"]",
"objArray",
"=",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"actualLineNum",
")",
",",
"jspLineId",
".",
"getFilePath",
"(",
")",
"}",
";",
"if",
"(",
"jspLineId",
".",
"getFilePath",
"(",
")",
".",
"equals",
"(",
"jspLineId",
".",
"getParentFile",
"(",
")",
")",
")",
"{",
"compilerOutput",
".",
"append",
"(",
"separatorString",
"+",
"JspCoreException",
".",
"getMsg",
"(",
"\"jsp.error.single.line.number\"",
",",
"objArray",
")",
")",
";",
"// Defect 211450",
"}",
"else",
"{",
"compilerOutput",
".",
"append",
"(",
"separatorString",
"+",
"JspCoreException",
".",
"getMsg",
"(",
"\"jsp.error.single.line.number.included.file\"",
",",
"objArray",
")",
")",
";",
"// Defect 211450",
"}",
"}",
"else",
"{",
"Object",
"[",
"]",
"objArray",
"=",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"jspLineId",
".",
"getStartSourceLineNum",
"(",
")",
")",
",",
"new",
"Integer",
"(",
"(",
"jspLineId",
".",
"getStartSourceLineNum",
"(",
")",
")",
"+",
"jspLineId",
".",
"getSourceLineCount",
"(",
")",
"-",
"1",
")",
",",
"jspLineId",
".",
"getFilePath",
"(",
")",
"}",
";",
"if",
"(",
"jspLineId",
".",
"getFilePath",
"(",
")",
".",
"equals",
"(",
"jspLineId",
".",
"getParentFile",
"(",
")",
")",
")",
"{",
"compilerOutput",
".",
"append",
"(",
"separatorString",
"+",
"// Defect 211450",
"JspCoreException",
".",
"getMsg",
"(",
"\"jsp.error.multiple.line.number\"",
",",
"objArray",
")",
")",
";",
"}",
"else",
"{",
"compilerOutput",
".",
"append",
"(",
"separatorString",
"+",
"// Defect 211450",
"JspCoreException",
".",
"getMsg",
"(",
"\"jsp.error.multiple.line.number.included.file\"",
",",
"objArray",
")",
")",
";",
"}",
"}",
"}",
"compilerOutput",
".",
"append",
"(",
"separatorString",
"+",
"JspCoreException",
".",
"getMsg",
"(",
"\"jsp.error.corresponding.servlet\"",
",",
"new",
"Object",
"[",
"]",
"{",
"jspLineId",
".",
"getParentFile",
"(",
")",
"}",
")",
")",
";",
"// Defect 211450",
"//152470 starts",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINER",
")",
")",
"{",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINER",
",",
"CLASS_NAME",
",",
"\"createErrorMsg\"",
",",
"\"The value of the JSP attribute jdkSourceLevel is [\"",
"+",
"jdkSourceLevel",
"+",
"\"]\"",
")",
";",
"}",
"//152470 ends",
"return",
"compilerOutput",
".",
"toString",
"(",
")",
";",
"}"
] | name of parent file | [
"name",
"of",
"parent",
"file"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JikesJspCompiler.java#L360-L409 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java | WebConfigParamUtils.getInstanceInitParameter | @SuppressWarnings("unchecked")
public static <T> T getInstanceInitParameter(ExternalContext context, String name,
String deprecatedName, T defaultValue)
{
String param = getStringInitParameter(context, name, deprecatedName);
if (param == null)
{
return defaultValue;
}
else
{
try
{
return (T) ClassUtils.classForName(param).newInstance();
}
catch (Exception e)
{
throw new FacesException("Error Initializing Object[" + param + "]", e);
}
}
} | java | @SuppressWarnings("unchecked")
public static <T> T getInstanceInitParameter(ExternalContext context, String name,
String deprecatedName, T defaultValue)
{
String param = getStringInitParameter(context, name, deprecatedName);
if (param == null)
{
return defaultValue;
}
else
{
try
{
return (T) ClassUtils.classForName(param).newInstance();
}
catch (Exception e)
{
throw new FacesException("Error Initializing Object[" + param + "]", e);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getInstanceInitParameter",
"(",
"ExternalContext",
"context",
",",
"String",
"name",
",",
"String",
"deprecatedName",
",",
"T",
"defaultValue",
")",
"{",
"String",
"param",
"=",
"getStringInitParameter",
"(",
"context",
",",
"name",
",",
"deprecatedName",
")",
";",
"if",
"(",
"param",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"else",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"ClassUtils",
".",
"classForName",
"(",
"param",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"FacesException",
"(",
"\"Error Initializing Object[\"",
"+",
"param",
"+",
"\"]\"",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Gets the init parameter value from the specified context and instanciate it.
If the parameter was not specified, the default value is used instead.
@param context
the application's external context
@param name
the init parameter's name
@param deprecatedName
the init parameter's deprecated name.
@param defaultValue
the default value to return in case the parameter was not set
@return the init parameter value as an object instance
@throws NullPointerException
if context or name is <code>null</code> | [
"Gets",
"the",
"init",
"parameter",
"value",
"from",
"the",
"specified",
"context",
"and",
"instanciate",
"it",
".",
"If",
"the",
"parameter",
"was",
"not",
"specified",
"the",
"default",
"value",
"is",
"used",
"instead",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java#L687-L707 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/LDAPUtils.java | LDAPUtils.escapeLDAPFilterTerm | public static String escapeLDAPFilterTerm(String term) {
if (term == null)
return null;
Matcher m = FILTER_CHARS_TO_ESCAPE.matcher(term);
StringBuffer sb = new StringBuffer(term.length());
while (m.find()) {
final String replacement = escapeFilterChar(m.group().charAt(0));
m.appendReplacement(sb, Matcher.quoteReplacement(replacement));
}
m.appendTail(sb);
return sb.toString();
} | java | public static String escapeLDAPFilterTerm(String term) {
if (term == null)
return null;
Matcher m = FILTER_CHARS_TO_ESCAPE.matcher(term);
StringBuffer sb = new StringBuffer(term.length());
while (m.find()) {
final String replacement = escapeFilterChar(m.group().charAt(0));
m.appendReplacement(sb, Matcher.quoteReplacement(replacement));
}
m.appendTail(sb);
return sb.toString();
} | [
"public",
"static",
"String",
"escapeLDAPFilterTerm",
"(",
"String",
"term",
")",
"{",
"if",
"(",
"term",
"==",
"null",
")",
"return",
"null",
";",
"Matcher",
"m",
"=",
"FILTER_CHARS_TO_ESCAPE",
".",
"matcher",
"(",
"term",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"term",
".",
"length",
"(",
")",
")",
";",
"while",
"(",
"m",
".",
"find",
"(",
")",
")",
"{",
"final",
"String",
"replacement",
"=",
"escapeFilterChar",
"(",
"m",
".",
"group",
"(",
")",
".",
"charAt",
"(",
"0",
")",
")",
";",
"m",
".",
"appendReplacement",
"(",
"sb",
",",
"Matcher",
".",
"quoteReplacement",
"(",
"replacement",
")",
")",
";",
"}",
"m",
".",
"appendTail",
"(",
"sb",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Escape a term for use in an LDAP filter.
@param term
@return | [
"Escape",
"a",
"term",
"for",
"use",
"in",
"an",
"LDAP",
"filter",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/LDAPUtils.java#L28-L39 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/RestoreStateUtils.java | RestoreStateUtils.getBindingMethod | private static Method getBindingMethod(UIComponent parent)
{
Class[] clazzes = parent.getClass().getInterfaces();
for (int i = 0; i < clazzes.length; i++)
{
Class clazz = clazzes[i];
if(clazz.getName().indexOf("BindingAware")!=-1)
{
try
{
return parent.getClass().getMethod("handleBindings",new Class[]{});
}
catch (NoSuchMethodException e)
{
// return
}
}
}
return null;
} | java | private static Method getBindingMethod(UIComponent parent)
{
Class[] clazzes = parent.getClass().getInterfaces();
for (int i = 0; i < clazzes.length; i++)
{
Class clazz = clazzes[i];
if(clazz.getName().indexOf("BindingAware")!=-1)
{
try
{
return parent.getClass().getMethod("handleBindings",new Class[]{});
}
catch (NoSuchMethodException e)
{
// return
}
}
}
return null;
} | [
"private",
"static",
"Method",
"getBindingMethod",
"(",
"UIComponent",
"parent",
")",
"{",
"Class",
"[",
"]",
"clazzes",
"=",
"parent",
".",
"getClass",
"(",
")",
".",
"getInterfaces",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"clazzes",
".",
"length",
";",
"i",
"++",
")",
"{",
"Class",
"clazz",
"=",
"clazzes",
"[",
"i",
"]",
";",
"if",
"(",
"clazz",
".",
"getName",
"(",
")",
".",
"indexOf",
"(",
"\"BindingAware\"",
")",
"!=",
"-",
"1",
")",
"{",
"try",
"{",
"return",
"parent",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"handleBindings\"",
",",
"new",
"Class",
"[",
"]",
"{",
"}",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"// return",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | This is all a hack to work around a spec-bug which will be fixed in JSF2.0
@param parent
@return true if this component is bindingAware (e.g. aliasBean) | [
"This",
"is",
"all",
"a",
"hack",
"to",
"work",
"around",
"a",
"spec",
"-",
"bug",
"which",
"will",
"be",
"fixed",
"in",
"JSF2",
".",
"0"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/RestoreStateUtils.java#L99-L121 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapEntity.java | LdapEntity.setObjectClasses | public void setObjectClasses(List<String> objectClasses) {
int size = objectClasses.size();
iObjectClasses = new ArrayList<String>(objectClasses.size());
for (int i = 0; i < size; i++) {
String objectClass = objectClasses.get(i).toLowerCase();
if (!iObjectClasses.contains(objectClass)) {
iObjectClasses.add(objectClass);
}
}
} | java | public void setObjectClasses(List<String> objectClasses) {
int size = objectClasses.size();
iObjectClasses = new ArrayList<String>(objectClasses.size());
for (int i = 0; i < size; i++) {
String objectClass = objectClasses.get(i).toLowerCase();
if (!iObjectClasses.contains(objectClass)) {
iObjectClasses.add(objectClass);
}
}
} | [
"public",
"void",
"setObjectClasses",
"(",
"List",
"<",
"String",
">",
"objectClasses",
")",
"{",
"int",
"size",
"=",
"objectClasses",
".",
"size",
"(",
")",
";",
"iObjectClasses",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"objectClasses",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"String",
"objectClass",
"=",
"objectClasses",
".",
"get",
"(",
"i",
")",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"!",
"iObjectClasses",
".",
"contains",
"(",
"objectClass",
")",
")",
"{",
"iObjectClasses",
".",
"add",
"(",
"objectClass",
")",
";",
"}",
"}",
"}"
] | Sets a list of defining object classes for this entity type.
The object classes will be stored in lower case form for comparison.
@param objectClasses A list of defining object class names to be added. | [
"Sets",
"a",
"list",
"of",
"defining",
"object",
"classes",
"for",
"this",
"entity",
"type",
".",
"The",
"object",
"classes",
"will",
"be",
"stored",
"in",
"lower",
"case",
"form",
"for",
"comparison",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapEntity.java#L232-L241 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapEntity.java | LdapEntity.setObjectClassesForCreate | public void setObjectClassesForCreate(List<String> objectClasses) {
if (iRDNObjectClass != null && iRDNObjectClass.length > 1) {
iObjectClassAttrs = new Attribute[iRDNObjectClass.length];
for (int i = 0; i < iRDNObjectClass.length; i++) {
iObjectClassAttrs[i] = new BasicAttribute(LdapConstants.LDAP_ATTR_OBJECTCLASS, iRDNObjectClass[i][0]);
// Remove the object class for create
objectClasses.remove(iRDNObjectClass[i][0]);
}
// Add rest auxliary object classes.
for (int i = 0; i < iObjectClassAttrs.length; i++) {
for (int j = 0; j < objectClasses.size(); j++) {
iObjectClassAttrs[i].add(objectClasses.get(j));
}
}
} else {
iObjectClassAttrs = new Attribute[1];
iObjectClassAttrs[0] = new BasicAttribute(LdapConstants.LDAP_ATTR_OBJECTCLASS);
if (objectClasses.size() > 0) {
for (int i = 0; i < objectClasses.size(); i++) {
iObjectClassAttrs[0].add(objectClasses.get(i));
}
} else {
// If create object class is not define, use object classes
for (int i = 0; i < iObjectClasses.size(); i++) {
iObjectClassAttrs[0].add(iObjectClasses.get(i));
}
}
}
} | java | public void setObjectClassesForCreate(List<String> objectClasses) {
if (iRDNObjectClass != null && iRDNObjectClass.length > 1) {
iObjectClassAttrs = new Attribute[iRDNObjectClass.length];
for (int i = 0; i < iRDNObjectClass.length; i++) {
iObjectClassAttrs[i] = new BasicAttribute(LdapConstants.LDAP_ATTR_OBJECTCLASS, iRDNObjectClass[i][0]);
// Remove the object class for create
objectClasses.remove(iRDNObjectClass[i][0]);
}
// Add rest auxliary object classes.
for (int i = 0; i < iObjectClassAttrs.length; i++) {
for (int j = 0; j < objectClasses.size(); j++) {
iObjectClassAttrs[i].add(objectClasses.get(j));
}
}
} else {
iObjectClassAttrs = new Attribute[1];
iObjectClassAttrs[0] = new BasicAttribute(LdapConstants.LDAP_ATTR_OBJECTCLASS);
if (objectClasses.size() > 0) {
for (int i = 0; i < objectClasses.size(); i++) {
iObjectClassAttrs[0].add(objectClasses.get(i));
}
} else {
// If create object class is not define, use object classes
for (int i = 0; i < iObjectClasses.size(); i++) {
iObjectClassAttrs[0].add(iObjectClasses.get(i));
}
}
}
} | [
"public",
"void",
"setObjectClassesForCreate",
"(",
"List",
"<",
"String",
">",
"objectClasses",
")",
"{",
"if",
"(",
"iRDNObjectClass",
"!=",
"null",
"&&",
"iRDNObjectClass",
".",
"length",
">",
"1",
")",
"{",
"iObjectClassAttrs",
"=",
"new",
"Attribute",
"[",
"iRDNObjectClass",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"iRDNObjectClass",
".",
"length",
";",
"i",
"++",
")",
"{",
"iObjectClassAttrs",
"[",
"i",
"]",
"=",
"new",
"BasicAttribute",
"(",
"LdapConstants",
".",
"LDAP_ATTR_OBJECTCLASS",
",",
"iRDNObjectClass",
"[",
"i",
"]",
"[",
"0",
"]",
")",
";",
"// Remove the object class for create",
"objectClasses",
".",
"remove",
"(",
"iRDNObjectClass",
"[",
"i",
"]",
"[",
"0",
"]",
")",
";",
"}",
"// Add rest auxliary object classes.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"iObjectClassAttrs",
".",
"length",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"objectClasses",
".",
"size",
"(",
")",
";",
"j",
"++",
")",
"{",
"iObjectClassAttrs",
"[",
"i",
"]",
".",
"add",
"(",
"objectClasses",
".",
"get",
"(",
"j",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"iObjectClassAttrs",
"=",
"new",
"Attribute",
"[",
"1",
"]",
";",
"iObjectClassAttrs",
"[",
"0",
"]",
"=",
"new",
"BasicAttribute",
"(",
"LdapConstants",
".",
"LDAP_ATTR_OBJECTCLASS",
")",
";",
"if",
"(",
"objectClasses",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"objectClasses",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"iObjectClassAttrs",
"[",
"0",
"]",
".",
"add",
"(",
"objectClasses",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"}",
"else",
"{",
"// If create object class is not define, use object classes",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"iObjectClasses",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"iObjectClassAttrs",
"[",
"0",
"]",
".",
"add",
"(",
"iObjectClasses",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"}",
"}",
"}"
] | Sets the object classes attribute for creating.
@param objectClasses A list of defining object class names to be added. | [
"Sets",
"the",
"object",
"classes",
"attribute",
"for",
"creating",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapEntity.java#L249-L277 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapEntity.java | LdapEntity.setRDNAttributes | public void setRDNAttributes(List<Map<String, Object>> rdnAttrList) throws MissingInitPropertyException {
int size = rdnAttrList.size();
// if size = 0, No RDN attributes defined. Same as RDN properties.
if (size > 0) {
iRDNAttrs = new String[size][];
iRDNObjectClass = new String[size][];
if (size == 1) {
Map<String, Object> rdnAttr = rdnAttrList.get(0);
String[] rdns = LdapHelper.getRDNs((String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME));
iRDNAttrs[0] = rdns;
} else {
int i = 0;
for (Map<String, Object> rdnAttr : rdnAttrList) {
String name = (String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME);
String[] rdns = LdapHelper.getRDNs(name);
iRDNAttrs[i] = rdns;
String[] objCls = (String[]) rdnAttr.get(ConfigConstants.CONFIG_PROP_OBJECTCLASS);
if (objCls == null) {
throw new MissingInitPropertyException(WIMMessageKey.MISSING_INI_PROPERTY, Tr.formatMessage(
tc,
WIMMessageKey.MISSING_INI_PROPERTY,
WIMMessageHelper.generateMsgParms(ConfigConstants.CONFIG_PROP_OBJECTCLASS)));
} else {
iRDNObjectClass[i] = objCls;
}
i++;
}
}
}
} | java | public void setRDNAttributes(List<Map<String, Object>> rdnAttrList) throws MissingInitPropertyException {
int size = rdnAttrList.size();
// if size = 0, No RDN attributes defined. Same as RDN properties.
if (size > 0) {
iRDNAttrs = new String[size][];
iRDNObjectClass = new String[size][];
if (size == 1) {
Map<String, Object> rdnAttr = rdnAttrList.get(0);
String[] rdns = LdapHelper.getRDNs((String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME));
iRDNAttrs[0] = rdns;
} else {
int i = 0;
for (Map<String, Object> rdnAttr : rdnAttrList) {
String name = (String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME);
String[] rdns = LdapHelper.getRDNs(name);
iRDNAttrs[i] = rdns;
String[] objCls = (String[]) rdnAttr.get(ConfigConstants.CONFIG_PROP_OBJECTCLASS);
if (objCls == null) {
throw new MissingInitPropertyException(WIMMessageKey.MISSING_INI_PROPERTY, Tr.formatMessage(
tc,
WIMMessageKey.MISSING_INI_PROPERTY,
WIMMessageHelper.generateMsgParms(ConfigConstants.CONFIG_PROP_OBJECTCLASS)));
} else {
iRDNObjectClass[i] = objCls;
}
i++;
}
}
}
} | [
"public",
"void",
"setRDNAttributes",
"(",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"rdnAttrList",
")",
"throws",
"MissingInitPropertyException",
"{",
"int",
"size",
"=",
"rdnAttrList",
".",
"size",
"(",
")",
";",
"// if size = 0, No RDN attributes defined. Same as RDN properties.",
"if",
"(",
"size",
">",
"0",
")",
"{",
"iRDNAttrs",
"=",
"new",
"String",
"[",
"size",
"]",
"[",
"",
"]",
";",
"iRDNObjectClass",
"=",
"new",
"String",
"[",
"size",
"]",
"[",
"",
"]",
";",
"if",
"(",
"size",
"==",
"1",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"rdnAttr",
"=",
"rdnAttrList",
".",
"get",
"(",
"0",
")",
";",
"String",
"[",
"]",
"rdns",
"=",
"LdapHelper",
".",
"getRDNs",
"(",
"(",
"String",
")",
"rdnAttr",
".",
"get",
"(",
"ConfigConstants",
".",
"CONFIG_PROP_NAME",
")",
")",
";",
"iRDNAttrs",
"[",
"0",
"]",
"=",
"rdns",
";",
"}",
"else",
"{",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"rdnAttr",
":",
"rdnAttrList",
")",
"{",
"String",
"name",
"=",
"(",
"String",
")",
"rdnAttr",
".",
"get",
"(",
"ConfigConstants",
".",
"CONFIG_PROP_NAME",
")",
";",
"String",
"[",
"]",
"rdns",
"=",
"LdapHelper",
".",
"getRDNs",
"(",
"name",
")",
";",
"iRDNAttrs",
"[",
"i",
"]",
"=",
"rdns",
";",
"String",
"[",
"]",
"objCls",
"=",
"(",
"String",
"[",
"]",
")",
"rdnAttr",
".",
"get",
"(",
"ConfigConstants",
".",
"CONFIG_PROP_OBJECTCLASS",
")",
";",
"if",
"(",
"objCls",
"==",
"null",
")",
"{",
"throw",
"new",
"MissingInitPropertyException",
"(",
"WIMMessageKey",
".",
"MISSING_INI_PROPERTY",
",",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"MISSING_INI_PROPERTY",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"ConfigConstants",
".",
"CONFIG_PROP_OBJECTCLASS",
")",
")",
")",
";",
"}",
"else",
"{",
"iRDNObjectClass",
"[",
"i",
"]",
"=",
"objCls",
";",
"}",
"i",
"++",
";",
"}",
"}",
"}",
"}"
] | Sets the RDN attribute types of this member type.
RDN attribute types will be converted to lower case.
@param The RDN attribute types of this member type. | [
"Sets",
"the",
"RDN",
"attribute",
"types",
"of",
"this",
"member",
"type",
".",
"RDN",
"attribute",
"types",
"will",
"be",
"converted",
"to",
"lower",
"case",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapEntity.java#L400-L429 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapEntity.java | LdapEntity.getObjectClassAttribute | public Attribute getObjectClassAttribute(String dn) {
if (iObjectClassAttrs.length == 1 || dn == null) {
return iObjectClassAttrs[0];
} else {
String[] rdns = LdapHelper.getRDNAttributes(dn);
for (int i = 0; i < iRDNAttrs.length; i++) {
String[] attrs = iRDNAttrs[i];
for (int j = 0; j < attrs.length; j++) {
for (int k = 0; k < attrs.length; k++) {
if (attrs[j].equals(rdns[k])) {
return iObjectClassAttrs[i];
}
}
}
}
}
return null;
} | java | public Attribute getObjectClassAttribute(String dn) {
if (iObjectClassAttrs.length == 1 || dn == null) {
return iObjectClassAttrs[0];
} else {
String[] rdns = LdapHelper.getRDNAttributes(dn);
for (int i = 0; i < iRDNAttrs.length; i++) {
String[] attrs = iRDNAttrs[i];
for (int j = 0; j < attrs.length; j++) {
for (int k = 0; k < attrs.length; k++) {
if (attrs[j].equals(rdns[k])) {
return iObjectClassAttrs[i];
}
}
}
}
}
return null;
} | [
"public",
"Attribute",
"getObjectClassAttribute",
"(",
"String",
"dn",
")",
"{",
"if",
"(",
"iObjectClassAttrs",
".",
"length",
"==",
"1",
"||",
"dn",
"==",
"null",
")",
"{",
"return",
"iObjectClassAttrs",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"String",
"[",
"]",
"rdns",
"=",
"LdapHelper",
".",
"getRDNAttributes",
"(",
"dn",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"iRDNAttrs",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"[",
"]",
"attrs",
"=",
"iRDNAttrs",
"[",
"i",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"attrs",
".",
"length",
";",
"j",
"++",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"attrs",
".",
"length",
";",
"k",
"++",
")",
"{",
"if",
"(",
"attrs",
"[",
"j",
"]",
".",
"equals",
"(",
"rdns",
"[",
"k",
"]",
")",
")",
"{",
"return",
"iObjectClassAttrs",
"[",
"i",
"]",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the LDAP object class attribute that contains all object classes needed to create the member on LDAP server.
@return The LDAP object class attribute of this member type. | [
"Gets",
"the",
"LDAP",
"object",
"class",
"attribute",
"that",
"contains",
"all",
"object",
"classes",
"needed",
"to",
"create",
"the",
"member",
"on",
"LDAP",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapEntity.java#L436-L455 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/SimpleEntry.java | SimpleEntry.next | public SimpleEntry next()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "next", this);
SibTr.exit(tc, "next", this.next);
}
return this.next;
} | java | public SimpleEntry next()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "next", this);
SibTr.exit(tc, "next", this.next);
}
return this.next;
} | [
"public",
"SimpleEntry",
"next",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"next\"",
",",
"this",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"next\"",
",",
"this",
".",
"next",
")",
";",
"}",
"return",
"this",
".",
"next",
";",
"}"
] | Return the next entry in the list
@return | [
"Return",
"the",
"next",
"entry",
"in",
"the",
"list"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/SimpleEntry.java#L44-L53 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/SimpleEntry.java | SimpleEntry.remove | public void remove()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "remove", this);
if(previous != null)
previous.next = next;
else
list.first = next;
if(next != null)
next.previous = previous;
else
list.last = previous;
previous = null;
next = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "remove", list.printList());
} | java | public void remove()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "remove", this);
if(previous != null)
previous.next = next;
else
list.first = next;
if(next != null)
next.previous = previous;
else
list.last = previous;
previous = null;
next = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "remove", list.printList());
} | [
"public",
"void",
"remove",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"remove\"",
",",
"this",
")",
";",
"if",
"(",
"previous",
"!=",
"null",
")",
"previous",
".",
"next",
"=",
"next",
";",
"else",
"list",
".",
"first",
"=",
"next",
";",
"if",
"(",
"next",
"!=",
"null",
")",
"next",
".",
"previous",
"=",
"previous",
";",
"else",
"list",
".",
"last",
"=",
"previous",
";",
"previous",
"=",
"null",
";",
"next",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"remove\"",
",",
"list",
".",
"printList",
"(",
")",
")",
";",
"}"
] | Remove this entry from the list | [
"Remove",
"this",
"entry",
"from",
"the",
"list"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/SimpleEntry.java#L59-L79 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.utils/src/com/ibm/ws/jca/utils/metagen/ChildAliasSelector.java | ChildAliasSelector.rank | void rank(MetatypeOcd ocd, List<String> rankedSuffixes) {
List<String> childAliasSuffixes = new LinkedList<String>();
for (String suffix : rankedSuffixes)
if (!childAliasSuffixes.contains(suffix)) {
MetatypeOcd collision = unavailableSuffixes.put(suffix, ocd);
if (collision == null)
childAliasSuffixes.add(suffix);
else {
List<String> suffixesForCollisionOCD = rankings.get(collision);
if (suffixesForCollisionOCD != null)
suffixesForCollisionOCD.remove(suffix);
}
}
rankings.put(ocd, childAliasSuffixes);
} | java | void rank(MetatypeOcd ocd, List<String> rankedSuffixes) {
List<String> childAliasSuffixes = new LinkedList<String>();
for (String suffix : rankedSuffixes)
if (!childAliasSuffixes.contains(suffix)) {
MetatypeOcd collision = unavailableSuffixes.put(suffix, ocd);
if (collision == null)
childAliasSuffixes.add(suffix);
else {
List<String> suffixesForCollisionOCD = rankings.get(collision);
if (suffixesForCollisionOCD != null)
suffixesForCollisionOCD.remove(suffix);
}
}
rankings.put(ocd, childAliasSuffixes);
} | [
"void",
"rank",
"(",
"MetatypeOcd",
"ocd",
",",
"List",
"<",
"String",
">",
"rankedSuffixes",
")",
"{",
"List",
"<",
"String",
">",
"childAliasSuffixes",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"String",
"suffix",
":",
"rankedSuffixes",
")",
"if",
"(",
"!",
"childAliasSuffixes",
".",
"contains",
"(",
"suffix",
")",
")",
"{",
"MetatypeOcd",
"collision",
"=",
"unavailableSuffixes",
".",
"put",
"(",
"suffix",
",",
"ocd",
")",
";",
"if",
"(",
"collision",
"==",
"null",
")",
"childAliasSuffixes",
".",
"add",
"(",
"suffix",
")",
";",
"else",
"{",
"List",
"<",
"String",
">",
"suffixesForCollisionOCD",
"=",
"rankings",
".",
"get",
"(",
"collision",
")",
";",
"if",
"(",
"suffixesForCollisionOCD",
"!=",
"null",
")",
"suffixesForCollisionOCD",
".",
"remove",
"(",
"suffix",
")",
";",
"}",
"}",
"rankings",
".",
"put",
"(",
"ocd",
",",
"childAliasSuffixes",
")",
";",
"}"
] | Specifies rankings for child alias suffixes.
@param ocd represents an object class definition (OCD) element.
@param rankedSuffixes ordered list that indicates the rankings. Elements at the beginning of the list are considered to have the highest preference. | [
"Specifies",
"rankings",
"for",
"child",
"alias",
"suffixes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.utils/src/com/ibm/ws/jca/utils/metagen/ChildAliasSelector.java#L71-L85 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.utils/src/com/ibm/ws/jca/utils/metagen/ChildAliasSelector.java | ChildAliasSelector.reserve | void reserve(String suffix, MetatypeOcd ocd) {
MetatypeOcd previous = unavailableSuffixes.put(suffix, ocd);
if (previous != null)
throw new IllegalArgumentException("aliasSuffix: " + suffix);
} | java | void reserve(String suffix, MetatypeOcd ocd) {
MetatypeOcd previous = unavailableSuffixes.put(suffix, ocd);
if (previous != null)
throw new IllegalArgumentException("aliasSuffix: " + suffix);
} | [
"void",
"reserve",
"(",
"String",
"suffix",
",",
"MetatypeOcd",
"ocd",
")",
"{",
"MetatypeOcd",
"previous",
"=",
"unavailableSuffixes",
".",
"put",
"(",
"suffix",
",",
"ocd",
")",
";",
"if",
"(",
"previous",
"!=",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"aliasSuffix: \"",
"+",
"suffix",
")",
";",
"}"
] | Reserve a child alias suffix so that no one else can claim it.
This method should only be used when an aliasSuffix override is specified in wlp-ra.xml.
@param suffix name of the child alias.
@param ocd OCD element that is claiming it.
@throws IllegalArgumentException if another OCD has already reserved the child alias suffix. | [
"Reserve",
"a",
"child",
"alias",
"suffix",
"so",
"that",
"no",
"one",
"else",
"can",
"claim",
"it",
".",
"This",
"method",
"should",
"only",
"be",
"used",
"when",
"an",
"aliasSuffix",
"override",
"is",
"specified",
"in",
"wlp",
"-",
"ra",
".",
"xml",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.utils/src/com/ibm/ws/jca/utils/metagen/ChildAliasSelector.java#L95-L99 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverEsa.java | KernelResolverEsa.matchCapability | private CapabilityMatchingResult matchCapability(Collection<? extends ProvisioningFeatureDefinition> features) {
String capabilityString = esaResource.getProvisionCapability();
if (capabilityString == null) {
CapabilityMatchingResult result = new CapabilityMatchingResult();
result.capabilitySatisfied = true;
result.features = Collections.emptyList();
return result;
}
CapabilityMatchingResult result = new CapabilityMatchingResult();
result.capabilitySatisfied = true;
result.features = new ArrayList<>();
List<FeatureCapabilityInfo> capabilityMaps = createCapabilityMaps(features);
for (Filter filter : createFilterList()) {
boolean matched = false;
for (FeatureCapabilityInfo capabilityInfo : capabilityMaps) {
if (filter.matches(capabilityInfo.capabilities)) {
matched = true;
result.features.add(capabilityInfo.feature);
break;
}
}
// If any of the filters in the provision capability header don't match, we're not satisfied
if (!matched) {
result.capabilitySatisfied = false;
}
}
return result;
} | java | private CapabilityMatchingResult matchCapability(Collection<? extends ProvisioningFeatureDefinition> features) {
String capabilityString = esaResource.getProvisionCapability();
if (capabilityString == null) {
CapabilityMatchingResult result = new CapabilityMatchingResult();
result.capabilitySatisfied = true;
result.features = Collections.emptyList();
return result;
}
CapabilityMatchingResult result = new CapabilityMatchingResult();
result.capabilitySatisfied = true;
result.features = new ArrayList<>();
List<FeatureCapabilityInfo> capabilityMaps = createCapabilityMaps(features);
for (Filter filter : createFilterList()) {
boolean matched = false;
for (FeatureCapabilityInfo capabilityInfo : capabilityMaps) {
if (filter.matches(capabilityInfo.capabilities)) {
matched = true;
result.features.add(capabilityInfo.feature);
break;
}
}
// If any of the filters in the provision capability header don't match, we're not satisfied
if (!matched) {
result.capabilitySatisfied = false;
}
}
return result;
} | [
"private",
"CapabilityMatchingResult",
"matchCapability",
"(",
"Collection",
"<",
"?",
"extends",
"ProvisioningFeatureDefinition",
">",
"features",
")",
"{",
"String",
"capabilityString",
"=",
"esaResource",
".",
"getProvisionCapability",
"(",
")",
";",
"if",
"(",
"capabilityString",
"==",
"null",
")",
"{",
"CapabilityMatchingResult",
"result",
"=",
"new",
"CapabilityMatchingResult",
"(",
")",
";",
"result",
".",
"capabilitySatisfied",
"=",
"true",
";",
"result",
".",
"features",
"=",
"Collections",
".",
"emptyList",
"(",
")",
";",
"return",
"result",
";",
"}",
"CapabilityMatchingResult",
"result",
"=",
"new",
"CapabilityMatchingResult",
"(",
")",
";",
"result",
".",
"capabilitySatisfied",
"=",
"true",
";",
"result",
".",
"features",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"FeatureCapabilityInfo",
">",
"capabilityMaps",
"=",
"createCapabilityMaps",
"(",
"features",
")",
";",
"for",
"(",
"Filter",
"filter",
":",
"createFilterList",
"(",
")",
")",
"{",
"boolean",
"matched",
"=",
"false",
";",
"for",
"(",
"FeatureCapabilityInfo",
"capabilityInfo",
":",
"capabilityMaps",
")",
"{",
"if",
"(",
"filter",
".",
"matches",
"(",
"capabilityInfo",
".",
"capabilities",
")",
")",
"{",
"matched",
"=",
"true",
";",
"result",
".",
"features",
".",
"add",
"(",
"capabilityInfo",
".",
"feature",
")",
";",
"break",
";",
"}",
"}",
"// If any of the filters in the provision capability header don't match, we're not satisfied",
"if",
"(",
"!",
"matched",
")",
"{",
"result",
".",
"capabilitySatisfied",
"=",
"false",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Attempt to match the ProvisionCapability requirements against the given list of features
@param features the list of features to match against
@return a {@link CapabilityMatchingResult} specifying whether all requirements were satisfied and which features were used to satisfy them | [
"Attempt",
"to",
"match",
"the",
"ProvisionCapability",
"requirements",
"against",
"the",
"given",
"list",
"of",
"features"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverEsa.java#L180-L212 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/connections/RestRepositoryConnection.java | RestRepositoryConnection.getAssetURL | public String getAssetURL(String id) {
String url = getRepositoryUrl() + "/assets/" + id + "?";
if (getUserId() != null) {
url += "userId=" + getUserId();
}
if (getUserId() != null && getPassword() != null) {
url += "&password=" + getPassword();
}
if (getApiKey() != null) {
url += "&apiKey=" + getApiKey();
}
return url;
} | java | public String getAssetURL(String id) {
String url = getRepositoryUrl() + "/assets/" + id + "?";
if (getUserId() != null) {
url += "userId=" + getUserId();
}
if (getUserId() != null && getPassword() != null) {
url += "&password=" + getPassword();
}
if (getApiKey() != null) {
url += "&apiKey=" + getApiKey();
}
return url;
} | [
"public",
"String",
"getAssetURL",
"(",
"String",
"id",
")",
"{",
"String",
"url",
"=",
"getRepositoryUrl",
"(",
")",
"+",
"\"/assets/\"",
"+",
"id",
"+",
"\"?\"",
";",
"if",
"(",
"getUserId",
"(",
")",
"!=",
"null",
")",
"{",
"url",
"+=",
"\"userId=\"",
"+",
"getUserId",
"(",
")",
";",
"}",
"if",
"(",
"getUserId",
"(",
")",
"!=",
"null",
"&&",
"getPassword",
"(",
")",
"!=",
"null",
")",
"{",
"url",
"+=",
"\"&password=\"",
"+",
"getPassword",
"(",
")",
";",
"}",
"if",
"(",
"getApiKey",
"(",
")",
"!=",
"null",
")",
"{",
"url",
"+=",
"\"&apiKey=\"",
"+",
"getApiKey",
"(",
")",
";",
"}",
"return",
"url",
";",
"}"
] | Returns a URL which represent the URL that can be used to view the asset in Massive. This is more
for testing purposes, the assets can be access programatically via various methods on this class.
@param asset - an Asset
@return String - the asset URL | [
"Returns",
"a",
"URL",
"which",
"represent",
"the",
"URL",
"that",
"can",
"be",
"used",
"to",
"view",
"the",
"asset",
"in",
"Massive",
".",
"This",
"is",
"more",
"for",
"testing",
"purposes",
"the",
"assets",
"can",
"be",
"access",
"programatically",
"via",
"various",
"methods",
"on",
"this",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/connections/RestRepositoryConnection.java#L147-L159 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/cmdline/ExeHelpAction.java | ExeHelpAction.getTaskUsage | public String getTaskUsage(ExeAction task) {
StringBuilder taskUsage = new StringBuilder(NL);
// print a empty line
taskUsage.append(getHelpPart("global.usage"));
taskUsage.append(NL);
taskUsage.append('\t');
taskUsage.append(COMMAND);
taskUsage.append(' ');
taskUsage.append(task);
taskUsage.append(" [");
taskUsage.append(getHelpPart("global.options.lower"));
taskUsage.append("]");
List<String> options = task.getCommandOptions();
for (String option : options) {
if (option.charAt(0) != '-') {
taskUsage.append(' ');
taskUsage.append(option);
}
}
taskUsage.append(NL);
taskUsage.append(NL);
taskUsage.append(getHelpPart("global.description"));
taskUsage.append(NL);
taskUsage.append(getDescription(task));
taskUsage.append(NL);
if (options.size() > 0) {
taskUsage.append(NL);
taskUsage.append(getHelpPart("global.options"));
for (String option : task.getCommandOptions()) {
taskUsage.append(NL);
String optionKey;
try {
optionKey = getHelpPart(task + ".option-key." + option);
} catch (MissingResourceException e) {
// This happens because we don't have a message for the key for the
// license arguments but these are not translated and don't need any
// arguments after them so can just use the option
optionKey = " " + option;
}
taskUsage.append(optionKey);
taskUsage.append(NL);
taskUsage.append(getHelpPart(task + ".option-desc." + option));
taskUsage.append(NL);
}
}
taskUsage.append(NL);
return taskUsage.toString();
} | java | public String getTaskUsage(ExeAction task) {
StringBuilder taskUsage = new StringBuilder(NL);
// print a empty line
taskUsage.append(getHelpPart("global.usage"));
taskUsage.append(NL);
taskUsage.append('\t');
taskUsage.append(COMMAND);
taskUsage.append(' ');
taskUsage.append(task);
taskUsage.append(" [");
taskUsage.append(getHelpPart("global.options.lower"));
taskUsage.append("]");
List<String> options = task.getCommandOptions();
for (String option : options) {
if (option.charAt(0) != '-') {
taskUsage.append(' ');
taskUsage.append(option);
}
}
taskUsage.append(NL);
taskUsage.append(NL);
taskUsage.append(getHelpPart("global.description"));
taskUsage.append(NL);
taskUsage.append(getDescription(task));
taskUsage.append(NL);
if (options.size() > 0) {
taskUsage.append(NL);
taskUsage.append(getHelpPart("global.options"));
for (String option : task.getCommandOptions()) {
taskUsage.append(NL);
String optionKey;
try {
optionKey = getHelpPart(task + ".option-key." + option);
} catch (MissingResourceException e) {
// This happens because we don't have a message for the key for the
// license arguments but these are not translated and don't need any
// arguments after them so can just use the option
optionKey = " " + option;
}
taskUsage.append(optionKey);
taskUsage.append(NL);
taskUsage.append(getHelpPart(task + ".option-desc." + option));
taskUsage.append(NL);
}
}
taskUsage.append(NL);
return taskUsage.toString();
} | [
"public",
"String",
"getTaskUsage",
"(",
"ExeAction",
"task",
")",
"{",
"StringBuilder",
"taskUsage",
"=",
"new",
"StringBuilder",
"(",
"NL",
")",
";",
"// print a empty line",
"taskUsage",
".",
"append",
"(",
"getHelpPart",
"(",
"\"global.usage\"",
")",
")",
";",
"taskUsage",
".",
"append",
"(",
"NL",
")",
";",
"taskUsage",
".",
"append",
"(",
"'",
"'",
")",
";",
"taskUsage",
".",
"append",
"(",
"COMMAND",
")",
";",
"taskUsage",
".",
"append",
"(",
"'",
"'",
")",
";",
"taskUsage",
".",
"append",
"(",
"task",
")",
";",
"taskUsage",
".",
"append",
"(",
"\" [\"",
")",
";",
"taskUsage",
".",
"append",
"(",
"getHelpPart",
"(",
"\"global.options.lower\"",
")",
")",
";",
"taskUsage",
".",
"append",
"(",
"\"]\"",
")",
";",
"List",
"<",
"String",
">",
"options",
"=",
"task",
".",
"getCommandOptions",
"(",
")",
";",
"for",
"(",
"String",
"option",
":",
"options",
")",
"{",
"if",
"(",
"option",
".",
"charAt",
"(",
"0",
")",
"!=",
"'",
"'",
")",
"{",
"taskUsage",
".",
"append",
"(",
"'",
"'",
")",
";",
"taskUsage",
".",
"append",
"(",
"option",
")",
";",
"}",
"}",
"taskUsage",
".",
"append",
"(",
"NL",
")",
";",
"taskUsage",
".",
"append",
"(",
"NL",
")",
";",
"taskUsage",
".",
"append",
"(",
"getHelpPart",
"(",
"\"global.description\"",
")",
")",
";",
"taskUsage",
".",
"append",
"(",
"NL",
")",
";",
"taskUsage",
".",
"append",
"(",
"getDescription",
"(",
"task",
")",
")",
";",
"taskUsage",
".",
"append",
"(",
"NL",
")",
";",
"if",
"(",
"options",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"taskUsage",
".",
"append",
"(",
"NL",
")",
";",
"taskUsage",
".",
"append",
"(",
"getHelpPart",
"(",
"\"global.options\"",
")",
")",
";",
"for",
"(",
"String",
"option",
":",
"task",
".",
"getCommandOptions",
"(",
")",
")",
"{",
"taskUsage",
".",
"append",
"(",
"NL",
")",
";",
"String",
"optionKey",
";",
"try",
"{",
"optionKey",
"=",
"getHelpPart",
"(",
"task",
"+",
"\".option-key.\"",
"+",
"option",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
"e",
")",
"{",
"// This happens because we don't have a message for the key for the",
"// license arguments but these are not translated and don't need any",
"// arguments after them so can just use the option",
"optionKey",
"=",
"\" \"",
"+",
"option",
";",
"}",
"taskUsage",
".",
"append",
"(",
"optionKey",
")",
";",
"taskUsage",
".",
"append",
"(",
"NL",
")",
";",
"taskUsage",
".",
"append",
"(",
"getHelpPart",
"(",
"task",
"+",
"\".option-desc.\"",
"+",
"option",
")",
")",
";",
"taskUsage",
".",
"append",
"(",
"NL",
")",
";",
"}",
"}",
"taskUsage",
".",
"append",
"(",
"NL",
")",
";",
"return",
"taskUsage",
".",
"toString",
"(",
")",
";",
"}"
] | Constructs a string to represent the usage for a particular task.
@param task - type of action
@return string that holds the usage for param:task | [
"Constructs",
"a",
"string",
"to",
"represent",
"the",
"usage",
"for",
"a",
"particular",
"task",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/cmdline/ExeHelpAction.java#L74-L125 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/BoundedBuffer.java | BoundedBuffer.getQueueIndex | private int getQueueIndex(Object[] queue, java.util.concurrent.atomic.AtomicInteger counter, boolean increment) {
// fast path for single element array
if (queue.length == 1) {
return 0;
} else if (increment) {
// get the next long value from counter
int i = counter.incrementAndGet();
// rollover logic to make sure we stay within
// the bounds of an integer. Not important that
// this logic is highly accurate, ballpark is okay.
if (i > MAX_COUNTER) {
if (counter.compareAndSet(i, 0)) {
System.out.println("BoundedBuffer: reset counter to 0");
}
}
return i % queue.length;
} else {
return counter.get() % queue.length;
}
} | java | private int getQueueIndex(Object[] queue, java.util.concurrent.atomic.AtomicInteger counter, boolean increment) {
// fast path for single element array
if (queue.length == 1) {
return 0;
} else if (increment) {
// get the next long value from counter
int i = counter.incrementAndGet();
// rollover logic to make sure we stay within
// the bounds of an integer. Not important that
// this logic is highly accurate, ballpark is okay.
if (i > MAX_COUNTER) {
if (counter.compareAndSet(i, 0)) {
System.out.println("BoundedBuffer: reset counter to 0");
}
}
return i % queue.length;
} else {
return counter.get() % queue.length;
}
} | [
"private",
"int",
"getQueueIndex",
"(",
"Object",
"[",
"]",
"queue",
",",
"java",
".",
"util",
".",
"concurrent",
".",
"atomic",
".",
"AtomicInteger",
"counter",
",",
"boolean",
"increment",
")",
"{",
"// fast path for single element array",
"if",
"(",
"queue",
".",
"length",
"==",
"1",
")",
"{",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"increment",
")",
"{",
"// get the next long value from counter",
"int",
"i",
"=",
"counter",
".",
"incrementAndGet",
"(",
")",
";",
"// rollover logic to make sure we stay within",
"// the bounds of an integer. Not important that",
"// this logic is highly accurate, ballpark is okay.",
"if",
"(",
"i",
">",
"MAX_COUNTER",
")",
"{",
"if",
"(",
"counter",
".",
"compareAndSet",
"(",
"i",
",",
"0",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"BoundedBuffer: reset counter to 0\"",
")",
";",
"}",
"}",
"return",
"i",
"%",
"queue",
".",
"length",
";",
"}",
"else",
"{",
"return",
"counter",
".",
"get",
"(",
")",
"%",
"queue",
".",
"length",
";",
"}",
"}"
] | has waited. | [
"has",
"waited",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/BoundedBuffer.java#L230-L252 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/BoundedBuffer.java | BoundedBuffer.put | public void put(Object x) throws InterruptedException {
if (x == null) {
throw new IllegalArgumentException();
}
// D186845 if (Thread.interrupted())
// D186845 throw new InterruptedException();
// D312598 - begin
boolean ret = false;
while (true) {
synchronized (lock) {
if (numberOfUsedSlots.get() < buffer.length) {
insert(x);
numberOfUsedSlots.getAndIncrement();
ret = true;
}
}
if (ret) {
notifyGet_();
return;
}
int spinctr = SPINS_PUT_;
while (numberOfUsedSlots.get() >= buffer.length) {
// busy wait
if (spinctr > 0) {
if (YIELD_PUT_)
Thread.yield();
spinctr--;
} else {
// block on lock
waitPut_(WAIT_SHORT_SLICE_);
}
}
}
// D312598 - end
} | java | public void put(Object x) throws InterruptedException {
if (x == null) {
throw new IllegalArgumentException();
}
// D186845 if (Thread.interrupted())
// D186845 throw new InterruptedException();
// D312598 - begin
boolean ret = false;
while (true) {
synchronized (lock) {
if (numberOfUsedSlots.get() < buffer.length) {
insert(x);
numberOfUsedSlots.getAndIncrement();
ret = true;
}
}
if (ret) {
notifyGet_();
return;
}
int spinctr = SPINS_PUT_;
while (numberOfUsedSlots.get() >= buffer.length) {
// busy wait
if (spinctr > 0) {
if (YIELD_PUT_)
Thread.yield();
spinctr--;
} else {
// block on lock
waitPut_(WAIT_SHORT_SLICE_);
}
}
}
// D312598 - end
} | [
"public",
"void",
"put",
"(",
"Object",
"x",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"x",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"// D186845 if (Thread.interrupted())",
"// D186845 throw new InterruptedException();",
"// D312598 - begin",
"boolean",
"ret",
"=",
"false",
";",
"while",
"(",
"true",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"numberOfUsedSlots",
".",
"get",
"(",
")",
"<",
"buffer",
".",
"length",
")",
"{",
"insert",
"(",
"x",
")",
";",
"numberOfUsedSlots",
".",
"getAndIncrement",
"(",
")",
";",
"ret",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"ret",
")",
"{",
"notifyGet_",
"(",
")",
";",
"return",
";",
"}",
"int",
"spinctr",
"=",
"SPINS_PUT_",
";",
"while",
"(",
"numberOfUsedSlots",
".",
"get",
"(",
")",
">=",
"buffer",
".",
"length",
")",
"{",
"// busy wait",
"if",
"(",
"spinctr",
">",
"0",
")",
"{",
"if",
"(",
"YIELD_PUT_",
")",
"Thread",
".",
"yield",
"(",
")",
";",
"spinctr",
"--",
";",
"}",
"else",
"{",
"// block on lock",
"waitPut_",
"(",
"WAIT_SHORT_SLICE_",
")",
";",
"}",
"}",
"}",
"// D312598 - end",
"}"
] | Puts an object into the buffer. If the buffer is full,
the call will block indefinitely until space is freed up.
@param x
the object being placed in the buffer.
@exception IllegalArgumentException
if the object is null. | [
"Puts",
"an",
"object",
"into",
"the",
"buffer",
".",
"If",
"the",
"buffer",
"is",
"full",
"the",
"call",
"will",
"block",
"indefinitely",
"until",
"space",
"is",
"freed",
"up",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/BoundedBuffer.java#L466-L505 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaActivationSpecImpl.java | JmsJcaActivationSpecImpl.setTarget | @Override
public void setTarget(String target) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "setTarget", target);
}
_target = target;
} | java | @Override
public void setTarget(String target) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "setTarget", target);
}
_target = target;
} | [
"@",
"Override",
"public",
"void",
"setTarget",
"(",
"String",
"target",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"TRACE",
",",
"\"setTarget\"",
",",
"target",
")",
";",
"}",
"_target",
"=",
"target",
";",
"}"
] | Set the target property.
@param target | [
"Set",
"the",
"target",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaActivationSpecImpl.java#L891-L899 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaActivationSpecImpl.java | JmsJcaActivationSpecImpl.setTargetType | @Override
public void setTargetType(String targetType) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "setTargetType", targetType);
}
_targetType = targetType;
} | java | @Override
public void setTargetType(String targetType) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "setTargetType", targetType);
}
_targetType = targetType;
} | [
"@",
"Override",
"public",
"void",
"setTargetType",
"(",
"String",
"targetType",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"TRACE",
",",
"\"setTargetType\"",
",",
"targetType",
")",
";",
"}",
"_targetType",
"=",
"targetType",
";",
"}"
] | Set the target type property.
@param targetType | [
"Set",
"the",
"target",
"type",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaActivationSpecImpl.java#L918-L926 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaActivationSpecImpl.java | JmsJcaActivationSpecImpl.setMaxSequentialMessageFailure | @Override
public void setMaxSequentialMessageFailure(final String maxSequentialMessageFailure)
{
_maxSequentialMessageFailure = (maxSequentialMessageFailure == null ? null : Integer.valueOf(maxSequentialMessageFailure));
} | java | @Override
public void setMaxSequentialMessageFailure(final String maxSequentialMessageFailure)
{
_maxSequentialMessageFailure = (maxSequentialMessageFailure == null ? null : Integer.valueOf(maxSequentialMessageFailure));
} | [
"@",
"Override",
"public",
"void",
"setMaxSequentialMessageFailure",
"(",
"final",
"String",
"maxSequentialMessageFailure",
")",
"{",
"_maxSequentialMessageFailure",
"=",
"(",
"maxSequentialMessageFailure",
"==",
"null",
"?",
"null",
":",
"Integer",
".",
"valueOf",
"(",
"maxSequentialMessageFailure",
")",
")",
";",
"}"
] | Set the MaxSequentialMessageFailure property
@param maxSequentialMessageFailure The maximum number of failed messages | [
"Set",
"the",
"MaxSequentialMessageFailure",
"property"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaActivationSpecImpl.java#L1051-L1055 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaActivationSpecImpl.java | JmsJcaActivationSpecImpl.setAutoStopSequentialMessageFailure | @Override
public void setAutoStopSequentialMessageFailure(final String autoStopSequentialMessageFailure)
{
_autoStopSequentialMessageFailure = (autoStopSequentialMessageFailure == null ? null : Integer.valueOf(autoStopSequentialMessageFailure));
} | java | @Override
public void setAutoStopSequentialMessageFailure(final String autoStopSequentialMessageFailure)
{
_autoStopSequentialMessageFailure = (autoStopSequentialMessageFailure == null ? null : Integer.valueOf(autoStopSequentialMessageFailure));
} | [
"@",
"Override",
"public",
"void",
"setAutoStopSequentialMessageFailure",
"(",
"final",
"String",
"autoStopSequentialMessageFailure",
")",
"{",
"_autoStopSequentialMessageFailure",
"=",
"(",
"autoStopSequentialMessageFailure",
"==",
"null",
"?",
"null",
":",
"Integer",
".",
"valueOf",
"(",
"autoStopSequentialMessageFailure",
")",
")",
";",
"}"
] | Set the AutoStopSequentialMessageFailure property
@param autoStopSequentialMessageFailure The maximum number of failed messages before stopping the MDB | [
"Set",
"the",
"AutoStopSequentialMessageFailure",
"property"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaActivationSpecImpl.java#L1082-L1086 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/ltc/impl/LTCUOWCallback.java | LTCUOWCallback.createUserTransactionCallback | public static UOWScopeCallback createUserTransactionCallback() {
if (tc.isEntryEnabled())
Tr.entry(tc, "createUserTransactionCallback");
if (userTranCallback == null) {
userTranCallback = new LTCUOWCallback(UOW_TYPE_TRANSACTION);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "createUserTransactionCallback", userTranCallback);
return userTranCallback;
} | java | public static UOWScopeCallback createUserTransactionCallback() {
if (tc.isEntryEnabled())
Tr.entry(tc, "createUserTransactionCallback");
if (userTranCallback == null) {
userTranCallback = new LTCUOWCallback(UOW_TYPE_TRANSACTION);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "createUserTransactionCallback", userTranCallback);
return userTranCallback;
} | [
"public",
"static",
"UOWScopeCallback",
"createUserTransactionCallback",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"createUserTransactionCallback\"",
")",
";",
"if",
"(",
"userTranCallback",
"==",
"null",
")",
"{",
"userTranCallback",
"=",
"new",
"LTCUOWCallback",
"(",
"UOW_TYPE_TRANSACTION",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"createUserTransactionCallback\"",
",",
"userTranCallback",
")",
";",
"return",
"userTranCallback",
";",
"}"
] | may be different in derived classes | [
"may",
"be",
"different",
"in",
"derived",
"classes"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/ltc/impl/LTCUOWCallback.java#L41-L52 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/x509/X509Name.java | X509Name.getInstance | public static X509Name getInstance(
ASN1TaggedObject obj,
boolean explicit)
{
return getInstance(ASN1Sequence.getInstance(obj, explicit));
} | java | public static X509Name getInstance(
ASN1TaggedObject obj,
boolean explicit)
{
return getInstance(ASN1Sequence.getInstance(obj, explicit));
} | [
"public",
"static",
"X509Name",
"getInstance",
"(",
"ASN1TaggedObject",
"obj",
",",
"boolean",
"explicit",
")",
"{",
"return",
"getInstance",
"(",
"ASN1Sequence",
".",
"getInstance",
"(",
"obj",
",",
"explicit",
")",
")",
";",
"}"
] | Return a X509Name based on the passed in tagged object.
@param obj tag object holding name.
@param explicit true if explicitly tagged false otherwise.
@return the X509Name | [
"Return",
"a",
"X509Name",
"based",
"on",
"the",
"passed",
"in",
"tagged",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/x509/X509Name.java#L228-L233 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/x509/X509Name.java | X509Name.getOIDs | public Vector getOIDs()
{
Vector v = new Vector();
for (int i = 0; i != ordering.size(); i++)
{
v.addElement(ordering.elementAt(i));
}
return v;
} | java | public Vector getOIDs()
{
Vector v = new Vector();
for (int i = 0; i != ordering.size(); i++)
{
v.addElement(ordering.elementAt(i));
}
return v;
} | [
"public",
"Vector",
"getOIDs",
"(",
")",
"{",
"Vector",
"v",
"=",
"new",
"Vector",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"ordering",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"v",
".",
"addElement",
"(",
"ordering",
".",
"elementAt",
"(",
"i",
")",
")",
";",
"}",
"return",
"v",
";",
"}"
] | return a vector of the oids in the name, in the order they were found. | [
"return",
"a",
"vector",
"of",
"the",
"oids",
"in",
"the",
"name",
"in",
"the",
"order",
"they",
"were",
"found",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/x509/X509Name.java#L577-L587 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/x509/X509Name.java | X509Name.getValues | public Vector getValues()
{
Vector v = new Vector();
for (int i = 0; i != values.size(); i++)
{
v.addElement(values.elementAt(i));
}
return v;
} | java | public Vector getValues()
{
Vector v = new Vector();
for (int i = 0; i != values.size(); i++)
{
v.addElement(values.elementAt(i));
}
return v;
} | [
"public",
"Vector",
"getValues",
"(",
")",
"{",
"Vector",
"v",
"=",
"new",
"Vector",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"values",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"v",
".",
"addElement",
"(",
"values",
".",
"elementAt",
"(",
"i",
")",
")",
";",
"}",
"return",
"v",
";",
"}"
] | return a vector of the values found in the name, in the order they
were found. | [
"return",
"a",
"vector",
"of",
"the",
"values",
"found",
"in",
"the",
"name",
"in",
"the",
"order",
"they",
"were",
"found",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/x509/X509Name.java#L593-L603 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/ConfigID.java | ConfigID.fromProperty | public static ConfigID fromProperty(String property) {
//TODO Perhaps there is a clever regex that could handle this
String[] parents = property.split("//");
ConfigID id = null;
for (String parentString : parents) {
id = constructId(id, parentString);
}
return id;
} | java | public static ConfigID fromProperty(String property) {
//TODO Perhaps there is a clever regex that could handle this
String[] parents = property.split("//");
ConfigID id = null;
for (String parentString : parents) {
id = constructId(id, parentString);
}
return id;
} | [
"public",
"static",
"ConfigID",
"fromProperty",
"(",
"String",
"property",
")",
"{",
"//TODO Perhaps there is a clever regex that could handle this",
"String",
"[",
"]",
"parents",
"=",
"property",
".",
"split",
"(",
"\"//\"",
")",
";",
"ConfigID",
"id",
"=",
"null",
";",
"for",
"(",
"String",
"parentString",
":",
"parents",
")",
"{",
"id",
"=",
"constructId",
"(",
"id",
",",
"parentString",
")",
";",
"}",
"return",
"id",
";",
"}"
] | Translate config.id back into an ConfigID object
@param property
@return | [
"Translate",
"config",
".",
"id",
"back",
"into",
"an",
"ConfigID",
"object"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/ConfigID.java#L68-L78 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ClientConnectionManagerImpl.java | ClientConnectionManagerImpl.connect | @Override
public Conversation connect(InetSocketAddress remoteHost,
ConversationReceiveListener arl,
String chainName)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "connect", new Object[] { remoteHost, arl, chainName });
if (initialisationFailed)
{
String nlsMsg = nls.getFormattedMessage("EXCP_CONN_FAIL_NO_CF_SICJ0007", null, null);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "connection failed because comms failed to initialise");
throw new SIResourceException(nlsMsg);
}
Conversation conversation = tracker.connect(remoteHost, arl, chainName, Conversation.CLIENT);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "connect", conversation);
return conversation;
} | java | @Override
public Conversation connect(InetSocketAddress remoteHost,
ConversationReceiveListener arl,
String chainName)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "connect", new Object[] { remoteHost, arl, chainName });
if (initialisationFailed)
{
String nlsMsg = nls.getFormattedMessage("EXCP_CONN_FAIL_NO_CF_SICJ0007", null, null);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "connection failed because comms failed to initialise");
throw new SIResourceException(nlsMsg);
}
Conversation conversation = tracker.connect(remoteHost, arl, chainName, Conversation.CLIENT);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "connect", conversation);
return conversation;
} | [
"@",
"Override",
"public",
"Conversation",
"connect",
"(",
"InetSocketAddress",
"remoteHost",
",",
"ConversationReceiveListener",
"arl",
",",
"String",
"chainName",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"connect\"",
",",
"new",
"Object",
"[",
"]",
"{",
"remoteHost",
",",
"arl",
",",
"chainName",
"}",
")",
";",
"if",
"(",
"initialisationFailed",
")",
"{",
"String",
"nlsMsg",
"=",
"nls",
".",
"getFormattedMessage",
"(",
"\"EXCP_CONN_FAIL_NO_CF_SICJ0007\"",
",",
"null",
",",
"null",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"connection failed because comms failed to initialise\"",
")",
";",
"throw",
"new",
"SIResourceException",
"(",
"nlsMsg",
")",
";",
"}",
"Conversation",
"conversation",
"=",
"tracker",
".",
"connect",
"(",
"remoteHost",
",",
"arl",
",",
"chainName",
",",
"Conversation",
".",
"CLIENT",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"connect\"",
",",
"conversation",
")",
";",
"return",
"conversation",
";",
"}"
] | Implementation of the connect method provided by our abstract parent. Attempts to establish a
conversation to the specified remote host using the appropriate chain. This may involve
creating a new connection or reusing an existing one. The harder part is doing this in such a
way as to avoid blocking all calls while processing a single new outbound connection attempt.
@param remoteHost
@param arl
@return Connection | [
"Implementation",
"of",
"the",
"connect",
"method",
"provided",
"by",
"our",
"abstract",
"parent",
".",
"Attempts",
"to",
"establish",
"a",
"conversation",
"to",
"the",
"specified",
"remote",
"host",
"using",
"the",
"appropriate",
"chain",
".",
"This",
"may",
"involve",
"creating",
"a",
"new",
"connection",
"or",
"reusing",
"an",
"existing",
"one",
".",
"The",
"harder",
"part",
"is",
"doing",
"this",
"in",
"such",
"a",
"way",
"as",
"to",
"avoid",
"blocking",
"all",
"calls",
"while",
"processing",
"a",
"single",
"new",
"outbound",
"connection",
"attempt",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ClientConnectionManagerImpl.java#L78-L100 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ClientConnectionManagerImpl.java | ClientConnectionManagerImpl.initialise | public static void initialise() throws SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initialise");
initialisationFailed = true;
Framework framework = Framework.getInstance();
if (framework != null)
{
tracker = new OutboundConnectionTracker(framework);
initialisationFailed = false;
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "initialisation failed");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialise");
} | java | public static void initialise() throws SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initialise");
initialisationFailed = true;
Framework framework = Framework.getInstance();
if (framework != null)
{
tracker = new OutboundConnectionTracker(framework);
initialisationFailed = false;
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "initialisation failed");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialise");
} | [
"public",
"static",
"void",
"initialise",
"(",
")",
"throws",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"initialise\"",
")",
";",
"initialisationFailed",
"=",
"true",
";",
"Framework",
"framework",
"=",
"Framework",
".",
"getInstance",
"(",
")",
";",
"if",
"(",
"framework",
"!=",
"null",
")",
"{",
"tracker",
"=",
"new",
"OutboundConnectionTracker",
"(",
"framework",
")",
";",
"initialisationFailed",
"=",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"initialisation failed\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"initialise\"",
")",
";",
"}"
] | Initialises the Client Connection Manager.
@see com.ibm.ws.sib.jfapchannel.ClientConnectionManager#initialise() | [
"Initialises",
"the",
"Client",
"Connection",
"Manager",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ClientConnectionManagerImpl.java#L166-L188 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/session/internal/SessionImpl.java | SessionImpl.destroy | private void destroy() {
final boolean bTrace = TraceComponent.isAnyTracingEnabled();
if (bTrace && tc.isEventEnabled()) {
Tr.event(tc, "Session being destroyed; " + this);
}
// List<HttpSessionListener> list = this.myConfig.getSessionListeners();
// if (null != list) {
// HttpSessionEvent event = new HttpSessionEvent(this);
// for (HttpSessionListener listener : list) {
// if (bTrace && tc.isDebugEnabled()) {
// Tr.debug(tc, "Notifying listener of destroy; " + listener);
// }
// listener.sessionDestroyed(event);
// }
// }
for (String key : this.attributes.keySet()) {
Object value = this.attributes.get(key);
HttpSessionBindingEvent event = new HttpSessionBindingEvent(this, key);
if (value instanceof HttpSessionBindingListener) {
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Notifying attribute of removal: " + value);
}
((HttpSessionBindingListener) value).valueUnbound(event);
}
}
this.attributes.clear();
this.myContext = null;
} | java | private void destroy() {
final boolean bTrace = TraceComponent.isAnyTracingEnabled();
if (bTrace && tc.isEventEnabled()) {
Tr.event(tc, "Session being destroyed; " + this);
}
// List<HttpSessionListener> list = this.myConfig.getSessionListeners();
// if (null != list) {
// HttpSessionEvent event = new HttpSessionEvent(this);
// for (HttpSessionListener listener : list) {
// if (bTrace && tc.isDebugEnabled()) {
// Tr.debug(tc, "Notifying listener of destroy; " + listener);
// }
// listener.sessionDestroyed(event);
// }
// }
for (String key : this.attributes.keySet()) {
Object value = this.attributes.get(key);
HttpSessionBindingEvent event = new HttpSessionBindingEvent(this, key);
if (value instanceof HttpSessionBindingListener) {
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Notifying attribute of removal: " + value);
}
((HttpSessionBindingListener) value).valueUnbound(event);
}
}
this.attributes.clear();
this.myContext = null;
} | [
"private",
"void",
"destroy",
"(",
")",
"{",
"final",
"boolean",
"bTrace",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"bTrace",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Session being destroyed; \"",
"+",
"this",
")",
";",
"}",
"// List<HttpSessionListener> list = this.myConfig.getSessionListeners();",
"// if (null != list) {",
"// HttpSessionEvent event = new HttpSessionEvent(this);",
"// for (HttpSessionListener listener : list) {",
"// if (bTrace && tc.isDebugEnabled()) {",
"// Tr.debug(tc, \"Notifying listener of destroy; \" + listener);",
"// }",
"// listener.sessionDestroyed(event);",
"// }",
"// }",
"for",
"(",
"String",
"key",
":",
"this",
".",
"attributes",
".",
"keySet",
"(",
")",
")",
"{",
"Object",
"value",
"=",
"this",
".",
"attributes",
".",
"get",
"(",
"key",
")",
";",
"HttpSessionBindingEvent",
"event",
"=",
"new",
"HttpSessionBindingEvent",
"(",
"this",
",",
"key",
")",
";",
"if",
"(",
"value",
"instanceof",
"HttpSessionBindingListener",
")",
"{",
"if",
"(",
"bTrace",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Notifying attribute of removal: \"",
"+",
"value",
")",
";",
"}",
"(",
"(",
"HttpSessionBindingListener",
")",
"value",
")",
".",
"valueUnbound",
"(",
"event",
")",
";",
"}",
"}",
"this",
".",
"attributes",
".",
"clear",
"(",
")",
";",
"this",
".",
"myContext",
"=",
"null",
";",
"}"
] | Once a session has been invalidated, this will perform final cleanup
and notifying any listeners. | [
"Once",
"a",
"session",
"has",
"been",
"invalidated",
"this",
"will",
"perform",
"final",
"cleanup",
"and",
"notifying",
"any",
"listeners",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/session/internal/SessionImpl.java#L82-L109 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ThreadContextClassLoader.java | ThreadContextClassLoader.cleanup | private void cleanup() {
final String methodName = "cleanup(): ";
try {
final Bundle b = bundle.getAndSet(null);
if (b != null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + "Uninstalling bundle location: " + b.getLocation() + ", bundle id: " + b.getBundleId());
}
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
try {
b.uninstall();
return null;
} catch (BundleException ignored) {
return null;
}
}
});
} else {
b.uninstall();
}
}
} catch (BundleException ignored) {
} catch (IllegalStateException ignored) {
}
} | java | private void cleanup() {
final String methodName = "cleanup(): ";
try {
final Bundle b = bundle.getAndSet(null);
if (b != null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + "Uninstalling bundle location: " + b.getLocation() + ", bundle id: " + b.getBundleId());
}
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
try {
b.uninstall();
return null;
} catch (BundleException ignored) {
return null;
}
}
});
} else {
b.uninstall();
}
}
} catch (BundleException ignored) {
} catch (IllegalStateException ignored) {
}
} | [
"private",
"void",
"cleanup",
"(",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"cleanup(): \"",
";",
"try",
"{",
"final",
"Bundle",
"b",
"=",
"bundle",
".",
"getAndSet",
"(",
"null",
")",
";",
"if",
"(",
"b",
"!=",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"methodName",
"+",
"\"Uninstalling bundle location: \"",
"+",
"b",
".",
"getLocation",
"(",
")",
"+",
"\", bundle id: \"",
"+",
"b",
".",
"getBundleId",
"(",
")",
")",
";",
"}",
"SecurityManager",
"sm",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"sm",
"!=",
"null",
")",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"run",
"(",
")",
"{",
"try",
"{",
"b",
".",
"uninstall",
"(",
")",
";",
"return",
"null",
";",
"}",
"catch",
"(",
"BundleException",
"ignored",
")",
"{",
"return",
"null",
";",
"}",
"}",
"}",
")",
";",
"}",
"else",
"{",
"b",
".",
"uninstall",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"BundleException",
"ignored",
")",
"{",
"}",
"catch",
"(",
"IllegalStateException",
"ignored",
")",
"{",
"}",
"}"
] | Cleans up the TCCL instance. Once called, this TCCL is effectively disabled.
It's associated gateway bundle will have been removed. | [
"Cleans",
"up",
"the",
"TCCL",
"instance",
".",
"Once",
"called",
"this",
"TCCL",
"is",
"effectively",
"disabled",
".",
"It",
"s",
"associated",
"gateway",
"bundle",
"will",
"have",
"been",
"removed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ThreadContextClassLoader.java#L59-L88 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ThreadContextClassLoader.java | ThreadContextClassLoader.decrementRefCount | int decrementRefCount() {
final String methodName = "decrementRefCount(): ";
final int count = refCount.decrementAndGet();
if (count < 0) {
// more destroys than creates
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " refCount < 0 - too many calls to destroy/cleaup", new Throwable("stack trace"));
}
}
if (count == 0) {
cleanup();
}
return count;
} | java | int decrementRefCount() {
final String methodName = "decrementRefCount(): ";
final int count = refCount.decrementAndGet();
if (count < 0) {
// more destroys than creates
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " refCount < 0 - too many calls to destroy/cleaup", new Throwable("stack trace"));
}
}
if (count == 0) {
cleanup();
}
return count;
} | [
"int",
"decrementRefCount",
"(",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"decrementRefCount(): \"",
";",
"final",
"int",
"count",
"=",
"refCount",
".",
"decrementAndGet",
"(",
")",
";",
"if",
"(",
"count",
"<",
"0",
")",
"{",
"// more destroys than creates",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"methodName",
"+",
"\" refCount < 0 - too many calls to destroy/cleaup\"",
",",
"new",
"Throwable",
"(",
"\"stack trace\"",
")",
")",
";",
"}",
"}",
"if",
"(",
"count",
"==",
"0",
")",
"{",
"cleanup",
"(",
")",
";",
"}",
"return",
"count",
";",
"}"
] | The ClassLoadingService implementation should call this method when it's
destroyThreadContextClassLoader method is called. Each call to destroyTCCL
should decrement this ref counter. When there are no more references to this
TCCL, it will be cleaned up, which effectively invalidates it.
Users of the ClassLoadingService should understand that:<ol>
<li>They are responsible for destroying every instance of a TCCL that they
create via the CLS.createTCCL method, and,
<li>If they still have references to the TCCL instance after destroying all
instances they created, they will be holding on to a stale (leaked) classloader,
which can result in OOM situations.</li>
</ol>
@return the new current count of references to this TCCL instance | [
"The",
"ClassLoadingService",
"implementation",
"should",
"call",
"this",
"method",
"when",
"it",
"s",
"destroyThreadContextClassLoader",
"method",
"is",
"called",
".",
"Each",
"call",
"to",
"destroyTCCL",
"should",
"decrement",
"this",
"ref",
"counter",
".",
"When",
"there",
"are",
"no",
"more",
"references",
"to",
"this",
"TCCL",
"it",
"will",
"be",
"cleaned",
"up",
"which",
"effectively",
"invalidates",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ThreadContextClassLoader.java#L106-L119 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAPCtxtInjectionBinding.java | JPAPCtxtInjectionBinding.newPersistenceContext | private static PersistenceContext newPersistenceContext(final String fJndiName, final String fUnitName, final int fCtxType,
final List<Property> fCtxProperties) {
return new PersistenceContext() {
@Override
public Class<? extends Annotation> annotationType() {
return PersistenceContext.class;
}
@Override
public String name() {
return fJndiName;
}
@Override
public PersistenceProperty[] properties() {
//TODO not ideal doing this conversion processing here
PersistenceProperty[] props = new PersistenceProperty[fCtxProperties.size()];
int i = 0;
for (Property property : fCtxProperties) {
final String name = property.getName();
final String value = property.getValue();
PersistenceProperty prop = new PersistenceProperty() {
@Override
public Class<? extends Annotation> annotationType() {
return PersistenceProperty.class;
}
@Override
public String name() {
return name;
}
@Override
public String value() {
return value;
}
};
props[i++] = prop;
}
return props;
}
@Override
public PersistenceContextType type() {
if (fCtxType == PersistenceContextRef.TYPE_TRANSACTION) {
return PersistenceContextType.TRANSACTION;
} else {
return PersistenceContextType.EXTENDED;
}
}
@Override
public String unitName() {
return fUnitName;
}
@Override
public String toString() {
return "JPA.PersistenceContext(name=" + fJndiName +
", unitName=" + fUnitName + ")";
}
};
} | java | private static PersistenceContext newPersistenceContext(final String fJndiName, final String fUnitName, final int fCtxType,
final List<Property> fCtxProperties) {
return new PersistenceContext() {
@Override
public Class<? extends Annotation> annotationType() {
return PersistenceContext.class;
}
@Override
public String name() {
return fJndiName;
}
@Override
public PersistenceProperty[] properties() {
//TODO not ideal doing this conversion processing here
PersistenceProperty[] props = new PersistenceProperty[fCtxProperties.size()];
int i = 0;
for (Property property : fCtxProperties) {
final String name = property.getName();
final String value = property.getValue();
PersistenceProperty prop = new PersistenceProperty() {
@Override
public Class<? extends Annotation> annotationType() {
return PersistenceProperty.class;
}
@Override
public String name() {
return name;
}
@Override
public String value() {
return value;
}
};
props[i++] = prop;
}
return props;
}
@Override
public PersistenceContextType type() {
if (fCtxType == PersistenceContextRef.TYPE_TRANSACTION) {
return PersistenceContextType.TRANSACTION;
} else {
return PersistenceContextType.EXTENDED;
}
}
@Override
public String unitName() {
return fUnitName;
}
@Override
public String toString() {
return "JPA.PersistenceContext(name=" + fJndiName +
", unitName=" + fUnitName + ")";
}
};
} | [
"private",
"static",
"PersistenceContext",
"newPersistenceContext",
"(",
"final",
"String",
"fJndiName",
",",
"final",
"String",
"fUnitName",
",",
"final",
"int",
"fCtxType",
",",
"final",
"List",
"<",
"Property",
">",
"fCtxProperties",
")",
"{",
"return",
"new",
"PersistenceContext",
"(",
")",
"{",
"@",
"Override",
"public",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
"(",
")",
"{",
"return",
"PersistenceContext",
".",
"class",
";",
"}",
"@",
"Override",
"public",
"String",
"name",
"(",
")",
"{",
"return",
"fJndiName",
";",
"}",
"@",
"Override",
"public",
"PersistenceProperty",
"[",
"]",
"properties",
"(",
")",
"{",
"//TODO not ideal doing this conversion processing here",
"PersistenceProperty",
"[",
"]",
"props",
"=",
"new",
"PersistenceProperty",
"[",
"fCtxProperties",
".",
"size",
"(",
")",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"Property",
"property",
":",
"fCtxProperties",
")",
"{",
"final",
"String",
"name",
"=",
"property",
".",
"getName",
"(",
")",
";",
"final",
"String",
"value",
"=",
"property",
".",
"getValue",
"(",
")",
";",
"PersistenceProperty",
"prop",
"=",
"new",
"PersistenceProperty",
"(",
")",
"{",
"@",
"Override",
"public",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
"(",
")",
"{",
"return",
"PersistenceProperty",
".",
"class",
";",
"}",
"@",
"Override",
"public",
"String",
"name",
"(",
")",
"{",
"return",
"name",
";",
"}",
"@",
"Override",
"public",
"String",
"value",
"(",
")",
"{",
"return",
"value",
";",
"}",
"}",
";",
"props",
"[",
"i",
"++",
"]",
"=",
"prop",
";",
"}",
"return",
"props",
";",
"}",
"@",
"Override",
"public",
"PersistenceContextType",
"type",
"(",
")",
"{",
"if",
"(",
"fCtxType",
"==",
"PersistenceContextRef",
".",
"TYPE_TRANSACTION",
")",
"{",
"return",
"PersistenceContextType",
".",
"TRANSACTION",
";",
"}",
"else",
"{",
"return",
"PersistenceContextType",
".",
"EXTENDED",
";",
"}",
"}",
"@",
"Override",
"public",
"String",
"unitName",
"(",
")",
"{",
"return",
"fUnitName",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"JPA.PersistenceContext(name=\"",
"+",
"fJndiName",
"+",
"\", unitName=\"",
"+",
"fUnitName",
"+",
"\")\"",
";",
"}",
"}",
";",
"}"
] | This transient PersistenceContext annotation class has no default value.
i.e. null is a valid value for some fields. | [
"This",
"transient",
"PersistenceContext",
"annotation",
"class",
"has",
"no",
"default",
"value",
".",
"i",
".",
"e",
".",
"null",
"is",
"a",
"valid",
"value",
"for",
"some",
"fields",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAPCtxtInjectionBinding.java#L450-L515 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProxyReceiveListener.java | ProxyReceiveListener.processConnectionInfo | private void processConnectionInfo(CommsByteBuffer buffer, Conversation conversation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "processConnectionInfo",
new Object[]{buffer, conversation});
ClientConversationState convState = (ClientConversationState) conversation.getAttachment();
short connectionObjectId = buffer.getShort(); // BIT16 ConnectionObjectID
String meName = buffer.getString(); // STR MEName
// Set the connection object ID in the conversation state
convState.setConnectionObjectID(connectionObjectId);
// Create the connection proxy and save it away in the conversation state
final ConnectionProxy connectionProxy;
// The type of connection proxy we create is dependent on FAP version. Fap version 5 supports
// a connection which MSSIXAResourceProvider. This is done so that PEV (introduced in line with
// FAP 5) can perform remote recovery of resources.
if (conversation.getHandshakeProperties().getFapLevel() >= JFapChannelConstants.FAP_VERSION_5)
{
connectionProxy = new MSSIXAResourceProvidingConnectionProxy(conversation);
}
else
{
connectionProxy = new ConnectionProxy(conversation);
}
convState.setSICoreConnection(connectionProxy);
// Set in the ME name
connectionProxy.setMeName(meName);
// Now get the unique Id if there was one, and set it in the connection proxy
short idLength = buffer.getShort();
if (idLength != 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Got unique id of length:", idLength);
byte[] uniqueId = buffer.get(idLength);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.bytes(tc, uniqueId);
connectionProxy.setInitialUniqueId(uniqueId);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "No unique Id was returned");
}
// Get the ME Uuid
String meUuid = buffer.getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "ME Uuid: ", meUuid);
connectionProxy.setMeUuid(meUuid);
// Get the resolved User Id
String resolvedUserId = buffer.getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Resolved UserId: ", resolvedUserId);
connectionProxy.setResolvedUserId(resolvedUserId);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "processConnectionInfo");
} | java | private void processConnectionInfo(CommsByteBuffer buffer, Conversation conversation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "processConnectionInfo",
new Object[]{buffer, conversation});
ClientConversationState convState = (ClientConversationState) conversation.getAttachment();
short connectionObjectId = buffer.getShort(); // BIT16 ConnectionObjectID
String meName = buffer.getString(); // STR MEName
// Set the connection object ID in the conversation state
convState.setConnectionObjectID(connectionObjectId);
// Create the connection proxy and save it away in the conversation state
final ConnectionProxy connectionProxy;
// The type of connection proxy we create is dependent on FAP version. Fap version 5 supports
// a connection which MSSIXAResourceProvider. This is done so that PEV (introduced in line with
// FAP 5) can perform remote recovery of resources.
if (conversation.getHandshakeProperties().getFapLevel() >= JFapChannelConstants.FAP_VERSION_5)
{
connectionProxy = new MSSIXAResourceProvidingConnectionProxy(conversation);
}
else
{
connectionProxy = new ConnectionProxy(conversation);
}
convState.setSICoreConnection(connectionProxy);
// Set in the ME name
connectionProxy.setMeName(meName);
// Now get the unique Id if there was one, and set it in the connection proxy
short idLength = buffer.getShort();
if (idLength != 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Got unique id of length:", idLength);
byte[] uniqueId = buffer.get(idLength);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.bytes(tc, uniqueId);
connectionProxy.setInitialUniqueId(uniqueId);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "No unique Id was returned");
}
// Get the ME Uuid
String meUuid = buffer.getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "ME Uuid: ", meUuid);
connectionProxy.setMeUuid(meUuid);
// Get the resolved User Id
String resolvedUserId = buffer.getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Resolved UserId: ", resolvedUserId);
connectionProxy.setResolvedUserId(resolvedUserId);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "processConnectionInfo");
} | [
"private",
"void",
"processConnectionInfo",
"(",
"CommsByteBuffer",
"buffer",
",",
"Conversation",
"conversation",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"processConnectionInfo\"",
",",
"new",
"Object",
"[",
"]",
"{",
"buffer",
",",
"conversation",
"}",
")",
";",
"ClientConversationState",
"convState",
"=",
"(",
"ClientConversationState",
")",
"conversation",
".",
"getAttachment",
"(",
")",
";",
"short",
"connectionObjectId",
"=",
"buffer",
".",
"getShort",
"(",
")",
";",
"// BIT16 ConnectionObjectID",
"String",
"meName",
"=",
"buffer",
".",
"getString",
"(",
")",
";",
"// STR MEName",
"// Set the connection object ID in the conversation state",
"convState",
".",
"setConnectionObjectID",
"(",
"connectionObjectId",
")",
";",
"// Create the connection proxy and save it away in the conversation state",
"final",
"ConnectionProxy",
"connectionProxy",
";",
"// The type of connection proxy we create is dependent on FAP version. Fap version 5 supports",
"// a connection which MSSIXAResourceProvider. This is done so that PEV (introduced in line with",
"// FAP 5) can perform remote recovery of resources.",
"if",
"(",
"conversation",
".",
"getHandshakeProperties",
"(",
")",
".",
"getFapLevel",
"(",
")",
">=",
"JFapChannelConstants",
".",
"FAP_VERSION_5",
")",
"{",
"connectionProxy",
"=",
"new",
"MSSIXAResourceProvidingConnectionProxy",
"(",
"conversation",
")",
";",
"}",
"else",
"{",
"connectionProxy",
"=",
"new",
"ConnectionProxy",
"(",
"conversation",
")",
";",
"}",
"convState",
".",
"setSICoreConnection",
"(",
"connectionProxy",
")",
";",
"// Set in the ME name",
"connectionProxy",
".",
"setMeName",
"(",
"meName",
")",
";",
"// Now get the unique Id if there was one, and set it in the connection proxy",
"short",
"idLength",
"=",
"buffer",
".",
"getShort",
"(",
")",
";",
"if",
"(",
"idLength",
"!=",
"0",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Got unique id of length:\"",
",",
"idLength",
")",
";",
"byte",
"[",
"]",
"uniqueId",
"=",
"buffer",
".",
"get",
"(",
"idLength",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"bytes",
"(",
"tc",
",",
"uniqueId",
")",
";",
"connectionProxy",
".",
"setInitialUniqueId",
"(",
"uniqueId",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"No unique Id was returned\"",
")",
";",
"}",
"// Get the ME Uuid",
"String",
"meUuid",
"=",
"buffer",
".",
"getString",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"ME Uuid: \"",
",",
"meUuid",
")",
";",
"connectionProxy",
".",
"setMeUuid",
"(",
"meUuid",
")",
";",
"// Get the resolved User Id",
"String",
"resolvedUserId",
"=",
"buffer",
".",
"getString",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Resolved UserId: \"",
",",
"resolvedUserId",
")",
";",
"connectionProxy",
".",
"setResolvedUserId",
"(",
"resolvedUserId",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"processConnectionInfo\"",
")",
";",
"}"
] | This method will process the connection information received from our peer.
At the moment this consists of the connection object ID required at the server,
the name of the messaging engine and the ME Uuid.
@param buffer
@param conversation | [
"This",
"method",
"will",
"process",
"the",
"connection",
"information",
"received",
"from",
"our",
"peer",
".",
"At",
"the",
"moment",
"this",
"consists",
"of",
"the",
"connection",
"object",
"ID",
"required",
"at",
"the",
"server",
"the",
"name",
"of",
"the",
"messaging",
"engine",
"and",
"the",
"ME",
"Uuid",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProxyReceiveListener.java#L526-L587 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProxyReceiveListener.java | ProxyReceiveListener.processSchema | private void processSchema(CommsByteBuffer buffer, Conversation conversation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "processSchema",
new Object[]
{
buffer,
conversation
});
ClientConversationState convState = (ClientConversationState) conversation.getAttachment();
byte[] mfpDataAsBytes = buffer.getRemaining();
// Get hold of the CommsConnection associated with this conversation
CommsConnection cc = convState.getCommsConnection();
// Get hold of MFP Singleton and pass it the schema
try
{
// Get hold of product version
final HandshakeProperties handshakeGroup = conversation.getHandshakeProperties();
final int productVersion = handshakeGroup.getMajorVersion();
// Get hold of MFP and inform it of the schema
CompHandshake ch = (CompHandshake) CompHandshakeFactory.getInstance();
ch.compData(cc,productVersion,mfpDataAsBytes);
}
catch (Exception e1)
{
FFDCFilter.processException(e1, CLASS_NAME + ".processSchema",
CommsConstants.PROXYRECEIVELISTENER_PROCESSSCHEMA_01, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "MFP unable to create CompHandshake Singleton", e1);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "processSchema");
} | java | private void processSchema(CommsByteBuffer buffer, Conversation conversation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "processSchema",
new Object[]
{
buffer,
conversation
});
ClientConversationState convState = (ClientConversationState) conversation.getAttachment();
byte[] mfpDataAsBytes = buffer.getRemaining();
// Get hold of the CommsConnection associated with this conversation
CommsConnection cc = convState.getCommsConnection();
// Get hold of MFP Singleton and pass it the schema
try
{
// Get hold of product version
final HandshakeProperties handshakeGroup = conversation.getHandshakeProperties();
final int productVersion = handshakeGroup.getMajorVersion();
// Get hold of MFP and inform it of the schema
CompHandshake ch = (CompHandshake) CompHandshakeFactory.getInstance();
ch.compData(cc,productVersion,mfpDataAsBytes);
}
catch (Exception e1)
{
FFDCFilter.processException(e1, CLASS_NAME + ".processSchema",
CommsConstants.PROXYRECEIVELISTENER_PROCESSSCHEMA_01, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "MFP unable to create CompHandshake Singleton", e1);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "processSchema");
} | [
"private",
"void",
"processSchema",
"(",
"CommsByteBuffer",
"buffer",
",",
"Conversation",
"conversation",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"processSchema\"",
",",
"new",
"Object",
"[",
"]",
"{",
"buffer",
",",
"conversation",
"}",
")",
";",
"ClientConversationState",
"convState",
"=",
"(",
"ClientConversationState",
")",
"conversation",
".",
"getAttachment",
"(",
")",
";",
"byte",
"[",
"]",
"mfpDataAsBytes",
"=",
"buffer",
".",
"getRemaining",
"(",
")",
";",
"// Get hold of the CommsConnection associated with this conversation",
"CommsConnection",
"cc",
"=",
"convState",
".",
"getCommsConnection",
"(",
")",
";",
"// Get hold of MFP Singleton and pass it the schema",
"try",
"{",
"// Get hold of product version",
"final",
"HandshakeProperties",
"handshakeGroup",
"=",
"conversation",
".",
"getHandshakeProperties",
"(",
")",
";",
"final",
"int",
"productVersion",
"=",
"handshakeGroup",
".",
"getMajorVersion",
"(",
")",
";",
"// Get hold of MFP and inform it of the schema",
"CompHandshake",
"ch",
"=",
"(",
"CompHandshake",
")",
"CompHandshakeFactory",
".",
"getInstance",
"(",
")",
";",
"ch",
".",
"compData",
"(",
"cc",
",",
"productVersion",
",",
"mfpDataAsBytes",
")",
";",
"}",
"catch",
"(",
"Exception",
"e1",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e1",
",",
"CLASS_NAME",
"+",
"\".processSchema\"",
",",
"CommsConstants",
".",
"PROXYRECEIVELISTENER_PROCESSSCHEMA_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"MFP unable to create CompHandshake Singleton\"",
",",
"e1",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"processSchema\"",
")",
";",
"}"
] | This method will process a schema received from our peer's MFP compoennt.
At the moment this consists of contacting MFP here on the client and
giving it the schema. Schemas are received when the ME is about to send
us a message and realises that we don't have the necessary schema to decode
it. A High priority message is then sent ahead of the data ensuring that
by the time the message is received the schema will be understood.
@param buffer
@param conversation | [
"This",
"method",
"will",
"process",
"a",
"schema",
"received",
"from",
"our",
"peer",
"s",
"MFP",
"compoennt",
".",
"At",
"the",
"moment",
"this",
"consists",
"of",
"contacting",
"MFP",
"here",
"on",
"the",
"client",
"and",
"giving",
"it",
"the",
"schema",
".",
"Schemas",
"are",
"received",
"when",
"the",
"ME",
"is",
"about",
"to",
"send",
"us",
"a",
"message",
"and",
"realises",
"that",
"we",
"don",
"t",
"have",
"the",
"necessary",
"schema",
"to",
"decode",
"it",
".",
"A",
"High",
"priority",
"message",
"is",
"then",
"sent",
"ahead",
"of",
"the",
"data",
"ensuring",
"that",
"by",
"the",
"time",
"the",
"message",
"is",
"received",
"the",
"schema",
"will",
"be",
"understood",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProxyReceiveListener.java#L600-L636 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProxyReceiveListener.java | ProxyReceiveListener.processSyncMessageChunk | private void processSyncMessageChunk(CommsByteBuffer buffer, Conversation conversation,
boolean connectionMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "processSyncMessageChunk",
new Object[]{buffer, conversation, connectionMessage});
// First get the ConnectionProxy for this conversation
ClientConversationState convState = (ClientConversationState) conversation.getAttachment();
ConnectionProxy connProxy = (ConnectionProxy) convState.getSICoreConnection();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Found connection: ", connProxy);
// Now read the connection object Id
buffer.getShort(); // BIT16 ConnectionObjId
if (connectionMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Adding message part directly to connection");
connProxy.addMessagePart(buffer);
}
else
{
short consumerSessionId = buffer.getShort(); // BIT16 ConsumerSessionId
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Consumer Session Id:", ""+consumerSessionId);
// Now simply pass the message buffer off to the consumer
ConsumerSessionProxy consumer = connProxy.getConsumerSessionProxy(consumerSessionId);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Found consumer:", consumer);
consumer.addMessagePart(buffer);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "processSyncMessageChunk");
} | java | private void processSyncMessageChunk(CommsByteBuffer buffer, Conversation conversation,
boolean connectionMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "processSyncMessageChunk",
new Object[]{buffer, conversation, connectionMessage});
// First get the ConnectionProxy for this conversation
ClientConversationState convState = (ClientConversationState) conversation.getAttachment();
ConnectionProxy connProxy = (ConnectionProxy) convState.getSICoreConnection();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Found connection: ", connProxy);
// Now read the connection object Id
buffer.getShort(); // BIT16 ConnectionObjId
if (connectionMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Adding message part directly to connection");
connProxy.addMessagePart(buffer);
}
else
{
short consumerSessionId = buffer.getShort(); // BIT16 ConsumerSessionId
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Consumer Session Id:", ""+consumerSessionId);
// Now simply pass the message buffer off to the consumer
ConsumerSessionProxy consumer = connProxy.getConsumerSessionProxy(consumerSessionId);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Found consumer:", consumer);
consumer.addMessagePart(buffer);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "processSyncMessageChunk");
} | [
"private",
"void",
"processSyncMessageChunk",
"(",
"CommsByteBuffer",
"buffer",
",",
"Conversation",
"conversation",
",",
"boolean",
"connectionMessage",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"processSyncMessageChunk\"",
",",
"new",
"Object",
"[",
"]",
"{",
"buffer",
",",
"conversation",
",",
"connectionMessage",
"}",
")",
";",
"// First get the ConnectionProxy for this conversation",
"ClientConversationState",
"convState",
"=",
"(",
"ClientConversationState",
")",
"conversation",
".",
"getAttachment",
"(",
")",
";",
"ConnectionProxy",
"connProxy",
"=",
"(",
"ConnectionProxy",
")",
"convState",
".",
"getSICoreConnection",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Found connection: \"",
",",
"connProxy",
")",
";",
"// Now read the connection object Id",
"buffer",
".",
"getShort",
"(",
")",
";",
"// BIT16 ConnectionObjId",
"if",
"(",
"connectionMessage",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Adding message part directly to connection\"",
")",
";",
"connProxy",
".",
"addMessagePart",
"(",
"buffer",
")",
";",
"}",
"else",
"{",
"short",
"consumerSessionId",
"=",
"buffer",
".",
"getShort",
"(",
")",
";",
"// BIT16 ConsumerSessionId",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Consumer Session Id:\"",
",",
"\"\"",
"+",
"consumerSessionId",
")",
";",
"// Now simply pass the message buffer off to the consumer",
"ConsumerSessionProxy",
"consumer",
"=",
"connProxy",
".",
"getConsumerSessionProxy",
"(",
"consumerSessionId",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Found consumer:\"",
",",
"consumer",
")",
";",
"consumer",
".",
"addMessagePart",
"(",
"buffer",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"processSyncMessageChunk\"",
")",
";",
"}"
] | Processes a chunk received from a synchronous message.
@param buffer
@param conversation
@param connectionMessage | [
"Processes",
"a",
"chunk",
"received",
"from",
"a",
"synchronous",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProxyReceiveListener.java#L645-L675 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java | Activator.getBean | public BeanO getBean(ContainerTx tx, BeanId id)
{
return id.getActivationStrategy().atGet(tx, id);
} | java | public BeanO getBean(ContainerTx tx, BeanId id)
{
return id.getActivationStrategy().atGet(tx, id);
} | [
"public",
"BeanO",
"getBean",
"(",
"ContainerTx",
"tx",
",",
"BeanId",
"id",
")",
"{",
"return",
"id",
".",
"getActivationStrategy",
"(",
")",
".",
"atGet",
"(",
"tx",
",",
"id",
")",
";",
"}"
] | Return bean from cache for given transaction, bean id. Return null
if no entry in cache. | [
"Return",
"bean",
"from",
"cache",
"for",
"given",
"transaction",
"bean",
"id",
".",
"Return",
"null",
"if",
"no",
"entry",
"in",
"cache",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L368-L371 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java | Activator.commitBean | public void commitBean(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atCommit(tx, bean);
} | java | public void commitBean(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atCommit(tx, bean);
} | [
"public",
"void",
"commitBean",
"(",
"ContainerTx",
"tx",
",",
"BeanO",
"bean",
")",
"{",
"bean",
".",
"getActivationStrategy",
"(",
")",
".",
"atCommit",
"(",
"tx",
",",
"bean",
")",
";",
"}"
] | Perform commit-time processing for the specified transaction and bean.
This method should be called for each bean which was participating in
a transaction which was successfully committed.
The transaction-local instance of the bean is removed from the cache,
and any necessary reconciliation between that instance and the master
instance is done (e.g. if the bean was removed during the transaction,
the master instance is also removed from the cache).
<p>
@param tx The transaction which just committed
@param bean The BeanId of the bean | [
"Perform",
"commit",
"-",
"time",
"processing",
"for",
"the",
"specified",
"transaction",
"and",
"bean",
".",
"This",
"method",
"should",
"be",
"called",
"for",
"each",
"bean",
"which",
"was",
"participating",
"in",
"a",
"transaction",
"which",
"was",
"successfully",
"committed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L387-L390 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java | Activator.unitOfWorkEnd | public void unitOfWorkEnd(ContainerAS as, BeanO bean)
{
bean.getActivationStrategy().atUnitOfWorkEnd(as, bean);
} | java | public void unitOfWorkEnd(ContainerAS as, BeanO bean)
{
bean.getActivationStrategy().atUnitOfWorkEnd(as, bean);
} | [
"public",
"void",
"unitOfWorkEnd",
"(",
"ContainerAS",
"as",
",",
"BeanO",
"bean",
")",
"{",
"bean",
".",
"getActivationStrategy",
"(",
")",
".",
"atUnitOfWorkEnd",
"(",
"as",
",",
"bean",
")",
";",
"}"
] | LIDB441.5 - added | [
"LIDB441",
".",
"5",
"-",
"added"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L404-L407 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java | Activator.rollbackBean | public void rollbackBean(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atRollback(tx, bean);
} | java | public void rollbackBean(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atRollback(tx, bean);
} | [
"public",
"void",
"rollbackBean",
"(",
"ContainerTx",
"tx",
",",
"BeanO",
"bean",
")",
"{",
"bean",
".",
"getActivationStrategy",
"(",
")",
".",
"atRollback",
"(",
"tx",
",",
"bean",
")",
";",
"}"
] | Perform rollback-time processing for the specified transaction and
bean. This method should be called for each bean which was
participating in a transaction which was rolled back.
Removes the transaction-local instance from the cache.
@param tx The transaction which was just rolled back
@param bean The bean for rollback processing | [
"Perform",
"rollback",
"-",
"time",
"processing",
"for",
"the",
"specified",
"transaction",
"and",
"bean",
".",
"This",
"method",
"should",
"be",
"called",
"for",
"each",
"bean",
"which",
"was",
"participating",
"in",
"a",
"transaction",
"which",
"was",
"rolled",
"back",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L419-L422 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java | Activator.enlistBean | public final void enlistBean(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atEnlist(tx, bean);
} | java | public final void enlistBean(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atEnlist(tx, bean);
} | [
"public",
"final",
"void",
"enlistBean",
"(",
"ContainerTx",
"tx",
",",
"BeanO",
"bean",
")",
"{",
"bean",
".",
"getActivationStrategy",
"(",
")",
".",
"atEnlist",
"(",
"tx",
",",
"bean",
")",
";",
"}"
] | Perform actions required when a bean is enlisted in a transaction
at some point in time other than at activation. Used only for
beans using TX_BEAN_MANAGED. | [
"Perform",
"actions",
"required",
"when",
"a",
"bean",
"is",
"enlisted",
"in",
"a",
"transaction",
"at",
"some",
"point",
"in",
"time",
"other",
"than",
"at",
"activation",
".",
"Used",
"only",
"for",
"beans",
"using",
"TX_BEAN_MANAGED",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L429-L432 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java | Activator.terminate | public void terminate()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "terminate");
statefulBeanReaper.cancel(); //d601399
// Force a reaper sweep
statefulBeanReaper.finalSweep(passivator);
beanCache.terminate();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "terminate");
} | java | public void terminate()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "terminate");
statefulBeanReaper.cancel(); //d601399
// Force a reaper sweep
statefulBeanReaper.finalSweep(passivator);
beanCache.terminate();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "terminate");
} | [
"public",
"void",
"terminate",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"terminate\"",
")",
";",
"statefulBeanReaper",
".",
"cancel",
"(",
")",
";",
"//d601399",
"// Force a reaper sweep",
"statefulBeanReaper",
".",
"finalSweep",
"(",
"passivator",
")",
";",
"beanCache",
".",
"terminate",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"terminate\"",
")",
";",
"}"
] | Enable cleanup of passivated beans, kind of a hack, required
because all the bean's homes have already been cleaned up at this
point | [
"Enable",
"cleanup",
"of",
"passivated",
"beans",
"kind",
"of",
"a",
"hack",
"required",
"because",
"all",
"the",
"bean",
"s",
"homes",
"have",
"already",
"been",
"cleaned",
"up",
"at",
"this",
"point"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L564-L578 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java | Activator.uninstallBean | public void uninstallBean(J2EEName homeName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "uninstallBean " + homeName);
BeanO cacheMember;
J2EEName cacheHomeName;
Iterator<?> statefulBeans; // d103404.1
int numEnumerated = 0, numRemoved = 0, numTimedout = 0; // d103404.2
// Enumerate through the bean cache, removing all instances
// associated with the specified home.
Enumeration<?> enumerate = beanCache.enumerateElements();
while (enumerate.hasMoreElements())
{
cacheMember = (BeanO) ((CacheElement)
enumerate.nextElement()).getObject();
BeanId cacheMemberBeanId = cacheMember.getId();
cacheHomeName = cacheMemberBeanId.getJ2EEName();
numEnumerated++;
// If the cache has homeObj as it's home, remove it.
// If the bean has been removed since it was found (above),
// then the call to atUninstall() will just no-op.
// Note that the enumeration can handle elements being removed
// from the cache while enumerating. d103404.2
if (cacheHomeName.equals(homeName))
{
HomeInternal home = cacheMember.getHome();
// On z/OS, the application might be stopping in a single SR
// only. We can't tell, so assume the SFSB needs to remain
// available for the application running in another SR, and
// passivate the SFSB rather than uninstalling it. LIDB2775-23.4
BeanMetaData bmd = cacheMemberBeanId.getBeanMetaData();
if (EJSPlatformHelper.isZOS() && bmd.isPassivationCapable()) {
try {
home.getActivationStrategy().atPassivate(cacheMemberBeanId);
} catch (Exception ex) {
Tr.warning(tc, "UNABLE_TO_PASSIVATE_EJB_CNTR0005W",
new Object[] { cacheMemberBeanId, this, ex });
}
} else {
home.getActivationStrategy().atUninstall(cacheMemberBeanId,
cacheMember);
}
numRemoved++;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // d103404.1 d103404.2
Tr.debug(tc, beanCache.getName() + ": Uninstalled " + numRemoved +
" bean instances (total = " + numEnumerated + ")");
}
// Also, uninstall all passivated Stateful Session beans for the
// specified home, regardless of whether they have timed out or not.
// All of the beans for this home in the StatefulBeanReaper should
// be in the passivated state (i.e. state written to a file), as the
// above loop should have cleared all active ones from the EJB Cache.
// Calling atUninstall on them will delete the file and remove them
// from the reaper. d103404.1
statefulBeans = statefulBeanReaper.getPassivatedStatefulBeanIds(homeName);
while (statefulBeans.hasNext())
{
// Call atUninstall just like for those in the cache... atUninstall
// will handle them not being in the cache and remove the file.
// Note that atTimeout cannot be used, as the beans (though passivated)
// may not be timed out, and atTimeout would skip them. d129562
BeanId beanId = (BeanId) statefulBeans.next();
// LIDB2775-23.4 Begins
if (EJSPlatformHelper.isZOS())
{
statefulBeanReaper.remove(beanId);
} else
// LIDB2775-23.4 Ends
{
beanId.getActivationStrategy().atUninstall(beanId, null);
}
numTimedout++;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // d103404.2
Tr.debug(tc, "Passivated Beans: Uninstalled " + numTimedout +
" bean instances");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "uninstallBean");
} | java | public void uninstallBean(J2EEName homeName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "uninstallBean " + homeName);
BeanO cacheMember;
J2EEName cacheHomeName;
Iterator<?> statefulBeans; // d103404.1
int numEnumerated = 0, numRemoved = 0, numTimedout = 0; // d103404.2
// Enumerate through the bean cache, removing all instances
// associated with the specified home.
Enumeration<?> enumerate = beanCache.enumerateElements();
while (enumerate.hasMoreElements())
{
cacheMember = (BeanO) ((CacheElement)
enumerate.nextElement()).getObject();
BeanId cacheMemberBeanId = cacheMember.getId();
cacheHomeName = cacheMemberBeanId.getJ2EEName();
numEnumerated++;
// If the cache has homeObj as it's home, remove it.
// If the bean has been removed since it was found (above),
// then the call to atUninstall() will just no-op.
// Note that the enumeration can handle elements being removed
// from the cache while enumerating. d103404.2
if (cacheHomeName.equals(homeName))
{
HomeInternal home = cacheMember.getHome();
// On z/OS, the application might be stopping in a single SR
// only. We can't tell, so assume the SFSB needs to remain
// available for the application running in another SR, and
// passivate the SFSB rather than uninstalling it. LIDB2775-23.4
BeanMetaData bmd = cacheMemberBeanId.getBeanMetaData();
if (EJSPlatformHelper.isZOS() && bmd.isPassivationCapable()) {
try {
home.getActivationStrategy().atPassivate(cacheMemberBeanId);
} catch (Exception ex) {
Tr.warning(tc, "UNABLE_TO_PASSIVATE_EJB_CNTR0005W",
new Object[] { cacheMemberBeanId, this, ex });
}
} else {
home.getActivationStrategy().atUninstall(cacheMemberBeanId,
cacheMember);
}
numRemoved++;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // d103404.1 d103404.2
Tr.debug(tc, beanCache.getName() + ": Uninstalled " + numRemoved +
" bean instances (total = " + numEnumerated + ")");
}
// Also, uninstall all passivated Stateful Session beans for the
// specified home, regardless of whether they have timed out or not.
// All of the beans for this home in the StatefulBeanReaper should
// be in the passivated state (i.e. state written to a file), as the
// above loop should have cleared all active ones from the EJB Cache.
// Calling atUninstall on them will delete the file and remove them
// from the reaper. d103404.1
statefulBeans = statefulBeanReaper.getPassivatedStatefulBeanIds(homeName);
while (statefulBeans.hasNext())
{
// Call atUninstall just like for those in the cache... atUninstall
// will handle them not being in the cache and remove the file.
// Note that atTimeout cannot be used, as the beans (though passivated)
// may not be timed out, and atTimeout would skip them. d129562
BeanId beanId = (BeanId) statefulBeans.next();
// LIDB2775-23.4 Begins
if (EJSPlatformHelper.isZOS())
{
statefulBeanReaper.remove(beanId);
} else
// LIDB2775-23.4 Ends
{
beanId.getActivationStrategy().atUninstall(beanId, null);
}
numTimedout++;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // d103404.2
Tr.debug(tc, "Passivated Beans: Uninstalled " + numTimedout +
" bean instances");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "uninstallBean");
} | [
"public",
"void",
"uninstallBean",
"(",
"J2EEName",
"homeName",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"uninstallBean \"",
"+",
"homeName",
")",
";",
"BeanO",
"cacheMember",
";",
"J2EEName",
"cacheHomeName",
";",
"Iterator",
"<",
"?",
">",
"statefulBeans",
";",
"// d103404.1",
"int",
"numEnumerated",
"=",
"0",
",",
"numRemoved",
"=",
"0",
",",
"numTimedout",
"=",
"0",
";",
"// d103404.2",
"// Enumerate through the bean cache, removing all instances",
"// associated with the specified home.",
"Enumeration",
"<",
"?",
">",
"enumerate",
"=",
"beanCache",
".",
"enumerateElements",
"(",
")",
";",
"while",
"(",
"enumerate",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"cacheMember",
"=",
"(",
"BeanO",
")",
"(",
"(",
"CacheElement",
")",
"enumerate",
".",
"nextElement",
"(",
")",
")",
".",
"getObject",
"(",
")",
";",
"BeanId",
"cacheMemberBeanId",
"=",
"cacheMember",
".",
"getId",
"(",
")",
";",
"cacheHomeName",
"=",
"cacheMemberBeanId",
".",
"getJ2EEName",
"(",
")",
";",
"numEnumerated",
"++",
";",
"// If the cache has homeObj as it's home, remove it.",
"// If the bean has been removed since it was found (above),",
"// then the call to atUninstall() will just no-op.",
"// Note that the enumeration can handle elements being removed",
"// from the cache while enumerating. d103404.2",
"if",
"(",
"cacheHomeName",
".",
"equals",
"(",
"homeName",
")",
")",
"{",
"HomeInternal",
"home",
"=",
"cacheMember",
".",
"getHome",
"(",
")",
";",
"// On z/OS, the application might be stopping in a single SR",
"// only. We can't tell, so assume the SFSB needs to remain",
"// available for the application running in another SR, and",
"// passivate the SFSB rather than uninstalling it. LIDB2775-23.4",
"BeanMetaData",
"bmd",
"=",
"cacheMemberBeanId",
".",
"getBeanMetaData",
"(",
")",
";",
"if",
"(",
"EJSPlatformHelper",
".",
"isZOS",
"(",
")",
"&&",
"bmd",
".",
"isPassivationCapable",
"(",
")",
")",
"{",
"try",
"{",
"home",
".",
"getActivationStrategy",
"(",
")",
".",
"atPassivate",
"(",
"cacheMemberBeanId",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"UNABLE_TO_PASSIVATE_EJB_CNTR0005W\"",
",",
"new",
"Object",
"[",
"]",
"{",
"cacheMemberBeanId",
",",
"this",
",",
"ex",
"}",
")",
";",
"}",
"}",
"else",
"{",
"home",
".",
"getActivationStrategy",
"(",
")",
".",
"atUninstall",
"(",
"cacheMemberBeanId",
",",
"cacheMember",
")",
";",
"}",
"numRemoved",
"++",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// d103404.1 d103404.2",
"Tr",
".",
"debug",
"(",
"tc",
",",
"beanCache",
".",
"getName",
"(",
")",
"+",
"\": Uninstalled \"",
"+",
"numRemoved",
"+",
"\" bean instances (total = \"",
"+",
"numEnumerated",
"+",
"\")\"",
")",
";",
"}",
"// Also, uninstall all passivated Stateful Session beans for the",
"// specified home, regardless of whether they have timed out or not.",
"// All of the beans for this home in the StatefulBeanReaper should",
"// be in the passivated state (i.e. state written to a file), as the",
"// above loop should have cleared all active ones from the EJB Cache.",
"// Calling atUninstall on them will delete the file and remove them",
"// from the reaper. d103404.1",
"statefulBeans",
"=",
"statefulBeanReaper",
".",
"getPassivatedStatefulBeanIds",
"(",
"homeName",
")",
";",
"while",
"(",
"statefulBeans",
".",
"hasNext",
"(",
")",
")",
"{",
"// Call atUninstall just like for those in the cache... atUninstall",
"// will handle them not being in the cache and remove the file.",
"// Note that atTimeout cannot be used, as the beans (though passivated)",
"// may not be timed out, and atTimeout would skip them. d129562",
"BeanId",
"beanId",
"=",
"(",
"BeanId",
")",
"statefulBeans",
".",
"next",
"(",
")",
";",
"// LIDB2775-23.4 Begins",
"if",
"(",
"EJSPlatformHelper",
".",
"isZOS",
"(",
")",
")",
"{",
"statefulBeanReaper",
".",
"remove",
"(",
"beanId",
")",
";",
"}",
"else",
"// LIDB2775-23.4 Ends",
"{",
"beanId",
".",
"getActivationStrategy",
"(",
")",
".",
"atUninstall",
"(",
"beanId",
",",
"null",
")",
";",
"}",
"numTimedout",
"++",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// d103404.2",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Passivated Beans: Uninstalled \"",
"+",
"numTimedout",
"+",
"\" bean instances\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"uninstallBean\"",
")",
";",
"}"
] | Uninstall a bean identified by the J2EEName. This is a partial solution
to the general problem of how we can quiesce beans.
Uninstalling a bean requires us to enumerate the whole bean cache
We attempt to find beans which have the same J2EEName as the bean we
are uninstalling. We then fire the uninstall event on the activation
strategy. It is upto the activation strategy to decide whether to
remove the bean or not.
Also, timeout all Stateful Session beans. When a Stateful Session
bean is stopped, not only does it need to remove it from the Active
EJB Cache, but it also needs to have any passivated instances removed
as well, deleting the file associated with them. This needs to be
done so that the customer may change the implementation of the bean
and restart it. An old file (with serialized bean data) may not
restore to the new implementation. d103404.1 | [
"Uninstall",
"a",
"bean",
"identified",
"by",
"the",
"J2EEName",
".",
"This",
"is",
"a",
"partial",
"solution",
"to",
"the",
"general",
"problem",
"of",
"how",
"we",
"can",
"quiesce",
"beans",
".",
"Uninstalling",
"a",
"bean",
"requires",
"us",
"to",
"enumerate",
"the",
"whole",
"bean",
"cache",
"We",
"attempt",
"to",
"find",
"beans",
"which",
"have",
"the",
"same",
"J2EEName",
"as",
"the",
"bean",
"we",
"are",
"uninstalling",
".",
"We",
"then",
"fire",
"the",
"uninstall",
"event",
"on",
"the",
"activation",
"strategy",
".",
"It",
"is",
"upto",
"the",
"activation",
"strategy",
"to",
"decide",
"whether",
"to",
"remove",
"the",
"bean",
"or",
"not",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L597-L686 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/TimerNpImpl.java | TimerNpImpl.calculateNextExpiration | synchronized long calculateNextExpiration()
{
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "calculateNextExpiration: " + this);
ivLastExpiration = ivExpiration; // 598265
if (ivParsedScheduleExpression != null) {
// F7437591.codRev - getNextTimeout returns -1 for "no more timeouts",
// but this class uses ivExpiration=0.
ivExpiration = Math.max(0, ivParsedScheduleExpression.getNextTimeout(ivExpiration));
}
else {
if (ivInterval > 0) {
ivExpiration += ivInterval; // 597753
}
else {
ivExpiration = 0;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "calculateNextExpiration: " + ivExpiration); // 597753
return ivExpiration;
} | java | synchronized long calculateNextExpiration()
{
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "calculateNextExpiration: " + this);
ivLastExpiration = ivExpiration; // 598265
if (ivParsedScheduleExpression != null) {
// F7437591.codRev - getNextTimeout returns -1 for "no more timeouts",
// but this class uses ivExpiration=0.
ivExpiration = Math.max(0, ivParsedScheduleExpression.getNextTimeout(ivExpiration));
}
else {
if (ivInterval > 0) {
ivExpiration += ivInterval; // 597753
}
else {
ivExpiration = 0;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "calculateNextExpiration: " + ivExpiration); // 597753
return ivExpiration;
} | [
"synchronized",
"long",
"calculateNextExpiration",
"(",
")",
"{",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"calculateNextExpiration: \"",
"+",
"this",
")",
";",
"ivLastExpiration",
"=",
"ivExpiration",
";",
"// 598265",
"if",
"(",
"ivParsedScheduleExpression",
"!=",
"null",
")",
"{",
"// F7437591.codRev - getNextTimeout returns -1 for \"no more timeouts\",",
"// but this class uses ivExpiration=0.",
"ivExpiration",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"ivParsedScheduleExpression",
".",
"getNextTimeout",
"(",
"ivExpiration",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"ivInterval",
">",
"0",
")",
"{",
"ivExpiration",
"+=",
"ivInterval",
";",
"// 597753",
"}",
"else",
"{",
"ivExpiration",
"=",
"0",
";",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"calculateNextExpiration: \"",
"+",
"ivExpiration",
")",
";",
"// 597753",
"return",
"ivExpiration",
";",
"}"
] | Calculate the next time that the timer should fire.
@return the number of milliseconds until the next timeout, or 0 if the
timer should not fire again | [
"Calculate",
"the",
"next",
"time",
"that",
"the",
"timer",
"should",
"fire",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/TimerNpImpl.java#L406-L432 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/TimerNpImpl.java | TimerNpImpl.removeTimersByJ2EEName | public static void removeTimersByJ2EEName(J2EEName j2eeName)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "removeTimersByJ2EEName: " + j2eeName);
Collection<TimerNpImpl> timersToRemove = null;
// Although this seems inefficient, removing all of the timers for an
// application or module that is stopping is done in two steps to avoid
// obtaining locks on both the active timers map and any individual
// timer concurrently. Many methods on a timer will also need to obtain
// the lock on the active timers map as well, so the two step approach
// avoids the possibility of deadlock. RTC107334
synchronized (svActiveTimers)
{
if (svActiveTimers.size() > 0)
{
String appToRemove = j2eeName.getApplication();
String modToRemove = j2eeName.getModule();
for (TimerNpImpl timer : svActiveTimers.values())
{
J2EEName timerJ2EEName = timer.ivBeanId.j2eeName;
if (appToRemove.equals(timerJ2EEName.getApplication()) &&
(modToRemove == null || modToRemove.equals(timerJ2EEName.getModule())))
{
// save the timer to be removed outside the active timers map lock
if (timersToRemove == null)
{
timersToRemove = new ArrayList<TimerNpImpl>();
}
timersToRemove.add(timer);
}
}
}
}
if (timersToRemove != null)
{
for (TimerNpImpl timer : timersToRemove)
{
timer.remove(true); // permanently remove the timer; cannot be rolled back
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "removeTimersByJ2EEName: removed " + (timersToRemove != null ? timersToRemove.size() : 0));
} | java | public static void removeTimersByJ2EEName(J2EEName j2eeName)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "removeTimersByJ2EEName: " + j2eeName);
Collection<TimerNpImpl> timersToRemove = null;
// Although this seems inefficient, removing all of the timers for an
// application or module that is stopping is done in two steps to avoid
// obtaining locks on both the active timers map and any individual
// timer concurrently. Many methods on a timer will also need to obtain
// the lock on the active timers map as well, so the two step approach
// avoids the possibility of deadlock. RTC107334
synchronized (svActiveTimers)
{
if (svActiveTimers.size() > 0)
{
String appToRemove = j2eeName.getApplication();
String modToRemove = j2eeName.getModule();
for (TimerNpImpl timer : svActiveTimers.values())
{
J2EEName timerJ2EEName = timer.ivBeanId.j2eeName;
if (appToRemove.equals(timerJ2EEName.getApplication()) &&
(modToRemove == null || modToRemove.equals(timerJ2EEName.getModule())))
{
// save the timer to be removed outside the active timers map lock
if (timersToRemove == null)
{
timersToRemove = new ArrayList<TimerNpImpl>();
}
timersToRemove.add(timer);
}
}
}
}
if (timersToRemove != null)
{
for (TimerNpImpl timer : timersToRemove)
{
timer.remove(true); // permanently remove the timer; cannot be rolled back
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "removeTimersByJ2EEName: removed " + (timersToRemove != null ? timersToRemove.size() : 0));
} | [
"public",
"static",
"void",
"removeTimersByJ2EEName",
"(",
"J2EEName",
"j2eeName",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"removeTimersByJ2EEName: \"",
"+",
"j2eeName",
")",
";",
"Collection",
"<",
"TimerNpImpl",
">",
"timersToRemove",
"=",
"null",
";",
"// Although this seems inefficient, removing all of the timers for an",
"// application or module that is stopping is done in two steps to avoid",
"// obtaining locks on both the active timers map and any individual",
"// timer concurrently. Many methods on a timer will also need to obtain",
"// the lock on the active timers map as well, so the two step approach",
"// avoids the possibility of deadlock. RTC107334",
"synchronized",
"(",
"svActiveTimers",
")",
"{",
"if",
"(",
"svActiveTimers",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"String",
"appToRemove",
"=",
"j2eeName",
".",
"getApplication",
"(",
")",
";",
"String",
"modToRemove",
"=",
"j2eeName",
".",
"getModule",
"(",
")",
";",
"for",
"(",
"TimerNpImpl",
"timer",
":",
"svActiveTimers",
".",
"values",
"(",
")",
")",
"{",
"J2EEName",
"timerJ2EEName",
"=",
"timer",
".",
"ivBeanId",
".",
"j2eeName",
";",
"if",
"(",
"appToRemove",
".",
"equals",
"(",
"timerJ2EEName",
".",
"getApplication",
"(",
")",
")",
"&&",
"(",
"modToRemove",
"==",
"null",
"||",
"modToRemove",
".",
"equals",
"(",
"timerJ2EEName",
".",
"getModule",
"(",
")",
")",
")",
")",
"{",
"// save the timer to be removed outside the active timers map lock",
"if",
"(",
"timersToRemove",
"==",
"null",
")",
"{",
"timersToRemove",
"=",
"new",
"ArrayList",
"<",
"TimerNpImpl",
">",
"(",
")",
";",
"}",
"timersToRemove",
".",
"add",
"(",
"timer",
")",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"timersToRemove",
"!=",
"null",
")",
"{",
"for",
"(",
"TimerNpImpl",
"timer",
":",
"timersToRemove",
")",
"{",
"timer",
".",
"remove",
"(",
"true",
")",
";",
"// permanently remove the timer; cannot be rolled back",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"removeTimersByJ2EEName: removed \"",
"+",
"(",
"timersToRemove",
"!=",
"null",
"?",
"timersToRemove",
".",
"size",
"(",
")",
":",
"0",
")",
")",
";",
"}"
] | Removes all timers associated with the specified application or module.
@param j2eeName the name of the application or module | [
"Removes",
"all",
"timers",
"associated",
"with",
"the",
"specified",
"application",
"or",
"module",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/TimerNpImpl.java#L1067-L1116 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.monitor/src/com/ibm/ws/webcontainer/monitor/WebAppModule.java | WebAppModule.statisticCreated | public void statisticCreated (SPIStatistic s)
{
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"statisticCreated","Servlet statistic created with id="+s.getId());
if (s.getId() == LOADED_SERVLETS)
{
sgLoadedServlets = (SPICountStatistic)s;
}
else
if (s.getId() == NUM_RELOADS)
{
sgNumReloads = (SPICountStatistic)s;
}
} | java | public void statisticCreated (SPIStatistic s)
{
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"statisticCreated","Servlet statistic created with id="+s.getId());
if (s.getId() == LOADED_SERVLETS)
{
sgLoadedServlets = (SPICountStatistic)s;
}
else
if (s.getId() == NUM_RELOADS)
{
sgNumReloads = (SPICountStatistic)s;
}
} | [
"public",
"void",
"statisticCreated",
"(",
"SPIStatistic",
"s",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"websphere",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"statisticCreated\"",
",",
"\"Servlet statistic created with id=\"",
"+",
"s",
".",
"getId",
"(",
")",
")",
";",
"if",
"(",
"s",
".",
"getId",
"(",
")",
"==",
"LOADED_SERVLETS",
")",
"{",
"sgLoadedServlets",
"=",
"(",
"SPICountStatistic",
")",
"s",
";",
"}",
"else",
"if",
"(",
"s",
".",
"getId",
"(",
")",
"==",
"NUM_RELOADS",
")",
"{",
"sgNumReloads",
"=",
"(",
"SPICountStatistic",
")",
"s",
";",
"}",
"}"
] | use ID defined in template to identify a statistic | [
"use",
"ID",
"defined",
"in",
"template",
"to",
"identify",
"a",
"statistic"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.monitor/src/com/ibm/ws/webcontainer/monitor/WebAppModule.java#L147-L160 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.createEJBModuleMetaDataImpl | public EJBModuleMetaDataImpl createEJBModuleMetaDataImpl(EJBApplicationMetaData ejbAMD, // F743-4950
ModuleInitData mid,
SfFailoverCache statefulFailoverCache,
EJSContainer container) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "createEJBModuleMetaDataImpl");
EJBJar ejbJar = mid.ivEJBJar;
EJBModuleMetaDataImpl mmd = mid.createModuleMetaData(ejbAMD);
mmd.ivInitData = mid;
mmd.ivMetadataComplete = mid.ivMetadataComplete;
mmd.ivJ2EEName = mid.ivJ2EEName;
mmd.ivName = mid.ivName;
mmd.ivAppName = mid.ivAppName;
mmd.ivLogicalName = mid.ivLogicalName;
mmd.ivApplicationExceptionMap = createApplicationExceptionMap(ejbJar);
mmd.ivModuleVersion = ejbJar == null ? BeanMetaData.J2EE_EJB_VERSION_3_0 : ejbJar.getVersionID();
// Determine if the SetRollbackOnly behavior should be as it was in 2.x
// modules (where SetRollbackOnly would need to be invoked within the
// actual EJB instance), or use the 3.x behavior (where
// SetRollbackOnly can be invoke within and ejb instance that is itself
// invoked from within the ejb instance that began the transaction).
// For EJB 3.x applications, the LimitSetRollbackOnlyBehaviorToInstanceFor property
// is usd to indicate that the 2.x behavior should be used.
// Likewise, 2.x applications can use the ExtendSetRollbackOnlyBehaviorBeyondInstanceFor
// property to get the 3.x behavior.
// d461917.1
if (mmd.ivModuleVersion >= BeanMetaData.J2EE_EJB_VERSION_3_0) {
if ((LimitSetRollbackOnlyBehaviorToInstanceFor == null) ||
(!LimitSetRollbackOnlyBehaviorToInstanceFor.contains(mmd.ivAppName))) {
mmd.ivUseExtendedSetRollbackOnlyBehavior = true;
}
} else { // not a 3.0 module
if ((ExtendSetRollbackOnlyBehaviorBeyondInstanceFor != null) &&
(ExtendSetRollbackOnlyBehaviorBeyondInstanceFor.contains("*") ||
ExtendSetRollbackOnlyBehaviorBeyondInstanceFor.contains(mmd.ivAppName))) {
mmd.ivUseExtendedSetRollbackOnlyBehavior = true;
}
}
// Get the failover instance ID and SFSB Failover value to use for this module if
// a SfFailoverCache object was created.
if (statefulFailoverCache != null) {
mmd.ivSfsbFailover = getSFSBFailover(mmd, container);
mmd.ivFailoverInstanceId = getFailoverInstanceId(mmd, statefulFailoverCache);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createEJBModuleMetaDataImpl: " + mmd);
return mmd;
} | java | public EJBModuleMetaDataImpl createEJBModuleMetaDataImpl(EJBApplicationMetaData ejbAMD, // F743-4950
ModuleInitData mid,
SfFailoverCache statefulFailoverCache,
EJSContainer container) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "createEJBModuleMetaDataImpl");
EJBJar ejbJar = mid.ivEJBJar;
EJBModuleMetaDataImpl mmd = mid.createModuleMetaData(ejbAMD);
mmd.ivInitData = mid;
mmd.ivMetadataComplete = mid.ivMetadataComplete;
mmd.ivJ2EEName = mid.ivJ2EEName;
mmd.ivName = mid.ivName;
mmd.ivAppName = mid.ivAppName;
mmd.ivLogicalName = mid.ivLogicalName;
mmd.ivApplicationExceptionMap = createApplicationExceptionMap(ejbJar);
mmd.ivModuleVersion = ejbJar == null ? BeanMetaData.J2EE_EJB_VERSION_3_0 : ejbJar.getVersionID();
// Determine if the SetRollbackOnly behavior should be as it was in 2.x
// modules (where SetRollbackOnly would need to be invoked within the
// actual EJB instance), or use the 3.x behavior (where
// SetRollbackOnly can be invoke within and ejb instance that is itself
// invoked from within the ejb instance that began the transaction).
// For EJB 3.x applications, the LimitSetRollbackOnlyBehaviorToInstanceFor property
// is usd to indicate that the 2.x behavior should be used.
// Likewise, 2.x applications can use the ExtendSetRollbackOnlyBehaviorBeyondInstanceFor
// property to get the 3.x behavior.
// d461917.1
if (mmd.ivModuleVersion >= BeanMetaData.J2EE_EJB_VERSION_3_0) {
if ((LimitSetRollbackOnlyBehaviorToInstanceFor == null) ||
(!LimitSetRollbackOnlyBehaviorToInstanceFor.contains(mmd.ivAppName))) {
mmd.ivUseExtendedSetRollbackOnlyBehavior = true;
}
} else { // not a 3.0 module
if ((ExtendSetRollbackOnlyBehaviorBeyondInstanceFor != null) &&
(ExtendSetRollbackOnlyBehaviorBeyondInstanceFor.contains("*") ||
ExtendSetRollbackOnlyBehaviorBeyondInstanceFor.contains(mmd.ivAppName))) {
mmd.ivUseExtendedSetRollbackOnlyBehavior = true;
}
}
// Get the failover instance ID and SFSB Failover value to use for this module if
// a SfFailoverCache object was created.
if (statefulFailoverCache != null) {
mmd.ivSfsbFailover = getSFSBFailover(mmd, container);
mmd.ivFailoverInstanceId = getFailoverInstanceId(mmd, statefulFailoverCache);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createEJBModuleMetaDataImpl: " + mmd);
return mmd;
} | [
"public",
"EJBModuleMetaDataImpl",
"createEJBModuleMetaDataImpl",
"(",
"EJBApplicationMetaData",
"ejbAMD",
",",
"// F743-4950",
"ModuleInitData",
"mid",
",",
"SfFailoverCache",
"statefulFailoverCache",
",",
"EJSContainer",
"container",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"createEJBModuleMetaDataImpl\"",
")",
";",
"EJBJar",
"ejbJar",
"=",
"mid",
".",
"ivEJBJar",
";",
"EJBModuleMetaDataImpl",
"mmd",
"=",
"mid",
".",
"createModuleMetaData",
"(",
"ejbAMD",
")",
";",
"mmd",
".",
"ivInitData",
"=",
"mid",
";",
"mmd",
".",
"ivMetadataComplete",
"=",
"mid",
".",
"ivMetadataComplete",
";",
"mmd",
".",
"ivJ2EEName",
"=",
"mid",
".",
"ivJ2EEName",
";",
"mmd",
".",
"ivName",
"=",
"mid",
".",
"ivName",
";",
"mmd",
".",
"ivAppName",
"=",
"mid",
".",
"ivAppName",
";",
"mmd",
".",
"ivLogicalName",
"=",
"mid",
".",
"ivLogicalName",
";",
"mmd",
".",
"ivApplicationExceptionMap",
"=",
"createApplicationExceptionMap",
"(",
"ejbJar",
")",
";",
"mmd",
".",
"ivModuleVersion",
"=",
"ejbJar",
"==",
"null",
"?",
"BeanMetaData",
".",
"J2EE_EJB_VERSION_3_0",
":",
"ejbJar",
".",
"getVersionID",
"(",
")",
";",
"// Determine if the SetRollbackOnly behavior should be as it was in 2.x",
"// modules (where SetRollbackOnly would need to be invoked within the",
"// actual EJB instance), or use the 3.x behavior (where",
"// SetRollbackOnly can be invoke within and ejb instance that is itself",
"// invoked from within the ejb instance that began the transaction).",
"// For EJB 3.x applications, the LimitSetRollbackOnlyBehaviorToInstanceFor property",
"// is usd to indicate that the 2.x behavior should be used.",
"// Likewise, 2.x applications can use the ExtendSetRollbackOnlyBehaviorBeyondInstanceFor",
"// property to get the 3.x behavior.",
"// d461917.1",
"if",
"(",
"mmd",
".",
"ivModuleVersion",
">=",
"BeanMetaData",
".",
"J2EE_EJB_VERSION_3_0",
")",
"{",
"if",
"(",
"(",
"LimitSetRollbackOnlyBehaviorToInstanceFor",
"==",
"null",
")",
"||",
"(",
"!",
"LimitSetRollbackOnlyBehaviorToInstanceFor",
".",
"contains",
"(",
"mmd",
".",
"ivAppName",
")",
")",
")",
"{",
"mmd",
".",
"ivUseExtendedSetRollbackOnlyBehavior",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"// not a 3.0 module",
"if",
"(",
"(",
"ExtendSetRollbackOnlyBehaviorBeyondInstanceFor",
"!=",
"null",
")",
"&&",
"(",
"ExtendSetRollbackOnlyBehaviorBeyondInstanceFor",
".",
"contains",
"(",
"\"*\"",
")",
"||",
"ExtendSetRollbackOnlyBehaviorBeyondInstanceFor",
".",
"contains",
"(",
"mmd",
".",
"ivAppName",
")",
")",
")",
"{",
"mmd",
".",
"ivUseExtendedSetRollbackOnlyBehavior",
"=",
"true",
";",
"}",
"}",
"// Get the failover instance ID and SFSB Failover value to use for this module if",
"// a SfFailoverCache object was created.",
"if",
"(",
"statefulFailoverCache",
"!=",
"null",
")",
"{",
"mmd",
".",
"ivSfsbFailover",
"=",
"getSFSBFailover",
"(",
"mmd",
",",
"container",
")",
";",
"mmd",
".",
"ivFailoverInstanceId",
"=",
"getFailoverInstanceId",
"(",
"mmd",
",",
"statefulFailoverCache",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"createEJBModuleMetaDataImpl: \"",
"+",
"mmd",
")",
";",
"return",
"mmd",
";",
"}"
] | Create the EJB Container's internal module metadata object and fill in the data from
the metadata framework's generic ModuleDataObject. This occurs at application start
time.
@param ejbAMD is the container's metadata for the application containing this module
@param mid the data needed to initialize a bean module.
@param statefulFailoverCache is an EJB Container configuration object that indicates whether
or not SFSB failover is active for this module.
@param container used to obtain container-level SFSB failover values.
@return EJBModuleMetaDataImpl is the Container's internal format for module
configuration data. | [
"Create",
"the",
"EJB",
"Container",
"s",
"internal",
"module",
"metadata",
"object",
"and",
"fill",
"in",
"the",
"data",
"from",
"the",
"metadata",
"framework",
"s",
"generic",
"ModuleDataObject",
".",
"This",
"occurs",
"at",
"application",
"start",
"time",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L214-L270 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.processDeferredBMD | public void processDeferredBMD(BeanMetaData bmd) throws EJBConfigurationException, ContainerException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "processDeferredBMD: " + bmd.j2eeName);
// F743-506 - Process automatic timers. This always needs to be
// done regardless of deferred EJB initialization.
if (bmd.ivInitData.ivTimerMethods == null) {
processAutomaticTimerMetaData(bmd);
}
// d659020 - Clear references that aren't needed for deferred init.
bmd.ivInitData.unload();
bmd.wccm.unload();
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processDeferredBMD");
} | java | public void processDeferredBMD(BeanMetaData bmd) throws EJBConfigurationException, ContainerException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "processDeferredBMD: " + bmd.j2eeName);
// F743-506 - Process automatic timers. This always needs to be
// done regardless of deferred EJB initialization.
if (bmd.ivInitData.ivTimerMethods == null) {
processAutomaticTimerMetaData(bmd);
}
// d659020 - Clear references that aren't needed for deferred init.
bmd.ivInitData.unload();
bmd.wccm.unload();
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processDeferredBMD");
} | [
"public",
"void",
"processDeferredBMD",
"(",
"BeanMetaData",
"bmd",
")",
"throws",
"EJBConfigurationException",
",",
"ContainerException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"processDeferredBMD: \"",
"+",
"bmd",
".",
"j2eeName",
")",
";",
"// F743-506 - Process automatic timers. This always needs to be",
"// done regardless of deferred EJB initialization.",
"if",
"(",
"bmd",
".",
"ivInitData",
".",
"ivTimerMethods",
"==",
"null",
")",
"{",
"processAutomaticTimerMetaData",
"(",
"bmd",
")",
";",
"}",
"// d659020 - Clear references that aren't needed for deferred init.",
"bmd",
".",
"ivInitData",
".",
"unload",
"(",
")",
";",
"bmd",
".",
"wccm",
".",
"unload",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"processDeferredBMD\"",
")",
";",
"}"
] | Perform metadata processing for a bean that is being deferred. | [
"Perform",
"metadata",
"processing",
"for",
"a",
"bean",
"that",
"is",
"being",
"deferred",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L569-L586 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.initializeLifecycleInterceptorMethodMD | private void initializeLifecycleInterceptorMethodMD(Method[] ejbMethods,
List<ContainerTransaction> transactionList,
List<ActivitySessionMethod> activitySessionList,
BeanMetaData bmd) throws EJBConfigurationException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "initializeLifecycleInterceptorMethodMD", (Object[]) ejbMethods);
final int numMethods = LifecycleInterceptorWrapper.NUM_METHODS;
String[] methodNames = new String[numMethods];
Class<?>[][] methodParamTypes = new Class<?>[numMethods][];
String[] methodSignatures = new String[numMethods];
TransactionAttribute[] transactionAttrs = new TransactionAttribute[numMethods];
ActivitySessionAttribute[] activitySessionAttrs = new ActivitySessionAttribute[numMethods];
for (int i = 0; i < numMethods; i++) {
if (ejbMethods[i] == null) {
methodNames[i] = LifecycleInterceptorWrapper.METHOD_NAMES[i];
methodParamTypes[i] = LifecycleInterceptorWrapper.METHOD_PARAM_TYPES[i];
methodSignatures[i] = LifecycleInterceptorWrapper.METHOD_SIGNATURES[i];
// The spec states that in order to specify a transaction attribute
// for lifecycle interceptor methods, the method must be declared
// on the bean class. Afterwards, it states that if a transaction
// attribute is not specified, then it must be REQUIRED. This
// implies that if the bean class specifies a class-level
// transaction attribute of NOT_SUPPORT but does not specify a
// lifecycle interceptor method, we still use REQUIRED for the
// other lifecycle interceptors.
//
// By specifying the default transaction attribute here, we avoid
// NPE in getAnnotationCMTransactions by using null ejbMethods[i].
transactionAttrs[i] = bmd.type == InternalConstants.TYPE_STATEFUL_SESSION ? TransactionAttribute.TX_NOT_SUPPORTED : TransactionAttribute.TX_REQUIRED;
} else {
methodNames[i] = ejbMethods[i].getName();
methodParamTypes[i] = ejbMethods[i].getParameterTypes();
methodSignatures[i] = MethodAttribUtils.methodSignatureOnly(ejbMethods[i]);
}
}
initializeBeanMethodTransactionAttributes(false,
false,
MethodInterface.LIFECYCLE_INTERCEPTOR,
ejbMethods,
null,
null,
transactionList,
activitySessionList,
methodNames,
methodParamTypes,
methodSignatures,
transactionAttrs,
activitySessionAttrs,
bmd);
EJBMethodInfoImpl[] methodInfos = new EJBMethodInfoImpl[numMethods];
int slotSize = bmd.container.getEJBRuntime().getMetaDataSlotSize(MethodMetaData.class);
for (int i = 0; i < numMethods; i++) {
String methodSig = ejbMethods[i] == null ? methodNames[i] + MethodAttribUtils.METHOD_ARGLIST_SEP
+ methodSignatures[i] : MethodAttribUtils.methodSignature(ejbMethods[i]);
String jdiMethodSig = ejbMethods[i] == null ? LifecycleInterceptorWrapper.METHOD_JDI_SIGNATURES[i] : MethodAttribUtils.jdiMethodSignature(ejbMethods[i]);
EJBMethodInfoImpl methodInfo = bmd.createEJBMethodInfoImpl(slotSize);
methodInfo.initializeInstanceData(methodSig, methodNames[i], bmd, MethodInterface.LIFECYCLE_INTERCEPTOR, transactionAttrs[i], false);
methodInfo.setMethodDescriptor(jdiMethodSig);
methodInfo.setActivitySessionAttribute(activitySessionAttrs[i]);
methodInfos[i] = methodInfo;
}
bmd.lifecycleInterceptorMethodInfos = methodInfos;
bmd.lifecycleInterceptorMethodNames = methodNames;
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "initializeLifecycleInterceptorMethodMD");
} | java | private void initializeLifecycleInterceptorMethodMD(Method[] ejbMethods,
List<ContainerTransaction> transactionList,
List<ActivitySessionMethod> activitySessionList,
BeanMetaData bmd) throws EJBConfigurationException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "initializeLifecycleInterceptorMethodMD", (Object[]) ejbMethods);
final int numMethods = LifecycleInterceptorWrapper.NUM_METHODS;
String[] methodNames = new String[numMethods];
Class<?>[][] methodParamTypes = new Class<?>[numMethods][];
String[] methodSignatures = new String[numMethods];
TransactionAttribute[] transactionAttrs = new TransactionAttribute[numMethods];
ActivitySessionAttribute[] activitySessionAttrs = new ActivitySessionAttribute[numMethods];
for (int i = 0; i < numMethods; i++) {
if (ejbMethods[i] == null) {
methodNames[i] = LifecycleInterceptorWrapper.METHOD_NAMES[i];
methodParamTypes[i] = LifecycleInterceptorWrapper.METHOD_PARAM_TYPES[i];
methodSignatures[i] = LifecycleInterceptorWrapper.METHOD_SIGNATURES[i];
// The spec states that in order to specify a transaction attribute
// for lifecycle interceptor methods, the method must be declared
// on the bean class. Afterwards, it states that if a transaction
// attribute is not specified, then it must be REQUIRED. This
// implies that if the bean class specifies a class-level
// transaction attribute of NOT_SUPPORT but does not specify a
// lifecycle interceptor method, we still use REQUIRED for the
// other lifecycle interceptors.
//
// By specifying the default transaction attribute here, we avoid
// NPE in getAnnotationCMTransactions by using null ejbMethods[i].
transactionAttrs[i] = bmd.type == InternalConstants.TYPE_STATEFUL_SESSION ? TransactionAttribute.TX_NOT_SUPPORTED : TransactionAttribute.TX_REQUIRED;
} else {
methodNames[i] = ejbMethods[i].getName();
methodParamTypes[i] = ejbMethods[i].getParameterTypes();
methodSignatures[i] = MethodAttribUtils.methodSignatureOnly(ejbMethods[i]);
}
}
initializeBeanMethodTransactionAttributes(false,
false,
MethodInterface.LIFECYCLE_INTERCEPTOR,
ejbMethods,
null,
null,
transactionList,
activitySessionList,
methodNames,
methodParamTypes,
methodSignatures,
transactionAttrs,
activitySessionAttrs,
bmd);
EJBMethodInfoImpl[] methodInfos = new EJBMethodInfoImpl[numMethods];
int slotSize = bmd.container.getEJBRuntime().getMetaDataSlotSize(MethodMetaData.class);
for (int i = 0; i < numMethods; i++) {
String methodSig = ejbMethods[i] == null ? methodNames[i] + MethodAttribUtils.METHOD_ARGLIST_SEP
+ methodSignatures[i] : MethodAttribUtils.methodSignature(ejbMethods[i]);
String jdiMethodSig = ejbMethods[i] == null ? LifecycleInterceptorWrapper.METHOD_JDI_SIGNATURES[i] : MethodAttribUtils.jdiMethodSignature(ejbMethods[i]);
EJBMethodInfoImpl methodInfo = bmd.createEJBMethodInfoImpl(slotSize);
methodInfo.initializeInstanceData(methodSig, methodNames[i], bmd, MethodInterface.LIFECYCLE_INTERCEPTOR, transactionAttrs[i], false);
methodInfo.setMethodDescriptor(jdiMethodSig);
methodInfo.setActivitySessionAttribute(activitySessionAttrs[i]);
methodInfos[i] = methodInfo;
}
bmd.lifecycleInterceptorMethodInfos = methodInfos;
bmd.lifecycleInterceptorMethodNames = methodNames;
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "initializeLifecycleInterceptorMethodMD");
} | [
"private",
"void",
"initializeLifecycleInterceptorMethodMD",
"(",
"Method",
"[",
"]",
"ejbMethods",
",",
"List",
"<",
"ContainerTransaction",
">",
"transactionList",
",",
"List",
"<",
"ActivitySessionMethod",
">",
"activitySessionList",
",",
"BeanMetaData",
"bmd",
")",
"throws",
"EJBConfigurationException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"initializeLifecycleInterceptorMethodMD\"",
",",
"(",
"Object",
"[",
"]",
")",
"ejbMethods",
")",
";",
"final",
"int",
"numMethods",
"=",
"LifecycleInterceptorWrapper",
".",
"NUM_METHODS",
";",
"String",
"[",
"]",
"methodNames",
"=",
"new",
"String",
"[",
"numMethods",
"]",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"[",
"]",
"methodParamTypes",
"=",
"new",
"Class",
"<",
"?",
">",
"[",
"numMethods",
"]",
"[",
"",
"]",
";",
"String",
"[",
"]",
"methodSignatures",
"=",
"new",
"String",
"[",
"numMethods",
"]",
";",
"TransactionAttribute",
"[",
"]",
"transactionAttrs",
"=",
"new",
"TransactionAttribute",
"[",
"numMethods",
"]",
";",
"ActivitySessionAttribute",
"[",
"]",
"activitySessionAttrs",
"=",
"new",
"ActivitySessionAttribute",
"[",
"numMethods",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numMethods",
";",
"i",
"++",
")",
"{",
"if",
"(",
"ejbMethods",
"[",
"i",
"]",
"==",
"null",
")",
"{",
"methodNames",
"[",
"i",
"]",
"=",
"LifecycleInterceptorWrapper",
".",
"METHOD_NAMES",
"[",
"i",
"]",
";",
"methodParamTypes",
"[",
"i",
"]",
"=",
"LifecycleInterceptorWrapper",
".",
"METHOD_PARAM_TYPES",
"[",
"i",
"]",
";",
"methodSignatures",
"[",
"i",
"]",
"=",
"LifecycleInterceptorWrapper",
".",
"METHOD_SIGNATURES",
"[",
"i",
"]",
";",
"// The spec states that in order to specify a transaction attribute",
"// for lifecycle interceptor methods, the method must be declared",
"// on the bean class. Afterwards, it states that if a transaction",
"// attribute is not specified, then it must be REQUIRED. This",
"// implies that if the bean class specifies a class-level",
"// transaction attribute of NOT_SUPPORT but does not specify a",
"// lifecycle interceptor method, we still use REQUIRED for the",
"// other lifecycle interceptors.",
"//",
"// By specifying the default transaction attribute here, we avoid",
"// NPE in getAnnotationCMTransactions by using null ejbMethods[i].",
"transactionAttrs",
"[",
"i",
"]",
"=",
"bmd",
".",
"type",
"==",
"InternalConstants",
".",
"TYPE_STATEFUL_SESSION",
"?",
"TransactionAttribute",
".",
"TX_NOT_SUPPORTED",
":",
"TransactionAttribute",
".",
"TX_REQUIRED",
";",
"}",
"else",
"{",
"methodNames",
"[",
"i",
"]",
"=",
"ejbMethods",
"[",
"i",
"]",
".",
"getName",
"(",
")",
";",
"methodParamTypes",
"[",
"i",
"]",
"=",
"ejbMethods",
"[",
"i",
"]",
".",
"getParameterTypes",
"(",
")",
";",
"methodSignatures",
"[",
"i",
"]",
"=",
"MethodAttribUtils",
".",
"methodSignatureOnly",
"(",
"ejbMethods",
"[",
"i",
"]",
")",
";",
"}",
"}",
"initializeBeanMethodTransactionAttributes",
"(",
"false",
",",
"false",
",",
"MethodInterface",
".",
"LIFECYCLE_INTERCEPTOR",
",",
"ejbMethods",
",",
"null",
",",
"null",
",",
"transactionList",
",",
"activitySessionList",
",",
"methodNames",
",",
"methodParamTypes",
",",
"methodSignatures",
",",
"transactionAttrs",
",",
"activitySessionAttrs",
",",
"bmd",
")",
";",
"EJBMethodInfoImpl",
"[",
"]",
"methodInfos",
"=",
"new",
"EJBMethodInfoImpl",
"[",
"numMethods",
"]",
";",
"int",
"slotSize",
"=",
"bmd",
".",
"container",
".",
"getEJBRuntime",
"(",
")",
".",
"getMetaDataSlotSize",
"(",
"MethodMetaData",
".",
"class",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numMethods",
";",
"i",
"++",
")",
"{",
"String",
"methodSig",
"=",
"ejbMethods",
"[",
"i",
"]",
"==",
"null",
"?",
"methodNames",
"[",
"i",
"]",
"+",
"MethodAttribUtils",
".",
"METHOD_ARGLIST_SEP",
"+",
"methodSignatures",
"[",
"i",
"]",
":",
"MethodAttribUtils",
".",
"methodSignature",
"(",
"ejbMethods",
"[",
"i",
"]",
")",
";",
"String",
"jdiMethodSig",
"=",
"ejbMethods",
"[",
"i",
"]",
"==",
"null",
"?",
"LifecycleInterceptorWrapper",
".",
"METHOD_JDI_SIGNATURES",
"[",
"i",
"]",
":",
"MethodAttribUtils",
".",
"jdiMethodSignature",
"(",
"ejbMethods",
"[",
"i",
"]",
")",
";",
"EJBMethodInfoImpl",
"methodInfo",
"=",
"bmd",
".",
"createEJBMethodInfoImpl",
"(",
"slotSize",
")",
";",
"methodInfo",
".",
"initializeInstanceData",
"(",
"methodSig",
",",
"methodNames",
"[",
"i",
"]",
",",
"bmd",
",",
"MethodInterface",
".",
"LIFECYCLE_INTERCEPTOR",
",",
"transactionAttrs",
"[",
"i",
"]",
",",
"false",
")",
";",
"methodInfo",
".",
"setMethodDescriptor",
"(",
"jdiMethodSig",
")",
";",
"methodInfo",
".",
"setActivitySessionAttribute",
"(",
"activitySessionAttrs",
"[",
"i",
"]",
")",
";",
"methodInfos",
"[",
"i",
"]",
"=",
"methodInfo",
";",
"}",
"bmd",
".",
"lifecycleInterceptorMethodInfos",
"=",
"methodInfos",
";",
"bmd",
".",
"lifecycleInterceptorMethodNames",
"=",
"methodNames",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"initializeLifecycleInterceptorMethodMD\"",
")",
";",
"}"
] | Initialize lifecycleInterceptorMethodInfos and
lifecycleInterceptorMethodNames fields in the specified BeanMetaData. | [
"Initialize",
"lifecycleInterceptorMethodInfos",
"and",
"lifecycleInterceptorMethodNames",
"fields",
"in",
"the",
"specified",
"BeanMetaData",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L1554-L1629 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.getNestedException | @SuppressWarnings("deprecation")
protected Throwable getNestedException(Throwable t) {
Throwable root = t;
for (;;) {
if (root instanceof RemoteException) {
RemoteException re = (RemoteException) root;
if (re.detail == null)
break;
root = re.detail;
} else if (root instanceof NamingException) {
NamingException ne = (NamingException) root;
if (ne.getRootCause() == null)
break;
root = ne.getRootCause();
} else if (root instanceof com.ibm.ws.exception.WsNestedException) { //d121522
com.ibm.ws.exception.WsNestedException ne = (com.ibm.ws.exception.WsNestedException) root;
if (ne.getCause() == null)
break;
root = ne.getCause();
} else {
break;
}
}
return root;
} | java | @SuppressWarnings("deprecation")
protected Throwable getNestedException(Throwable t) {
Throwable root = t;
for (;;) {
if (root instanceof RemoteException) {
RemoteException re = (RemoteException) root;
if (re.detail == null)
break;
root = re.detail;
} else if (root instanceof NamingException) {
NamingException ne = (NamingException) root;
if (ne.getRootCause() == null)
break;
root = ne.getRootCause();
} else if (root instanceof com.ibm.ws.exception.WsNestedException) { //d121522
com.ibm.ws.exception.WsNestedException ne = (com.ibm.ws.exception.WsNestedException) root;
if (ne.getCause() == null)
break;
root = ne.getCause();
} else {
break;
}
}
return root;
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"protected",
"Throwable",
"getNestedException",
"(",
"Throwable",
"t",
")",
"{",
"Throwable",
"root",
"=",
"t",
";",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"root",
"instanceof",
"RemoteException",
")",
"{",
"RemoteException",
"re",
"=",
"(",
"RemoteException",
")",
"root",
";",
"if",
"(",
"re",
".",
"detail",
"==",
"null",
")",
"break",
";",
"root",
"=",
"re",
".",
"detail",
";",
"}",
"else",
"if",
"(",
"root",
"instanceof",
"NamingException",
")",
"{",
"NamingException",
"ne",
"=",
"(",
"NamingException",
")",
"root",
";",
"if",
"(",
"ne",
".",
"getRootCause",
"(",
")",
"==",
"null",
")",
"break",
";",
"root",
"=",
"ne",
".",
"getRootCause",
"(",
")",
";",
"}",
"else",
"if",
"(",
"root",
"instanceof",
"com",
".",
"ibm",
".",
"ws",
".",
"exception",
".",
"WsNestedException",
")",
"{",
"//d121522",
"com",
".",
"ibm",
".",
"ws",
".",
"exception",
".",
"WsNestedException",
"ne",
"=",
"(",
"com",
".",
"ibm",
".",
"ws",
".",
"exception",
".",
"WsNestedException",
")",
"root",
";",
"if",
"(",
"ne",
".",
"getCause",
"(",
")",
"==",
"null",
")",
"break",
";",
"root",
"=",
"ne",
".",
"getCause",
"(",
")",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"return",
"root",
";",
"}"
] | d494984 eliminate assignment to parameter t. | [
"d494984",
"eliminate",
"assignment",
"to",
"parameter",
"t",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L2090-L2114 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.processSingletonConcurrencyManagementType | private void processSingletonConcurrencyManagementType(BeanMetaData bmd) throws EJBConfigurationException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "processSingletonConcurrencyManagementType");
}
// Initialize DD Concurrency Management type to null and change to
// non null value if it is specified in the DD for the module.
ConcurrencyManagementType ddType = null;
// F743-7027 start
Session sessionBean = (Session) bmd.wccm.enterpriseBean;
if (sessionBean != null) {
int type = sessionBean.getConcurrencyManagementTypeValue();
if (type == Session.CONCURRENCY_MANAGEMENT_TYPE_CONTAINER) {
ddType = ConcurrencyManagementType.CONTAINER;
} else if (type == Session.CONCURRENCY_MANAGEMENT_TYPE_BEAN) {
ddType = ConcurrencyManagementType.BEAN;
}
} // F743-7027 end
// Initialize annotation Concurrency Management type to null and change to
// non null value only if metadata complete is false and annotation is used
// for this Singleton session bean.
ConcurrencyManagementType annotationType = null;
if (bmd.metadataComplete == false) {
// Metadata complete is false, so do we have annotation value?
// Note, EJB spec says annotation can not be inherited from superclass.
Class<?> ejbClass = bmd.enterpriseBeanClass;
ConcurrencyManagement annotation = ejbClass.getAnnotation(javax.ejb.ConcurrencyManagement.class);
if (annotation != null) {
// We have an annotation on EJB class, so validate that it is a valid value.
annotationType = annotation.value();
if (annotationType != ConcurrencyManagementType.CONTAINER && annotationType != ConcurrencyManagementType.BEAN) {
// CNTR0193E: The value, {0}, that is specified for the concurrency management type of
// the {1} enterprise bean class must be either BEAN or CONTAINER.
Tr.error(tc, "SINGLETON_INVALID_CONCURRENCY_MANAGEMENT_CNTR0193E", new Object[] { annotationType, bmd.enterpriseBeanClassName });
throw new EJBConfigurationException("CNTR0193E: The value, " + annotationType
+ ", that is specified for the concurrency management type of the "
+ bmd.enterpriseBeanClassName + " enterprise bean class must be either BEAN or CONTAINER.");
}
}
}
// Assign concurrency management type for this Singleton seesion bean.
// Note, in "4.8.4.3 Specification of a Concurrency Management Type" of EJB 3.1 specification,
// it says "The application assembler is not permitted to use the deployment
// descriptor to override a bean's concurrency management type regardless of whether
// it has been explicitly specified or defaulted by the Bean Provider." However,
// we have no way to know whether DD is from application assembler vs Bean Provider,
// so we have to assume it came from Bean Provider. The team decided that if both
// annotation and DD is used, then the value must match. If they do not match,
// throw an exception.
// Was a value provided via DD?
if (ddType == null) {
// DD did not provide a value, so use annotation value if one was provided.
// Otherwise, use default value required by EJB 3.1 spec.
if (annotationType != null) {
// No DD, but we have annotation. So use the annotation.
bmd.ivSingletonUsesBeanManagedConcurrency = (annotationType == ConcurrencyManagementType.BEAN);
} else {
// Neither DD nor annotation, so default to Container Concurrency Management type.
bmd.ivSingletonUsesBeanManagedConcurrency = false;
}
} else {
// DD did provide a concurrency management type. Verify it matches annotation type
// if both annotation and DD provided a value.
if (annotationType != null && ddType != annotationType) {
// CNTR0194E: The value {0} that is specified in the ejb-jar.xml file for concurrency management type is
// not the same as the @ConcurrencyManagement annotation value {1} on the {2} enterprise bean class.
Tr.error(tc, "SINGLETON_XML_OVERRIDE_CONCURRENCY_MANAGEMENT_CNTR0194E", new Object[] { ddType, annotationType, bmd.enterpriseBeanClassName });
throw new EJBConfigurationException("CNTR0194E: The value " + ddType
+ " that is specified in the ejb-jar.xml file for concurrency management type is not the same "
+ " as the @ConcurrencyManagement annotation value " + annotationType + " on the "
+ bmd.enterpriseBeanClassName + " enterprise bean class.");
}
// Use DD value since either annotation not used or DD matches the annotation type.
bmd.ivSingletonUsesBeanManagedConcurrency = (ddType == ConcurrencyManagementType.BEAN);
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "processSingletonConcurrencyManagementType returning "
+ bmd.ivSingletonUsesBeanManagedConcurrency + " for j2ee name = " + bmd.j2eeName);
}
} | java | private void processSingletonConcurrencyManagementType(BeanMetaData bmd) throws EJBConfigurationException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "processSingletonConcurrencyManagementType");
}
// Initialize DD Concurrency Management type to null and change to
// non null value if it is specified in the DD for the module.
ConcurrencyManagementType ddType = null;
// F743-7027 start
Session sessionBean = (Session) bmd.wccm.enterpriseBean;
if (sessionBean != null) {
int type = sessionBean.getConcurrencyManagementTypeValue();
if (type == Session.CONCURRENCY_MANAGEMENT_TYPE_CONTAINER) {
ddType = ConcurrencyManagementType.CONTAINER;
} else if (type == Session.CONCURRENCY_MANAGEMENT_TYPE_BEAN) {
ddType = ConcurrencyManagementType.BEAN;
}
} // F743-7027 end
// Initialize annotation Concurrency Management type to null and change to
// non null value only if metadata complete is false and annotation is used
// for this Singleton session bean.
ConcurrencyManagementType annotationType = null;
if (bmd.metadataComplete == false) {
// Metadata complete is false, so do we have annotation value?
// Note, EJB spec says annotation can not be inherited from superclass.
Class<?> ejbClass = bmd.enterpriseBeanClass;
ConcurrencyManagement annotation = ejbClass.getAnnotation(javax.ejb.ConcurrencyManagement.class);
if (annotation != null) {
// We have an annotation on EJB class, so validate that it is a valid value.
annotationType = annotation.value();
if (annotationType != ConcurrencyManagementType.CONTAINER && annotationType != ConcurrencyManagementType.BEAN) {
// CNTR0193E: The value, {0}, that is specified for the concurrency management type of
// the {1} enterprise bean class must be either BEAN or CONTAINER.
Tr.error(tc, "SINGLETON_INVALID_CONCURRENCY_MANAGEMENT_CNTR0193E", new Object[] { annotationType, bmd.enterpriseBeanClassName });
throw new EJBConfigurationException("CNTR0193E: The value, " + annotationType
+ ", that is specified for the concurrency management type of the "
+ bmd.enterpriseBeanClassName + " enterprise bean class must be either BEAN or CONTAINER.");
}
}
}
// Assign concurrency management type for this Singleton seesion bean.
// Note, in "4.8.4.3 Specification of a Concurrency Management Type" of EJB 3.1 specification,
// it says "The application assembler is not permitted to use the deployment
// descriptor to override a bean's concurrency management type regardless of whether
// it has been explicitly specified or defaulted by the Bean Provider." However,
// we have no way to know whether DD is from application assembler vs Bean Provider,
// so we have to assume it came from Bean Provider. The team decided that if both
// annotation and DD is used, then the value must match. If they do not match,
// throw an exception.
// Was a value provided via DD?
if (ddType == null) {
// DD did not provide a value, so use annotation value if one was provided.
// Otherwise, use default value required by EJB 3.1 spec.
if (annotationType != null) {
// No DD, but we have annotation. So use the annotation.
bmd.ivSingletonUsesBeanManagedConcurrency = (annotationType == ConcurrencyManagementType.BEAN);
} else {
// Neither DD nor annotation, so default to Container Concurrency Management type.
bmd.ivSingletonUsesBeanManagedConcurrency = false;
}
} else {
// DD did provide a concurrency management type. Verify it matches annotation type
// if both annotation and DD provided a value.
if (annotationType != null && ddType != annotationType) {
// CNTR0194E: The value {0} that is specified in the ejb-jar.xml file for concurrency management type is
// not the same as the @ConcurrencyManagement annotation value {1} on the {2} enterprise bean class.
Tr.error(tc, "SINGLETON_XML_OVERRIDE_CONCURRENCY_MANAGEMENT_CNTR0194E", new Object[] { ddType, annotationType, bmd.enterpriseBeanClassName });
throw new EJBConfigurationException("CNTR0194E: The value " + ddType
+ " that is specified in the ejb-jar.xml file for concurrency management type is not the same "
+ " as the @ConcurrencyManagement annotation value " + annotationType + " on the "
+ bmd.enterpriseBeanClassName + " enterprise bean class.");
}
// Use DD value since either annotation not used or DD matches the annotation type.
bmd.ivSingletonUsesBeanManagedConcurrency = (ddType == ConcurrencyManagementType.BEAN);
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "processSingletonConcurrencyManagementType returning "
+ bmd.ivSingletonUsesBeanManagedConcurrency + " for j2ee name = " + bmd.j2eeName);
}
} | [
"private",
"void",
"processSingletonConcurrencyManagementType",
"(",
"BeanMetaData",
"bmd",
")",
"throws",
"EJBConfigurationException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"processSingletonConcurrencyManagementType\"",
")",
";",
"}",
"// Initialize DD Concurrency Management type to null and change to",
"// non null value if it is specified in the DD for the module.",
"ConcurrencyManagementType",
"ddType",
"=",
"null",
";",
"// F743-7027 start",
"Session",
"sessionBean",
"=",
"(",
"Session",
")",
"bmd",
".",
"wccm",
".",
"enterpriseBean",
";",
"if",
"(",
"sessionBean",
"!=",
"null",
")",
"{",
"int",
"type",
"=",
"sessionBean",
".",
"getConcurrencyManagementTypeValue",
"(",
")",
";",
"if",
"(",
"type",
"==",
"Session",
".",
"CONCURRENCY_MANAGEMENT_TYPE_CONTAINER",
")",
"{",
"ddType",
"=",
"ConcurrencyManagementType",
".",
"CONTAINER",
";",
"}",
"else",
"if",
"(",
"type",
"==",
"Session",
".",
"CONCURRENCY_MANAGEMENT_TYPE_BEAN",
")",
"{",
"ddType",
"=",
"ConcurrencyManagementType",
".",
"BEAN",
";",
"}",
"}",
"// F743-7027 end",
"// Initialize annotation Concurrency Management type to null and change to",
"// non null value only if metadata complete is false and annotation is used",
"// for this Singleton session bean.",
"ConcurrencyManagementType",
"annotationType",
"=",
"null",
";",
"if",
"(",
"bmd",
".",
"metadataComplete",
"==",
"false",
")",
"{",
"// Metadata complete is false, so do we have annotation value?",
"// Note, EJB spec says annotation can not be inherited from superclass.",
"Class",
"<",
"?",
">",
"ejbClass",
"=",
"bmd",
".",
"enterpriseBeanClass",
";",
"ConcurrencyManagement",
"annotation",
"=",
"ejbClass",
".",
"getAnnotation",
"(",
"javax",
".",
"ejb",
".",
"ConcurrencyManagement",
".",
"class",
")",
";",
"if",
"(",
"annotation",
"!=",
"null",
")",
"{",
"// We have an annotation on EJB class, so validate that it is a valid value.",
"annotationType",
"=",
"annotation",
".",
"value",
"(",
")",
";",
"if",
"(",
"annotationType",
"!=",
"ConcurrencyManagementType",
".",
"CONTAINER",
"&&",
"annotationType",
"!=",
"ConcurrencyManagementType",
".",
"BEAN",
")",
"{",
"// CNTR0193E: The value, {0}, that is specified for the concurrency management type of",
"// the {1} enterprise bean class must be either BEAN or CONTAINER.",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"SINGLETON_INVALID_CONCURRENCY_MANAGEMENT_CNTR0193E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"annotationType",
",",
"bmd",
".",
"enterpriseBeanClassName",
"}",
")",
";",
"throw",
"new",
"EJBConfigurationException",
"(",
"\"CNTR0193E: The value, \"",
"+",
"annotationType",
"+",
"\", that is specified for the concurrency management type of the \"",
"+",
"bmd",
".",
"enterpriseBeanClassName",
"+",
"\" enterprise bean class must be either BEAN or CONTAINER.\"",
")",
";",
"}",
"}",
"}",
"// Assign concurrency management type for this Singleton seesion bean.",
"// Note, in \"4.8.4.3 Specification of a Concurrency Management Type\" of EJB 3.1 specification,",
"// it says \"The application assembler is not permitted to use the deployment",
"// descriptor to override a bean's concurrency management type regardless of whether",
"// it has been explicitly specified or defaulted by the Bean Provider.\" However,",
"// we have no way to know whether DD is from application assembler vs Bean Provider,",
"// so we have to assume it came from Bean Provider. The team decided that if both",
"// annotation and DD is used, then the value must match. If they do not match,",
"// throw an exception.",
"// Was a value provided via DD?",
"if",
"(",
"ddType",
"==",
"null",
")",
"{",
"// DD did not provide a value, so use annotation value if one was provided.",
"// Otherwise, use default value required by EJB 3.1 spec.",
"if",
"(",
"annotationType",
"!=",
"null",
")",
"{",
"// No DD, but we have annotation. So use the annotation.",
"bmd",
".",
"ivSingletonUsesBeanManagedConcurrency",
"=",
"(",
"annotationType",
"==",
"ConcurrencyManagementType",
".",
"BEAN",
")",
";",
"}",
"else",
"{",
"// Neither DD nor annotation, so default to Container Concurrency Management type.",
"bmd",
".",
"ivSingletonUsesBeanManagedConcurrency",
"=",
"false",
";",
"}",
"}",
"else",
"{",
"// DD did provide a concurrency management type. Verify it matches annotation type",
"// if both annotation and DD provided a value.",
"if",
"(",
"annotationType",
"!=",
"null",
"&&",
"ddType",
"!=",
"annotationType",
")",
"{",
"// CNTR0194E: The value {0} that is specified in the ejb-jar.xml file for concurrency management type is",
"// not the same as the @ConcurrencyManagement annotation value {1} on the {2} enterprise bean class.",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"SINGLETON_XML_OVERRIDE_CONCURRENCY_MANAGEMENT_CNTR0194E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"ddType",
",",
"annotationType",
",",
"bmd",
".",
"enterpriseBeanClassName",
"}",
")",
";",
"throw",
"new",
"EJBConfigurationException",
"(",
"\"CNTR0194E: The value \"",
"+",
"ddType",
"+",
"\" that is specified in the ejb-jar.xml file for concurrency management type is not the same \"",
"+",
"\" as the @ConcurrencyManagement annotation value \"",
"+",
"annotationType",
"+",
"\" on the \"",
"+",
"bmd",
".",
"enterpriseBeanClassName",
"+",
"\" enterprise bean class.\"",
")",
";",
"}",
"// Use DD value since either annotation not used or DD matches the annotation type.",
"bmd",
".",
"ivSingletonUsesBeanManagedConcurrency",
"=",
"(",
"ddType",
"==",
"ConcurrencyManagementType",
".",
"BEAN",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"processSingletonConcurrencyManagementType returning \"",
"+",
"bmd",
".",
"ivSingletonUsesBeanManagedConcurrency",
"+",
"\" for j2ee name = \"",
"+",
"bmd",
".",
"j2eeName",
")",
";",
"}",
"}"
] | F743-1752CodRev rewrote to do error checking and validation. | [
"F743",
"-",
"1752CodRev",
"rewrote",
"to",
"do",
"error",
"checking",
"and",
"validation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L3160-L3249 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.initializeManagedObjectFactoryOrConstructor | private void initializeManagedObjectFactoryOrConstructor(BeanMetaData bmd) throws EJBConfigurationException {
if (bmd.isManagedBean()) {
bmd.ivEnterpriseBeanFactory = getManagedBeanManagedObjectFactory(bmd, bmd.enterpriseBeanClass);
// If the managed object factroy and the managed object instances will perform all injection
// and interceptor processing, then save that indication and reset all of the methodinfos so
// that AroundInvoke is not handled by the EJB Container. Injection, PostConstruct, and
// PreDestroy will also be skipped.
if (bmd.ivEnterpriseBeanFactory != null && bmd.ivEnterpriseBeanFactory.managesInjectionAndInterceptors()) {
bmd.managedObjectManagesInjectionAndInterceptors = true;
if (bmd.ivInterceptorMetaData != null && bmd.localMethodInfos != null) {
for (EJBMethodInfoImpl mbMethod : bmd.localMethodInfos) {
mbMethod.setAroundInterceptorProxies(null);
}
}
}
} else {
bmd.ivEnterpriseBeanFactory = getEJBManagedObjectFactory(bmd, bmd.enterpriseBeanClass);
}
if (bmd.ivEnterpriseBeanFactory == null) {
try {
bmd.ivEnterpriseBeanClassConstructor = bmd.enterpriseBeanClass.getConstructor((Class<?>[]) null);
} catch (NoSuchMethodException e) {
Tr.error(tc, "JIT_NO_DEFAULT_CTOR_CNTR5007E",
new Object[] { bmd.enterpriseBeanClassName, bmd.enterpriseBeanName });
throw new EJBConfigurationException("CNTR5007E: The " + bmd.enterpriseBeanClassName + " bean class for the " + bmd.enterpriseBeanName +
" bean does not have a public constructor that does not take parameters.");
}
}
// Removed else clause that calls bmd.ivEnterpriseBeanFactory.getConstructor() because this method
// is called before cdiMMD.setWebBeansContext(webBeansContext) in LibertySingletonServer. If we call
// getConstructor before setting the webBeansContext, we default to a constructor that may not be correct.
// eg. returning no-arg constructor when multi-arg constructor injection should be invoked.
} | java | private void initializeManagedObjectFactoryOrConstructor(BeanMetaData bmd) throws EJBConfigurationException {
if (bmd.isManagedBean()) {
bmd.ivEnterpriseBeanFactory = getManagedBeanManagedObjectFactory(bmd, bmd.enterpriseBeanClass);
// If the managed object factroy and the managed object instances will perform all injection
// and interceptor processing, then save that indication and reset all of the methodinfos so
// that AroundInvoke is not handled by the EJB Container. Injection, PostConstruct, and
// PreDestroy will also be skipped.
if (bmd.ivEnterpriseBeanFactory != null && bmd.ivEnterpriseBeanFactory.managesInjectionAndInterceptors()) {
bmd.managedObjectManagesInjectionAndInterceptors = true;
if (bmd.ivInterceptorMetaData != null && bmd.localMethodInfos != null) {
for (EJBMethodInfoImpl mbMethod : bmd.localMethodInfos) {
mbMethod.setAroundInterceptorProxies(null);
}
}
}
} else {
bmd.ivEnterpriseBeanFactory = getEJBManagedObjectFactory(bmd, bmd.enterpriseBeanClass);
}
if (bmd.ivEnterpriseBeanFactory == null) {
try {
bmd.ivEnterpriseBeanClassConstructor = bmd.enterpriseBeanClass.getConstructor((Class<?>[]) null);
} catch (NoSuchMethodException e) {
Tr.error(tc, "JIT_NO_DEFAULT_CTOR_CNTR5007E",
new Object[] { bmd.enterpriseBeanClassName, bmd.enterpriseBeanName });
throw new EJBConfigurationException("CNTR5007E: The " + bmd.enterpriseBeanClassName + " bean class for the " + bmd.enterpriseBeanName +
" bean does not have a public constructor that does not take parameters.");
}
}
// Removed else clause that calls bmd.ivEnterpriseBeanFactory.getConstructor() because this method
// is called before cdiMMD.setWebBeansContext(webBeansContext) in LibertySingletonServer. If we call
// getConstructor before setting the webBeansContext, we default to a constructor that may not be correct.
// eg. returning no-arg constructor when multi-arg constructor injection should be invoked.
} | [
"private",
"void",
"initializeManagedObjectFactoryOrConstructor",
"(",
"BeanMetaData",
"bmd",
")",
"throws",
"EJBConfigurationException",
"{",
"if",
"(",
"bmd",
".",
"isManagedBean",
"(",
")",
")",
"{",
"bmd",
".",
"ivEnterpriseBeanFactory",
"=",
"getManagedBeanManagedObjectFactory",
"(",
"bmd",
",",
"bmd",
".",
"enterpriseBeanClass",
")",
";",
"// If the managed object factroy and the managed object instances will perform all injection",
"// and interceptor processing, then save that indication and reset all of the methodinfos so",
"// that AroundInvoke is not handled by the EJB Container. Injection, PostConstruct, and",
"// PreDestroy will also be skipped.",
"if",
"(",
"bmd",
".",
"ivEnterpriseBeanFactory",
"!=",
"null",
"&&",
"bmd",
".",
"ivEnterpriseBeanFactory",
".",
"managesInjectionAndInterceptors",
"(",
")",
")",
"{",
"bmd",
".",
"managedObjectManagesInjectionAndInterceptors",
"=",
"true",
";",
"if",
"(",
"bmd",
".",
"ivInterceptorMetaData",
"!=",
"null",
"&&",
"bmd",
".",
"localMethodInfos",
"!=",
"null",
")",
"{",
"for",
"(",
"EJBMethodInfoImpl",
"mbMethod",
":",
"bmd",
".",
"localMethodInfos",
")",
"{",
"mbMethod",
".",
"setAroundInterceptorProxies",
"(",
"null",
")",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"bmd",
".",
"ivEnterpriseBeanFactory",
"=",
"getEJBManagedObjectFactory",
"(",
"bmd",
",",
"bmd",
".",
"enterpriseBeanClass",
")",
";",
"}",
"if",
"(",
"bmd",
".",
"ivEnterpriseBeanFactory",
"==",
"null",
")",
"{",
"try",
"{",
"bmd",
".",
"ivEnterpriseBeanClassConstructor",
"=",
"bmd",
".",
"enterpriseBeanClass",
".",
"getConstructor",
"(",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
")",
"null",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"JIT_NO_DEFAULT_CTOR_CNTR5007E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"bmd",
".",
"enterpriseBeanClassName",
",",
"bmd",
".",
"enterpriseBeanName",
"}",
")",
";",
"throw",
"new",
"EJBConfigurationException",
"(",
"\"CNTR5007E: The \"",
"+",
"bmd",
".",
"enterpriseBeanClassName",
"+",
"\" bean class for the \"",
"+",
"bmd",
".",
"enterpriseBeanName",
"+",
"\" bean does not have a public constructor that does not take parameters.\"",
")",
";",
"}",
"}",
"// Removed else clause that calls bmd.ivEnterpriseBeanFactory.getConstructor() because this method",
"// is called before cdiMMD.setWebBeansContext(webBeansContext) in LibertySingletonServer. If we call",
"// getConstructor before setting the webBeansContext, we default to a constructor that may not be correct.",
"// eg. returning no-arg constructor when multi-arg constructor injection should be invoked.",
"}"
] | Create the appropriate ManagedObjectFactory for the bean type, or obtain the constructor
if a ManagedObjectFactory will not be used. | [
"Create",
"the",
"appropriate",
"ManagedObjectFactory",
"for",
"the",
"bean",
"type",
"or",
"obtain",
"the",
"constructor",
"if",
"a",
"ManagedObjectFactory",
"will",
"not",
"be",
"used",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L3255-L3288 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.initializeEntityConstructor | private void initializeEntityConstructor(BeanMetaData bmd) throws EJBConfigurationException {
try {
bmd.ivEnterpriseBeanClassConstructor = bmd.enterpriseBeanClass.getConstructor((Class<?>[]) null);
} catch (NoSuchMethodException e) {
Tr.error(tc, "JIT_NO_DEFAULT_CTOR_CNTR5007E",
new Object[] { bmd.enterpriseBeanClassName, bmd.enterpriseBeanName });
throw new EJBConfigurationException("CNTR5007E: The " + bmd.enterpriseBeanClassName + " bean class for the " + bmd.enterpriseBeanName +
" bean does not have a public constructor that does not take parameters.");
}
} | java | private void initializeEntityConstructor(BeanMetaData bmd) throws EJBConfigurationException {
try {
bmd.ivEnterpriseBeanClassConstructor = bmd.enterpriseBeanClass.getConstructor((Class<?>[]) null);
} catch (NoSuchMethodException e) {
Tr.error(tc, "JIT_NO_DEFAULT_CTOR_CNTR5007E",
new Object[] { bmd.enterpriseBeanClassName, bmd.enterpriseBeanName });
throw new EJBConfigurationException("CNTR5007E: The " + bmd.enterpriseBeanClassName + " bean class for the " + bmd.enterpriseBeanName +
" bean does not have a public constructor that does not take parameters.");
}
} | [
"private",
"void",
"initializeEntityConstructor",
"(",
"BeanMetaData",
"bmd",
")",
"throws",
"EJBConfigurationException",
"{",
"try",
"{",
"bmd",
".",
"ivEnterpriseBeanClassConstructor",
"=",
"bmd",
".",
"enterpriseBeanClass",
".",
"getConstructor",
"(",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
")",
"null",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"JIT_NO_DEFAULT_CTOR_CNTR5007E\"",
",",
"new",
"Object",
"[",
"]",
"{",
"bmd",
".",
"enterpriseBeanClassName",
",",
"bmd",
".",
"enterpriseBeanName",
"}",
")",
";",
"throw",
"new",
"EJBConfigurationException",
"(",
"\"CNTR5007E: The \"",
"+",
"bmd",
".",
"enterpriseBeanClassName",
"+",
"\" bean class for the \"",
"+",
"bmd",
".",
"enterpriseBeanName",
"+",
"\" bean does not have a public constructor that does not take parameters.\"",
")",
";",
"}",
"}"
] | Obtain the constructor for the entity bean concrete class. | [
"Obtain",
"the",
"constructor",
"for",
"the",
"entity",
"bean",
"concrete",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L3293-L3302 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.getManagedBeanManagedObjectFactory | protected <T> ManagedObjectFactory<T> getManagedBeanManagedObjectFactory(BeanMetaData bmd, Class<T> klass) throws EJBConfigurationException {
ManagedObjectFactory<T> factory = null;
ManagedObjectService managedObjectService = getManagedObjectService();
if (managedObjectService != null) {
try {
factory = managedObjectService.createManagedObjectFactory(bmd._moduleMetaData, klass, true);
//TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory
if (!factory.isManaged()) {
factory = null;
}
} catch (ManagedObjectException e) {
throw new EJBConfigurationException(e);
}
}
return factory;
} | java | protected <T> ManagedObjectFactory<T> getManagedBeanManagedObjectFactory(BeanMetaData bmd, Class<T> klass) throws EJBConfigurationException {
ManagedObjectFactory<T> factory = null;
ManagedObjectService managedObjectService = getManagedObjectService();
if (managedObjectService != null) {
try {
factory = managedObjectService.createManagedObjectFactory(bmd._moduleMetaData, klass, true);
//TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory
if (!factory.isManaged()) {
factory = null;
}
} catch (ManagedObjectException e) {
throw new EJBConfigurationException(e);
}
}
return factory;
} | [
"protected",
"<",
"T",
">",
"ManagedObjectFactory",
"<",
"T",
">",
"getManagedBeanManagedObjectFactory",
"(",
"BeanMetaData",
"bmd",
",",
"Class",
"<",
"T",
">",
"klass",
")",
"throws",
"EJBConfigurationException",
"{",
"ManagedObjectFactory",
"<",
"T",
">",
"factory",
"=",
"null",
";",
"ManagedObjectService",
"managedObjectService",
"=",
"getManagedObjectService",
"(",
")",
";",
"if",
"(",
"managedObjectService",
"!=",
"null",
")",
"{",
"try",
"{",
"factory",
"=",
"managedObjectService",
".",
"createManagedObjectFactory",
"(",
"bmd",
".",
"_moduleMetaData",
",",
"klass",
",",
"true",
")",
";",
"//TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory",
"if",
"(",
"!",
"factory",
".",
"isManaged",
"(",
")",
")",
"{",
"factory",
"=",
"null",
";",
"}",
"}",
"catch",
"(",
"ManagedObjectException",
"e",
")",
"{",
"throw",
"new",
"EJBConfigurationException",
"(",
"e",
")",
";",
"}",
"}",
"return",
"factory",
";",
"}"
] | Gets a managed object factory for the specified ManagedBean class, or null if
instances of the class do not need to be managed.
@param bmd the bean metadata
@param klass the ManagedBean class | [
"Gets",
"a",
"managed",
"object",
"factory",
"for",
"the",
"specified",
"ManagedBean",
"class",
"or",
"null",
"if",
"instances",
"of",
"the",
"class",
"do",
"not",
"need",
"to",
"be",
"managed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L3316-L3332 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.getInterceptorManagedObjectFactory | protected <T> ManagedObjectFactory<T> getInterceptorManagedObjectFactory(BeanMetaData bmd, Class<T> klass) throws EJBConfigurationException {
ManagedObjectFactory<T> factory = null;
ManagedObjectService managedObjectService = getManagedObjectService();
if (managedObjectService != null) {
try {
factory = managedObjectService.createInterceptorManagedObjectFactory(bmd._moduleMetaData, klass);
//TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory
if (!factory.isManaged()) {
factory = null;
}
} catch (ManagedObjectException e) {
throw new EJBConfigurationException(e);
}
}
return factory;
} | java | protected <T> ManagedObjectFactory<T> getInterceptorManagedObjectFactory(BeanMetaData bmd, Class<T> klass) throws EJBConfigurationException {
ManagedObjectFactory<T> factory = null;
ManagedObjectService managedObjectService = getManagedObjectService();
if (managedObjectService != null) {
try {
factory = managedObjectService.createInterceptorManagedObjectFactory(bmd._moduleMetaData, klass);
//TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory
if (!factory.isManaged()) {
factory = null;
}
} catch (ManagedObjectException e) {
throw new EJBConfigurationException(e);
}
}
return factory;
} | [
"protected",
"<",
"T",
">",
"ManagedObjectFactory",
"<",
"T",
">",
"getInterceptorManagedObjectFactory",
"(",
"BeanMetaData",
"bmd",
",",
"Class",
"<",
"T",
">",
"klass",
")",
"throws",
"EJBConfigurationException",
"{",
"ManagedObjectFactory",
"<",
"T",
">",
"factory",
"=",
"null",
";",
"ManagedObjectService",
"managedObjectService",
"=",
"getManagedObjectService",
"(",
")",
";",
"if",
"(",
"managedObjectService",
"!=",
"null",
")",
"{",
"try",
"{",
"factory",
"=",
"managedObjectService",
".",
"createInterceptorManagedObjectFactory",
"(",
"bmd",
".",
"_moduleMetaData",
",",
"klass",
")",
";",
"//TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory",
"if",
"(",
"!",
"factory",
".",
"isManaged",
"(",
")",
")",
"{",
"factory",
"=",
"null",
";",
"}",
"}",
"catch",
"(",
"ManagedObjectException",
"e",
")",
"{",
"throw",
"new",
"EJBConfigurationException",
"(",
"e",
")",
";",
"}",
"}",
"return",
"factory",
";",
"}"
] | Gets a managed object factory for the specified interceptor class, or null if
instances of the class do not need to be managed.
@param bmd the bean metadata
@param klass the interceptor class | [
"Gets",
"a",
"managed",
"object",
"factory",
"for",
"the",
"specified",
"interceptor",
"class",
"or",
"null",
"if",
"instances",
"of",
"the",
"class",
"do",
"not",
"need",
"to",
"be",
"managed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L3341-L3357 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.getEJBManagedObjectFactory | protected <T> ManagedObjectFactory<T> getEJBManagedObjectFactory(BeanMetaData bmd, Class<T> klass) throws EJBConfigurationException {
ManagedObjectFactory<T> factory = null;
ManagedObjectService managedObjectService = getManagedObjectService();
if (managedObjectService != null) {
try {
factory = managedObjectService.createEJBManagedObjectFactory(bmd._moduleMetaData, klass, bmd.j2eeName.getComponent());
//TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory
if (!factory.isManaged()) {
factory = null;
}
} catch (ManagedObjectException e) {
throw new EJBConfigurationException(e);
}
}
return factory;
} | java | protected <T> ManagedObjectFactory<T> getEJBManagedObjectFactory(BeanMetaData bmd, Class<T> klass) throws EJBConfigurationException {
ManagedObjectFactory<T> factory = null;
ManagedObjectService managedObjectService = getManagedObjectService();
if (managedObjectService != null) {
try {
factory = managedObjectService.createEJBManagedObjectFactory(bmd._moduleMetaData, klass, bmd.j2eeName.getComponent());
//TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory
if (!factory.isManaged()) {
factory = null;
}
} catch (ManagedObjectException e) {
throw new EJBConfigurationException(e);
}
}
return factory;
} | [
"protected",
"<",
"T",
">",
"ManagedObjectFactory",
"<",
"T",
">",
"getEJBManagedObjectFactory",
"(",
"BeanMetaData",
"bmd",
",",
"Class",
"<",
"T",
">",
"klass",
")",
"throws",
"EJBConfigurationException",
"{",
"ManagedObjectFactory",
"<",
"T",
">",
"factory",
"=",
"null",
";",
"ManagedObjectService",
"managedObjectService",
"=",
"getManagedObjectService",
"(",
")",
";",
"if",
"(",
"managedObjectService",
"!=",
"null",
")",
"{",
"try",
"{",
"factory",
"=",
"managedObjectService",
".",
"createEJBManagedObjectFactory",
"(",
"bmd",
".",
"_moduleMetaData",
",",
"klass",
",",
"bmd",
".",
"j2eeName",
".",
"getComponent",
"(",
")",
")",
";",
"//TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory",
"if",
"(",
"!",
"factory",
".",
"isManaged",
"(",
")",
")",
"{",
"factory",
"=",
"null",
";",
"}",
"}",
"catch",
"(",
"ManagedObjectException",
"e",
")",
"{",
"throw",
"new",
"EJBConfigurationException",
"(",
"e",
")",
";",
"}",
"}",
"return",
"factory",
";",
"}"
] | Gets a managed object factory for the specified EJB class, or null if
instances of the class do not need to be managed.
@param bmd the bean metadata
@param klass the bean implementation class | [
"Gets",
"a",
"managed",
"object",
"factory",
"for",
"the",
"specified",
"EJB",
"class",
"or",
"null",
"if",
"instances",
"of",
"the",
"class",
"do",
"not",
"need",
"to",
"be",
"managed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L3366-L3382 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.getWrapperProxyClassLoader | private ClassLoader getWrapperProxyClassLoader(BeanMetaData bmd, Class<?> intf) // F58064
throws EJBConfigurationException {
// Wrapper proxies are intended to support application restart scenarios.
// In order to allow GC of the target EJB class loader when the
// application stops, the wrapper proxy class must not be defined by the
// target EJB class loader. Instead, we directly define the class on the
// class loader of the interface.
ClassLoader loader = intf.getClassLoader();
// Classes defined by the boot class loader (i.e., java.lang.Runnable)
// have a null class loader.
if (loader != null) {
try {
loader.loadClass(BusinessLocalWrapperProxy.class.getName());
return loader;
} catch (ClassNotFoundException ex) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "unable to load EJSLocalWrapperProxy for " + intf.getName() + " from " + loader);
}
}
// The class loader of the interface did not have visibility to our
// com.ibm.ejs.container classes, which is required. Attempt to use the
// server class loader instead.
loader = bmd.container.getEJBRuntime().getServerClassLoader();
try {
if (loader.loadClass(intf.getName()) == intf) {
return loader;
}
} catch (ClassNotFoundException ex) {
// Nothing.
}
// The server class loader did not have visibility to the interface
// class. The interface was probably loaded by a non-runtime bundle that
// didn't import com.ibm.ejs.container. Just use the application class
// loader even though this will prevent it from being garbage collected,
// and it will do the wrong thing for package-private methods in
// no-interface view.
return bmd.classLoader; // d727494
} | java | private ClassLoader getWrapperProxyClassLoader(BeanMetaData bmd, Class<?> intf) // F58064
throws EJBConfigurationException {
// Wrapper proxies are intended to support application restart scenarios.
// In order to allow GC of the target EJB class loader when the
// application stops, the wrapper proxy class must not be defined by the
// target EJB class loader. Instead, we directly define the class on the
// class loader of the interface.
ClassLoader loader = intf.getClassLoader();
// Classes defined by the boot class loader (i.e., java.lang.Runnable)
// have a null class loader.
if (loader != null) {
try {
loader.loadClass(BusinessLocalWrapperProxy.class.getName());
return loader;
} catch (ClassNotFoundException ex) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "unable to load EJSLocalWrapperProxy for " + intf.getName() + " from " + loader);
}
}
// The class loader of the interface did not have visibility to our
// com.ibm.ejs.container classes, which is required. Attempt to use the
// server class loader instead.
loader = bmd.container.getEJBRuntime().getServerClassLoader();
try {
if (loader.loadClass(intf.getName()) == intf) {
return loader;
}
} catch (ClassNotFoundException ex) {
// Nothing.
}
// The server class loader did not have visibility to the interface
// class. The interface was probably loaded by a non-runtime bundle that
// didn't import com.ibm.ejs.container. Just use the application class
// loader even though this will prevent it from being garbage collected,
// and it will do the wrong thing for package-private methods in
// no-interface view.
return bmd.classLoader; // d727494
} | [
"private",
"ClassLoader",
"getWrapperProxyClassLoader",
"(",
"BeanMetaData",
"bmd",
",",
"Class",
"<",
"?",
">",
"intf",
")",
"// F58064",
"throws",
"EJBConfigurationException",
"{",
"// Wrapper proxies are intended to support application restart scenarios.",
"// In order to allow GC of the target EJB class loader when the",
"// application stops, the wrapper proxy class must not be defined by the",
"// target EJB class loader. Instead, we directly define the class on the",
"// class loader of the interface.",
"ClassLoader",
"loader",
"=",
"intf",
".",
"getClassLoader",
"(",
")",
";",
"// Classes defined by the boot class loader (i.e., java.lang.Runnable)",
"// have a null class loader.",
"if",
"(",
"loader",
"!=",
"null",
")",
"{",
"try",
"{",
"loader",
".",
"loadClass",
"(",
"BusinessLocalWrapperProxy",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"return",
"loader",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"ex",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"unable to load EJSLocalWrapperProxy for \"",
"+",
"intf",
".",
"getName",
"(",
")",
"+",
"\" from \"",
"+",
"loader",
")",
";",
"}",
"}",
"// The class loader of the interface did not have visibility to our",
"// com.ibm.ejs.container classes, which is required. Attempt to use the",
"// server class loader instead.",
"loader",
"=",
"bmd",
".",
"container",
".",
"getEJBRuntime",
"(",
")",
".",
"getServerClassLoader",
"(",
")",
";",
"try",
"{",
"if",
"(",
"loader",
".",
"loadClass",
"(",
"intf",
".",
"getName",
"(",
")",
")",
"==",
"intf",
")",
"{",
"return",
"loader",
";",
"}",
"}",
"catch",
"(",
"ClassNotFoundException",
"ex",
")",
"{",
"// Nothing.",
"}",
"// The server class loader did not have visibility to the interface",
"// class. The interface was probably loaded by a non-runtime bundle that",
"// didn't import com.ibm.ejs.container. Just use the application class",
"// loader even though this will prevent it from being garbage collected,",
"// and it will do the wrong thing for package-private methods in",
"// no-interface view.",
"return",
"bmd",
".",
"classLoader",
";",
"// d727494",
"}"
] | Returns a class loader that can be used to define a proxy for the
specified interface.
@param bmd the bean metadata
@param intf the interface to proxy
@return the loader
@throws EJBConfigurationException | [
"Returns",
"a",
"class",
"loader",
"that",
"can",
"be",
"used",
"to",
"define",
"a",
"proxy",
"for",
"the",
"specified",
"interface",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L4453-L4495 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.getWrapperProxyConstructor | private Constructor<?> getWrapperProxyConstructor(BeanMetaData bmd,
String proxyClassName,
Class<?> interfaceClass,
Method[] methods) // F58064
throws EJBConfigurationException, ClassNotFoundException {
ClassLoader proxyClassLoader = getWrapperProxyClassLoader(bmd, interfaceClass);
Class<?>[] interfaces = new Class<?>[] { interfaceClass };
Class<?> proxyClass = JITDeploy.generateEJBWrapperProxy(proxyClassLoader, proxyClassName, interfaces, methods,
bmd.container.getEJBRuntime().getClassDefiner()); // F70650
try {
return proxyClass.getConstructor(WrapperProxyState.class);
} catch (NoSuchMethodException ex) {
throw new IllegalStateException(ex);
}
} | java | private Constructor<?> getWrapperProxyConstructor(BeanMetaData bmd,
String proxyClassName,
Class<?> interfaceClass,
Method[] methods) // F58064
throws EJBConfigurationException, ClassNotFoundException {
ClassLoader proxyClassLoader = getWrapperProxyClassLoader(bmd, interfaceClass);
Class<?>[] interfaces = new Class<?>[] { interfaceClass };
Class<?> proxyClass = JITDeploy.generateEJBWrapperProxy(proxyClassLoader, proxyClassName, interfaces, methods,
bmd.container.getEJBRuntime().getClassDefiner()); // F70650
try {
return proxyClass.getConstructor(WrapperProxyState.class);
} catch (NoSuchMethodException ex) {
throw new IllegalStateException(ex);
}
} | [
"private",
"Constructor",
"<",
"?",
">",
"getWrapperProxyConstructor",
"(",
"BeanMetaData",
"bmd",
",",
"String",
"proxyClassName",
",",
"Class",
"<",
"?",
">",
"interfaceClass",
",",
"Method",
"[",
"]",
"methods",
")",
"// F58064",
"throws",
"EJBConfigurationException",
",",
"ClassNotFoundException",
"{",
"ClassLoader",
"proxyClassLoader",
"=",
"getWrapperProxyClassLoader",
"(",
"bmd",
",",
"interfaceClass",
")",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
"=",
"new",
"Class",
"<",
"?",
">",
"[",
"]",
"{",
"interfaceClass",
"}",
";",
"Class",
"<",
"?",
">",
"proxyClass",
"=",
"JITDeploy",
".",
"generateEJBWrapperProxy",
"(",
"proxyClassLoader",
",",
"proxyClassName",
",",
"interfaces",
",",
"methods",
",",
"bmd",
".",
"container",
".",
"getEJBRuntime",
"(",
")",
".",
"getClassDefiner",
"(",
")",
")",
";",
"// F70650",
"try",
"{",
"return",
"proxyClass",
".",
"getConstructor",
"(",
"WrapperProxyState",
".",
"class",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"ex",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"ex",
")",
";",
"}",
"}"
] | Defines a wrapper proxy class and obtains its constructor that accepts a
WrapperProxyStte.
@param bmd the bean metadata
@param proxyClassName the wrapper proxy class name
@param interfaceClass the interface class to proxy
@param methods the methods to define on the proxy
@return the constructor with a WrapperProxyState parameter
@throws EJBConfigurationException if a class loader cannot be found
@throws ClassNotFoundException if class generation fails | [
"Defines",
"a",
"wrapper",
"proxy",
"class",
"and",
"obtains",
"its",
"constructor",
"that",
"accepts",
"a",
"WrapperProxyStte",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L4509-L4524 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.hasEmptyThrowsClause | private static boolean hasEmptyThrowsClause(Method method) {
for (Class<?> klass : method.getExceptionTypes()) {
// Per CTS, callback methods can declare unchecked exceptions on the
// throws clause.
if (!RuntimeException.class.isAssignableFrom(klass) &&
!Error.class.isAssignableFrom(klass)) {
return false;
}
}
return true;
} | java | private static boolean hasEmptyThrowsClause(Method method) {
for (Class<?> klass : method.getExceptionTypes()) {
// Per CTS, callback methods can declare unchecked exceptions on the
// throws clause.
if (!RuntimeException.class.isAssignableFrom(klass) &&
!Error.class.isAssignableFrom(klass)) {
return false;
}
}
return true;
} | [
"private",
"static",
"boolean",
"hasEmptyThrowsClause",
"(",
"Method",
"method",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"klass",
":",
"method",
".",
"getExceptionTypes",
"(",
")",
")",
"{",
"// Per CTS, callback methods can declare unchecked exceptions on the",
"// throws clause.",
"if",
"(",
"!",
"RuntimeException",
".",
"class",
".",
"isAssignableFrom",
"(",
"klass",
")",
"&&",
"!",
"Error",
".",
"class",
".",
"isAssignableFrom",
"(",
"klass",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Returns true if the specified method has an empty throws clause.
@param method the method to check
@return true if the method throws clause is empty | [
"Returns",
"true",
"if",
"the",
"specified",
"method",
"has",
"an",
"empty",
"throws",
"clause",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L4533-L4544 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.dealWithUnsatisifedXMLTimers | private void dealWithUnsatisifedXMLTimers(Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> timers1ParmByMethodName,
Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> timers0ParmByMethodName,
BeanMetaData bmd) throws EJBConfigurationException {
String oneMethodInError = null;
String last1ParmError = dealWithUnsatisfiedXMLTimers(timers1ParmByMethodName, bmd);
String last0ParmError = dealWithUnsatisfiedXMLTimers(timers0ParmByMethodName, bmd);
//We log all the methods-in-error, but we only explicitly callout one of them in the exception, and it doesn't matter which one we pick.
if (last1ParmError != null) {
oneMethodInError = last1ParmError;
} else {
if (last0ParmError != null) {
oneMethodInError = last0ParmError;
}
}
if (oneMethodInError != null) {
throw new EJBConfigurationException("CNTR0210: The " + bmd.j2eeName.getComponent()
+ " enterprise bean in the " + bmd.j2eeName.getModule()
+ " module has an automatic timer configured in the deployment descriptor for the " + oneMethodInError
+ " method, but no timeout callback method with that name was found.");
}
} | java | private void dealWithUnsatisifedXMLTimers(Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> timers1ParmByMethodName,
Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> timers0ParmByMethodName,
BeanMetaData bmd) throws EJBConfigurationException {
String oneMethodInError = null;
String last1ParmError = dealWithUnsatisfiedXMLTimers(timers1ParmByMethodName, bmd);
String last0ParmError = dealWithUnsatisfiedXMLTimers(timers0ParmByMethodName, bmd);
//We log all the methods-in-error, but we only explicitly callout one of them in the exception, and it doesn't matter which one we pick.
if (last1ParmError != null) {
oneMethodInError = last1ParmError;
} else {
if (last0ParmError != null) {
oneMethodInError = last0ParmError;
}
}
if (oneMethodInError != null) {
throw new EJBConfigurationException("CNTR0210: The " + bmd.j2eeName.getComponent()
+ " enterprise bean in the " + bmd.j2eeName.getModule()
+ " module has an automatic timer configured in the deployment descriptor for the " + oneMethodInError
+ " method, but no timeout callback method with that name was found.");
}
} | [
"private",
"void",
"dealWithUnsatisifedXMLTimers",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"ejb",
".",
"Timer",
">",
">",
"timers1ParmByMethodName",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"ejb",
".",
"Timer",
">",
">",
"timers0ParmByMethodName",
",",
"BeanMetaData",
"bmd",
")",
"throws",
"EJBConfigurationException",
"{",
"String",
"oneMethodInError",
"=",
"null",
";",
"String",
"last1ParmError",
"=",
"dealWithUnsatisfiedXMLTimers",
"(",
"timers1ParmByMethodName",
",",
"bmd",
")",
";",
"String",
"last0ParmError",
"=",
"dealWithUnsatisfiedXMLTimers",
"(",
"timers0ParmByMethodName",
",",
"bmd",
")",
";",
"//We log all the methods-in-error, but we only explicitly callout one of them in the exception, and it doesn't matter which one we pick.",
"if",
"(",
"last1ParmError",
"!=",
"null",
")",
"{",
"oneMethodInError",
"=",
"last1ParmError",
";",
"}",
"else",
"{",
"if",
"(",
"last0ParmError",
"!=",
"null",
")",
"{",
"oneMethodInError",
"=",
"last0ParmError",
";",
"}",
"}",
"if",
"(",
"oneMethodInError",
"!=",
"null",
")",
"{",
"throw",
"new",
"EJBConfigurationException",
"(",
"\"CNTR0210: The \"",
"+",
"bmd",
".",
"j2eeName",
".",
"getComponent",
"(",
")",
"+",
"\" enterprise bean in the \"",
"+",
"bmd",
".",
"j2eeName",
".",
"getModule",
"(",
")",
"+",
"\" module has an automatic timer configured in the deployment descriptor for the \"",
"+",
"oneMethodInError",
"+",
"\" method, but no timeout callback method with that name was found.\"",
")",
";",
"}",
"}"
] | Verifies that every timer defined in xml was successfully associated
with a Method.
@param timers1ParmByMethodName List of timers defined in xml with 1 parm.
@param timers0ParmByMethodName List of timers defined in xml with 0 parms.
@param timersUnspecifiedParmByMethodName List of timers defined in xml with unspecified parms.
@param bmd BeanMetaData
@throws EJBConfigurationException | [
"Verifies",
"that",
"every",
"timer",
"defined",
"in",
"xml",
"was",
"successfully",
"associated",
"with",
"a",
"Method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L5258-L5281 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.hasTimeoutCallbackParameters | private boolean hasTimeoutCallbackParameters(MethodMap.MethodInfo methodInfo) {
int numParams = methodInfo.getNumParameters();
return numParams == 0 ||
(numParams == 1 && methodInfo.getParameterType(0) == Timer.class);
} | java | private boolean hasTimeoutCallbackParameters(MethodMap.MethodInfo methodInfo) {
int numParams = methodInfo.getNumParameters();
return numParams == 0 ||
(numParams == 1 && methodInfo.getParameterType(0) == Timer.class);
} | [
"private",
"boolean",
"hasTimeoutCallbackParameters",
"(",
"MethodMap",
".",
"MethodInfo",
"methodInfo",
")",
"{",
"int",
"numParams",
"=",
"methodInfo",
".",
"getNumParameters",
"(",
")",
";",
"return",
"numParams",
"==",
"0",
"||",
"(",
"numParams",
"==",
"1",
"&&",
"methodInfo",
".",
"getParameterType",
"(",
"0",
")",
"==",
"Timer",
".",
"class",
")",
";",
"}"
] | Returns true if the specified method has the proper parameter types for
a timeout callback method.
@param methodInfo the method info
@return true if the method has the proper parameter | [
"Returns",
"true",
"if",
"the",
"specified",
"method",
"has",
"the",
"proper",
"parameter",
"types",
"for",
"a",
"timeout",
"callback",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L5314-L5318 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.addTimerToCorrectMap | private void addTimerToCorrectMap(Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> timers1ParmByMethodName,
Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> timers0ParmByMethodName,
Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> timersUnspecifiedParmByMethodName,
int parmCount,
String methodName,
com.ibm.ws.javaee.dd.ejb.Timer timer) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> mapToUse = null;
if (parmCount == 0) {
mapToUse = timers0ParmByMethodName;
} else if (parmCount == 1) {
mapToUse = timers1ParmByMethodName;
} else {
mapToUse = timersUnspecifiedParmByMethodName;
}
List<com.ibm.ws.javaee.dd.ejb.Timer> timerList = mapToUse.get(methodName);
if (timerList == null) {
timerList = new ArrayList<com.ibm.ws.javaee.dd.ejb.Timer>();
mapToUse.put(methodName, timerList);
}
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "found XML timer for method " + methodName);
}
timerList.add(timer);
} | java | private void addTimerToCorrectMap(Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> timers1ParmByMethodName,
Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> timers0ParmByMethodName,
Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> timersUnspecifiedParmByMethodName,
int parmCount,
String methodName,
com.ibm.ws.javaee.dd.ejb.Timer timer) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> mapToUse = null;
if (parmCount == 0) {
mapToUse = timers0ParmByMethodName;
} else if (parmCount == 1) {
mapToUse = timers1ParmByMethodName;
} else {
mapToUse = timersUnspecifiedParmByMethodName;
}
List<com.ibm.ws.javaee.dd.ejb.Timer> timerList = mapToUse.get(methodName);
if (timerList == null) {
timerList = new ArrayList<com.ibm.ws.javaee.dd.ejb.Timer>();
mapToUse.put(methodName, timerList);
}
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "found XML timer for method " + methodName);
}
timerList.add(timer);
} | [
"private",
"void",
"addTimerToCorrectMap",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"ejb",
".",
"Timer",
">",
">",
"timers1ParmByMethodName",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"ejb",
".",
"Timer",
">",
">",
"timers0ParmByMethodName",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"ejb",
".",
"Timer",
">",
">",
"timersUnspecifiedParmByMethodName",
",",
"int",
"parmCount",
",",
"String",
"methodName",
",",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"ejb",
".",
"Timer",
"timer",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"Map",
"<",
"String",
",",
"List",
"<",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"ejb",
".",
"Timer",
">",
">",
"mapToUse",
"=",
"null",
";",
"if",
"(",
"parmCount",
"==",
"0",
")",
"{",
"mapToUse",
"=",
"timers0ParmByMethodName",
";",
"}",
"else",
"if",
"(",
"parmCount",
"==",
"1",
")",
"{",
"mapToUse",
"=",
"timers1ParmByMethodName",
";",
"}",
"else",
"{",
"mapToUse",
"=",
"timersUnspecifiedParmByMethodName",
";",
"}",
"List",
"<",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"ejb",
".",
"Timer",
">",
"timerList",
"=",
"mapToUse",
".",
"get",
"(",
"methodName",
")",
";",
"if",
"(",
"timerList",
"==",
"null",
")",
"{",
"timerList",
"=",
"new",
"ArrayList",
"<",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"ejb",
".",
"Timer",
">",
"(",
")",
";",
"mapToUse",
".",
"put",
"(",
"methodName",
",",
"timerList",
")",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"found XML timer for method \"",
"+",
"methodName",
")",
";",
"}",
"timerList",
".",
"add",
"(",
"timer",
")",
";",
"}"
] | Sticks a timer defined in xml into the correct list, based on the number
of parameters specified in xml for the timer.
@param timers1ParmByMethodName list of timers specified in xml with 1 parm
@param timers0ParmByMethodName list of timers specified in xml with 0 parms
@param timersUnspecifiedParmByMethodName list of timers specified in xml with undefined parms
@param parmCount number of parms explicitily defined for the timer in xml (1, 0, or -1 for undefined)
@param methodName name of the Method that should be the recipient of the timer callback
@param timer The Timer instance representing the timer defined in xml | [
"Sticks",
"a",
"timer",
"defined",
"in",
"xml",
"into",
"the",
"correct",
"list",
"based",
"on",
"the",
"number",
"of",
"parameters",
"specified",
"in",
"xml",
"for",
"the",
"timer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L5332-L5361 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.findMethodInEJBMethodInfoArray | private EJBMethodInfoImpl findMethodInEJBMethodInfoArray(EJBMethodInfoImpl[] methodInfos, final Method targetMethod) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "findMethodInEJBMethodInfoArray for method \"" + targetMethod.toString() + "\"");
}
for (EJBMethodInfoImpl info : methodInfos) {
if (targetMethod.equals(info.getMethod())) {
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "findMethodInEJBMethodInfoArray found EJBMethodInfoImpl for method \"" + targetMethod.toString() + "\"");
}
return info;
}
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "findMethodInEJBMethodInfoArray did not find EJBMethodInfoImpl for method \"" + targetMethod.toString() + "\"");
}
return null;
} | java | private EJBMethodInfoImpl findMethodInEJBMethodInfoArray(EJBMethodInfoImpl[] methodInfos, final Method targetMethod) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "findMethodInEJBMethodInfoArray for method \"" + targetMethod.toString() + "\"");
}
for (EJBMethodInfoImpl info : methodInfos) {
if (targetMethod.equals(info.getMethod())) {
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "findMethodInEJBMethodInfoArray found EJBMethodInfoImpl for method \"" + targetMethod.toString() + "\"");
}
return info;
}
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "findMethodInEJBMethodInfoArray did not find EJBMethodInfoImpl for method \"" + targetMethod.toString() + "\"");
}
return null;
} | [
"private",
"EJBMethodInfoImpl",
"findMethodInEJBMethodInfoArray",
"(",
"EJBMethodInfoImpl",
"[",
"]",
"methodInfos",
",",
"final",
"Method",
"targetMethod",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"findMethodInEJBMethodInfoArray for method \\\"\"",
"+",
"targetMethod",
".",
"toString",
"(",
")",
"+",
"\"\\\"\"",
")",
";",
"}",
"for",
"(",
"EJBMethodInfoImpl",
"info",
":",
"methodInfos",
")",
"{",
"if",
"(",
"targetMethod",
".",
"equals",
"(",
"info",
".",
"getMethod",
"(",
")",
")",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"findMethodInEJBMethodInfoArray found EJBMethodInfoImpl for method \\\"\"",
"+",
"targetMethod",
".",
"toString",
"(",
")",
"+",
"\"\\\"\"",
")",
";",
"}",
"return",
"info",
";",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"findMethodInEJBMethodInfoArray did not find EJBMethodInfoImpl for method \\\"\"",
"+",
"targetMethod",
".",
"toString",
"(",
")",
"+",
"\"\\\"\"",
")",
";",
"}",
"return",
"null",
";",
"}"
] | d494984.1 - added entire method | [
"d494984",
".",
"1",
"-",
"added",
"entire",
"method"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L6321-L6341 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.processReferenceContext | protected void processReferenceContext(BeanMetaData bmd) throws InjectionException, EJBConfigurationException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "ensureReferenceDataIsProcessed");
// At this point, regardless of whether we are in a pure or hybrid flow,
// we should have a populated ReferenceContext.
//
// Now we attempt to process it. If we are in a pure flow, processing
// will actually occur. If we are in a hybrid flow, processing will
// occur if it has not been done yet (via the webcontainer, or via
// some other bean component). If it has already been done, this
// call will no-op...but thats a black box to us here, and we don't
// know are care if processing actually runs now, or if it already
// ran earlier in time.
ReferenceContext refContext = bmd.ivReferenceContext;
refContext.process();
// Persist output data structures into BMD
bmd._javaNameSpaceContext = refContext.getJavaCompContext(); // F743-17630CodRv
bmd.setJavaNameSpace(refContext.getComponentNameSpace());
bmd._resourceRefList = refContext.getResolvedResourceRefs();
bmd.ivJavaColonCompEnvMap = refContext.getJavaColonCompEnvMap();
bmd.envProps = refContext.getEJBContext10Properties(); // F743-17630CodRv
// F743-21481
// Stick InjectionTargets that are visible to bean class into BMD
bmd.ivBeanInjectionTargets = getInjectionTargets(bmd, bmd.enterpriseBeanClass);
// F743-21481
// Stick the InjectionTargets that are visible to each interceptor
// class into the InterceptorMetaData
InterceptorMetaData imd = bmd.ivInterceptorMetaData;
if (imd != null) {
Class<?>[] interceptorClasses = imd.ivInterceptorClasses;
if (interceptorClasses != null && interceptorClasses.length > 0) {
InjectionTarget[][] interceptorInjectionTargets = new InjectionTarget[interceptorClasses.length][0];
for (int i = 0; i < interceptorClasses.length; i++) {
// The InjectionTarget[] associated with the interceptor class is
// empty (ie, 0 length array) if there are no visible
// InjectionTargets. Its added to the interceptorInjectionTargets
// array anyway because this array needs to have the same length
// as the IMD.ivInterceptorClasses array...ie, each 'row' in this
// array corresponds directly to a class in that array, and if the
// two arrays get out-of-sync, then we have a problem.
Class<?> oneInterceptorClass = interceptorClasses[i];
InjectionTarget[] targets = getInjectionTargets(bmd, oneInterceptorClass);
interceptorInjectionTargets[i] = targets;
}
imd.ivInterceptorInjectionTargets = interceptorInjectionTargets;
}
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Interceptor metadata after adding any InjectionTargets:\n" + imd);
}
if (!EJSPlatformHelper.isZOSCRA()) {
// Verify that a MDB or stateless session bean instance or the
// interceptor instances of MDB and SLSB are not the target of a
// extended persistent context injection since extended persistent
// unit is only allowed for the SFSB and it's interceptor instances.
findAndProcessExtendedPC(bmd); //465813
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "ensureReferenceDataIsProcessed");
} | java | protected void processReferenceContext(BeanMetaData bmd) throws InjectionException, EJBConfigurationException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "ensureReferenceDataIsProcessed");
// At this point, regardless of whether we are in a pure or hybrid flow,
// we should have a populated ReferenceContext.
//
// Now we attempt to process it. If we are in a pure flow, processing
// will actually occur. If we are in a hybrid flow, processing will
// occur if it has not been done yet (via the webcontainer, or via
// some other bean component). If it has already been done, this
// call will no-op...but thats a black box to us here, and we don't
// know are care if processing actually runs now, or if it already
// ran earlier in time.
ReferenceContext refContext = bmd.ivReferenceContext;
refContext.process();
// Persist output data structures into BMD
bmd._javaNameSpaceContext = refContext.getJavaCompContext(); // F743-17630CodRv
bmd.setJavaNameSpace(refContext.getComponentNameSpace());
bmd._resourceRefList = refContext.getResolvedResourceRefs();
bmd.ivJavaColonCompEnvMap = refContext.getJavaColonCompEnvMap();
bmd.envProps = refContext.getEJBContext10Properties(); // F743-17630CodRv
// F743-21481
// Stick InjectionTargets that are visible to bean class into BMD
bmd.ivBeanInjectionTargets = getInjectionTargets(bmd, bmd.enterpriseBeanClass);
// F743-21481
// Stick the InjectionTargets that are visible to each interceptor
// class into the InterceptorMetaData
InterceptorMetaData imd = bmd.ivInterceptorMetaData;
if (imd != null) {
Class<?>[] interceptorClasses = imd.ivInterceptorClasses;
if (interceptorClasses != null && interceptorClasses.length > 0) {
InjectionTarget[][] interceptorInjectionTargets = new InjectionTarget[interceptorClasses.length][0];
for (int i = 0; i < interceptorClasses.length; i++) {
// The InjectionTarget[] associated with the interceptor class is
// empty (ie, 0 length array) if there are no visible
// InjectionTargets. Its added to the interceptorInjectionTargets
// array anyway because this array needs to have the same length
// as the IMD.ivInterceptorClasses array...ie, each 'row' in this
// array corresponds directly to a class in that array, and if the
// two arrays get out-of-sync, then we have a problem.
Class<?> oneInterceptorClass = interceptorClasses[i];
InjectionTarget[] targets = getInjectionTargets(bmd, oneInterceptorClass);
interceptorInjectionTargets[i] = targets;
}
imd.ivInterceptorInjectionTargets = interceptorInjectionTargets;
}
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Interceptor metadata after adding any InjectionTargets:\n" + imd);
}
if (!EJSPlatformHelper.isZOSCRA()) {
// Verify that a MDB or stateless session bean instance or the
// interceptor instances of MDB and SLSB are not the target of a
// extended persistent context injection since extended persistent
// unit is only allowed for the SFSB and it's interceptor instances.
findAndProcessExtendedPC(bmd); //465813
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "ensureReferenceDataIsProcessed");
} | [
"protected",
"void",
"processReferenceContext",
"(",
"BeanMetaData",
"bmd",
")",
"throws",
"InjectionException",
",",
"EJBConfigurationException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"ensureReferenceDataIsProcessed\"",
")",
";",
"// At this point, regardless of whether we are in a pure or hybrid flow,",
"// we should have a populated ReferenceContext.",
"//",
"// Now we attempt to process it. If we are in a pure flow, processing",
"// will actually occur. If we are in a hybrid flow, processing will",
"// occur if it has not been done yet (via the webcontainer, or via",
"// some other bean component). If it has already been done, this",
"// call will no-op...but thats a black box to us here, and we don't",
"// know are care if processing actually runs now, or if it already",
"// ran earlier in time.",
"ReferenceContext",
"refContext",
"=",
"bmd",
".",
"ivReferenceContext",
";",
"refContext",
".",
"process",
"(",
")",
";",
"// Persist output data structures into BMD",
"bmd",
".",
"_javaNameSpaceContext",
"=",
"refContext",
".",
"getJavaCompContext",
"(",
")",
";",
"// F743-17630CodRv",
"bmd",
".",
"setJavaNameSpace",
"(",
"refContext",
".",
"getComponentNameSpace",
"(",
")",
")",
";",
"bmd",
".",
"_resourceRefList",
"=",
"refContext",
".",
"getResolvedResourceRefs",
"(",
")",
";",
"bmd",
".",
"ivJavaColonCompEnvMap",
"=",
"refContext",
".",
"getJavaColonCompEnvMap",
"(",
")",
";",
"bmd",
".",
"envProps",
"=",
"refContext",
".",
"getEJBContext10Properties",
"(",
")",
";",
"// F743-17630CodRv",
"// F743-21481",
"// Stick InjectionTargets that are visible to bean class into BMD",
"bmd",
".",
"ivBeanInjectionTargets",
"=",
"getInjectionTargets",
"(",
"bmd",
",",
"bmd",
".",
"enterpriseBeanClass",
")",
";",
"// F743-21481",
"// Stick the InjectionTargets that are visible to each interceptor",
"// class into the InterceptorMetaData",
"InterceptorMetaData",
"imd",
"=",
"bmd",
".",
"ivInterceptorMetaData",
";",
"if",
"(",
"imd",
"!=",
"null",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"interceptorClasses",
"=",
"imd",
".",
"ivInterceptorClasses",
";",
"if",
"(",
"interceptorClasses",
"!=",
"null",
"&&",
"interceptorClasses",
".",
"length",
">",
"0",
")",
"{",
"InjectionTarget",
"[",
"]",
"[",
"]",
"interceptorInjectionTargets",
"=",
"new",
"InjectionTarget",
"[",
"interceptorClasses",
".",
"length",
"]",
"[",
"0",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"interceptorClasses",
".",
"length",
";",
"i",
"++",
")",
"{",
"// The InjectionTarget[] associated with the interceptor class is",
"// empty (ie, 0 length array) if there are no visible",
"// InjectionTargets. Its added to the interceptorInjectionTargets",
"// array anyway because this array needs to have the same length",
"// as the IMD.ivInterceptorClasses array...ie, each 'row' in this",
"// array corresponds directly to a class in that array, and if the",
"// two arrays get out-of-sync, then we have a problem.",
"Class",
"<",
"?",
">",
"oneInterceptorClass",
"=",
"interceptorClasses",
"[",
"i",
"]",
";",
"InjectionTarget",
"[",
"]",
"targets",
"=",
"getInjectionTargets",
"(",
"bmd",
",",
"oneInterceptorClass",
")",
";",
"interceptorInjectionTargets",
"[",
"i",
"]",
"=",
"targets",
";",
"}",
"imd",
".",
"ivInterceptorInjectionTargets",
"=",
"interceptorInjectionTargets",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Interceptor metadata after adding any InjectionTargets:\\n\"",
"+",
"imd",
")",
";",
"}",
"if",
"(",
"!",
"EJSPlatformHelper",
".",
"isZOSCRA",
"(",
")",
")",
"{",
"// Verify that a MDB or stateless session bean instance or the",
"// interceptor instances of MDB and SLSB are not the target of a",
"// extended persistent context injection since extended persistent",
"// unit is only allowed for the SFSB and it's interceptor instances.",
"findAndProcessExtendedPC",
"(",
"bmd",
")",
";",
"//465813",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"ensureReferenceDataIsProcessed\"",
")",
";",
"}"
] | Ensure that reference data is processed, and that the resulting
output data structures are stuffed in BeanMetaData.
This method gets called during finishBMDInit. If the bean component is part
of a pure module, then its reference data has not been processed yet,
and we go ahead and do that now.
However, if the bean component is part of a hybrid module, then its reference
data was processed between the createMetaData and startModule flows, and so
we do not repeat that work.
In either case, the InjectionEngine processing is completed, and then the
resulting output data structures are persisted into BeanMetaData for future use. | [
"Ensure",
"that",
"reference",
"data",
"is",
"processed",
"and",
"that",
"the",
"resulting",
"output",
"data",
"structures",
"are",
"stuffed",
"in",
"BeanMetaData",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L7326-L7394 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java | EJBMDOrchestrator.removeTemporaryMethodData | private void removeTemporaryMethodData(BeanMetaData bmd) {
bmd.methodsExposedOnLocalHomeInterface = null;
bmd.methodsExposedOnLocalInterface = null;
bmd.methodsExposedOnRemoteHomeInterface = null;
bmd.methodsExposedOnRemoteInterface = null;
bmd.allPublicMethodsOnBean = null;
bmd.methodsToMethodInfos = null;
} | java | private void removeTemporaryMethodData(BeanMetaData bmd) {
bmd.methodsExposedOnLocalHomeInterface = null;
bmd.methodsExposedOnLocalInterface = null;
bmd.methodsExposedOnRemoteHomeInterface = null;
bmd.methodsExposedOnRemoteInterface = null;
bmd.allPublicMethodsOnBean = null;
bmd.methodsToMethodInfos = null;
} | [
"private",
"void",
"removeTemporaryMethodData",
"(",
"BeanMetaData",
"bmd",
")",
"{",
"bmd",
".",
"methodsExposedOnLocalHomeInterface",
"=",
"null",
";",
"bmd",
".",
"methodsExposedOnLocalInterface",
"=",
"null",
";",
"bmd",
".",
"methodsExposedOnRemoteHomeInterface",
"=",
"null",
";",
"bmd",
".",
"methodsExposedOnRemoteInterface",
"=",
"null",
";",
"bmd",
".",
"allPublicMethodsOnBean",
"=",
"null",
";",
"bmd",
".",
"methodsToMethodInfos",
"=",
"null",
";",
"}"
] | Removes temporary lists of data from BMD when they are no longer needed. | [
"Removes",
"temporary",
"lists",
"of",
"data",
"from",
"BMD",
"when",
"they",
"are",
"no",
"longer",
"needed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L7900-L7907 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BrowserSessionImpl.java | BrowserSessionImpl.next | public SIBusMessage next()
throws SISessionUnavailableException, SISessionDroppedException,
SIResourceException, SIConnectionLostException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
SibTr.entry(CoreSPIBrowserSession.tc, "next", this);
JsMessage msg = null;
synchronized(this)
{
//Check that the session is not closed, if it is throw an exception
checkNotClosed();
//if the browse cursor is null - it was pub sub - this
//session will never return any messages
if (_browseCursor != null)
{
try
{
//Get the next item from the browseCursor and cast it
//to a SIMPMessage
msg = _browseCursor.next();
}
catch (SISessionDroppedException e)
{
// MessageStoreException shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BrowserSessionImpl.next",
"1:265:1.78.1.7",
this);
close();
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.BrowserSessionImpl",
"1:274:1.78.1.7",
e });
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
SibTr.exit(CoreSPIBrowserSession.tc, "next", e);
throw e;
}
catch (SIResourceException e)
{
// MessageStoreException shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BrowserSessionImpl.next",
"1:287:1.78.1.7",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.BrowserSessionImpl",
"1:294:1.78.1.7",
e });
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
SibTr.exit(CoreSPIBrowserSession.tc, "next", e);
throw e;
}
}//end if
}//end sync
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(CoreSPIBrowserSession.tc, "next", msg);
return msg;
} | java | public SIBusMessage next()
throws SISessionUnavailableException, SISessionDroppedException,
SIResourceException, SIConnectionLostException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
SibTr.entry(CoreSPIBrowserSession.tc, "next", this);
JsMessage msg = null;
synchronized(this)
{
//Check that the session is not closed, if it is throw an exception
checkNotClosed();
//if the browse cursor is null - it was pub sub - this
//session will never return any messages
if (_browseCursor != null)
{
try
{
//Get the next item from the browseCursor and cast it
//to a SIMPMessage
msg = _browseCursor.next();
}
catch (SISessionDroppedException e)
{
// MessageStoreException shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BrowserSessionImpl.next",
"1:265:1.78.1.7",
this);
close();
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.BrowserSessionImpl",
"1:274:1.78.1.7",
e });
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
SibTr.exit(CoreSPIBrowserSession.tc, "next", e);
throw e;
}
catch (SIResourceException e)
{
// MessageStoreException shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BrowserSessionImpl.next",
"1:287:1.78.1.7",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.BrowserSessionImpl",
"1:294:1.78.1.7",
e });
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
SibTr.exit(CoreSPIBrowserSession.tc, "next", e);
throw e;
}
}//end if
}//end sync
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(CoreSPIBrowserSession.tc, "next", msg);
return msg;
} | [
"public",
"SIBusMessage",
"next",
"(",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"CoreSPIBrowserSession",
".",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"CoreSPIBrowserSession",
".",
"tc",
",",
"\"next\"",
",",
"this",
")",
";",
"JsMessage",
"msg",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"//Check that the session is not closed, if it is throw an exception",
"checkNotClosed",
"(",
")",
";",
"//if the browse cursor is null - it was pub sub - this",
"//session will never return any messages",
"if",
"(",
"_browseCursor",
"!=",
"null",
")",
"{",
"try",
"{",
"//Get the next item from the browseCursor and cast it",
"//to a SIMPMessage",
"msg",
"=",
"_browseCursor",
".",
"next",
"(",
")",
";",
"}",
"catch",
"(",
"SISessionDroppedException",
"e",
")",
"{",
"// MessageStoreException shouldn't occur so FFDC.",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.BrowserSessionImpl.next\"",
",",
"\"1:265:1.78.1.7\"",
",",
"this",
")",
";",
"close",
"(",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.BrowserSessionImpl\"",
",",
"\"1:274:1.78.1.7\"",
",",
"e",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"CoreSPIBrowserSession",
".",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"CoreSPIBrowserSession",
".",
"tc",
",",
"\"next\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"catch",
"(",
"SIResourceException",
"e",
")",
"{",
"// MessageStoreException shouldn't occur so FFDC.",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.BrowserSessionImpl.next\"",
",",
"\"1:287:1.78.1.7\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.BrowserSessionImpl\"",
",",
"\"1:294:1.78.1.7\"",
",",
"e",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"CoreSPIBrowserSession",
".",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"CoreSPIBrowserSession",
".",
"tc",
",",
"\"next\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"}",
"//end if",
"}",
"//end sync",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"CoreSPIBrowserSession",
".",
"tc",
",",
"\"next\"",
",",
"msg",
")",
";",
"return",
"msg",
";",
"}"
] | Gets the next item from the BrowseCursor.
@see com.ibm.wsspi.sib.core.BrowserSession#next() | [
"Gets",
"the",
"next",
"item",
"from",
"the",
"BrowseCursor",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BrowserSessionImpl.java#L206-L280 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BrowserSessionImpl.java | BrowserSessionImpl.close | public void close()
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
SibTr.entry(CoreSPIBrowserSession.tc, "close", this);
synchronized (this)
{
if (!_closed)
//if we're closed already, don't bother doing anything.
{
//dereference from the parent connection
_conn.removeBrowserSession(this);
_close();
}
}
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
SibTr.exit(CoreSPIBrowserSession.tc, "close");
} | java | public void close()
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
SibTr.entry(CoreSPIBrowserSession.tc, "close", this);
synchronized (this)
{
if (!_closed)
//if we're closed already, don't bother doing anything.
{
//dereference from the parent connection
_conn.removeBrowserSession(this);
_close();
}
}
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
SibTr.exit(CoreSPIBrowserSession.tc, "close");
} | [
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"CoreSPIBrowserSession",
".",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"CoreSPIBrowserSession",
".",
"tc",
",",
"\"close\"",
",",
"this",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"!",
"_closed",
")",
"//if we're closed already, don't bother doing anything.",
"{",
"//dereference from the parent connection",
"_conn",
".",
"removeBrowserSession",
"(",
"this",
")",
";",
"_close",
"(",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"CoreSPIBrowserSession",
".",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"CoreSPIBrowserSession",
".",
"tc",
",",
"\"close\"",
")",
";",
"}"
] | Close this BrowserSession...
Dereference from the parent connection and set the closed flag to true.
@see com.ibm.ws.sib.processor.BrowserSession#close() | [
"Close",
"this",
"BrowserSession",
"...",
"Dereference",
"from",
"the",
"parent",
"connection",
"and",
"set",
"the",
"closed",
"flag",
"to",
"true",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BrowserSessionImpl.java#L288-L306 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BrowserSessionImpl.java | BrowserSessionImpl.checkNotClosed | void checkNotClosed() throws SISessionUnavailableException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkNotClosed");
synchronized (this)
{
if (_closed)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed", "Object closed");
throw new SISessionUnavailableException(
nls.getFormattedMessage("OBJECT_CLOSED_ERROR_CWSIP0081",
new Object[] { _dest.getName(),
_dest.getMessageProcessor().getMessagingEngineName() },
null));
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed");
} | java | void checkNotClosed() throws SISessionUnavailableException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkNotClosed");
synchronized (this)
{
if (_closed)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed", "Object closed");
throw new SISessionUnavailableException(
nls.getFormattedMessage("OBJECT_CLOSED_ERROR_CWSIP0081",
new Object[] { _dest.getName(),
_dest.getMessageProcessor().getMessagingEngineName() },
null));
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed");
} | [
"void",
"checkNotClosed",
"(",
")",
"throws",
"SISessionUnavailableException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"checkNotClosed\"",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"_closed",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkNotClosed\"",
",",
"\"Object closed\"",
")",
";",
"throw",
"new",
"SISessionUnavailableException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"OBJECT_CLOSED_ERROR_CWSIP0081\"",
",",
"new",
"Object",
"[",
"]",
"{",
"_dest",
".",
"getName",
"(",
")",
",",
"_dest",
".",
"getMessageProcessor",
"(",
")",
".",
"getMessagingEngineName",
"(",
")",
"}",
",",
"null",
")",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"checkNotClosed\"",
")",
";",
"}"
] | Check if the session is closed. If the closed flag is set to
true, throw an exception.
@throws SISessionUnavailableException thrown if the session is closed | [
"Check",
"if",
"the",
"session",
"is",
"closed",
".",
"If",
"the",
"closed",
"flag",
"is",
"set",
"to",
"true",
"throw",
"an",
"exception",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BrowserSessionImpl.java#L426-L448 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BrowserSessionImpl.java | BrowserSessionImpl.getNamedDestination | public DestinationHandler getNamedDestination()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getNamedDestination");
SibTr.exit(tc, "getNamedDestination", _dest);
}
return _dest;
} | java | public DestinationHandler getNamedDestination()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getNamedDestination");
SibTr.exit(tc, "getNamedDestination", _dest);
}
return _dest;
} | [
"public",
"DestinationHandler",
"getNamedDestination",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getNamedDestination\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getNamedDestination\"",
",",
"_dest",
")",
";",
"}",
"return",
"_dest",
";",
"}"
] | Returns the destination that the session was created against
@return | [
"Returns",
"the",
"destination",
"that",
"the",
"session",
"was",
"created",
"against"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BrowserSessionImpl.java#L552-L560 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/lifecycle/ClientConfig.java | ClientConfig.getUserAgent | public String getUserAgent(FacesContext facesContext)
{
if (userAgent == null)
{
synchronized (this)
{
if (userAgent == null)
{
Map<String, String[]> requestHeaders =
facesContext.getExternalContext().getRequestHeaderValuesMap();
if (requestHeaders != null &&
requestHeaders.containsKey("User-Agent"))
{
String[] userAgents = requestHeaders.get("User-Agent");
userAgent = userAgents.length > 0 ? userAgents[0] : null;
}
}
}
}
return userAgent;
} | java | public String getUserAgent(FacesContext facesContext)
{
if (userAgent == null)
{
synchronized (this)
{
if (userAgent == null)
{
Map<String, String[]> requestHeaders =
facesContext.getExternalContext().getRequestHeaderValuesMap();
if (requestHeaders != null &&
requestHeaders.containsKey("User-Agent"))
{
String[] userAgents = requestHeaders.get("User-Agent");
userAgent = userAgents.length > 0 ? userAgents[0] : null;
}
}
}
}
return userAgent;
} | [
"public",
"String",
"getUserAgent",
"(",
"FacesContext",
"facesContext",
")",
"{",
"if",
"(",
"userAgent",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"userAgent",
"==",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"requestHeaders",
"=",
"facesContext",
".",
"getExternalContext",
"(",
")",
".",
"getRequestHeaderValuesMap",
"(",
")",
";",
"if",
"(",
"requestHeaders",
"!=",
"null",
"&&",
"requestHeaders",
".",
"containsKey",
"(",
"\"User-Agent\"",
")",
")",
"{",
"String",
"[",
"]",
"userAgents",
"=",
"requestHeaders",
".",
"get",
"(",
"\"User-Agent\"",
")",
";",
"userAgent",
"=",
"userAgents",
".",
"length",
">",
"0",
"?",
"userAgents",
"[",
"0",
"]",
":",
"null",
";",
"}",
"}",
"}",
"}",
"return",
"userAgent",
";",
"}"
] | This information will get stored as it cannot
change during the session anyway.
@return the UserAgent of the request. | [
"This",
"information",
"will",
"get",
"stored",
"as",
"it",
"cannot",
"change",
"during",
"the",
"session",
"anyway",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/lifecycle/ClientConfig.java#L179-L201 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/jwk/BigIntegerUtil.java | BigIntegerUtil.decode | public static BigInteger decode(String s) {
byte[] bytes = Base64.decodeBase64(s);
BigInteger bi = new BigInteger(1, bytes);
return bi;
} | java | public static BigInteger decode(String s) {
byte[] bytes = Base64.decodeBase64(s);
BigInteger bi = new BigInteger(1, bytes);
return bi;
} | [
"public",
"static",
"BigInteger",
"decode",
"(",
"String",
"s",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"Base64",
".",
"decodeBase64",
"(",
"s",
")",
";",
"BigInteger",
"bi",
"=",
"new",
"BigInteger",
"(",
"1",
",",
"bytes",
")",
";",
"return",
"bi",
";",
"}"
] | This is in use by FAT only at the writing time | [
"This",
"is",
"in",
"use",
"by",
"FAT",
"only",
"at",
"the",
"writing",
"time"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/jwk/BigIntegerUtil.java#L19-L24 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsDiagnosticModule.java | CommsDiagnosticModule.initialise | public static synchronized void initialise()
{
// Only initialise if it has not already been created
if (_instance == null)
{
// Check what environment we are running in. If we are in server mode we must use the
// server diagnostic module.
//Liberty COMMS TODO:
//For now not enabling server side diagnostics as can not load SERVER_DIAG_MODULE_CLASS in a clean manner
// without having dependency of COMMs server ( at least more than 4/5 classes are needed) which defeat
// the purpose of COMMS client independence w.r.to COMMS server
//Has to rework on load SERVER_DIAG_MODULE_CLASS without too many dependencies of COMMS server.
/*
if (RuntimeInfo.isServer())
{
if (tc.isDebugEnabled()) SibTr.debug(tc, "We are in Server mode");
try
{
Class clazz = Class.forName(CommsConstants.SERVER_DIAG_MODULE_CLASS);
Method getInstanceMethod = clazz.getMethod("getInstance", new Class[0]);
_instance = (CommsDiagnosticModule) getInstanceMethod.invoke(null, (Object[]) null);
}
catch (Exception e)
{
FFDCFilter.processException(e, CLASS_NAME + ".initialise",
CommsConstants.COMMSDIAGMODULE_INITIALIZE_01,
CommsConstants.SERVER_DIAG_MODULE_CLASS);
if (tc.isDebugEnabled()) SibTr.debug(tc, "Unable to load the Comms Server Diagnostic Module", e);
// In this case, fall out of here with a null _instance and default to the client
// one. At least in that case we get _some_ diagnostics...
// This is the point where I mention that that shouldn't ever happen :-).
}
}
*/
// In all other cases use the client diagnostic module. Note we can instantiate this
// directly as we are located in the same build component
if (_instance == null)
{
if (tc.isDebugEnabled()) SibTr.debug(tc, "We are NOT in Server mode");
_instance = ClientCommsDiagnosticModule.getInstance();
}
// Now register the packages
_instance.register(packageList);
}
} | java | public static synchronized void initialise()
{
// Only initialise if it has not already been created
if (_instance == null)
{
// Check what environment we are running in. If we are in server mode we must use the
// server diagnostic module.
//Liberty COMMS TODO:
//For now not enabling server side diagnostics as can not load SERVER_DIAG_MODULE_CLASS in a clean manner
// without having dependency of COMMs server ( at least more than 4/5 classes are needed) which defeat
// the purpose of COMMS client independence w.r.to COMMS server
//Has to rework on load SERVER_DIAG_MODULE_CLASS without too many dependencies of COMMS server.
/*
if (RuntimeInfo.isServer())
{
if (tc.isDebugEnabled()) SibTr.debug(tc, "We are in Server mode");
try
{
Class clazz = Class.forName(CommsConstants.SERVER_DIAG_MODULE_CLASS);
Method getInstanceMethod = clazz.getMethod("getInstance", new Class[0]);
_instance = (CommsDiagnosticModule) getInstanceMethod.invoke(null, (Object[]) null);
}
catch (Exception e)
{
FFDCFilter.processException(e, CLASS_NAME + ".initialise",
CommsConstants.COMMSDIAGMODULE_INITIALIZE_01,
CommsConstants.SERVER_DIAG_MODULE_CLASS);
if (tc.isDebugEnabled()) SibTr.debug(tc, "Unable to load the Comms Server Diagnostic Module", e);
// In this case, fall out of here with a null _instance and default to the client
// one. At least in that case we get _some_ diagnostics...
// This is the point where I mention that that shouldn't ever happen :-).
}
}
*/
// In all other cases use the client diagnostic module. Note we can instantiate this
// directly as we are located in the same build component
if (_instance == null)
{
if (tc.isDebugEnabled()) SibTr.debug(tc, "We are NOT in Server mode");
_instance = ClientCommsDiagnosticModule.getInstance();
}
// Now register the packages
_instance.register(packageList);
}
} | [
"public",
"static",
"synchronized",
"void",
"initialise",
"(",
")",
"{",
"// Only initialise if it has not already been created",
"if",
"(",
"_instance",
"==",
"null",
")",
"{",
"// Check what environment we are running in. If we are in server mode we must use the ",
"// server diagnostic module.",
"//Liberty COMMS TODO:",
"//For now not enabling server side diagnostics as can not load SERVER_DIAG_MODULE_CLASS in a clean manner",
"// without having dependency of COMMs server ( at least more than 4/5 classes are needed) which defeat",
"// the purpose of COMMS client independence w.r.to COMMS server",
"//Has to rework on load SERVER_DIAG_MODULE_CLASS without too many dependencies of COMMS server.",
"/*\n if (RuntimeInfo.isServer())\n {\n if (tc.isDebugEnabled()) SibTr.debug(tc, \"We are in Server mode\");\n \n try\n {\n Class clazz = Class.forName(CommsConstants.SERVER_DIAG_MODULE_CLASS);\n Method getInstanceMethod = clazz.getMethod(\"getInstance\", new Class[0]);\n _instance = (CommsDiagnosticModule) getInstanceMethod.invoke(null, (Object[]) null);\n }\n catch (Exception e)\n {\n FFDCFilter.processException(e, CLASS_NAME + \".initialise\", \n CommsConstants.COMMSDIAGMODULE_INITIALIZE_01,\n CommsConstants.SERVER_DIAG_MODULE_CLASS);\n \n if (tc.isDebugEnabled()) SibTr.debug(tc, \"Unable to load the Comms Server Diagnostic Module\", e);\n \n // In this case, fall out of here with a null _instance and default to the client\n // one. At least in that case we get _some_ diagnostics...\n // This is the point where I mention that that shouldn't ever happen :-).\n }\n }\n */",
"// In all other cases use the client diagnostic module. Note we can instantiate this",
"// directly as we are located in the same build component",
"if",
"(",
"_instance",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"We are NOT in Server mode\"",
")",
";",
"_instance",
"=",
"ClientCommsDiagnosticModule",
".",
"getInstance",
"(",
")",
";",
"}",
"// Now register the packages",
"_instance",
".",
"register",
"(",
"packageList",
")",
";",
"}",
"}"
] | Initialises the diagnostic module. | [
"Initialises",
"the",
"diagnostic",
"module",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsDiagnosticModule.java#L53-L104 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsDiagnosticModule.java | CommsDiagnosticModule.ffdcDumpDefault | public void ffdcDumpDefault(Throwable t, IncidentStream is, Object callerThis, Object[] objs, String sourceId)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "ffdcDumpDefault",
new Object[]{t, is, callerThis, objs, sourceId});
// Dump the SIB information
super.ffdcDumpDefault(t, is, callerThis, objs, sourceId);
is.writeLine("\n= ============= SIB Communications Diagnostic Information =============", "");
is.writeLine("Current Diagnostic Module: ", _instance);
dumpJFapClientStatus(is);
dumpJFapServerStatus(is);
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "ffdcDumpDefault");
} | java | public void ffdcDumpDefault(Throwable t, IncidentStream is, Object callerThis, Object[] objs, String sourceId)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "ffdcDumpDefault",
new Object[]{t, is, callerThis, objs, sourceId});
// Dump the SIB information
super.ffdcDumpDefault(t, is, callerThis, objs, sourceId);
is.writeLine("\n= ============= SIB Communications Diagnostic Information =============", "");
is.writeLine("Current Diagnostic Module: ", _instance);
dumpJFapClientStatus(is);
dumpJFapServerStatus(is);
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "ffdcDumpDefault");
} | [
"public",
"void",
"ffdcDumpDefault",
"(",
"Throwable",
"t",
",",
"IncidentStream",
"is",
",",
"Object",
"callerThis",
",",
"Object",
"[",
"]",
"objs",
",",
"String",
"sourceId",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"ffdcDumpDefault\"",
",",
"new",
"Object",
"[",
"]",
"{",
"t",
",",
"is",
",",
"callerThis",
",",
"objs",
",",
"sourceId",
"}",
")",
";",
"// Dump the SIB information",
"super",
".",
"ffdcDumpDefault",
"(",
"t",
",",
"is",
",",
"callerThis",
",",
"objs",
",",
"sourceId",
")",
";",
"is",
".",
"writeLine",
"(",
"\"\\n= ============= SIB Communications Diagnostic Information =============\"",
",",
"\"\"",
")",
";",
"is",
".",
"writeLine",
"(",
"\"Current Diagnostic Module: \"",
",",
"_instance",
")",
";",
"dumpJFapClientStatus",
"(",
"is",
")",
";",
"dumpJFapServerStatus",
"(",
"is",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"ffdcDumpDefault\"",
")",
";",
"}"
] | Called when an FFDC is generated and the stack matches one of our packages.
@see com.ibm.ws.sib.utils.ffdc.SibDiagnosticModule#ffdcDumpDefault(java.lang.Throwable, com.ibm.ws.ffdc.IncidentStream, java.lang.Object, java.lang.Object[], java.lang.String) | [
"Called",
"when",
"an",
"FFDC",
"is",
"generated",
"and",
"the",
"stack",
"matches",
"one",
"of",
"our",
"packages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsDiagnosticModule.java#L111-L126 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultImpl.java | RemoteAsyncResultImpl.setObserver | boolean setObserver(Observer observer) { // F16043
boolean success;
Observer oldObserver;
synchronized (this) {
oldObserver = ivObserver;
success = oldObserver != null || !isDone();
ivObserver = success ? observer : null;
}
if (oldObserver != null) {
oldObserver.update(null, observer);
}
return success;
} | java | boolean setObserver(Observer observer) { // F16043
boolean success;
Observer oldObserver;
synchronized (this) {
oldObserver = ivObserver;
success = oldObserver != null || !isDone();
ivObserver = success ? observer : null;
}
if (oldObserver != null) {
oldObserver.update(null, observer);
}
return success;
} | [
"boolean",
"setObserver",
"(",
"Observer",
"observer",
")",
"{",
"// F16043",
"boolean",
"success",
";",
"Observer",
"oldObserver",
";",
"synchronized",
"(",
"this",
")",
"{",
"oldObserver",
"=",
"ivObserver",
";",
"success",
"=",
"oldObserver",
"!=",
"null",
"||",
"!",
"isDone",
"(",
")",
";",
"ivObserver",
"=",
"success",
"?",
"observer",
":",
"null",
";",
"}",
"if",
"(",
"oldObserver",
"!=",
"null",
")",
"{",
"oldObserver",
".",
"update",
"(",
"null",
",",
"observer",
")",
";",
"}",
"return",
"success",
";",
"}"
] | Sets the current observer and updates the pending one. If the result is
already available, the existing observer if any will be updated and
passed the new observer as data. Otherwise, the observer will be updated
when the result is available and will be passed null as data.
@param observer the new observer
@return true if the observer was set, or false if the result is available | [
"Sets",
"the",
"current",
"observer",
"and",
"updates",
"the",
"pending",
"one",
".",
"If",
"the",
"result",
"is",
"already",
"available",
"the",
"existing",
"observer",
"if",
"any",
"will",
"be",
"updated",
"and",
"passed",
"the",
"new",
"observer",
"as",
"data",
".",
"Otherwise",
"the",
"observer",
"will",
"be",
"updated",
"when",
"the",
"result",
"is",
"available",
"and",
"will",
"be",
"passed",
"null",
"as",
"data",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultImpl.java#L128-L142 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultImpl.java | RemoteAsyncResultImpl.cleanup | private void cleanup() { // d623593
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "cleanup");
synchronized (ivRemoteAsyncResultReaper) {
if (ivAddedToReaper) { // d690014
// d690014.3 - The call to remove will remove the result from the
// reaper and then call unexportObject itself.
this.ivRemoteAsyncResultReaper.remove(this);
} else {
unexportObject();
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "cleanup");
} | java | private void cleanup() { // d623593
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "cleanup");
synchronized (ivRemoteAsyncResultReaper) {
if (ivAddedToReaper) { // d690014
// d690014.3 - The call to remove will remove the result from the
// reaper and then call unexportObject itself.
this.ivRemoteAsyncResultReaper.remove(this);
} else {
unexportObject();
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "cleanup");
} | [
"private",
"void",
"cleanup",
"(",
")",
"{",
"// d623593",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"cleanup\"",
")",
";",
"synchronized",
"(",
"ivRemoteAsyncResultReaper",
")",
"{",
"if",
"(",
"ivAddedToReaper",
")",
"{",
"// d690014",
"// d690014.3 - The call to remove will remove the result from the",
"// reaper and then call unexportObject itself.",
"this",
".",
"ivRemoteAsyncResultReaper",
".",
"remove",
"(",
"this",
")",
";",
"}",
"else",
"{",
"unexportObject",
"(",
")",
";",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"cleanup\"",
")",
";",
"}"
] | Clean up all resources associated with this object. | [
"Clean",
"up",
"all",
"resources",
"associated",
"with",
"this",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultImpl.java#L218-L236 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultImpl.java | RemoteAsyncResultImpl.exportObject | RemoteAsyncResult exportObject() throws RemoteException {
ivObjectID = ivRemoteRuntime.activateAsyncResult((Servant) createTie());
return ivRemoteRuntime.getAsyncResultReference(ivObjectID);
} | java | RemoteAsyncResult exportObject() throws RemoteException {
ivObjectID = ivRemoteRuntime.activateAsyncResult((Servant) createTie());
return ivRemoteRuntime.getAsyncResultReference(ivObjectID);
} | [
"RemoteAsyncResult",
"exportObject",
"(",
")",
"throws",
"RemoteException",
"{",
"ivObjectID",
"=",
"ivRemoteRuntime",
".",
"activateAsyncResult",
"(",
"(",
"Servant",
")",
"createTie",
"(",
")",
")",
";",
"return",
"ivRemoteRuntime",
".",
"getAsyncResultReference",
"(",
"ivObjectID",
")",
";",
"}"
] | Export this object so that it is remotely accessible.
<p>This method must be called before the async work is scheduled. | [
"Export",
"this",
"object",
"so",
"that",
"it",
"is",
"remotely",
"accessible",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultImpl.java#L243-L246 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultImpl.java | RemoteAsyncResultImpl.unexportObject | protected void unexportObject() { // d623593
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "unexportObject: " + this);
if (ivObjectID != null) {
// Either the allowed timeout occurred or a method was called and we
// know that the client no longer needs this server resource.
try {
ivRemoteRuntime.deactivateAsyncResult(ivObjectID);
} catch (Throwable e) {
// We failed to unexport the object. This should never happen, but
// it's not fatal.
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "unexportObject exception", e);
FFDCFilter.processException(e, CLASS_NAME + ".unexportObject", "237", this);
}
this.ivObjectID = null;
}
} | java | protected void unexportObject() { // d623593
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "unexportObject: " + this);
if (ivObjectID != null) {
// Either the allowed timeout occurred or a method was called and we
// know that the client no longer needs this server resource.
try {
ivRemoteRuntime.deactivateAsyncResult(ivObjectID);
} catch (Throwable e) {
// We failed to unexport the object. This should never happen, but
// it's not fatal.
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "unexportObject exception", e);
FFDCFilter.processException(e, CLASS_NAME + ".unexportObject", "237", this);
}
this.ivObjectID = null;
}
} | [
"protected",
"void",
"unexportObject",
"(",
")",
"{",
"// d623593",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"unexportObject: \"",
"+",
"this",
")",
";",
"if",
"(",
"ivObjectID",
"!=",
"null",
")",
"{",
"// Either the allowed timeout occurred or a method was called and we",
"// know that the client no longer needs this server resource.",
"try",
"{",
"ivRemoteRuntime",
".",
"deactivateAsyncResult",
"(",
"ivObjectID",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"// We failed to unexport the object. This should never happen, but",
"// it's not fatal.",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"unexportObject exception\"",
",",
"e",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".unexportObject\"",
",",
"\"237\"",
",",
"this",
")",
";",
"}",
"this",
".",
"ivObjectID",
"=",
"null",
";",
"}",
"}"
] | Unexport this object so that it is not remotely accessible.
<p>The caller must be holding the monitor lock on the
RemoteAsyncResultReaper prior to calling this method if the async work
was successfully scheduled. | [
"Unexport",
"this",
"object",
"so",
"that",
"it",
"is",
"not",
"remotely",
"accessible",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.async/src/com/ibm/ws/ejbcontainer/async/osgi/internal/RemoteAsyncResultImpl.java#L287-L307 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanIdCache.java | BeanIdCache.find | public BeanId find(EJSHome home, Serializable pkey, boolean isHome)
{
int hashValue = BeanId.computeHashValue(home.j2eeName, pkey, isHome);
BeanId[] buckets = this.ivBuckets;
BeanId element = buckets[(hashValue & 0x7FFFFFFF) % buckets.length];
if (element == null || !element.equals(home, pkey, isHome))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
++ivCacheFinds;
Tr.debug(tc, "BeanId not found in BeanId Cache : " +
ivCacheHits + " / " + ivCacheFinds);
}
element = new BeanId(home, pkey, isHome);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
++ivCacheFinds;
++ivCacheHits;
Tr.debug(tc, "BeanId found in BeanId Cache : " +
ivCacheHits + " / " + ivCacheFinds);
}
}
return element;
} | java | public BeanId find(EJSHome home, Serializable pkey, boolean isHome)
{
int hashValue = BeanId.computeHashValue(home.j2eeName, pkey, isHome);
BeanId[] buckets = this.ivBuckets;
BeanId element = buckets[(hashValue & 0x7FFFFFFF) % buckets.length];
if (element == null || !element.equals(home, pkey, isHome))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
++ivCacheFinds;
Tr.debug(tc, "BeanId not found in BeanId Cache : " +
ivCacheHits + " / " + ivCacheFinds);
}
element = new BeanId(home, pkey, isHome);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
++ivCacheFinds;
++ivCacheHits;
Tr.debug(tc, "BeanId found in BeanId Cache : " +
ivCacheHits + " / " + ivCacheFinds);
}
}
return element;
} | [
"public",
"BeanId",
"find",
"(",
"EJSHome",
"home",
",",
"Serializable",
"pkey",
",",
"boolean",
"isHome",
")",
"{",
"int",
"hashValue",
"=",
"BeanId",
".",
"computeHashValue",
"(",
"home",
".",
"j2eeName",
",",
"pkey",
",",
"isHome",
")",
";",
"BeanId",
"[",
"]",
"buckets",
"=",
"this",
".",
"ivBuckets",
";",
"BeanId",
"element",
"=",
"buckets",
"[",
"(",
"hashValue",
"&",
"0x7FFFFFFF",
")",
"%",
"buckets",
".",
"length",
"]",
";",
"if",
"(",
"element",
"==",
"null",
"||",
"!",
"element",
".",
"equals",
"(",
"home",
",",
"pkey",
",",
"isHome",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"++",
"ivCacheFinds",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"BeanId not found in BeanId Cache : \"",
"+",
"ivCacheHits",
"+",
"\" / \"",
"+",
"ivCacheFinds",
")",
";",
"}",
"element",
"=",
"new",
"BeanId",
"(",
"home",
",",
"pkey",
",",
"isHome",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"++",
"ivCacheFinds",
";",
"++",
"ivCacheHits",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"BeanId found in BeanId Cache : \"",
"+",
"ivCacheHits",
"+",
"\" / \"",
"+",
"ivCacheFinds",
")",
";",
"}",
"}",
"return",
"element",
";",
"}"
] | d156807.3 Begins | [
"d156807",
".",
"3",
"Begins"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanIdCache.java#L102-L131 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java | FaceletCacheImpl.needsToBeRefreshed | protected boolean needsToBeRefreshed(DefaultFacelet facelet)
{
// if set to 0, constantly reload-- nocache
if (_refreshPeriod == NO_CACHE_DELAY)
{
return true;
}
// if set to -1, never reload
if (_refreshPeriod == INFINITE_DELAY)
{
return false;
}
long target = facelet.getCreateTime() + _refreshPeriod;
if (System.currentTimeMillis() > target)
{
// Should check for file modification
URLConnection conn = null;
try
{
conn = facelet.getSource().openConnection();
long lastModified = ResourceLoaderUtils.getResourceLastModified(conn);
return lastModified == 0 || lastModified > target;
}
catch (IOException e)
{
throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(), e);
}
finally
{
// finally close input stream when finished, if fails just continue.
if (conn != null)
{
try
{
InputStream is = conn.getInputStream();
if (is != null)
{
is.close();
}
}
catch (IOException e)
{
// Ignore
}
}
}
}
return false;
} | java | protected boolean needsToBeRefreshed(DefaultFacelet facelet)
{
// if set to 0, constantly reload-- nocache
if (_refreshPeriod == NO_CACHE_DELAY)
{
return true;
}
// if set to -1, never reload
if (_refreshPeriod == INFINITE_DELAY)
{
return false;
}
long target = facelet.getCreateTime() + _refreshPeriod;
if (System.currentTimeMillis() > target)
{
// Should check for file modification
URLConnection conn = null;
try
{
conn = facelet.getSource().openConnection();
long lastModified = ResourceLoaderUtils.getResourceLastModified(conn);
return lastModified == 0 || lastModified > target;
}
catch (IOException e)
{
throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(), e);
}
finally
{
// finally close input stream when finished, if fails just continue.
if (conn != null)
{
try
{
InputStream is = conn.getInputStream();
if (is != null)
{
is.close();
}
}
catch (IOException e)
{
// Ignore
}
}
}
}
return false;
} | [
"protected",
"boolean",
"needsToBeRefreshed",
"(",
"DefaultFacelet",
"facelet",
")",
"{",
"// if set to 0, constantly reload-- nocache",
"if",
"(",
"_refreshPeriod",
"==",
"NO_CACHE_DELAY",
")",
"{",
"return",
"true",
";",
"}",
"// if set to -1, never reload",
"if",
"(",
"_refreshPeriod",
"==",
"INFINITE_DELAY",
")",
"{",
"return",
"false",
";",
"}",
"long",
"target",
"=",
"facelet",
".",
"getCreateTime",
"(",
")",
"+",
"_refreshPeriod",
";",
"if",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
">",
"target",
")",
"{",
"// Should check for file modification",
"URLConnection",
"conn",
"=",
"null",
";",
"try",
"{",
"conn",
"=",
"facelet",
".",
"getSource",
"(",
")",
".",
"openConnection",
"(",
")",
";",
"long",
"lastModified",
"=",
"ResourceLoaderUtils",
".",
"getResourceLastModified",
"(",
"conn",
")",
";",
"return",
"lastModified",
"==",
"0",
"||",
"lastModified",
">",
"target",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"FaceletException",
"(",
"\"Error Checking Last Modified for \"",
"+",
"facelet",
".",
"getAlias",
"(",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"// finally close input stream when finished, if fails just continue.",
"if",
"(",
"conn",
"!=",
"null",
")",
"{",
"try",
"{",
"InputStream",
"is",
"=",
"conn",
".",
"getInputStream",
"(",
")",
";",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"is",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// Ignore ",
"}",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | Template method for determining if the Facelet needs to be refreshed.
@param facelet
Facelet that could have expired
@return true if it needs to be refreshed | [
"Template",
"method",
"for",
"determining",
"if",
"the",
"Facelet",
"needs",
"to",
"be",
"refreshed",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java#L139-L192 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PatternWrapper.java | PatternWrapper.getState | int getState() {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "getState");
int state;
if (!prefixDone) {
// Somewhere in the prefix or at beginning and there is no prefix
Pattern.Clause prefix = pattern.getPrefix();
if (prefix == null || next >= prefix.items.length) {
// There is no prefix or we're at the end of it
Pattern.Clause suffix = pattern.getSuffix();
// Answer depends on the suffix
state = suffix == null ? FINAL_MANY : suffix == prefix ? FINAL_EXACT
: SWITCH_TO_SUFFIX;
}
else
// We're somewhere in the body of the prefix
state = prefix.items[next] == Pattern.matchOne ? SKIP_ONE_PREFIX : PREFIX_CHARS;
}
else {
// We're in the suffix
Pattern.Clause suffix = pattern.getSuffix();
state = (next < 0) ? FINAL_MANY
: suffix.items[next] == Pattern.matchOne ? SKIP_ONE_SUFFIX : SUFFIX_CHARS;
}
if (tc.isEntryEnabled())
tc.exit(this,cclass, "getState", new Integer(state));
return state;
} | java | int getState() {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "getState");
int state;
if (!prefixDone) {
// Somewhere in the prefix or at beginning and there is no prefix
Pattern.Clause prefix = pattern.getPrefix();
if (prefix == null || next >= prefix.items.length) {
// There is no prefix or we're at the end of it
Pattern.Clause suffix = pattern.getSuffix();
// Answer depends on the suffix
state = suffix == null ? FINAL_MANY : suffix == prefix ? FINAL_EXACT
: SWITCH_TO_SUFFIX;
}
else
// We're somewhere in the body of the prefix
state = prefix.items[next] == Pattern.matchOne ? SKIP_ONE_PREFIX : PREFIX_CHARS;
}
else {
// We're in the suffix
Pattern.Clause suffix = pattern.getSuffix();
state = (next < 0) ? FINAL_MANY
: suffix.items[next] == Pattern.matchOne ? SKIP_ONE_SUFFIX : SUFFIX_CHARS;
}
if (tc.isEntryEnabled())
tc.exit(this,cclass, "getState", new Integer(state));
return state;
} | [
"int",
"getState",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"getState\"",
")",
";",
"int",
"state",
";",
"if",
"(",
"!",
"prefixDone",
")",
"{",
"// Somewhere in the prefix or at beginning and there is no prefix",
"Pattern",
".",
"Clause",
"prefix",
"=",
"pattern",
".",
"getPrefix",
"(",
")",
";",
"if",
"(",
"prefix",
"==",
"null",
"||",
"next",
">=",
"prefix",
".",
"items",
".",
"length",
")",
"{",
"// There is no prefix or we're at the end of it",
"Pattern",
".",
"Clause",
"suffix",
"=",
"pattern",
".",
"getSuffix",
"(",
")",
";",
"// Answer depends on the suffix",
"state",
"=",
"suffix",
"==",
"null",
"?",
"FINAL_MANY",
":",
"suffix",
"==",
"prefix",
"?",
"FINAL_EXACT",
":",
"SWITCH_TO_SUFFIX",
";",
"}",
"else",
"// We're somewhere in the body of the prefix",
"state",
"=",
"prefix",
".",
"items",
"[",
"next",
"]",
"==",
"Pattern",
".",
"matchOne",
"?",
"SKIP_ONE_PREFIX",
":",
"PREFIX_CHARS",
";",
"}",
"else",
"{",
"// We're in the suffix",
"Pattern",
".",
"Clause",
"suffix",
"=",
"pattern",
".",
"getSuffix",
"(",
")",
";",
"state",
"=",
"(",
"next",
"<",
"0",
")",
"?",
"FINAL_MANY",
":",
"suffix",
".",
"items",
"[",
"next",
"]",
"==",
"Pattern",
".",
"matchOne",
"?",
"SKIP_ONE_SUFFIX",
":",
"SUFFIX_CHARS",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"getState\"",
",",
"new",
"Integer",
"(",
"state",
")",
")",
";",
"return",
"state",
";",
"}"
] | Get the state of this Pattern (which item is next to process | [
"Get",
"the",
"state",
"of",
"this",
"Pattern",
"(",
"which",
"item",
"is",
"next",
"to",
"process"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PatternWrapper.java#L74-L101 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PatternWrapper.java | PatternWrapper.advance | void advance() {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "advance");
if (!prefixDone) {
Pattern.Clause prefix = pattern.getPrefix();
if (prefix == null || next >= prefix.items.length) {
Pattern.Clause suffix = pattern.getSuffix();
if (suffix != null && suffix != prefix) {
// SWITCH_TO_SUFFIX
prefixDone = true;
next = suffix.items.length-1;
}
// else in one of the FINAL_ states, so do nothing
}
else
// somewhere in the body of the prefix, so advance by incrementing
next++;
}
else
// somewhere in the suffix, so advance by decrementing
next--;
if (tc.isEntryEnabled())
tc.exit(this,cclass, "advance");
} | java | void advance() {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "advance");
if (!prefixDone) {
Pattern.Clause prefix = pattern.getPrefix();
if (prefix == null || next >= prefix.items.length) {
Pattern.Clause suffix = pattern.getSuffix();
if (suffix != null && suffix != prefix) {
// SWITCH_TO_SUFFIX
prefixDone = true;
next = suffix.items.length-1;
}
// else in one of the FINAL_ states, so do nothing
}
else
// somewhere in the body of the prefix, so advance by incrementing
next++;
}
else
// somewhere in the suffix, so advance by decrementing
next--;
if (tc.isEntryEnabled())
tc.exit(this,cclass, "advance");
} | [
"void",
"advance",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"advance\"",
")",
";",
"if",
"(",
"!",
"prefixDone",
")",
"{",
"Pattern",
".",
"Clause",
"prefix",
"=",
"pattern",
".",
"getPrefix",
"(",
")",
";",
"if",
"(",
"prefix",
"==",
"null",
"||",
"next",
">=",
"prefix",
".",
"items",
".",
"length",
")",
"{",
"Pattern",
".",
"Clause",
"suffix",
"=",
"pattern",
".",
"getSuffix",
"(",
")",
";",
"if",
"(",
"suffix",
"!=",
"null",
"&&",
"suffix",
"!=",
"prefix",
")",
"{",
"// SWITCH_TO_SUFFIX",
"prefixDone",
"=",
"true",
";",
"next",
"=",
"suffix",
".",
"items",
".",
"length",
"-",
"1",
";",
"}",
"// else in one of the FINAL_ states, so do nothing",
"}",
"else",
"// somewhere in the body of the prefix, so advance by incrementing",
"next",
"++",
";",
"}",
"else",
"// somewhere in the suffix, so advance by decrementing",
"next",
"--",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"advance\"",
")",
";",
"}"
] | Advance the state of this pattern | [
"Advance",
"the",
"state",
"of",
"this",
"pattern"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PatternWrapper.java#L104-L127 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PatternWrapper.java | PatternWrapper.getChars | char[] getChars() {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "getChars");
char[] ans;
if (prefixDone)
ans = (char[]) pattern.getSuffix().items[next--];
else
ans = (char[]) pattern.getPrefix().items[next++];
if (tc.isEntryEnabled())
tc.exit(this,cclass, "getChars", new String(ans));
return ans;
} | java | char[] getChars() {
if (tc.isEntryEnabled())
tc.entry(this,cclass, "getChars");
char[] ans;
if (prefixDone)
ans = (char[]) pattern.getSuffix().items[next--];
else
ans = (char[]) pattern.getPrefix().items[next++];
if (tc.isEntryEnabled())
tc.exit(this,cclass, "getChars", new String(ans));
return ans;
} | [
"char",
"[",
"]",
"getChars",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"getChars\"",
")",
";",
"char",
"[",
"]",
"ans",
";",
"if",
"(",
"prefixDone",
")",
"ans",
"=",
"(",
"char",
"[",
"]",
")",
"pattern",
".",
"getSuffix",
"(",
")",
".",
"items",
"[",
"next",
"--",
"]",
";",
"else",
"ans",
"=",
"(",
"char",
"[",
"]",
")",
"pattern",
".",
"getPrefix",
"(",
")",
".",
"items",
"[",
"next",
"++",
"]",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"getChars\"",
",",
"new",
"String",
"(",
"ans",
")",
")",
";",
"return",
"ans",
";",
"}"
] | Get the characters and advance (assumes the pattern is in one of the CHARS states | [
"Get",
"the",
"characters",
"and",
"advance",
"(",
"assumes",
"the",
"pattern",
"is",
"in",
"one",
"of",
"the",
"CHARS",
"states"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PatternWrapper.java#L130-L141 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PatternWrapper.java | PatternWrapper.matchMidClauses | public boolean matchMidClauses(char[] chars, int start, int length)
{
return pattern.matchMiddle(chars, start, start+length);
} | java | public boolean matchMidClauses(char[] chars, int start, int length)
{
return pattern.matchMiddle(chars, start, start+length);
} | [
"public",
"boolean",
"matchMidClauses",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"return",
"pattern",
".",
"matchMiddle",
"(",
"chars",
",",
"start",
",",
"start",
"+",
"length",
")",
";",
"}"
] | Test whether the underlying pattern's mid clauses match a set of characters.
@param chars
@param start
@param length
@return | [
"Test",
"whether",
"the",
"underlying",
"pattern",
"s",
"mid",
"clauses",
"match",
"a",
"set",
"of",
"characters",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PatternWrapper.java#L162-L166 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java | URIDestinationCreator.extractPropertyFromURI | public String extractPropertyFromURI(String propName, String uri) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "extractPropertyFromURI", new Object[]{propName, uri});
String result = null;
// only something to do if uri is non-null & non-empty u
if (uri != null) {
uri = uri.trim();
if (!uri.equals("")) {
String[] parts = splitOnNonEscapedChar(uri, '?', 2);
// parts[1] (if present) is the NVPs, so only something to do if present & non-empty
if (parts.length >= 2) {
String nvps = parts[1].trim();
if (!nvps.equals("")) {
// break the nvps string into an array of name=value strings
// Use a regular expression to split on an '&' only if it isn't preceeded by a '\'.
String[] nvpArray = splitOnNonEscapedChar(nvps, '&', -1);
// Search the array for the named property
String propNameE = propName+"=";
for (int i = 0; i < nvpArray.length; i++) {
String nvp = nvpArray[i];
if (nvp.startsWith(propNameE)) {
// everything after the = is the value
result = nvp.substring(propNameE.length());
break; // exit the loop
}
}
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "extractPropertyFromURI", result);
return result;
} | java | public String extractPropertyFromURI(String propName, String uri) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "extractPropertyFromURI", new Object[]{propName, uri});
String result = null;
// only something to do if uri is non-null & non-empty u
if (uri != null) {
uri = uri.trim();
if (!uri.equals("")) {
String[] parts = splitOnNonEscapedChar(uri, '?', 2);
// parts[1] (if present) is the NVPs, so only something to do if present & non-empty
if (parts.length >= 2) {
String nvps = parts[1].trim();
if (!nvps.equals("")) {
// break the nvps string into an array of name=value strings
// Use a regular expression to split on an '&' only if it isn't preceeded by a '\'.
String[] nvpArray = splitOnNonEscapedChar(nvps, '&', -1);
// Search the array for the named property
String propNameE = propName+"=";
for (int i = 0; i < nvpArray.length; i++) {
String nvp = nvpArray[i];
if (nvp.startsWith(propNameE)) {
// everything after the = is the value
result = nvp.substring(propNameE.length());
break; // exit the loop
}
}
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "extractPropertyFromURI", result);
return result;
} | [
"public",
"String",
"extractPropertyFromURI",
"(",
"String",
"propName",
",",
"String",
"uri",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"extractPropertyFromURI\"",
",",
"new",
"Object",
"[",
"]",
"{",
"propName",
",",
"uri",
"}",
")",
";",
"String",
"result",
"=",
"null",
";",
"// only something to do if uri is non-null & non-empty u",
"if",
"(",
"uri",
"!=",
"null",
")",
"{",
"uri",
"=",
"uri",
".",
"trim",
"(",
")",
";",
"if",
"(",
"!",
"uri",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"splitOnNonEscapedChar",
"(",
"uri",
",",
"'",
"'",
",",
"2",
")",
";",
"// parts[1] (if present) is the NVPs, so only something to do if present & non-empty",
"if",
"(",
"parts",
".",
"length",
">=",
"2",
")",
"{",
"String",
"nvps",
"=",
"parts",
"[",
"1",
"]",
".",
"trim",
"(",
")",
";",
"if",
"(",
"!",
"nvps",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"// break the nvps string into an array of name=value strings",
"// Use a regular expression to split on an '&' only if it isn't preceeded by a '\\'.",
"String",
"[",
"]",
"nvpArray",
"=",
"splitOnNonEscapedChar",
"(",
"nvps",
",",
"'",
"'",
",",
"-",
"1",
")",
";",
"// Search the array for the named property",
"String",
"propNameE",
"=",
"propName",
"+",
"\"=\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nvpArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"nvp",
"=",
"nvpArray",
"[",
"i",
"]",
";",
"if",
"(",
"nvp",
".",
"startsWith",
"(",
"propNameE",
")",
")",
"{",
"// everything after the = is the value",
"result",
"=",
"nvp",
".",
"substring",
"(",
"propNameE",
".",
"length",
"(",
")",
")",
";",
"break",
";",
"// exit the loop",
"}",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"extractPropertyFromURI\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Extract the value of the named property from URI.
Find the named property in the name value pairs of the uri and return the value,
or null if the property is not present.
@param propName the name of the property whose value is required
@param uri the URI to search in
@return | [
"Extract",
"the",
"value",
"of",
"the",
"named",
"property",
"from",
"URI",
".",
"Find",
"the",
"named",
"property",
"in",
"the",
"name",
"value",
"pairs",
"of",
"the",
"uri",
"and",
"return",
"the",
"value",
"or",
"null",
"if",
"the",
"property",
"is",
"not",
"present",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java#L98-L132 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java | URIDestinationCreator.splitOnNonEscapedChar | private String[] splitOnNonEscapedChar(String inputStr, char splitChar, int expectedPartCount) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "splitOnNonEscapedChar", new Object[]{inputStr, splitChar, expectedPartCount});
String[] parts = null;
List<String> partsList = null;
// Index variable along the length of the string
int startPoint = 0;
int tokenStart = 0;
int splitCharIndex = 0;
// Used to keep track of how many parts we have found
int partCount = 0;
// Implement manual splitting here.
// Loop through searching for unescaped splitter characters until we reach the end of the string
// or the requested number of pieces.
while ((splitCharIndex != -1) && (partCount != (expectedPartCount-1))) {
splitCharIndex = inputStr.indexOf(splitChar, startPoint);
// We only have work to do here if a splitter char was found and it was not escaped.
if ((splitCharIndex != -1) && !charIsEscaped(inputStr, splitCharIndex)) {
// Found a non-escaped splitter character
// Set the first part of the string.
String nextPart = inputStr.substring(tokenStart, splitCharIndex);
// If we have not yet initialized the storage then do so now.
if (expectedPartCount >= 2) {
if (parts == null) parts = new String[expectedPartCount];
parts[partCount] = nextPart;
}
else {
// Variable storage mechanism.
if (partsList == null) partsList = new ArrayList<String>(5);
partsList.add(nextPart);
}
// Indicate that we have found a new part.
partCount++;
// Move up the start point appropriately
startPoint = splitCharIndex+1;
tokenStart = startPoint;
}
else {
// If the splitter is escaped then we need to look further
// down the string for the next one.
startPoint = splitCharIndex+1;
// implicit 'continue' on the while loop.
}
}
// Get the last part of the token string here. Either we haven't found another splitter,
// or we just need to pick up the last chunk (regardless of whether it contains further
// splitters).
String nextPart = inputStr.substring(tokenStart, inputStr.length());
if (expectedPartCount >= 2) {
if (parts == null) {
// If we haven't found any splitters then just pass back the string itself.
parts = new String[1];
}
// Either there weren't any splitter characters, or we found one at some point but
// have subsequently run out of further ones to process - in any case we need to put
// in the last part of the string.
parts[partCount] = nextPart;
}
else {
// Variable storage final step here.
if (partsList == null) {
// No parts found - special optimized path here.
parts = new String[1];
parts[0] = nextPart;
}
else {
partsList.add(nextPart);
// Conver the list back into a string[]
parts = partsList.toArray(new String[] {});
}
}
// Do a quick check to see whether we were unable to make up the requested number of elements in
// the array (in which case it is too big and needs resizing). This should hopefully be a minority
// case.
if ((parts[parts.length-1] == null)) {
// There are one or more empty spaces at the end of the array.
// Find the last element that doesn't have real data in it and trim the array appropriately.
// In observations the last element can be empty string, so the partCount isn't any good to us here.
int lastValidEntry = 0;
while ((parts[lastValidEntry] != null) && (!"".equals(parts[lastValidEntry]))) {
lastValidEntry++;
}
String[] tempParts = new String[lastValidEntry];
System.arraycopy(parts, 0, tempParts, 0, lastValidEntry);
parts = tempParts;
}
// Slightly unconventional way of ensuring that the content of the array is properly traced rather than just
// the array object code (tr.exit will call toString on each of the parts of the array)
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "splitOnNonEscapedChar", parts);
return parts;
} | java | private String[] splitOnNonEscapedChar(String inputStr, char splitChar, int expectedPartCount) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "splitOnNonEscapedChar", new Object[]{inputStr, splitChar, expectedPartCount});
String[] parts = null;
List<String> partsList = null;
// Index variable along the length of the string
int startPoint = 0;
int tokenStart = 0;
int splitCharIndex = 0;
// Used to keep track of how many parts we have found
int partCount = 0;
// Implement manual splitting here.
// Loop through searching for unescaped splitter characters until we reach the end of the string
// or the requested number of pieces.
while ((splitCharIndex != -1) && (partCount != (expectedPartCount-1))) {
splitCharIndex = inputStr.indexOf(splitChar, startPoint);
// We only have work to do here if a splitter char was found and it was not escaped.
if ((splitCharIndex != -1) && !charIsEscaped(inputStr, splitCharIndex)) {
// Found a non-escaped splitter character
// Set the first part of the string.
String nextPart = inputStr.substring(tokenStart, splitCharIndex);
// If we have not yet initialized the storage then do so now.
if (expectedPartCount >= 2) {
if (parts == null) parts = new String[expectedPartCount];
parts[partCount] = nextPart;
}
else {
// Variable storage mechanism.
if (partsList == null) partsList = new ArrayList<String>(5);
partsList.add(nextPart);
}
// Indicate that we have found a new part.
partCount++;
// Move up the start point appropriately
startPoint = splitCharIndex+1;
tokenStart = startPoint;
}
else {
// If the splitter is escaped then we need to look further
// down the string for the next one.
startPoint = splitCharIndex+1;
// implicit 'continue' on the while loop.
}
}
// Get the last part of the token string here. Either we haven't found another splitter,
// or we just need to pick up the last chunk (regardless of whether it contains further
// splitters).
String nextPart = inputStr.substring(tokenStart, inputStr.length());
if (expectedPartCount >= 2) {
if (parts == null) {
// If we haven't found any splitters then just pass back the string itself.
parts = new String[1];
}
// Either there weren't any splitter characters, or we found one at some point but
// have subsequently run out of further ones to process - in any case we need to put
// in the last part of the string.
parts[partCount] = nextPart;
}
else {
// Variable storage final step here.
if (partsList == null) {
// No parts found - special optimized path here.
parts = new String[1];
parts[0] = nextPart;
}
else {
partsList.add(nextPart);
// Conver the list back into a string[]
parts = partsList.toArray(new String[] {});
}
}
// Do a quick check to see whether we were unable to make up the requested number of elements in
// the array (in which case it is too big and needs resizing). This should hopefully be a minority
// case.
if ((parts[parts.length-1] == null)) {
// There are one or more empty spaces at the end of the array.
// Find the last element that doesn't have real data in it and trim the array appropriately.
// In observations the last element can be empty string, so the partCount isn't any good to us here.
int lastValidEntry = 0;
while ((parts[lastValidEntry] != null) && (!"".equals(parts[lastValidEntry]))) {
lastValidEntry++;
}
String[] tempParts = new String[lastValidEntry];
System.arraycopy(parts, 0, tempParts, 0, lastValidEntry);
parts = tempParts;
}
// Slightly unconventional way of ensuring that the content of the array is properly traced rather than just
// the array object code (tr.exit will call toString on each of the parts of the array)
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "splitOnNonEscapedChar", parts);
return parts;
} | [
"private",
"String",
"[",
"]",
"splitOnNonEscapedChar",
"(",
"String",
"inputStr",
",",
"char",
"splitChar",
",",
"int",
"expectedPartCount",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"splitOnNonEscapedChar\"",
",",
"new",
"Object",
"[",
"]",
"{",
"inputStr",
",",
"splitChar",
",",
"expectedPartCount",
"}",
")",
";",
"String",
"[",
"]",
"parts",
"=",
"null",
";",
"List",
"<",
"String",
">",
"partsList",
"=",
"null",
";",
"// Index variable along the length of the string",
"int",
"startPoint",
"=",
"0",
";",
"int",
"tokenStart",
"=",
"0",
";",
"int",
"splitCharIndex",
"=",
"0",
";",
"// Used to keep track of how many parts we have found",
"int",
"partCount",
"=",
"0",
";",
"// Implement manual splitting here.",
"// Loop through searching for unescaped splitter characters until we reach the end of the string",
"// or the requested number of pieces.",
"while",
"(",
"(",
"splitCharIndex",
"!=",
"-",
"1",
")",
"&&",
"(",
"partCount",
"!=",
"(",
"expectedPartCount",
"-",
"1",
")",
")",
")",
"{",
"splitCharIndex",
"=",
"inputStr",
".",
"indexOf",
"(",
"splitChar",
",",
"startPoint",
")",
";",
"// We only have work to do here if a splitter char was found and it was not escaped.",
"if",
"(",
"(",
"splitCharIndex",
"!=",
"-",
"1",
")",
"&&",
"!",
"charIsEscaped",
"(",
"inputStr",
",",
"splitCharIndex",
")",
")",
"{",
"// Found a non-escaped splitter character",
"// Set the first part of the string.",
"String",
"nextPart",
"=",
"inputStr",
".",
"substring",
"(",
"tokenStart",
",",
"splitCharIndex",
")",
";",
"// If we have not yet initialized the storage then do so now.",
"if",
"(",
"expectedPartCount",
">=",
"2",
")",
"{",
"if",
"(",
"parts",
"==",
"null",
")",
"parts",
"=",
"new",
"String",
"[",
"expectedPartCount",
"]",
";",
"parts",
"[",
"partCount",
"]",
"=",
"nextPart",
";",
"}",
"else",
"{",
"// Variable storage mechanism.",
"if",
"(",
"partsList",
"==",
"null",
")",
"partsList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"5",
")",
";",
"partsList",
".",
"add",
"(",
"nextPart",
")",
";",
"}",
"// Indicate that we have found a new part.",
"partCount",
"++",
";",
"// Move up the start point appropriately",
"startPoint",
"=",
"splitCharIndex",
"+",
"1",
";",
"tokenStart",
"=",
"startPoint",
";",
"}",
"else",
"{",
"// If the splitter is escaped then we need to look further",
"// down the string for the next one.",
"startPoint",
"=",
"splitCharIndex",
"+",
"1",
";",
"// implicit 'continue' on the while loop.",
"}",
"}",
"// Get the last part of the token string here. Either we haven't found another splitter,",
"// or we just need to pick up the last chunk (regardless of whether it contains further",
"// splitters).",
"String",
"nextPart",
"=",
"inputStr",
".",
"substring",
"(",
"tokenStart",
",",
"inputStr",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"expectedPartCount",
">=",
"2",
")",
"{",
"if",
"(",
"parts",
"==",
"null",
")",
"{",
"// If we haven't found any splitters then just pass back the string itself.",
"parts",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"}",
"// Either there weren't any splitter characters, or we found one at some point but",
"// have subsequently run out of further ones to process - in any case we need to put",
"// in the last part of the string.",
"parts",
"[",
"partCount",
"]",
"=",
"nextPart",
";",
"}",
"else",
"{",
"// Variable storage final step here.",
"if",
"(",
"partsList",
"==",
"null",
")",
"{",
"// No parts found - special optimized path here.",
"parts",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"parts",
"[",
"0",
"]",
"=",
"nextPart",
";",
"}",
"else",
"{",
"partsList",
".",
"add",
"(",
"nextPart",
")",
";",
"// Conver the list back into a string[]",
"parts",
"=",
"partsList",
".",
"toArray",
"(",
"new",
"String",
"[",
"]",
"{",
"}",
")",
";",
"}",
"}",
"// Do a quick check to see whether we were unable to make up the requested number of elements in",
"// the array (in which case it is too big and needs resizing). This should hopefully be a minority",
"// case.",
"if",
"(",
"(",
"parts",
"[",
"parts",
".",
"length",
"-",
"1",
"]",
"==",
"null",
")",
")",
"{",
"// There are one or more empty spaces at the end of the array.",
"// Find the last element that doesn't have real data in it and trim the array appropriately.",
"// In observations the last element can be empty string, so the partCount isn't any good to us here.",
"int",
"lastValidEntry",
"=",
"0",
";",
"while",
"(",
"(",
"parts",
"[",
"lastValidEntry",
"]",
"!=",
"null",
")",
"&&",
"(",
"!",
"\"\"",
".",
"equals",
"(",
"parts",
"[",
"lastValidEntry",
"]",
")",
")",
")",
"{",
"lastValidEntry",
"++",
";",
"}",
"String",
"[",
"]",
"tempParts",
"=",
"new",
"String",
"[",
"lastValidEntry",
"]",
";",
"System",
".",
"arraycopy",
"(",
"parts",
",",
"0",
",",
"tempParts",
",",
"0",
",",
"lastValidEntry",
")",
";",
"parts",
"=",
"tempParts",
";",
"}",
"// Slightly unconventional way of ensuring that the content of the array is properly traced rather than just",
"// the array object code (tr.exit will call toString on each of the parts of the array)",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"splitOnNonEscapedChar\"",
",",
"parts",
")",
";",
"return",
"parts",
";",
"}"
] | Split the specified string into the requested number of pieces using the splitter
character provided. This method is careful to only split on non-escaped instances
of the splitter character.
Historical regex expressions that this replaces were as follows (from Javadoc)
// Patterns used for splitting strings
// NB These regexs are not completely rigorous, as they assume that a
// preceding backslash always escapes the following character. This may not
// be true, as the backslash may itself be escaped. The correct test is that
// the character is escaped if it is preceded by an odd number of contiguous
// backslashes, but I don't think this can be represented as a regex. To be
// completely correct we would need to replace the regexs with a new routine
// for splitting strings which combined indexof searching with the charIsEscaped
// method. (Low priority, probably not worth the bother, but might be useful
// for both correctness and performance).
// /'?' = non-capturing
// '<!' = negative look-behind --> only match if there isn't this char before it (behind!)
// '\\\\' = 1 back slash --> 2 escaped to JVM, 1 escaped to Regex compiler
// '\\?' = the char to split on, which has to be escaped (one \ eaten by JVM)
private Pattern pSplitNonEscapedQMark = Pattern.compile("(?<!\\\\)\\?");
private Pattern pSplitNonEscapedSlash = Pattern.compile("(?<!\\\\)/");
// '?' = non-capturing
// '<!' = negative look-behind --> only match if there isn't this char before it (behind!)
// '\\\\' = 1 back slash --> 2 escaped to JVM, 1 escaped to Regex compiler
// '&' = the char to split on
private Pattern pSplitNonEscapedAmpersand = Pattern.compile("(?<!\\\\)&");
// '?' = non-capturing
// '<!' = negative look-behind --> only match if there isn't this char before it (behind!)
// '\\\\' = 1 back slash --> 2 escaped to JVM, 1 escaped to Regex compiler
// ':' = the char to split on
private Pattern pSplitNonEscapedColon = Pattern.compile("(?<!\\\\):");
@param inputStr The string to be split
@param splitChar The character on which the string should be split (if it is not escaped)
@param expectedPartCount The number of pieces the string should be split into. For example specifying
two here indicates splitting at the first occurence giving two parts - before and after.
Value of 1 indicates return just the original string. Value of less than 1 indicates
split into as many parts as necessary.
@return String[] containing the split parts.
- If the splitter character is not present then the array will be of size 1 containing
the full string. size 's' will be 1 <= s <= n
depending upon whether there were enough separator characters to make up the requested
piece count. Note that in some extreme cases (like passing in empty string) there might only
be one element, which will be an empty string.
- If numPieces is less than 1 (as many pieces as necessary) then the array will be exactly
the required size (no nulls). | [
"Split",
"the",
"specified",
"string",
"into",
"the",
"requested",
"number",
"of",
"pieces",
"using",
"the",
"splitter",
"character",
"provided",
".",
"This",
"method",
"is",
"careful",
"to",
"only",
"split",
"on",
"non",
"-",
"escaped",
"instances",
"of",
"the",
"splitter",
"character",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java#L424-L530 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java | URIDestinationCreator.unescape | private String unescape(String input, char c) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unescape", new Object[]{input, c});
String result = input;
// if there are no instances of c in the String we can just return the original
if (input.indexOf(c) != -1) {
int startValue = 0;
StringBuffer temp = new StringBuffer(input);
String cStr = new String(new char[] { c });
while ((startValue = temp.indexOf(cStr, startValue)) != -1) {
if (startValue > 0 && temp.charAt(startValue - 1) == '\\') {
// remove the preceding slash to leave the escaped character
temp.deleteCharAt(startValue - 1);
}
else {
startValue++;
}
}
result = temp.toString();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unescape", result);
return result;
} | java | private String unescape(String input, char c) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unescape", new Object[]{input, c});
String result = input;
// if there are no instances of c in the String we can just return the original
if (input.indexOf(c) != -1) {
int startValue = 0;
StringBuffer temp = new StringBuffer(input);
String cStr = new String(new char[] { c });
while ((startValue = temp.indexOf(cStr, startValue)) != -1) {
if (startValue > 0 && temp.charAt(startValue - 1) == '\\') {
// remove the preceding slash to leave the escaped character
temp.deleteCharAt(startValue - 1);
}
else {
startValue++;
}
}
result = temp.toString();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unescape", result);
return result;
} | [
"private",
"String",
"unescape",
"(",
"String",
"input",
",",
"char",
"c",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"unescape\"",
",",
"new",
"Object",
"[",
"]",
"{",
"input",
",",
"c",
"}",
")",
";",
"String",
"result",
"=",
"input",
";",
"// if there are no instances of c in the String we can just return the original",
"if",
"(",
"input",
".",
"indexOf",
"(",
"c",
")",
"!=",
"-",
"1",
")",
"{",
"int",
"startValue",
"=",
"0",
";",
"StringBuffer",
"temp",
"=",
"new",
"StringBuffer",
"(",
"input",
")",
";",
"String",
"cStr",
"=",
"new",
"String",
"(",
"new",
"char",
"[",
"]",
"{",
"c",
"}",
")",
";",
"while",
"(",
"(",
"startValue",
"=",
"temp",
".",
"indexOf",
"(",
"cStr",
",",
"startValue",
")",
")",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"startValue",
">",
"0",
"&&",
"temp",
".",
"charAt",
"(",
"startValue",
"-",
"1",
")",
"==",
"'",
"'",
")",
"{",
"// remove the preceding slash to leave the escaped character",
"temp",
".",
"deleteCharAt",
"(",
"startValue",
"-",
"1",
")",
";",
"}",
"else",
"{",
"startValue",
"++",
";",
"}",
"}",
"result",
"=",
"temp",
".",
"toString",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"unescape\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Remove '\' characters from input String when they precede
specified character.
@param input The string to be processed
@param c The character that should be unescaped
@return The modified String | [
"Remove",
"\\",
"characters",
"from",
"input",
"String",
"when",
"they",
"precede",
"specified",
"character",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java#L695-L718 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java | URIDestinationCreator.unescapeBackslash | private String unescapeBackslash(String input) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unescapeBackslash", input);
String result = input;
// If there are no backslashes then don't bother creating the buffer etc.
if (input.indexOf("\\") != -1) {
int startValue = 0;
StringBuffer tmp = new StringBuffer(input);
while ((startValue = tmp.indexOf("\\", startValue)) != -1) {
// check that the next character is also a \
if (startValue + 1 < tmp.length() && tmp.charAt(startValue + 1) == '\\') {
// remove the first slash
tmp.deleteCharAt(startValue);
// increment startValue so that the next indexOf begins after the second slash
startValue++;
}
else {
// we've found a single \, so throw an exception
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"BAD_ESCAPE_CHAR_CWSIA0387",
new Object[] { input },
tc);
}
}
result = tmp.toString();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unescapeBackslash", result);
return result;
} | java | private String unescapeBackslash(String input) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unescapeBackslash", input);
String result = input;
// If there are no backslashes then don't bother creating the buffer etc.
if (input.indexOf("\\") != -1) {
int startValue = 0;
StringBuffer tmp = new StringBuffer(input);
while ((startValue = tmp.indexOf("\\", startValue)) != -1) {
// check that the next character is also a \
if (startValue + 1 < tmp.length() && tmp.charAt(startValue + 1) == '\\') {
// remove the first slash
tmp.deleteCharAt(startValue);
// increment startValue so that the next indexOf begins after the second slash
startValue++;
}
else {
// we've found a single \, so throw an exception
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"BAD_ESCAPE_CHAR_CWSIA0387",
new Object[] { input },
tc);
}
}
result = tmp.toString();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unescapeBackslash", result);
return result;
} | [
"private",
"String",
"unescapeBackslash",
"(",
"String",
"input",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"unescapeBackslash\"",
",",
"input",
")",
";",
"String",
"result",
"=",
"input",
";",
"// If there are no backslashes then don't bother creating the buffer etc.",
"if",
"(",
"input",
".",
"indexOf",
"(",
"\"\\\\\"",
")",
"!=",
"-",
"1",
")",
"{",
"int",
"startValue",
"=",
"0",
";",
"StringBuffer",
"tmp",
"=",
"new",
"StringBuffer",
"(",
"input",
")",
";",
"while",
"(",
"(",
"startValue",
"=",
"tmp",
".",
"indexOf",
"(",
"\"\\\\\"",
",",
"startValue",
")",
")",
"!=",
"-",
"1",
")",
"{",
"// check that the next character is also a \\",
"if",
"(",
"startValue",
"+",
"1",
"<",
"tmp",
".",
"length",
"(",
")",
"&&",
"tmp",
".",
"charAt",
"(",
"startValue",
"+",
"1",
")",
"==",
"'",
"'",
")",
"{",
"// remove the first slash",
"tmp",
".",
"deleteCharAt",
"(",
"startValue",
")",
";",
"// increment startValue so that the next indexOf begins after the second slash",
"startValue",
"++",
";",
"}",
"else",
"{",
"// we've found a single \\, so throw an exception",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"JMSException",
".",
"class",
",",
"\"BAD_ESCAPE_CHAR_CWSIA0387\"",
",",
"new",
"Object",
"[",
"]",
"{",
"input",
"}",
",",
"tc",
")",
";",
"}",
"}",
"result",
"=",
"tmp",
".",
"toString",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"unescapeBackslash\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Convert escaped backslash to single backslash.
This method de-escapes double backslashes whilst at the same time
checking that there are no single backslahes in the input string.
@param input The string to be processed
@return The modified String
@throws JMSException if an unescaped backslash is found | [
"Convert",
"escaped",
"backslash",
"to",
"single",
"backslash",
".",
"This",
"method",
"de",
"-",
"escapes",
"double",
"backslashes",
"whilst",
"at",
"the",
"same",
"time",
"checking",
"that",
"there",
"are",
"no",
"single",
"backslahes",
"in",
"the",
"input",
"string",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java#L729-L760 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java | URIDestinationCreator.validateNVP | private String[] validateNVP(String namePart, String valuePart, String uri, JmsDestination dest) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "validateNVP", new Object[]{namePart, valuePart, uri, dest});
// de-escape any escaped &s in the value (we define names, so no & there)
if (valuePart.indexOf('&') != -1) {
valuePart = valuePart.replaceAll("\\\\&", "&");
}
// The only valid escape sequence that should be left is "\\" which
// transforms to a single '\'
valuePart = unescapeBackslash(valuePart);
// Performing mapping from MA88 names to Jetstream names.
// If the name part is any of the following MA88 properties, we leave it because
// there is no direct Jetstream equivalent for the property:
// 'CCSID', 'encoding', 'brokerDurSubQueue', 'brokerCCDurSubQueue', 'multicast'.
// In this event, the unknown property will be silently ignored, and NOT throw an exception.
if (namePart.equalsIgnoreCase(MA88_EXPIRY)) {
namePart = JmsInternalConstants.TIME_TO_LIVE;
}
if (namePart.equalsIgnoreCase(MA88_PERSISTENCE)) {
namePart = JmsInternalConstants.DELIVERY_MODE;
// map between the MA88 Integer values and the Jetstream String values
if (valuePart.equals("1")) {
valuePart = ApiJmsConstants.DELIVERY_MODE_NONPERSISTENT;
}
else if (valuePart.equals("2")) {
valuePart = ApiJmsConstants.DELIVERY_MODE_PERSISTENT;
}
else {
valuePart = ApiJmsConstants.DELIVERY_MODE_APP;
}
}
// create a new String[] and populate it with the newly validated element, then return.
String[] result = new String[] { namePart, valuePart };
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "validateNVP", result);
return result;
} | java | private String[] validateNVP(String namePart, String valuePart, String uri, JmsDestination dest) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "validateNVP", new Object[]{namePart, valuePart, uri, dest});
// de-escape any escaped &s in the value (we define names, so no & there)
if (valuePart.indexOf('&') != -1) {
valuePart = valuePart.replaceAll("\\\\&", "&");
}
// The only valid escape sequence that should be left is "\\" which
// transforms to a single '\'
valuePart = unescapeBackslash(valuePart);
// Performing mapping from MA88 names to Jetstream names.
// If the name part is any of the following MA88 properties, we leave it because
// there is no direct Jetstream equivalent for the property:
// 'CCSID', 'encoding', 'brokerDurSubQueue', 'brokerCCDurSubQueue', 'multicast'.
// In this event, the unknown property will be silently ignored, and NOT throw an exception.
if (namePart.equalsIgnoreCase(MA88_EXPIRY)) {
namePart = JmsInternalConstants.TIME_TO_LIVE;
}
if (namePart.equalsIgnoreCase(MA88_PERSISTENCE)) {
namePart = JmsInternalConstants.DELIVERY_MODE;
// map between the MA88 Integer values and the Jetstream String values
if (valuePart.equals("1")) {
valuePart = ApiJmsConstants.DELIVERY_MODE_NONPERSISTENT;
}
else if (valuePart.equals("2")) {
valuePart = ApiJmsConstants.DELIVERY_MODE_PERSISTENT;
}
else {
valuePart = ApiJmsConstants.DELIVERY_MODE_APP;
}
}
// create a new String[] and populate it with the newly validated element, then return.
String[] result = new String[] { namePart, valuePart };
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "validateNVP", result);
return result;
} | [
"private",
"String",
"[",
"]",
"validateNVP",
"(",
"String",
"namePart",
",",
"String",
"valuePart",
",",
"String",
"uri",
",",
"JmsDestination",
"dest",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"validateNVP\"",
",",
"new",
"Object",
"[",
"]",
"{",
"namePart",
",",
"valuePart",
",",
"uri",
",",
"dest",
"}",
")",
";",
"// de-escape any escaped &s in the value (we define names, so no & there)",
"if",
"(",
"valuePart",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"{",
"valuePart",
"=",
"valuePart",
".",
"replaceAll",
"(",
"\"\\\\\\\\&\"",
",",
"\"&\"",
")",
";",
"}",
"// The only valid escape sequence that should be left is \"\\\\\" which",
"// transforms to a single '\\'",
"valuePart",
"=",
"unescapeBackslash",
"(",
"valuePart",
")",
";",
"// Performing mapping from MA88 names to Jetstream names.",
"// If the name part is any of the following MA88 properties, we leave it because",
"// there is no direct Jetstream equivalent for the property:",
"// 'CCSID', 'encoding', 'brokerDurSubQueue', 'brokerCCDurSubQueue', 'multicast'.",
"// In this event, the unknown property will be silently ignored, and NOT throw an exception.",
"if",
"(",
"namePart",
".",
"equalsIgnoreCase",
"(",
"MA88_EXPIRY",
")",
")",
"{",
"namePart",
"=",
"JmsInternalConstants",
".",
"TIME_TO_LIVE",
";",
"}",
"if",
"(",
"namePart",
".",
"equalsIgnoreCase",
"(",
"MA88_PERSISTENCE",
")",
")",
"{",
"namePart",
"=",
"JmsInternalConstants",
".",
"DELIVERY_MODE",
";",
"// map between the MA88 Integer values and the Jetstream String values",
"if",
"(",
"valuePart",
".",
"equals",
"(",
"\"1\"",
")",
")",
"{",
"valuePart",
"=",
"ApiJmsConstants",
".",
"DELIVERY_MODE_NONPERSISTENT",
";",
"}",
"else",
"if",
"(",
"valuePart",
".",
"equals",
"(",
"\"2\"",
")",
")",
"{",
"valuePart",
"=",
"ApiJmsConstants",
".",
"DELIVERY_MODE_PERSISTENT",
";",
"}",
"else",
"{",
"valuePart",
"=",
"ApiJmsConstants",
".",
"DELIVERY_MODE_APP",
";",
"}",
"}",
"// create a new String[] and populate it with the newly validated element, then return.",
"String",
"[",
"]",
"result",
"=",
"new",
"String",
"[",
"]",
"{",
"namePart",
",",
"valuePart",
"}",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"validateNVP\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | This utility method performs the validation on the name and value parts of the NVP.
It performs several checks to make sure that neither part contain any illegal characters
unless they are escaped by a backslash.
The method also performs a conversion between any Jetstream-mappable MA88 properties.
Finally, it returns the new values in a String array to the calling code.
@param String namePart The name part of an NVP
@param String valuePart The value part of an NVP
@param String uri The full URI (needed for debug and exception statements)
@param JmsDestination dest updated if dest name requires wild card conversion
@throws JMSException If an NVP element is found to be illegal
@return String[] The newly validated NVP element | [
"This",
"utility",
"method",
"performs",
"the",
"validation",
"on",
"the",
"name",
"and",
"value",
"parts",
"of",
"the",
"NVP",
".",
"It",
"performs",
"several",
"checks",
"to",
"make",
"sure",
"that",
"neither",
"part",
"contain",
"any",
"illegal",
"characters",
"unless",
"they",
"are",
"escaped",
"by",
"a",
"backslash",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java#L778-L818 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java | URIDestinationCreator.configureDestinationFromMap | private void configureDestinationFromMap(JmsDestination dest, Map<String,String> props, String uri) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "configureDestinationFromMap", new Object[]{dest, props, uri});
// Iterate over the map, retrieving the name and value parts of the NVP.
Iterator<Map.Entry<String,String>> iter = props.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String,String> nextProp = iter.next();
String namePart = nextProp.getKey();
String valuePart = nextProp.getValue();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "name " + namePart + ", value " + valuePart);
// Here we want to try and get the class for the value part or a property name.
// If this returns null, we can silently ignore the property because we know
// that it in not a valid property to set on a Destination object.
// We also use a boolean flag so that we don't then try to process this property again below.
boolean propertyIsSettable = true;
Class cl = MsgDestEncodingUtilsImpl.getPropertyType(namePart);
if (cl == null) {
propertyIsSettable = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Ignoring invalid property " + namePart);
}
// Now we know they're legal, we can process the name and value pairs
// Determine the type of the value using a dynamic lookup on the name.
// This uses the utility methods in MsgDestEncodingUtilsImpl.
// We only want to perform this step if an exception was not throw in the code block above.
if (propertyIsSettable) {
try {
// Convert the property to the right type of object
Object valueObject = MsgDestEncodingUtilsImpl.convertPropertyToType(namePart, valuePart);
if (namePart.equals(TOPIC_NAME)) {
// special case topicName, as it may be null, and the reflection stuff can't cope
if (dest instanceof JmsTopicImpl) {
((JmsTopicImpl) dest).setTopicName((String) valueObject);
}
else {
// generate an internal error
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"INTERNAL_ERROR_CWSIA0386",
null,
tc);
}
}
else {
// call setDestinationProperty(JmsDestination dest, String propName, String propVal)
MsgDestEncodingUtilsImpl.setDestinationProperty(dest, namePart, valueObject);
}
}
catch (NumberFormatException nfe) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.exception(tc, nfe);
// d238447 FFDC review.
// Updated during d272111. NFEs can be generated by supplying badly formed URIs from
// user code, so don't FFDC.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"INVALID_URI_ELEMENT_CWSIA0384",
new Object[] { namePart, valuePart, uri },
nfe, null, null, // nulls = no ffdc
tc);
}
catch (JMSException jmse) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.exception(tc, jmse);
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"INVALID_URI_ELEMENT_CWSIA0384",
new Object[] { namePart, valuePart, uri },
tc);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "configureDestinationFromMap");
} | java | private void configureDestinationFromMap(JmsDestination dest, Map<String,String> props, String uri) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "configureDestinationFromMap", new Object[]{dest, props, uri});
// Iterate over the map, retrieving the name and value parts of the NVP.
Iterator<Map.Entry<String,String>> iter = props.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String,String> nextProp = iter.next();
String namePart = nextProp.getKey();
String valuePart = nextProp.getValue();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "name " + namePart + ", value " + valuePart);
// Here we want to try and get the class for the value part or a property name.
// If this returns null, we can silently ignore the property because we know
// that it in not a valid property to set on a Destination object.
// We also use a boolean flag so that we don't then try to process this property again below.
boolean propertyIsSettable = true;
Class cl = MsgDestEncodingUtilsImpl.getPropertyType(namePart);
if (cl == null) {
propertyIsSettable = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Ignoring invalid property " + namePart);
}
// Now we know they're legal, we can process the name and value pairs
// Determine the type of the value using a dynamic lookup on the name.
// This uses the utility methods in MsgDestEncodingUtilsImpl.
// We only want to perform this step if an exception was not throw in the code block above.
if (propertyIsSettable) {
try {
// Convert the property to the right type of object
Object valueObject = MsgDestEncodingUtilsImpl.convertPropertyToType(namePart, valuePart);
if (namePart.equals(TOPIC_NAME)) {
// special case topicName, as it may be null, and the reflection stuff can't cope
if (dest instanceof JmsTopicImpl) {
((JmsTopicImpl) dest).setTopicName((String) valueObject);
}
else {
// generate an internal error
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"INTERNAL_ERROR_CWSIA0386",
null,
tc);
}
}
else {
// call setDestinationProperty(JmsDestination dest, String propName, String propVal)
MsgDestEncodingUtilsImpl.setDestinationProperty(dest, namePart, valueObject);
}
}
catch (NumberFormatException nfe) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.exception(tc, nfe);
// d238447 FFDC review.
// Updated during d272111. NFEs can be generated by supplying badly formed URIs from
// user code, so don't FFDC.
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"INVALID_URI_ELEMENT_CWSIA0384",
new Object[] { namePart, valuePart, uri },
nfe, null, null, // nulls = no ffdc
tc);
}
catch (JMSException jmse) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.exception(tc, jmse);
throw (JMSException) JmsErrorUtils.newThrowable(
JMSException.class,
"INVALID_URI_ELEMENT_CWSIA0384",
new Object[] { namePart, valuePart, uri },
tc);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "configureDestinationFromMap");
} | [
"private",
"void",
"configureDestinationFromMap",
"(",
"JmsDestination",
"dest",
",",
"Map",
"<",
"String",
",",
"String",
">",
"props",
",",
"String",
"uri",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"configureDestinationFromMap\"",
",",
"new",
"Object",
"[",
"]",
"{",
"dest",
",",
"props",
",",
"uri",
"}",
")",
";",
"// Iterate over the map, retrieving the name and value parts of the NVP.",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"iter",
"=",
"props",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"nextProp",
"=",
"iter",
".",
"next",
"(",
")",
";",
"String",
"namePart",
"=",
"nextProp",
".",
"getKey",
"(",
")",
";",
"String",
"valuePart",
"=",
"nextProp",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"name \"",
"+",
"namePart",
"+",
"\", value \"",
"+",
"valuePart",
")",
";",
"// Here we want to try and get the class for the value part or a property name.",
"// If this returns null, we can silently ignore the property because we know",
"// that it in not a valid property to set on a Destination object.",
"// We also use a boolean flag so that we don't then try to process this property again below.",
"boolean",
"propertyIsSettable",
"=",
"true",
";",
"Class",
"cl",
"=",
"MsgDestEncodingUtilsImpl",
".",
"getPropertyType",
"(",
"namePart",
")",
";",
"if",
"(",
"cl",
"==",
"null",
")",
"{",
"propertyIsSettable",
"=",
"false",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Ignoring invalid property \"",
"+",
"namePart",
")",
";",
"}",
"// Now we know they're legal, we can process the name and value pairs",
"// Determine the type of the value using a dynamic lookup on the name.",
"// This uses the utility methods in MsgDestEncodingUtilsImpl.",
"// We only want to perform this step if an exception was not throw in the code block above.",
"if",
"(",
"propertyIsSettable",
")",
"{",
"try",
"{",
"// Convert the property to the right type of object",
"Object",
"valueObject",
"=",
"MsgDestEncodingUtilsImpl",
".",
"convertPropertyToType",
"(",
"namePart",
",",
"valuePart",
")",
";",
"if",
"(",
"namePart",
".",
"equals",
"(",
"TOPIC_NAME",
")",
")",
"{",
"// special case topicName, as it may be null, and the reflection stuff can't cope",
"if",
"(",
"dest",
"instanceof",
"JmsTopicImpl",
")",
"{",
"(",
"(",
"JmsTopicImpl",
")",
"dest",
")",
".",
"setTopicName",
"(",
"(",
"String",
")",
"valueObject",
")",
";",
"}",
"else",
"{",
"// generate an internal error",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"JMSException",
".",
"class",
",",
"\"INTERNAL_ERROR_CWSIA0386\"",
",",
"null",
",",
"tc",
")",
";",
"}",
"}",
"else",
"{",
"// call setDestinationProperty(JmsDestination dest, String propName, String propVal)",
"MsgDestEncodingUtilsImpl",
".",
"setDestinationProperty",
"(",
"dest",
",",
"namePart",
",",
"valueObject",
")",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"// No FFDC code needed",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"nfe",
")",
";",
"// d238447 FFDC review.",
"// Updated during d272111. NFEs can be generated by supplying badly formed URIs from",
"// user code, so don't FFDC.",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"JMSException",
".",
"class",
",",
"\"INVALID_URI_ELEMENT_CWSIA0384\"",
",",
"new",
"Object",
"[",
"]",
"{",
"namePart",
",",
"valuePart",
",",
"uri",
"}",
",",
"nfe",
",",
"null",
",",
"null",
",",
"// nulls = no ffdc",
"tc",
")",
";",
"}",
"catch",
"(",
"JMSException",
"jmse",
")",
"{",
"// No FFDC code needed",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"jmse",
")",
";",
"throw",
"(",
"JMSException",
")",
"JmsErrorUtils",
".",
"newThrowable",
"(",
"JMSException",
".",
"class",
",",
"\"INVALID_URI_ELEMENT_CWSIA0384\"",
",",
"new",
"Object",
"[",
"]",
"{",
"namePart",
",",
"valuePart",
",",
"uri",
"}",
",",
"tc",
")",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"configureDestinationFromMap\"",
")",
";",
"}"
] | This utililty method uses the supplied Map to configure a destination property.
The map contains the name and value pairs from the URI.
@param Destination dest The Destination object to configure
@param Map props The Map collection containing the NVPs from the URI
@param String uri The original URI used for debugging purposes
@throws JMSException In the event of an error configuring the destination | [
"This",
"utililty",
"method",
"uses",
"the",
"supplied",
"Map",
"to",
"configure",
"a",
"destination",
"property",
".",
"The",
"map",
"contains",
"the",
"name",
"and",
"value",
"pairs",
"from",
"the",
"URI",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java#L829-L907 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java | URIDestinationCreator.createDestinationFromURI | public Destination createDestinationFromURI(String uri, int qmProcessing) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createDestinationFromURI", new Object[]{uri, qmProcessing});
Destination result = null;
if (uri != null) {
result = processURI(uri, qmProcessing, null);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createDestinationFromURI", result);
return result;
} | java | public Destination createDestinationFromURI(String uri, int qmProcessing) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createDestinationFromURI", new Object[]{uri, qmProcessing});
Destination result = null;
if (uri != null) {
result = processURI(uri, qmProcessing, null);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createDestinationFromURI", result);
return result;
} | [
"public",
"Destination",
"createDestinationFromURI",
"(",
"String",
"uri",
",",
"int",
"qmProcessing",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"createDestinationFromURI\"",
",",
"new",
"Object",
"[",
"]",
"{",
"uri",
",",
"qmProcessing",
"}",
")",
";",
"Destination",
"result",
"=",
"null",
";",
"if",
"(",
"uri",
"!=",
"null",
")",
"{",
"result",
"=",
"processURI",
"(",
"uri",
",",
"qmProcessing",
",",
"null",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"createDestinationFromURI\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Create a Destination object from a full URI format String.
@param uri The URI format string describing the destination. If null, method returns
null. If not null, must begin with either queue:// or topic://, otherwise an ??
exception is thrown.
@param qmProcessing flag to indicate how to deal with QMs in MA88 queue URIs.
@return a fully configured Destination object (either JmsQueueImpl or JmsTopicImpl)
@throws JMSException if createDestinationFromString throws it. | [
"Create",
"a",
"Destination",
"object",
"from",
"a",
"full",
"URI",
"format",
"String",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java#L993-L1001 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java | URIDestinationCreator.charIsEscaped | private static boolean charIsEscaped(String str, int index) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "charIsEscaped", new Object[]{str, index});
// precondition, null str or out of range index returns false.
if (str == null || index < 0 || index >= str.length()) return false;
// A character is escaped if it is preceded by an odd number of '\'s.
int nEscape = 0;
int i = index-1;
while(i>=0 && str.charAt(i) == '\\') {
nEscape++;
i--;
}
boolean result = nEscape % 2 == 1 ;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "charIsEscaped", result);
return result;
} | java | private static boolean charIsEscaped(String str, int index) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "charIsEscaped", new Object[]{str, index});
// precondition, null str or out of range index returns false.
if (str == null || index < 0 || index >= str.length()) return false;
// A character is escaped if it is preceded by an odd number of '\'s.
int nEscape = 0;
int i = index-1;
while(i>=0 && str.charAt(i) == '\\') {
nEscape++;
i--;
}
boolean result = nEscape % 2 == 1 ;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "charIsEscaped", result);
return result;
} | [
"private",
"static",
"boolean",
"charIsEscaped",
"(",
"String",
"str",
",",
"int",
"index",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"charIsEscaped\"",
",",
"new",
"Object",
"[",
"]",
"{",
"str",
",",
"index",
"}",
")",
";",
"// precondition, null str or out of range index returns false.",
"if",
"(",
"str",
"==",
"null",
"||",
"index",
"<",
"0",
"||",
"index",
">=",
"str",
".",
"length",
"(",
")",
")",
"return",
"false",
";",
"// A character is escaped if it is preceded by an odd number of '\\'s.",
"int",
"nEscape",
"=",
"0",
";",
"int",
"i",
"=",
"index",
"-",
"1",
";",
"while",
"(",
"i",
">=",
"0",
"&&",
"str",
".",
"charAt",
"(",
"i",
")",
"==",
"'",
"'",
")",
"{",
"nEscape",
"++",
";",
"i",
"--",
";",
"}",
"boolean",
"result",
"=",
"nEscape",
"%",
"2",
"==",
"1",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"charIsEscaped\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Test if the specified character is escaped.
Checks whether the character at the specified index is preceded by an
escape character. The test is non-trivial because it has to check that
the escape character is itself non-escaped.
@param str The string in which to perform the check
@param index The index in the string of the character that we are interested in.
@return true if the specified character is escaped. | [
"Test",
"if",
"the",
"specified",
"character",
"is",
"escaped",
".",
"Checks",
"whether",
"the",
"character",
"at",
"the",
"specified",
"index",
"is",
"preceded",
"by",
"an",
"escape",
"character",
".",
"The",
"test",
"is",
"non",
"-",
"trivial",
"because",
"it",
"has",
"to",
"check",
"that",
"the",
"escape",
"character",
"is",
"itself",
"non",
"-",
"escaped",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java#L1012-L1029 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java | TokenUtils.readPrivateKey | public static PrivateKey readPrivateKey(String pemResName) throws Exception {
InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName);
byte[] tmp = new byte[4096];
int length = contentIS.read(tmp);
PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length));
return privateKey;
} | java | public static PrivateKey readPrivateKey(String pemResName) throws Exception {
InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName);
byte[] tmp = new byte[4096];
int length = contentIS.read(tmp);
PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length));
return privateKey;
} | [
"public",
"static",
"PrivateKey",
"readPrivateKey",
"(",
"String",
"pemResName",
")",
"throws",
"Exception",
"{",
"InputStream",
"contentIS",
"=",
"TokenUtils",
".",
"class",
".",
"getResourceAsStream",
"(",
"pemResName",
")",
";",
"byte",
"[",
"]",
"tmp",
"=",
"new",
"byte",
"[",
"4096",
"]",
";",
"int",
"length",
"=",
"contentIS",
".",
"read",
"(",
"tmp",
")",
";",
"PrivateKey",
"privateKey",
"=",
"decodePrivateKey",
"(",
"new",
"String",
"(",
"tmp",
",",
"0",
",",
"length",
")",
")",
";",
"return",
"privateKey",
";",
"}"
] | Read a PEM encoded private key from the classpath
@param pemResName - key file resource name
@return PrivateKey
@throws Exception on decode failure | [
"Read",
"a",
"PEM",
"encoded",
"private",
"key",
"from",
"the",
"classpath"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java#L162-L168 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java | TokenUtils.readPublicKey | public static PublicKey readPublicKey(String pemResName) throws Exception {
InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName);
byte[] tmp = new byte[4096];
int length = contentIS.read(tmp);
PublicKey publicKey = decodePublicKey(new String(tmp, 0, length));
return publicKey;
} | java | public static PublicKey readPublicKey(String pemResName) throws Exception {
InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName);
byte[] tmp = new byte[4096];
int length = contentIS.read(tmp);
PublicKey publicKey = decodePublicKey(new String(tmp, 0, length));
return publicKey;
} | [
"public",
"static",
"PublicKey",
"readPublicKey",
"(",
"String",
"pemResName",
")",
"throws",
"Exception",
"{",
"InputStream",
"contentIS",
"=",
"TokenUtils",
".",
"class",
".",
"getResourceAsStream",
"(",
"pemResName",
")",
";",
"byte",
"[",
"]",
"tmp",
"=",
"new",
"byte",
"[",
"4096",
"]",
";",
"int",
"length",
"=",
"contentIS",
".",
"read",
"(",
"tmp",
")",
";",
"PublicKey",
"publicKey",
"=",
"decodePublicKey",
"(",
"new",
"String",
"(",
"tmp",
",",
"0",
",",
"length",
")",
")",
";",
"return",
"publicKey",
";",
"}"
] | Read a PEM encoded public key from the classpath
@param pemResName - key file resource name
@return PublicKey
@throws Exception on decode failure | [
"Read",
"a",
"PEM",
"encoded",
"public",
"key",
"from",
"the",
"classpath"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java#L177-L183 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java | TokenUtils.generateKeyPair | public static KeyPair generateKeyPair(int keySize) throws NoSuchAlgorithmException {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(keySize);
KeyPair keyPair = keyPairGenerator.genKeyPair();
return keyPair;
} | java | public static KeyPair generateKeyPair(int keySize) throws NoSuchAlgorithmException {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(keySize);
KeyPair keyPair = keyPairGenerator.genKeyPair();
return keyPair;
} | [
"public",
"static",
"KeyPair",
"generateKeyPair",
"(",
"int",
"keySize",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"KeyPairGenerator",
"keyPairGenerator",
"=",
"KeyPairGenerator",
".",
"getInstance",
"(",
"\"RSA\"",
")",
";",
"keyPairGenerator",
".",
"initialize",
"(",
"keySize",
")",
";",
"KeyPair",
"keyPair",
"=",
"keyPairGenerator",
".",
"genKeyPair",
"(",
")",
";",
"return",
"keyPair",
";",
"}"
] | Generate a new RSA keypair.
@param keySize - the size of the key
@return KeyPair
@throws NoSuchAlgorithmException on failure to load RSA key generator | [
"Generate",
"a",
"new",
"RSA",
"keypair",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java#L192-L197 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java | TokenUtils.decodePrivateKey | public static PrivateKey decodePrivateKey(String pemEncoded) throws Exception {
pemEncoded = removeBeginEnd(pemEncoded);
byte[] pkcs8EncodedBytes = Base64.getDecoder().decode(pemEncoded);
// extract the private key
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(pkcs8EncodedBytes);
KeyFactory kf = KeyFactory.getInstance("RSA");
PrivateKey privKey = kf.generatePrivate(keySpec);
return privKey;
} | java | public static PrivateKey decodePrivateKey(String pemEncoded) throws Exception {
pemEncoded = removeBeginEnd(pemEncoded);
byte[] pkcs8EncodedBytes = Base64.getDecoder().decode(pemEncoded);
// extract the private key
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(pkcs8EncodedBytes);
KeyFactory kf = KeyFactory.getInstance("RSA");
PrivateKey privKey = kf.generatePrivate(keySpec);
return privKey;
} | [
"public",
"static",
"PrivateKey",
"decodePrivateKey",
"(",
"String",
"pemEncoded",
")",
"throws",
"Exception",
"{",
"pemEncoded",
"=",
"removeBeginEnd",
"(",
"pemEncoded",
")",
";",
"byte",
"[",
"]",
"pkcs8EncodedBytes",
"=",
"Base64",
".",
"getDecoder",
"(",
")",
".",
"decode",
"(",
"pemEncoded",
")",
";",
"// extract the private key",
"PKCS8EncodedKeySpec",
"keySpec",
"=",
"new",
"PKCS8EncodedKeySpec",
"(",
"pkcs8EncodedBytes",
")",
";",
"KeyFactory",
"kf",
"=",
"KeyFactory",
".",
"getInstance",
"(",
"\"RSA\"",
")",
";",
"PrivateKey",
"privKey",
"=",
"kf",
".",
"generatePrivate",
"(",
"keySpec",
")",
";",
"return",
"privKey",
";",
"}"
] | Decode a PEM encoded private key string to an RSA PrivateKey
@param pemEncoded - PEM string for private key
@return PrivateKey
@throws Exception on decode failure | [
"Decode",
"a",
"PEM",
"encoded",
"private",
"key",
"string",
"to",
"an",
"RSA",
"PrivateKey"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java#L206-L216 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java | TokenUtils.decodePublicKey | public static PublicKey decodePublicKey(String pemEncoded) throws Exception {
pemEncoded = removeBeginEnd(pemEncoded);
byte[] encodedBytes = Base64.getDecoder().decode(pemEncoded);
X509EncodedKeySpec spec = new X509EncodedKeySpec(encodedBytes);
KeyFactory kf = KeyFactory.getInstance("RSA");
return kf.generatePublic(spec);
} | java | public static PublicKey decodePublicKey(String pemEncoded) throws Exception {
pemEncoded = removeBeginEnd(pemEncoded);
byte[] encodedBytes = Base64.getDecoder().decode(pemEncoded);
X509EncodedKeySpec spec = new X509EncodedKeySpec(encodedBytes);
KeyFactory kf = KeyFactory.getInstance("RSA");
return kf.generatePublic(spec);
} | [
"public",
"static",
"PublicKey",
"decodePublicKey",
"(",
"String",
"pemEncoded",
")",
"throws",
"Exception",
"{",
"pemEncoded",
"=",
"removeBeginEnd",
"(",
"pemEncoded",
")",
";",
"byte",
"[",
"]",
"encodedBytes",
"=",
"Base64",
".",
"getDecoder",
"(",
")",
".",
"decode",
"(",
"pemEncoded",
")",
";",
"X509EncodedKeySpec",
"spec",
"=",
"new",
"X509EncodedKeySpec",
"(",
"encodedBytes",
")",
";",
"KeyFactory",
"kf",
"=",
"KeyFactory",
".",
"getInstance",
"(",
"\"RSA\"",
")",
";",
"return",
"kf",
".",
"generatePublic",
"(",
"spec",
")",
";",
"}"
] | Decode a PEM encoded public key string to an RSA PublicKey
@param pemEncoded - PEM string for private key
@return PublicKey
@throws Exception on decode failure | [
"Decode",
"a",
"PEM",
"encoded",
"public",
"key",
"string",
"to",
"an",
"RSA",
"PublicKey"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java#L225-L232 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/DeferredService.java | DeferredService.registerDeferredService | public void registerDeferredService(BundleContext bundleContext, Class<?> providedService, Dictionary dict) {
Object obj = serviceReg.get();
if (obj instanceof ServiceRegistration<?>) {
// already registered - nothing to do here
return;
}
if (obj instanceof CountDownLatch) {
// another thread is in the process of (de)registering - wait for it to finish
try {
((CountDownLatch) obj).await();
if (serviceReg.get() instanceof ServiceRegistration<?>) {
// Another thread has successfully registered to return out (so we don't go
// into recursive loop).
return;
}
} catch (InterruptedException swallowed) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Count down interrrupted", swallowed);
}
}
} else {
// This is probably the first thread to register.
// Claim the right to register by setting a latch for other threads to wait on.
CountDownLatch latch = new CountDownLatch(1);
if (serviceReg.compareAndSet(null, latch)) {
// This thread won the right to register the service
try {
serviceReg.set(bundleContext.registerService(providedService.getName(), this, dict));
// successfully registered - nothing more to do
return;
} finally {
// if the serviceReg was not updated for any reason, we need to set it back to null
serviceReg.compareAndSet(latch, null);
// in any case we need to allow any blocked threads to proceed
latch.countDown();
}
}
}
// If we get to here we have not successfully registered
// nor seen another thread successfully register, so just recurse.
registerDeferredService(bundleContext, providedService, dict);
} | java | public void registerDeferredService(BundleContext bundleContext, Class<?> providedService, Dictionary dict) {
Object obj = serviceReg.get();
if (obj instanceof ServiceRegistration<?>) {
// already registered - nothing to do here
return;
}
if (obj instanceof CountDownLatch) {
// another thread is in the process of (de)registering - wait for it to finish
try {
((CountDownLatch) obj).await();
if (serviceReg.get() instanceof ServiceRegistration<?>) {
// Another thread has successfully registered to return out (so we don't go
// into recursive loop).
return;
}
} catch (InterruptedException swallowed) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Count down interrrupted", swallowed);
}
}
} else {
// This is probably the first thread to register.
// Claim the right to register by setting a latch for other threads to wait on.
CountDownLatch latch = new CountDownLatch(1);
if (serviceReg.compareAndSet(null, latch)) {
// This thread won the right to register the service
try {
serviceReg.set(bundleContext.registerService(providedService.getName(), this, dict));
// successfully registered - nothing more to do
return;
} finally {
// if the serviceReg was not updated for any reason, we need to set it back to null
serviceReg.compareAndSet(latch, null);
// in any case we need to allow any blocked threads to proceed
latch.countDown();
}
}
}
// If we get to here we have not successfully registered
// nor seen another thread successfully register, so just recurse.
registerDeferredService(bundleContext, providedService, dict);
} | [
"public",
"void",
"registerDeferredService",
"(",
"BundleContext",
"bundleContext",
",",
"Class",
"<",
"?",
">",
"providedService",
",",
"Dictionary",
"dict",
")",
"{",
"Object",
"obj",
"=",
"serviceReg",
".",
"get",
"(",
")",
";",
"if",
"(",
"obj",
"instanceof",
"ServiceRegistration",
"<",
"?",
">",
")",
"{",
"// already registered - nothing to do here",
"return",
";",
"}",
"if",
"(",
"obj",
"instanceof",
"CountDownLatch",
")",
"{",
"// another thread is in the process of (de)registering - wait for it to finish",
"try",
"{",
"(",
"(",
"CountDownLatch",
")",
"obj",
")",
".",
"await",
"(",
")",
";",
"if",
"(",
"serviceReg",
".",
"get",
"(",
")",
"instanceof",
"ServiceRegistration",
"<",
"?",
">",
")",
"{",
"// Another thread has successfully registered to return out (so we don't go",
"// into recursive loop).",
"return",
";",
"}",
"}",
"catch",
"(",
"InterruptedException",
"swallowed",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Count down interrrupted\"",
",",
"swallowed",
")",
";",
"}",
"}",
"}",
"else",
"{",
"// This is probably the first thread to register.",
"// Claim the right to register by setting a latch for other threads to wait on.",
"CountDownLatch",
"latch",
"=",
"new",
"CountDownLatch",
"(",
"1",
")",
";",
"if",
"(",
"serviceReg",
".",
"compareAndSet",
"(",
"null",
",",
"latch",
")",
")",
"{",
"// This thread won the right to register the service",
"try",
"{",
"serviceReg",
".",
"set",
"(",
"bundleContext",
".",
"registerService",
"(",
"providedService",
".",
"getName",
"(",
")",
",",
"this",
",",
"dict",
")",
")",
";",
"// successfully registered - nothing more to do",
"return",
";",
"}",
"finally",
"{",
"// if the serviceReg was not updated for any reason, we need to set it back to null",
"serviceReg",
".",
"compareAndSet",
"(",
"latch",
",",
"null",
")",
";",
"// in any case we need to allow any blocked threads to proceed",
"latch",
".",
"countDown",
"(",
")",
";",
"}",
"}",
"}",
"// If we get to here we have not successfully registered ",
"// nor seen another thread successfully register, so just recurse.",
"registerDeferredService",
"(",
"bundleContext",
",",
"providedService",
",",
"dict",
")",
";",
"}"
] | Register information available after class loader is created
for use by RAR bundle | [
"Register",
"information",
"available",
"after",
"class",
"loader",
"is",
"created",
"for",
"use",
"by",
"RAR",
"bundle"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/DeferredService.java#L42-L84 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.