repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/ConnectorService.java | ConnectorService.logMessage | public static final void logMessage(Level level, String key, Object... args) {
if (WsLevel.AUDIT.equals(level))
Tr.audit(tc, key, args);
else if (WsLevel.ERROR.equals(level))
Tr.error(tc, key, args);
else if (Level.INFO.equals(level))
Tr.info(tc, key, args);
else if (Level.WARNING.equals(level))
Tr.warning(tc, key, args);
else
throw new UnsupportedOperationException(level.toString());
} | java | public static final void logMessage(Level level, String key, Object... args) {
if (WsLevel.AUDIT.equals(level))
Tr.audit(tc, key, args);
else if (WsLevel.ERROR.equals(level))
Tr.error(tc, key, args);
else if (Level.INFO.equals(level))
Tr.info(tc, key, args);
else if (Level.WARNING.equals(level))
Tr.warning(tc, key, args);
else
throw new UnsupportedOperationException(level.toString());
} | [
"public",
"static",
"final",
"void",
"logMessage",
"(",
"Level",
"level",
",",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"WsLevel",
".",
"AUDIT",
".",
"equals",
"(",
"level",
")",
")",
"Tr",
".",
"audit",
"(",
"tc",
",",
"key",
",",
"args",
")",
";",
"else",
"if",
"(",
"WsLevel",
".",
"ERROR",
".",
"equals",
"(",
"level",
")",
")",
"Tr",
".",
"error",
"(",
"tc",
",",
"key",
",",
"args",
")",
";",
"else",
"if",
"(",
"Level",
".",
"INFO",
".",
"equals",
"(",
"level",
")",
")",
"Tr",
".",
"info",
"(",
"tc",
",",
"key",
",",
"args",
")",
";",
"else",
"if",
"(",
"Level",
".",
"WARNING",
".",
"equals",
"(",
"level",
")",
")",
"Tr",
".",
"warning",
"(",
"tc",
",",
"key",
",",
"args",
")",
";",
"else",
"throw",
"new",
"UnsupportedOperationException",
"(",
"level",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Logs a message from the J2CAMessages file.
@param key message key.
@param args message parameters | [
"Logs",
"a",
"message",
"from",
"the",
"J2CAMessages",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/ConnectorService.java#L118-L129 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.audit.source/src/com/ibm/ws/security/audit/utils/AuditUtils.java | AuditUtils.getSessionID | public static String getSessionID(HttpServletRequest req) {
String sessionID = null;
final HttpServletRequest f_req = req;
try {
sessionID = AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
@Override
public String run() throws Exception {
HttpSession session = f_req.getSession();
if (session != null) {
return session.getId();
} else {
return null;
}
}
});
} catch (PrivilegedActionException e) {
if ((e.getException()) instanceof com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException) {
if (!req.isRequestedSessionIdFromCookie()) {
sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return f_req.getSession().getId();
}
});
} else {
sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return f_req.getRequestedSessionId();
}
});
}
}
} catch (com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException e) {
try {
if (!req.isRequestedSessionIdFromCookie()) {
sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return f_req.getSession().getId();
}
});
} else {
sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return f_req.getRequestedSessionId();
}
});
}
} catch (java.lang.NullPointerException ee) {
sessionID = "UnauthorizedSessionRequest";
} catch (com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException ue) {
sessionID = "UnauthorizedSessionRequest";
}
}
return sessionID;
} | java | public static String getSessionID(HttpServletRequest req) {
String sessionID = null;
final HttpServletRequest f_req = req;
try {
sessionID = AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
@Override
public String run() throws Exception {
HttpSession session = f_req.getSession();
if (session != null) {
return session.getId();
} else {
return null;
}
}
});
} catch (PrivilegedActionException e) {
if ((e.getException()) instanceof com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException) {
if (!req.isRequestedSessionIdFromCookie()) {
sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return f_req.getSession().getId();
}
});
} else {
sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return f_req.getRequestedSessionId();
}
});
}
}
} catch (com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException e) {
try {
if (!req.isRequestedSessionIdFromCookie()) {
sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return f_req.getSession().getId();
}
});
} else {
sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return f_req.getRequestedSessionId();
}
});
}
} catch (java.lang.NullPointerException ee) {
sessionID = "UnauthorizedSessionRequest";
} catch (com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException ue) {
sessionID = "UnauthorizedSessionRequest";
}
}
return sessionID;
} | [
"public",
"static",
"String",
"getSessionID",
"(",
"HttpServletRequest",
"req",
")",
"{",
"String",
"sessionID",
"=",
"null",
";",
"final",
"HttpServletRequest",
"f_req",
"=",
"req",
";",
"try",
"{",
"sessionID",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"run",
"(",
")",
"throws",
"Exception",
"{",
"HttpSession",
"session",
"=",
"f_req",
".",
"getSession",
"(",
")",
";",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"return",
"session",
".",
"getId",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"PrivilegedActionException",
"e",
")",
"{",
"if",
"(",
"(",
"e",
".",
"getException",
"(",
")",
")",
"instanceof",
"com",
".",
"ibm",
".",
"websphere",
".",
"servlet",
".",
"session",
".",
"UnauthorizedSessionRequestException",
")",
"{",
"if",
"(",
"!",
"req",
".",
"isRequestedSessionIdFromCookie",
"(",
")",
")",
"{",
"sessionID",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"run",
"(",
")",
"{",
"return",
"f_req",
".",
"getSession",
"(",
")",
".",
"getId",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"else",
"{",
"sessionID",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"run",
"(",
")",
"{",
"return",
"f_req",
".",
"getRequestedSessionId",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"com",
".",
"ibm",
".",
"websphere",
".",
"servlet",
".",
"session",
".",
"UnauthorizedSessionRequestException",
"e",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"req",
".",
"isRequestedSessionIdFromCookie",
"(",
")",
")",
"{",
"sessionID",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"run",
"(",
")",
"{",
"return",
"f_req",
".",
"getSession",
"(",
")",
".",
"getId",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"else",
"{",
"sessionID",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"run",
"(",
")",
"{",
"return",
"f_req",
".",
"getRequestedSessionId",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"catch",
"(",
"java",
".",
"lang",
".",
"NullPointerException",
"ee",
")",
"{",
"sessionID",
"=",
"\"UnauthorizedSessionRequest\"",
";",
"}",
"catch",
"(",
"com",
".",
"ibm",
".",
"websphere",
".",
"servlet",
".",
"session",
".",
"UnauthorizedSessionRequestException",
"ue",
")",
"{",
"sessionID",
"=",
"\"UnauthorizedSessionRequest\"",
";",
"}",
"}",
"return",
"sessionID",
";",
"}"
] | Return the session id if the request has an HttpSession,
otherwise return null.
@param req
@return session id or null | [
"Return",
"the",
"session",
"id",
"if",
"the",
"request",
"has",
"an",
"HttpSession",
"otherwise",
"return",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.source/src/com/ibm/ws/security/audit/utils/AuditUtils.java#L77-L138 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.audit.source/src/com/ibm/ws/security/audit/utils/AuditUtils.java | AuditUtils.getRequestScheme | public static String getRequestScheme(HttpServletRequest req) {
String scheme;
if (req.getScheme() != null)
scheme = req.getScheme().toUpperCase();
else
scheme = AuditEvent.REASON_TYPE_HTTP;
return scheme;
} | java | public static String getRequestScheme(HttpServletRequest req) {
String scheme;
if (req.getScheme() != null)
scheme = req.getScheme().toUpperCase();
else
scheme = AuditEvent.REASON_TYPE_HTTP;
return scheme;
} | [
"public",
"static",
"String",
"getRequestScheme",
"(",
"HttpServletRequest",
"req",
")",
"{",
"String",
"scheme",
";",
"if",
"(",
"req",
".",
"getScheme",
"(",
")",
"!=",
"null",
")",
"scheme",
"=",
"req",
".",
"getScheme",
"(",
")",
".",
"toUpperCase",
"(",
")",
";",
"else",
"scheme",
"=",
"AuditEvent",
".",
"REASON_TYPE_HTTP",
";",
"return",
"scheme",
";",
"}"
] | Get the scheme from the request - generally "HTTP" or HTTPS"
@param req
@return the scheme | [
"Get",
"the",
"scheme",
"from",
"the",
"request",
"-",
"generally",
"HTTP",
"or",
"HTTPS"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.source/src/com/ibm/ws/security/audit/utils/AuditUtils.java#L146-L153 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.audit.source/src/com/ibm/ws/security/audit/utils/AuditUtils.java | AuditUtils.getRequestMethod | public static String getRequestMethod(HttpServletRequest req) {
String method;
if (req.getMethod() != null)
method = req.getMethod().toUpperCase();
else
method = AuditEvent.TARGET_METHOD_GET;
return method;
} | java | public static String getRequestMethod(HttpServletRequest req) {
String method;
if (req.getMethod() != null)
method = req.getMethod().toUpperCase();
else
method = AuditEvent.TARGET_METHOD_GET;
return method;
} | [
"public",
"static",
"String",
"getRequestMethod",
"(",
"HttpServletRequest",
"req",
")",
"{",
"String",
"method",
";",
"if",
"(",
"req",
".",
"getMethod",
"(",
")",
"!=",
"null",
")",
"method",
"=",
"req",
".",
"getMethod",
"(",
")",
".",
"toUpperCase",
"(",
")",
";",
"else",
"method",
"=",
"AuditEvent",
".",
"TARGET_METHOD_GET",
";",
"return",
"method",
";",
"}"
] | Get the method from the request - generally "GET" or "POST"
@param req
@return the method | [
"Get",
"the",
"method",
"from",
"the",
"request",
"-",
"generally",
"GET",
"or",
"POST"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.source/src/com/ibm/ws/security/audit/utils/AuditUtils.java#L171-L178 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/objectpool/CircularObjectPool.java | CircularObjectPool.get | @Override
public Object get() {
Object oObject = null;
synchronized (this) {
// Check if any are free in the free hashtable
if (lastEntry > -1) {
// Free array has entries, get the last one.
// remove last one for best performance
oObject = free[lastEntry];
free[lastEntry] = null;
if (lastEntry == firstEntry) { // none left in pool
lastEntry = -1;
firstEntry = -1;
} else if (lastEntry > 0) {
lastEntry = lastEntry - 1;
} else { // last entry = 0, reset to end of list
lastEntry = poolSize - 1;
}
}
}
if (oObject == null && factory != null) {
oObject = factory.create();
}
return oObject;
} | java | @Override
public Object get() {
Object oObject = null;
synchronized (this) {
// Check if any are free in the free hashtable
if (lastEntry > -1) {
// Free array has entries, get the last one.
// remove last one for best performance
oObject = free[lastEntry];
free[lastEntry] = null;
if (lastEntry == firstEntry) { // none left in pool
lastEntry = -1;
firstEntry = -1;
} else if (lastEntry > 0) {
lastEntry = lastEntry - 1;
} else { // last entry = 0, reset to end of list
lastEntry = poolSize - 1;
}
}
}
if (oObject == null && factory != null) {
oObject = factory.create();
}
return oObject;
} | [
"@",
"Override",
"public",
"Object",
"get",
"(",
")",
"{",
"Object",
"oObject",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"// Check if any are free in the free hashtable",
"if",
"(",
"lastEntry",
">",
"-",
"1",
")",
"{",
"// Free array has entries, get the last one.",
"// remove last one for best performance",
"oObject",
"=",
"free",
"[",
"lastEntry",
"]",
";",
"free",
"[",
"lastEntry",
"]",
"=",
"null",
";",
"if",
"(",
"lastEntry",
"==",
"firstEntry",
")",
"{",
"// none left in pool",
"lastEntry",
"=",
"-",
"1",
";",
"firstEntry",
"=",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"lastEntry",
">",
"0",
")",
"{",
"lastEntry",
"=",
"lastEntry",
"-",
"1",
";",
"}",
"else",
"{",
"// last entry = 0, reset to end of list",
"lastEntry",
"=",
"poolSize",
"-",
"1",
";",
"}",
"}",
"}",
"if",
"(",
"oObject",
"==",
"null",
"&&",
"factory",
"!=",
"null",
")",
"{",
"oObject",
"=",
"factory",
".",
"create",
"(",
")",
";",
"}",
"return",
"oObject",
";",
"}"
] | Gets an Object from the pool and returns it. If there are
currently no entries in the pool then a new object will be
created.
@return Object from the pool | [
"Gets",
"an",
"Object",
"from",
"the",
"pool",
"and",
"returns",
"it",
".",
"If",
"there",
"are",
"currently",
"no",
"entries",
"in",
"the",
"pool",
"then",
"a",
"new",
"object",
"will",
"be",
"created",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/objectpool/CircularObjectPool.java#L89-L116 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/objectpool/CircularObjectPool.java | CircularObjectPool.put | @Override
public Object put(Object object) {
Object returnVal = null;
long currentTime = CHFWBundle.getApproxTime();
synchronized (this) {
// get next free position, or oldest position if none free
lastEntry++;
// If last entry is past end of array, go back to the beginning
if (lastEntry == poolSize) {
lastEntry = 0;
}
returnVal = free[lastEntry]; // get whatever was in that slot for return
// value
free[lastEntry] = object;
timeFreed[lastEntry] = currentTime;
// if we overlaid the first/oldest entry, reset the first entry position
if (lastEntry == firstEntry) {
firstEntry++;
if (firstEntry == poolSize) {
firstEntry = 0;
}
}
if (firstEntry == -1) { // if pool was empty before, this is first entry now
firstEntry = lastEntry; // should always be at '0', this may
// overwrite the oldest entry, in which case
// the oldest one will be garbage collected
}
if (returnVal != null && destroyer != null) { // @PK36998A
destroyer.destroy(returnVal);
}
// check timestamp of oldest entry, and delete if older than 60 seconds
// we should do a batch cleanup of all pools based on a timer rather than
// waiting for a buffer to be released to trigger it, maybe in the next
// release
if (cleanUpOld) {
while (firstEntry != lastEntry) {
if (currentTime > (timeFreed[firstEntry] + 60000L)) {
if (destroyer != null && free[firstEntry] != null) { // @PK36998A
destroyer.destroy(free[firstEntry]);
}
free[firstEntry] = null;
firstEntry++;
if (firstEntry == poolSize) {
firstEntry = 0;
}
} else
break;
}
}
}
return returnVal;
} | java | @Override
public Object put(Object object) {
Object returnVal = null;
long currentTime = CHFWBundle.getApproxTime();
synchronized (this) {
// get next free position, or oldest position if none free
lastEntry++;
// If last entry is past end of array, go back to the beginning
if (lastEntry == poolSize) {
lastEntry = 0;
}
returnVal = free[lastEntry]; // get whatever was in that slot for return
// value
free[lastEntry] = object;
timeFreed[lastEntry] = currentTime;
// if we overlaid the first/oldest entry, reset the first entry position
if (lastEntry == firstEntry) {
firstEntry++;
if (firstEntry == poolSize) {
firstEntry = 0;
}
}
if (firstEntry == -1) { // if pool was empty before, this is first entry now
firstEntry = lastEntry; // should always be at '0', this may
// overwrite the oldest entry, in which case
// the oldest one will be garbage collected
}
if (returnVal != null && destroyer != null) { // @PK36998A
destroyer.destroy(returnVal);
}
// check timestamp of oldest entry, and delete if older than 60 seconds
// we should do a batch cleanup of all pools based on a timer rather than
// waiting for a buffer to be released to trigger it, maybe in the next
// release
if (cleanUpOld) {
while (firstEntry != lastEntry) {
if (currentTime > (timeFreed[firstEntry] + 60000L)) {
if (destroyer != null && free[firstEntry] != null) { // @PK36998A
destroyer.destroy(free[firstEntry]);
}
free[firstEntry] = null;
firstEntry++;
if (firstEntry == poolSize) {
firstEntry = 0;
}
} else
break;
}
}
}
return returnVal;
} | [
"@",
"Override",
"public",
"Object",
"put",
"(",
"Object",
"object",
")",
"{",
"Object",
"returnVal",
"=",
"null",
";",
"long",
"currentTime",
"=",
"CHFWBundle",
".",
"getApproxTime",
"(",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"// get next free position, or oldest position if none free",
"lastEntry",
"++",
";",
"// If last entry is past end of array, go back to the beginning",
"if",
"(",
"lastEntry",
"==",
"poolSize",
")",
"{",
"lastEntry",
"=",
"0",
";",
"}",
"returnVal",
"=",
"free",
"[",
"lastEntry",
"]",
";",
"// get whatever was in that slot for return",
"// value",
"free",
"[",
"lastEntry",
"]",
"=",
"object",
";",
"timeFreed",
"[",
"lastEntry",
"]",
"=",
"currentTime",
";",
"// if we overlaid the first/oldest entry, reset the first entry position",
"if",
"(",
"lastEntry",
"==",
"firstEntry",
")",
"{",
"firstEntry",
"++",
";",
"if",
"(",
"firstEntry",
"==",
"poolSize",
")",
"{",
"firstEntry",
"=",
"0",
";",
"}",
"}",
"if",
"(",
"firstEntry",
"==",
"-",
"1",
")",
"{",
"// if pool was empty before, this is first entry now",
"firstEntry",
"=",
"lastEntry",
";",
"// should always be at '0', this may",
"// overwrite the oldest entry, in which case",
"// the oldest one will be garbage collected",
"}",
"if",
"(",
"returnVal",
"!=",
"null",
"&&",
"destroyer",
"!=",
"null",
")",
"{",
"// @PK36998A",
"destroyer",
".",
"destroy",
"(",
"returnVal",
")",
";",
"}",
"// check timestamp of oldest entry, and delete if older than 60 seconds",
"// we should do a batch cleanup of all pools based on a timer rather than",
"// waiting for a buffer to be released to trigger it, maybe in the next",
"// release",
"if",
"(",
"cleanUpOld",
")",
"{",
"while",
"(",
"firstEntry",
"!=",
"lastEntry",
")",
"{",
"if",
"(",
"currentTime",
">",
"(",
"timeFreed",
"[",
"firstEntry",
"]",
"+",
"60000L",
")",
")",
"{",
"if",
"(",
"destroyer",
"!=",
"null",
"&&",
"free",
"[",
"firstEntry",
"]",
"!=",
"null",
")",
"{",
"// @PK36998A",
"destroyer",
".",
"destroy",
"(",
"free",
"[",
"firstEntry",
"]",
")",
";",
"}",
"free",
"[",
"firstEntry",
"]",
"=",
"null",
";",
"firstEntry",
"++",
";",
"if",
"(",
"firstEntry",
"==",
"poolSize",
")",
"{",
"firstEntry",
"=",
"0",
";",
"}",
"}",
"else",
"break",
";",
"}",
"}",
"}",
"return",
"returnVal",
";",
"}"
] | Puts an Object into the free pool. If the free pool is full
then this object will overlay the oldest object in the pool.
@param object
to be put in the pool. | [
"Puts",
"an",
"Object",
"into",
"the",
"free",
"pool",
".",
"If",
"the",
"free",
"pool",
"is",
"full",
"then",
"this",
"object",
"will",
"overlay",
"the",
"oldest",
"object",
"in",
"the",
"pool",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/objectpool/CircularObjectPool.java#L125-L179 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/objectpool/CircularObjectPool.java | CircularObjectPool.putBatch | protected void putBatch(Object[] objectArray) {
int index = 0;
synchronized (this) {
while (index < objectArray.length && objectArray[index] != null) {
put(objectArray[index]);
index++;
}
}
return;
} | java | protected void putBatch(Object[] objectArray) {
int index = 0;
synchronized (this) {
while (index < objectArray.length && objectArray[index] != null) {
put(objectArray[index]);
index++;
}
}
return;
} | [
"protected",
"void",
"putBatch",
"(",
"Object",
"[",
"]",
"objectArray",
")",
"{",
"int",
"index",
"=",
"0",
";",
"synchronized",
"(",
"this",
")",
"{",
"while",
"(",
"index",
"<",
"objectArray",
".",
"length",
"&&",
"objectArray",
"[",
"index",
"]",
"!=",
"null",
")",
"{",
"put",
"(",
"objectArray",
"[",
"index",
"]",
")",
";",
"index",
"++",
";",
"}",
"}",
"return",
";",
"}"
] | Puts a set of Objects into the free pool. If the free pool is full
then this object will overlay the oldest object in the pool.
@param objectArray
list of objects to put into the pool | [
"Puts",
"a",
"set",
"of",
"Objects",
"into",
"the",
"free",
"pool",
".",
"If",
"the",
"free",
"pool",
"is",
"full",
"then",
"this",
"object",
"will",
"overlay",
"the",
"oldest",
"object",
"in",
"the",
"pool",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/channelfw/objectpool/CircularObjectPool.java#L221-L231 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java | JsJmsMessageFactoryImpl.createJmsMessage | public JsJmsMessage createJmsMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsMessage");
JsJmsMessage msg = null;
try {
msg = new JsJmsMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsMessage");
return msg;
} | java | public JsJmsMessage createJmsMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsMessage");
JsJmsMessage msg = null;
try {
msg = new JsJmsMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsMessage");
return msg;
} | [
"public",
"JsJmsMessage",
"createJmsMessage",
"(",
")",
"throws",
"MessageCreateFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createJmsMessage\"",
")",
";",
"JsJmsMessage",
"msg",
"=",
"null",
";",
"try",
"{",
"msg",
"=",
"new",
"JsJmsMessageImpl",
"(",
"MfpConstants",
".",
"CONSTRUCTOR_NO_OP",
")",
";",
"}",
"catch",
"(",
"MessageDecodeFailedException",
"e",
")",
"{",
"/* No need to FFDC this as JsMsgObject will already have done so */",
"// No FFDC code needed",
"throw",
"new",
"MessageCreateFailedException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createJmsMessage\"",
")",
";",
"return",
"msg",
";",
"}"
] | Create a new, empty null-bodied JMS Message.
To be called by the API component.
@return The new JsJmsMessage
@exception MessageCreateFailedException Thrown if such a message can not be created | [
"Create",
"a",
"new",
"empty",
"null",
"-",
"bodied",
"JMS",
"Message",
".",
"To",
"be",
"called",
"by",
"the",
"API",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java#L38-L51 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java | JsJmsMessageFactoryImpl.createJmsBytesMessage | public JsJmsBytesMessage createJmsBytesMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsBytesMessage");
JsJmsBytesMessage msg = null;
try {
msg = new JsJmsBytesMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsBytesMessage");
return msg;
} | java | public JsJmsBytesMessage createJmsBytesMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsBytesMessage");
JsJmsBytesMessage msg = null;
try {
msg = new JsJmsBytesMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsBytesMessage");
return msg;
} | [
"public",
"JsJmsBytesMessage",
"createJmsBytesMessage",
"(",
")",
"throws",
"MessageCreateFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createJmsBytesMessage\"",
")",
";",
"JsJmsBytesMessage",
"msg",
"=",
"null",
";",
"try",
"{",
"msg",
"=",
"new",
"JsJmsBytesMessageImpl",
"(",
"MfpConstants",
".",
"CONSTRUCTOR_NO_OP",
")",
";",
"}",
"catch",
"(",
"MessageDecodeFailedException",
"e",
")",
"{",
"/* No need to FFDC this as JsMsgObject will already have done so */",
"// No FFDC code needed",
"throw",
"new",
"MessageCreateFailedException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createJmsBytesMessage\"",
")",
";",
"return",
"msg",
";",
"}"
] | Create a new, empty JMS BytesMessage.
To be called by the API component.
@return The new JsJmsBytesMessage
@exception MessageCreateFailedException Thrown if such a message can not be created | [
"Create",
"a",
"new",
"empty",
"JMS",
"BytesMessage",
".",
"To",
"be",
"called",
"by",
"the",
"API",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java#L61-L74 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java | JsJmsMessageFactoryImpl.createJmsMapMessage | public JsJmsMapMessage createJmsMapMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsMapMessage");
JsJmsMapMessage msg = null;
try {
msg = new JsJmsMapMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsMapMessage");
return msg;
} | java | public JsJmsMapMessage createJmsMapMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsMapMessage");
JsJmsMapMessage msg = null;
try {
msg = new JsJmsMapMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsMapMessage");
return msg;
} | [
"public",
"JsJmsMapMessage",
"createJmsMapMessage",
"(",
")",
"throws",
"MessageCreateFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createJmsMapMessage\"",
")",
";",
"JsJmsMapMessage",
"msg",
"=",
"null",
";",
"try",
"{",
"msg",
"=",
"new",
"JsJmsMapMessageImpl",
"(",
"MfpConstants",
".",
"CONSTRUCTOR_NO_OP",
")",
";",
"}",
"catch",
"(",
"MessageDecodeFailedException",
"e",
")",
"{",
"/* No need to FFDC this as JsMsgObject will already have done so */",
"// No FFDC code needed",
"throw",
"new",
"MessageCreateFailedException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createJmsMapMessage\"",
")",
";",
"return",
"msg",
";",
"}"
] | Create a new, empty JMS MapMessage.
To be called by the API component.
@return The new JsJmsMapMessage
@exception MessageCreateFailedException Thrown if such a message can not be created | [
"Create",
"a",
"new",
"empty",
"JMS",
"MapMessage",
".",
"To",
"be",
"called",
"by",
"the",
"API",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java#L84-L97 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java | JsJmsMessageFactoryImpl.createJmsObjectMessage | public JsJmsObjectMessage createJmsObjectMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsObjectMessage");
JsJmsObjectMessage msg = null;
try {
msg = new JsJmsObjectMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsObjectMessage");
return msg;
} | java | public JsJmsObjectMessage createJmsObjectMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsObjectMessage");
JsJmsObjectMessage msg = null;
try {
msg = new JsJmsObjectMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsObjectMessage");
return msg;
} | [
"public",
"JsJmsObjectMessage",
"createJmsObjectMessage",
"(",
")",
"throws",
"MessageCreateFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createJmsObjectMessage\"",
")",
";",
"JsJmsObjectMessage",
"msg",
"=",
"null",
";",
"try",
"{",
"msg",
"=",
"new",
"JsJmsObjectMessageImpl",
"(",
"MfpConstants",
".",
"CONSTRUCTOR_NO_OP",
")",
";",
"}",
"catch",
"(",
"MessageDecodeFailedException",
"e",
")",
"{",
"/* No need to FFDC this as JsMsgObject will already have done so */",
"// No FFDC code needed",
"throw",
"new",
"MessageCreateFailedException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createJmsObjectMessage\"",
")",
";",
"return",
"msg",
";",
"}"
] | Create a new, empty JMS ObjectMessage.
To be called by the API component.
@return The new JsJmsObjectMessage
@exception MessageCreateFailedException Thrown if such a message can not be created | [
"Create",
"a",
"new",
"empty",
"JMS",
"ObjectMessage",
".",
"To",
"be",
"called",
"by",
"the",
"API",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java#L107-L120 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java | JsJmsMessageFactoryImpl.createJmsStreamMessage | public JsJmsStreamMessage createJmsStreamMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsStreamMessage");
JsJmsStreamMessage msg = null;
try {
msg = new JsJmsStreamMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsStreamMessage");
return msg;
} | java | public JsJmsStreamMessage createJmsStreamMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsStreamMessage");
JsJmsStreamMessage msg = null;
try {
msg = new JsJmsStreamMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsStreamMessage");
return msg;
} | [
"public",
"JsJmsStreamMessage",
"createJmsStreamMessage",
"(",
")",
"throws",
"MessageCreateFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createJmsStreamMessage\"",
")",
";",
"JsJmsStreamMessage",
"msg",
"=",
"null",
";",
"try",
"{",
"msg",
"=",
"new",
"JsJmsStreamMessageImpl",
"(",
"MfpConstants",
".",
"CONSTRUCTOR_NO_OP",
")",
";",
"}",
"catch",
"(",
"MessageDecodeFailedException",
"e",
")",
"{",
"/* No need to FFDC this as JsMsgObject will already have done so */",
"// No FFDC code needed",
"throw",
"new",
"MessageCreateFailedException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createJmsStreamMessage\"",
")",
";",
"return",
"msg",
";",
"}"
] | Create a new, empty JMS StreamMessage.
To be called by the API component.
@return The new JsJmsStreamMessage
@exception MessageCreateFailedException Thrown if such a message can not be created | [
"Create",
"a",
"new",
"empty",
"JMS",
"StreamMessage",
".",
"To",
"be",
"called",
"by",
"the",
"API",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java#L130-L143 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java | JsJmsMessageFactoryImpl.createJmsTextMessage | public JsJmsTextMessage createJmsTextMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsTextMessage");
JsJmsTextMessage msg = null;
try {
msg = new JsJmsTextMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsTextMessage");
return msg;
} | java | public JsJmsTextMessage createJmsTextMessage() throws MessageCreateFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsTextMessage");
JsJmsTextMessage msg = null;
try {
msg = new JsJmsTextMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
}
catch (MessageDecodeFailedException e) {
/* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsTextMessage");
return msg;
} | [
"public",
"JsJmsTextMessage",
"createJmsTextMessage",
"(",
")",
"throws",
"MessageCreateFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createJmsTextMessage\"",
")",
";",
"JsJmsTextMessage",
"msg",
"=",
"null",
";",
"try",
"{",
"msg",
"=",
"new",
"JsJmsTextMessageImpl",
"(",
"MfpConstants",
".",
"CONSTRUCTOR_NO_OP",
")",
";",
"}",
"catch",
"(",
"MessageDecodeFailedException",
"e",
")",
"{",
"/* No need to FFDC this as JsMsgObject will already have done so */",
"// No FFDC code needed",
"throw",
"new",
"MessageCreateFailedException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createJmsTextMessage\"",
")",
";",
"return",
"msg",
";",
"}"
] | Create a new, empty JMS TextMessage.
To be called by the API component.
@return The new JsJmsTextMessage
@exception MessageCreateFailedException Thrown if such a message can not be created | [
"Create",
"a",
"new",
"empty",
"JMS",
"TextMessage",
".",
"To",
"be",
"called",
"by",
"the",
"API",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMessageFactoryImpl.java#L153-L166 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java | SSLReadServiceContext.saveDecryptedPositions | private void saveDecryptedPositions() {
for (int i = 0; i < decryptedNetPosInfo.length; i++) {
decryptedNetPosInfo[i] = 0;
}
if (null != getBuffers()) {
WsByteBuffer[] buffers = getBuffers();
if (buffers.length > decryptedNetPosInfo.length) {
decryptedNetPosInfo = new int[buffers.length];
}
for (int i = 0; i < buffers.length && null != buffers[i]; i++) {
decryptedNetPosInfo[i] = buffers[i].position();
}
}
} | java | private void saveDecryptedPositions() {
for (int i = 0; i < decryptedNetPosInfo.length; i++) {
decryptedNetPosInfo[i] = 0;
}
if (null != getBuffers()) {
WsByteBuffer[] buffers = getBuffers();
if (buffers.length > decryptedNetPosInfo.length) {
decryptedNetPosInfo = new int[buffers.length];
}
for (int i = 0; i < buffers.length && null != buffers[i]; i++) {
decryptedNetPosInfo[i] = buffers[i].position();
}
}
} | [
"private",
"void",
"saveDecryptedPositions",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"decryptedNetPosInfo",
".",
"length",
";",
"i",
"++",
")",
"{",
"decryptedNetPosInfo",
"[",
"i",
"]",
"=",
"0",
";",
"}",
"if",
"(",
"null",
"!=",
"getBuffers",
"(",
")",
")",
"{",
"WsByteBuffer",
"[",
"]",
"buffers",
"=",
"getBuffers",
"(",
")",
";",
"if",
"(",
"buffers",
".",
"length",
">",
"decryptedNetPosInfo",
".",
"length",
")",
"{",
"decryptedNetPosInfo",
"=",
"new",
"int",
"[",
"buffers",
".",
"length",
"]",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"buffers",
".",
"length",
"&&",
"null",
"!=",
"buffers",
"[",
"i",
"]",
";",
"i",
"++",
")",
"{",
"decryptedNetPosInfo",
"[",
"i",
"]",
"=",
"buffers",
"[",
"i",
"]",
".",
"position",
"(",
")",
";",
"}",
"}",
"}"
] | Save the starting positions of the output buffers so that we can properly
calculate the amount of data being returned by the read. | [
"Save",
"the",
"starting",
"positions",
"of",
"the",
"output",
"buffers",
"so",
"that",
"we",
"can",
"properly",
"calculate",
"the",
"amount",
"of",
"data",
"being",
"returned",
"by",
"the",
"read",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java#L100-L113 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java | SSLReadServiceContext.read | @Override
public VirtualConnection read(long numBytes, TCPReadCompletedCallback userCallback, boolean forceQueue, int timeout) {
// Call the async read with a flag showing this was not done from a queued request.
return read(numBytes, userCallback, forceQueue, timeout, false);
} | java | @Override
public VirtualConnection read(long numBytes, TCPReadCompletedCallback userCallback, boolean forceQueue, int timeout) {
// Call the async read with a flag showing this was not done from a queued request.
return read(numBytes, userCallback, forceQueue, timeout, false);
} | [
"@",
"Override",
"public",
"VirtualConnection",
"read",
"(",
"long",
"numBytes",
",",
"TCPReadCompletedCallback",
"userCallback",
",",
"boolean",
"forceQueue",
",",
"int",
"timeout",
")",
"{",
"// Call the async read with a flag showing this was not done from a queued request.",
"return",
"read",
"(",
"numBytes",
",",
"userCallback",
",",
"forceQueue",
",",
"timeout",
",",
"false",
")",
";",
"}"
] | Note, a separate thread is not spawned to handle the decryption. The asynchronous
behavior of this call will take place when the device side channel makes a
nonblocking IO call and the request is potentially moved to a separate thread.
The buffers potentially set from the calling application will be used to store the
output of the decrypted message. No read buffers are set in the device channel. It
will have the responsibility of allocating while we will have the responsibility of
releasing.
@see com.ibm.wsspi.tcpchannel.TCPReadRequestContext#read(long, TCPReadCompletedCallback, boolean, int) | [
"Note",
"a",
"separate",
"thread",
"is",
"not",
"spawned",
"to",
"handle",
"the",
"decryption",
".",
"The",
"asynchronous",
"behavior",
"of",
"this",
"call",
"will",
"take",
"place",
"when",
"the",
"device",
"side",
"channel",
"makes",
"a",
"nonblocking",
"IO",
"call",
"and",
"the",
"request",
"is",
"potentially",
"moved",
"to",
"a",
"separate",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java#L359-L363 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java | SSLReadServiceContext.handleAsyncComplete | private void handleAsyncComplete(boolean forceQueue, TCPReadCompletedCallback inCallback) {
boolean fireHere = true;
if (forceQueue) {
// Complete must be returned on a separate thread.
// Reuse queuedWork object (performance), but reset the error parameters.
queuedWork.setCompleteParameters(getConnLink().getVirtualConnection(), this, inCallback);
EventEngine events = SSLChannelProvider.getEventService();
if (null == events) {
Exception e = new Exception("missing event service");
FFDCFilter.processException(e, getClass().getName(), "471", this);
// fall-thru below and use callback here regardless
} else {
// fire an event to continue this queued work
Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK);
event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork);
events.postEvent(event);
fireHere = false;
}
}
if (fireHere) {
// Call the callback right here.
inCallback.complete(getConnLink().getVirtualConnection(), this);
}
} | java | private void handleAsyncComplete(boolean forceQueue, TCPReadCompletedCallback inCallback) {
boolean fireHere = true;
if (forceQueue) {
// Complete must be returned on a separate thread.
// Reuse queuedWork object (performance), but reset the error parameters.
queuedWork.setCompleteParameters(getConnLink().getVirtualConnection(), this, inCallback);
EventEngine events = SSLChannelProvider.getEventService();
if (null == events) {
Exception e = new Exception("missing event service");
FFDCFilter.processException(e, getClass().getName(), "471", this);
// fall-thru below and use callback here regardless
} else {
// fire an event to continue this queued work
Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK);
event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork);
events.postEvent(event);
fireHere = false;
}
}
if (fireHere) {
// Call the callback right here.
inCallback.complete(getConnLink().getVirtualConnection(), this);
}
} | [
"private",
"void",
"handleAsyncComplete",
"(",
"boolean",
"forceQueue",
",",
"TCPReadCompletedCallback",
"inCallback",
")",
"{",
"boolean",
"fireHere",
"=",
"true",
";",
"if",
"(",
"forceQueue",
")",
"{",
"// Complete must be returned on a separate thread.",
"// Reuse queuedWork object (performance), but reset the error parameters.",
"queuedWork",
".",
"setCompleteParameters",
"(",
"getConnLink",
"(",
")",
".",
"getVirtualConnection",
"(",
")",
",",
"this",
",",
"inCallback",
")",
";",
"EventEngine",
"events",
"=",
"SSLChannelProvider",
".",
"getEventService",
"(",
")",
";",
"if",
"(",
"null",
"==",
"events",
")",
"{",
"Exception",
"e",
"=",
"new",
"Exception",
"(",
"\"missing event service\"",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"471\"",
",",
"this",
")",
";",
"// fall-thru below and use callback here regardless",
"}",
"else",
"{",
"// fire an event to continue this queued work",
"Event",
"event",
"=",
"events",
".",
"createEvent",
"(",
"SSLEventHandler",
".",
"TOPIC_QUEUED_WORK",
")",
";",
"event",
".",
"setProperty",
"(",
"SSLEventHandler",
".",
"KEY_RUNNABLE",
",",
"this",
".",
"queuedWork",
")",
";",
"events",
".",
"postEvent",
"(",
"event",
")",
";",
"fireHere",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"fireHere",
")",
"{",
"// Call the callback right here.",
"inCallback",
".",
"complete",
"(",
"getConnLink",
"(",
")",
".",
"getVirtualConnection",
"(",
")",
",",
"this",
")",
";",
"}",
"}"
] | This method handles calling the complete method of the callback as required by an async
read. Appropriate action is taken based on the setting of the forceQueue parameter.
If it is true, the complete callback is called on a separate thread. Otherwise it is
called right here.
@param forceQueue
@param inCallback | [
"This",
"method",
"handles",
"calling",
"the",
"complete",
"method",
"of",
"the",
"callback",
"as",
"required",
"by",
"an",
"async",
"read",
".",
"Appropriate",
"action",
"is",
"taken",
"based",
"on",
"the",
"setting",
"of",
"the",
"forceQueue",
"parameter",
".",
"If",
"it",
"is",
"true",
"the",
"complete",
"callback",
"is",
"called",
"on",
"a",
"separate",
"thread",
".",
"Otherwise",
"it",
"is",
"called",
"right",
"here",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java#L576-L600 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java | SSLReadServiceContext.handleAsyncError | private void handleAsyncError(boolean forceQueue, IOException exception, TCPReadCompletedCallback inCallback) {
boolean fireHere = true;
if (forceQueue) {
// Error must be returned on a separate thread.
// Reuse queuedWork object (performance), but reset the error parameters.
queuedWork.setErrorParameters(getConnLink().getVirtualConnection(),
this, inCallback, exception);
EventEngine events = SSLChannelProvider.getEventService();
if (null == events) {
Exception e = new Exception("missing event service");
FFDCFilter.processException(e, getClass().getName(), "503", this);
// fall-thru below and use callback here regardless
} else {
// fire an event to continue this queued work
Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK);
event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork);
events.postEvent(event);
fireHere = false;
}
}
if (fireHere) {
// Call the callback right here.
inCallback.error(getConnLink().getVirtualConnection(), this, exception);
}
} | java | private void handleAsyncError(boolean forceQueue, IOException exception, TCPReadCompletedCallback inCallback) {
boolean fireHere = true;
if (forceQueue) {
// Error must be returned on a separate thread.
// Reuse queuedWork object (performance), but reset the error parameters.
queuedWork.setErrorParameters(getConnLink().getVirtualConnection(),
this, inCallback, exception);
EventEngine events = SSLChannelProvider.getEventService();
if (null == events) {
Exception e = new Exception("missing event service");
FFDCFilter.processException(e, getClass().getName(), "503", this);
// fall-thru below and use callback here regardless
} else {
// fire an event to continue this queued work
Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK);
event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork);
events.postEvent(event);
fireHere = false;
}
}
if (fireHere) {
// Call the callback right here.
inCallback.error(getConnLink().getVirtualConnection(), this, exception);
}
} | [
"private",
"void",
"handleAsyncError",
"(",
"boolean",
"forceQueue",
",",
"IOException",
"exception",
",",
"TCPReadCompletedCallback",
"inCallback",
")",
"{",
"boolean",
"fireHere",
"=",
"true",
";",
"if",
"(",
"forceQueue",
")",
"{",
"// Error must be returned on a separate thread.",
"// Reuse queuedWork object (performance), but reset the error parameters.",
"queuedWork",
".",
"setErrorParameters",
"(",
"getConnLink",
"(",
")",
".",
"getVirtualConnection",
"(",
")",
",",
"this",
",",
"inCallback",
",",
"exception",
")",
";",
"EventEngine",
"events",
"=",
"SSLChannelProvider",
".",
"getEventService",
"(",
")",
";",
"if",
"(",
"null",
"==",
"events",
")",
"{",
"Exception",
"e",
"=",
"new",
"Exception",
"(",
"\"missing event service\"",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"503\"",
",",
"this",
")",
";",
"// fall-thru below and use callback here regardless",
"}",
"else",
"{",
"// fire an event to continue this queued work",
"Event",
"event",
"=",
"events",
".",
"createEvent",
"(",
"SSLEventHandler",
".",
"TOPIC_QUEUED_WORK",
")",
";",
"event",
".",
"setProperty",
"(",
"SSLEventHandler",
".",
"KEY_RUNNABLE",
",",
"this",
".",
"queuedWork",
")",
";",
"events",
".",
"postEvent",
"(",
"event",
")",
";",
"fireHere",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"fireHere",
")",
"{",
"// Call the callback right here.",
"inCallback",
".",
"error",
"(",
"getConnLink",
"(",
")",
".",
"getVirtualConnection",
"(",
")",
",",
"this",
",",
"exception",
")",
";",
"}",
"}"
] | This method handles errors when they occur during the code path of an async read. It takes
appropriate action based on the setting of the forceQueue parameter. If it is true, the
error callback is called on a separate thread. Otherwise it is called right here.
@param forceQueue
@param exception
@param inCallback | [
"This",
"method",
"handles",
"errors",
"when",
"they",
"occur",
"during",
"the",
"code",
"path",
"of",
"an",
"async",
"read",
".",
"It",
"takes",
"appropriate",
"action",
"based",
"on",
"the",
"setting",
"of",
"the",
"forceQueue",
"parameter",
".",
"If",
"it",
"is",
"true",
"the",
"error",
"callback",
"is",
"called",
"on",
"a",
"separate",
"thread",
".",
"Otherwise",
"it",
"is",
"called",
"right",
"here",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java#L611-L636 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java | SSLReadServiceContext.readUnconsumedDecData | public long readUnconsumedDecData() {
long totalBytesRead = 0L;
// Determine if data is left over from a former read request.
if (unconsumedDecData != null) {
// Left over data exists. Is there enough to satisfy the request?
if (getBuffer() == null) {
// Caller needs us to allocate the buffer to return.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caller needs buffer, unconsumed data: "
+ SSLUtils.getBufferTraceInfo(unconsumedDecData));
}
// Note, data of unconsumedDecData buffer array should be starting
// at position 0 in the first buffer.
totalBytesRead = SSLUtils.lengthOf(unconsumedDecData, 0);
// First release any existing buffers in decryptedNetBuffers array.
cleanupDecBuffers();
callerRequiredAllocation = true;
// Note, it is the responsibility of the calling channel to release this buffer.
decryptedNetBuffers = unconsumedDecData;
// Set left over buffers to null to note that they are no longer in use.
unconsumedDecData = null;
if ((decryptedNetLimitInfo == null)
|| (decryptedNetLimitInfo.length != decryptedNetBuffers.length)) {
decryptedNetLimitInfo = new int[decryptedNetBuffers.length];
}
SSLUtils.getBufferLimits(decryptedNetBuffers, decryptedNetLimitInfo);
} else {
// Caller provided buffers for read. We need to copy the left over
// data to those buffers.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caller provided buffers, unconsumed data: "
+ SSLUtils.getBufferTraceInfo(unconsumedDecData));
}
// First release any existing buffers in decryptedNetBuffers array.
cleanupDecBuffers();
// The unconsumedDecData buffers have the data to copy to the user buffers.
// The copyDataToCallerBuffers method copies from decryptedNetBuffers, so assign it.
decryptedNetBuffers = unconsumedDecData;
// Copy the outputbuffer to the buffers provided by the caller.
totalBytesRead = copyDataToCallerBuffers();
// Null out the reference to the overflow buffers.
decryptedNetBuffers = null;
}
}
return totalBytesRead;
} | java | public long readUnconsumedDecData() {
long totalBytesRead = 0L;
// Determine if data is left over from a former read request.
if (unconsumedDecData != null) {
// Left over data exists. Is there enough to satisfy the request?
if (getBuffer() == null) {
// Caller needs us to allocate the buffer to return.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caller needs buffer, unconsumed data: "
+ SSLUtils.getBufferTraceInfo(unconsumedDecData));
}
// Note, data of unconsumedDecData buffer array should be starting
// at position 0 in the first buffer.
totalBytesRead = SSLUtils.lengthOf(unconsumedDecData, 0);
// First release any existing buffers in decryptedNetBuffers array.
cleanupDecBuffers();
callerRequiredAllocation = true;
// Note, it is the responsibility of the calling channel to release this buffer.
decryptedNetBuffers = unconsumedDecData;
// Set left over buffers to null to note that they are no longer in use.
unconsumedDecData = null;
if ((decryptedNetLimitInfo == null)
|| (decryptedNetLimitInfo.length != decryptedNetBuffers.length)) {
decryptedNetLimitInfo = new int[decryptedNetBuffers.length];
}
SSLUtils.getBufferLimits(decryptedNetBuffers, decryptedNetLimitInfo);
} else {
// Caller provided buffers for read. We need to copy the left over
// data to those buffers.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caller provided buffers, unconsumed data: "
+ SSLUtils.getBufferTraceInfo(unconsumedDecData));
}
// First release any existing buffers in decryptedNetBuffers array.
cleanupDecBuffers();
// The unconsumedDecData buffers have the data to copy to the user buffers.
// The copyDataToCallerBuffers method copies from decryptedNetBuffers, so assign it.
decryptedNetBuffers = unconsumedDecData;
// Copy the outputbuffer to the buffers provided by the caller.
totalBytesRead = copyDataToCallerBuffers();
// Null out the reference to the overflow buffers.
decryptedNetBuffers = null;
}
}
return totalBytesRead;
} | [
"public",
"long",
"readUnconsumedDecData",
"(",
")",
"{",
"long",
"totalBytesRead",
"=",
"0L",
";",
"// Determine if data is left over from a former read request.",
"if",
"(",
"unconsumedDecData",
"!=",
"null",
")",
"{",
"// Left over data exists. Is there enough to satisfy the request?",
"if",
"(",
"getBuffer",
"(",
")",
"==",
"null",
")",
"{",
"// Caller needs us to allocate the buffer to return.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Caller needs buffer, unconsumed data: \"",
"+",
"SSLUtils",
".",
"getBufferTraceInfo",
"(",
"unconsumedDecData",
")",
")",
";",
"}",
"// Note, data of unconsumedDecData buffer array should be starting",
"// at position 0 in the first buffer.",
"totalBytesRead",
"=",
"SSLUtils",
".",
"lengthOf",
"(",
"unconsumedDecData",
",",
"0",
")",
";",
"// First release any existing buffers in decryptedNetBuffers array.",
"cleanupDecBuffers",
"(",
")",
";",
"callerRequiredAllocation",
"=",
"true",
";",
"// Note, it is the responsibility of the calling channel to release this buffer.",
"decryptedNetBuffers",
"=",
"unconsumedDecData",
";",
"// Set left over buffers to null to note that they are no longer in use.",
"unconsumedDecData",
"=",
"null",
";",
"if",
"(",
"(",
"decryptedNetLimitInfo",
"==",
"null",
")",
"||",
"(",
"decryptedNetLimitInfo",
".",
"length",
"!=",
"decryptedNetBuffers",
".",
"length",
")",
")",
"{",
"decryptedNetLimitInfo",
"=",
"new",
"int",
"[",
"decryptedNetBuffers",
".",
"length",
"]",
";",
"}",
"SSLUtils",
".",
"getBufferLimits",
"(",
"decryptedNetBuffers",
",",
"decryptedNetLimitInfo",
")",
";",
"}",
"else",
"{",
"// Caller provided buffers for read. We need to copy the left over",
"// data to those buffers.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Caller provided buffers, unconsumed data: \"",
"+",
"SSLUtils",
".",
"getBufferTraceInfo",
"(",
"unconsumedDecData",
")",
")",
";",
"}",
"// First release any existing buffers in decryptedNetBuffers array.",
"cleanupDecBuffers",
"(",
")",
";",
"// The unconsumedDecData buffers have the data to copy to the user buffers.",
"// The copyDataToCallerBuffers method copies from decryptedNetBuffers, so assign it.",
"decryptedNetBuffers",
"=",
"unconsumedDecData",
";",
"// Copy the outputbuffer to the buffers provided by the caller.",
"totalBytesRead",
"=",
"copyDataToCallerBuffers",
"(",
")",
";",
"// Null out the reference to the overflow buffers.",
"decryptedNetBuffers",
"=",
"null",
";",
"}",
"}",
"return",
"totalBytesRead",
";",
"}"
] | This method is called when a read is requested. It checks to see if any
data is left over from the previous read, but there wasn't space in the
buffers to store the result.
@return number of bytes copied from the left over buffer | [
"This",
"method",
"is",
"called",
"when",
"a",
"read",
"is",
"requested",
".",
"It",
"checks",
"to",
"see",
"if",
"any",
"data",
"is",
"left",
"over",
"from",
"the",
"previous",
"read",
"but",
"there",
"wasn",
"t",
"space",
"in",
"the",
"buffers",
"to",
"store",
"the",
"result",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java#L699-L745 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java | SSLReadServiceContext.getNetworkBuffer | protected void getNetworkBuffer(long requestedSize) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getNetworkBuffer: size=" + requestedSize);
}
// Reset the netBuffer mark.
this.netBufferMark = 0;
int allocationSize = getConnLink().getPacketBufferSize();
if (allocationSize < requestedSize) {
allocationSize = (int) requestedSize;
}
if (null == this.netBuffer) {
// Need to allocate a buffer to give to the device channel to read into.
this.netBuffer = SSLUtils.allocateByteBuffer(allocationSize, true);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found existing netbuffer, " + SSLUtils.getBufferTraceInfo(netBuffer));
}
int cap = netBuffer.capacity();
int pos = netBuffer.position();
int lim = netBuffer.limit();
if (pos == lim) {
// 431269 - nothing is currently in this buffer, see if we can reuse it
if (cap >= allocationSize) {
this.netBuffer.clear();
} else {
this.netBuffer.release();
this.netBuffer = SSLUtils.allocateByteBuffer(allocationSize, true);
}
} else {
// if we have less than the allocation size amount of data + empty,
// then make a new buffer to start clean inside of...
if ((cap - pos) < allocationSize) {
// allocate a new buffer, copy the existing data over
WsByteBuffer buffer = SSLUtils.allocateByteBuffer(allocationSize, true);
SSLUtils.copyBuffer(this.netBuffer, buffer, lim - pos);
this.netBuffer.release();
this.netBuffer = buffer;
} else {
this.netBufferMark = pos;
this.netBuffer.position(lim);
this.netBuffer.limit(cap);
}
}
}
// Inform the device side channel to read into the new buffers.
deviceReadContext.setBuffer(this.netBuffer);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "netBuffer: " + SSLUtils.getBufferTraceInfo(this.netBuffer));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getNetworkBuffer");
}
} | java | protected void getNetworkBuffer(long requestedSize) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getNetworkBuffer: size=" + requestedSize);
}
// Reset the netBuffer mark.
this.netBufferMark = 0;
int allocationSize = getConnLink().getPacketBufferSize();
if (allocationSize < requestedSize) {
allocationSize = (int) requestedSize;
}
if (null == this.netBuffer) {
// Need to allocate a buffer to give to the device channel to read into.
this.netBuffer = SSLUtils.allocateByteBuffer(allocationSize, true);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found existing netbuffer, " + SSLUtils.getBufferTraceInfo(netBuffer));
}
int cap = netBuffer.capacity();
int pos = netBuffer.position();
int lim = netBuffer.limit();
if (pos == lim) {
// 431269 - nothing is currently in this buffer, see if we can reuse it
if (cap >= allocationSize) {
this.netBuffer.clear();
} else {
this.netBuffer.release();
this.netBuffer = SSLUtils.allocateByteBuffer(allocationSize, true);
}
} else {
// if we have less than the allocation size amount of data + empty,
// then make a new buffer to start clean inside of...
if ((cap - pos) < allocationSize) {
// allocate a new buffer, copy the existing data over
WsByteBuffer buffer = SSLUtils.allocateByteBuffer(allocationSize, true);
SSLUtils.copyBuffer(this.netBuffer, buffer, lim - pos);
this.netBuffer.release();
this.netBuffer = buffer;
} else {
this.netBufferMark = pos;
this.netBuffer.position(lim);
this.netBuffer.limit(cap);
}
}
}
// Inform the device side channel to read into the new buffers.
deviceReadContext.setBuffer(this.netBuffer);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "netBuffer: " + SSLUtils.getBufferTraceInfo(this.netBuffer));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getNetworkBuffer");
}
} | [
"protected",
"void",
"getNetworkBuffer",
"(",
"long",
"requestedSize",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getNetworkBuffer: size=\"",
"+",
"requestedSize",
")",
";",
"}",
"// Reset the netBuffer mark.",
"this",
".",
"netBufferMark",
"=",
"0",
";",
"int",
"allocationSize",
"=",
"getConnLink",
"(",
")",
".",
"getPacketBufferSize",
"(",
")",
";",
"if",
"(",
"allocationSize",
"<",
"requestedSize",
")",
"{",
"allocationSize",
"=",
"(",
"int",
")",
"requestedSize",
";",
"}",
"if",
"(",
"null",
"==",
"this",
".",
"netBuffer",
")",
"{",
"// Need to allocate a buffer to give to the device channel to read into.",
"this",
".",
"netBuffer",
"=",
"SSLUtils",
".",
"allocateByteBuffer",
"(",
"allocationSize",
",",
"true",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Found existing netbuffer, \"",
"+",
"SSLUtils",
".",
"getBufferTraceInfo",
"(",
"netBuffer",
")",
")",
";",
"}",
"int",
"cap",
"=",
"netBuffer",
".",
"capacity",
"(",
")",
";",
"int",
"pos",
"=",
"netBuffer",
".",
"position",
"(",
")",
";",
"int",
"lim",
"=",
"netBuffer",
".",
"limit",
"(",
")",
";",
"if",
"(",
"pos",
"==",
"lim",
")",
"{",
"// 431269 - nothing is currently in this buffer, see if we can reuse it",
"if",
"(",
"cap",
">=",
"allocationSize",
")",
"{",
"this",
".",
"netBuffer",
".",
"clear",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"netBuffer",
".",
"release",
"(",
")",
";",
"this",
".",
"netBuffer",
"=",
"SSLUtils",
".",
"allocateByteBuffer",
"(",
"allocationSize",
",",
"true",
")",
";",
"}",
"}",
"else",
"{",
"// if we have less than the allocation size amount of data + empty,",
"// then make a new buffer to start clean inside of...",
"if",
"(",
"(",
"cap",
"-",
"pos",
")",
"<",
"allocationSize",
")",
"{",
"// allocate a new buffer, copy the existing data over",
"WsByteBuffer",
"buffer",
"=",
"SSLUtils",
".",
"allocateByteBuffer",
"(",
"allocationSize",
",",
"true",
")",
";",
"SSLUtils",
".",
"copyBuffer",
"(",
"this",
".",
"netBuffer",
",",
"buffer",
",",
"lim",
"-",
"pos",
")",
";",
"this",
".",
"netBuffer",
".",
"release",
"(",
")",
";",
"this",
".",
"netBuffer",
"=",
"buffer",
";",
"}",
"else",
"{",
"this",
".",
"netBufferMark",
"=",
"pos",
";",
"this",
".",
"netBuffer",
".",
"position",
"(",
"lim",
")",
";",
"this",
".",
"netBuffer",
".",
"limit",
"(",
"cap",
")",
";",
"}",
"}",
"}",
"// Inform the device side channel to read into the new buffers.",
"deviceReadContext",
".",
"setBuffer",
"(",
"this",
".",
"netBuffer",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"netBuffer: \"",
"+",
"SSLUtils",
".",
"getBufferTraceInfo",
"(",
"this",
".",
"netBuffer",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getNetworkBuffer\"",
")",
";",
"}",
"}"
] | Get the buffers that the device channel should read into. These buffers
get reused over the course of multiple reads. The size of the buffers
are determined by either the allocation size specified by the application
channel or, if that wasn't set, the max packet buffer size specified in
the SSL engine.
@param requestedSize minimum amount of space that must be available in the buffers. | [
"Get",
"the",
"buffers",
"that",
"the",
"device",
"channel",
"should",
"read",
"into",
".",
"These",
"buffers",
"get",
"reused",
"over",
"the",
"course",
"of",
"multiple",
"reads",
".",
"The",
"size",
"of",
"the",
"buffers",
"are",
"determined",
"by",
"either",
"the",
"allocation",
"size",
"specified",
"by",
"the",
"application",
"channel",
"or",
"if",
"that",
"wasn",
"t",
"set",
"the",
"max",
"packet",
"buffer",
"size",
"specified",
"in",
"the",
"SSL",
"engine",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java#L756-L811 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java | SSLReadServiceContext.cleanupDecBuffers | private void cleanupDecBuffers() {
// if we have decrypted buffers and they are either JIT created or made
// during decryption/expansion (user buffers too small) then release them
// here and dereference
if (null != this.decryptedNetBuffers
&& (callerRequiredAllocation || decryptedNetBufferReleaseRequired)) {
WsByteBufferUtils.releaseBufferArray(this.decryptedNetBuffers);
this.decryptedNetBuffers = null;
}
} | java | private void cleanupDecBuffers() {
// if we have decrypted buffers and they are either JIT created or made
// during decryption/expansion (user buffers too small) then release them
// here and dereference
if (null != this.decryptedNetBuffers
&& (callerRequiredAllocation || decryptedNetBufferReleaseRequired)) {
WsByteBufferUtils.releaseBufferArray(this.decryptedNetBuffers);
this.decryptedNetBuffers = null;
}
} | [
"private",
"void",
"cleanupDecBuffers",
"(",
")",
"{",
"// if we have decrypted buffers and they are either JIT created or made",
"// during decryption/expansion (user buffers too small) then release them",
"// here and dereference",
"if",
"(",
"null",
"!=",
"this",
".",
"decryptedNetBuffers",
"&&",
"(",
"callerRequiredAllocation",
"||",
"decryptedNetBufferReleaseRequired",
")",
")",
"{",
"WsByteBufferUtils",
".",
"releaseBufferArray",
"(",
"this",
".",
"decryptedNetBuffers",
")",
";",
"this",
".",
"decryptedNetBuffers",
"=",
"null",
";",
"}",
"}"
] | Utility method to handle releasing the decrypted network buffers that we
may or may not own at this point. | [
"Utility",
"method",
"to",
"handle",
"releasing",
"the",
"decrypted",
"network",
"buffers",
"that",
"we",
"may",
"or",
"may",
"not",
"own",
"at",
"this",
"point",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java#L1091-L1100 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java | SSLReadServiceContext.close | public void close() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "close, vc=" + getVCHash());
}
synchronized (closeSync) {
if (closeCalled) {
return;
}
closeCalled = true;
if (null != this.netBuffer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Releasing netBuffer during close "
+ SSLUtils.getBufferTraceInfo(netBuffer));
}
this.netBuffer.release();
this.netBuffer = null;
}
cleanupDecBuffers();
if (unconsumedDecData != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Releasing unconsumed decrypted buffers, "
+ SSLUtils.getBufferTraceInfo(unconsumedDecData));
}
WsByteBufferUtils.releaseBufferArray(unconsumedDecData);
unconsumedDecData = null;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "close");
}
} | java | public void close() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "close, vc=" + getVCHash());
}
synchronized (closeSync) {
if (closeCalled) {
return;
}
closeCalled = true;
if (null != this.netBuffer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Releasing netBuffer during close "
+ SSLUtils.getBufferTraceInfo(netBuffer));
}
this.netBuffer.release();
this.netBuffer = null;
}
cleanupDecBuffers();
if (unconsumedDecData != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Releasing unconsumed decrypted buffers, "
+ SSLUtils.getBufferTraceInfo(unconsumedDecData));
}
WsByteBufferUtils.releaseBufferArray(unconsumedDecData);
unconsumedDecData = null;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "close");
}
} | [
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"close, vc=\"",
"+",
"getVCHash",
"(",
")",
")",
";",
"}",
"synchronized",
"(",
"closeSync",
")",
"{",
"if",
"(",
"closeCalled",
")",
"{",
"return",
";",
"}",
"closeCalled",
"=",
"true",
";",
"if",
"(",
"null",
"!=",
"this",
".",
"netBuffer",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Releasing netBuffer during close \"",
"+",
"SSLUtils",
".",
"getBufferTraceInfo",
"(",
"netBuffer",
")",
")",
";",
"}",
"this",
".",
"netBuffer",
".",
"release",
"(",
")",
";",
"this",
".",
"netBuffer",
"=",
"null",
";",
"}",
"cleanupDecBuffers",
"(",
")",
";",
"if",
"(",
"unconsumedDecData",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Releasing unconsumed decrypted buffers, \"",
"+",
"SSLUtils",
".",
"getBufferTraceInfo",
"(",
"unconsumedDecData",
")",
")",
";",
"}",
"WsByteBufferUtils",
".",
"releaseBufferArray",
"(",
"unconsumedDecData",
")",
";",
"unconsumedDecData",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"close\"",
")",
";",
"}",
"}"
] | Release the potential buffer that were created | [
"Release",
"the",
"potential",
"buffer",
"that",
"were",
"created"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java#L1105-L1139 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java | SSLReadServiceContext.doHandshake | private SSLEngineResult doHandshake(boolean async) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "doHandshake");
}
SSLEngineResult sslResult;
// Line up all the buffers needed for the SSL handshake. Temporary so
// use indirect allocation for speed.
int appSize = getConnLink().getAppBufferSize();
int packetSize = getConnLink().getPacketBufferSize();
WsByteBuffer localNetBuffer = SSLUtils.allocateByteBuffer(packetSize, true);
WsByteBuffer decryptedNetBuffer = SSLUtils.allocateByteBuffer(appSize, false);
WsByteBuffer encryptedAppBuffer = SSLUtils.allocateByteBuffer(packetSize, true);
// Callback to be used if the request is async.
MyHandshakeCompletedCallback handshakeCallback = null;
if (async) {
handshakeCallback = new MyHandshakeCompletedCallback(this, callback, localNetBuffer, decryptedNetBuffer, encryptedAppBuffer);
}
try {
// Do the SSL handshake. Note, if synchronous the handshakeCallback is null.
sslResult = SSLUtils.handleHandshake(
getConnLink(),
localNetBuffer,
decryptedNetBuffer,
encryptedAppBuffer,
null,
handshakeCallback,
false);
} catch (IOException e) {
// Release buffers used in the handshake.
localNetBuffer.release();
localNetBuffer = null;
decryptedNetBuffer.release();
decryptedNetBuffer = null;
encryptedAppBuffer.release();
encryptedAppBuffer = null;
throw e;
}
if (sslResult != null) {
// Handshake was done synchronously.
// Release buffers used in the handshake.
localNetBuffer.release();
localNetBuffer = null;
decryptedNetBuffer.release();
decryptedNetBuffer = null;
encryptedAppBuffer.release();
encryptedAppBuffer = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "doHandshake");
}
return sslResult;
} | java | private SSLEngineResult doHandshake(boolean async) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "doHandshake");
}
SSLEngineResult sslResult;
// Line up all the buffers needed for the SSL handshake. Temporary so
// use indirect allocation for speed.
int appSize = getConnLink().getAppBufferSize();
int packetSize = getConnLink().getPacketBufferSize();
WsByteBuffer localNetBuffer = SSLUtils.allocateByteBuffer(packetSize, true);
WsByteBuffer decryptedNetBuffer = SSLUtils.allocateByteBuffer(appSize, false);
WsByteBuffer encryptedAppBuffer = SSLUtils.allocateByteBuffer(packetSize, true);
// Callback to be used if the request is async.
MyHandshakeCompletedCallback handshakeCallback = null;
if (async) {
handshakeCallback = new MyHandshakeCompletedCallback(this, callback, localNetBuffer, decryptedNetBuffer, encryptedAppBuffer);
}
try {
// Do the SSL handshake. Note, if synchronous the handshakeCallback is null.
sslResult = SSLUtils.handleHandshake(
getConnLink(),
localNetBuffer,
decryptedNetBuffer,
encryptedAppBuffer,
null,
handshakeCallback,
false);
} catch (IOException e) {
// Release buffers used in the handshake.
localNetBuffer.release();
localNetBuffer = null;
decryptedNetBuffer.release();
decryptedNetBuffer = null;
encryptedAppBuffer.release();
encryptedAppBuffer = null;
throw e;
}
if (sslResult != null) {
// Handshake was done synchronously.
// Release buffers used in the handshake.
localNetBuffer.release();
localNetBuffer = null;
decryptedNetBuffer.release();
decryptedNetBuffer = null;
encryptedAppBuffer.release();
encryptedAppBuffer = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "doHandshake");
}
return sslResult;
} | [
"private",
"SSLEngineResult",
"doHandshake",
"(",
"boolean",
"async",
")",
"throws",
"IOException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"doHandshake\"",
")",
";",
"}",
"SSLEngineResult",
"sslResult",
";",
"// Line up all the buffers needed for the SSL handshake. Temporary so",
"// use indirect allocation for speed.",
"int",
"appSize",
"=",
"getConnLink",
"(",
")",
".",
"getAppBufferSize",
"(",
")",
";",
"int",
"packetSize",
"=",
"getConnLink",
"(",
")",
".",
"getPacketBufferSize",
"(",
")",
";",
"WsByteBuffer",
"localNetBuffer",
"=",
"SSLUtils",
".",
"allocateByteBuffer",
"(",
"packetSize",
",",
"true",
")",
";",
"WsByteBuffer",
"decryptedNetBuffer",
"=",
"SSLUtils",
".",
"allocateByteBuffer",
"(",
"appSize",
",",
"false",
")",
";",
"WsByteBuffer",
"encryptedAppBuffer",
"=",
"SSLUtils",
".",
"allocateByteBuffer",
"(",
"packetSize",
",",
"true",
")",
";",
"// Callback to be used if the request is async.",
"MyHandshakeCompletedCallback",
"handshakeCallback",
"=",
"null",
";",
"if",
"(",
"async",
")",
"{",
"handshakeCallback",
"=",
"new",
"MyHandshakeCompletedCallback",
"(",
"this",
",",
"callback",
",",
"localNetBuffer",
",",
"decryptedNetBuffer",
",",
"encryptedAppBuffer",
")",
";",
"}",
"try",
"{",
"// Do the SSL handshake. Note, if synchronous the handshakeCallback is null.",
"sslResult",
"=",
"SSLUtils",
".",
"handleHandshake",
"(",
"getConnLink",
"(",
")",
",",
"localNetBuffer",
",",
"decryptedNetBuffer",
",",
"encryptedAppBuffer",
",",
"null",
",",
"handshakeCallback",
",",
"false",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// Release buffers used in the handshake.",
"localNetBuffer",
".",
"release",
"(",
")",
";",
"localNetBuffer",
"=",
"null",
";",
"decryptedNetBuffer",
".",
"release",
"(",
")",
";",
"decryptedNetBuffer",
"=",
"null",
";",
"encryptedAppBuffer",
".",
"release",
"(",
")",
";",
"encryptedAppBuffer",
"=",
"null",
";",
"throw",
"e",
";",
"}",
"if",
"(",
"sslResult",
"!=",
"null",
")",
"{",
"// Handshake was done synchronously.",
"// Release buffers used in the handshake.",
"localNetBuffer",
".",
"release",
"(",
")",
";",
"localNetBuffer",
"=",
"null",
";",
"decryptedNetBuffer",
".",
"release",
"(",
")",
";",
"decryptedNetBuffer",
"=",
"null",
";",
"encryptedAppBuffer",
".",
"release",
"(",
")",
";",
"encryptedAppBuffer",
"=",
"null",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"doHandshake\"",
")",
";",
"}",
"return",
"sslResult",
";",
"}"
] | When data is read, there is always the change the a renegotiation will take place. If so,
this method will be called. Note, it is used by both the sync and async writes.
@param async
@return result of the handshake
@throws IOException | [
"When",
"data",
"is",
"read",
"there",
"is",
"always",
"the",
"change",
"the",
"a",
"renegotiation",
"will",
"take",
"place",
".",
"If",
"so",
"this",
"method",
"will",
"be",
"called",
".",
"Note",
"it",
"is",
"used",
"by",
"both",
"the",
"sync",
"and",
"async",
"writes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java#L1489-L1543 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java | FlowScopedContextImpl.getContextualStorage | protected ContextualStorage getContextualStorage(boolean createIfNotExist, String clientWindowFlowId)
{
//FacesContext facesContext = FacesContext.getCurrentInstance();
//String clientWindowFlowId = getCurrentClientWindowFlowId(facesContext);
if (clientWindowFlowId == null)
{
throw new ContextNotActiveException("FlowScopedContextImpl: no current active flow");
}
if (createIfNotExist)
{
return getFlowScopeBeanHolder().getContextualStorage(beanManager, clientWindowFlowId);
}
else
{
return getFlowScopeBeanHolder().getContextualStorageNoCreate(beanManager, clientWindowFlowId);
}
} | java | protected ContextualStorage getContextualStorage(boolean createIfNotExist, String clientWindowFlowId)
{
//FacesContext facesContext = FacesContext.getCurrentInstance();
//String clientWindowFlowId = getCurrentClientWindowFlowId(facesContext);
if (clientWindowFlowId == null)
{
throw new ContextNotActiveException("FlowScopedContextImpl: no current active flow");
}
if (createIfNotExist)
{
return getFlowScopeBeanHolder().getContextualStorage(beanManager, clientWindowFlowId);
}
else
{
return getFlowScopeBeanHolder().getContextualStorageNoCreate(beanManager, clientWindowFlowId);
}
} | [
"protected",
"ContextualStorage",
"getContextualStorage",
"(",
"boolean",
"createIfNotExist",
",",
"String",
"clientWindowFlowId",
")",
"{",
"//FacesContext facesContext = FacesContext.getCurrentInstance();",
"//String clientWindowFlowId = getCurrentClientWindowFlowId(facesContext);",
"if",
"(",
"clientWindowFlowId",
"==",
"null",
")",
"{",
"throw",
"new",
"ContextNotActiveException",
"(",
"\"FlowScopedContextImpl: no current active flow\"",
")",
";",
"}",
"if",
"(",
"createIfNotExist",
")",
"{",
"return",
"getFlowScopeBeanHolder",
"(",
")",
".",
"getContextualStorage",
"(",
"beanManager",
",",
"clientWindowFlowId",
")",
";",
"}",
"else",
"{",
"return",
"getFlowScopeBeanHolder",
"(",
")",
".",
"getContextualStorageNoCreate",
"(",
"beanManager",
",",
"clientWindowFlowId",
")",
";",
"}",
"}"
] | An implementation has to return the underlying storage which
contains the items held in the Context.
@param createIfNotExist whether a ContextualStorage shall get created if it doesn't yet exist.
@return the underlying storage | [
"An",
"implementation",
"has",
"to",
"return",
"the",
"underlying",
"storage",
"which",
"contains",
"the",
"items",
"held",
"in",
"the",
"Context",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java#L125-L142 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java | TCPProxyResponse.proxyReadHandshake | protected void proxyReadHandshake() {
// setup the read buffer - use JIT on the first read attempt. If it
// works, then any subsequent reads will use that same buffer.
connLink.getReadInterface().setJITAllocateSize(1024);
// reader.setBuffer(WsByteBufferPoolManagerImpl.getRef().allocate(1024));
if (connLink.isAsyncConnect()) {
// handshake - read the proxy response
this.proxyReadCB = new ProxyReadCallback();
readProxyResponse(connLink.getVirtualConnection());
} else {
int rc = STATUS_NOT_DONE;
while (rc == STATUS_NOT_DONE) {
readProxyResponse(connLink.getVirtualConnection());
rc = checkResponse(connLink.getReadInterface());
}
if (rc == STATUS_ERROR) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "could not complete proxy handshake, read request failed");
}
releaseProxyReadBuffer();
// if (null == this.syncError) {
if (connLink.isSyncError() == false) {
// create a new connect exception
connLink.connectFailed(new IOException("Invalid Proxy Server Response "));
}
}
}
} | java | protected void proxyReadHandshake() {
// setup the read buffer - use JIT on the first read attempt. If it
// works, then any subsequent reads will use that same buffer.
connLink.getReadInterface().setJITAllocateSize(1024);
// reader.setBuffer(WsByteBufferPoolManagerImpl.getRef().allocate(1024));
if (connLink.isAsyncConnect()) {
// handshake - read the proxy response
this.proxyReadCB = new ProxyReadCallback();
readProxyResponse(connLink.getVirtualConnection());
} else {
int rc = STATUS_NOT_DONE;
while (rc == STATUS_NOT_DONE) {
readProxyResponse(connLink.getVirtualConnection());
rc = checkResponse(connLink.getReadInterface());
}
if (rc == STATUS_ERROR) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "could not complete proxy handshake, read request failed");
}
releaseProxyReadBuffer();
// if (null == this.syncError) {
if (connLink.isSyncError() == false) {
// create a new connect exception
connLink.connectFailed(new IOException("Invalid Proxy Server Response "));
}
}
}
} | [
"protected",
"void",
"proxyReadHandshake",
"(",
")",
"{",
"// setup the read buffer - use JIT on the first read attempt. If it",
"// works, then any subsequent reads will use that same buffer.",
"connLink",
".",
"getReadInterface",
"(",
")",
".",
"setJITAllocateSize",
"(",
"1024",
")",
";",
"// reader.setBuffer(WsByteBufferPoolManagerImpl.getRef().allocate(1024));",
"if",
"(",
"connLink",
".",
"isAsyncConnect",
"(",
")",
")",
"{",
"// handshake - read the proxy response",
"this",
".",
"proxyReadCB",
"=",
"new",
"ProxyReadCallback",
"(",
")",
";",
"readProxyResponse",
"(",
"connLink",
".",
"getVirtualConnection",
"(",
")",
")",
";",
"}",
"else",
"{",
"int",
"rc",
"=",
"STATUS_NOT_DONE",
";",
"while",
"(",
"rc",
"==",
"STATUS_NOT_DONE",
")",
"{",
"readProxyResponse",
"(",
"connLink",
".",
"getVirtualConnection",
"(",
")",
")",
";",
"rc",
"=",
"checkResponse",
"(",
"connLink",
".",
"getReadInterface",
"(",
")",
")",
";",
"}",
"if",
"(",
"rc",
"==",
"STATUS_ERROR",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"could not complete proxy handshake, read request failed\"",
")",
";",
"}",
"releaseProxyReadBuffer",
"(",
")",
";",
"// if (null == this.syncError) {",
"if",
"(",
"connLink",
".",
"isSyncError",
"(",
")",
"==",
"false",
")",
"{",
"// create a new connect exception",
"connLink",
".",
"connectFailed",
"(",
"new",
"IOException",
"(",
"\"Invalid Proxy Server Response \"",
")",
")",
";",
"}",
"}",
"}",
"}"
] | Complete the proxy connect handshake by reading for the response and
validating any data. | [
"Complete",
"the",
"proxy",
"connect",
"handshake",
"by",
"reading",
"for",
"the",
"response",
"and",
"validating",
"any",
"data",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java#L96-L126 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java | TCPProxyResponse.checkResponse | protected int checkResponse(TCPReadRequestContext rsc) {
// Parse the proxy server response
//
WsByteBuffer[] buffers = rsc.getBuffers();
// check if the correct response was received
if (null == buffers) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Could not complete proxy handshake, null buffers");
}
return STATUS_ERROR;
}
int status = validateProxyResponse(buffers);
if (STATUS_DONE == status) {
releaseProxyReadBuffer();
}
return status;
} | java | protected int checkResponse(TCPReadRequestContext rsc) {
// Parse the proxy server response
//
WsByteBuffer[] buffers = rsc.getBuffers();
// check if the correct response was received
if (null == buffers) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Could not complete proxy handshake, null buffers");
}
return STATUS_ERROR;
}
int status = validateProxyResponse(buffers);
if (STATUS_DONE == status) {
releaseProxyReadBuffer();
}
return status;
} | [
"protected",
"int",
"checkResponse",
"(",
"TCPReadRequestContext",
"rsc",
")",
"{",
"// Parse the proxy server response",
"//",
"WsByteBuffer",
"[",
"]",
"buffers",
"=",
"rsc",
".",
"getBuffers",
"(",
")",
";",
"// check if the correct response was received",
"if",
"(",
"null",
"==",
"buffers",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Could not complete proxy handshake, null buffers\"",
")",
";",
"}",
"return",
"STATUS_ERROR",
";",
"}",
"int",
"status",
"=",
"validateProxyResponse",
"(",
"buffers",
")",
";",
"if",
"(",
"STATUS_DONE",
"==",
"status",
")",
"{",
"releaseProxyReadBuffer",
"(",
")",
";",
"}",
"return",
"status",
";",
"}"
] | Check for a proxy handshake response.
@param rsc
@return int (status code) | [
"Check",
"for",
"a",
"proxy",
"handshake",
"response",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java#L134-L151 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java | TCPProxyResponse.releaseProxyWriteBuffer | protected void releaseProxyWriteBuffer() {
WsByteBuffer buffer = connLink.getWriteInterface().getBuffer();
if (null != buffer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Releasing proxy write buffer: " + buffer);
}
buffer.release();
connLink.getWriteInterface().setBuffer(null);
}
} | java | protected void releaseProxyWriteBuffer() {
WsByteBuffer buffer = connLink.getWriteInterface().getBuffer();
if (null != buffer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Releasing proxy write buffer: " + buffer);
}
buffer.release();
connLink.getWriteInterface().setBuffer(null);
}
} | [
"protected",
"void",
"releaseProxyWriteBuffer",
"(",
")",
"{",
"WsByteBuffer",
"buffer",
"=",
"connLink",
".",
"getWriteInterface",
"(",
")",
".",
"getBuffer",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"buffer",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Releasing proxy write buffer: \"",
"+",
"buffer",
")",
";",
"}",
"buffer",
".",
"release",
"(",
")",
";",
"connLink",
".",
"getWriteInterface",
"(",
")",
".",
"setBuffer",
"(",
"null",
")",
";",
"}",
"}"
] | Release the proxy connect write buffer. | [
"Release",
"the",
"proxy",
"connect",
"write",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java#L181-L190 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java | TCPProxyResponse.releaseProxyReadBuffer | protected void releaseProxyReadBuffer() {
WsByteBuffer buffer = connLink.getReadInterface().getBuffer();
if (null != buffer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Releasing proxy read buffer: " + buffer);
}
buffer.release();
connLink.getReadInterface().setBuffer(null);
}
} | java | protected void releaseProxyReadBuffer() {
WsByteBuffer buffer = connLink.getReadInterface().getBuffer();
if (null != buffer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Releasing proxy read buffer: " + buffer);
}
buffer.release();
connLink.getReadInterface().setBuffer(null);
}
} | [
"protected",
"void",
"releaseProxyReadBuffer",
"(",
")",
"{",
"WsByteBuffer",
"buffer",
"=",
"connLink",
".",
"getReadInterface",
"(",
")",
".",
"getBuffer",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"buffer",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Releasing proxy read buffer: \"",
"+",
"buffer",
")",
";",
"}",
"buffer",
".",
"release",
"(",
")",
";",
"connLink",
".",
"getReadInterface",
"(",
")",
".",
"setBuffer",
"(",
"null",
")",
";",
"}",
"}"
] | Release the proxy connect read buffer. | [
"Release",
"the",
"proxy",
"connect",
"read",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java#L195-L204 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java | TCPProxyResponse.containsHTTP200 | protected boolean containsHTTP200(byte[] data) {
boolean rc = true;
// byte comparison to check for HTTP and 200 in the response
// this code is not pretty, it is designed to be fast
// code assumes that HTTP/1.0 200 will be contained in one buffer
//
if (data.length < 12 || data[0] != 'H' || data[1] != 'T' || data[2] != 'T' || data[3] != 'P' || data[9] != '2' || data[10] != '0' || data[11] != '0') {
rc = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "containsHTTP200: " + rc);
}
return rc;
} | java | protected boolean containsHTTP200(byte[] data) {
boolean rc = true;
// byte comparison to check for HTTP and 200 in the response
// this code is not pretty, it is designed to be fast
// code assumes that HTTP/1.0 200 will be contained in one buffer
//
if (data.length < 12 || data[0] != 'H' || data[1] != 'T' || data[2] != 'T' || data[3] != 'P' || data[9] != '2' || data[10] != '0' || data[11] != '0') {
rc = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "containsHTTP200: " + rc);
}
return rc;
} | [
"protected",
"boolean",
"containsHTTP200",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"boolean",
"rc",
"=",
"true",
";",
"// byte comparison to check for HTTP and 200 in the response",
"// this code is not pretty, it is designed to be fast",
"// code assumes that HTTP/1.0 200 will be contained in one buffer",
"//",
"if",
"(",
"data",
".",
"length",
"<",
"12",
"||",
"data",
"[",
"0",
"]",
"!=",
"'",
"'",
"||",
"data",
"[",
"1",
"]",
"!=",
"'",
"'",
"||",
"data",
"[",
"2",
"]",
"!=",
"'",
"'",
"||",
"data",
"[",
"3",
"]",
"!=",
"'",
"'",
"||",
"data",
"[",
"9",
"]",
"!=",
"'",
"'",
"||",
"data",
"[",
"10",
"]",
"!=",
"'",
"'",
"||",
"data",
"[",
"11",
"]",
"!=",
"'",
"'",
")",
"{",
"rc",
"=",
"false",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"containsHTTP200: \"",
"+",
"rc",
")",
";",
"}",
"return",
"rc",
";",
"}"
] | Checks if the byte array contains "HTTP 200" in a byte array.
@param data
search byte array
@return true if found; false if not | [
"Checks",
"if",
"the",
"byte",
"array",
"contains",
"HTTP",
"200",
"in",
"a",
"byte",
"array",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java#L340-L356 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java | TCPProxyResponse.readProxyResponse | protected void readProxyResponse(VirtualConnection inVC) {
int size = 1;
if (!this.isProxyResponseValid) {
// we need at least 12 bytes for the first line
size = 12;
}
if (connLink.isAsyncConnect()) {
VirtualConnection vcRC = connLink.getReadInterface().read(size, this.proxyReadCB, false, TCPRequestContext.USE_CHANNEL_TIMEOUT);
if (null != vcRC) {
this.proxyReadCB.complete(vcRC, connLink.getReadInterface());
}
} else {
try {
connLink.getReadInterface().read(size, TCPRequestContext.USE_CHANNEL_TIMEOUT);
} catch (IOException x) {
// no FFDC required
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "could not complete proxy handshake, read request failed");
}
releaseProxyReadBuffer();
connLink.connectFailed(x);
}
}
} | java | protected void readProxyResponse(VirtualConnection inVC) {
int size = 1;
if (!this.isProxyResponseValid) {
// we need at least 12 bytes for the first line
size = 12;
}
if (connLink.isAsyncConnect()) {
VirtualConnection vcRC = connLink.getReadInterface().read(size, this.proxyReadCB, false, TCPRequestContext.USE_CHANNEL_TIMEOUT);
if (null != vcRC) {
this.proxyReadCB.complete(vcRC, connLink.getReadInterface());
}
} else {
try {
connLink.getReadInterface().read(size, TCPRequestContext.USE_CHANNEL_TIMEOUT);
} catch (IOException x) {
// no FFDC required
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "could not complete proxy handshake, read request failed");
}
releaseProxyReadBuffer();
connLink.connectFailed(x);
}
}
} | [
"protected",
"void",
"readProxyResponse",
"(",
"VirtualConnection",
"inVC",
")",
"{",
"int",
"size",
"=",
"1",
";",
"if",
"(",
"!",
"this",
".",
"isProxyResponseValid",
")",
"{",
"// we need at least 12 bytes for the first line",
"size",
"=",
"12",
";",
"}",
"if",
"(",
"connLink",
".",
"isAsyncConnect",
"(",
")",
")",
"{",
"VirtualConnection",
"vcRC",
"=",
"connLink",
".",
"getReadInterface",
"(",
")",
".",
"read",
"(",
"size",
",",
"this",
".",
"proxyReadCB",
",",
"false",
",",
"TCPRequestContext",
".",
"USE_CHANNEL_TIMEOUT",
")",
";",
"if",
"(",
"null",
"!=",
"vcRC",
")",
"{",
"this",
".",
"proxyReadCB",
".",
"complete",
"(",
"vcRC",
",",
"connLink",
".",
"getReadInterface",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"try",
"{",
"connLink",
".",
"getReadInterface",
"(",
")",
".",
"read",
"(",
"size",
",",
"TCPRequestContext",
".",
"USE_CHANNEL_TIMEOUT",
")",
";",
"}",
"catch",
"(",
"IOException",
"x",
")",
"{",
"// no FFDC required",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"could not complete proxy handshake, read request failed\"",
")",
";",
"}",
"releaseProxyReadBuffer",
"(",
")",
";",
"connLink",
".",
"connectFailed",
"(",
"x",
")",
";",
"}",
"}",
"}"
] | Start a read for the response from the target proxy, this is either the
first read or possibly secondary ones if necessary.
@param inVC | [
"Start",
"a",
"read",
"for",
"the",
"response",
"from",
"the",
"target",
"proxy",
"this",
"is",
"either",
"the",
"first",
"read",
"or",
"possibly",
"secondary",
"ones",
"if",
"necessary",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPProxyResponse.java#L516-L540 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/BaseMessageItemStream.java | BaseMessageItemStream.setDefaultDestLimits | public synchronized void setDefaultDestLimits() throws MessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setDefaultDestLimits");
// Defaults are based on those defined to the ME, the low is 80% of the high
// Use setDestLimits() to set the initial limits/watermarks (510343)
long destHighMsgs = mp.getHighMessageThreshold();
setDestLimits(destHighMsgs,
(destHighMsgs * 8) / 10);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setDefaultDestLimits");
} | java | public synchronized void setDefaultDestLimits() throws MessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setDefaultDestLimits");
// Defaults are based on those defined to the ME, the low is 80% of the high
// Use setDestLimits() to set the initial limits/watermarks (510343)
long destHighMsgs = mp.getHighMessageThreshold();
setDestLimits(destHighMsgs,
(destHighMsgs * 8) / 10);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setDefaultDestLimits");
} | [
"public",
"synchronized",
"void",
"setDefaultDestLimits",
"(",
")",
"throws",
"MessageStoreException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setDefaultDestLimits\"",
")",
";",
"// Defaults are based on those defined to the ME, the low is 80% of the high",
"// Use setDestLimits() to set the initial limits/watermarks (510343)",
"long",
"destHighMsgs",
"=",
"mp",
".",
"getHighMessageThreshold",
"(",
")",
";",
"setDestLimits",
"(",
"destHighMsgs",
",",
"(",
"destHighMsgs",
"*",
"8",
")",
"/",
"10",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setDefaultDestLimits\"",
")",
";",
"}"
] | Set the default limits for this itemstream | [
"Set",
"the",
"default",
"limits",
"for",
"this",
"itemstream"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/BaseMessageItemStream.java#L142-L155 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/BaseMessageItemStream.java | BaseMessageItemStream.getDestHighMsgs | public long getDestHighMsgs()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getDestHighMsgs");
SibTr.exit(tc, "getDestHighMsgs", Long.valueOf(_destHighMsgs));
}
return _destHighMsgs;
} | java | public long getDestHighMsgs()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getDestHighMsgs");
SibTr.exit(tc, "getDestHighMsgs", Long.valueOf(_destHighMsgs));
}
return _destHighMsgs;
} | [
"public",
"long",
"getDestHighMsgs",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getDestHighMsgs\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getDestHighMsgs\"",
",",
"Long",
".",
"valueOf",
"(",
"_destHighMsgs",
")",
")",
";",
"}",
"return",
"_destHighMsgs",
";",
"}"
] | Gets the destination high messages limit currently being used by this localization.
@return | [
"Gets",
"the",
"destination",
"high",
"messages",
"limit",
"currently",
"being",
"used",
"by",
"this",
"localization",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/BaseMessageItemStream.java#L162-L170 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/BaseMessageItemStream.java | BaseMessageItemStream.getDestLowMsgs | public long getDestLowMsgs()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getDestLowMsgs");
SibTr.exit(tc, "getDestLowMsgs", Long.valueOf(_destLowMsgs));
}
return _destLowMsgs;
} | java | public long getDestLowMsgs()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getDestLowMsgs");
SibTr.exit(tc, "getDestLowMsgs", Long.valueOf(_destLowMsgs));
}
return _destLowMsgs;
} | [
"public",
"long",
"getDestLowMsgs",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getDestLowMsgs\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getDestLowMsgs\"",
",",
"Long",
".",
"valueOf",
"(",
"_destLowMsgs",
")",
")",
";",
"}",
"return",
"_destLowMsgs",
";",
"}"
] | Gets the destination low messages limit currently being used by this localization.
@return | [
"Gets",
"the",
"destination",
"low",
"messages",
"limit",
"currently",
"being",
"used",
"by",
"this",
"localization",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/BaseMessageItemStream.java#L177-L185 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/BaseMessageItemStream.java | BaseMessageItemStream.fireDepthThresholdReachedEvent | public void fireDepthThresholdReachedEvent(ControlAdapter cAdapter,
boolean reachedHigh,
long numMsgs, long msgLimit)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "fireDepthThresholdReachedEvent",
new Object[] { cAdapter, new Boolean(reachedHigh), new Long(numMsgs) });
// Retrieve appropriate information
String destinationName = destinationHandler.getName();
String meName = mp.getMessagingEngineName();
// If we've been told to output the event message to the log, do it...
if (mp.getCustomProperties().getOutputDestinationThresholdEventsToLog())
{
if (reachedHigh)
SibTr.info(tc, "NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0553",
new Object[] { destinationName, meName, msgLimit });
else
SibTr.info(tc, "NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0554",
new Object[] { destinationName, meName, msgLimit });
}
// If we're actually issuing events, do that too...
if (_isEventNotificationEnabled)
{
if (cAdapter != null)
{
// Build the message for the Notification
String message = null;
if (reachedHigh)
message = nls.getFormattedMessage("NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0553",
new Object[] { destinationName,
meName, msgLimit },
null);
else
message = nls.getFormattedMessage("NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0554",
new Object[] { destinationName,
meName, msgLimit },
null);
// Build the properties for the Notification
Properties props = new Properties();
props.put(SibNotificationConstants.KEY_DESTINATION_NAME, destinationName);
props.put(SibNotificationConstants.KEY_DESTINATION_UUID, destinationHandler.getUuid().toString());
if (reachedHigh)
props.put(SibNotificationConstants.KEY_DEPTH_THRESHOLD_REACHED,
SibNotificationConstants.DEPTH_THRESHOLD_REACHED_HIGH);
else
props.put(SibNotificationConstants.KEY_DEPTH_THRESHOLD_REACHED,
SibNotificationConstants.DEPTH_THRESHOLD_REACHED_LOW);
// Number of Messages
props.put(SibNotificationConstants.KEY_MESSAGES, String.valueOf(numMsgs));
// Now create the Event object to pass to the control adapter
MPRuntimeEvent MPevent =
new MPRuntimeEvent(SibNotificationConstants.TYPE_SIB_MESSAGEPOINT_DEPTH_THRESHOLD_REACHED,
message,
props);
// Fire the event
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "fireDepthThresholdReachedEvent", "Drive runtimeEventOccurred against Control adapter: " + cAdapter);
cAdapter.runtimeEventOccurred(MPevent);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "fireDepthThresholdReachedEvent", "Control adapter is null, cannot fire event");
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "fireDepthThresholdReachedEvent");
} | java | public void fireDepthThresholdReachedEvent(ControlAdapter cAdapter,
boolean reachedHigh,
long numMsgs, long msgLimit)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "fireDepthThresholdReachedEvent",
new Object[] { cAdapter, new Boolean(reachedHigh), new Long(numMsgs) });
// Retrieve appropriate information
String destinationName = destinationHandler.getName();
String meName = mp.getMessagingEngineName();
// If we've been told to output the event message to the log, do it...
if (mp.getCustomProperties().getOutputDestinationThresholdEventsToLog())
{
if (reachedHigh)
SibTr.info(tc, "NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0553",
new Object[] { destinationName, meName, msgLimit });
else
SibTr.info(tc, "NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0554",
new Object[] { destinationName, meName, msgLimit });
}
// If we're actually issuing events, do that too...
if (_isEventNotificationEnabled)
{
if (cAdapter != null)
{
// Build the message for the Notification
String message = null;
if (reachedHigh)
message = nls.getFormattedMessage("NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0553",
new Object[] { destinationName,
meName, msgLimit },
null);
else
message = nls.getFormattedMessage("NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0554",
new Object[] { destinationName,
meName, msgLimit },
null);
// Build the properties for the Notification
Properties props = new Properties();
props.put(SibNotificationConstants.KEY_DESTINATION_NAME, destinationName);
props.put(SibNotificationConstants.KEY_DESTINATION_UUID, destinationHandler.getUuid().toString());
if (reachedHigh)
props.put(SibNotificationConstants.KEY_DEPTH_THRESHOLD_REACHED,
SibNotificationConstants.DEPTH_THRESHOLD_REACHED_HIGH);
else
props.put(SibNotificationConstants.KEY_DEPTH_THRESHOLD_REACHED,
SibNotificationConstants.DEPTH_THRESHOLD_REACHED_LOW);
// Number of Messages
props.put(SibNotificationConstants.KEY_MESSAGES, String.valueOf(numMsgs));
// Now create the Event object to pass to the control adapter
MPRuntimeEvent MPevent =
new MPRuntimeEvent(SibNotificationConstants.TYPE_SIB_MESSAGEPOINT_DEPTH_THRESHOLD_REACHED,
message,
props);
// Fire the event
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "fireDepthThresholdReachedEvent", "Drive runtimeEventOccurred against Control adapter: " + cAdapter);
cAdapter.runtimeEventOccurred(MPevent);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "fireDepthThresholdReachedEvent", "Control adapter is null, cannot fire event");
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "fireDepthThresholdReachedEvent");
} | [
"public",
"void",
"fireDepthThresholdReachedEvent",
"(",
"ControlAdapter",
"cAdapter",
",",
"boolean",
"reachedHigh",
",",
"long",
"numMsgs",
",",
"long",
"msgLimit",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"fireDepthThresholdReachedEvent\"",
",",
"new",
"Object",
"[",
"]",
"{",
"cAdapter",
",",
"new",
"Boolean",
"(",
"reachedHigh",
")",
",",
"new",
"Long",
"(",
"numMsgs",
")",
"}",
")",
";",
"// Retrieve appropriate information",
"String",
"destinationName",
"=",
"destinationHandler",
".",
"getName",
"(",
")",
";",
"String",
"meName",
"=",
"mp",
".",
"getMessagingEngineName",
"(",
")",
";",
"// If we've been told to output the event message to the log, do it...",
"if",
"(",
"mp",
".",
"getCustomProperties",
"(",
")",
".",
"getOutputDestinationThresholdEventsToLog",
"(",
")",
")",
"{",
"if",
"(",
"reachedHigh",
")",
"SibTr",
".",
"info",
"(",
"tc",
",",
"\"NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0553\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destinationName",
",",
"meName",
",",
"msgLimit",
"}",
")",
";",
"else",
"SibTr",
".",
"info",
"(",
"tc",
",",
"\"NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0554\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destinationName",
",",
"meName",
",",
"msgLimit",
"}",
")",
";",
"}",
"// If we're actually issuing events, do that too...",
"if",
"(",
"_isEventNotificationEnabled",
")",
"{",
"if",
"(",
"cAdapter",
"!=",
"null",
")",
"{",
"// Build the message for the Notification",
"String",
"message",
"=",
"null",
";",
"if",
"(",
"reachedHigh",
")",
"message",
"=",
"nls",
".",
"getFormattedMessage",
"(",
"\"NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0553\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destinationName",
",",
"meName",
",",
"msgLimit",
"}",
",",
"null",
")",
";",
"else",
"message",
"=",
"nls",
".",
"getFormattedMessage",
"(",
"\"NOTIFY_DEPTH_THRESHOLD_REACHED_CWSIP0554\"",
",",
"new",
"Object",
"[",
"]",
"{",
"destinationName",
",",
"meName",
",",
"msgLimit",
"}",
",",
"null",
")",
";",
"// Build the properties for the Notification",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"props",
".",
"put",
"(",
"SibNotificationConstants",
".",
"KEY_DESTINATION_NAME",
",",
"destinationName",
")",
";",
"props",
".",
"put",
"(",
"SibNotificationConstants",
".",
"KEY_DESTINATION_UUID",
",",
"destinationHandler",
".",
"getUuid",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"reachedHigh",
")",
"props",
".",
"put",
"(",
"SibNotificationConstants",
".",
"KEY_DEPTH_THRESHOLD_REACHED",
",",
"SibNotificationConstants",
".",
"DEPTH_THRESHOLD_REACHED_HIGH",
")",
";",
"else",
"props",
".",
"put",
"(",
"SibNotificationConstants",
".",
"KEY_DEPTH_THRESHOLD_REACHED",
",",
"SibNotificationConstants",
".",
"DEPTH_THRESHOLD_REACHED_LOW",
")",
";",
"// Number of Messages",
"props",
".",
"put",
"(",
"SibNotificationConstants",
".",
"KEY_MESSAGES",
",",
"String",
".",
"valueOf",
"(",
"numMsgs",
")",
")",
";",
"// Now create the Event object to pass to the control adapter",
"MPRuntimeEvent",
"MPevent",
"=",
"new",
"MPRuntimeEvent",
"(",
"SibNotificationConstants",
".",
"TYPE_SIB_MESSAGEPOINT_DEPTH_THRESHOLD_REACHED",
",",
"message",
",",
"props",
")",
";",
"// Fire the event",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"fireDepthThresholdReachedEvent\"",
",",
"\"Drive runtimeEventOccurred against Control adapter: \"",
"+",
"cAdapter",
")",
";",
"cAdapter",
".",
"runtimeEventOccurred",
"(",
"MPevent",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"fireDepthThresholdReachedEvent\"",
",",
"\"Control adapter is null, cannot fire event\"",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"fireDepthThresholdReachedEvent\"",
")",
";",
"}"
] | Fire an event notification of type TYPE_SIB_MESSAGEPOINT_DEPTH_THRESHOLD_REACHED
@param newState | [
"Fire",
"an",
"event",
"notification",
"of",
"type",
"TYPE_SIB_MESSAGEPOINT_DEPTH_THRESHOLD_REACHED"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/BaseMessageItemStream.java#L751-L828 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/FFDCJanitor.java | FFDCJanitor.reschedule | private void reschedule() {
// set up a daily roll
Calendar cal = Calendar.getInstance();
long today = cal.getTimeInMillis();
// adjust to somewhere after midnight of the next day
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.add(Calendar.DATE, 1);
long tomorrow = cal.getTimeInMillis();
if (executorService != null) {
future = executorService.schedule(this, tomorrow - today, TimeUnit.MILLISECONDS);
}
} | java | private void reschedule() {
// set up a daily roll
Calendar cal = Calendar.getInstance();
long today = cal.getTimeInMillis();
// adjust to somewhere after midnight of the next day
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.add(Calendar.DATE, 1);
long tomorrow = cal.getTimeInMillis();
if (executorService != null) {
future = executorService.schedule(this, tomorrow - today, TimeUnit.MILLISECONDS);
}
} | [
"private",
"void",
"reschedule",
"(",
")",
"{",
"// set up a daily roll",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"long",
"today",
"=",
"cal",
".",
"getTimeInMillis",
"(",
")",
";",
"// adjust to somewhere after midnight of the next day",
"cal",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"0",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"MINUTE",
",",
"0",
")",
";",
"cal",
".",
"add",
"(",
"Calendar",
".",
"DATE",
",",
"1",
")",
";",
"long",
"tomorrow",
"=",
"cal",
".",
"getTimeInMillis",
"(",
")",
";",
"if",
"(",
"executorService",
"!=",
"null",
")",
"{",
"future",
"=",
"executorService",
".",
"schedule",
"(",
"this",
",",
"tomorrow",
"-",
"today",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}",
"}"
] | Reschedule the task for midnight-ish the next day. | [
"Reschedule",
"the",
"task",
"for",
"midnight",
"-",
"ish",
"the",
"next",
"day",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/FFDCJanitor.java#L60-L74 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/TimerNpRunnable.java | TimerNpRunnable.run | @Override
public void run() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) // F743-425.CodRev
Tr.entry(tc, "run: " + ivTimer.ivTaskId); // F743-425.CodRev
if (serverStopping) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "Server shutting down; aborting");
return;
}
if (ivRetries == 0) // This is the first try
{
// F743-7591 - Calculate the next expiration before calling the timeout
// method. This ensures that Timer.getNextTimeout will properly throw
// NoMoreTimeoutsException.
ivTimer.calculateNextExpiration();
}
// Log a warning if this timer is starting late
ivTimer.checkLateTimerThreshold();
try // F743-425.CodRev
{
// Call the timeout method; last chance effort to abort if cancelled
if (!ivTimer.isIvDestroyed()) {
doWork();
} else {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "Timer has been cancelled; aborting");
return;
}
ivRetries = 0;
// re-schedule the alarm to go off again if it needs to,
// and if timer had not been canceled
ivTimer.scheduleNext(); // RTC107334
} catch (Throwable ex) // F743-425.CodRev
{
// Do not FFDC... that has already been done when the method failed
// All exceptions from timeout methods are system exceptions...
// indicating the timeout method failed, and should be retried. d667153
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "NP Timer failed : " + ex.getClass().getName() + ":" + ex.getMessage(), ex);
}
if ((ivRetryLimit != -1) && // not configured to retry indefinitely
(ivRetries >= ivRetryLimit)) // and retry limit reached
{
// Note: ivRetryLimit==0 means no retries at all
ivTimer.calculateNextExpiration();
ivTimer.scheduleNext();
ivRetries = 0;
Tr.warning(tc, "NP_TIMER_RETRY_LIMIT_REACHED_CNTR0179W", ivRetryLimit);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "Timer retry limit has been reached; aborting");
return;
}
ivRetries++;
// begin 597753
if (ivRetries == 1) {
// do first retry immediately, by re-entering this method
run();
} else {
// re-schedule the alarm to go off after the retry interval
// (if timer had not been canceled)
ivTimer.scheduleRetry(ivRetryInterval); // RTC107334
}
}
if (isTraceOn && tc.isEntryEnabled()) // F743-425.CodRev
Tr.exit(tc, "run"); // F743-425.CodRev
} | java | @Override
public void run() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) // F743-425.CodRev
Tr.entry(tc, "run: " + ivTimer.ivTaskId); // F743-425.CodRev
if (serverStopping) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "Server shutting down; aborting");
return;
}
if (ivRetries == 0) // This is the first try
{
// F743-7591 - Calculate the next expiration before calling the timeout
// method. This ensures that Timer.getNextTimeout will properly throw
// NoMoreTimeoutsException.
ivTimer.calculateNextExpiration();
}
// Log a warning if this timer is starting late
ivTimer.checkLateTimerThreshold();
try // F743-425.CodRev
{
// Call the timeout method; last chance effort to abort if cancelled
if (!ivTimer.isIvDestroyed()) {
doWork();
} else {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "Timer has been cancelled; aborting");
return;
}
ivRetries = 0;
// re-schedule the alarm to go off again if it needs to,
// and if timer had not been canceled
ivTimer.scheduleNext(); // RTC107334
} catch (Throwable ex) // F743-425.CodRev
{
// Do not FFDC... that has already been done when the method failed
// All exceptions from timeout methods are system exceptions...
// indicating the timeout method failed, and should be retried. d667153
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "NP Timer failed : " + ex.getClass().getName() + ":" + ex.getMessage(), ex);
}
if ((ivRetryLimit != -1) && // not configured to retry indefinitely
(ivRetries >= ivRetryLimit)) // and retry limit reached
{
// Note: ivRetryLimit==0 means no retries at all
ivTimer.calculateNextExpiration();
ivTimer.scheduleNext();
ivRetries = 0;
Tr.warning(tc, "NP_TIMER_RETRY_LIMIT_REACHED_CNTR0179W", ivRetryLimit);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "Timer retry limit has been reached; aborting");
return;
}
ivRetries++;
// begin 597753
if (ivRetries == 1) {
// do first retry immediately, by re-entering this method
run();
} else {
// re-schedule the alarm to go off after the retry interval
// (if timer had not been canceled)
ivTimer.scheduleRetry(ivRetryInterval); // RTC107334
}
}
if (isTraceOn && tc.isEntryEnabled()) // F743-425.CodRev
Tr.exit(tc, "run"); // F743-425.CodRev
} | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"// F743-425.CodRev",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"run: \"",
"+",
"ivTimer",
".",
"ivTaskId",
")",
";",
"// F743-425.CodRev",
"if",
"(",
"serverStopping",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"Server shutting down; aborting\"",
")",
";",
"return",
";",
"}",
"if",
"(",
"ivRetries",
"==",
"0",
")",
"// This is the first try",
"{",
"// F743-7591 - Calculate the next expiration before calling the timeout",
"// method. This ensures that Timer.getNextTimeout will properly throw",
"// NoMoreTimeoutsException.",
"ivTimer",
".",
"calculateNextExpiration",
"(",
")",
";",
"}",
"// Log a warning if this timer is starting late",
"ivTimer",
".",
"checkLateTimerThreshold",
"(",
")",
";",
"try",
"// F743-425.CodRev",
"{",
"// Call the timeout method; last chance effort to abort if cancelled",
"if",
"(",
"!",
"ivTimer",
".",
"isIvDestroyed",
"(",
")",
")",
"{",
"doWork",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"Timer has been cancelled; aborting\"",
")",
";",
"return",
";",
"}",
"ivRetries",
"=",
"0",
";",
"// re-schedule the alarm to go off again if it needs to,",
"// and if timer had not been canceled",
"ivTimer",
".",
"scheduleNext",
"(",
")",
";",
"// RTC107334",
"}",
"catch",
"(",
"Throwable",
"ex",
")",
"// F743-425.CodRev",
"{",
"// Do not FFDC... that has already been done when the method failed",
"// All exceptions from timeout methods are system exceptions...",
"// indicating the timeout method failed, and should be retried. d667153",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"NP Timer failed : \"",
"+",
"ex",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\":\"",
"+",
"ex",
".",
"getMessage",
"(",
")",
",",
"ex",
")",
";",
"}",
"if",
"(",
"(",
"ivRetryLimit",
"!=",
"-",
"1",
")",
"&&",
"// not configured to retry indefinitely",
"(",
"ivRetries",
">=",
"ivRetryLimit",
")",
")",
"// and retry limit reached",
"{",
"// Note: ivRetryLimit==0 means no retries at all",
"ivTimer",
".",
"calculateNextExpiration",
"(",
")",
";",
"ivTimer",
".",
"scheduleNext",
"(",
")",
";",
"ivRetries",
"=",
"0",
";",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"NP_TIMER_RETRY_LIMIT_REACHED_CNTR0179W\"",
",",
"ivRetryLimit",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"Timer retry limit has been reached; aborting\"",
")",
";",
"return",
";",
"}",
"ivRetries",
"++",
";",
"// begin 597753",
"if",
"(",
"ivRetries",
"==",
"1",
")",
"{",
"// do first retry immediately, by re-entering this method",
"run",
"(",
")",
";",
"}",
"else",
"{",
"// re-schedule the alarm to go off after the retry interval",
"// (if timer had not been canceled)",
"ivTimer",
".",
"scheduleRetry",
"(",
"ivRetryInterval",
")",
";",
"// RTC107334",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"// F743-425.CodRev",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"run\"",
")",
";",
"// F743-425.CodRev",
"}"
] | Executes the timer work with configured retries.
The EJB 3.1 spec, section 18.4.3 says, "If the transaction fails or
is rolled back, the container must retry the timeout at least once."
We allow the user to configure a retry count of 0, which will cause
NO retries to be performed. If the retry count is not set, we will
retry once immediately, then every retryInterval, indefinitely. | [
"Executes",
"the",
"timer",
"work",
"with",
"configured",
"retries",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/TimerNpRunnable.java#L70-L146 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/xml/ParserFactory.java | ParserFactory.parseDocument | public static Document parseDocument(DocumentBuilder builder, File file) throws IOException, SAXException {
final DocumentBuilder docBuilder = builder;
final File parsingFile = file;
try {
return (Document) AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws SAXException, IOException {
Thread currThread = Thread.currentThread();
ClassLoader oldLoader = currThread.getContextClassLoader();
currThread.setContextClassLoader(ParserFactory.class.getClassLoader());
try {
return docBuilder.parse(parsingFile);
}
finally {
currThread.setContextClassLoader(oldLoader);
}
}
});
} catch (PrivilegedActionException pae) {
Throwable t = pae.getCause();
if (t instanceof SAXException) {
throw (SAXException) t;
} else if (t instanceof IOException) {
throw (IOException) t;
}
}
return null;
} | java | public static Document parseDocument(DocumentBuilder builder, File file) throws IOException, SAXException {
final DocumentBuilder docBuilder = builder;
final File parsingFile = file;
try {
return (Document) AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws SAXException, IOException {
Thread currThread = Thread.currentThread();
ClassLoader oldLoader = currThread.getContextClassLoader();
currThread.setContextClassLoader(ParserFactory.class.getClassLoader());
try {
return docBuilder.parse(parsingFile);
}
finally {
currThread.setContextClassLoader(oldLoader);
}
}
});
} catch (PrivilegedActionException pae) {
Throwable t = pae.getCause();
if (t instanceof SAXException) {
throw (SAXException) t;
} else if (t instanceof IOException) {
throw (IOException) t;
}
}
return null;
} | [
"public",
"static",
"Document",
"parseDocument",
"(",
"DocumentBuilder",
"builder",
",",
"File",
"file",
")",
"throws",
"IOException",
",",
"SAXException",
"{",
"final",
"DocumentBuilder",
"docBuilder",
"=",
"builder",
";",
"final",
"File",
"parsingFile",
"=",
"file",
";",
"try",
"{",
"return",
"(",
"Document",
")",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
"(",
")",
"{",
"public",
"Object",
"run",
"(",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"Thread",
"currThread",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"ClassLoader",
"oldLoader",
"=",
"currThread",
".",
"getContextClassLoader",
"(",
")",
";",
"currThread",
".",
"setContextClassLoader",
"(",
"ParserFactory",
".",
"class",
".",
"getClassLoader",
"(",
")",
")",
";",
"try",
"{",
"return",
"docBuilder",
".",
"parse",
"(",
"parsingFile",
")",
";",
"}",
"finally",
"{",
"currThread",
".",
"setContextClassLoader",
"(",
"oldLoader",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"PrivilegedActionException",
"pae",
")",
"{",
"Throwable",
"t",
"=",
"pae",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"t",
"instanceof",
"SAXException",
")",
"{",
"throw",
"(",
"SAXException",
")",
"t",
";",
"}",
"else",
"if",
"(",
"t",
"instanceof",
"IOException",
")",
"{",
"throw",
"(",
"IOException",
")",
"t",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | D190462 - START | [
"D190462",
"-",
"START"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/xml/ParserFactory.java#L286-L312 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpInputStreamImpl.java | HttpInputStreamImpl.checkBuffer | protected boolean checkBuffer() throws IOException {
if (!enableMultiReadofPostData) {
if (null != this.buffer) {
if (this.buffer.hasRemaining()) {
return true;
}
this.buffer.release();
this.buffer = null;
}
try {
this.buffer = this.isc.getRequestBodyBuffer();
if (null != this.buffer) {
// record the new amount of data read from the channel
this.bytesRead += this.buffer.remaining();
// Tr.debug(tc, "Buffer=" + WsByteBufferUtils.asString(this.buffer));
return true;
}
return false;
} catch (IOException e) {
this.error = e;
throw e;
}
} else {
return checkMultiReadBuffer();
}
} | java | protected boolean checkBuffer() throws IOException {
if (!enableMultiReadofPostData) {
if (null != this.buffer) {
if (this.buffer.hasRemaining()) {
return true;
}
this.buffer.release();
this.buffer = null;
}
try {
this.buffer = this.isc.getRequestBodyBuffer();
if (null != this.buffer) {
// record the new amount of data read from the channel
this.bytesRead += this.buffer.remaining();
// Tr.debug(tc, "Buffer=" + WsByteBufferUtils.asString(this.buffer));
return true;
}
return false;
} catch (IOException e) {
this.error = e;
throw e;
}
} else {
return checkMultiReadBuffer();
}
} | [
"protected",
"boolean",
"checkBuffer",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"enableMultiReadofPostData",
")",
"{",
"if",
"(",
"null",
"!=",
"this",
".",
"buffer",
")",
"{",
"if",
"(",
"this",
".",
"buffer",
".",
"hasRemaining",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"this",
".",
"buffer",
".",
"release",
"(",
")",
";",
"this",
".",
"buffer",
"=",
"null",
";",
"}",
"try",
"{",
"this",
".",
"buffer",
"=",
"this",
".",
"isc",
".",
"getRequestBodyBuffer",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"this",
".",
"buffer",
")",
"{",
"// record the new amount of data read from the channel",
"this",
".",
"bytesRead",
"+=",
"this",
".",
"buffer",
".",
"remaining",
"(",
")",
";",
"// Tr.debug(tc, \"Buffer=\" + WsByteBufferUtils.asString(this.buffer));",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"this",
".",
"error",
"=",
"e",
";",
"throw",
"e",
";",
"}",
"}",
"else",
"{",
"return",
"checkMultiReadBuffer",
"(",
")",
";",
"}",
"}"
] | Check the input buffer for data. If necessary, attempt a read for a new
buffer.
@return boolean - true means data is ready
@throws IOException | [
"Check",
"the",
"input",
"buffer",
"for",
"data",
".",
"If",
"necessary",
"attempt",
"a",
"read",
"for",
"a",
"new",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpInputStreamImpl.java#L105-L130 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpInputStreamImpl.java | HttpInputStreamImpl.checkMultiReadBuffer | private boolean checkMultiReadBuffer() throws IOException {
//first check existing buffer
if (null != this.buffer) {
if (this.buffer.hasRemaining()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer, remaining ->" + this);
}
return true;
}
if (firstReadCompleteforMulti) { // multiRead enabled and subsequent read
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer, buffer is completely read, ready this buffer for the subsequent read ->" + this);
}
postDataBuffer.get(postDataIndex).flip(); // make position 0 , to read it again from start
postDataIndex++;
} else {
this.buffer.release();
}
this.buffer = null;
}
// no buffer read from store or first read of buffer
if (firstReadCompleteforMulti) {
// first read from what we have stored, if need more than go to channel
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer ,index ->" + postDataIndex + " ,storage.size ->" + postDataBuffer.size());
}
if (postDataBuffer.size() <= postDataIndex) {
//get remaining from channel now as read needs more than the stored
readRemainingFromChannel();
}
if (postDataBuffer.size() > postDataIndex) {
this.buffer = postDataBuffer.get(postDataIndex);
}
if (null != this.buffer) {
// record the new amount of data read from the store
this.bytesReadFromStore += this.buffer.remaining();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer ->" + this);
}
return true;
}
} else { // multiRead enabled and first read
if (getBufferFromChannel()) {
// store the channel buffer
postDataBuffer.add(postDataIndex, this.buffer.duplicate());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer, buffer ->" + postDataBuffer.get(postDataIndex)
+ " ,buffersize ->" + postDataBuffer.size() + " ,index ->" + postDataIndex);
}
postDataIndex++;
// record the new amount of data read from the channel
this.bytesRead += this.buffer.remaining();
return true;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer: no more buffer ->" + this);
}
return false;
} | java | private boolean checkMultiReadBuffer() throws IOException {
//first check existing buffer
if (null != this.buffer) {
if (this.buffer.hasRemaining()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer, remaining ->" + this);
}
return true;
}
if (firstReadCompleteforMulti) { // multiRead enabled and subsequent read
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer, buffer is completely read, ready this buffer for the subsequent read ->" + this);
}
postDataBuffer.get(postDataIndex).flip(); // make position 0 , to read it again from start
postDataIndex++;
} else {
this.buffer.release();
}
this.buffer = null;
}
// no buffer read from store or first read of buffer
if (firstReadCompleteforMulti) {
// first read from what we have stored, if need more than go to channel
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer ,index ->" + postDataIndex + " ,storage.size ->" + postDataBuffer.size());
}
if (postDataBuffer.size() <= postDataIndex) {
//get remaining from channel now as read needs more than the stored
readRemainingFromChannel();
}
if (postDataBuffer.size() > postDataIndex) {
this.buffer = postDataBuffer.get(postDataIndex);
}
if (null != this.buffer) {
// record the new amount of data read from the store
this.bytesReadFromStore += this.buffer.remaining();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer ->" + this);
}
return true;
}
} else { // multiRead enabled and first read
if (getBufferFromChannel()) {
// store the channel buffer
postDataBuffer.add(postDataIndex, this.buffer.duplicate());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer, buffer ->" + postDataBuffer.get(postDataIndex)
+ " ,buffersize ->" + postDataBuffer.size() + " ,index ->" + postDataIndex);
}
postDataIndex++;
// record the new amount of data read from the channel
this.bytesRead += this.buffer.remaining();
return true;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "checkMultiReadBuffer: no more buffer ->" + this);
}
return false;
} | [
"private",
"boolean",
"checkMultiReadBuffer",
"(",
")",
"throws",
"IOException",
"{",
"//first check existing buffer",
"if",
"(",
"null",
"!=",
"this",
".",
"buffer",
")",
"{",
"if",
"(",
"this",
".",
"buffer",
".",
"hasRemaining",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"checkMultiReadBuffer, remaining ->\"",
"+",
"this",
")",
";",
"}",
"return",
"true",
";",
"}",
"if",
"(",
"firstReadCompleteforMulti",
")",
"{",
"// multiRead enabled and subsequent read",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"checkMultiReadBuffer, buffer is completely read, ready this buffer for the subsequent read ->\"",
"+",
"this",
")",
";",
"}",
"postDataBuffer",
".",
"get",
"(",
"postDataIndex",
")",
".",
"flip",
"(",
")",
";",
"// make position 0 , to read it again from start",
"postDataIndex",
"++",
";",
"}",
"else",
"{",
"this",
".",
"buffer",
".",
"release",
"(",
")",
";",
"}",
"this",
".",
"buffer",
"=",
"null",
";",
"}",
"// no buffer read from store or first read of buffer",
"if",
"(",
"firstReadCompleteforMulti",
")",
"{",
"// first read from what we have stored, if need more than go to channel",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"checkMultiReadBuffer ,index ->\"",
"+",
"postDataIndex",
"+",
"\" ,storage.size ->\"",
"+",
"postDataBuffer",
".",
"size",
"(",
")",
")",
";",
"}",
"if",
"(",
"postDataBuffer",
".",
"size",
"(",
")",
"<=",
"postDataIndex",
")",
"{",
"//get remaining from channel now as read needs more than the stored",
"readRemainingFromChannel",
"(",
")",
";",
"}",
"if",
"(",
"postDataBuffer",
".",
"size",
"(",
")",
">",
"postDataIndex",
")",
"{",
"this",
".",
"buffer",
"=",
"postDataBuffer",
".",
"get",
"(",
"postDataIndex",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"this",
".",
"buffer",
")",
"{",
"// record the new amount of data read from the store",
"this",
".",
"bytesReadFromStore",
"+=",
"this",
".",
"buffer",
".",
"remaining",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"checkMultiReadBuffer ->\"",
"+",
"this",
")",
";",
"}",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"// multiRead enabled and first read",
"if",
"(",
"getBufferFromChannel",
"(",
")",
")",
"{",
"// store the channel buffer",
"postDataBuffer",
".",
"add",
"(",
"postDataIndex",
",",
"this",
".",
"buffer",
".",
"duplicate",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"checkMultiReadBuffer, buffer ->\"",
"+",
"postDataBuffer",
".",
"get",
"(",
"postDataIndex",
")",
"+",
"\" ,buffersize ->\"",
"+",
"postDataBuffer",
".",
"size",
"(",
")",
"+",
"\" ,index ->\"",
"+",
"postDataIndex",
")",
";",
"}",
"postDataIndex",
"++",
";",
"// record the new amount of data read from the channel",
"this",
".",
"bytesRead",
"+=",
"this",
".",
"buffer",
".",
"remaining",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"checkMultiReadBuffer: no more buffer ->\"",
"+",
"this",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Check the input buffer for data. If necessary, attempt a read for a new
buffer and store it.
@return
@throws IOException | [
"Check",
"the",
"input",
"buffer",
"for",
"data",
".",
"If",
"necessary",
"attempt",
"a",
"read",
"for",
"a",
"new",
"buffer",
"and",
"store",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpInputStreamImpl.java#L139-L201 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/internal/EsaSubsystemFeatureDefinitionImpl.java | EsaSubsystemFeatureDefinitionImpl.constructInstance | public static EsaSubsystemFeatureDefinitionImpl constructInstance(File esa) throws ZipException, IOException {
// Find the manifest - case isn't guaranteed so do a search
ZipFile zip = new ZipFile(esa);
Enumeration<? extends ZipEntry> zipEntries = zip.entries();
ZipEntry subsystemEntry = null;
while (zipEntries.hasMoreElements()) {
ZipEntry nextEntry = zipEntries.nextElement();
if ("OSGI-INF/SUBSYSTEM.MF".equalsIgnoreCase(nextEntry.getName())) {
subsystemEntry = nextEntry;
}
}
return new EsaSubsystemFeatureDefinitionImpl(zip.getInputStream(subsystemEntry), zip);
} | java | public static EsaSubsystemFeatureDefinitionImpl constructInstance(File esa) throws ZipException, IOException {
// Find the manifest - case isn't guaranteed so do a search
ZipFile zip = new ZipFile(esa);
Enumeration<? extends ZipEntry> zipEntries = zip.entries();
ZipEntry subsystemEntry = null;
while (zipEntries.hasMoreElements()) {
ZipEntry nextEntry = zipEntries.nextElement();
if ("OSGI-INF/SUBSYSTEM.MF".equalsIgnoreCase(nextEntry.getName())) {
subsystemEntry = nextEntry;
}
}
return new EsaSubsystemFeatureDefinitionImpl(zip.getInputStream(subsystemEntry), zip);
} | [
"public",
"static",
"EsaSubsystemFeatureDefinitionImpl",
"constructInstance",
"(",
"File",
"esa",
")",
"throws",
"ZipException",
",",
"IOException",
"{",
"// Find the manifest - case isn't guaranteed so do a search",
"ZipFile",
"zip",
"=",
"new",
"ZipFile",
"(",
"esa",
")",
";",
"Enumeration",
"<",
"?",
"extends",
"ZipEntry",
">",
"zipEntries",
"=",
"zip",
".",
"entries",
"(",
")",
";",
"ZipEntry",
"subsystemEntry",
"=",
"null",
";",
"while",
"(",
"zipEntries",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"ZipEntry",
"nextEntry",
"=",
"zipEntries",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"\"OSGI-INF/SUBSYSTEM.MF\"",
".",
"equalsIgnoreCase",
"(",
"nextEntry",
".",
"getName",
"(",
")",
")",
")",
"{",
"subsystemEntry",
"=",
"nextEntry",
";",
"}",
"}",
"return",
"new",
"EsaSubsystemFeatureDefinitionImpl",
"(",
"zip",
".",
"getInputStream",
"(",
"subsystemEntry",
")",
",",
"zip",
")",
";",
"}"
] | Create a new instance of this class for the supplied ESA file.
@param esa The ESA to load
@return The {@link EsaSubsystemFeatureDefinitionImpl} for working with the properties of the ESA
@throws ZipException
@throws IOException | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"for",
"the",
"supplied",
"ESA",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/internal/EsaSubsystemFeatureDefinitionImpl.java#L43-L55 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IncidentLogger.java | IncidentLogger.formatTime | static String formatTime() {
Date date = new Date();
DateFormat formatter = BaseTraceFormatter.useIsoDateFormat ? new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") : DateFormatProvider.getDateFormat();
StringBuffer answer = new StringBuffer();
answer.append('[');
formatter.format(date, answer, new FieldPosition(0));
answer.append(']');
return answer.toString();
} | java | static String formatTime() {
Date date = new Date();
DateFormat formatter = BaseTraceFormatter.useIsoDateFormat ? new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") : DateFormatProvider.getDateFormat();
StringBuffer answer = new StringBuffer();
answer.append('[');
formatter.format(date, answer, new FieldPosition(0));
answer.append(']');
return answer.toString();
} | [
"static",
"String",
"formatTime",
"(",
")",
"{",
"Date",
"date",
"=",
"new",
"Date",
"(",
")",
";",
"DateFormat",
"formatter",
"=",
"BaseTraceFormatter",
".",
"useIsoDateFormat",
"?",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\"",
")",
":",
"DateFormatProvider",
".",
"getDateFormat",
"(",
")",
";",
"StringBuffer",
"answer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"answer",
".",
"append",
"(",
"'",
"'",
")",
";",
"formatter",
".",
"format",
"(",
"date",
",",
"answer",
",",
"new",
"FieldPosition",
"(",
"0",
")",
")",
";",
"answer",
".",
"append",
"(",
"'",
"'",
")",
";",
"return",
"answer",
".",
"toString",
"(",
")",
";",
"}"
] | Return the current time formatted in a standard way
@return The current time | [
"Return",
"the",
"current",
"time",
"formatted",
"in",
"a",
"standard",
"way"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IncidentLogger.java#L114-L122 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IncidentLogger.java | IncidentLogger.getCallStackFromStackTraceElement | private static String[] getCallStackFromStackTraceElement(StackTraceElement[] exceptionCallStack) {
if (exceptionCallStack == null)
return null;
String[] answer = new String[exceptionCallStack.length];
for (int i = 0; i < exceptionCallStack.length; i++) {
answer[exceptionCallStack.length - 1 - i] = exceptionCallStack[i].getClassName();
}
return answer;
} | java | private static String[] getCallStackFromStackTraceElement(StackTraceElement[] exceptionCallStack) {
if (exceptionCallStack == null)
return null;
String[] answer = new String[exceptionCallStack.length];
for (int i = 0; i < exceptionCallStack.length; i++) {
answer[exceptionCallStack.length - 1 - i] = exceptionCallStack[i].getClassName();
}
return answer;
} | [
"private",
"static",
"String",
"[",
"]",
"getCallStackFromStackTraceElement",
"(",
"StackTraceElement",
"[",
"]",
"exceptionCallStack",
")",
"{",
"if",
"(",
"exceptionCallStack",
"==",
"null",
")",
"return",
"null",
";",
"String",
"[",
"]",
"answer",
"=",
"new",
"String",
"[",
"exceptionCallStack",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"exceptionCallStack",
".",
"length",
";",
"i",
"++",
")",
"{",
"answer",
"[",
"exceptionCallStack",
".",
"length",
"-",
"1",
"-",
"i",
"]",
"=",
"exceptionCallStack",
"[",
"i",
"]",
".",
"getClassName",
"(",
")",
";",
"}",
"return",
"answer",
";",
"}"
] | Create the call stack array expected by diagnostic modules from an array
of StackTraceElements
@param exceptionCallStack
The stack trace elements
@return The call stack | [
"Create",
"the",
"call",
"stack",
"array",
"expected",
"by",
"diagnostic",
"modules",
"from",
"an",
"array",
"of",
"StackTraceElements"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IncidentLogger.java#L171-L180 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IncidentLogger.java | IncidentLogger.getPackageName | private static String getPackageName(String className) {
int end = className.lastIndexOf('.');
return (end > 0) ? className.substring(0, end) : "";
} | java | private static String getPackageName(String className) {
int end = className.lastIndexOf('.');
return (end > 0) ? className.substring(0, end) : "";
} | [
"private",
"static",
"String",
"getPackageName",
"(",
"String",
"className",
")",
"{",
"int",
"end",
"=",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"return",
"(",
"end",
">",
"0",
")",
"?",
"className",
".",
"substring",
"(",
"0",
",",
"end",
")",
":",
"\"\"",
";",
"}"
] | Return the package name of a given class name
@param className
The class name from which to find the package name
@return The package name of the class (the empty string is returned for
the default package | [
"Return",
"the",
"package",
"name",
"of",
"a",
"given",
"class",
"name"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/IncidentLogger.java#L190-L193 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwtsso/src/com/ibm/ws/security/jwtsso/utils/ConfigUtils.java | ConfigUtils.validateCookieName | public String validateCookieName(String cookieName, boolean quiet) {
if (cookieName == null || cookieName.length() == 0) {
if (!quiet) {
Tr.error(tc, "COOKIE_NAME_CANT_BE_EMPTY");
}
return CFG_DEFAULT_COOKIENAME;
}
String cookieNameUc = cookieName.toUpperCase();
boolean valid = true;
for (int i = 0; i < cookieName.length(); i++) {
String eval = cookieNameUc.substring(i, i + 1);
if (!validCookieChars.contains(eval)) {
if (!quiet) {
Tr.error(tc, "COOKIE_NAME_INVALID", new Object[] { cookieName, eval });
}
valid = false;
}
}
if (!valid) {
return CFG_DEFAULT_COOKIENAME;
} else {
return cookieName;
}
} | java | public String validateCookieName(String cookieName, boolean quiet) {
if (cookieName == null || cookieName.length() == 0) {
if (!quiet) {
Tr.error(tc, "COOKIE_NAME_CANT_BE_EMPTY");
}
return CFG_DEFAULT_COOKIENAME;
}
String cookieNameUc = cookieName.toUpperCase();
boolean valid = true;
for (int i = 0; i < cookieName.length(); i++) {
String eval = cookieNameUc.substring(i, i + 1);
if (!validCookieChars.contains(eval)) {
if (!quiet) {
Tr.error(tc, "COOKIE_NAME_INVALID", new Object[] { cookieName, eval });
}
valid = false;
}
}
if (!valid) {
return CFG_DEFAULT_COOKIENAME;
} else {
return cookieName;
}
} | [
"public",
"String",
"validateCookieName",
"(",
"String",
"cookieName",
",",
"boolean",
"quiet",
")",
"{",
"if",
"(",
"cookieName",
"==",
"null",
"||",
"cookieName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"!",
"quiet",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"COOKIE_NAME_CANT_BE_EMPTY\"",
")",
";",
"}",
"return",
"CFG_DEFAULT_COOKIENAME",
";",
"}",
"String",
"cookieNameUc",
"=",
"cookieName",
".",
"toUpperCase",
"(",
")",
";",
"boolean",
"valid",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cookieName",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"String",
"eval",
"=",
"cookieNameUc",
".",
"substring",
"(",
"i",
",",
"i",
"+",
"1",
")",
";",
"if",
"(",
"!",
"validCookieChars",
".",
"contains",
"(",
"eval",
")",
")",
"{",
"if",
"(",
"!",
"quiet",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"COOKIE_NAME_INVALID\"",
",",
"new",
"Object",
"[",
"]",
"{",
"cookieName",
",",
"eval",
"}",
")",
";",
"}",
"valid",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"!",
"valid",
")",
"{",
"return",
"CFG_DEFAULT_COOKIENAME",
";",
"}",
"else",
"{",
"return",
"cookieName",
";",
"}",
"}"
] | reset cookieName to default value if it is not valid
@param cookieName
@param quiet
don't emit any error messages
@return original name or default if original was invalid | [
"reset",
"cookieName",
"to",
"default",
"value",
"if",
"it",
"is",
"not",
"valid"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwtsso/src/com/ibm/ws/security/jwtsso/utils/ConfigUtils.java#L30-L53 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredSyncs.java | RegisteredSyncs.distributeBefore | public void distributeBefore()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "distributeBefore", this);
boolean setRollback = false;
try
{
coreDistributeBefore();
}
catch (Throwable exc)
{
// No FFDC Code Needed.
Tr.error(tc, "WTRN0074_SYNCHRONIZATION_EXCEPTION", new Object[] {"before_completion", exc});
// PK19059 starts here
_tran.setOriginalException(exc);
// PK19059 ends here
setRollback = true;
}
// Finally issue the RRS syncs - z/OS always issues these even if RBO has occurred
// during previous syncs. Need to check with Matt if we need to do these even if the
// overall transaction is set to RBO as we bypass distributeBefore in this case.
final List RRSsyncs = _syncs[SYNC_TIER_RRS];
if (RRSsyncs != null)
{
for (int j = 0; j < RRSsyncs.size(); j++ ) // d162354 array could grow
{
final Synchronization sync = (Synchronization)RRSsyncs.get(j);
if (tc.isEventEnabled()) Tr.event(tc, "driving RRS before sync[" + j + "]", Util.identity(sync));
try
{
sync.beforeCompletion();
}
catch (Throwable exc)
{
// No FFDC Code Needed.
Tr.error(tc, "WTRN0074_SYNCHRONIZATION_EXCEPTION", new Object[] {"before_completion", exc});
setRollback = true;
}
}
// If RRS syncs, one may be DB2 type 2, so issue thread switch
// NativeJDBCDriverHelper.threadSwitch(); /* @367977A*/
}
//----------------------------------------------------------
// If we've encountered an error, try to set rollback only
//----------------------------------------------------------
if (setRollback && _tran != null)
{
try
{
_tran.setRollbackOnly();
}
catch (Exception ex)
{
if (tc.isDebugEnabled()) Tr.debug(tc, "setRollbackOnly raised exception", ex);
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "distributeBefore");
} | java | public void distributeBefore()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "distributeBefore", this);
boolean setRollback = false;
try
{
coreDistributeBefore();
}
catch (Throwable exc)
{
// No FFDC Code Needed.
Tr.error(tc, "WTRN0074_SYNCHRONIZATION_EXCEPTION", new Object[] {"before_completion", exc});
// PK19059 starts here
_tran.setOriginalException(exc);
// PK19059 ends here
setRollback = true;
}
// Finally issue the RRS syncs - z/OS always issues these even if RBO has occurred
// during previous syncs. Need to check with Matt if we need to do these even if the
// overall transaction is set to RBO as we bypass distributeBefore in this case.
final List RRSsyncs = _syncs[SYNC_TIER_RRS];
if (RRSsyncs != null)
{
for (int j = 0; j < RRSsyncs.size(); j++ ) // d162354 array could grow
{
final Synchronization sync = (Synchronization)RRSsyncs.get(j);
if (tc.isEventEnabled()) Tr.event(tc, "driving RRS before sync[" + j + "]", Util.identity(sync));
try
{
sync.beforeCompletion();
}
catch (Throwable exc)
{
// No FFDC Code Needed.
Tr.error(tc, "WTRN0074_SYNCHRONIZATION_EXCEPTION", new Object[] {"before_completion", exc});
setRollback = true;
}
}
// If RRS syncs, one may be DB2 type 2, so issue thread switch
// NativeJDBCDriverHelper.threadSwitch(); /* @367977A*/
}
//----------------------------------------------------------
// If we've encountered an error, try to set rollback only
//----------------------------------------------------------
if (setRollback && _tran != null)
{
try
{
_tran.setRollbackOnly();
}
catch (Exception ex)
{
if (tc.isDebugEnabled()) Tr.debug(tc, "setRollbackOnly raised exception", ex);
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "distributeBefore");
} | [
"public",
"void",
"distributeBefore",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"distributeBefore\"",
",",
"this",
")",
";",
"boolean",
"setRollback",
"=",
"false",
";",
"try",
"{",
"coreDistributeBefore",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"exc",
")",
"{",
"// No FFDC Code Needed.",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"WTRN0074_SYNCHRONIZATION_EXCEPTION\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"before_completion\"",
",",
"exc",
"}",
")",
";",
"// PK19059 starts here",
"_tran",
".",
"setOriginalException",
"(",
"exc",
")",
";",
"// PK19059 ends here",
"setRollback",
"=",
"true",
";",
"}",
"// Finally issue the RRS syncs - z/OS always issues these even if RBO has occurred",
"// during previous syncs. Need to check with Matt if we need to do these even if the",
"// overall transaction is set to RBO as we bypass distributeBefore in this case.",
"final",
"List",
"RRSsyncs",
"=",
"_syncs",
"[",
"SYNC_TIER_RRS",
"]",
";",
"if",
"(",
"RRSsyncs",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"RRSsyncs",
".",
"size",
"(",
")",
";",
"j",
"++",
")",
"// d162354 array could grow",
"{",
"final",
"Synchronization",
"sync",
"=",
"(",
"Synchronization",
")",
"RRSsyncs",
".",
"get",
"(",
"j",
")",
";",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"driving RRS before sync[\"",
"+",
"j",
"+",
"\"]\"",
",",
"Util",
".",
"identity",
"(",
"sync",
")",
")",
";",
"try",
"{",
"sync",
".",
"beforeCompletion",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"exc",
")",
"{",
"// No FFDC Code Needed.",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"WTRN0074_SYNCHRONIZATION_EXCEPTION\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"before_completion\"",
",",
"exc",
"}",
")",
";",
"setRollback",
"=",
"true",
";",
"}",
"}",
"// If RRS syncs, one may be DB2 type 2, so issue thread switch",
"// NativeJDBCDriverHelper.threadSwitch(); /* @367977A*/",
"}",
"//----------------------------------------------------------",
"// If we've encountered an error, try to set rollback only",
"//----------------------------------------------------------",
"if",
"(",
"setRollback",
"&&",
"_tran",
"!=",
"null",
")",
"{",
"try",
"{",
"_tran",
".",
"setRollbackOnly",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setRollbackOnly raised exception\"",
",",
"ex",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"distributeBefore\"",
")",
";",
"}"
] | Distributes before completion operations to all registered Synchronization
objects. If a synchronization raises an exception, mark transaction
for rollback. | [
"Distributes",
"before",
"completion",
"operations",
"to",
"all",
"registered",
"Synchronization",
"objects",
".",
"If",
"a",
"synchronization",
"raises",
"an",
"exception",
"mark",
"transaction",
"for",
"rollback",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredSyncs.java#L141-L205 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredSyncs.java | RegisteredSyncs.distributeAfter | public void distributeAfter(int status)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "distributeAfter", new Object[] { this, status});
// Issue the RRS syncs first - these need to be as close to the completion as possible
final List RRSsyncs = _syncs[SYNC_TIER_RRS];
if (RRSsyncs != null)
{
final int RRSstatus = (status == Status.STATUS_UNKNOWN ? Status.STATUS_COMMITTED : status); // @281425A
for (int j = RRSsyncs.size(); --j >= 0;)
{
final Synchronization sync = (Synchronization)RRSsyncs.get(j);
try
{
if (tc.isEntryEnabled()) Tr.event(tc, "driving RRS after sync[" + j + "]", Util.identity(sync));
sync.afterCompletion(RRSstatus); // @281425C
}
catch (Throwable exc)
{
// No FFDC Code Needed.
// Discard any exceptions at this point.
Tr.error(tc, "WTRN0074_SYNCHRONIZATION_EXCEPTION", new Object[] {"after_completion", exc});
}
}
}
coreDistributeAfter(status);
if (tc.isEntryEnabled()) Tr.exit(tc, "distributeAfter");
} | java | public void distributeAfter(int status)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "distributeAfter", new Object[] { this, status});
// Issue the RRS syncs first - these need to be as close to the completion as possible
final List RRSsyncs = _syncs[SYNC_TIER_RRS];
if (RRSsyncs != null)
{
final int RRSstatus = (status == Status.STATUS_UNKNOWN ? Status.STATUS_COMMITTED : status); // @281425A
for (int j = RRSsyncs.size(); --j >= 0;)
{
final Synchronization sync = (Synchronization)RRSsyncs.get(j);
try
{
if (tc.isEntryEnabled()) Tr.event(tc, "driving RRS after sync[" + j + "]", Util.identity(sync));
sync.afterCompletion(RRSstatus); // @281425C
}
catch (Throwable exc)
{
// No FFDC Code Needed.
// Discard any exceptions at this point.
Tr.error(tc, "WTRN0074_SYNCHRONIZATION_EXCEPTION", new Object[] {"after_completion", exc});
}
}
}
coreDistributeAfter(status);
if (tc.isEntryEnabled()) Tr.exit(tc, "distributeAfter");
} | [
"public",
"void",
"distributeAfter",
"(",
"int",
"status",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"distributeAfter\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"status",
"}",
")",
";",
"// Issue the RRS syncs first - these need to be as close to the completion as possible",
"final",
"List",
"RRSsyncs",
"=",
"_syncs",
"[",
"SYNC_TIER_RRS",
"]",
";",
"if",
"(",
"RRSsyncs",
"!=",
"null",
")",
"{",
"final",
"int",
"RRSstatus",
"=",
"(",
"status",
"==",
"Status",
".",
"STATUS_UNKNOWN",
"?",
"Status",
".",
"STATUS_COMMITTED",
":",
"status",
")",
";",
"// @281425A",
"for",
"(",
"int",
"j",
"=",
"RRSsyncs",
".",
"size",
"(",
")",
";",
"--",
"j",
">=",
"0",
";",
")",
"{",
"final",
"Synchronization",
"sync",
"=",
"(",
"Synchronization",
")",
"RRSsyncs",
".",
"get",
"(",
"j",
")",
";",
"try",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"driving RRS after sync[\"",
"+",
"j",
"+",
"\"]\"",
",",
"Util",
".",
"identity",
"(",
"sync",
")",
")",
";",
"sync",
".",
"afterCompletion",
"(",
"RRSstatus",
")",
";",
"// @281425C",
"}",
"catch",
"(",
"Throwable",
"exc",
")",
"{",
"// No FFDC Code Needed.",
"// Discard any exceptions at this point.",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"WTRN0074_SYNCHRONIZATION_EXCEPTION\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"after_completion\"",
",",
"exc",
"}",
")",
";",
"}",
"}",
"}",
"coreDistributeAfter",
"(",
"status",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"distributeAfter\"",
")",
";",
"}"
] | Distributes after completion operations to all registered Synchronization
objects.
@param status Indicates whether the transaction committed. | [
"Distributes",
"after",
"completion",
"operations",
"to",
"all",
"registered",
"Synchronization",
"objects",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredSyncs.java#L261-L293 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPBufferFactory.java | UDPBufferFactory.getRef | public static UDPBufferFactory getRef() {
if (null == ofInstance) {
synchronized (UDPBufferFactory.class) {
if (null == ofInstance) {
ofInstance = new UDPBufferFactory();
}
}
}
return ofInstance;
} | java | public static UDPBufferFactory getRef() {
if (null == ofInstance) {
synchronized (UDPBufferFactory.class) {
if (null == ofInstance) {
ofInstance = new UDPBufferFactory();
}
}
}
return ofInstance;
} | [
"public",
"static",
"UDPBufferFactory",
"getRef",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"ofInstance",
")",
"{",
"synchronized",
"(",
"UDPBufferFactory",
".",
"class",
")",
"{",
"if",
"(",
"null",
"==",
"ofInstance",
")",
"{",
"ofInstance",
"=",
"new",
"UDPBufferFactory",
"(",
")",
";",
"}",
"}",
"}",
"return",
"ofInstance",
";",
"}"
] | Get a reference to the singleton instance of this class.
@return UDPBufferFactory | [
"Get",
"a",
"reference",
"to",
"the",
"singleton",
"instance",
"of",
"this",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPBufferFactory.java#L37-L46 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPBufferFactory.java | UDPBufferFactory.getUDPBuffer | public static UDPBufferImpl getUDPBuffer(WsByteBuffer buffer, SocketAddress address) {
UDPBufferImpl udpBuffer = getRef().getUDPBufferImpl();
udpBuffer.set(buffer, address);
return udpBuffer;
} | java | public static UDPBufferImpl getUDPBuffer(WsByteBuffer buffer, SocketAddress address) {
UDPBufferImpl udpBuffer = getRef().getUDPBufferImpl();
udpBuffer.set(buffer, address);
return udpBuffer;
} | [
"public",
"static",
"UDPBufferImpl",
"getUDPBuffer",
"(",
"WsByteBuffer",
"buffer",
",",
"SocketAddress",
"address",
")",
"{",
"UDPBufferImpl",
"udpBuffer",
"=",
"getRef",
"(",
")",
".",
"getUDPBufferImpl",
"(",
")",
";",
"udpBuffer",
".",
"set",
"(",
"buffer",
",",
"address",
")",
";",
"return",
"udpBuffer",
";",
"}"
] | Get a UDPBuffer that will encapsulate the provided information.
@param buffer
@param address
@return UDPBufferImpl | [
"Get",
"a",
"UDPBuffer",
"that",
"will",
"encapsulate",
"the",
"provided",
"information",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPBufferFactory.java#L64-L68 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPBufferFactory.java | UDPBufferFactory.getUDPBufferImpl | protected UDPBufferImpl getUDPBufferImpl() {
UDPBufferImpl ret = (UDPBufferImpl) udpBufferObjectPool.get();
if (ret == null) {
ret = new UDPBufferImpl(this);
}
return ret;
} | java | protected UDPBufferImpl getUDPBufferImpl() {
UDPBufferImpl ret = (UDPBufferImpl) udpBufferObjectPool.get();
if (ret == null) {
ret = new UDPBufferImpl(this);
}
return ret;
} | [
"protected",
"UDPBufferImpl",
"getUDPBufferImpl",
"(",
")",
"{",
"UDPBufferImpl",
"ret",
"=",
"(",
"UDPBufferImpl",
")",
"udpBufferObjectPool",
".",
"get",
"(",
")",
";",
"if",
"(",
"ret",
"==",
"null",
")",
"{",
"ret",
"=",
"new",
"UDPBufferImpl",
"(",
"this",
")",
";",
"}",
"return",
"ret",
";",
"}"
] | Retrieve an UDPBuffer object from the factory.
@return UDPBufferImpl | [
"Retrieve",
"an",
"UDPBuffer",
"object",
"from",
"the",
"factory",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPBufferFactory.java#L84-L90 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileLogProperties.java | FileLogProperties.logDirectory | public String logDirectory()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "logDirectory", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "logDirectory", _logDirectory);
return _logDirectory;
} | java | public String logDirectory()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "logDirectory", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "logDirectory", _logDirectory);
return _logDirectory;
} | [
"public",
"String",
"logDirectory",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"logDirectory\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"logDirectory\"",
",",
"_logDirectory",
")",
";",
"return",
"_logDirectory",
";",
"}"
] | Returns the physical location where a recovery log constructed from the target
object will reside.
@return String The phyisical log directory path | [
"Returns",
"the",
"physical",
"location",
"where",
"a",
"recovery",
"log",
"constructed",
"from",
"the",
"target",
"object",
"will",
"reside",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileLogProperties.java#L304-L311 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileLogProperties.java | FileLogProperties.logDirectoryStem | public String logDirectoryStem()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "logDirectoryStem", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "logDirectoryStem", _logDirectoryStem);
return _logDirectoryStem;
} | java | public String logDirectoryStem()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "logDirectoryStem", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "logDirectoryStem", _logDirectoryStem);
return _logDirectoryStem;
} | [
"public",
"String",
"logDirectoryStem",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"logDirectoryStem\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"logDirectoryStem\"",
",",
"_logDirectoryStem",
")",
";",
"return",
"_logDirectoryStem",
";",
"}"
] | Returns the stem of the location where a recovery log constructed from the target
object will reside.
@return String The stem of the log directory path | [
"Returns",
"the",
"stem",
"of",
"the",
"location",
"where",
"a",
"recovery",
"log",
"constructed",
"from",
"the",
"target",
"object",
"will",
"reside",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileLogProperties.java#L322-L329 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileLogProperties.java | FileLogProperties.logFileSize | public int logFileSize()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "logFileSize", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "logFileSize", new Integer(_logFileSize));
return _logFileSize;
} | java | public int logFileSize()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "logFileSize", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "logFileSize", new Integer(_logFileSize));
return _logFileSize;
} | [
"public",
"int",
"logFileSize",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"logFileSize\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"logFileSize\"",
",",
"new",
"Integer",
"(",
"_logFileSize",
")",
")",
";",
"return",
"_logFileSize",
";",
"}"
] | Returns the physical log size of a recovery log constructed from the target
object.
@return int The phyisical log size (in kilobytes) | [
"Returns",
"the",
"physical",
"log",
"size",
"of",
"a",
"recovery",
"log",
"constructed",
"from",
"the",
"target",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileLogProperties.java#L340-L347 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileLogProperties.java | FileLogProperties.maxLogFileSize | public int maxLogFileSize()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "maxLogFileSize", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "maxLogFileSize", new Integer(_maxLogFileSize));
return _maxLogFileSize;
} | java | public int maxLogFileSize()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "maxLogFileSize", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "maxLogFileSize", new Integer(_maxLogFileSize));
return _maxLogFileSize;
} | [
"public",
"int",
"maxLogFileSize",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"maxLogFileSize\"",
",",
"this",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"maxLogFileSize\"",
",",
"new",
"Integer",
"(",
"_maxLogFileSize",
")",
")",
";",
"return",
"_maxLogFileSize",
";",
"}"
] | Returns the maximum physical log size of a recovery log constructed from the
target object.
@return int The maximum phyisical log size (in kilobytes) | [
"Returns",
"the",
"maximum",
"physical",
"log",
"size",
"of",
"a",
"recovery",
"log",
"constructed",
"from",
"the",
"target",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileLogProperties.java#L358-L365 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading.bells/src/com/ibm/ws/classloading/bells/internal/Bell.java | Bell.unregister | void unregister() {
trackerLock.lock();
try {
if (tracker != null) {
// simply closing the tracker causes the services to be unregistered
tracker.close();
tracker = null;
}
} finally {
trackerLock.unlock();
}
} | java | void unregister() {
trackerLock.lock();
try {
if (tracker != null) {
// simply closing the tracker causes the services to be unregistered
tracker.close();
tracker = null;
}
} finally {
trackerLock.unlock();
}
} | [
"void",
"unregister",
"(",
")",
"{",
"trackerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"tracker",
"!=",
"null",
")",
"{",
"// simply closing the tracker causes the services to be unregistered",
"tracker",
".",
"close",
"(",
")",
";",
"tracker",
"=",
"null",
";",
"}",
"}",
"finally",
"{",
"trackerLock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Unregisters all OSGi services associated with this bell | [
"Unregisters",
"all",
"OSGi",
"services",
"associated",
"with",
"this",
"bell"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading.bells/src/com/ibm/ws/classloading/bells/internal/Bell.java#L117-L128 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading.bells/src/com/ibm/ws/classloading/bells/internal/Bell.java | Bell.update | void update() {
final BundleContext context = componentContext.getBundleContext();
// determine the service filter to use for discovering the Library service this bell is for
String libraryRef = library.id();
// it is unclear if only looking at the id would work here.
// other examples in classloading use both id and service.pid to look up so doing the same here.
String libraryStatusFilter = String.format("(&(objectClass=%s)(|(id=%s)(service.pid=%s)))", Library.class.getName(), libraryRef, libraryRef);
Filter filter;
try {
filter = context.createFilter(libraryStatusFilter);
} catch (InvalidSyntaxException e) {
// should not happen, but blow up if it does
throw new RuntimeException(e);
}
final Set<String> serviceNames = getServiceNames((String[]) config.get(SERVICE_ATT));
// create a tracker that will register the services once the library becomes available
ServiceTracker<Library, List<ServiceRegistration<?>>> newTracker = null;
newTracker = new ServiceTracker<Library, List<ServiceRegistration<?>>>(context, filter, new ServiceTrackerCustomizer<Library, List<ServiceRegistration<?>>>() {
@Override
public List<ServiceRegistration<?>> addingService(ServiceReference<Library> libraryRef) {
Library library = context.getService(libraryRef);
// Got the library now register the services.
// The list of registrations is returned so we don't have to store them ourselves.
return registerLibraryServices(library, serviceNames);
}
@Override
public void modifiedService(ServiceReference<Library> libraryRef, List<ServiceRegistration<?>> metaInfServices) {
// don't care
}
@Override
@FFDCIgnore(IllegalStateException.class)
public void removedService(ServiceReference<Library> libraryRef, List<ServiceRegistration<?>> metaInfServices) {
// THe library is going away; need to unregister the services
for (ServiceRegistration<?> registration : metaInfServices) {
try {
registration.unregister();
} catch (IllegalStateException e) {
// ignore; already unregistered
}
}
context.ungetService(libraryRef);
}
});
trackerLock.lock();
try {
if (tracker != null) {
// close the existing tracker so we unregister existing services
tracker.close();
}
// store and open the new tracker so we can register the configured services.
tracker = newTracker;
tracker.open();
} finally {
trackerLock.unlock();
}
} | java | void update() {
final BundleContext context = componentContext.getBundleContext();
// determine the service filter to use for discovering the Library service this bell is for
String libraryRef = library.id();
// it is unclear if only looking at the id would work here.
// other examples in classloading use both id and service.pid to look up so doing the same here.
String libraryStatusFilter = String.format("(&(objectClass=%s)(|(id=%s)(service.pid=%s)))", Library.class.getName(), libraryRef, libraryRef);
Filter filter;
try {
filter = context.createFilter(libraryStatusFilter);
} catch (InvalidSyntaxException e) {
// should not happen, but blow up if it does
throw new RuntimeException(e);
}
final Set<String> serviceNames = getServiceNames((String[]) config.get(SERVICE_ATT));
// create a tracker that will register the services once the library becomes available
ServiceTracker<Library, List<ServiceRegistration<?>>> newTracker = null;
newTracker = new ServiceTracker<Library, List<ServiceRegistration<?>>>(context, filter, new ServiceTrackerCustomizer<Library, List<ServiceRegistration<?>>>() {
@Override
public List<ServiceRegistration<?>> addingService(ServiceReference<Library> libraryRef) {
Library library = context.getService(libraryRef);
// Got the library now register the services.
// The list of registrations is returned so we don't have to store them ourselves.
return registerLibraryServices(library, serviceNames);
}
@Override
public void modifiedService(ServiceReference<Library> libraryRef, List<ServiceRegistration<?>> metaInfServices) {
// don't care
}
@Override
@FFDCIgnore(IllegalStateException.class)
public void removedService(ServiceReference<Library> libraryRef, List<ServiceRegistration<?>> metaInfServices) {
// THe library is going away; need to unregister the services
for (ServiceRegistration<?> registration : metaInfServices) {
try {
registration.unregister();
} catch (IllegalStateException e) {
// ignore; already unregistered
}
}
context.ungetService(libraryRef);
}
});
trackerLock.lock();
try {
if (tracker != null) {
// close the existing tracker so we unregister existing services
tracker.close();
}
// store and open the new tracker so we can register the configured services.
tracker = newTracker;
tracker.open();
} finally {
trackerLock.unlock();
}
} | [
"void",
"update",
"(",
")",
"{",
"final",
"BundleContext",
"context",
"=",
"componentContext",
".",
"getBundleContext",
"(",
")",
";",
"// determine the service filter to use for discovering the Library service this bell is for",
"String",
"libraryRef",
"=",
"library",
".",
"id",
"(",
")",
";",
"// it is unclear if only looking at the id would work here.",
"// other examples in classloading use both id and service.pid to look up so doing the same here.",
"String",
"libraryStatusFilter",
"=",
"String",
".",
"format",
"(",
"\"(&(objectClass=%s)(|(id=%s)(service.pid=%s)))\"",
",",
"Library",
".",
"class",
".",
"getName",
"(",
")",
",",
"libraryRef",
",",
"libraryRef",
")",
";",
"Filter",
"filter",
";",
"try",
"{",
"filter",
"=",
"context",
".",
"createFilter",
"(",
"libraryStatusFilter",
")",
";",
"}",
"catch",
"(",
"InvalidSyntaxException",
"e",
")",
"{",
"// should not happen, but blow up if it does",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"final",
"Set",
"<",
"String",
">",
"serviceNames",
"=",
"getServiceNames",
"(",
"(",
"String",
"[",
"]",
")",
"config",
".",
"get",
"(",
"SERVICE_ATT",
")",
")",
";",
"// create a tracker that will register the services once the library becomes available",
"ServiceTracker",
"<",
"Library",
",",
"List",
"<",
"ServiceRegistration",
"<",
"?",
">",
">",
">",
"newTracker",
"=",
"null",
";",
"newTracker",
"=",
"new",
"ServiceTracker",
"<",
"Library",
",",
"List",
"<",
"ServiceRegistration",
"<",
"?",
">",
">",
">",
"(",
"context",
",",
"filter",
",",
"new",
"ServiceTrackerCustomizer",
"<",
"Library",
",",
"List",
"<",
"ServiceRegistration",
"<",
"?",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"ServiceRegistration",
"<",
"?",
">",
">",
"addingService",
"(",
"ServiceReference",
"<",
"Library",
">",
"libraryRef",
")",
"{",
"Library",
"library",
"=",
"context",
".",
"getService",
"(",
"libraryRef",
")",
";",
"// Got the library now register the services.",
"// The list of registrations is returned so we don't have to store them ourselves.",
"return",
"registerLibraryServices",
"(",
"library",
",",
"serviceNames",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"modifiedService",
"(",
"ServiceReference",
"<",
"Library",
">",
"libraryRef",
",",
"List",
"<",
"ServiceRegistration",
"<",
"?",
">",
">",
"metaInfServices",
")",
"{",
"// don't care",
"}",
"@",
"Override",
"@",
"FFDCIgnore",
"(",
"IllegalStateException",
".",
"class",
")",
"public",
"void",
"removedService",
"(",
"ServiceReference",
"<",
"Library",
">",
"libraryRef",
",",
"List",
"<",
"ServiceRegistration",
"<",
"?",
">",
">",
"metaInfServices",
")",
"{",
"// THe library is going away; need to unregister the services",
"for",
"(",
"ServiceRegistration",
"<",
"?",
">",
"registration",
":",
"metaInfServices",
")",
"{",
"try",
"{",
"registration",
".",
"unregister",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"e",
")",
"{",
"// ignore; already unregistered",
"}",
"}",
"context",
".",
"ungetService",
"(",
"libraryRef",
")",
";",
"}",
"}",
")",
";",
"trackerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"tracker",
"!=",
"null",
")",
"{",
"// close the existing tracker so we unregister existing services",
"tracker",
".",
"close",
"(",
")",
";",
"}",
"// store and open the new tracker so we can register the configured services.",
"tracker",
"=",
"newTracker",
";",
"tracker",
".",
"open",
"(",
")",
";",
"}",
"finally",
"{",
"trackerLock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Configures this bell with a specific library and a possible set of service names
@param context the bundle context
@param executor the executor service
@param config the configuration settings | [
"Configures",
"this",
"bell",
"with",
"a",
"specific",
"library",
"and",
"a",
"possible",
"set",
"of",
"service",
"names"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading.bells/src/com/ibm/ws/classloading/bells/internal/Bell.java#L137-L195 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.org.eclipse.microprofile.openapi.1.0/src/org/eclipse/microprofile/openapi/OASFactory.java | OASFactory.createObject | public static <T extends Constructible> T createObject(Class<T> clazz) {
return OASFactoryResolver.instance().createObject(clazz);
} | java | public static <T extends Constructible> T createObject(Class<T> clazz) {
return OASFactoryResolver.instance().createObject(clazz);
} | [
"public",
"static",
"<",
"T",
"extends",
"Constructible",
">",
"T",
"createObject",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"OASFactoryResolver",
".",
"instance",
"(",
")",
".",
"createObject",
"(",
"clazz",
")",
";",
"}"
] | This method creates a new instance of a constructible element from the OpenAPI model tree.
<br><br>Example:
<pre><code>OASFactory.createObject(Info.class).title("Airlines").description("Airlines APIs").version("1.0.0");
</code></pre>
@param <T> describes the type parameter
@param clazz represents a model which extends the {@link org.eclipse.microprofile.openapi.models.Constructible} interface
@return a new instance of the requested model class
@throws NullPointerException if the specified class is null
@throws IllegalArgumentException if an instance could not be created, most likely, due to an illegal or inappropriate class | [
"This",
"method",
"creates",
"a",
"new",
"instance",
"of",
"a",
"constructible",
"element",
"from",
"the",
"OpenAPI",
"model",
"tree",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.org.eclipse.microprofile.openapi.1.0/src/org/eclipse/microprofile/openapi/OASFactory.java#L48-L50 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/validator/EmbeddedXMLConfigValidator.java | EmbeddedXMLConfigValidator.printErrorMessage | private void printErrorMessage(String key, Object... substitutions) {
Tr.error(tc, key, substitutions);
errorMsgIssued = true;
} | java | private void printErrorMessage(String key, Object... substitutions) {
Tr.error(tc, key, substitutions);
errorMsgIssued = true;
} | [
"private",
"void",
"printErrorMessage",
"(",
"String",
"key",
",",
"Object",
"...",
"substitutions",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"key",
",",
"substitutions",
")",
";",
"errorMsgIssued",
"=",
"true",
";",
"}"
] | Prints the specified error message.
@param key The resource bundle key for the message.
@param substitutions The values to be substituted for the tokens in the
message skeleton. | [
"Prints",
"the",
"specified",
"error",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/validator/EmbeddedXMLConfigValidator.java#L371-L374 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java | ELHelper.evaluateElExpression | @Trivial
protected Object evaluateElExpression(String expression, boolean mask) {
final String methodName = "evaluateElExpression";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask });
}
EvalPrivilegedAction evalPrivilegedAction = new EvalPrivilegedAction(expression, mask);
Object result = AccessController.doPrivileged(evalPrivilegedAction);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, methodName, (result == null) ? null : mask ? OBFUSCATED_STRING : result);
}
return result;
} | java | @Trivial
protected Object evaluateElExpression(String expression, boolean mask) {
final String methodName = "evaluateElExpression";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask });
}
EvalPrivilegedAction evalPrivilegedAction = new EvalPrivilegedAction(expression, mask);
Object result = AccessController.doPrivileged(evalPrivilegedAction);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, methodName, (result == null) ? null : mask ? OBFUSCATED_STRING : result);
}
return result;
} | [
"@",
"Trivial",
"protected",
"Object",
"evaluateElExpression",
"(",
"String",
"expression",
",",
"boolean",
"mask",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"evaluateElExpression\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"methodName",
",",
"new",
"Object",
"[",
"]",
"{",
"(",
"expression",
"==",
"null",
")",
"?",
"null",
":",
"mask",
"?",
"OBFUSCATED_STRING",
":",
"expression",
",",
"mask",
"}",
")",
";",
"}",
"EvalPrivilegedAction",
"evalPrivilegedAction",
"=",
"new",
"EvalPrivilegedAction",
"(",
"expression",
",",
"mask",
")",
";",
"Object",
"result",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"evalPrivilegedAction",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"methodName",
",",
"(",
"result",
"==",
"null",
")",
"?",
"null",
":",
"mask",
"?",
"OBFUSCATED_STRING",
":",
"result",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Evaluate a possible EL expression.
@param expression The expression to evaluate.
@param mask Set whether to mask the expression and result. Useful for when passwords might be
contained in either the expression or the result.
@return The evaluated expression. | [
"Evaluate",
"a",
"possible",
"EL",
"expression",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java#L60-L74 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java | ELHelper.isImmediateExpression | @Trivial
static boolean isImmediateExpression(String expression, boolean mask) {
final String methodName = "isImmediateExpression";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask });
}
boolean result = expression.startsWith("${") && expression.endsWith("}");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, methodName, result);
}
return result;
} | java | @Trivial
static boolean isImmediateExpression(String expression, boolean mask) {
final String methodName = "isImmediateExpression";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask });
}
boolean result = expression.startsWith("${") && expression.endsWith("}");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, methodName, result);
}
return result;
} | [
"@",
"Trivial",
"static",
"boolean",
"isImmediateExpression",
"(",
"String",
"expression",
",",
"boolean",
"mask",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"isImmediateExpression\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"methodName",
",",
"new",
"Object",
"[",
"]",
"{",
"(",
"expression",
"==",
"null",
")",
"?",
"null",
":",
"mask",
"?",
"OBFUSCATED_STRING",
":",
"expression",
",",
"mask",
"}",
")",
";",
"}",
"boolean",
"result",
"=",
"expression",
".",
"startsWith",
"(",
"\"${\"",
")",
"&&",
"expression",
".",
"endsWith",
"(",
"\"}\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"methodName",
",",
"result",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Return whether the expression is an immediate EL expression.
@param expression The expression to evaluate.
@param mask Set whether to mask the expression and result. Useful for when passwords might be
contained in either the expression or the result.
@return True if the expression is an immediate EL expression. | [
"Return",
"whether",
"the",
"expression",
"is",
"an",
"immediate",
"EL",
"expression",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java#L118-L131 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java | ELHelper.removeBrackets | @Trivial
static String removeBrackets(String expression, boolean mask) {
final String methodName = "removeBrackets";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask });
}
expression = expression.trim();
if ((expression.startsWith("${") || expression.startsWith("#{")) && expression.endsWith("}")) {
expression = expression.substring(2, expression.length() - 1);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, methodName, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression);
}
return expression;
} | java | @Trivial
static String removeBrackets(String expression, boolean mask) {
final String methodName = "removeBrackets";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask });
}
expression = expression.trim();
if ((expression.startsWith("${") || expression.startsWith("#{")) && expression.endsWith("}")) {
expression = expression.substring(2, expression.length() - 1);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, methodName, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression);
}
return expression;
} | [
"@",
"Trivial",
"static",
"String",
"removeBrackets",
"(",
"String",
"expression",
",",
"boolean",
"mask",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"removeBrackets\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"methodName",
",",
"new",
"Object",
"[",
"]",
"{",
"(",
"expression",
"==",
"null",
")",
"?",
"null",
":",
"mask",
"?",
"OBFUSCATED_STRING",
":",
"expression",
",",
"mask",
"}",
")",
";",
"}",
"expression",
"=",
"expression",
".",
"trim",
"(",
")",
";",
"if",
"(",
"(",
"expression",
".",
"startsWith",
"(",
"\"${\"",
")",
"||",
"expression",
".",
"startsWith",
"(",
"\"#{\"",
")",
")",
"&&",
"expression",
".",
"endsWith",
"(",
"\"}\"",
")",
")",
"{",
"expression",
"=",
"expression",
".",
"substring",
"(",
"2",
",",
"expression",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"methodName",
",",
"(",
"expression",
"==",
"null",
")",
"?",
"null",
":",
"mask",
"?",
"OBFUSCATED_STRING",
":",
"expression",
")",
";",
"}",
"return",
"expression",
";",
"}"
] | Remove the brackets from an EL expression.
@param expression The expression to remove the brackets from.
@param mask Set whether to mask the expression and result. Useful for when passwords might
be contained in either the expression or the result.
@return The EL expression without the brackets. | [
"Remove",
"the",
"brackets",
"from",
"an",
"EL",
"expression",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java#L459-L475 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java | AbstractResourceInfo.getProxySet | @SuppressWarnings("unchecked")
private ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>> getProxySet() {
Object property = null;
property = bus.getProperty(PROXY_SET);
if (property == null) {
ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>> proxyMap = new ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>>();
bus.setProperty(PROXY_SET, proxyMap);
property = proxyMap;
}
return (ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>>) property;
} | java | @SuppressWarnings("unchecked")
private ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>> getProxySet() {
Object property = null;
property = bus.getProperty(PROXY_SET);
if (property == null) {
ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>> proxyMap = new ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>>();
bus.setProperty(PROXY_SET, proxyMap);
property = proxyMap;
}
return (ThreadLocalProxyCopyOnWriteArraySet<ThreadLocalProxy<?>>) property;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"ThreadLocalProxyCopyOnWriteArraySet",
"<",
"ThreadLocalProxy",
"<",
"?",
">",
">",
"getProxySet",
"(",
")",
"{",
"Object",
"property",
"=",
"null",
";",
"property",
"=",
"bus",
".",
"getProperty",
"(",
"PROXY_SET",
")",
";",
"if",
"(",
"property",
"==",
"null",
")",
"{",
"ThreadLocalProxyCopyOnWriteArraySet",
"<",
"ThreadLocalProxy",
"<",
"?",
">",
">",
"proxyMap",
"=",
"new",
"ThreadLocalProxyCopyOnWriteArraySet",
"<",
"ThreadLocalProxy",
"<",
"?",
">",
">",
"(",
")",
";",
"bus",
".",
"setProperty",
"(",
"PROXY_SET",
",",
"proxyMap",
")",
";",
"property",
"=",
"proxyMap",
";",
"}",
"return",
"(",
"ThreadLocalProxyCopyOnWriteArraySet",
"<",
"ThreadLocalProxy",
"<",
"?",
">",
">",
")",
"property",
";",
"}"
] | Create a CopyOnWriteArraySet to store the ThreadLocalProxy objects for convenience of clearance | [
"Create",
"a",
"CopyOnWriteArraySet",
"to",
"store",
"the",
"ThreadLocalProxy",
"objects",
"for",
"convenience",
"of",
"clearance"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java#L247-L258 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.instrument.serialfilter/src/com/ibm/ws/kernel/instrument/serialfilter/util/CallStackWalker.java | CallStackWalker.skipClasslessStackFrames | private void skipClasslessStackFrames() {
// skip over any stack trace elements that are unmatched in the classes array
if (classes.isEmpty()) return;
while (elements.size() > 0 && !!!elements.peek().getClassName().equals(classes.peek().getName())) {
elements.pop();
}
} | java | private void skipClasslessStackFrames() {
// skip over any stack trace elements that are unmatched in the classes array
if (classes.isEmpty()) return;
while (elements.size() > 0 && !!!elements.peek().getClassName().equals(classes.peek().getName())) {
elements.pop();
}
} | [
"private",
"void",
"skipClasslessStackFrames",
"(",
")",
"{",
"// skip over any stack trace elements that are unmatched in the classes array",
"if",
"(",
"classes",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"while",
"(",
"elements",
".",
"size",
"(",
")",
">",
"0",
"&&",
"!",
"!",
"!",
"elements",
".",
"peek",
"(",
")",
".",
"getClassName",
"(",
")",
".",
"equals",
"(",
"classes",
".",
"peek",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
"{",
"elements",
".",
"pop",
"(",
")",
";",
"}",
"}"
] | Call after any advancement to bring this.elements into line with this.classes. | [
"Call",
"after",
"any",
"advancement",
"to",
"bring",
"this",
".",
"elements",
"into",
"line",
"with",
"this",
".",
"classes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.instrument.serialfilter/src/com/ibm/ws/kernel/instrument/serialfilter/util/CallStackWalker.java#L51-L57 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/logging/hpel/LogRecordContext.java | LogRecordContext.unregisterExtension | public static boolean unregisterExtension(String key) {
if (key == null) {
throw new IllegalArgumentException(
"Parameter 'key' can not be null");
}
w.lock();
try {
return extensionMap.remove(key) != null;
} finally {
w.unlock();
}
} | java | public static boolean unregisterExtension(String key) {
if (key == null) {
throw new IllegalArgumentException(
"Parameter 'key' can not be null");
}
w.lock();
try {
return extensionMap.remove(key) != null;
} finally {
w.unlock();
}
} | [
"public",
"static",
"boolean",
"unregisterExtension",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter 'key' can not be null\"",
")",
";",
"}",
"w",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"extensionMap",
".",
"remove",
"(",
"key",
")",
"!=",
"null",
";",
"}",
"finally",
"{",
"w",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Removes context extension registration.
@param key
String key associated with the registered extension.
@return <code>true</code> if key had extension associated with it.
@throws IllegalArgumentException
if parameter <code>key</code> is <code>null</code>. | [
"Removes",
"context",
"extension",
"registration",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/logging/hpel/LogRecordContext.java#L267-L278 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/logging/hpel/LogRecordContext.java | LogRecordContext.getExtensions | public static void getExtensions(Map<String, String> map)
throws IllegalArgumentException {
if (map == null) {
throw new IllegalArgumentException(
"Parameter 'map' can not be null.");
}
if (recursion.get() == Boolean.TRUE) {
return;
}
recursion.set(Boolean.TRUE);
LinkedList<String> cleanup = new LinkedList<String>();
r.lock();
try {
for (Map.Entry<String, WeakReference<Extension>> entry : extensionMap
.entrySet()) {
Extension extension = entry.getValue().get();
if (extension == null) {
cleanup.add(entry.getKey());
} else {
String value = extension.getValue();
if (value != null) {
map.put(entry.getKey(), value);
}
}
}
} finally {
r.unlock();
recursion.remove();
}
if (cleanup.size() > 0) {
w.lock();
try {
for (String key : cleanup) {
WeakReference<Extension> extension = extensionMap
.remove(key);
if (extension != null && extension.get() != null) {
// Special case! Somebody has put new extension for this
// key after we released
// read lock and before we took write lock. We need to
// put it back.
extensionMap.put(key, extension);
}
}
} finally {
w.unlock();
}
}
if (extensions.get() != null) {
for (Entry<String, String> entry : extensions.get().entrySet()) {
map.put(entry.getKey(), entry.getValue());
}
}
} | java | public static void getExtensions(Map<String, String> map)
throws IllegalArgumentException {
if (map == null) {
throw new IllegalArgumentException(
"Parameter 'map' can not be null.");
}
if (recursion.get() == Boolean.TRUE) {
return;
}
recursion.set(Boolean.TRUE);
LinkedList<String> cleanup = new LinkedList<String>();
r.lock();
try {
for (Map.Entry<String, WeakReference<Extension>> entry : extensionMap
.entrySet()) {
Extension extension = entry.getValue().get();
if (extension == null) {
cleanup.add(entry.getKey());
} else {
String value = extension.getValue();
if (value != null) {
map.put(entry.getKey(), value);
}
}
}
} finally {
r.unlock();
recursion.remove();
}
if (cleanup.size() > 0) {
w.lock();
try {
for (String key : cleanup) {
WeakReference<Extension> extension = extensionMap
.remove(key);
if (extension != null && extension.get() != null) {
// Special case! Somebody has put new extension for this
// key after we released
// read lock and before we took write lock. We need to
// put it back.
extensionMap.put(key, extension);
}
}
} finally {
w.unlock();
}
}
if (extensions.get() != null) {
for (Entry<String, String> entry : extensions.get().entrySet()) {
map.put(entry.getKey(), entry.getValue());
}
}
} | [
"public",
"static",
"void",
"getExtensions",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter 'map' can not be null.\"",
")",
";",
"}",
"if",
"(",
"recursion",
".",
"get",
"(",
")",
"==",
"Boolean",
".",
"TRUE",
")",
"{",
"return",
";",
"}",
"recursion",
".",
"set",
"(",
"Boolean",
".",
"TRUE",
")",
";",
"LinkedList",
"<",
"String",
">",
"cleanup",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"r",
".",
"lock",
"(",
")",
";",
"try",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"WeakReference",
"<",
"Extension",
">",
">",
"entry",
":",
"extensionMap",
".",
"entrySet",
"(",
")",
")",
"{",
"Extension",
"extension",
"=",
"entry",
".",
"getValue",
"(",
")",
".",
"get",
"(",
")",
";",
"if",
"(",
"extension",
"==",
"null",
")",
"{",
"cleanup",
".",
"add",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"else",
"{",
"String",
"value",
"=",
"extension",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"map",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"value",
")",
";",
"}",
"}",
"}",
"}",
"finally",
"{",
"r",
".",
"unlock",
"(",
")",
";",
"recursion",
".",
"remove",
"(",
")",
";",
"}",
"if",
"(",
"cleanup",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"w",
".",
"lock",
"(",
")",
";",
"try",
"{",
"for",
"(",
"String",
"key",
":",
"cleanup",
")",
"{",
"WeakReference",
"<",
"Extension",
">",
"extension",
"=",
"extensionMap",
".",
"remove",
"(",
"key",
")",
";",
"if",
"(",
"extension",
"!=",
"null",
"&&",
"extension",
".",
"get",
"(",
")",
"!=",
"null",
")",
"{",
"// Special case! Somebody has put new extension for this",
"// key after we released",
"// read lock and before we took write lock. We need to",
"// put it back.",
"extensionMap",
".",
"put",
"(",
"key",
",",
"extension",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"w",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"if",
"(",
"extensions",
".",
"get",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"extensions",
".",
"get",
"(",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"map",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Retrieves values for all registered context extensions.
@param map
{@link Map} instance to populate with key-value pairs of the
context extensions.
@throws IllegalArgumentException
if parameter <code>map</code> is <code>null</code> | [
"Retrieves",
"values",
"for",
"all",
"registered",
"context",
"extensions",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/logging/hpel/LogRecordContext.java#L289-L342 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/AbstractJPAProviderIntegration.java | AbstractJPAProviderIntegration.logProviderInfo | @FFDCIgnore(Exception.class)
private void logProviderInfo(String providerName, ClassLoader loader) {
try {
if (PROVIDER_ECLIPSELINK.equals(providerName)) {
// org.eclipse.persistence.Version.getVersion(): 2.6.4.v20160829-44060b6
Class<?> Version = loadClass(loader, "org.eclipse.persistence.Version");
String version = (String) Version.getMethod("getVersionString").invoke(Version.newInstance());
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "EclipseLink", version);
} else if (PROVIDER_HIBERNATE.equals(providerName)) {
// org.hibernate.Version.getVersionString(): 5.2.6.Final
Class<?> Version = loadClass(loader, "org.hibernate.Version");
String version = (String) Version.getMethod("getVersionString").invoke(null);
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "Hibernate", version);
} else if (PROVIDER_OPENJPA.equals(providerName)) {
// OpenJPAVersion.appendOpenJPABanner(sb): OpenJPA #.#.#\n version id: openjpa-#.#.#-r# \n Apache svn revision: #
StringBuilder version = new StringBuilder();
Class<?> OpenJPAVersion = loadClass(loader, "org.apache.openjpa.conf.OpenJPAVersion");
OpenJPAVersion.getMethod("appendOpenJPABanner", StringBuilder.class).invoke(OpenJPAVersion.newInstance(), version);
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "OpenJPA", version);
} else {
Tr.info(tc, "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I", providerName);
}
} catch (Exception x) {
Tr.info(tc, "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I", providerName);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "unable to determine provider info", x);
}
} | java | @FFDCIgnore(Exception.class)
private void logProviderInfo(String providerName, ClassLoader loader) {
try {
if (PROVIDER_ECLIPSELINK.equals(providerName)) {
// org.eclipse.persistence.Version.getVersion(): 2.6.4.v20160829-44060b6
Class<?> Version = loadClass(loader, "org.eclipse.persistence.Version");
String version = (String) Version.getMethod("getVersionString").invoke(Version.newInstance());
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "EclipseLink", version);
} else if (PROVIDER_HIBERNATE.equals(providerName)) {
// org.hibernate.Version.getVersionString(): 5.2.6.Final
Class<?> Version = loadClass(loader, "org.hibernate.Version");
String version = (String) Version.getMethod("getVersionString").invoke(null);
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "Hibernate", version);
} else if (PROVIDER_OPENJPA.equals(providerName)) {
// OpenJPAVersion.appendOpenJPABanner(sb): OpenJPA #.#.#\n version id: openjpa-#.#.#-r# \n Apache svn revision: #
StringBuilder version = new StringBuilder();
Class<?> OpenJPAVersion = loadClass(loader, "org.apache.openjpa.conf.OpenJPAVersion");
OpenJPAVersion.getMethod("appendOpenJPABanner", StringBuilder.class).invoke(OpenJPAVersion.newInstance(), version);
Tr.info(tc, "JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I", "OpenJPA", version);
} else {
Tr.info(tc, "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I", providerName);
}
} catch (Exception x) {
Tr.info(tc, "JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I", providerName);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "unable to determine provider info", x);
}
} | [
"@",
"FFDCIgnore",
"(",
"Exception",
".",
"class",
")",
"private",
"void",
"logProviderInfo",
"(",
"String",
"providerName",
",",
"ClassLoader",
"loader",
")",
"{",
"try",
"{",
"if",
"(",
"PROVIDER_ECLIPSELINK",
".",
"equals",
"(",
"providerName",
")",
")",
"{",
"// org.eclipse.persistence.Version.getVersion(): 2.6.4.v20160829-44060b6",
"Class",
"<",
"?",
">",
"Version",
"=",
"loadClass",
"(",
"loader",
",",
"\"org.eclipse.persistence.Version\"",
")",
";",
"String",
"version",
"=",
"(",
"String",
")",
"Version",
".",
"getMethod",
"(",
"\"getVersionString\"",
")",
".",
"invoke",
"(",
"Version",
".",
"newInstance",
"(",
")",
")",
";",
"Tr",
".",
"info",
"(",
"tc",
",",
"\"JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I\"",
",",
"\"EclipseLink\"",
",",
"version",
")",
";",
"}",
"else",
"if",
"(",
"PROVIDER_HIBERNATE",
".",
"equals",
"(",
"providerName",
")",
")",
"{",
"// org.hibernate.Version.getVersionString(): 5.2.6.Final",
"Class",
"<",
"?",
">",
"Version",
"=",
"loadClass",
"(",
"loader",
",",
"\"org.hibernate.Version\"",
")",
";",
"String",
"version",
"=",
"(",
"String",
")",
"Version",
".",
"getMethod",
"(",
"\"getVersionString\"",
")",
".",
"invoke",
"(",
"null",
")",
";",
"Tr",
".",
"info",
"(",
"tc",
",",
"\"JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I\"",
",",
"\"Hibernate\"",
",",
"version",
")",
";",
"}",
"else",
"if",
"(",
"PROVIDER_OPENJPA",
".",
"equals",
"(",
"providerName",
")",
")",
"{",
"// OpenJPAVersion.appendOpenJPABanner(sb): OpenJPA #.#.#\\n version id: openjpa-#.#.#-r# \\n Apache svn revision: #",
"StringBuilder",
"version",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Class",
"<",
"?",
">",
"OpenJPAVersion",
"=",
"loadClass",
"(",
"loader",
",",
"\"org.apache.openjpa.conf.OpenJPAVersion\"",
")",
";",
"OpenJPAVersion",
".",
"getMethod",
"(",
"\"appendOpenJPABanner\"",
",",
"StringBuilder",
".",
"class",
")",
".",
"invoke",
"(",
"OpenJPAVersion",
".",
"newInstance",
"(",
")",
",",
"version",
")",
";",
"Tr",
".",
"info",
"(",
"tc",
",",
"\"JPA_THIRD_PARTY_PROV_INFO_CWWJP0053I\"",
",",
"\"OpenJPA\"",
",",
"version",
")",
";",
"}",
"else",
"{",
"Tr",
".",
"info",
"(",
"tc",
",",
"\"JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I\"",
",",
"providerName",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"x",
")",
"{",
"Tr",
".",
"info",
"(",
"tc",
",",
"\"JPA_THIRD_PARTY_PROV_NAME_CWWJP0052I\"",
",",
"providerName",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"unable to determine provider info\"",
",",
"x",
")",
";",
"}",
"}"
] | Log version information about the specified persistence provider, if it can be determined.
@param providerName fully qualified class name of JPA persistence provider
@param loader class loader with access to the JPA provider classes | [
"Log",
"version",
"information",
"about",
"the",
"specified",
"persistence",
"provider",
"if",
"it",
"can",
"be",
"determined",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/AbstractJPAProviderIntegration.java#L68-L95 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/ProvisionerImpl.java | ProvisionerImpl.checkStartStatus | protected void checkStartStatus(BundleStartStatus startStatus) throws InvalidBundleContextException {
final String m = "checkInstallStatus";
if (startStatus.startExceptions()) {
Map<Bundle, Throwable> startExceptions = startStatus.getStartExceptions();
for (Entry<Bundle, Throwable> entry : startExceptions.entrySet()) {
Bundle b = entry.getKey();
FFDCFilter.processException(entry.getValue(), ME, m, this,
new Object[] { b.getLocation() });
}
throw new LaunchException("Exceptions occurred while starting platform bundles", BootstrapConstants.messages.getString("error.platformBundleException"));
}
if (!startStatus.contextIsValid())
throw new InvalidBundleContextException();
} | java | protected void checkStartStatus(BundleStartStatus startStatus) throws InvalidBundleContextException {
final String m = "checkInstallStatus";
if (startStatus.startExceptions()) {
Map<Bundle, Throwable> startExceptions = startStatus.getStartExceptions();
for (Entry<Bundle, Throwable> entry : startExceptions.entrySet()) {
Bundle b = entry.getKey();
FFDCFilter.processException(entry.getValue(), ME, m, this,
new Object[] { b.getLocation() });
}
throw new LaunchException("Exceptions occurred while starting platform bundles", BootstrapConstants.messages.getString("error.platformBundleException"));
}
if (!startStatus.contextIsValid())
throw new InvalidBundleContextException();
} | [
"protected",
"void",
"checkStartStatus",
"(",
"BundleStartStatus",
"startStatus",
")",
"throws",
"InvalidBundleContextException",
"{",
"final",
"String",
"m",
"=",
"\"checkInstallStatus\"",
";",
"if",
"(",
"startStatus",
".",
"startExceptions",
"(",
")",
")",
"{",
"Map",
"<",
"Bundle",
",",
"Throwable",
">",
"startExceptions",
"=",
"startStatus",
".",
"getStartExceptions",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"Bundle",
",",
"Throwable",
">",
"entry",
":",
"startExceptions",
".",
"entrySet",
"(",
")",
")",
"{",
"Bundle",
"b",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"entry",
".",
"getValue",
"(",
")",
",",
"ME",
",",
"m",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"b",
".",
"getLocation",
"(",
")",
"}",
")",
";",
"}",
"throw",
"new",
"LaunchException",
"(",
"\"Exceptions occurred while starting platform bundles\"",
",",
"BootstrapConstants",
".",
"messages",
".",
"getString",
"(",
"\"error.platformBundleException\"",
")",
")",
";",
"}",
"if",
"(",
"!",
"startStatus",
".",
"contextIsValid",
"(",
")",
")",
"throw",
"new",
"InvalidBundleContextException",
"(",
")",
";",
"}"
] | Check the passed in start status for exceptions starting bundles, and
issue appropriate diagnostics & messages for this environment.
@param startStatus
@throws InvalidBundleContextException | [
"Check",
"the",
"passed",
"in",
"start",
"status",
"for",
"exceptions",
"starting",
"bundles",
"and",
"issue",
"appropriate",
"diagnostics",
"&",
"messages",
"for",
"this",
"environment",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/ProvisionerImpl.java#L139-L154 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/ProvisionerImpl.java | ProvisionerImpl.installBundles | protected BundleInstallStatus installBundles(BootstrapConfig config) throws InvalidBundleContextException {
BundleInstallStatus installStatus = new BundleInstallStatus();
KernelResolver resolver = config.getKernelResolver();
ContentBasedLocalBundleRepository repo = BundleRepositoryRegistry.getInstallBundleRepository();
List<KernelBundleElement> bundleList = resolver.getKernelBundles();
if (bundleList == null || bundleList.size() <= 0)
return installStatus;
boolean libertyBoot = Boolean.parseBoolean(config.get(BootstrapConstants.LIBERTY_BOOT_PROPERTY));
for (final KernelBundleElement element : bundleList) {
if (libertyBoot) {
// For boot bundles the LibertyBootRuntime must be used to install the bundles
installLibertBootBundle(element, installStatus);
} else {
installKernelBundle(element, installStatus, repo);
}
}
return installStatus;
} | java | protected BundleInstallStatus installBundles(BootstrapConfig config) throws InvalidBundleContextException {
BundleInstallStatus installStatus = new BundleInstallStatus();
KernelResolver resolver = config.getKernelResolver();
ContentBasedLocalBundleRepository repo = BundleRepositoryRegistry.getInstallBundleRepository();
List<KernelBundleElement> bundleList = resolver.getKernelBundles();
if (bundleList == null || bundleList.size() <= 0)
return installStatus;
boolean libertyBoot = Boolean.parseBoolean(config.get(BootstrapConstants.LIBERTY_BOOT_PROPERTY));
for (final KernelBundleElement element : bundleList) {
if (libertyBoot) {
// For boot bundles the LibertyBootRuntime must be used to install the bundles
installLibertBootBundle(element, installStatus);
} else {
installKernelBundle(element, installStatus, repo);
}
}
return installStatus;
} | [
"protected",
"BundleInstallStatus",
"installBundles",
"(",
"BootstrapConfig",
"config",
")",
"throws",
"InvalidBundleContextException",
"{",
"BundleInstallStatus",
"installStatus",
"=",
"new",
"BundleInstallStatus",
"(",
")",
";",
"KernelResolver",
"resolver",
"=",
"config",
".",
"getKernelResolver",
"(",
")",
";",
"ContentBasedLocalBundleRepository",
"repo",
"=",
"BundleRepositoryRegistry",
".",
"getInstallBundleRepository",
"(",
")",
";",
"List",
"<",
"KernelBundleElement",
">",
"bundleList",
"=",
"resolver",
".",
"getKernelBundles",
"(",
")",
";",
"if",
"(",
"bundleList",
"==",
"null",
"||",
"bundleList",
".",
"size",
"(",
")",
"<=",
"0",
")",
"return",
"installStatus",
";",
"boolean",
"libertyBoot",
"=",
"Boolean",
".",
"parseBoolean",
"(",
"config",
".",
"get",
"(",
"BootstrapConstants",
".",
"LIBERTY_BOOT_PROPERTY",
")",
")",
";",
"for",
"(",
"final",
"KernelBundleElement",
"element",
":",
"bundleList",
")",
"{",
"if",
"(",
"libertyBoot",
")",
"{",
"// For boot bundles the LibertyBootRuntime must be used to install the bundles",
"installLibertBootBundle",
"(",
"element",
",",
"installStatus",
")",
";",
"}",
"else",
"{",
"installKernelBundle",
"(",
"element",
",",
"installStatus",
",",
"repo",
")",
";",
"}",
"}",
"return",
"installStatus",
";",
"}"
] | Install framework bundles.
@param bundleList
Properties describing the bundles to install
@oaran config
Bootstrap configuration containing information about
initial configuration parameters and file locations
@return BundleInstallStatus containing details about the bundles
installed, exceptions that occurred, bundles that couldn't be
found, etc. | [
"Install",
"framework",
"bundles",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/ProvisionerImpl.java#L220-L241 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/dispatcher/SpillDispatcher.java | SpillDispatcher.isHealthy | public synchronized boolean isHealthy()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isHealthy");
boolean retval = _running && !_stopRequested && (_threadWriteErrorsOutstanding == 0);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isHealthy", Boolean.valueOf(retval));
return retval;
} | java | public synchronized boolean isHealthy()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isHealthy");
boolean retval = _running && !_stopRequested && (_threadWriteErrorsOutstanding == 0);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isHealthy", Boolean.valueOf(retval));
return retval;
} | [
"public",
"synchronized",
"boolean",
"isHealthy",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"isHealthy\"",
")",
";",
"boolean",
"retval",
"=",
"_running",
"&&",
"!",
"_stopRequested",
"&&",
"(",
"_threadWriteErrorsOutstanding",
"==",
"0",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"isHealthy\"",
",",
"Boolean",
".",
"valueOf",
"(",
"retval",
")",
")",
";",
"return",
"retval",
";",
"}"
] | Used as a quick way to check the health of a dispatcher before giving it work
in situations in which the work cannot be rejected. For example, for a transaction
which requires both synchronous and asynchronous persistence, once we've done the
synchronous persistence, a transient persistence problem from a dispatcher will
not be reported from the dispatching method because we cannot guarantee to roll back the
synchronous work.
@return <tt>true</tt> if the dispatcher is experiencing no problems, else <tt>false</tt> | [
"Used",
"as",
"a",
"quick",
"way",
"to",
"check",
"the",
"health",
"of",
"a",
"dispatcher",
"before",
"giving",
"it",
"work",
"in",
"situations",
"in",
"which",
"the",
"work",
"cannot",
"be",
"rejected",
".",
"For",
"example",
"for",
"a",
"transaction",
"which",
"requires",
"both",
"synchronous",
"and",
"asynchronous",
"persistence",
"once",
"we",
"ve",
"done",
"the",
"synchronous",
"persistence",
"a",
"transient",
"persistence",
"problem",
"from",
"a",
"dispatcher",
"will",
"not",
"be",
"reported",
"from",
"the",
"dispatching",
"method",
"because",
"we",
"cannot",
"guarantee",
"to",
"roll",
"back",
"the",
"synchronous",
"work",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/dispatcher/SpillDispatcher.java#L177-L185 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/file/AuditFileHandler.java | AuditFileHandler.getLogDir | private String getLogDir() {
StringBuffer output = new StringBuffer();
WsLocationAdmin locationAdmin = locationAdminRef.getService();
output.append(locationAdmin.resolveString("${server.output.dir}").replace('\\', '/')).append("/logs");
return output.toString();
} | java | private String getLogDir() {
StringBuffer output = new StringBuffer();
WsLocationAdmin locationAdmin = locationAdminRef.getService();
output.append(locationAdmin.resolveString("${server.output.dir}").replace('\\', '/')).append("/logs");
return output.toString();
} | [
"private",
"String",
"getLogDir",
"(",
")",
"{",
"StringBuffer",
"output",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"WsLocationAdmin",
"locationAdmin",
"=",
"locationAdminRef",
".",
"getService",
"(",
")",
";",
"output",
".",
"append",
"(",
"locationAdmin",
".",
"resolveString",
"(",
"\"${server.output.dir}\"",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
")",
".",
"append",
"(",
"\"/logs\"",
")",
";",
"return",
"output",
".",
"toString",
"(",
")",
";",
"}"
] | Get the default directory for logs
@return full path String of logs directory | [
"Get",
"the",
"default",
"directory",
"for",
"logs"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/file/AuditFileHandler.java#L380-L385 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/file/AuditFileHandler.java | AuditFileHandler.mapToJSONString | private String mapToJSONString(Map<String, Object> eventMap) {
JSONObject jsonEvent = new JSONObject();
String jsonString = null;
map2JSON(jsonEvent, eventMap);
try {
if (!compact) {
jsonString = jsonEvent.serialize(true).replaceAll("\\\\/", "/");
} else {
jsonString = jsonEvent.toString();
}
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unexpected error converting AuditEvent to JSON String", e);
}
}
return jsonString;
} | java | private String mapToJSONString(Map<String, Object> eventMap) {
JSONObject jsonEvent = new JSONObject();
String jsonString = null;
map2JSON(jsonEvent, eventMap);
try {
if (!compact) {
jsonString = jsonEvent.serialize(true).replaceAll("\\\\/", "/");
} else {
jsonString = jsonEvent.toString();
}
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unexpected error converting AuditEvent to JSON String", e);
}
}
return jsonString;
} | [
"private",
"String",
"mapToJSONString",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"eventMap",
")",
"{",
"JSONObject",
"jsonEvent",
"=",
"new",
"JSONObject",
"(",
")",
";",
"String",
"jsonString",
"=",
"null",
";",
"map2JSON",
"(",
"jsonEvent",
",",
"eventMap",
")",
";",
"try",
"{",
"if",
"(",
"!",
"compact",
")",
"{",
"jsonString",
"=",
"jsonEvent",
".",
"serialize",
"(",
"true",
")",
".",
"replaceAll",
"(",
"\"\\\\\\\\/\"",
",",
"\"/\"",
")",
";",
"}",
"else",
"{",
"jsonString",
"=",
"jsonEvent",
".",
"toString",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Unexpected error converting AuditEvent to JSON String\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"jsonString",
";",
"}"
] | Produce a JSON String for the given audit event
@return | [
"Produce",
"a",
"JSON",
"String",
"for",
"the",
"given",
"audit",
"event"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/file/AuditFileHandler.java#L392-L408 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/file/AuditFileHandler.java | AuditFileHandler.array2JSON | private JSONArray array2JSON(JSONArray ja, Object[] array) {
for (int i = 0; i < array.length; i++) {
// array entry is a Map
if (array[i] instanceof Map) {
//if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "array entry is a Map, calling map2JSON", array[i]);
//}
ja.add(map2JSON(new JSONObject(), (Map<String, Object>) array[i]));
}
// array entry is an array
else if (array[i].getClass().isArray()) {
//if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "array entry is a array, calling array2JSON", array[i]);
//}
ja.add(array2JSON(new JSONArray(), (Object[]) array[i]));
}
// else array entry is a "simple" value
else {
//if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "array entry is a simple value, adding to ja", array[i]);
//}
ja.add(array[i]);
}
}
return ja;
} | java | private JSONArray array2JSON(JSONArray ja, Object[] array) {
for (int i = 0; i < array.length; i++) {
// array entry is a Map
if (array[i] instanceof Map) {
//if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "array entry is a Map, calling map2JSON", array[i]);
//}
ja.add(map2JSON(new JSONObject(), (Map<String, Object>) array[i]));
}
// array entry is an array
else if (array[i].getClass().isArray()) {
//if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "array entry is a array, calling array2JSON", array[i]);
//}
ja.add(array2JSON(new JSONArray(), (Object[]) array[i]));
}
// else array entry is a "simple" value
else {
//if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "array entry is a simple value, adding to ja", array[i]);
//}
ja.add(array[i]);
}
}
return ja;
} | [
"private",
"JSONArray",
"array2JSON",
"(",
"JSONArray",
"ja",
",",
"Object",
"[",
"]",
"array",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"// array entry is a Map",
"if",
"(",
"array",
"[",
"i",
"]",
"instanceof",
"Map",
")",
"{",
"//if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {",
"// Tr.debug(tc, \"array entry is a Map, calling map2JSON\", array[i]);",
"//}",
"ja",
".",
"add",
"(",
"map2JSON",
"(",
"new",
"JSONObject",
"(",
")",
",",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"array",
"[",
"i",
"]",
")",
")",
";",
"}",
"// array entry is an array",
"else",
"if",
"(",
"array",
"[",
"i",
"]",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"//if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {",
"// Tr.debug(tc, \"array entry is a array, calling array2JSON\", array[i]);",
"//}",
"ja",
".",
"add",
"(",
"array2JSON",
"(",
"new",
"JSONArray",
"(",
")",
",",
"(",
"Object",
"[",
"]",
")",
"array",
"[",
"i",
"]",
")",
")",
";",
"}",
"// else array entry is a \"simple\" value",
"else",
"{",
"//if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {",
"// Tr.debug(tc, \"array entry is a simple value, adding to ja\", array[i]);",
"//}",
"ja",
".",
"add",
"(",
"array",
"[",
"i",
"]",
")",
";",
"}",
"}",
"return",
"ja",
";",
"}"
] | Given a Java array, add the corresponding JSON to the given JSONArray object
@param ja - JSONArray object
@param array - Java array object | [
"Given",
"a",
"Java",
"array",
"add",
"the",
"corresponding",
"JSON",
"to",
"the",
"given",
"JSONArray",
"object"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/file/AuditFileHandler.java#L482-L507 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/servers/ServerBootstrapUtils.java | ServerBootstrapUtils.writeBootstrapProperty | public void writeBootstrapProperty(LibertyServer server, String propKey, String propValue) throws Exception {
String bootProps = getBootstrapPropertiesFilePath(server);
appendBootstrapPropertyToFile(bootProps, propKey, propValue);
} | java | public void writeBootstrapProperty(LibertyServer server, String propKey, String propValue) throws Exception {
String bootProps = getBootstrapPropertiesFilePath(server);
appendBootstrapPropertyToFile(bootProps, propKey, propValue);
} | [
"public",
"void",
"writeBootstrapProperty",
"(",
"LibertyServer",
"server",
",",
"String",
"propKey",
",",
"String",
"propValue",
")",
"throws",
"Exception",
"{",
"String",
"bootProps",
"=",
"getBootstrapPropertiesFilePath",
"(",
"server",
")",
";",
"appendBootstrapPropertyToFile",
"(",
"bootProps",
",",
"propKey",
",",
"propValue",
")",
";",
"}"
] | Writes the specified bootstrap property and value to the provided server's bootstrap.properties file. | [
"Writes",
"the",
"specified",
"bootstrap",
"property",
"and",
"value",
"to",
"the",
"provided",
"server",
"s",
"bootstrap",
".",
"properties",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/servers/ServerBootstrapUtils.java#L21-L24 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/servers/ServerBootstrapUtils.java | ServerBootstrapUtils.writeBootstrapProperties | public void writeBootstrapProperties(LibertyServer server, Map<String, String> miscParms) throws Exception {
String thisMethod = "writeBootstrapProperties";
loggingUtils.printMethodName(thisMethod);
if (miscParms == null) {
return;
}
String bootPropFilePath = getBootstrapPropertiesFilePath(server);
for (Map.Entry<String, String> entry : miscParms.entrySet()) {
appendBootstrapPropertyToFile(bootPropFilePath, entry.getKey(), entry.getValue());
}
} | java | public void writeBootstrapProperties(LibertyServer server, Map<String, String> miscParms) throws Exception {
String thisMethod = "writeBootstrapProperties";
loggingUtils.printMethodName(thisMethod);
if (miscParms == null) {
return;
}
String bootPropFilePath = getBootstrapPropertiesFilePath(server);
for (Map.Entry<String, String> entry : miscParms.entrySet()) {
appendBootstrapPropertyToFile(bootPropFilePath, entry.getKey(), entry.getValue());
}
} | [
"public",
"void",
"writeBootstrapProperties",
"(",
"LibertyServer",
"server",
",",
"Map",
"<",
"String",
",",
"String",
">",
"miscParms",
")",
"throws",
"Exception",
"{",
"String",
"thisMethod",
"=",
"\"writeBootstrapProperties\"",
";",
"loggingUtils",
".",
"printMethodName",
"(",
"thisMethod",
")",
";",
"if",
"(",
"miscParms",
"==",
"null",
")",
"{",
"return",
";",
"}",
"String",
"bootPropFilePath",
"=",
"getBootstrapPropertiesFilePath",
"(",
"server",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"miscParms",
".",
"entrySet",
"(",
")",
")",
"{",
"appendBootstrapPropertyToFile",
"(",
"bootPropFilePath",
",",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] | Writes each of the specified bootstrap properties and values to the provided server's bootstrap.properties file. | [
"Writes",
"each",
"of",
"the",
"specified",
"bootstrap",
"properties",
"and",
"values",
"to",
"the",
"provided",
"server",
"s",
"bootstrap",
".",
"properties",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/servers/ServerBootstrapUtils.java#L29-L40 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/jta/embeddable/impl/WSATRecoveryCoordinator.java | WSATRecoveryCoordinator.fromLogData | public static WSATRecoveryCoordinator fromLogData(byte[] bytes) throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "fromLogData", bytes);
WSATRecoveryCoordinator wsatRC = null;
final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
try {
final ObjectInputStream ois = new ObjectInputStream(bais);
final Object obj = ois.readObject();
wsatRC = (WSATRecoveryCoordinator) obj;
} catch (Throwable e) {
FFDCFilter.processException(e, "com.ibm.ws.Transaction.wstx.WSATRecoveryCoordinator.fromLogData", "67");
final Throwable se = new SystemException().initCause(e);
if (tc.isEntryEnabled())
Tr.exit(tc, "fromLogData", se);
throw (SystemException) se;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "fromLogData", wsatRC);
return wsatRC;
} | java | public static WSATRecoveryCoordinator fromLogData(byte[] bytes) throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "fromLogData", bytes);
WSATRecoveryCoordinator wsatRC = null;
final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
try {
final ObjectInputStream ois = new ObjectInputStream(bais);
final Object obj = ois.readObject();
wsatRC = (WSATRecoveryCoordinator) obj;
} catch (Throwable e) {
FFDCFilter.processException(e, "com.ibm.ws.Transaction.wstx.WSATRecoveryCoordinator.fromLogData", "67");
final Throwable se = new SystemException().initCause(e);
if (tc.isEntryEnabled())
Tr.exit(tc, "fromLogData", se);
throw (SystemException) se;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "fromLogData", wsatRC);
return wsatRC;
} | [
"public",
"static",
"WSATRecoveryCoordinator",
"fromLogData",
"(",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"SystemException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"fromLogData\"",
",",
"bytes",
")",
";",
"WSATRecoveryCoordinator",
"wsatRC",
"=",
"null",
";",
"final",
"ByteArrayInputStream",
"bais",
"=",
"new",
"ByteArrayInputStream",
"(",
"bytes",
")",
";",
"try",
"{",
"final",
"ObjectInputStream",
"ois",
"=",
"new",
"ObjectInputStream",
"(",
"bais",
")",
";",
"final",
"Object",
"obj",
"=",
"ois",
".",
"readObject",
"(",
")",
";",
"wsatRC",
"=",
"(",
"WSATRecoveryCoordinator",
")",
"obj",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.Transaction.wstx.WSATRecoveryCoordinator.fromLogData\"",
",",
"\"67\"",
")",
";",
"final",
"Throwable",
"se",
"=",
"new",
"SystemException",
"(",
")",
".",
"initCause",
"(",
"e",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"fromLogData\"",
",",
"se",
")",
";",
"throw",
"(",
"SystemException",
")",
"se",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"fromLogData\"",
",",
"wsatRC",
")",
";",
"return",
"wsatRC",
";",
"}"
] | As called after recovery on distributed platform | [
"As",
"called",
"after",
"recovery",
"on",
"distributed",
"platform"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/jta/embeddable/impl/WSATRecoveryCoordinator.java#L60-L82 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/jaxrs2/DefaultParameterExtension.java | DefaultParameterExtension.handleAdditionalAnnotation | private boolean handleAdditionalAnnotation(List<Parameter> parameters, Annotation annotation,
final Type type, Set<Type> typesToSkip, javax.ws.rs.Consumes classConsumes,
javax.ws.rs.Consumes methodConsumes, Components components, boolean includeRequestBody) {
boolean processed = false;
if (BeanParam.class.isAssignableFrom(annotation.getClass())) {
// Use Jackson's logic for processing Beans
final BeanDescription beanDesc = mapper.getSerializationConfig().introspect(constructType(type));
final List<BeanPropertyDefinition> properties = beanDesc.findProperties();
for (final BeanPropertyDefinition propDef : properties) {
final AnnotatedField field = propDef.getField();
final AnnotatedMethod setter = propDef.getSetter();
final AnnotatedMethod getter = propDef.getGetter();
final List<Annotation> paramAnnotations = new ArrayList<Annotation>();
final Iterator<OpenAPIExtension> extensions = OpenAPIExtensions.chain();
Type paramType = null;
// Gather the field's details
if (field != null) {
paramType = field.getType();
for (final Annotation fieldAnnotation : field.annotations()) {
if (!paramAnnotations.contains(fieldAnnotation)) {
paramAnnotations.add(fieldAnnotation);
}
}
}
// Gather the setter's details but only the ones we need
if (setter != null) {
// Do not set the param class/type from the setter if the values are already identified
if (paramType == null) {
// paramType will stay null if there is no parameter
paramType = setter.getParameterType(0);
}
for (final Annotation fieldAnnotation : setter.annotations()) {
if (!paramAnnotations.contains(fieldAnnotation)) {
paramAnnotations.add(fieldAnnotation);
}
}
}
// Gather the getter's details but only the ones we need
if (getter != null) {
// Do not set the param class/type from the getter if the values are already identified
if (paramType == null) {
paramType = getter.getType();
}
for (final Annotation fieldAnnotation : getter.annotations()) {
if (!paramAnnotations.contains(fieldAnnotation)) {
paramAnnotations.add(fieldAnnotation);
}
}
}
if (paramType == null) {
continue;
}
// Re-process all Bean fields and let the default swagger-jaxrs/swagger-jersey-jaxrs processors do their thing
List<Parameter> extracted = extensions.next().extractParameters(
paramAnnotations,
paramType,
typesToSkip,
components,
classConsumes,
methodConsumes,
includeRequestBody,
extensions).parameters;
for (Parameter p : extracted) {
if (ParameterProcessor.applyAnnotations(
p,
paramType,
paramAnnotations,
components,
classConsumes == null ? new String[0] : classConsumes.value(),
methodConsumes == null ? new String[0] : methodConsumes.value()) != null) {
parameters.add(p);
}
}
processed = true;
}
}
return processed;
} | java | private boolean handleAdditionalAnnotation(List<Parameter> parameters, Annotation annotation,
final Type type, Set<Type> typesToSkip, javax.ws.rs.Consumes classConsumes,
javax.ws.rs.Consumes methodConsumes, Components components, boolean includeRequestBody) {
boolean processed = false;
if (BeanParam.class.isAssignableFrom(annotation.getClass())) {
// Use Jackson's logic for processing Beans
final BeanDescription beanDesc = mapper.getSerializationConfig().introspect(constructType(type));
final List<BeanPropertyDefinition> properties = beanDesc.findProperties();
for (final BeanPropertyDefinition propDef : properties) {
final AnnotatedField field = propDef.getField();
final AnnotatedMethod setter = propDef.getSetter();
final AnnotatedMethod getter = propDef.getGetter();
final List<Annotation> paramAnnotations = new ArrayList<Annotation>();
final Iterator<OpenAPIExtension> extensions = OpenAPIExtensions.chain();
Type paramType = null;
// Gather the field's details
if (field != null) {
paramType = field.getType();
for (final Annotation fieldAnnotation : field.annotations()) {
if (!paramAnnotations.contains(fieldAnnotation)) {
paramAnnotations.add(fieldAnnotation);
}
}
}
// Gather the setter's details but only the ones we need
if (setter != null) {
// Do not set the param class/type from the setter if the values are already identified
if (paramType == null) {
// paramType will stay null if there is no parameter
paramType = setter.getParameterType(0);
}
for (final Annotation fieldAnnotation : setter.annotations()) {
if (!paramAnnotations.contains(fieldAnnotation)) {
paramAnnotations.add(fieldAnnotation);
}
}
}
// Gather the getter's details but only the ones we need
if (getter != null) {
// Do not set the param class/type from the getter if the values are already identified
if (paramType == null) {
paramType = getter.getType();
}
for (final Annotation fieldAnnotation : getter.annotations()) {
if (!paramAnnotations.contains(fieldAnnotation)) {
paramAnnotations.add(fieldAnnotation);
}
}
}
if (paramType == null) {
continue;
}
// Re-process all Bean fields and let the default swagger-jaxrs/swagger-jersey-jaxrs processors do their thing
List<Parameter> extracted = extensions.next().extractParameters(
paramAnnotations,
paramType,
typesToSkip,
components,
classConsumes,
methodConsumes,
includeRequestBody,
extensions).parameters;
for (Parameter p : extracted) {
if (ParameterProcessor.applyAnnotations(
p,
paramType,
paramAnnotations,
components,
classConsumes == null ? new String[0] : classConsumes.value(),
methodConsumes == null ? new String[0] : methodConsumes.value()) != null) {
parameters.add(p);
}
}
processed = true;
}
}
return processed;
} | [
"private",
"boolean",
"handleAdditionalAnnotation",
"(",
"List",
"<",
"Parameter",
">",
"parameters",
",",
"Annotation",
"annotation",
",",
"final",
"Type",
"type",
",",
"Set",
"<",
"Type",
">",
"typesToSkip",
",",
"javax",
".",
"ws",
".",
"rs",
".",
"Consumes",
"classConsumes",
",",
"javax",
".",
"ws",
".",
"rs",
".",
"Consumes",
"methodConsumes",
",",
"Components",
"components",
",",
"boolean",
"includeRequestBody",
")",
"{",
"boolean",
"processed",
"=",
"false",
";",
"if",
"(",
"BeanParam",
".",
"class",
".",
"isAssignableFrom",
"(",
"annotation",
".",
"getClass",
"(",
")",
")",
")",
"{",
"// Use Jackson's logic for processing Beans",
"final",
"BeanDescription",
"beanDesc",
"=",
"mapper",
".",
"getSerializationConfig",
"(",
")",
".",
"introspect",
"(",
"constructType",
"(",
"type",
")",
")",
";",
"final",
"List",
"<",
"BeanPropertyDefinition",
">",
"properties",
"=",
"beanDesc",
".",
"findProperties",
"(",
")",
";",
"for",
"(",
"final",
"BeanPropertyDefinition",
"propDef",
":",
"properties",
")",
"{",
"final",
"AnnotatedField",
"field",
"=",
"propDef",
".",
"getField",
"(",
")",
";",
"final",
"AnnotatedMethod",
"setter",
"=",
"propDef",
".",
"getSetter",
"(",
")",
";",
"final",
"AnnotatedMethod",
"getter",
"=",
"propDef",
".",
"getGetter",
"(",
")",
";",
"final",
"List",
"<",
"Annotation",
">",
"paramAnnotations",
"=",
"new",
"ArrayList",
"<",
"Annotation",
">",
"(",
")",
";",
"final",
"Iterator",
"<",
"OpenAPIExtension",
">",
"extensions",
"=",
"OpenAPIExtensions",
".",
"chain",
"(",
")",
";",
"Type",
"paramType",
"=",
"null",
";",
"// Gather the field's details",
"if",
"(",
"field",
"!=",
"null",
")",
"{",
"paramType",
"=",
"field",
".",
"getType",
"(",
")",
";",
"for",
"(",
"final",
"Annotation",
"fieldAnnotation",
":",
"field",
".",
"annotations",
"(",
")",
")",
"{",
"if",
"(",
"!",
"paramAnnotations",
".",
"contains",
"(",
"fieldAnnotation",
")",
")",
"{",
"paramAnnotations",
".",
"add",
"(",
"fieldAnnotation",
")",
";",
"}",
"}",
"}",
"// Gather the setter's details but only the ones we need",
"if",
"(",
"setter",
"!=",
"null",
")",
"{",
"// Do not set the param class/type from the setter if the values are already identified",
"if",
"(",
"paramType",
"==",
"null",
")",
"{",
"// paramType will stay null if there is no parameter",
"paramType",
"=",
"setter",
".",
"getParameterType",
"(",
"0",
")",
";",
"}",
"for",
"(",
"final",
"Annotation",
"fieldAnnotation",
":",
"setter",
".",
"annotations",
"(",
")",
")",
"{",
"if",
"(",
"!",
"paramAnnotations",
".",
"contains",
"(",
"fieldAnnotation",
")",
")",
"{",
"paramAnnotations",
".",
"add",
"(",
"fieldAnnotation",
")",
";",
"}",
"}",
"}",
"// Gather the getter's details but only the ones we need",
"if",
"(",
"getter",
"!=",
"null",
")",
"{",
"// Do not set the param class/type from the getter if the values are already identified",
"if",
"(",
"paramType",
"==",
"null",
")",
"{",
"paramType",
"=",
"getter",
".",
"getType",
"(",
")",
";",
"}",
"for",
"(",
"final",
"Annotation",
"fieldAnnotation",
":",
"getter",
".",
"annotations",
"(",
")",
")",
"{",
"if",
"(",
"!",
"paramAnnotations",
".",
"contains",
"(",
"fieldAnnotation",
")",
")",
"{",
"paramAnnotations",
".",
"add",
"(",
"fieldAnnotation",
")",
";",
"}",
"}",
"}",
"if",
"(",
"paramType",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"// Re-process all Bean fields and let the default swagger-jaxrs/swagger-jersey-jaxrs processors do their thing",
"List",
"<",
"Parameter",
">",
"extracted",
"=",
"extensions",
".",
"next",
"(",
")",
".",
"extractParameters",
"(",
"paramAnnotations",
",",
"paramType",
",",
"typesToSkip",
",",
"components",
",",
"classConsumes",
",",
"methodConsumes",
",",
"includeRequestBody",
",",
"extensions",
")",
".",
"parameters",
";",
"for",
"(",
"Parameter",
"p",
":",
"extracted",
")",
"{",
"if",
"(",
"ParameterProcessor",
".",
"applyAnnotations",
"(",
"p",
",",
"paramType",
",",
"paramAnnotations",
",",
"components",
",",
"classConsumes",
"==",
"null",
"?",
"new",
"String",
"[",
"0",
"]",
":",
"classConsumes",
".",
"value",
"(",
")",
",",
"methodConsumes",
"==",
"null",
"?",
"new",
"String",
"[",
"0",
"]",
":",
"methodConsumes",
".",
"value",
"(",
")",
")",
"!=",
"null",
")",
"{",
"parameters",
".",
"add",
"(",
"p",
")",
";",
"}",
"}",
"processed",
"=",
"true",
";",
"}",
"}",
"return",
"processed",
";",
"}"
] | Adds additional annotation processing support
@param parameters
@param annotation
@param type
@param typesToSkip | [
"Adds",
"additional",
"annotation",
"processing",
"support"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/jaxrs2/DefaultParameterExtension.java#L153-L241 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/modelresolver/impl/AbstractPropertyResolver.java | AbstractPropertyResolver.replaceAllProperties | protected String replaceAllProperties(String str,
final Properties submittedProps, final Properties xmlProperties) {
int startIndex = 0;
NextProperty nextProp = this.findNextProperty(str, startIndex);
while (nextProp != null) {
// get the start index past this property for the next property in
// the string
//startIndex = this.getEndIndexOfNextProperty(str, startIndex);
startIndex = nextProp.endIndex;
// resolve the property
String nextPropValue = this.resolvePropertyValue(nextProp.propName, nextProp.propType, submittedProps, xmlProperties);
//if the property didn't resolve use the default value if it exists
if (nextPropValue.equals(UNRESOLVED_PROP_VALUE)){
if (nextProp.defaultValueExpression != null) {
nextPropValue = this.replaceAllProperties(nextProp.defaultValueExpression, submittedProps, xmlProperties);
}
}
// After we get this value the lenght of the string might change so
// we need to reset the start index
int lengthDifference = 0;
switch(nextProp.propType) {
case JOB_PARAMETERS:
lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{jobParameters['']}".length()); // this can be a negative value
startIndex = startIndex + lengthDifference; // move start index for next property
str = str.replace("#{jobParameters['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);
break;
case JOB_PROPERTIES:
lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{jobProperties['']}".length()); // this can be a negative value
startIndex = startIndex + lengthDifference; // move start index for next property
str = str.replace("#{jobProperties['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);
break;
case SYSTEM_PROPERTIES:
lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{systemProperties['']}".length()); // this can be a negative value
startIndex = startIndex + lengthDifference; // move start index for next property
str = str.replace("#{systemProperties['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);
break;
case PARTITION_PROPERTIES:
lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{partitionPlan['']}".length()); // this can be a negative value
startIndex = startIndex + lengthDifference; // move start index for next property
str = str.replace("#{partitionPlan['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);
break;
}
// find the next property
nextProp = this.findNextProperty(str, startIndex);
}
return str;
} | java | protected String replaceAllProperties(String str,
final Properties submittedProps, final Properties xmlProperties) {
int startIndex = 0;
NextProperty nextProp = this.findNextProperty(str, startIndex);
while (nextProp != null) {
// get the start index past this property for the next property in
// the string
//startIndex = this.getEndIndexOfNextProperty(str, startIndex);
startIndex = nextProp.endIndex;
// resolve the property
String nextPropValue = this.resolvePropertyValue(nextProp.propName, nextProp.propType, submittedProps, xmlProperties);
//if the property didn't resolve use the default value if it exists
if (nextPropValue.equals(UNRESOLVED_PROP_VALUE)){
if (nextProp.defaultValueExpression != null) {
nextPropValue = this.replaceAllProperties(nextProp.defaultValueExpression, submittedProps, xmlProperties);
}
}
// After we get this value the lenght of the string might change so
// we need to reset the start index
int lengthDifference = 0;
switch(nextProp.propType) {
case JOB_PARAMETERS:
lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{jobParameters['']}".length()); // this can be a negative value
startIndex = startIndex + lengthDifference; // move start index for next property
str = str.replace("#{jobParameters['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);
break;
case JOB_PROPERTIES:
lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{jobProperties['']}".length()); // this can be a negative value
startIndex = startIndex + lengthDifference; // move start index for next property
str = str.replace("#{jobProperties['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);
break;
case SYSTEM_PROPERTIES:
lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{systemProperties['']}".length()); // this can be a negative value
startIndex = startIndex + lengthDifference; // move start index for next property
str = str.replace("#{systemProperties['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);
break;
case PARTITION_PROPERTIES:
lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{partitionPlan['']}".length()); // this can be a negative value
startIndex = startIndex + lengthDifference; // move start index for next property
str = str.replace("#{partitionPlan['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);
break;
}
// find the next property
nextProp = this.findNextProperty(str, startIndex);
}
return str;
} | [
"protected",
"String",
"replaceAllProperties",
"(",
"String",
"str",
",",
"final",
"Properties",
"submittedProps",
",",
"final",
"Properties",
"xmlProperties",
")",
"{",
"int",
"startIndex",
"=",
"0",
";",
"NextProperty",
"nextProp",
"=",
"this",
".",
"findNextProperty",
"(",
"str",
",",
"startIndex",
")",
";",
"while",
"(",
"nextProp",
"!=",
"null",
")",
"{",
"// get the start index past this property for the next property in",
"// the string",
"//startIndex = this.getEndIndexOfNextProperty(str, startIndex);",
"startIndex",
"=",
"nextProp",
".",
"endIndex",
";",
"// resolve the property",
"String",
"nextPropValue",
"=",
"this",
".",
"resolvePropertyValue",
"(",
"nextProp",
".",
"propName",
",",
"nextProp",
".",
"propType",
",",
"submittedProps",
",",
"xmlProperties",
")",
";",
"//if the property didn't resolve use the default value if it exists",
"if",
"(",
"nextPropValue",
".",
"equals",
"(",
"UNRESOLVED_PROP_VALUE",
")",
")",
"{",
"if",
"(",
"nextProp",
".",
"defaultValueExpression",
"!=",
"null",
")",
"{",
"nextPropValue",
"=",
"this",
".",
"replaceAllProperties",
"(",
"nextProp",
".",
"defaultValueExpression",
",",
"submittedProps",
",",
"xmlProperties",
")",
";",
"}",
"}",
"// After we get this value the lenght of the string might change so",
"// we need to reset the start index",
"int",
"lengthDifference",
"=",
"0",
";",
"switch",
"(",
"nextProp",
".",
"propType",
")",
"{",
"case",
"JOB_PARAMETERS",
":",
"lengthDifference",
"=",
"nextPropValue",
".",
"length",
"(",
")",
"-",
"(",
"nextProp",
".",
"propName",
".",
"length",
"(",
")",
"+",
"\"#{jobParameters['']}\"",
".",
"length",
"(",
")",
")",
";",
"// this can be a negative value",
"startIndex",
"=",
"startIndex",
"+",
"lengthDifference",
";",
"// move start index for next property",
"str",
"=",
"str",
".",
"replace",
"(",
"\"#{jobParameters['\"",
"+",
"nextProp",
".",
"propName",
"+",
"\"']}\"",
"+",
"nextProp",
".",
"getDefaultValExprWithDelimitersIfExists",
"(",
")",
",",
"nextPropValue",
")",
";",
"break",
";",
"case",
"JOB_PROPERTIES",
":",
"lengthDifference",
"=",
"nextPropValue",
".",
"length",
"(",
")",
"-",
"(",
"nextProp",
".",
"propName",
".",
"length",
"(",
")",
"+",
"\"#{jobProperties['']}\"",
".",
"length",
"(",
")",
")",
";",
"// this can be a negative value",
"startIndex",
"=",
"startIndex",
"+",
"lengthDifference",
";",
"// move start index for next property",
"str",
"=",
"str",
".",
"replace",
"(",
"\"#{jobProperties['\"",
"+",
"nextProp",
".",
"propName",
"+",
"\"']}\"",
"+",
"nextProp",
".",
"getDefaultValExprWithDelimitersIfExists",
"(",
")",
",",
"nextPropValue",
")",
";",
"break",
";",
"case",
"SYSTEM_PROPERTIES",
":",
"lengthDifference",
"=",
"nextPropValue",
".",
"length",
"(",
")",
"-",
"(",
"nextProp",
".",
"propName",
".",
"length",
"(",
")",
"+",
"\"#{systemProperties['']}\"",
".",
"length",
"(",
")",
")",
";",
"// this can be a negative value",
"startIndex",
"=",
"startIndex",
"+",
"lengthDifference",
";",
"// move start index for next property",
"str",
"=",
"str",
".",
"replace",
"(",
"\"#{systemProperties['\"",
"+",
"nextProp",
".",
"propName",
"+",
"\"']}\"",
"+",
"nextProp",
".",
"getDefaultValExprWithDelimitersIfExists",
"(",
")",
",",
"nextPropValue",
")",
";",
"break",
";",
"case",
"PARTITION_PROPERTIES",
":",
"lengthDifference",
"=",
"nextPropValue",
".",
"length",
"(",
")",
"-",
"(",
"nextProp",
".",
"propName",
".",
"length",
"(",
")",
"+",
"\"#{partitionPlan['']}\"",
".",
"length",
"(",
")",
")",
";",
"// this can be a negative value",
"startIndex",
"=",
"startIndex",
"+",
"lengthDifference",
";",
"// move start index for next property",
"str",
"=",
"str",
".",
"replace",
"(",
"\"#{partitionPlan['\"",
"+",
"nextProp",
".",
"propName",
"+",
"\"']}\"",
"+",
"nextProp",
".",
"getDefaultValExprWithDelimitersIfExists",
"(",
")",
",",
"nextPropValue",
")",
";",
"break",
";",
"}",
"// find the next property",
"nextProp",
"=",
"this",
".",
"findNextProperty",
"(",
"str",
",",
"startIndex",
")",
";",
"}",
"return",
"str",
";",
"}"
] | Replace all the properties in String str.
@param str
@param submittedProps
@param xmlProperties
@return | [
"Replace",
"all",
"the",
"properties",
"in",
"String",
"str",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/modelresolver/impl/AbstractPropertyResolver.java#L108-L166 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/modelresolver/impl/AbstractPropertyResolver.java | AbstractPropertyResolver.resolvePropertyValue | private String resolvePropertyValue(final String name, PROPERTY_TYPE propType,
final Properties submittedProperties, final Properties xmlProperties) {
String value = null;
switch(propType) {
case JOB_PARAMETERS:
if (submittedProperties != null) {
value = submittedProperties.getProperty(name);
}
if (value != null){
return value;
}
break;
case JOB_PROPERTIES:
if (xmlProperties != null){
value = xmlProperties.getProperty(name);
}
if (value != null) {
return value;
}
break;
case SYSTEM_PROPERTIES:
value = System.getProperty(name);
if (value != null) {
return value;
}
break;
case PARTITION_PROPERTIES: //We are reusing the submitted props to carry the partition props
if (submittedProperties != null) {
value = submittedProperties.getProperty(name);
}
if (value != null) {
return value;
}
break;
}
return UNRESOLVED_PROP_VALUE;
} | java | private String resolvePropertyValue(final String name, PROPERTY_TYPE propType,
final Properties submittedProperties, final Properties xmlProperties) {
String value = null;
switch(propType) {
case JOB_PARAMETERS:
if (submittedProperties != null) {
value = submittedProperties.getProperty(name);
}
if (value != null){
return value;
}
break;
case JOB_PROPERTIES:
if (xmlProperties != null){
value = xmlProperties.getProperty(name);
}
if (value != null) {
return value;
}
break;
case SYSTEM_PROPERTIES:
value = System.getProperty(name);
if (value != null) {
return value;
}
break;
case PARTITION_PROPERTIES: //We are reusing the submitted props to carry the partition props
if (submittedProperties != null) {
value = submittedProperties.getProperty(name);
}
if (value != null) {
return value;
}
break;
}
return UNRESOLVED_PROP_VALUE;
} | [
"private",
"String",
"resolvePropertyValue",
"(",
"final",
"String",
"name",
",",
"PROPERTY_TYPE",
"propType",
",",
"final",
"Properties",
"submittedProperties",
",",
"final",
"Properties",
"xmlProperties",
")",
"{",
"String",
"value",
"=",
"null",
";",
"switch",
"(",
"propType",
")",
"{",
"case",
"JOB_PARAMETERS",
":",
"if",
"(",
"submittedProperties",
"!=",
"null",
")",
"{",
"value",
"=",
"submittedProperties",
".",
"getProperty",
"(",
"name",
")",
";",
"}",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
";",
"}",
"break",
";",
"case",
"JOB_PROPERTIES",
":",
"if",
"(",
"xmlProperties",
"!=",
"null",
")",
"{",
"value",
"=",
"xmlProperties",
".",
"getProperty",
"(",
"name",
")",
";",
"}",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
";",
"}",
"break",
";",
"case",
"SYSTEM_PROPERTIES",
":",
"value",
"=",
"System",
".",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
";",
"}",
"break",
";",
"case",
"PARTITION_PROPERTIES",
":",
"//We are reusing the submitted props to carry the partition props",
"if",
"(",
"submittedProperties",
"!=",
"null",
")",
"{",
"value",
"=",
"submittedProperties",
".",
"getProperty",
"(",
"name",
")",
";",
"}",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
";",
"}",
"break",
";",
"}",
"return",
"UNRESOLVED_PROP_VALUE",
";",
"}"
] | Gets the value of a property using the property type
If the property 'propname' is not defined the String 'null' (without quotes) is returned as the
value
@param name
@return | [
"Gets",
"the",
"value",
"of",
"a",
"property",
"using",
"the",
"property",
"type"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/modelresolver/impl/AbstractPropertyResolver.java#L177-L221 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/modelresolver/impl/AbstractPropertyResolver.java | AbstractPropertyResolver.inheritProperties | private Properties inheritProperties(final Properties parentProps,
final Properties childProps) {
if (parentProps == null) {
return childProps;
}
if (childProps == null) {
return parentProps;
}
for (final String parentKey : parentProps.stringPropertyNames()) {
// Add the parent property to the child if the child does not
// already define it
if (!childProps.containsKey(parentKey)) {
childProps.setProperty(parentKey, parentProps
.getProperty(parentKey));
}
}
return childProps;
} | java | private Properties inheritProperties(final Properties parentProps,
final Properties childProps) {
if (parentProps == null) {
return childProps;
}
if (childProps == null) {
return parentProps;
}
for (final String parentKey : parentProps.stringPropertyNames()) {
// Add the parent property to the child if the child does not
// already define it
if (!childProps.containsKey(parentKey)) {
childProps.setProperty(parentKey, parentProps
.getProperty(parentKey));
}
}
return childProps;
} | [
"private",
"Properties",
"inheritProperties",
"(",
"final",
"Properties",
"parentProps",
",",
"final",
"Properties",
"childProps",
")",
"{",
"if",
"(",
"parentProps",
"==",
"null",
")",
"{",
"return",
"childProps",
";",
"}",
"if",
"(",
"childProps",
"==",
"null",
")",
"{",
"return",
"parentProps",
";",
"}",
"for",
"(",
"final",
"String",
"parentKey",
":",
"parentProps",
".",
"stringPropertyNames",
"(",
")",
")",
"{",
"// Add the parent property to the child if the child does not",
"// already define it",
"if",
"(",
"!",
"childProps",
".",
"containsKey",
"(",
"parentKey",
")",
")",
"{",
"childProps",
".",
"setProperty",
"(",
"parentKey",
",",
"parentProps",
".",
"getProperty",
"(",
"parentKey",
")",
")",
";",
"}",
"}",
"return",
"childProps",
";",
"}"
] | Merge the parent properties that are already set into the child
properties. Child properties always override parent values.
@param parentProps
A set of already resolved parent properties
@param childProps
A set of already resolved child properties
@return | [
"Merge",
"the",
"parent",
"properties",
"that",
"are",
"already",
"set",
"into",
"the",
"child",
"properties",
".",
"Child",
"properties",
"always",
"override",
"parent",
"values",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/modelresolver/impl/AbstractPropertyResolver.java#L233-L255 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/BufferedWriter.java | BufferedWriter.isCommitted | public boolean isCommitted()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{ // 306998.15
Tr.debug(tc, "isCommitted: " + committed);
}
return committed;
} | java | public boolean isCommitted()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{ // 306998.15
Tr.debug(tc, "isCommitted: " + committed);
}
return committed;
} | [
"public",
"boolean",
"isCommitted",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// 306998.15",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"isCommitted: \"",
"+",
"committed",
")",
";",
"}",
"return",
"committed",
";",
"}"
] | Returns whether the output has been committed or not. | [
"Returns",
"whether",
"the",
"output",
"has",
"been",
"committed",
"or",
"not",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/BufferedWriter.java#L265-L272 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/BufferedWriter.java | BufferedWriter.write | public void write(int c) throws IOException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{ // 306998.15
Tr.debug(tc, "write --> " + c);
}
if (!_hasWritten && obs != null)
{
_hasWritten = true;
obs.alertFirstWrite();
}
if (limit > -1)
{
if (total >= limit)
{
throw new WriteBeyondContentLengthException();
}
}
if (count == buf.length)
{
response.setFlushMode(false);
flushChars();
response.setFlushMode(true);
}
buf[count++] = (char) c;
total++;
} | java | public void write(int c) throws IOException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{ // 306998.15
Tr.debug(tc, "write --> " + c);
}
if (!_hasWritten && obs != null)
{
_hasWritten = true;
obs.alertFirstWrite();
}
if (limit > -1)
{
if (total >= limit)
{
throw new WriteBeyondContentLengthException();
}
}
if (count == buf.length)
{
response.setFlushMode(false);
flushChars();
response.setFlushMode(true);
}
buf[count++] = (char) c;
total++;
} | [
"public",
"void",
"write",
"(",
"int",
"c",
")",
"throws",
"IOException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// 306998.15",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"write --> \"",
"+",
"c",
")",
";",
"}",
"if",
"(",
"!",
"_hasWritten",
"&&",
"obs",
"!=",
"null",
")",
"{",
"_hasWritten",
"=",
"true",
";",
"obs",
".",
"alertFirstWrite",
"(",
")",
";",
"}",
"if",
"(",
"limit",
">",
"-",
"1",
")",
"{",
"if",
"(",
"total",
">=",
"limit",
")",
"{",
"throw",
"new",
"WriteBeyondContentLengthException",
"(",
")",
";",
"}",
"}",
"if",
"(",
"count",
"==",
"buf",
".",
"length",
")",
"{",
"response",
".",
"setFlushMode",
"(",
"false",
")",
";",
"flushChars",
"(",
")",
";",
"response",
".",
"setFlushMode",
"(",
"true",
")",
";",
"}",
"buf",
"[",
"count",
"++",
"]",
"=",
"(",
"char",
")",
"c",
";",
"total",
"++",
";",
"}"
] | Writes a char. This method will block until the char is actually
written.
@param b
the char
@exception IOException
if an I/O error has occurred | [
"Writes",
"a",
"char",
".",
"This",
"method",
"will",
"block",
"until",
"the",
"char",
"is",
"actually",
"written",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/BufferedWriter.java#L300-L328 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/BufferedWriter.java | BufferedWriter.flushChars | protected void flushChars() throws IOException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{ // 306998.15
Tr.debug(tc, "flushChars");
}
if (!committed)
{
if (!_hasFlushed && obs != null)
{
_hasFlushed = true;
obs.alertFirstFlush();
}
}
committed = true;
if (count > 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "flushChars, Count = " + count);
}
writeOut(buf, 0, count);
// out.flush(); moved to writeOut 277717 SVT:Mixed information shown on
// the Admin Console WAS.webcontainer
count = 0;
}
else
{// PK22392 start
if (response.getFlushMode())
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "flushChars, Count 0 still flush mode is true , forceful flush");
}
response.flushBufferedContent();
}// PK22392 END
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "flushChars, flush mode is false");
}
}
}
} | java | protected void flushChars() throws IOException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{ // 306998.15
Tr.debug(tc, "flushChars");
}
if (!committed)
{
if (!_hasFlushed && obs != null)
{
_hasFlushed = true;
obs.alertFirstFlush();
}
}
committed = true;
if (count > 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "flushChars, Count = " + count);
}
writeOut(buf, 0, count);
// out.flush(); moved to writeOut 277717 SVT:Mixed information shown on
// the Admin Console WAS.webcontainer
count = 0;
}
else
{// PK22392 start
if (response.getFlushMode())
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "flushChars, Count 0 still flush mode is true , forceful flush");
}
response.flushBufferedContent();
}// PK22392 END
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "flushChars, flush mode is false");
}
}
}
} | [
"protected",
"void",
"flushChars",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// 306998.15",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"flushChars\"",
")",
";",
"}",
"if",
"(",
"!",
"committed",
")",
"{",
"if",
"(",
"!",
"_hasFlushed",
"&&",
"obs",
"!=",
"null",
")",
"{",
"_hasFlushed",
"=",
"true",
";",
"obs",
".",
"alertFirstFlush",
"(",
")",
";",
"}",
"}",
"committed",
"=",
"true",
";",
"if",
"(",
"count",
">",
"0",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"flushChars, Count = \"",
"+",
"count",
")",
";",
"}",
"writeOut",
"(",
"buf",
",",
"0",
",",
"count",
")",
";",
"// out.flush(); moved to writeOut 277717 SVT:Mixed information shown on",
"// the Admin Console WAS.webcontainer",
"count",
"=",
"0",
";",
"}",
"else",
"{",
"// PK22392 start",
"if",
"(",
"response",
".",
"getFlushMode",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"flushChars, Count 0 still flush mode is true , forceful flush\"",
")",
";",
"}",
"response",
".",
"flushBufferedContent",
"(",
")",
";",
"}",
"// PK22392 END",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"flushChars, flush mode is false\"",
")",
";",
"}",
"}",
"}",
"}"
] | Flushes the writer chars. | [
"Flushes",
"the",
"writer",
"chars",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/util/BufferedWriter.java#L495-L540 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java | FilterList.addAddressToList | private void addAddressToList(String newAddress, boolean validateOnly) {
int start = 0;
char delimiter = '.';
String sub;
int radix = 10;
// Address initially set to all zeroes
int addressToAdd[] = new int[IP_ADDR_NUMBERS];
for (int i = 0; i < IP_ADDR_NUMBERS; i++) {
addressToAdd[i] = 0;
}
int slot = IP_ADDR_NUMBERS - 1;
// assume the address is IP4, but change to IP6 if there is a colon
if (newAddress.indexOf('.') == -1) {
// if no ".", then assume IPv6 Address
delimiter = ':';
radix = 16;
}
String addr = newAddress;
while (true) {
// fill address from back to front
start = addr.lastIndexOf(delimiter);
if (start != -1) {
sub = addr.substring(start + 1);
if (sub.trim().equals("*")) {
addressToAdd[slot] = -1; // 0xFFFFFFFF is the wildcard.
} else {
addressToAdd[slot] = Integer.parseInt(sub, radix);
}
} else {
if (addr.trim().equals("*")) {
addressToAdd[slot] = -1; // 0xFFFFFFFF is the wildcard.
} else {
addressToAdd[slot] = Integer.parseInt(addr, radix);
}
break;
}
slot = slot - 1;
addr = addr.substring(0, start);
}
if (!validateOnly) {
putInList(addressToAdd);
}
} | java | private void addAddressToList(String newAddress, boolean validateOnly) {
int start = 0;
char delimiter = '.';
String sub;
int radix = 10;
// Address initially set to all zeroes
int addressToAdd[] = new int[IP_ADDR_NUMBERS];
for (int i = 0; i < IP_ADDR_NUMBERS; i++) {
addressToAdd[i] = 0;
}
int slot = IP_ADDR_NUMBERS - 1;
// assume the address is IP4, but change to IP6 if there is a colon
if (newAddress.indexOf('.') == -1) {
// if no ".", then assume IPv6 Address
delimiter = ':';
radix = 16;
}
String addr = newAddress;
while (true) {
// fill address from back to front
start = addr.lastIndexOf(delimiter);
if (start != -1) {
sub = addr.substring(start + 1);
if (sub.trim().equals("*")) {
addressToAdd[slot] = -1; // 0xFFFFFFFF is the wildcard.
} else {
addressToAdd[slot] = Integer.parseInt(sub, radix);
}
} else {
if (addr.trim().equals("*")) {
addressToAdd[slot] = -1; // 0xFFFFFFFF is the wildcard.
} else {
addressToAdd[slot] = Integer.parseInt(addr, radix);
}
break;
}
slot = slot - 1;
addr = addr.substring(0, start);
}
if (!validateOnly) {
putInList(addressToAdd);
}
} | [
"private",
"void",
"addAddressToList",
"(",
"String",
"newAddress",
",",
"boolean",
"validateOnly",
")",
"{",
"int",
"start",
"=",
"0",
";",
"char",
"delimiter",
"=",
"'",
"'",
";",
"String",
"sub",
";",
"int",
"radix",
"=",
"10",
";",
"// Address initially set to all zeroes",
"int",
"addressToAdd",
"[",
"]",
"=",
"new",
"int",
"[",
"IP_ADDR_NUMBERS",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"IP_ADDR_NUMBERS",
";",
"i",
"++",
")",
"{",
"addressToAdd",
"[",
"i",
"]",
"=",
"0",
";",
"}",
"int",
"slot",
"=",
"IP_ADDR_NUMBERS",
"-",
"1",
";",
"// assume the address is IP4, but change to IP6 if there is a colon",
"if",
"(",
"newAddress",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
")",
"{",
"// if no \".\", then assume IPv6 Address",
"delimiter",
"=",
"'",
"'",
";",
"radix",
"=",
"16",
";",
"}",
"String",
"addr",
"=",
"newAddress",
";",
"while",
"(",
"true",
")",
"{",
"// fill address from back to front",
"start",
"=",
"addr",
".",
"lastIndexOf",
"(",
"delimiter",
")",
";",
"if",
"(",
"start",
"!=",
"-",
"1",
")",
"{",
"sub",
"=",
"addr",
".",
"substring",
"(",
"start",
"+",
"1",
")",
";",
"if",
"(",
"sub",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"*\"",
")",
")",
"{",
"addressToAdd",
"[",
"slot",
"]",
"=",
"-",
"1",
";",
"// 0xFFFFFFFF is the wildcard.",
"}",
"else",
"{",
"addressToAdd",
"[",
"slot",
"]",
"=",
"Integer",
".",
"parseInt",
"(",
"sub",
",",
"radix",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"addr",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"*\"",
")",
")",
"{",
"addressToAdd",
"[",
"slot",
"]",
"=",
"-",
"1",
";",
"// 0xFFFFFFFF is the wildcard.",
"}",
"else",
"{",
"addressToAdd",
"[",
"slot",
"]",
"=",
"Integer",
".",
"parseInt",
"(",
"addr",
",",
"radix",
")",
";",
"}",
"break",
";",
"}",
"slot",
"=",
"slot",
"-",
"1",
";",
"addr",
"=",
"addr",
".",
"substring",
"(",
"0",
",",
"start",
")",
";",
"}",
"if",
"(",
"!",
"validateOnly",
")",
"{",
"putInList",
"(",
"addressToAdd",
")",
";",
"}",
"}"
] | Add one IPv4 or IPv6 address to the tree. The address is passed in as
a string and converted to an integer array by this routine. Another method
is then called to put it into the tree
@param newAddress
address to add | [
"Add",
"one",
"IPv4",
"or",
"IPv6",
"address",
"to",
"the",
"tree",
".",
"The",
"address",
"is",
"passed",
"in",
"as",
"a",
"string",
"and",
"converted",
"to",
"an",
"integer",
"array",
"by",
"this",
"routine",
".",
"Another",
"method",
"is",
"then",
"called",
"to",
"put",
"it",
"into",
"the",
"tree"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java#L79-L126 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java | FilterList.findInList | public boolean findInList(byte[] address) {
int len = address.length;
int a[] = new int[len];
for (int i = 0; i < len; i++) {
// convert possible negative byte value to positive int
a[i] = address[i] & 0x00FF;
}
return findInList(a);
} | java | public boolean findInList(byte[] address) {
int len = address.length;
int a[] = new int[len];
for (int i = 0; i < len; i++) {
// convert possible negative byte value to positive int
a[i] = address[i] & 0x00FF;
}
return findInList(a);
} | [
"public",
"boolean",
"findInList",
"(",
"byte",
"[",
"]",
"address",
")",
"{",
"int",
"len",
"=",
"address",
".",
"length",
";",
"int",
"a",
"[",
"]",
"=",
"new",
"int",
"[",
"len",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"// convert possible negative byte value to positive int",
"a",
"[",
"i",
"]",
"=",
"address",
"[",
"i",
"]",
"&",
"0x00FF",
";",
"}",
"return",
"findInList",
"(",
"a",
")",
";",
"}"
] | Determine if an address, represented by a byte array, is in the address
tree
@param address
byte array representing the address, leftmost number
in the address should start at array offset 0.
@return true if this address is found in the address tree, false if
it is not. | [
"Determine",
"if",
"an",
"address",
"represented",
"by",
"a",
"byte",
"array",
"is",
"in",
"the",
"address",
"tree"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java#L175-L185 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java | FilterList.findInList6 | public boolean findInList6(byte[] address) {
int len = address.length;
int a[] = new int[len / 2];
// IPv6, need to combine every two bytes to the ints
int j = 0;
int highOrder = 0;
int lowOrder = 0;
for (int i = 0; i < len; i += 2) {
// convert possible negative byte value to positive int
highOrder = address[i] & 0x00FF;
lowOrder = address[i + 1] & 0x00FF;
a[j] = highOrder * 256 + lowOrder;
j++;
}
return findInList(a);
} | java | public boolean findInList6(byte[] address) {
int len = address.length;
int a[] = new int[len / 2];
// IPv6, need to combine every two bytes to the ints
int j = 0;
int highOrder = 0;
int lowOrder = 0;
for (int i = 0; i < len; i += 2) {
// convert possible negative byte value to positive int
highOrder = address[i] & 0x00FF;
lowOrder = address[i + 1] & 0x00FF;
a[j] = highOrder * 256 + lowOrder;
j++;
}
return findInList(a);
} | [
"public",
"boolean",
"findInList6",
"(",
"byte",
"[",
"]",
"address",
")",
"{",
"int",
"len",
"=",
"address",
".",
"length",
";",
"int",
"a",
"[",
"]",
"=",
"new",
"int",
"[",
"len",
"/",
"2",
"]",
";",
"// IPv6, need to combine every two bytes to the ints",
"int",
"j",
"=",
"0",
";",
"int",
"highOrder",
"=",
"0",
";",
"int",
"lowOrder",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"+=",
"2",
")",
"{",
"// convert possible negative byte value to positive int",
"highOrder",
"=",
"address",
"[",
"i",
"]",
"&",
"0x00FF",
";",
"lowOrder",
"=",
"address",
"[",
"i",
"+",
"1",
"]",
"&",
"0x00FF",
";",
"a",
"[",
"j",
"]",
"=",
"highOrder",
"*",
"256",
"+",
"lowOrder",
";",
"j",
"++",
";",
"}",
"return",
"findInList",
"(",
"a",
")",
";",
"}"
] | Determine if an IPv6 address, represented by a byte array, is in the
address tree
@param address
byte array representing the address, leftmost number
in the address should start at array offset 0. Two bytes form 1
number
of the address, bytes assumed to be in network order
@return true if this address is found in the address tree, false if
it is not. | [
"Determine",
"if",
"an",
"IPv6",
"address",
"represented",
"by",
"a",
"byte",
"array",
"is",
"in",
"the",
"address",
"tree"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java#L199-L216 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java | FilterList.findInList | public boolean findInList(int[] address) {
int len = address.length;
if (len < IP_ADDR_NUMBERS) {
int j = IP_ADDR_NUMBERS - 1;
// for performace, hard code the size here
int a[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
// int a[] = new int[IP_ADDR_NUMBERS];
// for (int i = 0; i < IP_ADDR_NUMBERS; i++)
// {
// a[i] = 0;
// }
for (int i = len; i > 0; i--, j--) {
a[j] = address[i - 1];
}
return findInList(a, 0, firstCell, 7);
}
return findInList(address, 0, firstCell, (address.length - 1));
} | java | public boolean findInList(int[] address) {
int len = address.length;
if (len < IP_ADDR_NUMBERS) {
int j = IP_ADDR_NUMBERS - 1;
// for performace, hard code the size here
int a[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
// int a[] = new int[IP_ADDR_NUMBERS];
// for (int i = 0; i < IP_ADDR_NUMBERS; i++)
// {
// a[i] = 0;
// }
for (int i = len; i > 0; i--, j--) {
a[j] = address[i - 1];
}
return findInList(a, 0, firstCell, 7);
}
return findInList(address, 0, firstCell, (address.length - 1));
} | [
"public",
"boolean",
"findInList",
"(",
"int",
"[",
"]",
"address",
")",
"{",
"int",
"len",
"=",
"address",
".",
"length",
";",
"if",
"(",
"len",
"<",
"IP_ADDR_NUMBERS",
")",
"{",
"int",
"j",
"=",
"IP_ADDR_NUMBERS",
"-",
"1",
";",
"// for performace, hard code the size here",
"int",
"a",
"[",
"]",
"=",
"{",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
"}",
";",
"// int a[] = new int[IP_ADDR_NUMBERS];",
"// for (int i = 0; i < IP_ADDR_NUMBERS; i++)",
"// {",
"// a[i] = 0;",
"// }",
"for",
"(",
"int",
"i",
"=",
"len",
";",
"i",
">",
"0",
";",
"i",
"--",
",",
"j",
"--",
")",
"{",
"a",
"[",
"j",
"]",
"=",
"address",
"[",
"i",
"-",
"1",
"]",
";",
"}",
"return",
"findInList",
"(",
"a",
",",
"0",
",",
"firstCell",
",",
"7",
")",
";",
"}",
"return",
"findInList",
"(",
"address",
",",
"0",
",",
"firstCell",
",",
"(",
"address",
".",
"length",
"-",
"1",
")",
")",
";",
"}"
] | Determine if an address, represented by an integer array, is in the address
tree
@param address
integer array representing the address, leftmost number
in the address should start at array offset 0.
@return true if this address is found in the address tree, false if
it is not. | [
"Determine",
"if",
"an",
"address",
"represented",
"by",
"an",
"integer",
"array",
"is",
"in",
"the",
"address",
"tree"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java#L228-L249 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java | FilterList.findInList | private boolean findInList(int[] address, int index, FilterCell cell, int endIndex) {
if (cell.getWildcardCell() != null) {
// first look at wildcard slot
if (index == endIndex) {
// at the end, so we found a match, unwind returning true
return true;
}
// go to next level of this tree path
FilterCell newcell = cell.getWildcardCell();
// recursively search this path
if (findInList(address, index + 1, newcell, endIndex)) {
return true;
}
// the wildcard path didn't work, so see if there is a non-wildcard path
FilterCell nextCell = cell.findNextCell(address[index]);
if (nextCell != null) {
// see if we are at the end of a valid path
if (index == endIndex) {
// this path found a match, unwind returning true
return true;
}
// ok so far, recursively search this path
return findInList(address, index + 1, nextCell, endIndex);
}
// this path did not find a match.
return false;
}
// no wildcard here, try the non-wildcard path
FilterCell nextCell = cell.findNextCell(address[index]);
if (nextCell != null) {
if (index == endIndex) {
// this path found a match, unwind returning true
return true;
}
// ok so far, recursively search this path
return findInList(address, index + 1, nextCell, endIndex);
}
// this path did not find a match.
return false;
} | java | private boolean findInList(int[] address, int index, FilterCell cell, int endIndex) {
if (cell.getWildcardCell() != null) {
// first look at wildcard slot
if (index == endIndex) {
// at the end, so we found a match, unwind returning true
return true;
}
// go to next level of this tree path
FilterCell newcell = cell.getWildcardCell();
// recursively search this path
if (findInList(address, index + 1, newcell, endIndex)) {
return true;
}
// the wildcard path didn't work, so see if there is a non-wildcard path
FilterCell nextCell = cell.findNextCell(address[index]);
if (nextCell != null) {
// see if we are at the end of a valid path
if (index == endIndex) {
// this path found a match, unwind returning true
return true;
}
// ok so far, recursively search this path
return findInList(address, index + 1, nextCell, endIndex);
}
// this path did not find a match.
return false;
}
// no wildcard here, try the non-wildcard path
FilterCell nextCell = cell.findNextCell(address[index]);
if (nextCell != null) {
if (index == endIndex) {
// this path found a match, unwind returning true
return true;
}
// ok so far, recursively search this path
return findInList(address, index + 1, nextCell, endIndex);
}
// this path did not find a match.
return false;
} | [
"private",
"boolean",
"findInList",
"(",
"int",
"[",
"]",
"address",
",",
"int",
"index",
",",
"FilterCell",
"cell",
",",
"int",
"endIndex",
")",
"{",
"if",
"(",
"cell",
".",
"getWildcardCell",
"(",
")",
"!=",
"null",
")",
"{",
"// first look at wildcard slot",
"if",
"(",
"index",
"==",
"endIndex",
")",
"{",
"// at the end, so we found a match, unwind returning true",
"return",
"true",
";",
"}",
"// go to next level of this tree path",
"FilterCell",
"newcell",
"=",
"cell",
".",
"getWildcardCell",
"(",
")",
";",
"// recursively search this path",
"if",
"(",
"findInList",
"(",
"address",
",",
"index",
"+",
"1",
",",
"newcell",
",",
"endIndex",
")",
")",
"{",
"return",
"true",
";",
"}",
"// the wildcard path didn't work, so see if there is a non-wildcard path",
"FilterCell",
"nextCell",
"=",
"cell",
".",
"findNextCell",
"(",
"address",
"[",
"index",
"]",
")",
";",
"if",
"(",
"nextCell",
"!=",
"null",
")",
"{",
"// see if we are at the end of a valid path",
"if",
"(",
"index",
"==",
"endIndex",
")",
"{",
"// this path found a match, unwind returning true",
"return",
"true",
";",
"}",
"// ok so far, recursively search this path",
"return",
"findInList",
"(",
"address",
",",
"index",
"+",
"1",
",",
"nextCell",
",",
"endIndex",
")",
";",
"}",
"// this path did not find a match.",
"return",
"false",
";",
"}",
"// no wildcard here, try the non-wildcard path",
"FilterCell",
"nextCell",
"=",
"cell",
".",
"findNextCell",
"(",
"address",
"[",
"index",
"]",
")",
";",
"if",
"(",
"nextCell",
"!=",
"null",
")",
"{",
"if",
"(",
"index",
"==",
"endIndex",
")",
"{",
"// this path found a match, unwind returning true",
"return",
"true",
";",
"}",
"// ok so far, recursively search this path",
"return",
"findInList",
"(",
"address",
",",
"index",
"+",
"1",
",",
"nextCell",
",",
"endIndex",
")",
";",
"}",
"// this path did not find a match.",
"return",
"false",
";",
"}"
] | Determine, recursively, if an address, represented by an integer array, is
in the address tree
@param address
integer array representing the address, leftmost number
in the address should start at array offset 0. IPv4 address should
be
padded LEFT with zeroes.
@param index
the next index in the address array of the number to match against
the tree.
@param cell
the current cell in the tree that we are matching against
@param endIndex
the last index in the address array that we need to match
@return true if this address is found in the address tree, false if
it is not. | [
"Determine",
"recursively",
"if",
"an",
"address",
"represented",
"by",
"an",
"integer",
"array",
"is",
"in",
"the",
"address",
"tree"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java#L270-L311 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/CheckInstrumentableClassAdapter.java | CheckInstrumentableClassAdapter.isInstrumentableMethod | public boolean isInstrumentableMethod(int access, String methodName, String descriptor) {
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
return false;
}
if ((access & Opcodes.ACC_NATIVE) != 0) {
return false;
}
if ((access & Opcodes.ACC_ABSTRACT) != 0) {
return false;
}
if (methodName.equals("toString") && descriptor.equals("()Ljava/lang/String;")) {
return false;
}
if (methodName.equals("hashCode") && descriptor.equals("()I")) {
return false;
}
return true;
} | java | public boolean isInstrumentableMethod(int access, String methodName, String descriptor) {
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
return false;
}
if ((access & Opcodes.ACC_NATIVE) != 0) {
return false;
}
if ((access & Opcodes.ACC_ABSTRACT) != 0) {
return false;
}
if (methodName.equals("toString") && descriptor.equals("()Ljava/lang/String;")) {
return false;
}
if (methodName.equals("hashCode") && descriptor.equals("()I")) {
return false;
}
return true;
} | [
"public",
"boolean",
"isInstrumentableMethod",
"(",
"int",
"access",
",",
"String",
"methodName",
",",
"String",
"descriptor",
")",
"{",
"if",
"(",
"(",
"access",
"&",
"Opcodes",
".",
"ACC_SYNTHETIC",
")",
"!=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"(",
"access",
"&",
"Opcodes",
".",
"ACC_NATIVE",
")",
"!=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"(",
"access",
"&",
"Opcodes",
".",
"ACC_ABSTRACT",
")",
"!=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"methodName",
".",
"equals",
"(",
"\"toString\"",
")",
"&&",
"descriptor",
".",
"equals",
"(",
"\"()Ljava/lang/String;\"",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"methodName",
".",
"equals",
"(",
"\"hashCode\"",
")",
"&&",
"descriptor",
".",
"equals",
"(",
"\"()I\"",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Indicate whether or not the target method is instrumentable.
@param access
the method property flags
@param methodName
the name of the method
@return true if the method is not synthetic, is not native, and is
not named toString or hashCode. | [
"Indicate",
"whether",
"or",
"not",
"the",
"target",
"method",
"is",
"instrumentable",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/CheckInstrumentableClassAdapter.java#L108-L125 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtBadMPConfigAsSystemProperties.java | MPJwtBadMPConfigAsSystemProperties.MPJwtBadMPConfigAsSystemProperties_GoodMpJwtConfigSpecifiedInServerXml | @Mode(TestMode.LITE)
@Test
public void MPJwtBadMPConfigAsSystemProperties_GoodMpJwtConfigSpecifiedInServerXml() throws Exception {
resourceServer.reconfigureServerUsingExpandedConfiguration(_testName, "rs_server_AltConfigNotInApp_goodServerXmlConfig.xml");
standardTestFlow(resourceServer, MpJwtFatConstants.NO_MP_CONFIG_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.NO_MP_CONFIG_IN_APP_APP, MpJwtFatConstants.MPJWT_APP_CLASS_NO_MP_CONFIG_IN_APP);
} | java | @Mode(TestMode.LITE)
@Test
public void MPJwtBadMPConfigAsSystemProperties_GoodMpJwtConfigSpecifiedInServerXml() throws Exception {
resourceServer.reconfigureServerUsingExpandedConfiguration(_testName, "rs_server_AltConfigNotInApp_goodServerXmlConfig.xml");
standardTestFlow(resourceServer, MpJwtFatConstants.NO_MP_CONFIG_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.NO_MP_CONFIG_IN_APP_APP, MpJwtFatConstants.MPJWT_APP_CLASS_NO_MP_CONFIG_IN_APP);
} | [
"@",
"Mode",
"(",
"TestMode",
".",
"LITE",
")",
"@",
"Test",
"public",
"void",
"MPJwtBadMPConfigAsSystemProperties_GoodMpJwtConfigSpecifiedInServerXml",
"(",
")",
"throws",
"Exception",
"{",
"resourceServer",
".",
"reconfigureServerUsingExpandedConfiguration",
"(",
"_testName",
",",
"\"rs_server_AltConfigNotInApp_goodServerXmlConfig.xml\"",
")",
";",
"standardTestFlow",
"(",
"resourceServer",
",",
"MpJwtFatConstants",
".",
"NO_MP_CONFIG_IN_APP_ROOT_CONTEXT",
",",
"MpJwtFatConstants",
".",
"NO_MP_CONFIG_IN_APP_APP",
",",
"MpJwtFatConstants",
".",
"MPJWT_APP_CLASS_NO_MP_CONFIG_IN_APP",
")",
";",
"}"
] | The server will be started with all mp-config properties incorrectly configured in the jvm.options file.
The server.xml has a valid mp_jwt config specified.
The config settings should come from server.xml.
The test should run successfully .
@throws Exception | [
"The",
"server",
"will",
"be",
"started",
"with",
"all",
"mp",
"-",
"config",
"properties",
"incorrectly",
"configured",
"in",
"the",
"jvm",
".",
"options",
"file",
".",
"The",
"server",
".",
"xml",
"has",
"a",
"valid",
"mp_jwt",
"config",
"specified",
".",
"The",
"config",
"settings",
"should",
"come",
"from",
"server",
".",
"xml",
".",
"The",
"test",
"should",
"run",
"successfully",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/MPJwtBadMPConfigAsSystemProperties.java#L67-L75 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java | PartitionedStepControllerImpl.stop | @Override
@FFDCIgnore(JobExecutionNotRunningException.class)
public void stop() {
StopLock stopLock = getStopLock(); // Store in local variable to facilitate Ctrl+Shift+G search in Eclipse
synchronized (stopLock) {
if (isStepStartingOrStarted()) {
updateStepBatchStatus(BatchStatus.STOPPING);
// It's possible we may try to stop a partitioned step before any
// sub steps have been started.
// Note: in multi-jvm mode parallelBatchWorkUnits will be empty (sub-jobs may not be
// running locally, so no easy way to stop them).
// TODO: could queue stopPartition thru JMS i suppose...).
for (BatchPartitionWorkUnit subJob : parallelBatchWorkUnits) {
try {
getBatchKernelService().stopWorkUnit(subJob);
} catch (JobExecutionNotRunningException e) {
logger.fine("Caught exception trying to stop work unit: " + subJob + ", which was not running.");
// We want to stop all running sub steps.
// We do not want to throw an exception if a sub step has already been completed.
} catch (Exception e) {
// Blow up if it happens to force the issue.
throw new IllegalStateException(e);
}
}
} else {
// Might not be set up yet to have a state.
logger.fine("Ignoring stop, since step not in a state which has a valid status (might not be far enough along to have a state yet)");
}
}
} | java | @Override
@FFDCIgnore(JobExecutionNotRunningException.class)
public void stop() {
StopLock stopLock = getStopLock(); // Store in local variable to facilitate Ctrl+Shift+G search in Eclipse
synchronized (stopLock) {
if (isStepStartingOrStarted()) {
updateStepBatchStatus(BatchStatus.STOPPING);
// It's possible we may try to stop a partitioned step before any
// sub steps have been started.
// Note: in multi-jvm mode parallelBatchWorkUnits will be empty (sub-jobs may not be
// running locally, so no easy way to stop them).
// TODO: could queue stopPartition thru JMS i suppose...).
for (BatchPartitionWorkUnit subJob : parallelBatchWorkUnits) {
try {
getBatchKernelService().stopWorkUnit(subJob);
} catch (JobExecutionNotRunningException e) {
logger.fine("Caught exception trying to stop work unit: " + subJob + ", which was not running.");
// We want to stop all running sub steps.
// We do not want to throw an exception if a sub step has already been completed.
} catch (Exception e) {
// Blow up if it happens to force the issue.
throw new IllegalStateException(e);
}
}
} else {
// Might not be set up yet to have a state.
logger.fine("Ignoring stop, since step not in a state which has a valid status (might not be far enough along to have a state yet)");
}
}
} | [
"@",
"Override",
"@",
"FFDCIgnore",
"(",
"JobExecutionNotRunningException",
".",
"class",
")",
"public",
"void",
"stop",
"(",
")",
"{",
"StopLock",
"stopLock",
"=",
"getStopLock",
"(",
")",
";",
"// Store in local variable to facilitate Ctrl+Shift+G search in Eclipse",
"synchronized",
"(",
"stopLock",
")",
"{",
"if",
"(",
"isStepStartingOrStarted",
"(",
")",
")",
"{",
"updateStepBatchStatus",
"(",
"BatchStatus",
".",
"STOPPING",
")",
";",
"// It's possible we may try to stop a partitioned step before any",
"// sub steps have been started.",
"// Note: in multi-jvm mode parallelBatchWorkUnits will be empty (sub-jobs may not be",
"// running locally, so no easy way to stop them).",
"// TODO: could queue stopPartition thru JMS i suppose...).",
"for",
"(",
"BatchPartitionWorkUnit",
"subJob",
":",
"parallelBatchWorkUnits",
")",
"{",
"try",
"{",
"getBatchKernelService",
"(",
")",
".",
"stopWorkUnit",
"(",
"subJob",
")",
";",
"}",
"catch",
"(",
"JobExecutionNotRunningException",
"e",
")",
"{",
"logger",
".",
"fine",
"(",
"\"Caught exception trying to stop work unit: \"",
"+",
"subJob",
"+",
"\", which was not running.\"",
")",
";",
"// We want to stop all running sub steps.",
"// We do not want to throw an exception if a sub step has already been completed.",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// Blow up if it happens to force the issue.",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"}",
"}",
"else",
"{",
"// Might not be set up yet to have a state.",
"logger",
".",
"fine",
"(",
"\"Ignoring stop, since step not in a state which has a valid status (might not be far enough along to have a state yet)\"",
")",
";",
"}",
"}",
"}"
] | The body of this method is synchronized with startPartition to close timing windows
so that a new partition doesn't get started after this method has gone thru
and stopped all currently running partitions. | [
"The",
"body",
"of",
"this",
"method",
"is",
"synchronized",
"with",
"startPartition",
"to",
"close",
"timing",
"windows",
"so",
"that",
"a",
"new",
"partition",
"doesn",
"t",
"get",
"started",
"after",
"this",
"method",
"has",
"gone",
"thru",
"and",
"stopped",
"all",
"currently",
"running",
"partitions",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java#L194-L227 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java | PartitionedStepControllerImpl.setExecutionTypeIfNotSet | private void setExecutionTypeIfNotSet(ExecutionType executionType) {
if (this.executionType == null) {
logger.finer("Setting initial execution type value");
this.executionType = executionType;
} else {
logger.finer("Not setting execution type value since it's already set");
}
} | java | private void setExecutionTypeIfNotSet(ExecutionType executionType) {
if (this.executionType == null) {
logger.finer("Setting initial execution type value");
this.executionType = executionType;
} else {
logger.finer("Not setting execution type value since it's already set");
}
} | [
"private",
"void",
"setExecutionTypeIfNotSet",
"(",
"ExecutionType",
"executionType",
")",
"{",
"if",
"(",
"this",
".",
"executionType",
"==",
"null",
")",
"{",
"logger",
".",
"finer",
"(",
"\"Setting initial execution type value\"",
")",
";",
"this",
".",
"executionType",
"=",
"executionType",
";",
"}",
"else",
"{",
"logger",
".",
"finer",
"(",
"\"Not setting execution type value since it's already set\"",
")",
";",
"}",
"}"
] | We could be more aggressive about validating illegal states and throwing exceptions here. | [
"We",
"could",
"be",
"more",
"aggressive",
"about",
"validating",
"illegal",
"states",
"and",
"throwing",
"exceptions",
"here",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java#L380-L387 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java | PartitionedStepControllerImpl.validatePlanNumberOfPartitions | private void validatePlanNumberOfPartitions(PartitionPlanDescriptor currentPlan) {
int numPreviousPartitions = getTopLevelStepInstance().getPartitionPlanSize();
int numCurrentPartitions = currentPlan.getNumPartitionsInPlan();
if (logger.isLoggable(Level.FINE)) {
logger.fine("For step: " + getStepName() + ", previous num partitions = " + numPreviousPartitions + ", and current num partitions = " + numCurrentPartitions);
}
if (executionType == ExecutionType.RESTART_NORMAL) {
if (numPreviousPartitions == EntityConstants.PARTITION_PLAN_SIZE_UNINITIALIZED) {
logger.fine("For step: " + getStepName() + ", previous num partitions has not been initialized, so don't validate the current plan size against it");
} else if (numCurrentPartitions != numPreviousPartitions) {
throw new IllegalArgumentException("Partition not configured for override, and previous execution used " + numPreviousPartitions +
" number of partitions, while current plan uses a different number: " + numCurrentPartitions);
}
}
if (numCurrentPartitions < 1) {
throw new IllegalArgumentException("Partition plan size is calculated as " + numCurrentPartitions + ", but at least one partition is needed.");
}
} | java | private void validatePlanNumberOfPartitions(PartitionPlanDescriptor currentPlan) {
int numPreviousPartitions = getTopLevelStepInstance().getPartitionPlanSize();
int numCurrentPartitions = currentPlan.getNumPartitionsInPlan();
if (logger.isLoggable(Level.FINE)) {
logger.fine("For step: " + getStepName() + ", previous num partitions = " + numPreviousPartitions + ", and current num partitions = " + numCurrentPartitions);
}
if (executionType == ExecutionType.RESTART_NORMAL) {
if (numPreviousPartitions == EntityConstants.PARTITION_PLAN_SIZE_UNINITIALIZED) {
logger.fine("For step: " + getStepName() + ", previous num partitions has not been initialized, so don't validate the current plan size against it");
} else if (numCurrentPartitions != numPreviousPartitions) {
throw new IllegalArgumentException("Partition not configured for override, and previous execution used " + numPreviousPartitions +
" number of partitions, while current plan uses a different number: " + numCurrentPartitions);
}
}
if (numCurrentPartitions < 1) {
throw new IllegalArgumentException("Partition plan size is calculated as " + numCurrentPartitions + ", but at least one partition is needed.");
}
} | [
"private",
"void",
"validatePlanNumberOfPartitions",
"(",
"PartitionPlanDescriptor",
"currentPlan",
")",
"{",
"int",
"numPreviousPartitions",
"=",
"getTopLevelStepInstance",
"(",
")",
".",
"getPartitionPlanSize",
"(",
")",
";",
"int",
"numCurrentPartitions",
"=",
"currentPlan",
".",
"getNumPartitionsInPlan",
"(",
")",
";",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"logger",
".",
"fine",
"(",
"\"For step: \"",
"+",
"getStepName",
"(",
")",
"+",
"\", previous num partitions = \"",
"+",
"numPreviousPartitions",
"+",
"\", and current num partitions = \"",
"+",
"numCurrentPartitions",
")",
";",
"}",
"if",
"(",
"executionType",
"==",
"ExecutionType",
".",
"RESTART_NORMAL",
")",
"{",
"if",
"(",
"numPreviousPartitions",
"==",
"EntityConstants",
".",
"PARTITION_PLAN_SIZE_UNINITIALIZED",
")",
"{",
"logger",
".",
"fine",
"(",
"\"For step: \"",
"+",
"getStepName",
"(",
")",
"+",
"\", previous num partitions has not been initialized, so don't validate the current plan size against it\"",
")",
";",
"}",
"else",
"if",
"(",
"numCurrentPartitions",
"!=",
"numPreviousPartitions",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Partition not configured for override, and previous execution used \"",
"+",
"numPreviousPartitions",
"+",
"\" number of partitions, while current plan uses a different number: \"",
"+",
"numCurrentPartitions",
")",
";",
"}",
"}",
"if",
"(",
"numCurrentPartitions",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Partition plan size is calculated as \"",
"+",
"numCurrentPartitions",
"+",
"\", but at least one partition is needed.\"",
")",
";",
"}",
"}"
] | Verify the number of partitions in the plan makes sense.
@throws IllegalArgumentException if it doesn't make sense. | [
"Verify",
"the",
"number",
"of",
"partitions",
"in",
"the",
"plan",
"makes",
"sense",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java#L465-L486 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java | PartitionedStepControllerImpl.isStoppingStoppedOrFailed | private boolean isStoppingStoppedOrFailed() {
BatchStatus jobBatchStatus = runtimeWorkUnitExecution.getBatchStatus();
if (jobBatchStatus.equals(BatchStatus.STOPPING) || jobBatchStatus.equals(BatchStatus.STOPPED) || jobBatchStatus.equals(BatchStatus.FAILED)) {
return true;
}
return false;
} | java | private boolean isStoppingStoppedOrFailed() {
BatchStatus jobBatchStatus = runtimeWorkUnitExecution.getBatchStatus();
if (jobBatchStatus.equals(BatchStatus.STOPPING) || jobBatchStatus.equals(BatchStatus.STOPPED) || jobBatchStatus.equals(BatchStatus.FAILED)) {
return true;
}
return false;
} | [
"private",
"boolean",
"isStoppingStoppedOrFailed",
"(",
")",
"{",
"BatchStatus",
"jobBatchStatus",
"=",
"runtimeWorkUnitExecution",
".",
"getBatchStatus",
"(",
")",
";",
"if",
"(",
"jobBatchStatus",
".",
"equals",
"(",
"BatchStatus",
".",
"STOPPING",
")",
"||",
"jobBatchStatus",
".",
"equals",
"(",
"BatchStatus",
".",
"STOPPED",
")",
"||",
"jobBatchStatus",
".",
"equals",
"(",
"BatchStatus",
".",
"FAILED",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Today we know the PartitionedStepControllerImpl always runs in the JVM of the top-level job, and so
will be notified on the top-level stop.
Doing xJVM split-flow would be more complicated, since not only do we lose the single JVM for
the top-level job, the split and the child flows........we also can't count on the top-level
portion of the partition, the PartitionedStepControllerImpl, being in the same JVM as the
top-level job.
If we add xJVM split-flow.. not only do we have to worry about the flows themselves...we also have to recode
some assumptions for partitions... since the partitioned step might be itself part of a split-flow.
Note we also might have to worry about ensuring the STEP-level status was moved to STOPPING if we
were only checking the job level status remotely (see defect 203063).
We could just check the DB.. but I guess we don't have to for now.
@return true if the job is stopping, stopped, or failed. | [
"Today",
"we",
"know",
"the",
"PartitionedStepControllerImpl",
"always",
"runs",
"in",
"the",
"JVM",
"of",
"the",
"top",
"-",
"level",
"job",
"and",
"so",
"will",
"be",
"notified",
"on",
"the",
"top",
"-",
"level",
"stop",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java#L567-L574 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java | PartitionedStepControllerImpl.partitionFinished | private void partitionFinished(PartitionReplyMsg msg) {
JoblogUtil.logToJobLogAndTraceOnly(Level.FINE, "partition.ended", new Object[] {
msg.getPartitionPlanConfig().getPartitionNumber(),
msg.getBatchStatus(),
msg.getExitStatus(),
msg.getPartitionPlanConfig().getStepName(),
msg.getPartitionPlanConfig().getTopLevelNameInstanceExecutionInfo().getInstanceId(),
msg.getPartitionPlanConfig().getTopLevelNameInstanceExecutionInfo().getExecutionId() },
logger);
finishedWork.add(msg);
} | java | private void partitionFinished(PartitionReplyMsg msg) {
JoblogUtil.logToJobLogAndTraceOnly(Level.FINE, "partition.ended", new Object[] {
msg.getPartitionPlanConfig().getPartitionNumber(),
msg.getBatchStatus(),
msg.getExitStatus(),
msg.getPartitionPlanConfig().getStepName(),
msg.getPartitionPlanConfig().getTopLevelNameInstanceExecutionInfo().getInstanceId(),
msg.getPartitionPlanConfig().getTopLevelNameInstanceExecutionInfo().getExecutionId() },
logger);
finishedWork.add(msg);
} | [
"private",
"void",
"partitionFinished",
"(",
"PartitionReplyMsg",
"msg",
")",
"{",
"JoblogUtil",
".",
"logToJobLogAndTraceOnly",
"(",
"Level",
".",
"FINE",
",",
"\"partition.ended\"",
",",
"new",
"Object",
"[",
"]",
"{",
"msg",
".",
"getPartitionPlanConfig",
"(",
")",
".",
"getPartitionNumber",
"(",
")",
",",
"msg",
".",
"getBatchStatus",
"(",
")",
",",
"msg",
".",
"getExitStatus",
"(",
")",
",",
"msg",
".",
"getPartitionPlanConfig",
"(",
")",
".",
"getStepName",
"(",
")",
",",
"msg",
".",
"getPartitionPlanConfig",
"(",
")",
".",
"getTopLevelNameInstanceExecutionInfo",
"(",
")",
".",
"getInstanceId",
"(",
")",
",",
"msg",
".",
"getPartitionPlanConfig",
"(",
")",
".",
"getTopLevelNameInstanceExecutionInfo",
"(",
")",
".",
"getExecutionId",
"(",
")",
"}",
",",
"logger",
")",
";",
"finishedWork",
".",
"add",
"(",
"msg",
")",
";",
"}"
] | Issue message for partition finished and add it to the finishedWork list. | [
"Issue",
"message",
"for",
"partition",
"finished",
"and",
"add",
"it",
"to",
"the",
"finishedWork",
"list",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java#L666-L678 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java | PartitionedStepControllerImpl.waitForNextPartitionToFinish | private void waitForNextPartitionToFinish(List<Throwable> analyzerExceptions, List<Integer> finishedPartitions) throws JobStoppingException {
//Use this counter to count the number of cycles we recieve jms reply message
boolean isStoppingStoppedOrFailed = false;
PartitionReplyMsg msg = null;
do {
//TODO - We won't worry about local dispatch until we're prepated to code up
// the structure necessary to break free from waiting on the BlockingQueue
if (isMultiJvm) {
if (isStoppingStoppedOrFailed()) {
isStoppingStoppedOrFailed = true;
}
}
//This will only be triggered when stop issued
if (isStoppingStoppedOrFailed) {
//TODO - Crude, and the JVM doesn't have to follow this too closely.
// The idea is to give the partitions some time complete so we can report with
// a more tidy final status.
// Another idea would be to start a timer or do the first wait with a receive.
//
try {
Thread.sleep(PartitionReplyTimeoutConstants.BATCH_REPLY_MSG_SLEEP_AFTER_STOP);
} catch (InterruptedException e) {
// do nothing
}
while (true) {
//Get the message from the replyToQueue
msg = waitForPartitionReplyMsgNoWait();
//If no messages left, break the loop
if (msg != null) {
try {
processPartitionReplyMsg(msg);
} catch (Throwable t) {
// FFDC.
// Remember the exception for rollback later.
analyzerExceptions.add(t);
}
//check if last message received, and process it.
receivedLastMessageForPartition(msg, finishedPartitions);
} else {
throw new JobStoppingException();
}
}
} else {
//This is executed when stop has not been issued
msg = waitForPartitionReplyMsg();
//If waitForPartitionReplyMsg times out after 15 seconds, go back to the top and check
//if stop has been issued or not
if (msg == null) {
continue;
}
}
//This should never be executed while msg == null cause it the loop would have been broken or continued
try {
processPartitionReplyMsg(msg);
} catch (Throwable t) {
// FFDC.
// Remember the exception for rollback later.
analyzerExceptions.add(t);
}
} while (msg == null || !receivedLastMessageForPartition(msg, finishedPartitions));
} | java | private void waitForNextPartitionToFinish(List<Throwable> analyzerExceptions, List<Integer> finishedPartitions) throws JobStoppingException {
//Use this counter to count the number of cycles we recieve jms reply message
boolean isStoppingStoppedOrFailed = false;
PartitionReplyMsg msg = null;
do {
//TODO - We won't worry about local dispatch until we're prepated to code up
// the structure necessary to break free from waiting on the BlockingQueue
if (isMultiJvm) {
if (isStoppingStoppedOrFailed()) {
isStoppingStoppedOrFailed = true;
}
}
//This will only be triggered when stop issued
if (isStoppingStoppedOrFailed) {
//TODO - Crude, and the JVM doesn't have to follow this too closely.
// The idea is to give the partitions some time complete so we can report with
// a more tidy final status.
// Another idea would be to start a timer or do the first wait with a receive.
//
try {
Thread.sleep(PartitionReplyTimeoutConstants.BATCH_REPLY_MSG_SLEEP_AFTER_STOP);
} catch (InterruptedException e) {
// do nothing
}
while (true) {
//Get the message from the replyToQueue
msg = waitForPartitionReplyMsgNoWait();
//If no messages left, break the loop
if (msg != null) {
try {
processPartitionReplyMsg(msg);
} catch (Throwable t) {
// FFDC.
// Remember the exception for rollback later.
analyzerExceptions.add(t);
}
//check if last message received, and process it.
receivedLastMessageForPartition(msg, finishedPartitions);
} else {
throw new JobStoppingException();
}
}
} else {
//This is executed when stop has not been issued
msg = waitForPartitionReplyMsg();
//If waitForPartitionReplyMsg times out after 15 seconds, go back to the top and check
//if stop has been issued or not
if (msg == null) {
continue;
}
}
//This should never be executed while msg == null cause it the loop would have been broken or continued
try {
processPartitionReplyMsg(msg);
} catch (Throwable t) {
// FFDC.
// Remember the exception for rollback later.
analyzerExceptions.add(t);
}
} while (msg == null || !receivedLastMessageForPartition(msg, finishedPartitions));
} | [
"private",
"void",
"waitForNextPartitionToFinish",
"(",
"List",
"<",
"Throwable",
">",
"analyzerExceptions",
",",
"List",
"<",
"Integer",
">",
"finishedPartitions",
")",
"throws",
"JobStoppingException",
"{",
"//Use this counter to count the number of cycles we recieve jms reply message",
"boolean",
"isStoppingStoppedOrFailed",
"=",
"false",
";",
"PartitionReplyMsg",
"msg",
"=",
"null",
";",
"do",
"{",
"//TODO - We won't worry about local dispatch until we're prepated to code up",
"// the structure necessary to break free from waiting on the BlockingQueue",
"if",
"(",
"isMultiJvm",
")",
"{",
"if",
"(",
"isStoppingStoppedOrFailed",
"(",
")",
")",
"{",
"isStoppingStoppedOrFailed",
"=",
"true",
";",
"}",
"}",
"//This will only be triggered when stop issued",
"if",
"(",
"isStoppingStoppedOrFailed",
")",
"{",
"//TODO - Crude, and the JVM doesn't have to follow this too closely.",
"// The idea is to give the partitions some time complete so we can report with",
"// a more tidy final status.",
"// Another idea would be to start a timer or do the first wait with a receive.",
"//",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"PartitionReplyTimeoutConstants",
".",
"BATCH_REPLY_MSG_SLEEP_AFTER_STOP",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"// do nothing",
"}",
"while",
"(",
"true",
")",
"{",
"//Get the message from the replyToQueue",
"msg",
"=",
"waitForPartitionReplyMsgNoWait",
"(",
")",
";",
"//If no messages left, break the loop",
"if",
"(",
"msg",
"!=",
"null",
")",
"{",
"try",
"{",
"processPartitionReplyMsg",
"(",
"msg",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"// FFDC.",
"// Remember the exception for rollback later.",
"analyzerExceptions",
".",
"add",
"(",
"t",
")",
";",
"}",
"//check if last message received, and process it.",
"receivedLastMessageForPartition",
"(",
"msg",
",",
"finishedPartitions",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"JobStoppingException",
"(",
")",
";",
"}",
"}",
"}",
"else",
"{",
"//This is executed when stop has not been issued",
"msg",
"=",
"waitForPartitionReplyMsg",
"(",
")",
";",
"//If waitForPartitionReplyMsg times out after 15 seconds, go back to the top and check",
"//if stop has been issued or not",
"if",
"(",
"msg",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"}",
"//This should never be executed while msg == null cause it the loop would have been broken or continued",
"try",
"{",
"processPartitionReplyMsg",
"(",
"msg",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"// FFDC.",
"// Remember the exception for rollback later.",
"analyzerExceptions",
".",
"add",
"(",
"t",
")",
";",
"}",
"}",
"while",
"(",
"msg",
"==",
"null",
"||",
"!",
"receivedLastMessageForPartition",
"(",
"msg",
",",
"finishedPartitions",
")",
")",
";",
"}"
] | Wait and process the data sent back by the partitions.
This method returns as soon as the next partition sends back an "i'm finished" message.
@param analyzerExceptions collects any exceptions thrown by the user-supplied Analyzer
@param finishedPartitions
@return the partition number of the finished partition | [
"Wait",
"and",
"process",
"the",
"data",
"sent",
"back",
"by",
"the",
"partitions",
".",
"This",
"method",
"returns",
"as",
"soon",
"as",
"the",
"next",
"partition",
"sends",
"back",
"an",
"i",
"m",
"finished",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java#L754-L821 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java | PartitionedStepControllerImpl.executeAndWaitForCompletion | @FFDCIgnore(JobStoppingException.class)
private void executeAndWaitForCompletion(PartitionPlanDescriptor currentPlan) throws JobRestartException {
if (isStoppingStoppedOrFailed()) {
logger.fine("Job already in "
+ runtimeWorkUnitExecution.getWorkUnitJobContext().getBatchStatus().toString()
+ " state, exiting from executeAndWaitForCompletion() before beginning execution");
return;
}
List<Integer> partitionsToExecute = getPartitionNumbersToExecute(currentPlan);
logger.fine("Partitions to execute in this run: " + partitionsToExecute
+ ". Total number of partitions in step: " + currentPlan.getNumPartitionsInPlan());
List<Integer> startedPartitions = new ArrayList<Integer>();
List<Integer> finishedPartitions = new ArrayList<Integer>();
List<Throwable> analyzerExceptions = new ArrayList<Throwable>();
// Keep looping until all partitions have finished.
while (finishedPartitions.size() < partitionsToExecute.size()) {
startPartitions(partitionsToExecute, startedPartitions, finishedPartitions, currentPlan);
// Check that there are still un-finished partitions running.
// If not, break out of the loop.
if (finishedPartitions.size() >= partitionsToExecute.size()) {
break;
}
//Break this loop when nextPartitionFinished is -1
try {
waitForNextPartitionToFinish(analyzerExceptions, finishedPartitions);
} catch (JobStoppingException e) {
// break the loop
break;
}
}
if (!analyzerExceptions.isEmpty()) {
rollbackPartitionedStep();
throw new BatchContainerRuntimeException("Exception previously thrown by Analyzer, rolling back step.", analyzerExceptions.get(0));
}
} | java | @FFDCIgnore(JobStoppingException.class)
private void executeAndWaitForCompletion(PartitionPlanDescriptor currentPlan) throws JobRestartException {
if (isStoppingStoppedOrFailed()) {
logger.fine("Job already in "
+ runtimeWorkUnitExecution.getWorkUnitJobContext().getBatchStatus().toString()
+ " state, exiting from executeAndWaitForCompletion() before beginning execution");
return;
}
List<Integer> partitionsToExecute = getPartitionNumbersToExecute(currentPlan);
logger.fine("Partitions to execute in this run: " + partitionsToExecute
+ ". Total number of partitions in step: " + currentPlan.getNumPartitionsInPlan());
List<Integer> startedPartitions = new ArrayList<Integer>();
List<Integer> finishedPartitions = new ArrayList<Integer>();
List<Throwable> analyzerExceptions = new ArrayList<Throwable>();
// Keep looping until all partitions have finished.
while (finishedPartitions.size() < partitionsToExecute.size()) {
startPartitions(partitionsToExecute, startedPartitions, finishedPartitions, currentPlan);
// Check that there are still un-finished partitions running.
// If not, break out of the loop.
if (finishedPartitions.size() >= partitionsToExecute.size()) {
break;
}
//Break this loop when nextPartitionFinished is -1
try {
waitForNextPartitionToFinish(analyzerExceptions, finishedPartitions);
} catch (JobStoppingException e) {
// break the loop
break;
}
}
if (!analyzerExceptions.isEmpty()) {
rollbackPartitionedStep();
throw new BatchContainerRuntimeException("Exception previously thrown by Analyzer, rolling back step.", analyzerExceptions.get(0));
}
} | [
"@",
"FFDCIgnore",
"(",
"JobStoppingException",
".",
"class",
")",
"private",
"void",
"executeAndWaitForCompletion",
"(",
"PartitionPlanDescriptor",
"currentPlan",
")",
"throws",
"JobRestartException",
"{",
"if",
"(",
"isStoppingStoppedOrFailed",
"(",
")",
")",
"{",
"logger",
".",
"fine",
"(",
"\"Job already in \"",
"+",
"runtimeWorkUnitExecution",
".",
"getWorkUnitJobContext",
"(",
")",
".",
"getBatchStatus",
"(",
")",
".",
"toString",
"(",
")",
"+",
"\" state, exiting from executeAndWaitForCompletion() before beginning execution\"",
")",
";",
"return",
";",
"}",
"List",
"<",
"Integer",
">",
"partitionsToExecute",
"=",
"getPartitionNumbersToExecute",
"(",
"currentPlan",
")",
";",
"logger",
".",
"fine",
"(",
"\"Partitions to execute in this run: \"",
"+",
"partitionsToExecute",
"+",
"\". Total number of partitions in step: \"",
"+",
"currentPlan",
".",
"getNumPartitionsInPlan",
"(",
")",
")",
";",
"List",
"<",
"Integer",
">",
"startedPartitions",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
")",
";",
"List",
"<",
"Integer",
">",
"finishedPartitions",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
")",
";",
"List",
"<",
"Throwable",
">",
"analyzerExceptions",
"=",
"new",
"ArrayList",
"<",
"Throwable",
">",
"(",
")",
";",
"// Keep looping until all partitions have finished.",
"while",
"(",
"finishedPartitions",
".",
"size",
"(",
")",
"<",
"partitionsToExecute",
".",
"size",
"(",
")",
")",
"{",
"startPartitions",
"(",
"partitionsToExecute",
",",
"startedPartitions",
",",
"finishedPartitions",
",",
"currentPlan",
")",
";",
"// Check that there are still un-finished partitions running.",
"// If not, break out of the loop.",
"if",
"(",
"finishedPartitions",
".",
"size",
"(",
")",
">=",
"partitionsToExecute",
".",
"size",
"(",
")",
")",
"{",
"break",
";",
"}",
"//Break this loop when nextPartitionFinished is -1",
"try",
"{",
"waitForNextPartitionToFinish",
"(",
"analyzerExceptions",
",",
"finishedPartitions",
")",
";",
"}",
"catch",
"(",
"JobStoppingException",
"e",
")",
"{",
"// break the loop",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"analyzerExceptions",
".",
"isEmpty",
"(",
")",
")",
"{",
"rollbackPartitionedStep",
"(",
")",
";",
"throw",
"new",
"BatchContainerRuntimeException",
"(",
"\"Exception previously thrown by Analyzer, rolling back step.\"",
",",
"analyzerExceptions",
".",
"get",
"(",
"0",
")",
")",
";",
"}",
"}"
] | Spawn the partitions and wait for them to complete. | [
"Spawn",
"the",
"partitions",
"and",
"wait",
"for",
"them",
"to",
"complete",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java#L858-L900 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java | PartitionedStepControllerImpl.checkFinishedPartitions | private void checkFinishedPartitions() {
List<String> failingPartitionSeen = new ArrayList<String>();
boolean stoppedPartitionSeen = false;
for (PartitionReplyMsg replyMsg : finishedWork) {
BatchStatus batchStatus = replyMsg.getBatchStatus();
if (logger.isLoggable(Level.FINE)) {
logger.fine("For partitioned step: " + getStepName() + ", the partition # " +
replyMsg.getPartitionPlanConfig().getPartitionNumber() + " ended with status '" + batchStatus);
}
// Keep looping, just to see the log messages perhaps.
if (batchStatus.equals(BatchStatus.FAILED)) {
String msg = "For partitioned step: " + getStepName() + ", the partition # " +
replyMsg.getPartitionPlanConfig().getPartitionNumber() + " ended with status '" + batchStatus;
failingPartitionSeen.add(msg);
}
// This code seems to suggest it might be valid for a partition to end up in STOPPED state without
// the "top-level" step having been aware of this. It's unclear from the spec if this is even possible
// or a desirable spec interpretation. Nevertheless, we'll code it as such noting the ambiguity.
//
// However, in the RI at least, we won't bother updating the step level BatchStatus, since to date we
// would only transition the status in such a way independently.
if (batchStatus.equals(BatchStatus.STOPPED)) {
stoppedPartitionSeen = true;
}
}
if (!failingPartitionSeen.isEmpty()) {
markStepForFailure();
rollbackPartitionedStep();
throw new BatchContainerRuntimeException("One or more partitions failed: " + failingPartitionSeen);
} else if (isStoppingStoppedOrFailed()) {
rollbackPartitionedStep();
} else if (stoppedPartitionSeen) {
// At this point, the top-level job is still running.
// If we see a stopped partition, we mark the step/job failed
markStepForFailure();
rollbackPartitionedStep();
} else {
// Call before completion
if (this.partitionReducerProxy != null) {
this.partitionReducerProxy.beforePartitionedStepCompletion();
}
}
} | java | private void checkFinishedPartitions() {
List<String> failingPartitionSeen = new ArrayList<String>();
boolean stoppedPartitionSeen = false;
for (PartitionReplyMsg replyMsg : finishedWork) {
BatchStatus batchStatus = replyMsg.getBatchStatus();
if (logger.isLoggable(Level.FINE)) {
logger.fine("For partitioned step: " + getStepName() + ", the partition # " +
replyMsg.getPartitionPlanConfig().getPartitionNumber() + " ended with status '" + batchStatus);
}
// Keep looping, just to see the log messages perhaps.
if (batchStatus.equals(BatchStatus.FAILED)) {
String msg = "For partitioned step: " + getStepName() + ", the partition # " +
replyMsg.getPartitionPlanConfig().getPartitionNumber() + " ended with status '" + batchStatus;
failingPartitionSeen.add(msg);
}
// This code seems to suggest it might be valid for a partition to end up in STOPPED state without
// the "top-level" step having been aware of this. It's unclear from the spec if this is even possible
// or a desirable spec interpretation. Nevertheless, we'll code it as such noting the ambiguity.
//
// However, in the RI at least, we won't bother updating the step level BatchStatus, since to date we
// would only transition the status in such a way independently.
if (batchStatus.equals(BatchStatus.STOPPED)) {
stoppedPartitionSeen = true;
}
}
if (!failingPartitionSeen.isEmpty()) {
markStepForFailure();
rollbackPartitionedStep();
throw new BatchContainerRuntimeException("One or more partitions failed: " + failingPartitionSeen);
} else if (isStoppingStoppedOrFailed()) {
rollbackPartitionedStep();
} else if (stoppedPartitionSeen) {
// At this point, the top-level job is still running.
// If we see a stopped partition, we mark the step/job failed
markStepForFailure();
rollbackPartitionedStep();
} else {
// Call before completion
if (this.partitionReducerProxy != null) {
this.partitionReducerProxy.beforePartitionedStepCompletion();
}
}
} | [
"private",
"void",
"checkFinishedPartitions",
"(",
")",
"{",
"List",
"<",
"String",
">",
"failingPartitionSeen",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"boolean",
"stoppedPartitionSeen",
"=",
"false",
";",
"for",
"(",
"PartitionReplyMsg",
"replyMsg",
":",
"finishedWork",
")",
"{",
"BatchStatus",
"batchStatus",
"=",
"replyMsg",
".",
"getBatchStatus",
"(",
")",
";",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"logger",
".",
"fine",
"(",
"\"For partitioned step: \"",
"+",
"getStepName",
"(",
")",
"+",
"\", the partition # \"",
"+",
"replyMsg",
".",
"getPartitionPlanConfig",
"(",
")",
".",
"getPartitionNumber",
"(",
")",
"+",
"\" ended with status '\"",
"+",
"batchStatus",
")",
";",
"}",
"// Keep looping, just to see the log messages perhaps.",
"if",
"(",
"batchStatus",
".",
"equals",
"(",
"BatchStatus",
".",
"FAILED",
")",
")",
"{",
"String",
"msg",
"=",
"\"For partitioned step: \"",
"+",
"getStepName",
"(",
")",
"+",
"\", the partition # \"",
"+",
"replyMsg",
".",
"getPartitionPlanConfig",
"(",
")",
".",
"getPartitionNumber",
"(",
")",
"+",
"\" ended with status '\"",
"+",
"batchStatus",
";",
"failingPartitionSeen",
".",
"add",
"(",
"msg",
")",
";",
"}",
"// This code seems to suggest it might be valid for a partition to end up in STOPPED state without",
"// the \"top-level\" step having been aware of this. It's unclear from the spec if this is even possible",
"// or a desirable spec interpretation. Nevertheless, we'll code it as such noting the ambiguity.",
"//",
"// However, in the RI at least, we won't bother updating the step level BatchStatus, since to date we",
"// would only transition the status in such a way independently.",
"if",
"(",
"batchStatus",
".",
"equals",
"(",
"BatchStatus",
".",
"STOPPED",
")",
")",
"{",
"stoppedPartitionSeen",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"!",
"failingPartitionSeen",
".",
"isEmpty",
"(",
")",
")",
"{",
"markStepForFailure",
"(",
")",
";",
"rollbackPartitionedStep",
"(",
")",
";",
"throw",
"new",
"BatchContainerRuntimeException",
"(",
"\"One or more partitions failed: \"",
"+",
"failingPartitionSeen",
")",
";",
"}",
"else",
"if",
"(",
"isStoppingStoppedOrFailed",
"(",
")",
")",
"{",
"rollbackPartitionedStep",
"(",
")",
";",
"}",
"else",
"if",
"(",
"stoppedPartitionSeen",
")",
"{",
"// At this point, the top-level job is still running.",
"// If we see a stopped partition, we mark the step/job failed",
"markStepForFailure",
"(",
")",
";",
"rollbackPartitionedStep",
"(",
")",
";",
"}",
"else",
"{",
"// Call before completion",
"if",
"(",
"this",
".",
"partitionReducerProxy",
"!=",
"null",
")",
"{",
"this",
".",
"partitionReducerProxy",
".",
"beforePartitionedStepCompletion",
"(",
")",
";",
"}",
"}",
"}"
] | check the batch status of each subJob after it's done to see if we need to issue a rollback
start rollback if any have stopped or failed | [
"check",
"the",
"batch",
"status",
"of",
"each",
"subJob",
"after",
"it",
"s",
"done",
"to",
"see",
"if",
"we",
"need",
"to",
"issue",
"a",
"rollback",
"start",
"rollback",
"if",
"any",
"have",
"stopped",
"or",
"failed"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java#L906-L956 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java | PartitionedStepControllerImpl.invokePreStepArtifacts | @Override
protected void invokePreStepArtifacts() {
if (stepListeners != null) {
for (StepListenerProxy listenerProxy : stepListeners) {
// Call beforeStep on all the step listeners
listenerProxy.beforeStep();
}
}
// Invoke the reducer before all parallel steps start (must occur
// before mapper as well)
if (this.partitionReducerProxy != null) {
this.partitionReducerProxy.beginPartitionedStep();
}
} | java | @Override
protected void invokePreStepArtifacts() {
if (stepListeners != null) {
for (StepListenerProxy listenerProxy : stepListeners) {
// Call beforeStep on all the step listeners
listenerProxy.beforeStep();
}
}
// Invoke the reducer before all parallel steps start (must occur
// before mapper as well)
if (this.partitionReducerProxy != null) {
this.partitionReducerProxy.beginPartitionedStep();
}
} | [
"@",
"Override",
"protected",
"void",
"invokePreStepArtifacts",
"(",
")",
"{",
"if",
"(",
"stepListeners",
"!=",
"null",
")",
"{",
"for",
"(",
"StepListenerProxy",
"listenerProxy",
":",
"stepListeners",
")",
"{",
"// Call beforeStep on all the step listeners",
"listenerProxy",
".",
"beforeStep",
"(",
")",
";",
"}",
"}",
"// Invoke the reducer before all parallel steps start (must occur",
"// before mapper as well)",
"if",
"(",
"this",
".",
"partitionReducerProxy",
"!=",
"null",
")",
"{",
"this",
".",
"partitionReducerProxy",
".",
"beginPartitionedStep",
"(",
")",
";",
"}",
"}"
] | Invoke the StepListeners and PartitionReducer. | [
"Invoke",
"the",
"StepListeners",
"and",
"PartitionReducer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java#L1018-L1033 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ResourceUtils.java | ResourceUtils.getClassNameandPath | private static String getClassNameandPath (String className, Path path) {
if (path == null) {
return getClassNameandPath(className, "/");
} else {
return getClassNameandPath(className, path.value());
}
} | java | private static String getClassNameandPath (String className, Path path) {
if (path == null) {
return getClassNameandPath(className, "/");
} else {
return getClassNameandPath(className, path.value());
}
} | [
"private",
"static",
"String",
"getClassNameandPath",
"(",
"String",
"className",
",",
"Path",
"path",
")",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"return",
"getClassNameandPath",
"(",
"className",
",",
"\"/\"",
")",
";",
"}",
"else",
"{",
"return",
"getClassNameandPath",
"(",
"className",
",",
"path",
".",
"value",
"(",
")",
")",
";",
"}",
"}"
] | start Liberty change | [
"start",
"Liberty",
"change"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ResourceUtils.java#L549-L555 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ResourceUtils.java | ResourceUtils.checkMethodDispatcher | private static boolean checkMethodDispatcher(ClassResourceInfo cr) {
if (cr.getMethodDispatcher().getOperationResourceInfos().isEmpty()) {
LOG.warning(new org.apache.cxf.common.i18n.Message("NO_RESOURCE_OP_EXC",
BUNDLE,
cr.getServiceClass().getName()).toString());
return false;
}
return true;
} | java | private static boolean checkMethodDispatcher(ClassResourceInfo cr) {
if (cr.getMethodDispatcher().getOperationResourceInfos().isEmpty()) {
LOG.warning(new org.apache.cxf.common.i18n.Message("NO_RESOURCE_OP_EXC",
BUNDLE,
cr.getServiceClass().getName()).toString());
return false;
}
return true;
} | [
"private",
"static",
"boolean",
"checkMethodDispatcher",
"(",
"ClassResourceInfo",
"cr",
")",
"{",
"if",
"(",
"cr",
".",
"getMethodDispatcher",
"(",
")",
".",
"getOperationResourceInfos",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"LOG",
".",
"warning",
"(",
"new",
"org",
".",
"apache",
".",
"cxf",
".",
"common",
".",
"i18n",
".",
"Message",
"(",
"\"NO_RESOURCE_OP_EXC\"",
",",
"BUNDLE",
",",
"cr",
".",
"getServiceClass",
"(",
")",
".",
"getName",
"(",
")",
")",
".",
"toString",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | end Liberty change | [
"end",
"Liberty",
"change"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ResourceUtils.java#L575-L583 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/PoolManagerImpl.java | PoolManagerImpl.run | public void run()
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.entry(tc, "run");
int numPools;
synchronized (this)
{
if (ivIsCanceled)
{
return;
}
ivIsRunning = true;
numPools = pools.size();
if (numPools > 0)
{
if (numPools > poolArray.length)
{
poolArray = new PoolImplBase[numPools];
}
pools.toArray(poolArray);
}
}
try
{
for (int i = 0; i < poolArray.length && poolArray[i] != null; ++i) // 147140
{
if (poolArray[i].inactive)
{
poolArray[i].periodicDrain();
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setting inactive: " + poolArray[i]);
poolArray[i].inactive = true;
}
// Allow pools to be GC'ed promptly after being removed. PM54417
poolArray[i] = null;
}
} finally
{
synchronized (this)
{
ivIsRunning = false;
if (ivIsCanceled)
{
notify();
}
else if (!pools.isEmpty())
{
startAlarm();
}
else
{
ivScheduledFuture = null;
}
}
}
if (isTraceOn && tc.isDebugEnabled())
Tr.exit(tc, "run");
} | java | public void run()
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.entry(tc, "run");
int numPools;
synchronized (this)
{
if (ivIsCanceled)
{
return;
}
ivIsRunning = true;
numPools = pools.size();
if (numPools > 0)
{
if (numPools > poolArray.length)
{
poolArray = new PoolImplBase[numPools];
}
pools.toArray(poolArray);
}
}
try
{
for (int i = 0; i < poolArray.length && poolArray[i] != null; ++i) // 147140
{
if (poolArray[i].inactive)
{
poolArray[i].periodicDrain();
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setting inactive: " + poolArray[i]);
poolArray[i].inactive = true;
}
// Allow pools to be GC'ed promptly after being removed. PM54417
poolArray[i] = null;
}
} finally
{
synchronized (this)
{
ivIsRunning = false;
if (ivIsCanceled)
{
notify();
}
else if (!pools.isEmpty())
{
startAlarm();
}
else
{
ivScheduledFuture = null;
}
}
}
if (isTraceOn && tc.isDebugEnabled())
Tr.exit(tc, "run");
} | [
"public",
"void",
"run",
"(",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"run\"",
")",
";",
"int",
"numPools",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"ivIsCanceled",
")",
"{",
"return",
";",
"}",
"ivIsRunning",
"=",
"true",
";",
"numPools",
"=",
"pools",
".",
"size",
"(",
")",
";",
"if",
"(",
"numPools",
">",
"0",
")",
"{",
"if",
"(",
"numPools",
">",
"poolArray",
".",
"length",
")",
"{",
"poolArray",
"=",
"new",
"PoolImplBase",
"[",
"numPools",
"]",
";",
"}",
"pools",
".",
"toArray",
"(",
"poolArray",
")",
";",
"}",
"}",
"try",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"poolArray",
".",
"length",
"&&",
"poolArray",
"[",
"i",
"]",
"!=",
"null",
";",
"++",
"i",
")",
"// 147140",
"{",
"if",
"(",
"poolArray",
"[",
"i",
"]",
".",
"inactive",
")",
"{",
"poolArray",
"[",
"i",
"]",
".",
"periodicDrain",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setting inactive: \"",
"+",
"poolArray",
"[",
"i",
"]",
")",
";",
"poolArray",
"[",
"i",
"]",
".",
"inactive",
"=",
"true",
";",
"}",
"// Allow pools to be GC'ed promptly after being removed. PM54417",
"poolArray",
"[",
"i",
"]",
"=",
"null",
";",
"}",
"}",
"finally",
"{",
"synchronized",
"(",
"this",
")",
"{",
"ivIsRunning",
"=",
"false",
";",
"if",
"(",
"ivIsCanceled",
")",
"{",
"notify",
"(",
")",
";",
"}",
"else",
"if",
"(",
"!",
"pools",
".",
"isEmpty",
"(",
")",
")",
"{",
"startAlarm",
"(",
")",
";",
"}",
"else",
"{",
"ivScheduledFuture",
"=",
"null",
";",
"}",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"run\"",
")",
";",
"}"
] | Handle the scavenger alarm. Scan the list of pools and drain
all inactive ones. | [
"Handle",
"the",
"scavenger",
"alarm",
".",
"Scan",
"the",
"list",
"of",
"pools",
"and",
"drain",
"all",
"inactive",
"ones",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/PoolManagerImpl.java#L61-L129 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcPreparedStatement.java | WSJdbcPreparedStatement.addBatch | private Object addBatch(Object implObject, Method method, Object[] args)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException,
SQLException {
Object sqljPstmt = args[0];
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "addBatch", new Object[]
{ this, AdapterUtil.toString(sqljPstmt) });
// Get underlying instance of SQLJPreparedStatement from dynamic proxy
// to avoid java.lang.ClassCastException in addBatch()
if (sqljPstmt != null && Proxy.isProxyClass(sqljPstmt.getClass())) {
InvocationHandler handler = Proxy.getInvocationHandler(sqljPstmt);
if (handler instanceof WSJdbcWrapper)
args = new Object[] { ((WSJdbcWrapper) handler).getJDBCImplObject() };
}
return method.invoke(implObject, args);
} | java | private Object addBatch(Object implObject, Method method, Object[] args)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException,
SQLException {
Object sqljPstmt = args[0];
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "addBatch", new Object[]
{ this, AdapterUtil.toString(sqljPstmt) });
// Get underlying instance of SQLJPreparedStatement from dynamic proxy
// to avoid java.lang.ClassCastException in addBatch()
if (sqljPstmt != null && Proxy.isProxyClass(sqljPstmt.getClass())) {
InvocationHandler handler = Proxy.getInvocationHandler(sqljPstmt);
if (handler instanceof WSJdbcWrapper)
args = new Object[] { ((WSJdbcWrapper) handler).getJDBCImplObject() };
}
return method.invoke(implObject, args);
} | [
"private",
"Object",
"addBatch",
"(",
"Object",
"implObject",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"IllegalAccessException",
",",
"IllegalArgumentException",
",",
"InvocationTargetException",
",",
"SQLException",
"{",
"Object",
"sqljPstmt",
"=",
"args",
"[",
"0",
"]",
";",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"addBatch\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"AdapterUtil",
".",
"toString",
"(",
"sqljPstmt",
")",
"}",
")",
";",
"// Get underlying instance of SQLJPreparedStatement from dynamic proxy",
"// to avoid java.lang.ClassCastException in addBatch()",
"if",
"(",
"sqljPstmt",
"!=",
"null",
"&&",
"Proxy",
".",
"isProxyClass",
"(",
"sqljPstmt",
".",
"getClass",
"(",
")",
")",
")",
"{",
"InvocationHandler",
"handler",
"=",
"Proxy",
".",
"getInvocationHandler",
"(",
"sqljPstmt",
")",
";",
"if",
"(",
"handler",
"instanceof",
"WSJdbcWrapper",
")",
"args",
"=",
"new",
"Object",
"[",
"]",
"{",
"(",
"(",
"WSJdbcWrapper",
")",
"handler",
")",
".",
"getJDBCImplObject",
"(",
")",
"}",
";",
"}",
"return",
"method",
".",
"invoke",
"(",
"implObject",
",",
"args",
")",
";",
"}"
] | Invokes addBatch after replacing the parameter with the DB2 impl object if proxied.
@param implObject the instance on which the operation is invoked.
@param method the method that is invoked.
@param args the parameters to the method.
@throws IllegalAccessException if the method is inaccessible.
@throws IllegalArgumentException if the instance does not have the method or
if the method arguments are not appropriate.
@throws InvocationTargetException if the method raises a checked exception.
@throws SQLException if unable to invoke the method for other reasons.
@return the result of invoking the method. | [
"Invokes",
"addBatch",
"after",
"replacing",
"the",
"parameter",
"with",
"the",
"DB2",
"impl",
"object",
"if",
"proxied",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcPreparedStatement.java#L201-L219 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.