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.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/container/jaxrs/ClaimValueInjectionEndpoint.java | ClaimValueInjectionEndpoint.verifyInjectedOptionalCustomMissing | @GET
@Path("/verifyInjectedOptionalCustomMissing")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject verifyInjectedOptionalCustomMissing() {
boolean pass = false;
String msg;
// custom-missing
Optional<Long> customValue = custom.getValue();
if(customValue == null) {
msg = "custom-missing value is null, FAIL";
}
else if(!customValue.isPresent()) {
msg = "custom-missing PASS";
pass = true;
}
else {
msg = String.format("custom: %s != %s", null, customValue.get());
}
JsonObject result = Json.createObjectBuilder()
.add("pass", pass)
.add("msg", msg)
.build();
return result;
} | java | @GET
@Path("/verifyInjectedOptionalCustomMissing")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject verifyInjectedOptionalCustomMissing() {
boolean pass = false;
String msg;
// custom-missing
Optional<Long> customValue = custom.getValue();
if(customValue == null) {
msg = "custom-missing value is null, FAIL";
}
else if(!customValue.isPresent()) {
msg = "custom-missing PASS";
pass = true;
}
else {
msg = String.format("custom: %s != %s", null, customValue.get());
}
JsonObject result = Json.createObjectBuilder()
.add("pass", pass)
.add("msg", msg)
.build();
return result;
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/verifyInjectedOptionalCustomMissing\"",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"public",
"JsonObject",
"verifyInjectedOptionalCustomMissing",
"(",
")",
"{",
"boolean",
"pass",
"=",
"false",
";",
"String",
"msg",
";",
"// custom-missing",
"Optional",
"<",
"Long",
">",
"customValue",
"=",
"custom",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"customValue",
"==",
"null",
")",
"{",
"msg",
"=",
"\"custom-missing value is null, FAIL\"",
";",
"}",
"else",
"if",
"(",
"!",
"customValue",
".",
"isPresent",
"(",
")",
")",
"{",
"msg",
"=",
"\"custom-missing PASS\"",
";",
"pass",
"=",
"true",
";",
"}",
"else",
"{",
"msg",
"=",
"String",
".",
"format",
"(",
"\"custom: %s != %s\"",
",",
"null",
",",
"customValue",
".",
"get",
"(",
")",
")",
";",
"}",
"JsonObject",
"result",
"=",
"Json",
".",
"createObjectBuilder",
"(",
")",
".",
"add",
"(",
"\"pass\"",
",",
"pass",
")",
".",
"add",
"(",
"\"msg\"",
",",
"msg",
")",
".",
"build",
"(",
")",
";",
"return",
"result",
";",
"}"
] | Verify that values exist and that types match the corresponding Claims enum
@return a series of pass/fail statements regarding the check for each injected claim | [
"Verify",
"that",
"values",
"exist",
"and",
"that",
"types",
"match",
"the",
"corresponding",
"Claims",
"enum"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/container/jaxrs/ClaimValueInjectionEndpoint.java#L249-L272 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/PersonAccount.java | PersonAccount.addExtendedProperty | public static void addExtendedProperty(String propName, String dataType, boolean multiValued, Object defaultValue) {
if (dataType == null || "null".equalsIgnoreCase(dataType))
return;
if (extendedPropertiesDataType.containsKey(propName)) {
Tr.warning(tc, WIMMessageKey.DUPLICATE_PROPERTY_EXTENDED, new Object[] { propName, "PersonAccount" });
return;
}
if (getPropertyNames("PersonAccount").contains(propName)) {
Tr.warning(tc, WIMMessageKey.DUPLICATE_PROPERTY_ENTITY, new Object[] { propName, "PersonAccount" });
return;
}
extendedPropertiesDataType.put(propName, dataType);
if (defaultValue != null)
extendedPropertiesDefaultValue.put(propName, defaultValue);
if (multiValued)
extendedMultiValuedProperties.add(propName);
} | java | public static void addExtendedProperty(String propName, String dataType, boolean multiValued, Object defaultValue) {
if (dataType == null || "null".equalsIgnoreCase(dataType))
return;
if (extendedPropertiesDataType.containsKey(propName)) {
Tr.warning(tc, WIMMessageKey.DUPLICATE_PROPERTY_EXTENDED, new Object[] { propName, "PersonAccount" });
return;
}
if (getPropertyNames("PersonAccount").contains(propName)) {
Tr.warning(tc, WIMMessageKey.DUPLICATE_PROPERTY_ENTITY, new Object[] { propName, "PersonAccount" });
return;
}
extendedPropertiesDataType.put(propName, dataType);
if (defaultValue != null)
extendedPropertiesDefaultValue.put(propName, defaultValue);
if (multiValued)
extendedMultiValuedProperties.add(propName);
} | [
"public",
"static",
"void",
"addExtendedProperty",
"(",
"String",
"propName",
",",
"String",
"dataType",
",",
"boolean",
"multiValued",
",",
"Object",
"defaultValue",
")",
"{",
"if",
"(",
"dataType",
"==",
"null",
"||",
"\"null\"",
".",
"equalsIgnoreCase",
"(",
"dataType",
")",
")",
"return",
";",
"if",
"(",
"extendedPropertiesDataType",
".",
"containsKey",
"(",
"propName",
")",
")",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"WIMMessageKey",
".",
"DUPLICATE_PROPERTY_EXTENDED",
",",
"new",
"Object",
"[",
"]",
"{",
"propName",
",",
"\"PersonAccount\"",
"}",
")",
";",
"return",
";",
"}",
"if",
"(",
"getPropertyNames",
"(",
"\"PersonAccount\"",
")",
".",
"contains",
"(",
"propName",
")",
")",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"WIMMessageKey",
".",
"DUPLICATE_PROPERTY_ENTITY",
",",
"new",
"Object",
"[",
"]",
"{",
"propName",
",",
"\"PersonAccount\"",
"}",
")",
";",
"return",
";",
"}",
"extendedPropertiesDataType",
".",
"put",
"(",
"propName",
",",
"dataType",
")",
";",
"if",
"(",
"defaultValue",
"!=",
"null",
")",
"extendedPropertiesDefaultValue",
".",
"put",
"(",
"propName",
",",
"defaultValue",
")",
";",
"if",
"(",
"multiValued",
")",
"extendedMultiValuedProperties",
".",
"add",
"(",
"propName",
")",
";",
"}"
] | Allows for an extended property, or a property not pre-defined as part of this PersonAccount entity type, to be
added to the PersonAccount entity
@param propName: name of property
<ul><li>allowed object is a {@link String}</li></ul>
@param dataType: Java type of property
<ul><li>allowed object is a {@link String}</li></ul>
@param multiValued: describes if the property is a single valued or multi-valued property
<ul><li>allowed object is a {@link boolean}</li></ul>
@param defaultValue: defines the default value for this property
<ul><li>allowed object is a {@link Object}</li></ul> | [
"Allows",
"for",
"an",
"extended",
"property",
"or",
"a",
"property",
"not",
"pre",
"-",
"defined",
"as",
"part",
"of",
"this",
"PersonAccount",
"entity",
"type",
"to",
"be",
"added",
"to",
"the",
"PersonAccount",
"entity"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/PersonAccount.java#L3239-L3258 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/processor/ModelBuilder.java | ModelBuilder.depluralize | private static String depluralize(String s) {
if (s.endsWith("ies")) {
return s.substring(0, s.length() - 3) + 'y';
}
if (s.endsWith("s")) {
return s.substring(0, s.length() - 1);
}
return s;
} | java | private static String depluralize(String s) {
if (s.endsWith("ies")) {
return s.substring(0, s.length() - 3) + 'y';
}
if (s.endsWith("s")) {
return s.substring(0, s.length() - 1);
}
return s;
} | [
"private",
"static",
"String",
"depluralize",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"s",
".",
"endsWith",
"(",
"\"ies\"",
")",
")",
"{",
"return",
"s",
".",
"substring",
"(",
"0",
",",
"s",
".",
"length",
"(",
")",
"-",
"3",
")",
"+",
"'",
"'",
";",
"}",
"if",
"(",
"s",
".",
"endsWith",
"(",
"\"s\"",
")",
")",
"{",
"return",
"s",
".",
"substring",
"(",
"0",
",",
"s",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"return",
"s",
";",
"}"
] | Convert a string like "abcs" to "abc". | [
"Convert",
"a",
"string",
"like",
"abcs",
"to",
"abc",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/processor/ModelBuilder.java#L296-L304 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/processor/ModelBuilder.java | ModelBuilder.hyphenatedToCamelCase | private static String hyphenatedToCamelCase(String s) {
Matcher m = Pattern.compile("(?:^|-)([a-z])").matcher(s);
StringBuilder b = new StringBuilder();
int last = 0;
for (; m.find(); last = m.end()) {
b.append(s, last, m.start()).append(Character.toUpperCase(m.group(1).charAt(0)));
}
return b.append(s, last, s.length()).toString();
} | java | private static String hyphenatedToCamelCase(String s) {
Matcher m = Pattern.compile("(?:^|-)([a-z])").matcher(s);
StringBuilder b = new StringBuilder();
int last = 0;
for (; m.find(); last = m.end()) {
b.append(s, last, m.start()).append(Character.toUpperCase(m.group(1).charAt(0)));
}
return b.append(s, last, s.length()).toString();
} | [
"private",
"static",
"String",
"hyphenatedToCamelCase",
"(",
"String",
"s",
")",
"{",
"Matcher",
"m",
"=",
"Pattern",
".",
"compile",
"(",
"\"(?:^|-)([a-z])\"",
")",
".",
"matcher",
"(",
"s",
")",
";",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"last",
"=",
"0",
";",
"for",
"(",
";",
"m",
".",
"find",
"(",
")",
";",
"last",
"=",
"m",
".",
"end",
"(",
")",
")",
"{",
"b",
".",
"append",
"(",
"s",
",",
"last",
",",
"m",
".",
"start",
"(",
")",
")",
".",
"append",
"(",
"Character",
".",
"toUpperCase",
"(",
"m",
".",
"group",
"(",
"1",
")",
".",
"charAt",
"(",
"0",
")",
")",
")",
";",
"}",
"return",
"b",
".",
"append",
"(",
"s",
",",
"last",
",",
"s",
".",
"length",
"(",
")",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Convert a string like "abc-def-ghi" to "AbcDefGhi". | [
"Convert",
"a",
"string",
"like",
"abc",
"-",
"def",
"-",
"ghi",
"to",
"AbcDefGhi",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/processor/ModelBuilder.java#L309-L317 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/processor/ModelBuilder.java | ModelBuilder.upperCaseFirstChar | private static String upperCaseFirstChar(String s) {
return Character.toUpperCase(s.charAt(0)) + s.substring(1);
} | java | private static String upperCaseFirstChar(String s) {
return Character.toUpperCase(s.charAt(0)) + s.substring(1);
} | [
"private",
"static",
"String",
"upperCaseFirstChar",
"(",
"String",
"s",
")",
"{",
"return",
"Character",
".",
"toUpperCase",
"(",
"s",
".",
"charAt",
"(",
"0",
")",
")",
"+",
"s",
".",
"substring",
"(",
"1",
")",
";",
"}"
] | Convert a string like "abcDef" to "AbcDef". | [
"Convert",
"a",
"string",
"like",
"abcDef",
"to",
"AbcDef",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/processor/ModelBuilder.java#L322-L324 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/processor/ModelBuilder.java | ModelBuilder.getAnnotationClassValues | private static List<TypeMirror> getAnnotationClassValues(Element member, Annotation annotation, String annotationMemberName) {
for (AnnotationMirror annotationMirror : member.getAnnotationMirrors()) {
if (((TypeElement) annotationMirror.getAnnotationType().asElement()).getQualifiedName().contentEquals(annotation.annotationType().getName())) {
for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : annotationMirror.getElementValues().entrySet()) {
if (entry.getKey().getSimpleName().contentEquals(annotationMemberName)) {
@SuppressWarnings({ "unchecked", "rawtypes" })
List<AnnotationValue> types = (List) entry.getValue().getValue();
TypeMirror[] result = new TypeMirror[types.size()];
for (int i = 0; i < types.size(); i++) {
result[i] = (TypeMirror) types.get(i).getValue();
}
return Arrays.asList(result);
}
}
return Collections.emptyList();
}
}
throw new IllegalStateException(annotation.annotationType().getName() + " not found in " + member);
} | java | private static List<TypeMirror> getAnnotationClassValues(Element member, Annotation annotation, String annotationMemberName) {
for (AnnotationMirror annotationMirror : member.getAnnotationMirrors()) {
if (((TypeElement) annotationMirror.getAnnotationType().asElement()).getQualifiedName().contentEquals(annotation.annotationType().getName())) {
for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : annotationMirror.getElementValues().entrySet()) {
if (entry.getKey().getSimpleName().contentEquals(annotationMemberName)) {
@SuppressWarnings({ "unchecked", "rawtypes" })
List<AnnotationValue> types = (List) entry.getValue().getValue();
TypeMirror[] result = new TypeMirror[types.size()];
for (int i = 0; i < types.size(); i++) {
result[i] = (TypeMirror) types.get(i).getValue();
}
return Arrays.asList(result);
}
}
return Collections.emptyList();
}
}
throw new IllegalStateException(annotation.annotationType().getName() + " not found in " + member);
} | [
"private",
"static",
"List",
"<",
"TypeMirror",
">",
"getAnnotationClassValues",
"(",
"Element",
"member",
",",
"Annotation",
"annotation",
",",
"String",
"annotationMemberName",
")",
"{",
"for",
"(",
"AnnotationMirror",
"annotationMirror",
":",
"member",
".",
"getAnnotationMirrors",
"(",
")",
")",
"{",
"if",
"(",
"(",
"(",
"TypeElement",
")",
"annotationMirror",
".",
"getAnnotationType",
"(",
")",
".",
"asElement",
"(",
")",
")",
".",
"getQualifiedName",
"(",
")",
".",
"contentEquals",
"(",
"annotation",
".",
"annotationType",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"?",
"extends",
"ExecutableElement",
",",
"?",
"extends",
"AnnotationValue",
">",
"entry",
":",
"annotationMirror",
".",
"getElementValues",
"(",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"getKey",
"(",
")",
".",
"getSimpleName",
"(",
")",
".",
"contentEquals",
"(",
"annotationMemberName",
")",
")",
"{",
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"List",
"<",
"AnnotationValue",
">",
"types",
"=",
"(",
"List",
")",
"entry",
".",
"getValue",
"(",
")",
".",
"getValue",
"(",
")",
";",
"TypeMirror",
"[",
"]",
"result",
"=",
"new",
"TypeMirror",
"[",
"types",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"(",
"TypeMirror",
")",
"types",
".",
"get",
"(",
"i",
")",
".",
"getValue",
"(",
")",
";",
"}",
"return",
"Arrays",
".",
"asList",
"(",
"result",
")",
";",
"}",
"}",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"}",
"throw",
"new",
"IllegalStateException",
"(",
"annotation",
".",
"annotationType",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" not found in \"",
"+",
"member",
")",
";",
"}"
] | Return a List of TypeMirror for an annotation on a member. This is a
workaround for JDK-6519115, which causes MirroredTypeException to be
thrown rather than MirroredTypesException. | [
"Return",
"a",
"List",
"of",
"TypeMirror",
"for",
"an",
"annotation",
"on",
"a",
"member",
".",
"This",
"is",
"a",
"workaround",
"for",
"JDK",
"-",
"6519115",
"which",
"causes",
"MirroredTypeException",
"to",
"be",
"thrown",
"rather",
"than",
"MirroredTypesException",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/processor/ModelBuilder.java#L338-L357 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/cdi/view/ViewScopeBeanHolder.java | ViewScopeBeanHolder.getContextualStorage | public ViewScopeContextualStorage getContextualStorage(
BeanManager beanManager, String viewScopeId)
{
ViewScopeContextualStorage contextualStorage = storageMap.get(viewScopeId);
if (contextualStorage == null)
{
synchronized (this)
{
contextualStorage = storageMap.get(viewScopeId);
if (contextualStorage == null)
{
contextualStorage = new ViewScopeContextualStorage(beanManager);
storageMap.put(viewScopeId, contextualStorage);
}
}
}
return contextualStorage;
} | java | public ViewScopeContextualStorage getContextualStorage(
BeanManager beanManager, String viewScopeId)
{
ViewScopeContextualStorage contextualStorage = storageMap.get(viewScopeId);
if (contextualStorage == null)
{
synchronized (this)
{
contextualStorage = storageMap.get(viewScopeId);
if (contextualStorage == null)
{
contextualStorage = new ViewScopeContextualStorage(beanManager);
storageMap.put(viewScopeId, contextualStorage);
}
}
}
return contextualStorage;
} | [
"public",
"ViewScopeContextualStorage",
"getContextualStorage",
"(",
"BeanManager",
"beanManager",
",",
"String",
"viewScopeId",
")",
"{",
"ViewScopeContextualStorage",
"contextualStorage",
"=",
"storageMap",
".",
"get",
"(",
"viewScopeId",
")",
";",
"if",
"(",
"contextualStorage",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"contextualStorage",
"=",
"storageMap",
".",
"get",
"(",
"viewScopeId",
")",
";",
"if",
"(",
"contextualStorage",
"==",
"null",
")",
"{",
"contextualStorage",
"=",
"new",
"ViewScopeContextualStorage",
"(",
"beanManager",
")",
";",
"storageMap",
".",
"put",
"(",
"viewScopeId",
",",
"contextualStorage",
")",
";",
"}",
"}",
"}",
"return",
"contextualStorage",
";",
"}"
] | This method will return the ViewScopeContextualStorage or create a new one
if no one is yet assigned to the current windowId.
@param beanManager we need the CDI {@link BeanManager} for serialisation.
@param windowId the windowId for the current browser tab or window. | [
"This",
"method",
"will",
"return",
"the",
"ViewScopeContextualStorage",
"or",
"create",
"a",
"new",
"one",
"if",
"no",
"one",
"is",
"yet",
"assigned",
"to",
"the",
"current",
"windowId",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/cdi/view/ViewScopeBeanHolder.java#L81-L98 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/ProviderRegistry.java | ProviderRegistry.setProvider | public AuthConfigProvider setProvider(ProviderService providerService) {
AuthConfigProvider authConfigProvider = null;
if (providerService != null) {
authConfigProvider = providerService.getAuthConfigProvider(this);
registerConfigProvider(authConfigProvider, null, null, null);
} else {
removeRegistration(defaultRegistrationID.toString());
}
return authConfigProvider;
} | java | public AuthConfigProvider setProvider(ProviderService providerService) {
AuthConfigProvider authConfigProvider = null;
if (providerService != null) {
authConfigProvider = providerService.getAuthConfigProvider(this);
registerConfigProvider(authConfigProvider, null, null, null);
} else {
removeRegistration(defaultRegistrationID.toString());
}
return authConfigProvider;
} | [
"public",
"AuthConfigProvider",
"setProvider",
"(",
"ProviderService",
"providerService",
")",
"{",
"AuthConfigProvider",
"authConfigProvider",
"=",
"null",
";",
"if",
"(",
"providerService",
"!=",
"null",
")",
"{",
"authConfigProvider",
"=",
"providerService",
".",
"getAuthConfigProvider",
"(",
"this",
")",
";",
"registerConfigProvider",
"(",
"authConfigProvider",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}",
"else",
"{",
"removeRegistration",
"(",
"defaultRegistrationID",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"authConfigProvider",
";",
"}"
] | Called when a Liberty user defined feature provider is set or unset
@param providerService the provider if set, null if unset | [
"Called",
"when",
"a",
"Liberty",
"user",
"defined",
"feature",
"provider",
"is",
"set",
"or",
"unset"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/ProviderRegistry.java#L398-L407 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/SingletonActivationStrategy.java | SingletonActivationStrategy.doActivation | protected BeanO doActivation(EJBThreadData threadData, ContainerTx tx, BeanId beanId,
boolean takeInvocationRef)
throws RemoteException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "doActivation",
new Object[] { tx, beanId,
new Boolean(takeInvocationRef) });
}
BeanO bean = null;
Throwable exception = null;
MasterKey key = new MasterKey(beanId);
boolean activate = false;
boolean pushedCallbackBeanO = false;
try {
synchronized (locks.getLock(key)) {
if ((bean = (BeanO) cache.find(key)) == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Bean not in cache");
bean = beanId.getHome().createBeanO(threadData, tx, beanId); // d630940
pushedCallbackBeanO = true;
cache.insert(key, bean);
bean.ivCacheKey = key; // d199233
activate = true;
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Found bean in cache");
// Set the found BeanO as the 'Callback' BeanO, as this is the
// BeanO that is becoming the active beanO for the thread.
// This will allow methods called by customer code (like Timer
// methods) to determine the state of the BeanO that is making
// the call. d168509
threadData.pushCallbackBeanO(bean); // d630940
pushedCallbackBeanO = true;
}
}
boolean pin = false;
if (activate) {
bean.activate(beanId, tx); // d114677
}
pin = bean.enlist(tx); // d114677
if (takeInvocationRef && pin) {
// We need to take an additional reference
cache.pin(key);
} else if (!takeInvocationRef && !pin) {
// Need to drop reference taken by find or insert
cache.unpin(key);
}
} catch (RemoteException e) {
FFDCFilter.processException(e, CLASS_NAME + ".doActivation", "123", this);
exception = e;
throw e;
} catch (RuntimeException e) {
FFDCFilter.processException(e, CLASS_NAME + ".doActivation", "129", this);
exception = e;
throw e;
} finally {
if (exception != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "doActivation: exception raised", exception);
}
if (exception != null && bean != null)
{
if (pushedCallbackBeanO)
{
threadData.popCallbackBeanO();
}
bean.destroy();
if (activate) {
// Synchronize to insure that a temp pin obtained by getBean
// doesn't cause the remove to fail due to too many pins. PQ53065
synchronized (locks.getLock(key)) {
cache.remove(key, true);
bean.ivCacheKey = null; // d199233
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "doActivation", bean);
}
return bean;
} | java | protected BeanO doActivation(EJBThreadData threadData, ContainerTx tx, BeanId beanId,
boolean takeInvocationRef)
throws RemoteException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "doActivation",
new Object[] { tx, beanId,
new Boolean(takeInvocationRef) });
}
BeanO bean = null;
Throwable exception = null;
MasterKey key = new MasterKey(beanId);
boolean activate = false;
boolean pushedCallbackBeanO = false;
try {
synchronized (locks.getLock(key)) {
if ((bean = (BeanO) cache.find(key)) == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Bean not in cache");
bean = beanId.getHome().createBeanO(threadData, tx, beanId); // d630940
pushedCallbackBeanO = true;
cache.insert(key, bean);
bean.ivCacheKey = key; // d199233
activate = true;
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Found bean in cache");
// Set the found BeanO as the 'Callback' BeanO, as this is the
// BeanO that is becoming the active beanO for the thread.
// This will allow methods called by customer code (like Timer
// methods) to determine the state of the BeanO that is making
// the call. d168509
threadData.pushCallbackBeanO(bean); // d630940
pushedCallbackBeanO = true;
}
}
boolean pin = false;
if (activate) {
bean.activate(beanId, tx); // d114677
}
pin = bean.enlist(tx); // d114677
if (takeInvocationRef && pin) {
// We need to take an additional reference
cache.pin(key);
} else if (!takeInvocationRef && !pin) {
// Need to drop reference taken by find or insert
cache.unpin(key);
}
} catch (RemoteException e) {
FFDCFilter.processException(e, CLASS_NAME + ".doActivation", "123", this);
exception = e;
throw e;
} catch (RuntimeException e) {
FFDCFilter.processException(e, CLASS_NAME + ".doActivation", "129", this);
exception = e;
throw e;
} finally {
if (exception != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "doActivation: exception raised", exception);
}
if (exception != null && bean != null)
{
if (pushedCallbackBeanO)
{
threadData.popCallbackBeanO();
}
bean.destroy();
if (activate) {
// Synchronize to insure that a temp pin obtained by getBean
// doesn't cause the remove to fail due to too many pins. PQ53065
synchronized (locks.getLock(key)) {
cache.remove(key, true);
bean.ivCacheKey = null; // d199233
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "doActivation", bean);
}
return bean;
} | [
"protected",
"BeanO",
"doActivation",
"(",
"EJBThreadData",
"threadData",
",",
"ContainerTx",
"tx",
",",
"BeanId",
"beanId",
",",
"boolean",
"takeInvocationRef",
")",
"throws",
"RemoteException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"doActivation\"",
",",
"new",
"Object",
"[",
"]",
"{",
"tx",
",",
"beanId",
",",
"new",
"Boolean",
"(",
"takeInvocationRef",
")",
"}",
")",
";",
"}",
"BeanO",
"bean",
"=",
"null",
";",
"Throwable",
"exception",
"=",
"null",
";",
"MasterKey",
"key",
"=",
"new",
"MasterKey",
"(",
"beanId",
")",
";",
"boolean",
"activate",
"=",
"false",
";",
"boolean",
"pushedCallbackBeanO",
"=",
"false",
";",
"try",
"{",
"synchronized",
"(",
"locks",
".",
"getLock",
"(",
"key",
")",
")",
"{",
"if",
"(",
"(",
"bean",
"=",
"(",
"BeanO",
")",
"cache",
".",
"find",
"(",
"key",
")",
")",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Bean not in cache\"",
")",
";",
"bean",
"=",
"beanId",
".",
"getHome",
"(",
")",
".",
"createBeanO",
"(",
"threadData",
",",
"tx",
",",
"beanId",
")",
";",
"// d630940",
"pushedCallbackBeanO",
"=",
"true",
";",
"cache",
".",
"insert",
"(",
"key",
",",
"bean",
")",
";",
"bean",
".",
"ivCacheKey",
"=",
"key",
";",
"// d199233",
"activate",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Found bean in cache\"",
")",
";",
"// Set the found BeanO as the 'Callback' BeanO, as this is the",
"// BeanO that is becoming the active beanO for the thread.",
"// This will allow methods called by customer code (like Timer",
"// methods) to determine the state of the BeanO that is making",
"// the call. d168509",
"threadData",
".",
"pushCallbackBeanO",
"(",
"bean",
")",
";",
"// d630940",
"pushedCallbackBeanO",
"=",
"true",
";",
"}",
"}",
"boolean",
"pin",
"=",
"false",
";",
"if",
"(",
"activate",
")",
"{",
"bean",
".",
"activate",
"(",
"beanId",
",",
"tx",
")",
";",
"// d114677",
"}",
"pin",
"=",
"bean",
".",
"enlist",
"(",
"tx",
")",
";",
"// d114677",
"if",
"(",
"takeInvocationRef",
"&&",
"pin",
")",
"{",
"// We need to take an additional reference",
"cache",
".",
"pin",
"(",
"key",
")",
";",
"}",
"else",
"if",
"(",
"!",
"takeInvocationRef",
"&&",
"!",
"pin",
")",
"{",
"// Need to drop reference taken by find or insert",
"cache",
".",
"unpin",
"(",
"key",
")",
";",
"}",
"}",
"catch",
"(",
"RemoteException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".doActivation\"",
",",
"\"123\"",
",",
"this",
")",
";",
"exception",
"=",
"e",
";",
"throw",
"e",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".doActivation\"",
",",
"\"129\"",
",",
"this",
")",
";",
"exception",
"=",
"e",
";",
"throw",
"e",
";",
"}",
"finally",
"{",
"if",
"(",
"exception",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"doActivation: exception raised\"",
",",
"exception",
")",
";",
"}",
"if",
"(",
"exception",
"!=",
"null",
"&&",
"bean",
"!=",
"null",
")",
"{",
"if",
"(",
"pushedCallbackBeanO",
")",
"{",
"threadData",
".",
"popCallbackBeanO",
"(",
")",
";",
"}",
"bean",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"activate",
")",
"{",
"// Synchronize to insure that a temp pin obtained by getBean",
"// doesn't cause the remove to fail due to too many pins. PQ53065",
"synchronized",
"(",
"locks",
".",
"getLock",
"(",
"key",
")",
")",
"{",
"cache",
".",
"remove",
"(",
"key",
",",
"true",
")",
";",
"bean",
".",
"ivCacheKey",
"=",
"null",
";",
"// d199233",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"doActivation\"",
",",
"bean",
")",
";",
"}",
"return",
"bean",
";",
"}"
] | Internal method used by subclasses to activate a bean | [
"Internal",
"method",
"used",
"by",
"subclasses",
"to",
"activate",
"a",
"bean"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/SingletonActivationStrategy.java#L47-L152 | train |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/impl/BatchKernelImpl.java | BatchKernelImpl.startPartition | @Override
public Entry<BatchPartitionWorkUnit, Future<?>> startPartition(PartitionPlanConfig partitionPlanConfig,
Step step,
PartitionReplyQueue partitionReplyQueue,
boolean isRemoteDispatch) {
BatchPartitionWorkUnit workUnit = createPartitionWorkUnit(partitionPlanConfig, step, partitionReplyQueue, isRemoteDispatch);
Future<?> futureWork = runPartition(workUnit);
// TODO: issue "partition.started" message ?
return new AbstractMap.SimpleEntry<BatchPartitionWorkUnit, Future<?>>(workUnit, futureWork);
} | java | @Override
public Entry<BatchPartitionWorkUnit, Future<?>> startPartition(PartitionPlanConfig partitionPlanConfig,
Step step,
PartitionReplyQueue partitionReplyQueue,
boolean isRemoteDispatch) {
BatchPartitionWorkUnit workUnit = createPartitionWorkUnit(partitionPlanConfig, step, partitionReplyQueue, isRemoteDispatch);
Future<?> futureWork = runPartition(workUnit);
// TODO: issue "partition.started" message ?
return new AbstractMap.SimpleEntry<BatchPartitionWorkUnit, Future<?>>(workUnit, futureWork);
} | [
"@",
"Override",
"public",
"Entry",
"<",
"BatchPartitionWorkUnit",
",",
"Future",
"<",
"?",
">",
">",
"startPartition",
"(",
"PartitionPlanConfig",
"partitionPlanConfig",
",",
"Step",
"step",
",",
"PartitionReplyQueue",
"partitionReplyQueue",
",",
"boolean",
"isRemoteDispatch",
")",
"{",
"BatchPartitionWorkUnit",
"workUnit",
"=",
"createPartitionWorkUnit",
"(",
"partitionPlanConfig",
",",
"step",
",",
"partitionReplyQueue",
",",
"isRemoteDispatch",
")",
";",
"Future",
"<",
"?",
">",
"futureWork",
"=",
"runPartition",
"(",
"workUnit",
")",
";",
"// TODO: issue \"partition.started\" message ?",
"return",
"new",
"AbstractMap",
".",
"SimpleEntry",
"<",
"BatchPartitionWorkUnit",
",",
"Future",
"<",
"?",
">",
">",
"(",
"workUnit",
",",
"futureWork",
")",
";",
"}"
] | Create the BatchPartitionWorkUnit and start the sub-job partition thread.
@return A Map Entry with BatchPartitionWorkUnit as key and a Future WorkUnit as value | [
"Create",
"the",
"BatchPartitionWorkUnit",
"and",
"start",
"the",
"sub",
"-",
"job",
"partition",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/impl/BatchKernelImpl.java#L677-L690 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java | JFAPCommunicator.setConversation | protected void setConversation(Conversation conversation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setConversation", conversation);
con = conversation;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setConversation");
} | java | protected void setConversation(Conversation conversation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setConversation", conversation);
con = conversation;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setConversation");
} | [
"protected",
"void",
"setConversation",
"(",
"Conversation",
"conversation",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setConversation\"",
",",
"conversation",
")",
";",
"con",
"=",
"conversation",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setConversation\"",
")",
";",
"}"
] | Sets the Conversation object
@param conversation | [
"Sets",
"the",
"Conversation",
"object"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java#L152-L157 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java | JFAPCommunicator.jfapExchange | protected CommsByteBuffer jfapExchange(CommsByteBuffer buffer,
int sendSegmentType,
int priority,
boolean canPoolOnReceive)
throws SIConnectionDroppedException, SIConnectionLostException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "jfapExchange",
new Object[]{buffer, sendSegmentType, priority, canPoolOnReceive});
boolean success = false;
CommsByteBuffer rcvBuffer = null;
try
{
if (buffer == null)
{
// The data list cannot be null
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("NULL_DATA_LIST_PASSED_IN_SICO1046", null, null)
);
FFDCFilter.processException(e, CLASS_NAME + ".JFAPExchange",
CommsConstants.JFAPCOMMUNICATOR_EXCHANGE_01, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
throw e;
}
int reqNum = getRequestNumber();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "About to Exchange segment "
+ "conversation: "+ con + " "
+ JFapChannelConstants.getSegmentName(sendSegmentType)
+ " - " + sendSegmentType
+ " (0x" + Integer.toHexString(sendSegmentType) + ") "
+ "using request number "
+ reqNum);
SibTr.debug(this, tc, con.getFullSummary());
}
ReceivedData rd = con.exchange(buffer, sendSegmentType, reqNum, priority, canPoolOnReceive);
rcvBuffer = getCommsByteBuffer(rd);
int rcvSegmentType = rcvBuffer.getReceivedDataSegmentType();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Exchange completed successfully. "
+ "Segment returned "
+ JFapChannelConstants.getSegmentName(rcvSegmentType)
+ " - " + rcvSegmentType
+ " (0x" + Integer.toHexString(rcvSegmentType) + ")");
success = true;
}
finally
{
if (!success && TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Exchange failed.");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "jfapExchange", rcvBuffer);
}
return rcvBuffer;
} | java | protected CommsByteBuffer jfapExchange(CommsByteBuffer buffer,
int sendSegmentType,
int priority,
boolean canPoolOnReceive)
throws SIConnectionDroppedException, SIConnectionLostException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "jfapExchange",
new Object[]{buffer, sendSegmentType, priority, canPoolOnReceive});
boolean success = false;
CommsByteBuffer rcvBuffer = null;
try
{
if (buffer == null)
{
// The data list cannot be null
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("NULL_DATA_LIST_PASSED_IN_SICO1046", null, null)
);
FFDCFilter.processException(e, CLASS_NAME + ".JFAPExchange",
CommsConstants.JFAPCOMMUNICATOR_EXCHANGE_01, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
throw e;
}
int reqNum = getRequestNumber();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "About to Exchange segment "
+ "conversation: "+ con + " "
+ JFapChannelConstants.getSegmentName(sendSegmentType)
+ " - " + sendSegmentType
+ " (0x" + Integer.toHexString(sendSegmentType) + ") "
+ "using request number "
+ reqNum);
SibTr.debug(this, tc, con.getFullSummary());
}
ReceivedData rd = con.exchange(buffer, sendSegmentType, reqNum, priority, canPoolOnReceive);
rcvBuffer = getCommsByteBuffer(rd);
int rcvSegmentType = rcvBuffer.getReceivedDataSegmentType();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Exchange completed successfully. "
+ "Segment returned "
+ JFapChannelConstants.getSegmentName(rcvSegmentType)
+ " - " + rcvSegmentType
+ " (0x" + Integer.toHexString(rcvSegmentType) + ")");
success = true;
}
finally
{
if (!success && TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Exchange failed.");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "jfapExchange", rcvBuffer);
}
return rcvBuffer;
} | [
"protected",
"CommsByteBuffer",
"jfapExchange",
"(",
"CommsByteBuffer",
"buffer",
",",
"int",
"sendSegmentType",
",",
"int",
"priority",
",",
"boolean",
"canPoolOnReceive",
")",
"throws",
"SIConnectionDroppedException",
",",
"SIConnectionLostException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"jfapExchange\"",
",",
"new",
"Object",
"[",
"]",
"{",
"buffer",
",",
"sendSegmentType",
",",
"priority",
",",
"canPoolOnReceive",
"}",
")",
";",
"boolean",
"success",
"=",
"false",
";",
"CommsByteBuffer",
"rcvBuffer",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"// The data list cannot be null",
"SIErrorException",
"e",
"=",
"new",
"SIErrorException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"NULL_DATA_LIST_PASSED_IN_SICO1046\"",
",",
"null",
",",
"null",
")",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".JFAPExchange\"",
",",
"CommsConstants",
".",
"JFAPCOMMUNICATOR_EXCHANGE_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"int",
"reqNum",
"=",
"getRequestNumber",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"About to Exchange segment \"",
"+",
"\"conversation: \"",
"+",
"con",
"+",
"\" \"",
"+",
"JFapChannelConstants",
".",
"getSegmentName",
"(",
"sendSegmentType",
")",
"+",
"\" - \"",
"+",
"sendSegmentType",
"+",
"\" (0x\"",
"+",
"Integer",
".",
"toHexString",
"(",
"sendSegmentType",
")",
"+",
"\") \"",
"+",
"\"using request number \"",
"+",
"reqNum",
")",
";",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"con",
".",
"getFullSummary",
"(",
")",
")",
";",
"}",
"ReceivedData",
"rd",
"=",
"con",
".",
"exchange",
"(",
"buffer",
",",
"sendSegmentType",
",",
"reqNum",
",",
"priority",
",",
"canPoolOnReceive",
")",
";",
"rcvBuffer",
"=",
"getCommsByteBuffer",
"(",
"rd",
")",
";",
"int",
"rcvSegmentType",
"=",
"rcvBuffer",
".",
"getReceivedDataSegmentType",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Exchange completed successfully. \"",
"+",
"\"Segment returned \"",
"+",
"JFapChannelConstants",
".",
"getSegmentName",
"(",
"rcvSegmentType",
")",
"+",
"\" - \"",
"+",
"rcvSegmentType",
"+",
"\" (0x\"",
"+",
"Integer",
".",
"toHexString",
"(",
"rcvSegmentType",
")",
"+",
"\")\"",
")",
";",
"success",
"=",
"true",
";",
"}",
"finally",
"{",
"if",
"(",
"!",
"success",
"&&",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Exchange failed.\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"jfapExchange\"",
",",
"rcvBuffer",
")",
";",
"}",
"return",
"rcvBuffer",
";",
"}"
] | Wraps the JFAP Channel exchange method to allow tracing, retrieval
of Unique request numbers and setting of message priority.
@param buffer
@param sendSegmentType
@param priority
@param canPoolOnReceive
@return CommsByteBuffer
@throws SIConnectionDroppedException
@throws SIConnectionLostException | [
"Wraps",
"the",
"JFAP",
"Channel",
"exchange",
"method",
"to",
"allow",
"tracing",
"retrieval",
"of",
"Unique",
"request",
"numbers",
"and",
"setting",
"of",
"message",
"priority",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java#L222-L284 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java | JFAPCommunicator.jfapSend | protected void jfapSend(CommsByteBuffer buffer,
int sendSegType,
int priority,
boolean canPoolOnReceive,
ThrottlingPolicy throttlingPolicy)
throws SIConnectionDroppedException,
SIConnectionLostException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "jfapSend",
new Object[]{buffer, sendSegType, priority, canPoolOnReceive});
if (buffer == null)
{
// The data list cannot be null
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("NULL_DATA_LIST_PASSED_IN_SICO1046", null, null)
);
FFDCFilter.processException(e, CLASS_NAME + ".JFAPSend",
CommsConstants.JFAPCOMMUNICATOR_SEND_01, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
throw e;
}
int reqNum = 0;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "About to Send segment "
+ "conversation: "+ con + " "
+ JFapChannelConstants.getSegmentName(sendSegType)
+ " - " + sendSegType
+ " (0x" + Integer.toHexString(sendSegType) + ") "
+ "using request number "
+ reqNum);
SibTr.debug(this, tc, con.getFullSummary());
}
con.send(buffer, sendSegType, reqNum, priority, canPoolOnReceive, throttlingPolicy, null);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "jfapSend");
} | java | protected void jfapSend(CommsByteBuffer buffer,
int sendSegType,
int priority,
boolean canPoolOnReceive,
ThrottlingPolicy throttlingPolicy)
throws SIConnectionDroppedException,
SIConnectionLostException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "jfapSend",
new Object[]{buffer, sendSegType, priority, canPoolOnReceive});
if (buffer == null)
{
// The data list cannot be null
SIErrorException e = new SIErrorException(
nls.getFormattedMessage("NULL_DATA_LIST_PASSED_IN_SICO1046", null, null)
);
FFDCFilter.processException(e, CLASS_NAME + ".JFAPSend",
CommsConstants.JFAPCOMMUNICATOR_SEND_01, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e);
throw e;
}
int reqNum = 0;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "About to Send segment "
+ "conversation: "+ con + " "
+ JFapChannelConstants.getSegmentName(sendSegType)
+ " - " + sendSegType
+ " (0x" + Integer.toHexString(sendSegType) + ") "
+ "using request number "
+ reqNum);
SibTr.debug(this, tc, con.getFullSummary());
}
con.send(buffer, sendSegType, reqNum, priority, canPoolOnReceive, throttlingPolicy, null);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "jfapSend");
} | [
"protected",
"void",
"jfapSend",
"(",
"CommsByteBuffer",
"buffer",
",",
"int",
"sendSegType",
",",
"int",
"priority",
",",
"boolean",
"canPoolOnReceive",
",",
"ThrottlingPolicy",
"throttlingPolicy",
")",
"throws",
"SIConnectionDroppedException",
",",
"SIConnectionLostException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"jfapSend\"",
",",
"new",
"Object",
"[",
"]",
"{",
"buffer",
",",
"sendSegType",
",",
"priority",
",",
"canPoolOnReceive",
"}",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"// The data list cannot be null",
"SIErrorException",
"e",
"=",
"new",
"SIErrorException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"NULL_DATA_LIST_PASSED_IN_SICO1046\"",
",",
"null",
",",
"null",
")",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".JFAPSend\"",
",",
"CommsConstants",
".",
"JFAPCOMMUNICATOR_SEND_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"throw",
"e",
";",
"}",
"int",
"reqNum",
"=",
"0",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"About to Send segment \"",
"+",
"\"conversation: \"",
"+",
"con",
"+",
"\" \"",
"+",
"JFapChannelConstants",
".",
"getSegmentName",
"(",
"sendSegType",
")",
"+",
"\" - \"",
"+",
"sendSegType",
"+",
"\" (0x\"",
"+",
"Integer",
".",
"toHexString",
"(",
"sendSegType",
")",
"+",
"\") \"",
"+",
"\"using request number \"",
"+",
"reqNum",
")",
";",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"con",
".",
"getFullSummary",
"(",
")",
")",
";",
"}",
"con",
".",
"send",
"(",
"buffer",
",",
"sendSegType",
",",
"reqNum",
",",
"priority",
",",
"canPoolOnReceive",
",",
"throttlingPolicy",
",",
"null",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"jfapSend\"",
")",
";",
"}"
] | Wraps the JFAP Channel send method to allow tracing, retrieval
of Unique request numbers and setting of message priority.
@param sendSegType
@param priority
@param canPoolOnReceive
@throws SIConnectionDroppedException
@throws SIConnectionLostException | [
"Wraps",
"the",
"JFAP",
"Channel",
"send",
"method",
"to",
"allow",
"tracing",
"retrieval",
"of",
"Unique",
"request",
"numbers",
"and",
"setting",
"of",
"message",
"priority",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java#L297-L341 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java | JFAPCommunicator.getClientCapabilities | private short getClientCapabilities()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getClientCapabilities");
short capabilities = CommsConstants.CAPABILITIES_DEFAULT;
// Allow the use of a runtime property to alter the capability that we require a non-java
// bootstrap to locate an ME
boolean nonJavaBootstrap =
CommsUtils.getRuntimeBooleanProperty(CommsConstants.CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP_KEY,
CommsConstants.CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP_DEF);
if (nonJavaBootstrap)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Requesting non-java bootstrap");
// This bit is off by default, so turn it on
capabilities |= CommsConstants.CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP;
}
// Allow the use of a runtime property to alter the capability that we require JMF messages
boolean jmfMessagesOnly =
CommsUtils.getRuntimeBooleanProperty(CommsConstants.CAPABILITIY_REQUIRES_JMF_ENCODING_KEY,
CommsConstants.CAPABILITIY_REQUIRES_JMF_ENCODING_DEF);
if (jmfMessagesOnly)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Requesting JMF Only");
// This bit is off by default, so turn it on
capabilities |= CommsConstants.CAPABILITIY_REQUIRES_JMF_ENCODING;
}
// Allow the use of a runtime property to alter the capability that we require JMS messages
boolean jmsMessagesOnly =
CommsUtils.getRuntimeBooleanProperty(CommsConstants.CAPABILITIY_REQUIRES_JMS_MESSAGES_KEY,
CommsConstants.CAPABILITIY_REQUIRES_JMS_MESSAGES_DEF);
if (jmsMessagesOnly)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Requesting JMS Only");
// This bit is off by default, so turn it on
capabilities |= CommsConstants.CAPABILITIY_REQUIRES_JMS_MESSAGES;
}
// Allow the use of a runtime property to turn off optimized transactions.
boolean disableOptimizedTx =
CommsUtils.getRuntimeBooleanProperty(CommsConstants.DISABLE_OPTIMIZED_TX_KEY,
CommsConstants.DISABLE_OPTIMIZED_TX);
if (disableOptimizedTx)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Disabling use of optimized transactions");
// This bit is set on by default, so we must turn it off
capabilities &= (0xFFFF ^ CommsConstants.CAPABILITIY_REQUIRES_OPTIMIZED_TX);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getClientCapabilities", capabilities);
return capabilities;
} | java | private short getClientCapabilities()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getClientCapabilities");
short capabilities = CommsConstants.CAPABILITIES_DEFAULT;
// Allow the use of a runtime property to alter the capability that we require a non-java
// bootstrap to locate an ME
boolean nonJavaBootstrap =
CommsUtils.getRuntimeBooleanProperty(CommsConstants.CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP_KEY,
CommsConstants.CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP_DEF);
if (nonJavaBootstrap)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Requesting non-java bootstrap");
// This bit is off by default, so turn it on
capabilities |= CommsConstants.CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP;
}
// Allow the use of a runtime property to alter the capability that we require JMF messages
boolean jmfMessagesOnly =
CommsUtils.getRuntimeBooleanProperty(CommsConstants.CAPABILITIY_REQUIRES_JMF_ENCODING_KEY,
CommsConstants.CAPABILITIY_REQUIRES_JMF_ENCODING_DEF);
if (jmfMessagesOnly)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Requesting JMF Only");
// This bit is off by default, so turn it on
capabilities |= CommsConstants.CAPABILITIY_REQUIRES_JMF_ENCODING;
}
// Allow the use of a runtime property to alter the capability that we require JMS messages
boolean jmsMessagesOnly =
CommsUtils.getRuntimeBooleanProperty(CommsConstants.CAPABILITIY_REQUIRES_JMS_MESSAGES_KEY,
CommsConstants.CAPABILITIY_REQUIRES_JMS_MESSAGES_DEF);
if (jmsMessagesOnly)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Requesting JMS Only");
// This bit is off by default, so turn it on
capabilities |= CommsConstants.CAPABILITIY_REQUIRES_JMS_MESSAGES;
}
// Allow the use of a runtime property to turn off optimized transactions.
boolean disableOptimizedTx =
CommsUtils.getRuntimeBooleanProperty(CommsConstants.DISABLE_OPTIMIZED_TX_KEY,
CommsConstants.DISABLE_OPTIMIZED_TX);
if (disableOptimizedTx)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Disabling use of optimized transactions");
// This bit is set on by default, so we must turn it off
capabilities &= (0xFFFF ^ CommsConstants.CAPABILITIY_REQUIRES_OPTIMIZED_TX);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getClientCapabilities", capabilities);
return capabilities;
} | [
"private",
"short",
"getClientCapabilities",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getClientCapabilities\"",
")",
";",
"short",
"capabilities",
"=",
"CommsConstants",
".",
"CAPABILITIES_DEFAULT",
";",
"// Allow the use of a runtime property to alter the capability that we require a non-java",
"// bootstrap to locate an ME",
"boolean",
"nonJavaBootstrap",
"=",
"CommsUtils",
".",
"getRuntimeBooleanProperty",
"(",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP_KEY",
",",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP_DEF",
")",
";",
"if",
"(",
"nonJavaBootstrap",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Requesting non-java bootstrap\"",
")",
";",
"// This bit is off by default, so turn it on",
"capabilities",
"|=",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP",
";",
"}",
"// Allow the use of a runtime property to alter the capability that we require JMF messages",
"boolean",
"jmfMessagesOnly",
"=",
"CommsUtils",
".",
"getRuntimeBooleanProperty",
"(",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_JMF_ENCODING_KEY",
",",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_JMF_ENCODING_DEF",
")",
";",
"if",
"(",
"jmfMessagesOnly",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Requesting JMF Only\"",
")",
";",
"// This bit is off by default, so turn it on",
"capabilities",
"|=",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_JMF_ENCODING",
";",
"}",
"// Allow the use of a runtime property to alter the capability that we require JMS messages",
"boolean",
"jmsMessagesOnly",
"=",
"CommsUtils",
".",
"getRuntimeBooleanProperty",
"(",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_JMS_MESSAGES_KEY",
",",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_JMS_MESSAGES_DEF",
")",
";",
"if",
"(",
"jmsMessagesOnly",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Requesting JMS Only\"",
")",
";",
"// This bit is off by default, so turn it on",
"capabilities",
"|=",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_JMS_MESSAGES",
";",
"}",
"// Allow the use of a runtime property to turn off optimized transactions.",
"boolean",
"disableOptimizedTx",
"=",
"CommsUtils",
".",
"getRuntimeBooleanProperty",
"(",
"CommsConstants",
".",
"DISABLE_OPTIMIZED_TX_KEY",
",",
"CommsConstants",
".",
"DISABLE_OPTIMIZED_TX",
")",
";",
"if",
"(",
"disableOptimizedTx",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Disabling use of optimized transactions\"",
")",
";",
"// This bit is set on by default, so we must turn it off",
"capabilities",
"&=",
"(",
"0xFFFF",
"^",
"CommsConstants",
".",
"CAPABILITIY_REQUIRES_OPTIMIZED_TX",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getClientCapabilities\"",
",",
"capabilities",
")",
";",
"return",
"capabilities",
";",
"}"
] | Works out the capabilities that will be sent to the peer as part of the initial handshake.
This also takes into account any overrides from the SIB properties file.
@return Returns the capabilities. | [
"Works",
"out",
"the",
"capabilities",
"that",
"will",
"be",
"sent",
"to",
"the",
"peer",
"as",
"part",
"of",
"the",
"initial",
"handshake",
".",
"This",
"also",
"takes",
"into",
"account",
"any",
"overrides",
"from",
"the",
"SIB",
"properties",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java#L903-L960 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java | JFAPCommunicator.defaultChecker | public void defaultChecker(CommsByteBuffer buffer, short exceptionCode)
throws SIErrorException
{
if (exceptionCode != CommsConstants.SI_NO_EXCEPTION)
{
throw new SIErrorException(buffer.getException(con));
}
} | java | public void defaultChecker(CommsByteBuffer buffer, short exceptionCode)
throws SIErrorException
{
if (exceptionCode != CommsConstants.SI_NO_EXCEPTION)
{
throw new SIErrorException(buffer.getException(con));
}
} | [
"public",
"void",
"defaultChecker",
"(",
"CommsByteBuffer",
"buffer",
",",
"short",
"exceptionCode",
")",
"throws",
"SIErrorException",
"{",
"if",
"(",
"exceptionCode",
"!=",
"CommsConstants",
".",
"SI_NO_EXCEPTION",
")",
"{",
"throw",
"new",
"SIErrorException",
"(",
"buffer",
".",
"getException",
"(",
"con",
")",
")",
";",
"}",
"}"
] | The default checker. Should always be called last after all the checkers.
@param buffer
@param exceptionCode
@throws SIErrorException if the exception code is <strong>not</strong>
the enumerated value for "throw no exception". | [
"The",
"default",
"checker",
".",
"Should",
"always",
"be",
"called",
"last",
"after",
"all",
"the",
"checkers",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java#L1415-L1422 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java | JFAPCommunicator.invalidateConnection | protected void invalidateConnection(boolean notifyPeer, Throwable throwable, String debugReason)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "invalidateConnection", new Object[]{new Boolean(notifyPeer),
throwable,
debugReason});
if (con != null)
{
ConnectionInterface connection = con.getConnectionReference();
if (connection != null)
{
connection.invalidate(notifyPeer, throwable, debugReason);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "invalidateConnection");
} | java | protected void invalidateConnection(boolean notifyPeer, Throwable throwable, String debugReason)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "invalidateConnection", new Object[]{new Boolean(notifyPeer),
throwable,
debugReason});
if (con != null)
{
ConnectionInterface connection = con.getConnectionReference();
if (connection != null)
{
connection.invalidate(notifyPeer, throwable, debugReason);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "invalidateConnection");
} | [
"protected",
"void",
"invalidateConnection",
"(",
"boolean",
"notifyPeer",
",",
"Throwable",
"throwable",
",",
"String",
"debugReason",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"invalidateConnection\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Boolean",
"(",
"notifyPeer",
")",
",",
"throwable",
",",
"debugReason",
"}",
")",
";",
"if",
"(",
"con",
"!=",
"null",
")",
"{",
"ConnectionInterface",
"connection",
"=",
"con",
".",
"getConnectionReference",
"(",
")",
";",
"if",
"(",
"connection",
"!=",
"null",
")",
"{",
"connection",
".",
"invalidate",
"(",
"notifyPeer",
",",
"throwable",
",",
"debugReason",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"invalidateConnection\"",
")",
";",
"}"
] | Utility method to invalidate Connection. Parameters passed to ConnectionInterface.invalidate
@param notifyPeer
@param throwable
@param debugReason | [
"Utility",
"method",
"to",
"invalidate",
"Connection",
".",
"Parameters",
"passed",
"to",
"ConnectionInterface",
".",
"invalidate"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java#L1430-L1444 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java | SibRaMessagingEngineConnection.createListener | SibRaListener createListener(final SIDestinationAddress destination, MessageEndpointFactory messageEndpointFactory)
throws ResourceException {
final String methodName = "createListener";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] { destination, messageEndpointFactory });
}
if (_closed) {
throw new IllegalStateException(NLS
.getString("LISTENER_CLOSED_CWSIV0952"));
}
final SibRaListener listener;
listener = new SibRaSingleProcessListener(this, destination, messageEndpointFactory);
_listeners.put(destination, listener);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName, listener);
}
return listener;
} | java | SibRaListener createListener(final SIDestinationAddress destination, MessageEndpointFactory messageEndpointFactory)
throws ResourceException {
final String methodName = "createListener";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] { destination, messageEndpointFactory });
}
if (_closed) {
throw new IllegalStateException(NLS
.getString("LISTENER_CLOSED_CWSIV0952"));
}
final SibRaListener listener;
listener = new SibRaSingleProcessListener(this, destination, messageEndpointFactory);
_listeners.put(destination, listener);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName, listener);
}
return listener;
} | [
"SibRaListener",
"createListener",
"(",
"final",
"SIDestinationAddress",
"destination",
",",
"MessageEndpointFactory",
"messageEndpointFactory",
")",
"throws",
"ResourceException",
"{",
"final",
"String",
"methodName",
"=",
"\"createListener\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"new",
"Object",
"[",
"]",
"{",
"destination",
",",
"messageEndpointFactory",
"}",
")",
";",
"}",
"if",
"(",
"_closed",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"NLS",
".",
"getString",
"(",
"\"LISTENER_CLOSED_CWSIV0952\"",
")",
")",
";",
"}",
"final",
"SibRaListener",
"listener",
";",
"listener",
"=",
"new",
"SibRaSingleProcessListener",
"(",
"this",
",",
"destination",
",",
"messageEndpointFactory",
")",
";",
"_listeners",
".",
"put",
"(",
"destination",
",",
"listener",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"listener",
")",
";",
"}",
"return",
"listener",
";",
"}"
] | Creates a new listener to the given destination.
@param destination
the destination to listen to
@return a listener
@throws ResourceException
if the creation fails | [
"Creates",
"a",
"new",
"listener",
"to",
"the",
"given",
"destination",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java#L661-L686 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java | SibRaMessagingEngineConnection.createDispatcher | SibRaDispatcher createDispatcher(final AbstractConsumerSession session,
final Reliability unrecoveredReliability,
final int maxFailedDeliveries,
final int sequentialFailureThreshold)
throws ResourceException {
final String methodName = "createDispatcher";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName,
new Object[] { session, unrecoveredReliability, maxFailedDeliveries, sequentialFailureThreshold });
}
if (_closed) {
throw new IllegalStateException(NLS
.getString("LISTENER_CLOSED_CWSIV0953"));
}
final SibRaDispatcher dispatcher;
if (_endpointActivation.isEndpointMethodTransactional()) {
if (_endpointConfiguration.getShareDataSourceWithCMP()) {
dispatcher = new SibRaSynchronizedDispatcher(this,
session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries,
sequentialFailureThreshold);
} else {
dispatcher = new SibRaTransactionalDispatcher(this,
session, _endpointActivation, _busName, unrecoveredReliability, maxFailedDeliveries,
sequentialFailureThreshold);
}
} else {
if (SibRaMessageDeletionMode.BATCH.equals(_endpointConfiguration
.getMessageDeletionMode())) {
dispatcher = new SibRaBatchMessageDeletionDispatcher(
this, session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries,
sequentialFailureThreshold);
} else if (SibRaMessageDeletionMode.SINGLE
.equals(_endpointConfiguration.getMessageDeletionMode())) {
dispatcher = new SibRaSingleMessageDeletionDispatcher(
this, session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries,
sequentialFailureThreshold);
} else {
dispatcher = new SibRaNonTransactionalDispatcher(this,
session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries,
sequentialFailureThreshold);
}
}
_dispatcherCount.incrementAndGet();
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "Creating a dispatcher, there are now " + _dispatcherCount.get() + " open dispatchers");
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName, dispatcher);
}
return dispatcher;
} | java | SibRaDispatcher createDispatcher(final AbstractConsumerSession session,
final Reliability unrecoveredReliability,
final int maxFailedDeliveries,
final int sequentialFailureThreshold)
throws ResourceException {
final String methodName = "createDispatcher";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName,
new Object[] { session, unrecoveredReliability, maxFailedDeliveries, sequentialFailureThreshold });
}
if (_closed) {
throw new IllegalStateException(NLS
.getString("LISTENER_CLOSED_CWSIV0953"));
}
final SibRaDispatcher dispatcher;
if (_endpointActivation.isEndpointMethodTransactional()) {
if (_endpointConfiguration.getShareDataSourceWithCMP()) {
dispatcher = new SibRaSynchronizedDispatcher(this,
session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries,
sequentialFailureThreshold);
} else {
dispatcher = new SibRaTransactionalDispatcher(this,
session, _endpointActivation, _busName, unrecoveredReliability, maxFailedDeliveries,
sequentialFailureThreshold);
}
} else {
if (SibRaMessageDeletionMode.BATCH.equals(_endpointConfiguration
.getMessageDeletionMode())) {
dispatcher = new SibRaBatchMessageDeletionDispatcher(
this, session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries,
sequentialFailureThreshold);
} else if (SibRaMessageDeletionMode.SINGLE
.equals(_endpointConfiguration.getMessageDeletionMode())) {
dispatcher = new SibRaSingleMessageDeletionDispatcher(
this, session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries,
sequentialFailureThreshold);
} else {
dispatcher = new SibRaNonTransactionalDispatcher(this,
session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries,
sequentialFailureThreshold);
}
}
_dispatcherCount.incrementAndGet();
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "Creating a dispatcher, there are now " + _dispatcherCount.get() + " open dispatchers");
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName, dispatcher);
}
return dispatcher;
} | [
"SibRaDispatcher",
"createDispatcher",
"(",
"final",
"AbstractConsumerSession",
"session",
",",
"final",
"Reliability",
"unrecoveredReliability",
",",
"final",
"int",
"maxFailedDeliveries",
",",
"final",
"int",
"sequentialFailureThreshold",
")",
"throws",
"ResourceException",
"{",
"final",
"String",
"methodName",
"=",
"\"createDispatcher\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"new",
"Object",
"[",
"]",
"{",
"session",
",",
"unrecoveredReliability",
",",
"maxFailedDeliveries",
",",
"sequentialFailureThreshold",
"}",
")",
";",
"}",
"if",
"(",
"_closed",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"NLS",
".",
"getString",
"(",
"\"LISTENER_CLOSED_CWSIV0953\"",
")",
")",
";",
"}",
"final",
"SibRaDispatcher",
"dispatcher",
";",
"if",
"(",
"_endpointActivation",
".",
"isEndpointMethodTransactional",
"(",
")",
")",
"{",
"if",
"(",
"_endpointConfiguration",
".",
"getShareDataSourceWithCMP",
"(",
")",
")",
"{",
"dispatcher",
"=",
"new",
"SibRaSynchronizedDispatcher",
"(",
"this",
",",
"session",
",",
"_endpointActivation",
",",
"unrecoveredReliability",
",",
"maxFailedDeliveries",
",",
"sequentialFailureThreshold",
")",
";",
"}",
"else",
"{",
"dispatcher",
"=",
"new",
"SibRaTransactionalDispatcher",
"(",
"this",
",",
"session",
",",
"_endpointActivation",
",",
"_busName",
",",
"unrecoveredReliability",
",",
"maxFailedDeliveries",
",",
"sequentialFailureThreshold",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"SibRaMessageDeletionMode",
".",
"BATCH",
".",
"equals",
"(",
"_endpointConfiguration",
".",
"getMessageDeletionMode",
"(",
")",
")",
")",
"{",
"dispatcher",
"=",
"new",
"SibRaBatchMessageDeletionDispatcher",
"(",
"this",
",",
"session",
",",
"_endpointActivation",
",",
"unrecoveredReliability",
",",
"maxFailedDeliveries",
",",
"sequentialFailureThreshold",
")",
";",
"}",
"else",
"if",
"(",
"SibRaMessageDeletionMode",
".",
"SINGLE",
".",
"equals",
"(",
"_endpointConfiguration",
".",
"getMessageDeletionMode",
"(",
")",
")",
")",
"{",
"dispatcher",
"=",
"new",
"SibRaSingleMessageDeletionDispatcher",
"(",
"this",
",",
"session",
",",
"_endpointActivation",
",",
"unrecoveredReliability",
",",
"maxFailedDeliveries",
",",
"sequentialFailureThreshold",
")",
";",
"}",
"else",
"{",
"dispatcher",
"=",
"new",
"SibRaNonTransactionalDispatcher",
"(",
"this",
",",
"session",
",",
"_endpointActivation",
",",
"unrecoveredReliability",
",",
"maxFailedDeliveries",
",",
"sequentialFailureThreshold",
")",
";",
"}",
"}",
"_dispatcherCount",
".",
"incrementAndGet",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"TRACE",
",",
"\"Creating a dispatcher, there are now \"",
"+",
"_dispatcherCount",
".",
"get",
"(",
")",
"+",
"\" open dispatchers\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"dispatcher",
")",
";",
"}",
"return",
"dispatcher",
";",
"}"
] | Gets a dispatcher for the given session and messages.
@param session
the session locking the messages
@return the dispatcher
@throws ResourceException
if a dispatcher could not be created | [
"Gets",
"a",
"dispatcher",
"for",
"the",
"given",
"session",
"and",
"messages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java#L697-L770 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java | SibRaMessagingEngineConnection.closeDispatcher | void closeDispatcher(final SibRaDispatcher dispatcher) {
final String methodName = "closeDispatcher";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName);
}
dispatcher.close();
_dispatcherCount.decrementAndGet();
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "Removing a dispatcher - there are " + _dispatcherCount.get() + " left");
}
synchronized (_dispatcherCount) {
_dispatcherCount.notifyAll();
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | java | void closeDispatcher(final SibRaDispatcher dispatcher) {
final String methodName = "closeDispatcher";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName);
}
dispatcher.close();
_dispatcherCount.decrementAndGet();
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "Removing a dispatcher - there are " + _dispatcherCount.get() + " left");
}
synchronized (_dispatcherCount) {
_dispatcherCount.notifyAll();
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | [
"void",
"closeDispatcher",
"(",
"final",
"SibRaDispatcher",
"dispatcher",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"closeDispatcher\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"dispatcher",
".",
"close",
"(",
")",
";",
"_dispatcherCount",
".",
"decrementAndGet",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"TRACE",
",",
"\"Removing a dispatcher - there are \"",
"+",
"_dispatcherCount",
".",
"get",
"(",
")",
"+",
"\" left\"",
")",
";",
"}",
"synchronized",
"(",
"_dispatcherCount",
")",
"{",
"_dispatcherCount",
".",
"notifyAll",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"}"
] | Closes the given dispatcher.
@param dispatcher
the dispatcher to close. | [
"Closes",
"the",
"given",
"dispatcher",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java#L778-L798 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java | SibRaMessagingEngineConnection.close | void close() {
final String methodName = "close";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName);
}
close(false);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | java | void close() {
final String methodName = "close";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName);
}
close(false);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | [
"void",
"close",
"(",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"close\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"close",
"(",
"false",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"}"
] | Closes the connection and any associated listeners and dispatchers | [
"Closes",
"the",
"connection",
"and",
"any",
"associated",
"listeners",
"and",
"dispatchers"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java#L803-L814 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java | SibRaMessagingEngineConnection.close | void close(boolean alreadyClosed) {
final String methodName = "close";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, alreadyClosed);
}
_closed = true;
/*
* 238811:
* Stop all of the listeners - do not close them as the dispatchers
* might still be using them. Close them after the dispatchers have
* stopped.
*/
/*
* We close dispatchers as soon as they are finished with so no longer have to
* close them here.
*/
if (!alreadyClosed) {
for (final Iterator iterator = _listeners.values().iterator(); iterator
.hasNext();) {
final SibRaListener listener = (SibRaListener) iterator.next();
listener.stop();
}
}
// The connection is closing so throw away the connection name
SibRaDispatcher.resetMEName();
// We want this thread to wait until all the dispatchers have finished their work
// (which will happen when the dispatcherCount hits 0. We put the thread into a
// wait state if there are any dispatchers still going, the thread will be notified
// each time a dispatcher closes (when it has finished its work).
synchronized (_dispatcherCount) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "There are still " + _dispatcherCount.get() + " open dispatchers");
}
if (_dispatcherCount.get() > 0) {
Long mdbQuiescingTimeout = getMDBQuiescingTimeoutProperty();
waitForDispatchersToFinish(mdbQuiescingTimeout);
}
}
/*
* Close all of the listeners
*/
if (!alreadyClosed) {
for (final Iterator iterator = _listeners.values().iterator(); iterator
.hasNext();) {
final SibRaListener listener = (SibRaListener) iterator.next();
listener.close();
}
}
_listeners.clear();
/*
* Close the connection
*/
try {
_connection.removeConnectionListener(_connectionListener);
// It should be ok to call close on an already closed connection but comms
// FFDCs thjis (processor seems ok with it though). No need to close the connection
// again anyway so we'll check and if we are being called as part of MeTerminated or
// connectionError then the connection will have been closed so dont close again.
if (!alreadyClosed) {
_connection.close();
}
} catch (final SIException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, "1:1023:1.59", this);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception);
}
} catch (final SIErrorException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, "1:1031:1.59", this);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception);
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | java | void close(boolean alreadyClosed) {
final String methodName = "close";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, alreadyClosed);
}
_closed = true;
/*
* 238811:
* Stop all of the listeners - do not close them as the dispatchers
* might still be using them. Close them after the dispatchers have
* stopped.
*/
/*
* We close dispatchers as soon as they are finished with so no longer have to
* close them here.
*/
if (!alreadyClosed) {
for (final Iterator iterator = _listeners.values().iterator(); iterator
.hasNext();) {
final SibRaListener listener = (SibRaListener) iterator.next();
listener.stop();
}
}
// The connection is closing so throw away the connection name
SibRaDispatcher.resetMEName();
// We want this thread to wait until all the dispatchers have finished their work
// (which will happen when the dispatcherCount hits 0. We put the thread into a
// wait state if there are any dispatchers still going, the thread will be notified
// each time a dispatcher closes (when it has finished its work).
synchronized (_dispatcherCount) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "There are still " + _dispatcherCount.get() + " open dispatchers");
}
if (_dispatcherCount.get() > 0) {
Long mdbQuiescingTimeout = getMDBQuiescingTimeoutProperty();
waitForDispatchersToFinish(mdbQuiescingTimeout);
}
}
/*
* Close all of the listeners
*/
if (!alreadyClosed) {
for (final Iterator iterator = _listeners.values().iterator(); iterator
.hasNext();) {
final SibRaListener listener = (SibRaListener) iterator.next();
listener.close();
}
}
_listeners.clear();
/*
* Close the connection
*/
try {
_connection.removeConnectionListener(_connectionListener);
// It should be ok to call close on an already closed connection but comms
// FFDCs thjis (processor seems ok with it though). No need to close the connection
// again anyway so we'll check and if we are being called as part of MeTerminated or
// connectionError then the connection will have been closed so dont close again.
if (!alreadyClosed) {
_connection.close();
}
} catch (final SIException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, "1:1023:1.59", this);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception);
}
} catch (final SIErrorException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, "1:1031:1.59", this);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception);
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | [
"void",
"close",
"(",
"boolean",
"alreadyClosed",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"close\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"alreadyClosed",
")",
";",
"}",
"_closed",
"=",
"true",
";",
"/*\n * 238811:\n * Stop all of the listeners - do not close them as the dispatchers\n * might still be using them. Close them after the dispatchers have\n * stopped.\n */",
"/*\n * We close dispatchers as soon as they are finished with so no longer have to\n * close them here.\n */",
"if",
"(",
"!",
"alreadyClosed",
")",
"{",
"for",
"(",
"final",
"Iterator",
"iterator",
"=",
"_listeners",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"final",
"SibRaListener",
"listener",
"=",
"(",
"SibRaListener",
")",
"iterator",
".",
"next",
"(",
")",
";",
"listener",
".",
"stop",
"(",
")",
";",
"}",
"}",
"// The connection is closing so throw away the connection name",
"SibRaDispatcher",
".",
"resetMEName",
"(",
")",
";",
"// We want this thread to wait until all the dispatchers have finished their work",
"// (which will happen when the dispatcherCount hits 0. We put the thread into a",
"// wait state if there are any dispatchers still going, the thread will be notified",
"// each time a dispatcher closes (when it has finished its work).",
"synchronized",
"(",
"_dispatcherCount",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"TRACE",
",",
"\"There are still \"",
"+",
"_dispatcherCount",
".",
"get",
"(",
")",
"+",
"\" open dispatchers\"",
")",
";",
"}",
"if",
"(",
"_dispatcherCount",
".",
"get",
"(",
")",
">",
"0",
")",
"{",
"Long",
"mdbQuiescingTimeout",
"=",
"getMDBQuiescingTimeoutProperty",
"(",
")",
";",
"waitForDispatchersToFinish",
"(",
"mdbQuiescingTimeout",
")",
";",
"}",
"}",
"/*\n * Close all of the listeners\n */",
"if",
"(",
"!",
"alreadyClosed",
")",
"{",
"for",
"(",
"final",
"Iterator",
"iterator",
"=",
"_listeners",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"final",
"SibRaListener",
"listener",
"=",
"(",
"SibRaListener",
")",
"iterator",
".",
"next",
"(",
")",
";",
"listener",
".",
"close",
"(",
")",
";",
"}",
"}",
"_listeners",
".",
"clear",
"(",
")",
";",
"/*\n * Close the connection\n */",
"try",
"{",
"_connection",
".",
"removeConnectionListener",
"(",
"_connectionListener",
")",
";",
"// It should be ok to call close on an already closed connection but comms",
"// FFDCs thjis (processor seems ok with it though). No need to close the connection",
"// again anyway so we'll check and if we are being called as part of MeTerminated or",
"// connectionError then the connection will have been closed so dont close again.",
"if",
"(",
"!",
"alreadyClosed",
")",
"{",
"_connection",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"SIException",
"exception",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exception",
",",
"CLASS_NAME",
"+",
"\".\"",
"+",
"methodName",
",",
"\"1:1023:1.59\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exception",
"(",
"this",
",",
"TRACE",
",",
"exception",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"SIErrorException",
"exception",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exception",
",",
"CLASS_NAME",
"+",
"\".\"",
"+",
"methodName",
",",
"\"1:1031:1.59\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exception",
"(",
"this",
",",
"TRACE",
",",
"exception",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"}"
] | Closes this connection and any associated listeners and dispatchers. | [
"Closes",
"this",
"connection",
"and",
"any",
"associated",
"listeners",
"and",
"dispatchers",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java#L819-L915 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java | SibRaMessagingEngineConnection.createConnection | SICoreConnection createConnection(SICoreConnectionFactory factory, String name, String password, Map properties, String busName)
throws SIException, SIErrorException, Exception {
final String methodName = "createConnection";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] { factory, name, "password not traced", properties, busName });
}
SICoreConnection result;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "Creating connection with Userid and password");
}
result = factory.createConnection(name, password, properties);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "createConnection", result);
}
return result;
} | java | SICoreConnection createConnection(SICoreConnectionFactory factory, String name, String password, Map properties, String busName)
throws SIException, SIErrorException, Exception {
final String methodName = "createConnection";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] { factory, name, "password not traced", properties, busName });
}
SICoreConnection result;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "Creating connection with Userid and password");
}
result = factory.createConnection(name, password, properties);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "createConnection", result);
}
return result;
} | [
"SICoreConnection",
"createConnection",
"(",
"SICoreConnectionFactory",
"factory",
",",
"String",
"name",
",",
"String",
"password",
",",
"Map",
"properties",
",",
"String",
"busName",
")",
"throws",
"SIException",
",",
"SIErrorException",
",",
"Exception",
"{",
"final",
"String",
"methodName",
"=",
"\"createConnection\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"new",
"Object",
"[",
"]",
"{",
"factory",
",",
"name",
",",
"\"password not traced\"",
",",
"properties",
",",
"busName",
"}",
")",
";",
"}",
"SICoreConnection",
"result",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"this",
",",
"TRACE",
",",
"\"Creating connection with Userid and password\"",
")",
";",
"}",
"result",
"=",
"factory",
".",
"createConnection",
"(",
"name",
",",
"password",
",",
"properties",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"\"createConnection\"",
",",
"result",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Creates this connection using either the Auth Alias supplied or, if the property is set
the WAS server subject.
@param factory
The SICoreConnectionFactory used to make the connection.
@param name
The userid to use for secure connections
@param password
The password to use for secure connections
@param properties
The Map of properties to use when making the connection
@return the return value is the SICoreConnection object
@throws | [
"Creates",
"this",
"connection",
"using",
"either",
"the",
"Auth",
"Alias",
"supplied",
"or",
"if",
"the",
"property",
"is",
"set",
"the",
"WAS",
"server",
"subject",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java#L991-L1012 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.ready.service/src/com/ibm/ws/security/ready/internal/SecurityReadyServiceImpl.java | SecurityReadyServiceImpl.getUnavailableServices | private String getUnavailableServices() {
StringBuilder missingServices = new StringBuilder();
if (tokenService.getReference() == null) {
missingServices.append("tokenService, ");
}
if (tokenManager.getReference() == null) {
missingServices.append("tokenManager, ");
}
if (authenticationService.getReference() == null) {
missingServices.append("authenticationService, ");
}
if (authorizationService.getReference() == null) {
missingServices.append("authorizationService, ");
}
if (userRegistry.getReference() == null) {
missingServices.append("userRegistry, ");
}
if (userRegistryService.getReference() == null) {
missingServices.append("userRegistryService, ");
}
if (missingServices.length() == 0) {
return null;
} else {
// Return everything but the last ", "
return missingServices.substring(0, missingServices.length() - 2);
}
} | java | private String getUnavailableServices() {
StringBuilder missingServices = new StringBuilder();
if (tokenService.getReference() == null) {
missingServices.append("tokenService, ");
}
if (tokenManager.getReference() == null) {
missingServices.append("tokenManager, ");
}
if (authenticationService.getReference() == null) {
missingServices.append("authenticationService, ");
}
if (authorizationService.getReference() == null) {
missingServices.append("authorizationService, ");
}
if (userRegistry.getReference() == null) {
missingServices.append("userRegistry, ");
}
if (userRegistryService.getReference() == null) {
missingServices.append("userRegistryService, ");
}
if (missingServices.length() == 0) {
return null;
} else {
// Return everything but the last ", "
return missingServices.substring(0, missingServices.length() - 2);
}
} | [
"private",
"String",
"getUnavailableServices",
"(",
")",
"{",
"StringBuilder",
"missingServices",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"tokenService",
".",
"getReference",
"(",
")",
"==",
"null",
")",
"{",
"missingServices",
".",
"append",
"(",
"\"tokenService, \"",
")",
";",
"}",
"if",
"(",
"tokenManager",
".",
"getReference",
"(",
")",
"==",
"null",
")",
"{",
"missingServices",
".",
"append",
"(",
"\"tokenManager, \"",
")",
";",
"}",
"if",
"(",
"authenticationService",
".",
"getReference",
"(",
")",
"==",
"null",
")",
"{",
"missingServices",
".",
"append",
"(",
"\"authenticationService, \"",
")",
";",
"}",
"if",
"(",
"authorizationService",
".",
"getReference",
"(",
")",
"==",
"null",
")",
"{",
"missingServices",
".",
"append",
"(",
"\"authorizationService, \"",
")",
";",
"}",
"if",
"(",
"userRegistry",
".",
"getReference",
"(",
")",
"==",
"null",
")",
"{",
"missingServices",
".",
"append",
"(",
"\"userRegistry, \"",
")",
";",
"}",
"if",
"(",
"userRegistryService",
".",
"getReference",
"(",
")",
"==",
"null",
")",
"{",
"missingServices",
".",
"append",
"(",
"\"userRegistryService, \"",
")",
";",
"}",
"if",
"(",
"missingServices",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"// Return everything but the last \", \"",
"return",
"missingServices",
".",
"substring",
"(",
"0",
",",
"missingServices",
".",
"length",
"(",
")",
"-",
"2",
")",
";",
"}",
"}"
] | Construct a String that lists all of the missing services.
This is very useful for debugging.
@return {@code null} if all services are present, or a non-empty
String if any are missing | [
"Construct",
"a",
"String",
"that",
"lists",
"all",
"of",
"the",
"missing",
"services",
".",
"This",
"is",
"very",
"useful",
"for",
"debugging",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.ready.service/src/com/ibm/ws/security/ready/internal/SecurityReadyServiceImpl.java#L174-L201 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.ready.service/src/com/ibm/ws/security/ready/internal/SecurityReadyServiceImpl.java | SecurityReadyServiceImpl.updateSecurityReadyState | private void updateSecurityReadyState() {
if (!activated) {
return;
}
String unavailableServices = getUnavailableServices();
if (unavailableServices == null) {
Tr.info(tc, "SECURITY_SERVICE_READY");
securityReady = true;
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put("service.vendor", "IBM");
reg = cc.getBundleContext().registerService(SecurityReadyService.class, this, props);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "The following required security services are not available: " + unavailableServices);
}
securityReady = false;
if (reg != null) {
reg.unregister();
reg = null;
}
}
} | java | private void updateSecurityReadyState() {
if (!activated) {
return;
}
String unavailableServices = getUnavailableServices();
if (unavailableServices == null) {
Tr.info(tc, "SECURITY_SERVICE_READY");
securityReady = true;
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put("service.vendor", "IBM");
reg = cc.getBundleContext().registerService(SecurityReadyService.class, this, props);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "The following required security services are not available: " + unavailableServices);
}
securityReady = false;
if (reg != null) {
reg.unregister();
reg = null;
}
}
} | [
"private",
"void",
"updateSecurityReadyState",
"(",
")",
"{",
"if",
"(",
"!",
"activated",
")",
"{",
"return",
";",
"}",
"String",
"unavailableServices",
"=",
"getUnavailableServices",
"(",
")",
";",
"if",
"(",
"unavailableServices",
"==",
"null",
")",
"{",
"Tr",
".",
"info",
"(",
"tc",
",",
"\"SECURITY_SERVICE_READY\"",
")",
";",
"securityReady",
"=",
"true",
";",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"props",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"props",
".",
"put",
"(",
"\"service.vendor\"",
",",
"\"IBM\"",
")",
";",
"reg",
"=",
"cc",
".",
"getBundleContext",
"(",
")",
".",
"registerService",
"(",
"SecurityReadyService",
".",
"class",
",",
"this",
",",
"props",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"The following required security services are not available: \"",
"+",
"unavailableServices",
")",
";",
"}",
"securityReady",
"=",
"false",
";",
"if",
"(",
"reg",
"!=",
"null",
")",
"{",
"reg",
".",
"unregister",
"(",
")",
";",
"reg",
"=",
"null",
";",
"}",
"}",
"}"
] | Security is ready when all of these required services have been registered. | [
"Security",
"is",
"ready",
"when",
"all",
"of",
"these",
"required",
"services",
"have",
"been",
"registered",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.ready.service/src/com/ibm/ws/security/ready/internal/SecurityReadyServiceImpl.java#L206-L229 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ServerXMLConfiguration.java | ServerXMLConfiguration.parseDirectoryFiles | private void parseDirectoryFiles(WsResource directory, ServerConfiguration configuration) throws ConfigParserException, ConfigValidationException {
if (directory != null) {
File[] defaultFiles = getChildXMLFiles(directory);
if (defaultFiles == null)
return;
Arrays.sort(defaultFiles, new AlphaComparator());
for (int i = 0; i < defaultFiles.length; i++) {
File file = defaultFiles[i];
if (!file.isFile())
continue;
WsResource defaultFile = directory.resolveRelative(file.getName());
if (defaultFile == null) {
// This should never happen, but it's conceivable that someone could remove a file
// after listFiles and before getChild
if (tc.isDebugEnabled()) {
Tr.debug(tc, file.getName() + " was not found in directory " + directory.getName() + ". Ignoring. ");
}
continue;
}
Tr.audit(tc, "audit.dropin.being.processed", defaultFile.asFile());
try {
parser.parseServerConfiguration(defaultFile, configuration);
} catch (ConfigParserException ex) {
parser.handleParseError(ex, null);
if (ErrorHandler.INSTANCE.fail()) {
// if onError=FAIL, bubble the exception up the stack
throw ex;
} else {
// Mark the last update for the configuration so that we don't try to load it again
configuration.updateLastModified(configRoot.getLastModified());
}
}
}
}
} | java | private void parseDirectoryFiles(WsResource directory, ServerConfiguration configuration) throws ConfigParserException, ConfigValidationException {
if (directory != null) {
File[] defaultFiles = getChildXMLFiles(directory);
if (defaultFiles == null)
return;
Arrays.sort(defaultFiles, new AlphaComparator());
for (int i = 0; i < defaultFiles.length; i++) {
File file = defaultFiles[i];
if (!file.isFile())
continue;
WsResource defaultFile = directory.resolveRelative(file.getName());
if (defaultFile == null) {
// This should never happen, but it's conceivable that someone could remove a file
// after listFiles and before getChild
if (tc.isDebugEnabled()) {
Tr.debug(tc, file.getName() + " was not found in directory " + directory.getName() + ". Ignoring. ");
}
continue;
}
Tr.audit(tc, "audit.dropin.being.processed", defaultFile.asFile());
try {
parser.parseServerConfiguration(defaultFile, configuration);
} catch (ConfigParserException ex) {
parser.handleParseError(ex, null);
if (ErrorHandler.INSTANCE.fail()) {
// if onError=FAIL, bubble the exception up the stack
throw ex;
} else {
// Mark the last update for the configuration so that we don't try to load it again
configuration.updateLastModified(configRoot.getLastModified());
}
}
}
}
} | [
"private",
"void",
"parseDirectoryFiles",
"(",
"WsResource",
"directory",
",",
"ServerConfiguration",
"configuration",
")",
"throws",
"ConfigParserException",
",",
"ConfigValidationException",
"{",
"if",
"(",
"directory",
"!=",
"null",
")",
"{",
"File",
"[",
"]",
"defaultFiles",
"=",
"getChildXMLFiles",
"(",
"directory",
")",
";",
"if",
"(",
"defaultFiles",
"==",
"null",
")",
"return",
";",
"Arrays",
".",
"sort",
"(",
"defaultFiles",
",",
"new",
"AlphaComparator",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"defaultFiles",
".",
"length",
";",
"i",
"++",
")",
"{",
"File",
"file",
"=",
"defaultFiles",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"file",
".",
"isFile",
"(",
")",
")",
"continue",
";",
"WsResource",
"defaultFile",
"=",
"directory",
".",
"resolveRelative",
"(",
"file",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"defaultFile",
"==",
"null",
")",
"{",
"// This should never happen, but it's conceivable that someone could remove a file",
"// after listFiles and before getChild",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"file",
".",
"getName",
"(",
")",
"+",
"\" was not found in directory \"",
"+",
"directory",
".",
"getName",
"(",
")",
"+",
"\". Ignoring. \"",
")",
";",
"}",
"continue",
";",
"}",
"Tr",
".",
"audit",
"(",
"tc",
",",
"\"audit.dropin.being.processed\"",
",",
"defaultFile",
".",
"asFile",
"(",
")",
")",
";",
"try",
"{",
"parser",
".",
"parseServerConfiguration",
"(",
"defaultFile",
",",
"configuration",
")",
";",
"}",
"catch",
"(",
"ConfigParserException",
"ex",
")",
"{",
"parser",
".",
"handleParseError",
"(",
"ex",
",",
"null",
")",
";",
"if",
"(",
"ErrorHandler",
".",
"INSTANCE",
".",
"fail",
"(",
")",
")",
"{",
"// if onError=FAIL, bubble the exception up the stack",
"throw",
"ex",
";",
"}",
"else",
"{",
"// Mark the last update for the configuration so that we don't try to load it again",
"configuration",
".",
"updateLastModified",
"(",
"configRoot",
".",
"getLastModified",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Parse all of the config files in a directory in platform insensitive alphabetical order | [
"Parse",
"all",
"of",
"the",
"config",
"files",
"in",
"a",
"directory",
"in",
"platform",
"insensitive",
"alphabetical",
"order"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ServerXMLConfiguration.java#L345-L383 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/VirtualHost.java | VirtualHost.findContext | public ServletContext findContext(String path) {
WebGroup g = (WebGroup) requestMapper.map(path);
if (g != null)
return g.getContext();
else
return null;
} | java | public ServletContext findContext(String path) {
WebGroup g = (WebGroup) requestMapper.map(path);
if (g != null)
return g.getContext();
else
return null;
} | [
"public",
"ServletContext",
"findContext",
"(",
"String",
"path",
")",
"{",
"WebGroup",
"g",
"=",
"(",
"WebGroup",
")",
"requestMapper",
".",
"map",
"(",
"path",
")",
";",
"if",
"(",
"g",
"!=",
"null",
")",
"return",
"g",
".",
"getContext",
"(",
")",
";",
"else",
"return",
"null",
";",
"}"
] | Method findContext.
@param path
@return ServletContext | [
"Method",
"findContext",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/VirtualHost.java#L197-L203 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/SingleFileClient.java | SingleFileClient.addWlpInformation | private void addWlpInformation(Asset asset) {
WlpInformation wlpInfo = asset.getWlpInformation();
if (wlpInfo == null) {
wlpInfo = new WlpInformation();
asset.setWlpInformation(wlpInfo);
}
if (wlpInfo.getAppliesToFilterInfo() == null) {
wlpInfo.setAppliesToFilterInfo(new ArrayList<AppliesToFilterInfo>());
}
} | java | private void addWlpInformation(Asset asset) {
WlpInformation wlpInfo = asset.getWlpInformation();
if (wlpInfo == null) {
wlpInfo = new WlpInformation();
asset.setWlpInformation(wlpInfo);
}
if (wlpInfo.getAppliesToFilterInfo() == null) {
wlpInfo.setAppliesToFilterInfo(new ArrayList<AppliesToFilterInfo>());
}
} | [
"private",
"void",
"addWlpInformation",
"(",
"Asset",
"asset",
")",
"{",
"WlpInformation",
"wlpInfo",
"=",
"asset",
".",
"getWlpInformation",
"(",
")",
";",
"if",
"(",
"wlpInfo",
"==",
"null",
")",
"{",
"wlpInfo",
"=",
"new",
"WlpInformation",
"(",
")",
";",
"asset",
".",
"setWlpInformation",
"(",
"wlpInfo",
")",
";",
"}",
"if",
"(",
"wlpInfo",
".",
"getAppliesToFilterInfo",
"(",
")",
"==",
"null",
")",
"{",
"wlpInfo",
".",
"setAppliesToFilterInfo",
"(",
"new",
"ArrayList",
"<",
"AppliesToFilterInfo",
">",
"(",
")",
")",
";",
"}",
"}"
] | For historic reasons, when an asset is read back from the repository the wlpInformation and ATFI should always be present. This method does that. | [
"For",
"historic",
"reasons",
"when",
"an",
"asset",
"is",
"read",
"back",
"from",
"the",
"repository",
"the",
"wlpInformation",
"and",
"ATFI",
"should",
"always",
"be",
"present",
".",
"This",
"method",
"does",
"that",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/SingleFileClient.java#L215-L224 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/JFapChannelInbound.java | JFapChannelInbound.getDiscriminator | public Discriminator getDiscriminator() {
if (tc.isEntryEnabled())
SibTr.entry(this, tc, "getDiscriminator");
if (tc.isEntryEnabled())
SibTr.exit(this, tc, "getDiscriminator", discriminator);
return discriminator;
} | java | public Discriminator getDiscriminator() {
if (tc.isEntryEnabled())
SibTr.entry(this, tc, "getDiscriminator");
if (tc.isEntryEnabled())
SibTr.exit(this, tc, "getDiscriminator", discriminator);
return discriminator;
} | [
"public",
"Discriminator",
"getDiscriminator",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getDiscriminator\"",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getDiscriminator\"",
",",
"discriminator",
")",
";",
"return",
"discriminator",
";",
"}"
] | Returns the discriminator for this channel. | [
"Returns",
"the",
"discriminator",
"for",
"this",
"channel",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/JFapChannelInbound.java#L68-L74 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ServerAsyncResult.java | ServerAsyncResult.getResult | private Object getResult() throws InterruptedException, ExecutionException {
if (ivCancelled) { // F743-11774
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getResult: throwing CancellationException");
}
throw new CancellationException(); // F743-11774
}
// Method ended with an exception
if (ivException != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getResult: " + ivException);
}
throw new ExecutionException(ivException);
}
// F743-609CodRev
// If the result object is itself a Future object, we need to call "get" on it
// so that we unwrap the results and place them in this Future object. This
// is done to support asynchronous method calls that return results wrapped
// in Future objects, and also to support nested asynchronous method calls.
// Also, note that "null" is an acceptable result.
// F743-16193
// Remove instanceof check for Future object. Return type validation check
// moved to EJBMDOrchestrator.java
Object resultToReturn = null;
if (ivFuture != null) {
resultToReturn = ivFuture.get(); // d650178
}
return (resultToReturn);
} | java | private Object getResult() throws InterruptedException, ExecutionException {
if (ivCancelled) { // F743-11774
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getResult: throwing CancellationException");
}
throw new CancellationException(); // F743-11774
}
// Method ended with an exception
if (ivException != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getResult: " + ivException);
}
throw new ExecutionException(ivException);
}
// F743-609CodRev
// If the result object is itself a Future object, we need to call "get" on it
// so that we unwrap the results and place them in this Future object. This
// is done to support asynchronous method calls that return results wrapped
// in Future objects, and also to support nested asynchronous method calls.
// Also, note that "null" is an acceptable result.
// F743-16193
// Remove instanceof check for Future object. Return type validation check
// moved to EJBMDOrchestrator.java
Object resultToReturn = null;
if (ivFuture != null) {
resultToReturn = ivFuture.get(); // d650178
}
return (resultToReturn);
} | [
"private",
"Object",
"getResult",
"(",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"if",
"(",
"ivCancelled",
")",
"{",
"// F743-11774",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getResult: throwing CancellationException\"",
")",
";",
"}",
"throw",
"new",
"CancellationException",
"(",
")",
";",
"// F743-11774",
"}",
"// Method ended with an exception",
"if",
"(",
"ivException",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getResult: \"",
"+",
"ivException",
")",
";",
"}",
"throw",
"new",
"ExecutionException",
"(",
"ivException",
")",
";",
"}",
"// F743-609CodRev",
"// If the result object is itself a Future object, we need to call \"get\" on it",
"// so that we unwrap the results and place them in this Future object. This",
"// is done to support asynchronous method calls that return results wrapped",
"// in Future objects, and also to support nested asynchronous method calls.",
"// Also, note that \"null\" is an acceptable result.",
"// F743-16193",
"// Remove instanceof check for Future object. Return type validation check",
"// moved to EJBMDOrchestrator.java",
"Object",
"resultToReturn",
"=",
"null",
";",
"if",
"(",
"ivFuture",
"!=",
"null",
")",
"{",
"resultToReturn",
"=",
"ivFuture",
".",
"get",
"(",
")",
";",
"// d650178",
"}",
"return",
"(",
"resultToReturn",
")",
";",
"}"
] | This get method returns the result of the async method call. This method
must not be called unless ivGate indicates that results are available.
@return - the result object
@throws InterruptedException - if the thread is interrupted while waiting
@throws CancellationException - if the async method was canceled successfully
@throws ExecutionException - if the async method ended with an exception | [
"This",
"get",
"method",
"returns",
"the",
"result",
"of",
"the",
"async",
"method",
"call",
".",
"This",
"method",
"must",
"not",
"be",
"called",
"unless",
"ivGate",
"indicates",
"that",
"results",
"are",
"available",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ServerAsyncResult.java#L217-L248 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ServerAsyncResult.java | ServerAsyncResult.getResult | private Object getResult(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
if (ivCancelled) { // F743-11774
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getResult: throwing CancellationException");
}
throw new CancellationException(); // F743-11774
}
// Method ended with an exception
if (ivException != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getResult: " + ivException);
}
throw new ExecutionException(ivException);
}
// F743-609CodRev
// If the result object is itself a Future object, we need to call "get" on it
// so that we unwrap the results and place them in this Future object. This
// is done to support asynchronous method calls that return results wrapped
// in Future objects, and also to support nested asynchronous method calls.
// Also, note that "null" is an acceptable result.
// F743-16193
// Remove instanceof check for Future object. Return type validation check
// moved to EJBMDOrchestrator.java
Object resultToReturn = null;
if (ivFuture != null) {
// AsyncResult EJB3.2 API just throws IllegalStateExceptions for everything but .get().
// Even in EJB3.1 API get(timeout, unit) just immediately returned. In a long nested
// chain of futures, only the last one will be AsyncResult so we won't need to pass
// down the remaining timeout anyway.
if (ivFuture instanceof AsyncResult) {
resultToReturn = ivFuture.get();
} else {
resultToReturn = ivFuture.get(timeout, unit); // d650178
}
}
return (resultToReturn);
} | java | private Object getResult(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
if (ivCancelled) { // F743-11774
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getResult: throwing CancellationException");
}
throw new CancellationException(); // F743-11774
}
// Method ended with an exception
if (ivException != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getResult: " + ivException);
}
throw new ExecutionException(ivException);
}
// F743-609CodRev
// If the result object is itself a Future object, we need to call "get" on it
// so that we unwrap the results and place them in this Future object. This
// is done to support asynchronous method calls that return results wrapped
// in Future objects, and also to support nested asynchronous method calls.
// Also, note that "null" is an acceptable result.
// F743-16193
// Remove instanceof check for Future object. Return type validation check
// moved to EJBMDOrchestrator.java
Object resultToReturn = null;
if (ivFuture != null) {
// AsyncResult EJB3.2 API just throws IllegalStateExceptions for everything but .get().
// Even in EJB3.1 API get(timeout, unit) just immediately returned. In a long nested
// chain of futures, only the last one will be AsyncResult so we won't need to pass
// down the remaining timeout anyway.
if (ivFuture instanceof AsyncResult) {
resultToReturn = ivFuture.get();
} else {
resultToReturn = ivFuture.get(timeout, unit); // d650178
}
}
return (resultToReturn);
} | [
"private",
"Object",
"getResult",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
",",
"TimeoutException",
"{",
"if",
"(",
"ivCancelled",
")",
"{",
"// F743-11774",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getResult: throwing CancellationException\"",
")",
";",
"}",
"throw",
"new",
"CancellationException",
"(",
")",
";",
"// F743-11774",
"}",
"// Method ended with an exception",
"if",
"(",
"ivException",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getResult: \"",
"+",
"ivException",
")",
";",
"}",
"throw",
"new",
"ExecutionException",
"(",
"ivException",
")",
";",
"}",
"// F743-609CodRev",
"// If the result object is itself a Future object, we need to call \"get\" on it",
"// so that we unwrap the results and place them in this Future object. This",
"// is done to support asynchronous method calls that return results wrapped",
"// in Future objects, and also to support nested asynchronous method calls.",
"// Also, note that \"null\" is an acceptable result.",
"// F743-16193",
"// Remove instanceof check for Future object. Return type validation check",
"// moved to EJBMDOrchestrator.java",
"Object",
"resultToReturn",
"=",
"null",
";",
"if",
"(",
"ivFuture",
"!=",
"null",
")",
"{",
"// AsyncResult EJB3.2 API just throws IllegalStateExceptions for everything but .get().",
"// Even in EJB3.1 API get(timeout, unit) just immediately returned. In a long nested",
"// chain of futures, only the last one will be AsyncResult so we won't need to pass",
"// down the remaining timeout anyway.",
"if",
"(",
"ivFuture",
"instanceof",
"AsyncResult",
")",
"{",
"resultToReturn",
"=",
"ivFuture",
".",
"get",
"(",
")",
";",
"}",
"else",
"{",
"resultToReturn",
"=",
"ivFuture",
".",
"get",
"(",
"timeout",
",",
"unit",
")",
";",
"// d650178",
"}",
"}",
"return",
"(",
"resultToReturn",
")",
";",
"}"
] | This get method returns the result of the asynch method call. This method
must not be called unless ivGate indicates that results are available.
@param timeout - the timeout value
@param unit - the time unit for the timeout value (e.g. milliseconds, seconds, etc.)
@return - the result object
@throws InterruptedException - if the thread is interrupted while waiting
@throws CancellationException - if the async method was canceled successfully
@throws ExecutionException - if the async method ended with an exception
@throws TimeoutException - if the timeout period expires before the asynch method completes | [
"This",
"get",
"method",
"returns",
"the",
"result",
"of",
"the",
"asynch",
"method",
"call",
".",
"This",
"method",
"must",
"not",
"be",
"called",
"unless",
"ivGate",
"indicates",
"that",
"results",
"are",
"available",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ServerAsyncResult.java#L264-L303 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ServerAsyncResult.java | ServerAsyncResult.isCancelled | @Override
public boolean isCancelled() {
//F743-609CodRev - read volatile variable only once
boolean cancelled = ivCancelled;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "isCancelled: " + cancelled + " Future object: " + this);
}
return (cancelled);
} | java | @Override
public boolean isCancelled() {
//F743-609CodRev - read volatile variable only once
boolean cancelled = ivCancelled;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "isCancelled: " + cancelled + " Future object: " + this);
}
return (cancelled);
} | [
"@",
"Override",
"public",
"boolean",
"isCancelled",
"(",
")",
"{",
"//F743-609CodRev - read volatile variable only once",
"boolean",
"cancelled",
"=",
"ivCancelled",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"isCancelled: \"",
"+",
"cancelled",
"+",
"\" Future object: \"",
"+",
"this",
")",
";",
"}",
"return",
"(",
"cancelled",
")",
";",
"}"
] | This method allows clients to check the Future object to see if the asynch
method was canceled before it got a chance to execute. | [
"This",
"method",
"allows",
"clients",
"to",
"check",
"the",
"Future",
"object",
"to",
"see",
"if",
"the",
"asynch",
"method",
"was",
"canceled",
"before",
"it",
"got",
"a",
"chance",
"to",
"execute",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ServerAsyncResult.java#L373-L384 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ServerAsyncResult.java | ServerAsyncResult.setResult | void setResult(Future<?> theFuture) { // d650178
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setResult: " + Util.identity(theFuture) + " Future object: " + this);
}
// set result, we are done
ivFuture = theFuture;
done(); // F743-11774
} | java | void setResult(Future<?> theFuture) { // d650178
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setResult: " + Util.identity(theFuture) + " Future object: " + this);
}
// set result, we are done
ivFuture = theFuture;
done(); // F743-11774
} | [
"void",
"setResult",
"(",
"Future",
"<",
"?",
">",
"theFuture",
")",
"{",
"// d650178",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setResult: \"",
"+",
"Util",
".",
"identity",
"(",
"theFuture",
")",
"+",
"\" Future object: \"",
"+",
"this",
")",
";",
"}",
"// set result, we are done",
"ivFuture",
"=",
"theFuture",
";",
"done",
"(",
")",
";",
"// F743-11774",
"}"
] | did not throw an exception. | [
"did",
"not",
"throw",
"an",
"exception",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ServerAsyncResult.java#L413-L422 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ServerAsyncResult.java | ServerAsyncResult.setException | void setException(Throwable theException) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setException - Future object: " + this, theException);
}
// set exception, we are done
ivException = theException;
done(); // F743-11774
} | java | void setException(Throwable theException) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setException - Future object: " + this, theException);
}
// set exception, we are done
ivException = theException;
done(); // F743-11774
} | [
"void",
"setException",
"(",
"Throwable",
"theException",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setException - Future object: \"",
"+",
"this",
",",
"theException",
")",
";",
"}",
"// set exception, we are done",
"ivException",
"=",
"theException",
";",
"done",
"(",
")",
";",
"// F743-11774",
"}"
] | The async method ended with an exception | [
"The",
"async",
"method",
"ended",
"with",
"an",
"exception"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ServerAsyncResult.java#L425-L434 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/validator/LongRangeValidator.java | LongRangeValidator.saveState | public Object saveState(FacesContext context)
{
if (!initialStateMarked())
{
Object values[] = new Object[2];
values[0] = _maximum;
values[1] = _minimum;
return values;
}
return null;
} | java | public Object saveState(FacesContext context)
{
if (!initialStateMarked())
{
Object values[] = new Object[2];
values[0] = _maximum;
values[1] = _minimum;
return values;
}
return null;
} | [
"public",
"Object",
"saveState",
"(",
"FacesContext",
"context",
")",
"{",
"if",
"(",
"!",
"initialStateMarked",
"(",
")",
")",
"{",
"Object",
"values",
"[",
"]",
"=",
"new",
"Object",
"[",
"2",
"]",
";",
"values",
"[",
"0",
"]",
"=",
"_maximum",
";",
"values",
"[",
"1",
"]",
"=",
"_minimum",
";",
"return",
"values",
";",
"}",
"return",
"null",
";",
"}"
] | RESTORE & SAVE STATE | [
"RESTORE",
"&",
"SAVE",
"STATE"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/validator/LongRangeValidator.java#L194-L204 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.security.common/src/com/ibm/ws/messaging/security/Authentication.java | Authentication.logout | public void logout(Subject subject) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, CLASS_NAME + "logout");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "logout");
}
} | java | public void logout(Subject subject) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, CLASS_NAME + "logout");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "logout");
}
} | [
"public",
"void",
"logout",
"(",
"Subject",
"subject",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"CLASS_NAME",
"+",
"\"logout\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"CLASS_NAME",
"+",
"\"logout\"",
")",
";",
"}",
"}"
] | Logout method is used only for auditing purpose
@param subject
Subject which needs to be logged out | [
"Logout",
"method",
"is",
"used",
"only",
"for",
"auditing",
"purpose"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security.common/src/com/ibm/ws/messaging/security/Authentication.java#L191-L198 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.security.common/src/com/ibm/ws/messaging/security/Authentication.java | Authentication.setMessagingAuthenticationService | public void setMessagingAuthenticationService(
MessagingAuthenticationService messagingAuthenticationService) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, CLASS_NAME + "setMessagingAuthenticationService",
messagingAuthenticationService);
}
this.messagingAuthenticationService = messagingAuthenticationService;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "setMessagingAuthenticationService");
}
} | java | public void setMessagingAuthenticationService(
MessagingAuthenticationService messagingAuthenticationService) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, CLASS_NAME + "setMessagingAuthenticationService",
messagingAuthenticationService);
}
this.messagingAuthenticationService = messagingAuthenticationService;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "setMessagingAuthenticationService");
}
} | [
"public",
"void",
"setMessagingAuthenticationService",
"(",
"MessagingAuthenticationService",
"messagingAuthenticationService",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"CLASS_NAME",
"+",
"\"setMessagingAuthenticationService\"",
",",
"messagingAuthenticationService",
")",
";",
"}",
"this",
".",
"messagingAuthenticationService",
"=",
"messagingAuthenticationService",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"CLASS_NAME",
"+",
"\"setMessagingAuthenticationService\"",
")",
";",
"}",
"}"
] | Set the MessagingAuthenticationService
@param messagingAuthenticationService | [
"Set",
"the",
"MessagingAuthenticationService"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security.common/src/com/ibm/ws/messaging/security/Authentication.java#L205-L215 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractProviderResolver.java | AbstractProviderResolver.deactivate | public void deactivate(ComponentContext cc) throws IOException {
ConfigProviderResolver.setInstance(null);
shutdown();
scheduledExecutorServiceRef.deactivate(cc);
} | java | public void deactivate(ComponentContext cc) throws IOException {
ConfigProviderResolver.setInstance(null);
shutdown();
scheduledExecutorServiceRef.deactivate(cc);
} | [
"public",
"void",
"deactivate",
"(",
"ComponentContext",
"cc",
")",
"throws",
"IOException",
"{",
"ConfigProviderResolver",
".",
"setInstance",
"(",
"null",
")",
";",
"shutdown",
"(",
")",
";",
"scheduledExecutorServiceRef",
".",
"deactivate",
"(",
"cc",
")",
";",
"}"
] | Deactivate a context and set the instance to null
@param cc | [
"Deactivate",
"a",
"context",
"and",
"set",
"the",
"instance",
"to",
"null"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractProviderResolver.java#L90-L94 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractProviderResolver.java | AbstractProviderResolver.shutdown | public void shutdown() {
synchronized (configCache) {
Set<ClassLoader> allClassLoaders = new HashSet<>();
allClassLoaders.addAll(configCache.keySet()); //create a copy of the keys so that we avoid a ConcurrentModificationException
for (ClassLoader classLoader : allClassLoaders) {
close(classLoader);
}
//caches should be empty now but clear them anyway
configCache.clear();
appClassLoaderMap.clear();
}
} | java | public void shutdown() {
synchronized (configCache) {
Set<ClassLoader> allClassLoaders = new HashSet<>();
allClassLoaders.addAll(configCache.keySet()); //create a copy of the keys so that we avoid a ConcurrentModificationException
for (ClassLoader classLoader : allClassLoaders) {
close(classLoader);
}
//caches should be empty now but clear them anyway
configCache.clear();
appClassLoaderMap.clear();
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"synchronized",
"(",
"configCache",
")",
"{",
"Set",
"<",
"ClassLoader",
">",
"allClassLoaders",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"allClassLoaders",
".",
"addAll",
"(",
"configCache",
".",
"keySet",
"(",
")",
")",
";",
"//create a copy of the keys so that we avoid a ConcurrentModificationException",
"for",
"(",
"ClassLoader",
"classLoader",
":",
"allClassLoaders",
")",
"{",
"close",
"(",
"classLoader",
")",
";",
"}",
"//caches should be empty now but clear them anyway",
"configCache",
".",
"clear",
"(",
")",
";",
"appClassLoaderMap",
".",
"clear",
"(",
")",
";",
"}",
"}"
] | Close down all the configs | [
"Close",
"down",
"all",
"the",
"configs"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractProviderResolver.java#L144-L155 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractProviderResolver.java | AbstractProviderResolver.close | private void close(ClassLoader classLoader) {
synchronized (configCache) {
ConfigWrapper config = configCache.remove(classLoader);
if (config != null) {
Set<String> applicationNames = config.getApplications();
for (String app : applicationNames) {
appClassLoaderMap.remove(app);
}
config.close();
}
}
} | java | private void close(ClassLoader classLoader) {
synchronized (configCache) {
ConfigWrapper config = configCache.remove(classLoader);
if (config != null) {
Set<String> applicationNames = config.getApplications();
for (String app : applicationNames) {
appClassLoaderMap.remove(app);
}
config.close();
}
}
} | [
"private",
"void",
"close",
"(",
"ClassLoader",
"classLoader",
")",
"{",
"synchronized",
"(",
"configCache",
")",
"{",
"ConfigWrapper",
"config",
"=",
"configCache",
".",
"remove",
"(",
"classLoader",
")",
";",
"if",
"(",
"config",
"!=",
"null",
")",
"{",
"Set",
"<",
"String",
">",
"applicationNames",
"=",
"config",
".",
"getApplications",
"(",
")",
";",
"for",
"(",
"String",
"app",
":",
"applicationNames",
")",
"{",
"appClassLoaderMap",
".",
"remove",
"(",
"app",
")",
";",
"}",
"config",
".",
"close",
"(",
")",
";",
"}",
"}",
"}"
] | Completely close a config for a given classloader | [
"Completely",
"close",
"a",
"config",
"for",
"a",
"given",
"classloader"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractProviderResolver.java#L187-L199 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractProviderResolver.java | AbstractProviderResolver.closeConfig | private void closeConfig(Config config) {
if (config instanceof WebSphereConfig) {
try {
((WebSphereConfig) config).close();
} catch (IOException e) {
throw new ConfigException(Tr.formatMessage(tc, "could.not.close.CWMCG0004E", e));
}
}
} | java | private void closeConfig(Config config) {
if (config instanceof WebSphereConfig) {
try {
((WebSphereConfig) config).close();
} catch (IOException e) {
throw new ConfigException(Tr.formatMessage(tc, "could.not.close.CWMCG0004E", e));
}
}
} | [
"private",
"void",
"closeConfig",
"(",
"Config",
"config",
")",
"{",
"if",
"(",
"config",
"instanceof",
"WebSphereConfig",
")",
"{",
"try",
"{",
"(",
"(",
"WebSphereConfig",
")",
"config",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"ConfigException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"could.not.close.CWMCG0004E\"",
",",
"e",
")",
")",
";",
"}",
"}",
"}"
] | Close a given config, if it's a WebSphereConfig | [
"Close",
"a",
"given",
"config",
"if",
"it",
"s",
"a",
"WebSphereConfig"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractProviderResolver.java#L204-L212 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaConnectionImpl.java | JmsJcaConnectionImpl.getSICoreConnection | @Override
public SICoreConnection getSICoreConnection() throws IllegalStateException {
if (connectionClosed) {
throw new IllegalStateException(NLS.getFormattedMessage(
("ILLEGAL_STATE_CWSJR1086"),
new Object[] { "getSICoreConnection" }, null));
}
return _coreConnection;
} | java | @Override
public SICoreConnection getSICoreConnection() throws IllegalStateException {
if (connectionClosed) {
throw new IllegalStateException(NLS.getFormattedMessage(
("ILLEGAL_STATE_CWSJR1086"),
new Object[] { "getSICoreConnection" }, null));
}
return _coreConnection;
} | [
"@",
"Override",
"public",
"SICoreConnection",
"getSICoreConnection",
"(",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"connectionClosed",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"NLS",
".",
"getFormattedMessage",
"(",
"(",
"\"ILLEGAL_STATE_CWSJR1086\"",
")",
",",
"new",
"Object",
"[",
"]",
"{",
"\"getSICoreConnection\"",
"}",
",",
"null",
")",
")",
";",
"}",
"return",
"_coreConnection",
";",
"}"
] | Returns the core connection created for, and associated with, this
connection.
@return the core connection
@throws IllegalStateException
if this connection has been closed | [
"Returns",
"the",
"core",
"connection",
"created",
"for",
"and",
"associated",
"with",
"this",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaConnectionImpl.java#L503-L513 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaConnectionImpl.java | JmsJcaConnectionImpl.close | @Override
synchronized public void close() throws SIConnectionLostException,
SIIncorrectCallException, SIResourceException, SIErrorException,
SIConnectionDroppedException, SIConnectionUnavailableException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "close");
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
{
SibTr.debug(TRACE, "We have " + _sessions.size() + " left open - closing them");
}
// Close all the sessions created from this connection.
for (final Iterator iterator = _sessions.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof JmsJcaSessionImpl) {
final JmsJcaSessionImpl session = (JmsJcaSessionImpl) object;
session.close(false);
}
iterator.remove();
}
if (_coreConnection != null) {
_coreConnection.close();
}
connectionClosed = true;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "close");
}
} | java | @Override
synchronized public void close() throws SIConnectionLostException,
SIIncorrectCallException, SIResourceException, SIErrorException,
SIConnectionDroppedException, SIConnectionUnavailableException {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "close");
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
{
SibTr.debug(TRACE, "We have " + _sessions.size() + " left open - closing them");
}
// Close all the sessions created from this connection.
for (final Iterator iterator = _sessions.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof JmsJcaSessionImpl) {
final JmsJcaSessionImpl session = (JmsJcaSessionImpl) object;
session.close(false);
}
iterator.remove();
}
if (_coreConnection != null) {
_coreConnection.close();
}
connectionClosed = true;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "close");
}
} | [
"@",
"Override",
"synchronized",
"public",
"void",
"close",
"(",
")",
"throws",
"SIConnectionLostException",
",",
"SIIncorrectCallException",
",",
"SIResourceException",
",",
"SIErrorException",
",",
"SIConnectionDroppedException",
",",
"SIConnectionUnavailableException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"\"close\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"debug",
"(",
"TRACE",
",",
"\"We have \"",
"+",
"_sessions",
".",
"size",
"(",
")",
"+",
"\" left open - closing them\"",
")",
";",
"}",
"// Close all the sessions created from this connection.",
"for",
"(",
"final",
"Iterator",
"iterator",
"=",
"_sessions",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"final",
"Object",
"object",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"object",
"instanceof",
"JmsJcaSessionImpl",
")",
"{",
"final",
"JmsJcaSessionImpl",
"session",
"=",
"(",
"JmsJcaSessionImpl",
")",
"object",
";",
"session",
".",
"close",
"(",
"false",
")",
";",
"}",
"iterator",
".",
"remove",
"(",
")",
";",
"}",
"if",
"(",
"_coreConnection",
"!=",
"null",
")",
"{",
"_coreConnection",
".",
"close",
"(",
")",
";",
"}",
"connectionClosed",
"=",
"true",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"\"close\"",
")",
";",
"}",
"}"
] | Closes this connection, its associated core connection and any sessions
created from it.
Used in Outbound Diagram 8
@throws SIErrorException
if the associated core connection failed to close
@throws SIResourceException
if the associated core connection failed to close
@throws SIIncorrectCallException
if the associated core connection failed to close
@throws SIConnectionLostException
if the associated core connection failed to close | [
"Closes",
"this",
"connection",
"its",
"associated",
"core",
"connection",
"and",
"any",
"sessions",
"created",
"from",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaConnectionImpl.java#L530-L566 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaConnectionImpl.java | JmsJcaConnectionImpl.isRunningInWAS | private static boolean isRunningInWAS() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(TRACE, "isRunningInWAS");
}
if (inWAS == null) {
inWAS = Boolean.TRUE;
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(TRACE, "isRunningInWAS", inWAS);
}
return inWAS.booleanValue();
} | java | private static boolean isRunningInWAS() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(TRACE, "isRunningInWAS");
}
if (inWAS == null) {
inWAS = Boolean.TRUE;
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(TRACE, "isRunningInWAS", inWAS);
}
return inWAS.booleanValue();
} | [
"private",
"static",
"boolean",
"isRunningInWAS",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"TRACE",
",",
"\"isRunningInWAS\"",
")",
";",
"}",
"if",
"(",
"inWAS",
"==",
"null",
")",
"{",
"inWAS",
"=",
"Boolean",
".",
"TRUE",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"TRACE",
",",
"\"isRunningInWAS\"",
",",
"inWAS",
")",
";",
"}",
"return",
"inWAS",
".",
"booleanValue",
"(",
")",
";",
"}"
] | Returns true if running in WAS. The check is to see if com.ibm.tx.jta.Transaction.TransactionManagerFactory
is on the classpath.
@return if running in WAS | [
"Returns",
"true",
"if",
"running",
"in",
"WAS",
".",
"The",
"check",
"is",
"to",
"see",
"if",
"com",
".",
"ibm",
".",
"tx",
".",
"jta",
".",
"Transaction",
".",
"TransactionManagerFactory",
"is",
"on",
"the",
"classpath",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaConnectionImpl.java#L629-L642 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaConnectionImpl.java | JmsJcaConnectionImpl.getCurrentUOWCoord | private static final Object getCurrentUOWCoord() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(TRACE, "getCurrentUOWCoord");
}
Object currentUOW = null;
if (isRunningInWAS()) {
currentUOW = EmbeddableTransactionManagerFactory.getUOWCurrent().getUOWCoord();
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(TRACE, "getCurrentUOWCoord", currentUOW);
}
return currentUOW;
} | java | private static final Object getCurrentUOWCoord() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(TRACE, "getCurrentUOWCoord");
}
Object currentUOW = null;
if (isRunningInWAS()) {
currentUOW = EmbeddableTransactionManagerFactory.getUOWCurrent().getUOWCoord();
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(TRACE, "getCurrentUOWCoord", currentUOW);
}
return currentUOW;
} | [
"private",
"static",
"final",
"Object",
"getCurrentUOWCoord",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"TRACE",
",",
"\"getCurrentUOWCoord\"",
")",
";",
"}",
"Object",
"currentUOW",
"=",
"null",
";",
"if",
"(",
"isRunningInWAS",
"(",
")",
")",
"{",
"currentUOW",
"=",
"EmbeddableTransactionManagerFactory",
".",
"getUOWCurrent",
"(",
")",
".",
"getUOWCoord",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"TRACE",
",",
"\"getCurrentUOWCoord\"",
",",
"currentUOW",
")",
";",
"}",
"return",
"currentUOW",
";",
"}"
] | This method uses reflection to try and obtain the current UOW, if we are not inside WAS
null is returned.
@return The current UOW | [
"This",
"method",
"uses",
"reflection",
"to",
"try",
"and",
"obtain",
"the",
"current",
"UOW",
"if",
"we",
"are",
"not",
"inside",
"WAS",
"null",
"is",
"returned",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaConnectionImpl.java#L650-L664 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ClassLoadingServiceImpl.java | ClassLoadingServiceImpl.listenForLibraryChanges | private PostCreateAction listenForLibraryChanges(final String libid) {
return new PostCreateAction() {
@Override
public void invoke(AppClassLoader acl) {
listenForLibraryChanges(libid, acl);
}
};
} | java | private PostCreateAction listenForLibraryChanges(final String libid) {
return new PostCreateAction() {
@Override
public void invoke(AppClassLoader acl) {
listenForLibraryChanges(libid, acl);
}
};
} | [
"private",
"PostCreateAction",
"listenForLibraryChanges",
"(",
"final",
"String",
"libid",
")",
"{",
"return",
"new",
"PostCreateAction",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"invoke",
"(",
"AppClassLoader",
"acl",
")",
"{",
"listenForLibraryChanges",
"(",
"libid",
",",
"acl",
")",
";",
"}",
"}",
";",
"}"
] | create an action that will create a listener when invoked | [
"create",
"an",
"action",
"that",
"will",
"create",
"a",
"listener",
"when",
"invoked"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ClassLoadingServiceImpl.java#L498-L505 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ClassLoadingServiceImpl.java | ClassLoadingServiceImpl.listenForLibraryChanges | private void listenForLibraryChanges(String libid, AppClassLoader acl) {
// ensure this loader is removed from the canonical store when the library is updated
new WeakLibraryListener(libid, acl.getKey().getId(), acl, bundleContext) {
@Override
protected void update() {
Object cl = get();
if (cl instanceof AppClassLoader && aclStore != null)
aclStore.remove((AppClassLoader) cl);
deregister();
}
};
} | java | private void listenForLibraryChanges(String libid, AppClassLoader acl) {
// ensure this loader is removed from the canonical store when the library is updated
new WeakLibraryListener(libid, acl.getKey().getId(), acl, bundleContext) {
@Override
protected void update() {
Object cl = get();
if (cl instanceof AppClassLoader && aclStore != null)
aclStore.remove((AppClassLoader) cl);
deregister();
}
};
} | [
"private",
"void",
"listenForLibraryChanges",
"(",
"String",
"libid",
",",
"AppClassLoader",
"acl",
")",
"{",
"// ensure this loader is removed from the canonical store when the library is updated",
"new",
"WeakLibraryListener",
"(",
"libid",
",",
"acl",
".",
"getKey",
"(",
")",
".",
"getId",
"(",
")",
",",
"acl",
",",
"bundleContext",
")",
"{",
"@",
"Override",
"protected",
"void",
"update",
"(",
")",
"{",
"Object",
"cl",
"=",
"get",
"(",
")",
";",
"if",
"(",
"cl",
"instanceof",
"AppClassLoader",
"&&",
"aclStore",
"!=",
"null",
")",
"aclStore",
".",
"remove",
"(",
"(",
"AppClassLoader",
")",
"cl",
")",
";",
"deregister",
"(",
")",
";",
"}",
"}",
";",
"}"
] | create a listener to remove a loader from the canonical store on library update | [
"create",
"a",
"listener",
"to",
"remove",
"a",
"loader",
"from",
"the",
"canonical",
"store",
"on",
"library",
"update"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ClassLoadingServiceImpl.java#L508-L519 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/adapter/BundleEventAdapter.java | BundleEventAdapter.getTopic | private String getTopic(BundleEvent bundleEvent) {
StringBuilder topic = new StringBuilder(BUNDLE_EVENT_TOPIC_PREFIX);
switch (bundleEvent.getType()) {
case BundleEvent.INSTALLED:
topic.append("INSTALLED");
break;
case BundleEvent.STARTED:
topic.append("STARTED");
break;
case BundleEvent.STOPPED:
topic.append("STOPPED");
break;
case BundleEvent.UPDATED:
topic.append("UPDATED");
break;
case BundleEvent.UNINSTALLED:
topic.append("UNINSTALLED");
break;
case BundleEvent.RESOLVED:
topic.append("RESOLVED");
break;
case BundleEvent.UNRESOLVED:
topic.append("UNRESOLVED");
break;
default:
return null;
}
return topic.toString();
} | java | private String getTopic(BundleEvent bundleEvent) {
StringBuilder topic = new StringBuilder(BUNDLE_EVENT_TOPIC_PREFIX);
switch (bundleEvent.getType()) {
case BundleEvent.INSTALLED:
topic.append("INSTALLED");
break;
case BundleEvent.STARTED:
topic.append("STARTED");
break;
case BundleEvent.STOPPED:
topic.append("STOPPED");
break;
case BundleEvent.UPDATED:
topic.append("UPDATED");
break;
case BundleEvent.UNINSTALLED:
topic.append("UNINSTALLED");
break;
case BundleEvent.RESOLVED:
topic.append("RESOLVED");
break;
case BundleEvent.UNRESOLVED:
topic.append("UNRESOLVED");
break;
default:
return null;
}
return topic.toString();
} | [
"private",
"String",
"getTopic",
"(",
"BundleEvent",
"bundleEvent",
")",
"{",
"StringBuilder",
"topic",
"=",
"new",
"StringBuilder",
"(",
"BUNDLE_EVENT_TOPIC_PREFIX",
")",
";",
"switch",
"(",
"bundleEvent",
".",
"getType",
"(",
")",
")",
"{",
"case",
"BundleEvent",
".",
"INSTALLED",
":",
"topic",
".",
"append",
"(",
"\"INSTALLED\"",
")",
";",
"break",
";",
"case",
"BundleEvent",
".",
"STARTED",
":",
"topic",
".",
"append",
"(",
"\"STARTED\"",
")",
";",
"break",
";",
"case",
"BundleEvent",
".",
"STOPPED",
":",
"topic",
".",
"append",
"(",
"\"STOPPED\"",
")",
";",
"break",
";",
"case",
"BundleEvent",
".",
"UPDATED",
":",
"topic",
".",
"append",
"(",
"\"UPDATED\"",
")",
";",
"break",
";",
"case",
"BundleEvent",
".",
"UNINSTALLED",
":",
"topic",
".",
"append",
"(",
"\"UNINSTALLED\"",
")",
";",
"break",
";",
"case",
"BundleEvent",
".",
"RESOLVED",
":",
"topic",
".",
"append",
"(",
"\"RESOLVED\"",
")",
";",
"break",
";",
"case",
"BundleEvent",
".",
"UNRESOLVED",
":",
"topic",
".",
"append",
"(",
"\"UNRESOLVED\"",
")",
";",
"break",
";",
"default",
":",
"return",
"null",
";",
"}",
"return",
"topic",
".",
"toString",
"(",
")",
";",
"}"
] | Determine the appropriate topic to use for the Bundle Event.
@param bundleEvent
the bundle event that is being adapted
@return the topic or null if the event is not supported | [
"Determine",
"the",
"appropriate",
"topic",
"to",
"use",
"for",
"the",
"Bundle",
"Event",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/adapter/BundleEventAdapter.java#L93-L123 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PmiModuleConfig.java | PmiModuleConfig.submoduleMembers | public PmiDataInfo[] submoduleMembers(String submoduleName, int level) {
if (submoduleName == null)
return listLevelData(level);
ArrayList returnData = new ArrayList();
// special case for category
boolean inCategory = false;
if (submoduleName.startsWith("ejb."))
inCategory = true;
Iterator allData = perfData.values().iterator();
while (allData.hasNext()) {
PmiDataInfo info = (PmiDataInfo) allData.next();
if (inCategory) { // submoduleName is actually the category name for entity/session/mdb
if (info.getCategory().equals("all") || isInCategory(submoduleName, info.getCategory()))
returnData.add(info);
} else if (info.getSubmoduleName() != null &&
info.getSubmoduleName().equals(submoduleName) && info.getLevel() <= level) {
returnData.add(info);
}
}
PmiDataInfo[] ret = new PmiDataInfo[returnData.size()];
for (int i = 0; i < ret.length; i++)
ret[i] = (PmiDataInfo) returnData.get(i);
return ret;
} | java | public PmiDataInfo[] submoduleMembers(String submoduleName, int level) {
if (submoduleName == null)
return listLevelData(level);
ArrayList returnData = new ArrayList();
// special case for category
boolean inCategory = false;
if (submoduleName.startsWith("ejb."))
inCategory = true;
Iterator allData = perfData.values().iterator();
while (allData.hasNext()) {
PmiDataInfo info = (PmiDataInfo) allData.next();
if (inCategory) { // submoduleName is actually the category name for entity/session/mdb
if (info.getCategory().equals("all") || isInCategory(submoduleName, info.getCategory()))
returnData.add(info);
} else if (info.getSubmoduleName() != null &&
info.getSubmoduleName().equals(submoduleName) && info.getLevel() <= level) {
returnData.add(info);
}
}
PmiDataInfo[] ret = new PmiDataInfo[returnData.size()];
for (int i = 0; i < ret.length; i++)
ret[i] = (PmiDataInfo) returnData.get(i);
return ret;
} | [
"public",
"PmiDataInfo",
"[",
"]",
"submoduleMembers",
"(",
"String",
"submoduleName",
",",
"int",
"level",
")",
"{",
"if",
"(",
"submoduleName",
"==",
"null",
")",
"return",
"listLevelData",
"(",
"level",
")",
";",
"ArrayList",
"returnData",
"=",
"new",
"ArrayList",
"(",
")",
";",
"// special case for category",
"boolean",
"inCategory",
"=",
"false",
";",
"if",
"(",
"submoduleName",
".",
"startsWith",
"(",
"\"ejb.\"",
")",
")",
"inCategory",
"=",
"true",
";",
"Iterator",
"allData",
"=",
"perfData",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"allData",
".",
"hasNext",
"(",
")",
")",
"{",
"PmiDataInfo",
"info",
"=",
"(",
"PmiDataInfo",
")",
"allData",
".",
"next",
"(",
")",
";",
"if",
"(",
"inCategory",
")",
"{",
"// submoduleName is actually the category name for entity/session/mdb",
"if",
"(",
"info",
".",
"getCategory",
"(",
")",
".",
"equals",
"(",
"\"all\"",
")",
"||",
"isInCategory",
"(",
"submoduleName",
",",
"info",
".",
"getCategory",
"(",
")",
")",
")",
"returnData",
".",
"add",
"(",
"info",
")",
";",
"}",
"else",
"if",
"(",
"info",
".",
"getSubmoduleName",
"(",
")",
"!=",
"null",
"&&",
"info",
".",
"getSubmoduleName",
"(",
")",
".",
"equals",
"(",
"submoduleName",
")",
"&&",
"info",
".",
"getLevel",
"(",
")",
"<=",
"level",
")",
"{",
"returnData",
".",
"add",
"(",
"info",
")",
";",
"}",
"}",
"PmiDataInfo",
"[",
"]",
"ret",
"=",
"new",
"PmiDataInfo",
"[",
"returnData",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ret",
".",
"length",
";",
"i",
"++",
")",
"ret",
"[",
"i",
"]",
"=",
"(",
"PmiDataInfo",
")",
"returnData",
".",
"get",
"(",
"i",
")",
";",
"return",
"ret",
";",
"}"
] | Returns an array of PmiDataInfo for the given submoduleName and level. | [
"Returns",
"an",
"array",
"of",
"PmiDataInfo",
"for",
"the",
"given",
"submoduleName",
"and",
"level",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PmiModuleConfig.java#L172-L199 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PmiModuleConfig.java | PmiModuleConfig.listLevelData | public PmiDataInfo[] listLevelData(int level) {
ArrayList levelData = new ArrayList();
Iterator allData = perfData.values().iterator();
while (allData.hasNext()) {
PmiDataInfo dataInfo = (PmiDataInfo) allData.next();
if (dataInfo.getLevel() <= level) {
levelData.add(dataInfo);
}
}
// get the array
PmiDataInfo[] ret = new PmiDataInfo[levelData.size()];
for (int i = 0; i < ret.length; i++)
ret[i] = (PmiDataInfo) levelData.get(i);
return ret;
} | java | public PmiDataInfo[] listLevelData(int level) {
ArrayList levelData = new ArrayList();
Iterator allData = perfData.values().iterator();
while (allData.hasNext()) {
PmiDataInfo dataInfo = (PmiDataInfo) allData.next();
if (dataInfo.getLevel() <= level) {
levelData.add(dataInfo);
}
}
// get the array
PmiDataInfo[] ret = new PmiDataInfo[levelData.size()];
for (int i = 0; i < ret.length; i++)
ret[i] = (PmiDataInfo) levelData.get(i);
return ret;
} | [
"public",
"PmiDataInfo",
"[",
"]",
"listLevelData",
"(",
"int",
"level",
")",
"{",
"ArrayList",
"levelData",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Iterator",
"allData",
"=",
"perfData",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"allData",
".",
"hasNext",
"(",
")",
")",
"{",
"PmiDataInfo",
"dataInfo",
"=",
"(",
"PmiDataInfo",
")",
"allData",
".",
"next",
"(",
")",
";",
"if",
"(",
"dataInfo",
".",
"getLevel",
"(",
")",
"<=",
"level",
")",
"{",
"levelData",
".",
"add",
"(",
"dataInfo",
")",
";",
"}",
"}",
"// get the array",
"PmiDataInfo",
"[",
"]",
"ret",
"=",
"new",
"PmiDataInfo",
"[",
"levelData",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ret",
".",
"length",
";",
"i",
"++",
")",
"ret",
"[",
"i",
"]",
"=",
"(",
"PmiDataInfo",
")",
"levelData",
".",
"get",
"(",
"i",
")",
";",
"return",
"ret",
";",
"}"
] | Returns the statistic with level equal to or lower than 'level' | [
"Returns",
"the",
"statistic",
"with",
"level",
"equal",
"to",
"or",
"lower",
"than",
"level"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PmiModuleConfig.java#L222-L239 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PmiModuleConfig.java | PmiModuleConfig.listMyLevelData | public PmiDataInfo[] listMyLevelData(int level) {
ArrayList levelData = new ArrayList();
Iterator allData = perfData.values().iterator();
while (allData.hasNext()) {
PmiDataInfo dataInfo = (PmiDataInfo) allData.next();
if (dataInfo.getLevel() == level) {
levelData.add(dataInfo);
}
}
return (PmiDataInfo[]) levelData.toArray();
} | java | public PmiDataInfo[] listMyLevelData(int level) {
ArrayList levelData = new ArrayList();
Iterator allData = perfData.values().iterator();
while (allData.hasNext()) {
PmiDataInfo dataInfo = (PmiDataInfo) allData.next();
if (dataInfo.getLevel() == level) {
levelData.add(dataInfo);
}
}
return (PmiDataInfo[]) levelData.toArray();
} | [
"public",
"PmiDataInfo",
"[",
"]",
"listMyLevelData",
"(",
"int",
"level",
")",
"{",
"ArrayList",
"levelData",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Iterator",
"allData",
"=",
"perfData",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"allData",
".",
"hasNext",
"(",
")",
")",
"{",
"PmiDataInfo",
"dataInfo",
"=",
"(",
"PmiDataInfo",
")",
"allData",
".",
"next",
"(",
")",
";",
"if",
"(",
"dataInfo",
".",
"getLevel",
"(",
")",
"==",
"level",
")",
"{",
"levelData",
".",
"add",
"(",
"dataInfo",
")",
";",
"}",
"}",
"return",
"(",
"PmiDataInfo",
"[",
"]",
")",
"levelData",
".",
"toArray",
"(",
")",
";",
"}"
] | Returns the statistic with level equal to 'level' | [
"Returns",
"the",
"statistic",
"with",
"level",
"equal",
"to",
"level"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PmiModuleConfig.java#L244-L255 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PmiModuleConfig.java | PmiModuleConfig.listStatisticsWithDependents | public int[] listStatisticsWithDependents() {
if (dependList == null) {
ArrayList list = new ArrayList();
Iterator allData = perfData.values().iterator();
while (allData.hasNext()) {
PmiDataInfo dataInfo = (PmiDataInfo) allData.next();
if (dataInfo.getDependency() != null) {
list.add(new Integer(dataInfo.getId()));
}
}
dependList = new int[list.size()];
for (int i = 0; i < list.size(); i++) {
dependList[i] = ((Integer) list.get(i)).intValue();
}
}
return dependList;
} | java | public int[] listStatisticsWithDependents() {
if (dependList == null) {
ArrayList list = new ArrayList();
Iterator allData = perfData.values().iterator();
while (allData.hasNext()) {
PmiDataInfo dataInfo = (PmiDataInfo) allData.next();
if (dataInfo.getDependency() != null) {
list.add(new Integer(dataInfo.getId()));
}
}
dependList = new int[list.size()];
for (int i = 0; i < list.size(); i++) {
dependList[i] = ((Integer) list.get(i)).intValue();
}
}
return dependList;
} | [
"public",
"int",
"[",
"]",
"listStatisticsWithDependents",
"(",
")",
"{",
"if",
"(",
"dependList",
"==",
"null",
")",
"{",
"ArrayList",
"list",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Iterator",
"allData",
"=",
"perfData",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"allData",
".",
"hasNext",
"(",
")",
")",
"{",
"PmiDataInfo",
"dataInfo",
"=",
"(",
"PmiDataInfo",
")",
"allData",
".",
"next",
"(",
")",
";",
"if",
"(",
"dataInfo",
".",
"getDependency",
"(",
")",
"!=",
"null",
")",
"{",
"list",
".",
"add",
"(",
"new",
"Integer",
"(",
"dataInfo",
".",
"getId",
"(",
")",
")",
")",
";",
"}",
"}",
"dependList",
"=",
"new",
"int",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"dependList",
"[",
"i",
"]",
"=",
"(",
"(",
"Integer",
")",
"list",
".",
"get",
"(",
"i",
")",
")",
".",
"intValue",
"(",
")",
";",
"}",
"}",
"return",
"dependList",
";",
"}"
] | Returns String representation of this object | [
"Returns",
"String",
"representation",
"of",
"this",
"object"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/PmiModuleConfig.java#L293-L310 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/env/was/Cache.java | Cache.scheduleEvictionTask | private void scheduleEvictionTask(long timeoutInMilliSeconds) {
EvictionTask evictionTask = new EvictionTask();
// Before creating new Timers, which create new Threads, we
// must ensure that we are not using any application classloader
// as the current thread's context classloader. Otherwise, it
// is possible that the new Timer thread would hold on to the
// app classloader indefinitely, thereby leaking it and all
// classes that it loaded, long after the app has been stopped.
SwapTCCLAction swapTCCL = new SwapTCCLAction();
AccessController.doPrivileged(swapTCCL);
try {
timer = new Timer(true);
long period = timeoutInMilliSeconds / 3;
long delay = period;
timer.schedule(evictionTask, delay, period);
} finally {
AccessController.doPrivileged(swapTCCL);
}
} | java | private void scheduleEvictionTask(long timeoutInMilliSeconds) {
EvictionTask evictionTask = new EvictionTask();
// Before creating new Timers, which create new Threads, we
// must ensure that we are not using any application classloader
// as the current thread's context classloader. Otherwise, it
// is possible that the new Timer thread would hold on to the
// app classloader indefinitely, thereby leaking it and all
// classes that it loaded, long after the app has been stopped.
SwapTCCLAction swapTCCL = new SwapTCCLAction();
AccessController.doPrivileged(swapTCCL);
try {
timer = new Timer(true);
long period = timeoutInMilliSeconds / 3;
long delay = period;
timer.schedule(evictionTask, delay, period);
} finally {
AccessController.doPrivileged(swapTCCL);
}
} | [
"private",
"void",
"scheduleEvictionTask",
"(",
"long",
"timeoutInMilliSeconds",
")",
"{",
"EvictionTask",
"evictionTask",
"=",
"new",
"EvictionTask",
"(",
")",
";",
"// Before creating new Timers, which create new Threads, we",
"// must ensure that we are not using any application classloader",
"// as the current thread's context classloader. Otherwise, it",
"// is possible that the new Timer thread would hold on to the",
"// app classloader indefinitely, thereby leaking it and all",
"// classes that it loaded, long after the app has been stopped.",
"SwapTCCLAction",
"swapTCCL",
"=",
"new",
"SwapTCCLAction",
"(",
")",
";",
"AccessController",
".",
"doPrivileged",
"(",
"swapTCCL",
")",
";",
"try",
"{",
"timer",
"=",
"new",
"Timer",
"(",
"true",
")",
";",
"long",
"period",
"=",
"timeoutInMilliSeconds",
"/",
"3",
";",
"long",
"delay",
"=",
"period",
";",
"timer",
".",
"schedule",
"(",
"evictionTask",
",",
"delay",
",",
"period",
")",
";",
"}",
"finally",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"swapTCCL",
")",
";",
"}",
"}"
] | Creates a timer and schedules the eviction task based on the timeout in milliseconds
@param timeoutInMilliSeconds the time to be used in milliseconds for the eviction task | [
"Creates",
"a",
"timer",
"and",
"schedules",
"the",
"eviction",
"task",
"based",
"on",
"the",
"timeout",
"in",
"milliseconds"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/env/was/Cache.java#L149-L168 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/env/was/Cache.java | Cache.update | public synchronized Object update(String key, Object value) {
// evict until size < maxSize
while (isEvictionRequired() && entryLimit > 0 && entryLimit < Integer.MAX_VALUE) {
evictStaleEntries();
}
CacheEntry oldEntry = null;
CacheEntry curEntry = new CacheEntry(value);
if (primaryTable.containsKey(key)) {
oldEntry = (CacheEntry) primaryTable.put(key, curEntry);
} else if (secondaryTable.containsKey(key)) {
oldEntry = (CacheEntry) secondaryTable.put(key, curEntry);
} else if (tertiaryTable.containsKey(key)) {
oldEntry = (CacheEntry) tertiaryTable.put(key, curEntry);
} else {
oldEntry = (CacheEntry) primaryTable.put(key, curEntry);
}
return oldEntry != null ? oldEntry.value : null;
} | java | public synchronized Object update(String key, Object value) {
// evict until size < maxSize
while (isEvictionRequired() && entryLimit > 0 && entryLimit < Integer.MAX_VALUE) {
evictStaleEntries();
}
CacheEntry oldEntry = null;
CacheEntry curEntry = new CacheEntry(value);
if (primaryTable.containsKey(key)) {
oldEntry = (CacheEntry) primaryTable.put(key, curEntry);
} else if (secondaryTable.containsKey(key)) {
oldEntry = (CacheEntry) secondaryTable.put(key, curEntry);
} else if (tertiaryTable.containsKey(key)) {
oldEntry = (CacheEntry) tertiaryTable.put(key, curEntry);
} else {
oldEntry = (CacheEntry) primaryTable.put(key, curEntry);
}
return oldEntry != null ? oldEntry.value : null;
} | [
"public",
"synchronized",
"Object",
"update",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"// evict until size < maxSize",
"while",
"(",
"isEvictionRequired",
"(",
")",
"&&",
"entryLimit",
">",
"0",
"&&",
"entryLimit",
"<",
"Integer",
".",
"MAX_VALUE",
")",
"{",
"evictStaleEntries",
"(",
")",
";",
"}",
"CacheEntry",
"oldEntry",
"=",
"null",
";",
"CacheEntry",
"curEntry",
"=",
"new",
"CacheEntry",
"(",
"value",
")",
";",
"if",
"(",
"primaryTable",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"oldEntry",
"=",
"(",
"CacheEntry",
")",
"primaryTable",
".",
"put",
"(",
"key",
",",
"curEntry",
")",
";",
"}",
"else",
"if",
"(",
"secondaryTable",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"oldEntry",
"=",
"(",
"CacheEntry",
")",
"secondaryTable",
".",
"put",
"(",
"key",
",",
"curEntry",
")",
";",
"}",
"else",
"if",
"(",
"tertiaryTable",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"oldEntry",
"=",
"(",
"CacheEntry",
")",
"tertiaryTable",
".",
"put",
"(",
"key",
",",
"curEntry",
")",
";",
"}",
"else",
"{",
"oldEntry",
"=",
"(",
"CacheEntry",
")",
"primaryTable",
".",
"put",
"(",
"key",
",",
"curEntry",
")",
";",
"}",
"return",
"oldEntry",
"!=",
"null",
"?",
"oldEntry",
".",
"value",
":",
"null",
";",
"}"
] | Update the value into the Cache using the specified key, but do not change
the table level of the cache. If the key is not in any table, add it to
the primaryTable
@param key the key of the entry to be inserted
@param value the value of the entry to be inserted
@return the previous value associated with key, or null if there was none | [
"Update",
"the",
"value",
"into",
"the",
"Cache",
"using",
"the",
"specified",
"key",
"but",
"do",
"not",
"change",
"the",
"table",
"level",
"of",
"the",
"cache",
".",
"If",
"the",
"key",
"is",
"not",
"in",
"any",
"table",
"add",
"it",
"to",
"the",
"primaryTable"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/env/was/Cache.java#L257-L276 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/env/was/Cache.java | Cache.clearAllEntries | public synchronized void clearAllEntries() {
tertiaryTable.putAll(primaryTable);
tertiaryTable.putAll(secondaryTable);
primaryTable.clear();
secondaryTable.clear();
evictStaleEntries();
} | java | public synchronized void clearAllEntries() {
tertiaryTable.putAll(primaryTable);
tertiaryTable.putAll(secondaryTable);
primaryTable.clear();
secondaryTable.clear();
evictStaleEntries();
} | [
"public",
"synchronized",
"void",
"clearAllEntries",
"(",
")",
"{",
"tertiaryTable",
".",
"putAll",
"(",
"primaryTable",
")",
";",
"tertiaryTable",
".",
"putAll",
"(",
"secondaryTable",
")",
";",
"primaryTable",
".",
"clear",
"(",
")",
";",
"secondaryTable",
".",
"clear",
"(",
")",
";",
"evictStaleEntries",
"(",
")",
";",
"}"
] | Purge all entries from the Cache. Semantically, this should
behave the same as the expiration of all entries from
the cache. | [
"Purge",
"all",
"entries",
"from",
"the",
"Cache",
".",
"Semantically",
"this",
"should",
"behave",
"the",
"same",
"as",
"the",
"expiration",
"of",
"all",
"entries",
"from",
"the",
"cache",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/env/was/Cache.java#L338-L347 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/BDAFactory.java | BDAFactory.createBDA | public static WebSphereBeanDeploymentArchive createBDA(WebSphereCDIDeployment deployment,
ExtensionArchive extensionArchive,
CDIRuntime cdiRuntime) throws CDIException {
Set<String> additionalClasses = extensionArchive.getExtraClasses();
Set<String> additionalAnnotations = extensionArchive.getExtraBeanDefiningAnnotations();
boolean extensionCanSeeApplicationBDAs = extensionArchive.applicationBDAsVisible();
boolean extClassesOnlyBDA = extensionArchive.isExtClassesOnly();
String archiveID = deployment.getDeploymentID() + "#" + extensionArchive.getName() + ".additionalClasses";
//this isn't really part of any EE module so we just use the archiveID which should be unique
EEModuleDescriptor eeModuleDescriptor = new WebSphereEEModuleDescriptor(archiveID, extensionArchive.getType());
WebSphereBeanDeploymentArchive bda = createBDA(deployment,
archiveID,
extensionArchive,
cdiRuntime,
additionalClasses,
additionalAnnotations,
extensionCanSeeApplicationBDAs,
extClassesOnlyBDA,
eeModuleDescriptor);
return bda;
} | java | public static WebSphereBeanDeploymentArchive createBDA(WebSphereCDIDeployment deployment,
ExtensionArchive extensionArchive,
CDIRuntime cdiRuntime) throws CDIException {
Set<String> additionalClasses = extensionArchive.getExtraClasses();
Set<String> additionalAnnotations = extensionArchive.getExtraBeanDefiningAnnotations();
boolean extensionCanSeeApplicationBDAs = extensionArchive.applicationBDAsVisible();
boolean extClassesOnlyBDA = extensionArchive.isExtClassesOnly();
String archiveID = deployment.getDeploymentID() + "#" + extensionArchive.getName() + ".additionalClasses";
//this isn't really part of any EE module so we just use the archiveID which should be unique
EEModuleDescriptor eeModuleDescriptor = new WebSphereEEModuleDescriptor(archiveID, extensionArchive.getType());
WebSphereBeanDeploymentArchive bda = createBDA(deployment,
archiveID,
extensionArchive,
cdiRuntime,
additionalClasses,
additionalAnnotations,
extensionCanSeeApplicationBDAs,
extClassesOnlyBDA,
eeModuleDescriptor);
return bda;
} | [
"public",
"static",
"WebSphereBeanDeploymentArchive",
"createBDA",
"(",
"WebSphereCDIDeployment",
"deployment",
",",
"ExtensionArchive",
"extensionArchive",
",",
"CDIRuntime",
"cdiRuntime",
")",
"throws",
"CDIException",
"{",
"Set",
"<",
"String",
">",
"additionalClasses",
"=",
"extensionArchive",
".",
"getExtraClasses",
"(",
")",
";",
"Set",
"<",
"String",
">",
"additionalAnnotations",
"=",
"extensionArchive",
".",
"getExtraBeanDefiningAnnotations",
"(",
")",
";",
"boolean",
"extensionCanSeeApplicationBDAs",
"=",
"extensionArchive",
".",
"applicationBDAsVisible",
"(",
")",
";",
"boolean",
"extClassesOnlyBDA",
"=",
"extensionArchive",
".",
"isExtClassesOnly",
"(",
")",
";",
"String",
"archiveID",
"=",
"deployment",
".",
"getDeploymentID",
"(",
")",
"+",
"\"#\"",
"+",
"extensionArchive",
".",
"getName",
"(",
")",
"+",
"\".additionalClasses\"",
";",
"//this isn't really part of any EE module so we just use the archiveID which should be unique",
"EEModuleDescriptor",
"eeModuleDescriptor",
"=",
"new",
"WebSphereEEModuleDescriptor",
"(",
"archiveID",
",",
"extensionArchive",
".",
"getType",
"(",
")",
")",
";",
"WebSphereBeanDeploymentArchive",
"bda",
"=",
"createBDA",
"(",
"deployment",
",",
"archiveID",
",",
"extensionArchive",
",",
"cdiRuntime",
",",
"additionalClasses",
",",
"additionalAnnotations",
",",
"extensionCanSeeApplicationBDAs",
",",
"extClassesOnlyBDA",
",",
"eeModuleDescriptor",
")",
";",
"return",
"bda",
";",
"}"
] | only for extensions | [
"only",
"for",
"extensions"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/BDAFactory.java#L71-L94 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java | WrapperManager.setWrapperCacheSize | public void setWrapperCacheSize(int cacheSize)
{
wrapperCache.setCachePreferredMaxSize(cacheSize);
int updatedCacheSize = getBeanIdCacheSize(cacheSize);
beanIdCache.setSize(updatedCacheSize);
} | java | public void setWrapperCacheSize(int cacheSize)
{
wrapperCache.setCachePreferredMaxSize(cacheSize);
int updatedCacheSize = getBeanIdCacheSize(cacheSize);
beanIdCache.setSize(updatedCacheSize);
} | [
"public",
"void",
"setWrapperCacheSize",
"(",
"int",
"cacheSize",
")",
"{",
"wrapperCache",
".",
"setCachePreferredMaxSize",
"(",
"cacheSize",
")",
";",
"int",
"updatedCacheSize",
"=",
"getBeanIdCacheSize",
"(",
"cacheSize",
")",
";",
"beanIdCache",
".",
"setSize",
"(",
"updatedCacheSize",
")",
";",
"}"
] | Call to update the BeanIdCache cache size. | [
"Call",
"to",
"update",
"the",
"BeanIdCache",
"cache",
"size",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java#L127-L132 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java | WrapperManager.getBeanIdCacheSize | private int getBeanIdCacheSize(int cacheSize)
{
int beanIdCacheSize = cacheSize;
if (beanIdCacheSize < (Integer.MAX_VALUE / 2))
beanIdCacheSize = beanIdCacheSize * 2;
else
beanIdCacheSize = Integer.MAX_VALUE;
return beanIdCacheSize;
} | java | private int getBeanIdCacheSize(int cacheSize)
{
int beanIdCacheSize = cacheSize;
if (beanIdCacheSize < (Integer.MAX_VALUE / 2))
beanIdCacheSize = beanIdCacheSize * 2;
else
beanIdCacheSize = Integer.MAX_VALUE;
return beanIdCacheSize;
} | [
"private",
"int",
"getBeanIdCacheSize",
"(",
"int",
"cacheSize",
")",
"{",
"int",
"beanIdCacheSize",
"=",
"cacheSize",
";",
"if",
"(",
"beanIdCacheSize",
"<",
"(",
"Integer",
".",
"MAX_VALUE",
"/",
"2",
")",
")",
"beanIdCacheSize",
"=",
"beanIdCacheSize",
"*",
"2",
";",
"else",
"beanIdCacheSize",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"return",
"beanIdCacheSize",
";",
"}"
] | Calculate the size to be used for the BeanIdCache.
@return cacheSize | [
"Calculate",
"the",
"size",
"to",
"be",
"used",
"for",
"the",
"BeanIdCache",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java#L139-L148 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java | WrapperManager.unregister | public boolean unregister(BeanId beanId, boolean dropRef) // f111627
throws CSIException
{
boolean removed = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "unregister",
new Object[] { beanId, new Boolean(dropRef) }); // d181569
ByteArray wrapperKey = beanId.getByteArray(); // d181569
try
{
EJSWrapperCommon wrapperCommon = (EJSWrapperCommon) // f111627
wrapperCache.removeAndDiscard(wrapperKey, dropRef);
if (wrapperCommon != null) { // f111627
removed = true;
}
} catch (IllegalOperationException ex)
{
// Object is pinned and cannot be removed from the cache
// Swallow the exception for now, and let the Eviction thread
// take care of the object later
FFDCFilter.processException(ex, CLASS_NAME + ".unregister", "351", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { // d144064
Tr.event(tc,
"unregister ignoring IllegalOperationException for object "
+ beanId); // d181569
Tr.event(tc, "Exception: " + ex);
}
} catch (DiscardException ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".unregister", "358", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) // d144064
Tr.event(tc, "Unable to discard element");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "unregister");
return removed;
} | java | public boolean unregister(BeanId beanId, boolean dropRef) // f111627
throws CSIException
{
boolean removed = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "unregister",
new Object[] { beanId, new Boolean(dropRef) }); // d181569
ByteArray wrapperKey = beanId.getByteArray(); // d181569
try
{
EJSWrapperCommon wrapperCommon = (EJSWrapperCommon) // f111627
wrapperCache.removeAndDiscard(wrapperKey, dropRef);
if (wrapperCommon != null) { // f111627
removed = true;
}
} catch (IllegalOperationException ex)
{
// Object is pinned and cannot be removed from the cache
// Swallow the exception for now, and let the Eviction thread
// take care of the object later
FFDCFilter.processException(ex, CLASS_NAME + ".unregister", "351", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { // d144064
Tr.event(tc,
"unregister ignoring IllegalOperationException for object "
+ beanId); // d181569
Tr.event(tc, "Exception: " + ex);
}
} catch (DiscardException ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".unregister", "358", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) // d144064
Tr.event(tc, "Unable to discard element");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "unregister");
return removed;
} | [
"public",
"boolean",
"unregister",
"(",
"BeanId",
"beanId",
",",
"boolean",
"dropRef",
")",
"// f111627",
"throws",
"CSIException",
"{",
"boolean",
"removed",
"=",
"false",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"unregister\"",
",",
"new",
"Object",
"[",
"]",
"{",
"beanId",
",",
"new",
"Boolean",
"(",
"dropRef",
")",
"}",
")",
";",
"// d181569",
"ByteArray",
"wrapperKey",
"=",
"beanId",
".",
"getByteArray",
"(",
")",
";",
"// d181569",
"try",
"{",
"EJSWrapperCommon",
"wrapperCommon",
"=",
"(",
"EJSWrapperCommon",
")",
"// f111627",
"wrapperCache",
".",
"removeAndDiscard",
"(",
"wrapperKey",
",",
"dropRef",
")",
";",
"if",
"(",
"wrapperCommon",
"!=",
"null",
")",
"{",
"// f111627",
"removed",
"=",
"true",
";",
"}",
"}",
"catch",
"(",
"IllegalOperationException",
"ex",
")",
"{",
"// Object is pinned and cannot be removed from the cache",
"// Swallow the exception for now, and let the Eviction thread",
"// take care of the object later",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"CLASS_NAME",
"+",
"\".unregister\"",
",",
"\"351\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"// d144064",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"unregister ignoring IllegalOperationException for object \"",
"+",
"beanId",
")",
";",
"// d181569",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Exception: \"",
"+",
"ex",
")",
";",
"}",
"}",
"catch",
"(",
"DiscardException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"CLASS_NAME",
"+",
"\".unregister\"",
",",
"\"358\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"// d144064",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Unable to discard element\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"unregister\"",
")",
";",
"return",
"removed",
";",
"}"
] | d181569 - changed signature of method. | [
"d181569",
"-",
"changed",
"signature",
"of",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java#L374-L415 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java | WrapperManager.unregisterHome | public void unregisterHome(J2EEName homeName, EJSHome homeObj)
throws CSIException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "unregisterHome");
J2EEName cacheHomeName;
int numEnumerated = 0, numRemoved = 0; // d103404.2
Enumeration<?> enumerate = wrapperCache.enumerateElements();
while (enumerate.hasMoreElements())
{
// need to get the beanid from either the remote or local wrapper,
// whichever is available, the beanid must be the same for both wrappers
EJSWrapperCommon wCommon = (EJSWrapperCommon) // f111627
((CacheElement) enumerate.nextElement()).getObject(); // f111627
BeanId cacheMemberBeanId = wCommon.getBeanId(); // d181569
cacheHomeName = cacheMemberBeanId.getJ2EEName();
numEnumerated++;
// If the cache has homeObj as it's home or is itself the home,
// remove it. If the wrapper has been removed since it was found
// (above), then the call to unregister() will just return false.
// Note that the enumeration can handle elements being removed
// from the cache while enumerating. d103404.2
if (cacheHomeName.equals(homeName) ||
cacheMemberBeanId.equals(homeObj.getId()))
{
unregister(cacheMemberBeanId, true); // d181217 d181569
numRemoved++;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // d103404.1 d103404.2
Tr.debug(tc, "Unregistered " + numRemoved +
" wrappers (total = " + numEnumerated + ")");
}
// Now remove any cached BeanIds for this home. d152323
beanIdCache.removeAll(homeObj);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "unregisterHome");
} | java | public void unregisterHome(J2EEName homeName, EJSHome homeObj)
throws CSIException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "unregisterHome");
J2EEName cacheHomeName;
int numEnumerated = 0, numRemoved = 0; // d103404.2
Enumeration<?> enumerate = wrapperCache.enumerateElements();
while (enumerate.hasMoreElements())
{
// need to get the beanid from either the remote or local wrapper,
// whichever is available, the beanid must be the same for both wrappers
EJSWrapperCommon wCommon = (EJSWrapperCommon) // f111627
((CacheElement) enumerate.nextElement()).getObject(); // f111627
BeanId cacheMemberBeanId = wCommon.getBeanId(); // d181569
cacheHomeName = cacheMemberBeanId.getJ2EEName();
numEnumerated++;
// If the cache has homeObj as it's home or is itself the home,
// remove it. If the wrapper has been removed since it was found
// (above), then the call to unregister() will just return false.
// Note that the enumeration can handle elements being removed
// from the cache while enumerating. d103404.2
if (cacheHomeName.equals(homeName) ||
cacheMemberBeanId.equals(homeObj.getId()))
{
unregister(cacheMemberBeanId, true); // d181217 d181569
numRemoved++;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // d103404.1 d103404.2
Tr.debug(tc, "Unregistered " + numRemoved +
" wrappers (total = " + numEnumerated + ")");
}
// Now remove any cached BeanIds for this home. d152323
beanIdCache.removeAll(homeObj);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "unregisterHome");
} | [
"public",
"void",
"unregisterHome",
"(",
"J2EEName",
"homeName",
",",
"EJSHome",
"homeObj",
")",
"throws",
"CSIException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"unregisterHome\"",
")",
";",
"J2EEName",
"cacheHomeName",
";",
"int",
"numEnumerated",
"=",
"0",
",",
"numRemoved",
"=",
"0",
";",
"// d103404.2",
"Enumeration",
"<",
"?",
">",
"enumerate",
"=",
"wrapperCache",
".",
"enumerateElements",
"(",
")",
";",
"while",
"(",
"enumerate",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"// need to get the beanid from either the remote or local wrapper,",
"// whichever is available, the beanid must be the same for both wrappers",
"EJSWrapperCommon",
"wCommon",
"=",
"(",
"EJSWrapperCommon",
")",
"// f111627",
"(",
"(",
"CacheElement",
")",
"enumerate",
".",
"nextElement",
"(",
")",
")",
".",
"getObject",
"(",
")",
";",
"// f111627",
"BeanId",
"cacheMemberBeanId",
"=",
"wCommon",
".",
"getBeanId",
"(",
")",
";",
"// d181569",
"cacheHomeName",
"=",
"cacheMemberBeanId",
".",
"getJ2EEName",
"(",
")",
";",
"numEnumerated",
"++",
";",
"// If the cache has homeObj as it's home or is itself the home,",
"// remove it. If the wrapper has been removed since it was found",
"// (above), then the call to unregister() will just return false.",
"// Note that the enumeration can handle elements being removed",
"// from the cache while enumerating. d103404.2",
"if",
"(",
"cacheHomeName",
".",
"equals",
"(",
"homeName",
")",
"||",
"cacheMemberBeanId",
".",
"equals",
"(",
"homeObj",
".",
"getId",
"(",
")",
")",
")",
"{",
"unregister",
"(",
"cacheMemberBeanId",
",",
"true",
")",
";",
"// d181217 d181569",
"numRemoved",
"++",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// d103404.1 d103404.2",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Unregistered \"",
"+",
"numRemoved",
"+",
"\" wrappers (total = \"",
"+",
"numEnumerated",
"+",
"\")\"",
")",
";",
"}",
"// Now remove any cached BeanIds for this home. d152323",
"beanIdCache",
".",
"removeAll",
"(",
"homeObj",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"unregisterHome\"",
")",
";",
"}"
] | unregisterHome removes from cache homeObj and all Objects that
have homeObj as it's home. It also unregisters these objects from
from the orb object adapter. | [
"unregisterHome",
"removes",
"from",
"cache",
"homeObj",
"and",
"all",
"Objects",
"that",
"have",
"homeObj",
"as",
"it",
"s",
"home",
".",
"It",
"also",
"unregisters",
"these",
"objects",
"from",
"from",
"the",
"orb",
"object",
"adapter",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java#L422-L466 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java | WrapperManager.discardObject | @Override
public void discardObject(EJBCache wrapperCache, Object key, Object ele)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "discardObject", new Object[] { key, ele });
EJSWrapperCommon wrapperCommon = (EJSWrapperCommon) ele;
wrapperCommon.disconnect(); // @MD20022C, F58064
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "discardObject");
} | java | @Override
public void discardObject(EJBCache wrapperCache, Object key, Object ele)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "discardObject", new Object[] { key, ele });
EJSWrapperCommon wrapperCommon = (EJSWrapperCommon) ele;
wrapperCommon.disconnect(); // @MD20022C, F58064
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "discardObject");
} | [
"@",
"Override",
"public",
"void",
"discardObject",
"(",
"EJBCache",
"wrapperCache",
",",
"Object",
"key",
",",
"Object",
"ele",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"discardObject\"",
",",
"new",
"Object",
"[",
"]",
"{",
"key",
",",
"ele",
"}",
")",
";",
"EJSWrapperCommon",
"wrapperCommon",
"=",
"(",
"EJSWrapperCommon",
")",
"ele",
";",
"wrapperCommon",
".",
"disconnect",
"(",
")",
";",
"// @MD20022C, F58064",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"discardObject\"",
")",
";",
"}"
] | Unregister a wrapper instance when it is castout of the wrapper
cache. | [
"Unregister",
"a",
"wrapper",
"instance",
"when",
"it",
"is",
"castout",
"of",
"the",
"wrapper",
"cache",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java#L472-L483 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java | WrapperManager.faultOnKey | @Override
public Object faultOnKey(EJBCache cache, Object key)
throws FaultException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "faultOnKey", key);
ByteArray wrapperKey = (ByteArray) key;
EJSWrapperCommon result = null; // f111627
// Check if the beanId is already set on this key in which case
// we can avoid the deserialize
BeanId beanId = wrapperKey.getBeanId();
try
{
if (beanId == null) {
beanId = BeanId.getBeanId(wrapperKey, container); // d140003.12
}
result = container.createWrapper(beanId);
} catch (InvalidBeanIdException ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".faultOnKey", "533", this);
// If the nested exception is an EJBNotFoundException, then report
// that the app is not started/installed, rather than just the
// generic 'Malformed object key'. d356676.1
Throwable cause = ex.getCause();
if (cause instanceof EJBNotFoundException)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Application Not Started", ex);
throw new FaultException((EJBNotFoundException) cause,
"Application not started or not installed");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Malformed object key", ex);
throw new FaultException(ex, "Malformed object key");
} catch (Exception ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".faultOnKey", "548", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Malformed object key", ex);
throw new FaultException(ex, "Malformed object key");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "faultOnKey");
return result;
} | java | @Override
public Object faultOnKey(EJBCache cache, Object key)
throws FaultException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "faultOnKey", key);
ByteArray wrapperKey = (ByteArray) key;
EJSWrapperCommon result = null; // f111627
// Check if the beanId is already set on this key in which case
// we can avoid the deserialize
BeanId beanId = wrapperKey.getBeanId();
try
{
if (beanId == null) {
beanId = BeanId.getBeanId(wrapperKey, container); // d140003.12
}
result = container.createWrapper(beanId);
} catch (InvalidBeanIdException ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".faultOnKey", "533", this);
// If the nested exception is an EJBNotFoundException, then report
// that the app is not started/installed, rather than just the
// generic 'Malformed object key'. d356676.1
Throwable cause = ex.getCause();
if (cause instanceof EJBNotFoundException)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Application Not Started", ex);
throw new FaultException((EJBNotFoundException) cause,
"Application not started or not installed");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Malformed object key", ex);
throw new FaultException(ex, "Malformed object key");
} catch (Exception ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".faultOnKey", "548", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(tc, "Malformed object key", ex);
throw new FaultException(ex, "Malformed object key");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "faultOnKey");
return result;
} | [
"@",
"Override",
"public",
"Object",
"faultOnKey",
"(",
"EJBCache",
"cache",
",",
"Object",
"key",
")",
"throws",
"FaultException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"faultOnKey\"",
",",
"key",
")",
";",
"ByteArray",
"wrapperKey",
"=",
"(",
"ByteArray",
")",
"key",
";",
"EJSWrapperCommon",
"result",
"=",
"null",
";",
"// f111627",
"// Check if the beanId is already set on this key in which case",
"// we can avoid the deserialize",
"BeanId",
"beanId",
"=",
"wrapperKey",
".",
"getBeanId",
"(",
")",
";",
"try",
"{",
"if",
"(",
"beanId",
"==",
"null",
")",
"{",
"beanId",
"=",
"BeanId",
".",
"getBeanId",
"(",
"wrapperKey",
",",
"container",
")",
";",
"// d140003.12",
"}",
"result",
"=",
"container",
".",
"createWrapper",
"(",
"beanId",
")",
";",
"}",
"catch",
"(",
"InvalidBeanIdException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"CLASS_NAME",
"+",
"\".faultOnKey\"",
",",
"\"533\"",
",",
"this",
")",
";",
"// If the nested exception is an EJBNotFoundException, then report",
"// that the app is not started/installed, rather than just the",
"// generic 'Malformed object key'. d356676.1",
"Throwable",
"cause",
"=",
"ex",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"cause",
"instanceof",
"EJBNotFoundException",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Application Not Started\"",
",",
"ex",
")",
";",
"throw",
"new",
"FaultException",
"(",
"(",
"EJBNotFoundException",
")",
"cause",
",",
"\"Application not started or not installed\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Malformed object key\"",
",",
"ex",
")",
";",
"throw",
"new",
"FaultException",
"(",
"ex",
",",
"\"Malformed object key\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"CLASS_NAME",
"+",
"\".faultOnKey\"",
",",
"\"548\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Malformed object key\"",
",",
"ex",
")",
";",
"throw",
"new",
"FaultException",
"(",
"ex",
",",
"\"Malformed object key\"",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"faultOnKey\"",
")",
";",
"return",
"result",
";",
"}"
] | Invoked by the Cache FaultStrategy when an object was not found
and needs to be inserted. We create a new wrapper instance to be
inserted into the cache. The cache package holds the lock on a
bucket when this method is invoked. | [
"Invoked",
"by",
"the",
"Cache",
"FaultStrategy",
"when",
"an",
"object",
"was",
"not",
"found",
"and",
"needs",
"to",
"be",
"inserted",
".",
"We",
"create",
"a",
"new",
"wrapper",
"instance",
"to",
"be",
"inserted",
"into",
"the",
"cache",
".",
"The",
"cache",
"package",
"holds",
"the",
"lock",
"on",
"a",
"bucket",
"when",
"this",
"method",
"is",
"invoked",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/WrapperManager.java#L589-L639 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.token/src/com/ibm/ws/security/token/internal/AbstractTokenImpl.java | AbstractTokenImpl.isValid | public boolean isValid() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Checking validity of token " + this.getClass().getName());
if (token != null) {
// return if this token is still valid
long currentTime = System.currentTimeMillis();
long expiration = getExpiration();
long timeleft = expiration - currentTime;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Time left for token: " + timeleft);
if (timeleft > 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "token is valid.");
return true;
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "token is invalid.");
return false;
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "token is null, returning invalid.");
return false;
}
} | java | public boolean isValid() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Checking validity of token " + this.getClass().getName());
if (token != null) {
// return if this token is still valid
long currentTime = System.currentTimeMillis();
long expiration = getExpiration();
long timeleft = expiration - currentTime;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Time left for token: " + timeleft);
if (timeleft > 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "token is valid.");
return true;
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "token is invalid.");
return false;
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "token is null, returning invalid.");
return false;
}
} | [
"public",
"boolean",
"isValid",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Checking validity of token \"",
"+",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"token",
"!=",
"null",
")",
"{",
"// return if this token is still valid",
"long",
"currentTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"long",
"expiration",
"=",
"getExpiration",
"(",
")",
";",
"long",
"timeleft",
"=",
"expiration",
"-",
"currentTime",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Time left for token: \"",
"+",
"timeleft",
")",
";",
"if",
"(",
"timeleft",
">",
"0",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"token is valid.\"",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"token is invalid.\"",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"token is null, returning invalid.\"",
")",
";",
"return",
"false",
";",
"}",
"}"
] | Validates the token including expiration, signature, etc.
@return boolean | [
"Validates",
"the",
"token",
"including",
"expiration",
"signature",
"etc",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.token/src/com/ibm/ws/security/token/internal/AbstractTokenImpl.java#L65-L92 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.token/src/com/ibm/ws/security/token/internal/AbstractTokenImpl.java | AbstractTokenImpl.getPrincipal | public String getPrincipal() {
String[] accessIDArray = getAttributes("u");
if (accessIDArray != null && accessIDArray.length > 0)
return accessIDArray[0];
else
return null;
} | java | public String getPrincipal() {
String[] accessIDArray = getAttributes("u");
if (accessIDArray != null && accessIDArray.length > 0)
return accessIDArray[0];
else
return null;
} | [
"public",
"String",
"getPrincipal",
"(",
")",
"{",
"String",
"[",
"]",
"accessIDArray",
"=",
"getAttributes",
"(",
"\"u\"",
")",
";",
"if",
"(",
"accessIDArray",
"!=",
"null",
"&&",
"accessIDArray",
".",
"length",
">",
"0",
")",
"return",
"accessIDArray",
"[",
"0",
"]",
";",
"else",
"return",
"null",
";",
"}"
] | Gets the principal that this Token belongs to. If this is an authorization token,
this principal string must match the authentication token principal string or the
message will be rejected.
@return String | [
"Gets",
"the",
"principal",
"that",
"this",
"Token",
"belongs",
"to",
".",
"If",
"this",
"is",
"an",
"authorization",
"token",
"this",
"principal",
"string",
"must",
"match",
"the",
"authentication",
"token",
"principal",
"string",
"or",
"the",
"message",
"will",
"be",
"rejected",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.token/src/com/ibm/ws/security/token/internal/AbstractTokenImpl.java#L122-L129 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.token/src/com/ibm/ws/security/token/internal/AbstractTokenImpl.java | AbstractTokenImpl.getUniqueID | public String getUniqueID() {
// return null so that this token does not change the uniqueness,
// all static attributes from the default tokens.
String[] cacheKeyArray = getAttributes(AttributeNameConstants.WSCREDENTIAL_CACHE_KEY);
if (cacheKeyArray != null && cacheKeyArray[0] != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Found cache key in Authz token: " + cacheKeyArray[0]);
return cacheKeyArray[0];
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "No unique cache key found in token.");
return null;
} | java | public String getUniqueID() {
// return null so that this token does not change the uniqueness,
// all static attributes from the default tokens.
String[] cacheKeyArray = getAttributes(AttributeNameConstants.WSCREDENTIAL_CACHE_KEY);
if (cacheKeyArray != null && cacheKeyArray[0] != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Found cache key in Authz token: " + cacheKeyArray[0]);
return cacheKeyArray[0];
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "No unique cache key found in token.");
return null;
} | [
"public",
"String",
"getUniqueID",
"(",
")",
"{",
"// return null so that this token does not change the uniqueness, ",
"// all static attributes from the default tokens.",
"String",
"[",
"]",
"cacheKeyArray",
"=",
"getAttributes",
"(",
"AttributeNameConstants",
".",
"WSCREDENTIAL_CACHE_KEY",
")",
";",
"if",
"(",
"cacheKeyArray",
"!=",
"null",
"&&",
"cacheKeyArray",
"[",
"0",
"]",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Found cache key in Authz token: \"",
"+",
"cacheKeyArray",
"[",
"0",
"]",
")",
";",
"return",
"cacheKeyArray",
"[",
"0",
"]",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"No unique cache key found in token.\"",
")",
";",
"return",
"null",
";",
"}"
] | Returns a unique identifier of the token based upon information the provider
considers makes this a unique token. This will be used for caching purposes
and may be used in combination with other token unique IDs that are part of
the same Subject.
This method should return null if you want the accessID of the user to represent
uniqueness. This is the typical scenario.
@return String | [
"Returns",
"a",
"unique",
"identifier",
"of",
"the",
"token",
"based",
"upon",
"information",
"the",
"provider",
"considers",
"makes",
"this",
"a",
"unique",
"token",
".",
"This",
"will",
"be",
"used",
"for",
"caching",
"purposes",
"and",
"may",
"be",
"used",
"in",
"combination",
"with",
"other",
"token",
"unique",
"IDs",
"that",
"are",
"part",
"of",
"the",
"same",
"Subject",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.token/src/com/ibm/ws/security/token/internal/AbstractTokenImpl.java#L142-L156 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.token/src/com/ibm/ws/security/token/internal/AbstractTokenImpl.java | AbstractTokenImpl.getAttributes | public String[] getAttributes(String key) {
if (token != null)
return token.getAttributes(key);
else
return null;
} | java | public String[] getAttributes(String key) {
if (token != null)
return token.getAttributes(key);
else
return null;
} | [
"public",
"String",
"[",
"]",
"getAttributes",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"token",
"!=",
"null",
")",
"return",
"token",
".",
"getAttributes",
"(",
"key",
")",
";",
"else",
"return",
"null",
";",
"}"
] | Gets the attribute value based on the named value.
@param String key
@return String[] | [
"Gets",
"the",
"attribute",
"value",
"based",
"on",
"the",
"named",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.token/src/com/ibm/ws/security/token/internal/AbstractTokenImpl.java#L220-L225 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/items/MessageItemReference.java | MessageItemReference.getMaximumTimeInStore | @Override
public long getMaximumTimeInStore()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getMaximumTimeInStore");
long maxTime = getMessageItem().getMaximumTimeInStore();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMaximumTimeInStore", new Long(maxTime));
return maxTime;
} | java | @Override
public long getMaximumTimeInStore()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getMaximumTimeInStore");
long maxTime = getMessageItem().getMaximumTimeInStore();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMaximumTimeInStore", new Long(maxTime));
return maxTime;
} | [
"@",
"Override",
"public",
"long",
"getMaximumTimeInStore",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getMaximumTimeInStore\"",
")",
";",
"long",
"maxTime",
"=",
"getMessageItem",
"(",
")",
".",
"getMaximumTimeInStore",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMaximumTimeInStore\"",
",",
"new",
"Long",
"(",
"maxTime",
")",
")",
";",
"return",
"maxTime",
";",
"}"
] | Return the maximum time this reference should spend in a ReferenceStream.
The expiry time of a message reference is always the same as its
referenced item. The referenced item's getMaximumTimeInStore() return
will still be the same as it was when it was originally stored - the store
time only updates when the message is removed.
This method first appeared in feature 166831.1 | [
"Return",
"the",
"maximum",
"time",
"this",
"reference",
"should",
"spend",
"in",
"a",
"ReferenceStream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/items/MessageItemReference.java#L326-L338 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/items/MessageItemReference.java | MessageItemReference.resetEvents | private void resetEvents()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "resetEvents");
// Reset all callbacks
PRE_COMMIT_ADD = null;
PRE_COMMIT_REMOVE = null;
POST_COMMIT_ADD_1 = null;
POST_COMMIT_ADD_2 = null;
POST_COMMIT_REMOVE_1 = null;
POST_COMMIT_REMOVE_2 = null;
POST_COMMIT_REMOVE_3 = null;
POST_COMMIT_REMOVE_4 = null;
POST_ROLLBACK_ADD_1 = null;
POST_ROLLBACK_ADD_2 = null;
POST_ROLLBACK_REMOVE_1 = null;
POST_ROLLBACK_REMOVE_2 = null;
POST_ROLLBACK_REMOVE_3 = null;
POST_ROLLBACK_REMOVE_4 = null;
UNLOCKED_1 = null;
UNLOCKED_2 = null;
UNLOCKED_3 = null;
PRE_UNLOCKED_1 = null;
PRE_UNLOCKED_2 = null;
REFERENCES_DROPPED_TO_ZERO = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "resetEvents");
} | java | private void resetEvents()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "resetEvents");
// Reset all callbacks
PRE_COMMIT_ADD = null;
PRE_COMMIT_REMOVE = null;
POST_COMMIT_ADD_1 = null;
POST_COMMIT_ADD_2 = null;
POST_COMMIT_REMOVE_1 = null;
POST_COMMIT_REMOVE_2 = null;
POST_COMMIT_REMOVE_3 = null;
POST_COMMIT_REMOVE_4 = null;
POST_ROLLBACK_ADD_1 = null;
POST_ROLLBACK_ADD_2 = null;
POST_ROLLBACK_REMOVE_1 = null;
POST_ROLLBACK_REMOVE_2 = null;
POST_ROLLBACK_REMOVE_3 = null;
POST_ROLLBACK_REMOVE_4 = null;
UNLOCKED_1 = null;
UNLOCKED_2 = null;
UNLOCKED_3 = null;
PRE_UNLOCKED_1 = null;
PRE_UNLOCKED_2 = null;
REFERENCES_DROPPED_TO_ZERO = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "resetEvents");
} | [
"private",
"void",
"resetEvents",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"resetEvents\"",
")",
";",
"// Reset all callbacks",
"PRE_COMMIT_ADD",
"=",
"null",
";",
"PRE_COMMIT_REMOVE",
"=",
"null",
";",
"POST_COMMIT_ADD_1",
"=",
"null",
";",
"POST_COMMIT_ADD_2",
"=",
"null",
";",
"POST_COMMIT_REMOVE_1",
"=",
"null",
";",
"POST_COMMIT_REMOVE_2",
"=",
"null",
";",
"POST_COMMIT_REMOVE_3",
"=",
"null",
";",
"POST_COMMIT_REMOVE_4",
"=",
"null",
";",
"POST_ROLLBACK_ADD_1",
"=",
"null",
";",
"POST_ROLLBACK_ADD_2",
"=",
"null",
";",
"POST_ROLLBACK_REMOVE_1",
"=",
"null",
";",
"POST_ROLLBACK_REMOVE_2",
"=",
"null",
";",
"POST_ROLLBACK_REMOVE_3",
"=",
"null",
";",
"POST_ROLLBACK_REMOVE_4",
"=",
"null",
";",
"UNLOCKED_1",
"=",
"null",
";",
"UNLOCKED_2",
"=",
"null",
";",
"UNLOCKED_3",
"=",
"null",
";",
"PRE_UNLOCKED_1",
"=",
"null",
";",
"PRE_UNLOCKED_2",
"=",
"null",
";",
"REFERENCES_DROPPED_TO_ZERO",
"=",
"null",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"resetEvents\"",
")",
";",
"}"
] | Reset all callbacks to null. | [
"Reset",
"all",
"callbacks",
"to",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/items/MessageItemReference.java#L539-L568 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/items/MessageItemReference.java | MessageItemReference.getProducerConnectionUuid | @Override
public SIBUuid12 getProducerConnectionUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getProducerConnectionUuid");
SibTr.exit(tc, "getProducerConnectionUuid");
}
return getMessageItem().getProducerConnectionUuid();
} | java | @Override
public SIBUuid12 getProducerConnectionUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getProducerConnectionUuid");
SibTr.exit(tc, "getProducerConnectionUuid");
}
return getMessageItem().getProducerConnectionUuid();
} | [
"@",
"Override",
"public",
"SIBUuid12",
"getProducerConnectionUuid",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getProducerConnectionUuid\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getProducerConnectionUuid\"",
")",
";",
"}",
"return",
"getMessageItem",
"(",
")",
".",
"getProducerConnectionUuid",
"(",
")",
";",
"}"
] | Returns the producerConnectionUuid.
@return SIBUuid12 | [
"Returns",
"the",
"producerConnectionUuid",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/items/MessageItemReference.java#L725-L735 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/items/MessageItemReference.java | MessageItemReference.getMessageItem | private MessageItem getMessageItem()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getMessageItem");
MessageItem msg = null;
try
{
msg = (MessageItem) getReferredItem();
} catch (MessageStoreException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.items.MessageItemReference.getMessageItem",
"1:857:1.147",
this);
SibTr.exception(tc, e);
// TODO : For now we throw a runtime here but we need to look at the stack to see
// what this means.
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMessageItem", e);
throw new SIErrorException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMessageItem", msg);
return msg;
} | java | private MessageItem getMessageItem()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getMessageItem");
MessageItem msg = null;
try
{
msg = (MessageItem) getReferredItem();
} catch (MessageStoreException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.items.MessageItemReference.getMessageItem",
"1:857:1.147",
this);
SibTr.exception(tc, e);
// TODO : For now we throw a runtime here but we need to look at the stack to see
// what this means.
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMessageItem", e);
throw new SIErrorException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMessageItem", msg);
return msg;
} | [
"private",
"MessageItem",
"getMessageItem",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getMessageItem\"",
")",
";",
"MessageItem",
"msg",
"=",
"null",
";",
"try",
"{",
"msg",
"=",
"(",
"MessageItem",
")",
"getReferredItem",
"(",
")",
";",
"}",
"catch",
"(",
"MessageStoreException",
"e",
")",
"{",
"// FFDC",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.store.items.MessageItemReference.getMessageItem\"",
",",
"\"1:857:1.147\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"// TODO : For now we throw a runtime here but we need to look at the stack to see",
"// what this means.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMessageItem\"",
",",
"e",
")",
";",
"throw",
"new",
"SIErrorException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getMessageItem\"",
",",
"msg",
")",
";",
"return",
"msg",
";",
"}"
] | Returns the referenced message item | [
"Returns",
"the",
"referenced",
"message",
"item"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/items/MessageItemReference.java#L816-L849 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/stat/WSStatsHelper.java | WSStatsHelper.setTextInfoTranslationEnabled | public static void setTextInfoTranslationEnabled(boolean textInfoTranslationEnabled, Locale locale) {
com.ibm.ws.pmi.stat.StatsImpl.setEnableNLS(textInfoTranslationEnabled, locale);
} | java | public static void setTextInfoTranslationEnabled(boolean textInfoTranslationEnabled, Locale locale) {
com.ibm.ws.pmi.stat.StatsImpl.setEnableNLS(textInfoTranslationEnabled, locale);
} | [
"public",
"static",
"void",
"setTextInfoTranslationEnabled",
"(",
"boolean",
"textInfoTranslationEnabled",
",",
"Locale",
"locale",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"pmi",
".",
"stat",
".",
"StatsImpl",
".",
"setEnableNLS",
"(",
"textInfoTranslationEnabled",
",",
"locale",
")",
";",
"}"
] | This method allows translation of the textual information.
By default translation is enabled using the default Locale.
@param textInfoTranslationEnabled enable/disable
@param locale Locale to use for translation | [
"This",
"method",
"allows",
"translation",
"of",
"the",
"textual",
"information",
".",
"By",
"default",
"translation",
"is",
"enabled",
"using",
"the",
"default",
"Locale",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/stat/WSStatsHelper.java#L61-L63 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/visitor/validator/ValidateVisitor.java | ValidateVisitor.ELCheckType | private final static void ELCheckType(final Object obj, final Class<?> type) throws ELException {
if (String.class.equals(type)) {
ELSupport.coerceToString(obj);
}
if (ELArithmetic.isNumberType(type)) {
ELSupport.coerceToNumber(obj, type);
}
if (Character.class.equals(type) || Character.TYPE == type) {
ELSupport.coerceToCharacter(obj);
}
if (Boolean.class.equals(type) || Boolean.TYPE == type) {
ELSupport.coerceToBoolean(obj);
}
if (type.isEnum()) {
ELSupport.coerceToEnum(obj, type);
}
} | java | private final static void ELCheckType(final Object obj, final Class<?> type) throws ELException {
if (String.class.equals(type)) {
ELSupport.coerceToString(obj);
}
if (ELArithmetic.isNumberType(type)) {
ELSupport.coerceToNumber(obj, type);
}
if (Character.class.equals(type) || Character.TYPE == type) {
ELSupport.coerceToCharacter(obj);
}
if (Boolean.class.equals(type) || Boolean.TYPE == type) {
ELSupport.coerceToBoolean(obj);
}
if (type.isEnum()) {
ELSupport.coerceToEnum(obj, type);
}
} | [
"private",
"final",
"static",
"void",
"ELCheckType",
"(",
"final",
"Object",
"obj",
",",
"final",
"Class",
"<",
"?",
">",
"type",
")",
"throws",
"ELException",
"{",
"if",
"(",
"String",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"{",
"ELSupport",
".",
"coerceToString",
"(",
"obj",
")",
";",
"}",
"if",
"(",
"ELArithmetic",
".",
"isNumberType",
"(",
"type",
")",
")",
"{",
"ELSupport",
".",
"coerceToNumber",
"(",
"obj",
",",
"type",
")",
";",
"}",
"if",
"(",
"Character",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Character",
".",
"TYPE",
"==",
"type",
")",
"{",
"ELSupport",
".",
"coerceToCharacter",
"(",
"obj",
")",
";",
"}",
"if",
"(",
"Boolean",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Boolean",
".",
"TYPE",
"==",
"type",
")",
"{",
"ELSupport",
".",
"coerceToBoolean",
"(",
"obj",
")",
";",
"}",
"if",
"(",
"type",
".",
"isEnum",
"(",
")",
")",
"{",
"ELSupport",
".",
"coerceToEnum",
"(",
"obj",
",",
"type",
")",
";",
"}",
"}"
] | method used to replace ELSupport.checkType | [
"method",
"used",
"to",
"replace",
"ELSupport",
".",
"checkType"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/visitor/validator/ValidateVisitor.java#L1772-L1788 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/repository/download/RepositoryDownloadUtil.java | RepositoryDownloadUtil.getProductVersion | public static String getProductVersion(RepositoryResource installResource) {
String resourceVersion = null;
try {
Collection<ProductDefinition> pdList = new ArrayList<ProductDefinition>();
for (ProductInfo pi : ProductInfo.getAllProductInfo().values()) {
pdList.add(new ProductInfoProductDefinition(pi));
}
resourceVersion = installResource.getAppliesToVersions(pdList);
} catch (Exception e) {
logger.log(Level.FINEST, e.getMessage(), e);
}
if (resourceVersion == null)
resourceVersion = InstallConstants.NOVERSION;
return resourceVersion;
} | java | public static String getProductVersion(RepositoryResource installResource) {
String resourceVersion = null;
try {
Collection<ProductDefinition> pdList = new ArrayList<ProductDefinition>();
for (ProductInfo pi : ProductInfo.getAllProductInfo().values()) {
pdList.add(new ProductInfoProductDefinition(pi));
}
resourceVersion = installResource.getAppliesToVersions(pdList);
} catch (Exception e) {
logger.log(Level.FINEST, e.getMessage(), e);
}
if (resourceVersion == null)
resourceVersion = InstallConstants.NOVERSION;
return resourceVersion;
} | [
"public",
"static",
"String",
"getProductVersion",
"(",
"RepositoryResource",
"installResource",
")",
"{",
"String",
"resourceVersion",
"=",
"null",
";",
"try",
"{",
"Collection",
"<",
"ProductDefinition",
">",
"pdList",
"=",
"new",
"ArrayList",
"<",
"ProductDefinition",
">",
"(",
")",
";",
"for",
"(",
"ProductInfo",
"pi",
":",
"ProductInfo",
".",
"getAllProductInfo",
"(",
")",
".",
"values",
"(",
")",
")",
"{",
"pdList",
".",
"add",
"(",
"new",
"ProductInfoProductDefinition",
"(",
"pi",
")",
")",
";",
"}",
"resourceVersion",
"=",
"installResource",
".",
"getAppliesToVersions",
"(",
"pdList",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"if",
"(",
"resourceVersion",
"==",
"null",
")",
"resourceVersion",
"=",
"InstallConstants",
".",
"NOVERSION",
";",
"return",
"resourceVersion",
";",
"}"
] | Gets the version of the resource using the getAppliesToVersions function.
@param installResource - resource in a repository
@return - the version of installResource | [
"Gets",
"the",
"version",
"of",
"the",
"resource",
"using",
"the",
"getAppliesToVersions",
"function",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/repository/download/RepositoryDownloadUtil.java#L58-L74 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/repository/download/RepositoryDownloadUtil.java | RepositoryDownloadUtil.isPublicAsset | public static boolean isPublicAsset(ResourceType resourceType, RepositoryResource installResource) {
if (resourceType.equals(ResourceType.FEATURE) || resourceType.equals(ResourceType.ADDON)) {
EsaResource esar = ((EsaResource) installResource);
if (esar.getVisibility().equals(Visibility.PUBLIC) || esar.getVisibility().equals(Visibility.INSTALL)) {
return true;
}
} else if (resourceType.equals(ResourceType.PRODUCTSAMPLE) || resourceType.equals(ResourceType.OPENSOURCE)) {
return true;
}
return false;
} | java | public static boolean isPublicAsset(ResourceType resourceType, RepositoryResource installResource) {
if (resourceType.equals(ResourceType.FEATURE) || resourceType.equals(ResourceType.ADDON)) {
EsaResource esar = ((EsaResource) installResource);
if (esar.getVisibility().equals(Visibility.PUBLIC) || esar.getVisibility().equals(Visibility.INSTALL)) {
return true;
}
} else if (resourceType.equals(ResourceType.PRODUCTSAMPLE) || resourceType.equals(ResourceType.OPENSOURCE)) {
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isPublicAsset",
"(",
"ResourceType",
"resourceType",
",",
"RepositoryResource",
"installResource",
")",
"{",
"if",
"(",
"resourceType",
".",
"equals",
"(",
"ResourceType",
".",
"FEATURE",
")",
"||",
"resourceType",
".",
"equals",
"(",
"ResourceType",
".",
"ADDON",
")",
")",
"{",
"EsaResource",
"esar",
"=",
"(",
"(",
"EsaResource",
")",
"installResource",
")",
";",
"if",
"(",
"esar",
".",
"getVisibility",
"(",
")",
".",
"equals",
"(",
"Visibility",
".",
"PUBLIC",
")",
"||",
"esar",
".",
"getVisibility",
"(",
")",
".",
"equals",
"(",
"Visibility",
".",
"INSTALL",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"else",
"if",
"(",
"resourceType",
".",
"equals",
"(",
"ResourceType",
".",
"PRODUCTSAMPLE",
")",
"||",
"resourceType",
".",
"equals",
"(",
"ResourceType",
".",
"OPENSOURCE",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Checks if Feature or Addon has visibility public or install
OR checks if the resource is a Product sample or open source to see if it is a public asset.
@param resourceType - type of repository
@param installResource - represents a resouce in a repository
@return - true if the resource is visible to the public | [
"Checks",
"if",
"Feature",
"or",
"Addon",
"has",
"visibility",
"public",
"or",
"install",
"OR",
"checks",
"if",
"the",
"resource",
"is",
"a",
"Product",
"sample",
"or",
"open",
"source",
"to",
"see",
"if",
"it",
"is",
"a",
"public",
"asset",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/repository/download/RepositoryDownloadUtil.java#L84-L95 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/repository/download/RepositoryDownloadUtil.java | RepositoryDownloadUtil.writeResourcesToDiskRepo | public static Map<String, Collection<String>> writeResourcesToDiskRepo(Map<String, Collection<String>> downloaded, File toDir,
Map<String, List<List<RepositoryResource>>> installResources,
String productVersion,
EventManager eventManager, boolean defaultRepo) throws InstallException {
int progress = 10;
int interval1 = installResources.size() == 0 ? 90 : 90 / installResources.size();
for (List<List<RepositoryResource>> targetList : installResources.values()) {
for (List<RepositoryResource> mrList : targetList) {
int interval2 = mrList.size() == 0 ? interval1 : interval1 / mrList.size();
for (RepositoryResource installResource : mrList) {
try {
writeResourcesToDiskRepo(downloaded, toDir, installResource, eventManager, progress += interval2);
} catch (InstallException e) {
throw e;
} catch (Exception e) {
throw ExceptionUtils.createFailedToDownload(installResource, e, toDir);
}
}
}
}
return downloaded;
} | java | public static Map<String, Collection<String>> writeResourcesToDiskRepo(Map<String, Collection<String>> downloaded, File toDir,
Map<String, List<List<RepositoryResource>>> installResources,
String productVersion,
EventManager eventManager, boolean defaultRepo) throws InstallException {
int progress = 10;
int interval1 = installResources.size() == 0 ? 90 : 90 / installResources.size();
for (List<List<RepositoryResource>> targetList : installResources.values()) {
for (List<RepositoryResource> mrList : targetList) {
int interval2 = mrList.size() == 0 ? interval1 : interval1 / mrList.size();
for (RepositoryResource installResource : mrList) {
try {
writeResourcesToDiskRepo(downloaded, toDir, installResource, eventManager, progress += interval2);
} catch (InstallException e) {
throw e;
} catch (Exception e) {
throw ExceptionUtils.createFailedToDownload(installResource, e, toDir);
}
}
}
}
return downloaded;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Collection",
"<",
"String",
">",
">",
"writeResourcesToDiskRepo",
"(",
"Map",
"<",
"String",
",",
"Collection",
"<",
"String",
">",
">",
"downloaded",
",",
"File",
"toDir",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"List",
"<",
"RepositoryResource",
">",
">",
">",
"installResources",
",",
"String",
"productVersion",
",",
"EventManager",
"eventManager",
",",
"boolean",
"defaultRepo",
")",
"throws",
"InstallException",
"{",
"int",
"progress",
"=",
"10",
";",
"int",
"interval1",
"=",
"installResources",
".",
"size",
"(",
")",
"==",
"0",
"?",
"90",
":",
"90",
"/",
"installResources",
".",
"size",
"(",
")",
";",
"for",
"(",
"List",
"<",
"List",
"<",
"RepositoryResource",
">",
">",
"targetList",
":",
"installResources",
".",
"values",
"(",
")",
")",
"{",
"for",
"(",
"List",
"<",
"RepositoryResource",
">",
"mrList",
":",
"targetList",
")",
"{",
"int",
"interval2",
"=",
"mrList",
".",
"size",
"(",
")",
"==",
"0",
"?",
"interval1",
":",
"interval1",
"/",
"mrList",
".",
"size",
"(",
")",
";",
"for",
"(",
"RepositoryResource",
"installResource",
":",
"mrList",
")",
"{",
"try",
"{",
"writeResourcesToDiskRepo",
"(",
"downloaded",
",",
"toDir",
",",
"installResource",
",",
"eventManager",
",",
"progress",
"+=",
"interval2",
")",
";",
"}",
"catch",
"(",
"InstallException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"ExceptionUtils",
".",
"createFailedToDownload",
"(",
"installResource",
",",
"e",
",",
"toDir",
")",
";",
"}",
"}",
"}",
"}",
"return",
"downloaded",
";",
"}"
] | The function writes the resources to the downloaded disk repo
@param downloaded - collection of string values
@param toDir - File that represents the destination directory
@param installResources - list of resources in a repository
@param productVersion - string value of the version of the product
@param eventManager - eventManager object
@param defaultRepo - bool value if repository is the default Repo
@return - downloaded parameter
@throws InstallException | [
"The",
"function",
"writes",
"the",
"resources",
"to",
"the",
"downloaded",
"disk",
"repo"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/repository/download/RepositoryDownloadUtil.java#L234-L257 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jaas.common/src/com/ibm/ws/security/jaas/common/internal/JAASLoginContextEntryImpl.java | JAASLoginContextEntryImpl.setJaasLoginModuleConfig | @Reference(cardinality = ReferenceCardinality.MULTIPLE)
protected void setJaasLoginModuleConfig(JAASLoginModuleConfig lmc, Map<String, Object> props) {
String pid = (String) props.get(KEY_SERVICE_PID);
loginModuleMap.put(pid, lmc);
} | java | @Reference(cardinality = ReferenceCardinality.MULTIPLE)
protected void setJaasLoginModuleConfig(JAASLoginModuleConfig lmc, Map<String, Object> props) {
String pid = (String) props.get(KEY_SERVICE_PID);
loginModuleMap.put(pid, lmc);
} | [
"@",
"Reference",
"(",
"cardinality",
"=",
"ReferenceCardinality",
".",
"MULTIPLE",
")",
"protected",
"void",
"setJaasLoginModuleConfig",
"(",
"JAASLoginModuleConfig",
"lmc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"String",
"pid",
"=",
"(",
"String",
")",
"props",
".",
"get",
"(",
"KEY_SERVICE_PID",
")",
";",
"loginModuleMap",
".",
"put",
"(",
"pid",
",",
"lmc",
")",
";",
"}"
] | SINCE THIS IS A STATIC REFERENCE DS provides enough synchronization so that we don't need to synchronize on the map. | [
"SINCE",
"THIS",
"IS",
"A",
"STATIC",
"REFERENCE",
"DS",
"provides",
"enough",
"synchronization",
"so",
"that",
"we",
"don",
"t",
"need",
"to",
"synchronize",
"on",
"the",
"map",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jaas.common/src/com/ibm/ws/security/jaas/common/internal/JAASLoginContextEntryImpl.java#L55-L59 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/dispatcher/internal/channel/HttpRequestImpl.java | HttpRequestImpl.init | public void init(HttpInboundServiceContext context) {
this.message = context.getRequest();
if (this.useEE7Streams) {
this.body = new HttpInputStreamEE7(context);
} else {
this.body = new HttpInputStreamImpl(context);
}
} | java | public void init(HttpInboundServiceContext context) {
this.message = context.getRequest();
if (this.useEE7Streams) {
this.body = new HttpInputStreamEE7(context);
} else {
this.body = new HttpInputStreamImpl(context);
}
} | [
"public",
"void",
"init",
"(",
"HttpInboundServiceContext",
"context",
")",
"{",
"this",
".",
"message",
"=",
"context",
".",
"getRequest",
"(",
")",
";",
"if",
"(",
"this",
".",
"useEE7Streams",
")",
"{",
"this",
".",
"body",
"=",
"new",
"HttpInputStreamEE7",
"(",
"context",
")",
";",
"}",
"else",
"{",
"this",
".",
"body",
"=",
"new",
"HttpInputStreamImpl",
"(",
"context",
")",
";",
"}",
"}"
] | Initialize with a new connection.
@param context | [
"Initialize",
"with",
"a",
"new",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/dispatcher/internal/channel/HttpRequestImpl.java#L58-L65 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java | CDIUtils.loadExtension | public static Metadata<Extension> loadExtension(String extensionClass, ClassLoader classloader) {
Class<? extends Extension> serviceClass = loadClass(Extension.class, extensionClass, classloader);
if (serviceClass == null) {
return null;
}
Extension serviceInstance = prepareInstance(serviceClass);
if (serviceInstance == null) {
return null;
}
return new MetadataImpl<Extension>(serviceInstance, extensionClass);
} | java | public static Metadata<Extension> loadExtension(String extensionClass, ClassLoader classloader) {
Class<? extends Extension> serviceClass = loadClass(Extension.class, extensionClass, classloader);
if (serviceClass == null) {
return null;
}
Extension serviceInstance = prepareInstance(serviceClass);
if (serviceInstance == null) {
return null;
}
return new MetadataImpl<Extension>(serviceInstance, extensionClass);
} | [
"public",
"static",
"Metadata",
"<",
"Extension",
">",
"loadExtension",
"(",
"String",
"extensionClass",
",",
"ClassLoader",
"classloader",
")",
"{",
"Class",
"<",
"?",
"extends",
"Extension",
">",
"serviceClass",
"=",
"loadClass",
"(",
"Extension",
".",
"class",
",",
"extensionClass",
",",
"classloader",
")",
";",
"if",
"(",
"serviceClass",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Extension",
"serviceInstance",
"=",
"prepareInstance",
"(",
"serviceClass",
")",
";",
"if",
"(",
"serviceInstance",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"MetadataImpl",
"<",
"Extension",
">",
"(",
"serviceInstance",
",",
"extensionClass",
")",
";",
"}"
] | Create the extension and return a metadata for the extension
@param extensionClass extension class name
@param classloader the class loader that loads the extension
@return | [
"Create",
"the",
"extension",
"and",
"return",
"a",
"metadata",
"for",
"the",
"extension"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java#L252-L262 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java | CDIUtils.loadClass | public static <S> Class<? extends S> loadClass(Class<S> expectedType, String serviceClassName, ClassLoader classloader) {
Class<?> clazz = null;
Class<? extends S> serviceClass = null;
try {
clazz = classloader.loadClass(serviceClassName);
serviceClass = clazz.asSubclass(expectedType);
} catch (ResourceLoadingException e) {
//noop
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "loadClass()", e);
}
} catch (ClassCastException e) {
//noop
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "loadClass()", e);
}
} catch (ClassNotFoundException e) {
//noop
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "loadClass()", e);
}
}
return serviceClass;
} | java | public static <S> Class<? extends S> loadClass(Class<S> expectedType, String serviceClassName, ClassLoader classloader) {
Class<?> clazz = null;
Class<? extends S> serviceClass = null;
try {
clazz = classloader.loadClass(serviceClassName);
serviceClass = clazz.asSubclass(expectedType);
} catch (ResourceLoadingException e) {
//noop
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "loadClass()", e);
}
} catch (ClassCastException e) {
//noop
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "loadClass()", e);
}
} catch (ClassNotFoundException e) {
//noop
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "loadClass()", e);
}
}
return serviceClass;
} | [
"public",
"static",
"<",
"S",
">",
"Class",
"<",
"?",
"extends",
"S",
">",
"loadClass",
"(",
"Class",
"<",
"S",
">",
"expectedType",
",",
"String",
"serviceClassName",
",",
"ClassLoader",
"classloader",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"null",
";",
"Class",
"<",
"?",
"extends",
"S",
">",
"serviceClass",
"=",
"null",
";",
"try",
"{",
"clazz",
"=",
"classloader",
".",
"loadClass",
"(",
"serviceClassName",
")",
";",
"serviceClass",
"=",
"clazz",
".",
"asSubclass",
"(",
"expectedType",
")",
";",
"}",
"catch",
"(",
"ResourceLoadingException",
"e",
")",
"{",
"//noop",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"loadClass()\"",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"ClassCastException",
"e",
")",
"{",
"//noop",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"loadClass()\"",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"//noop",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"loadClass()\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"serviceClass",
";",
"}"
] | load the class and then casts to the specified sub class
@param expectedType the expected return class
@param serviceClassName the service class name
@param classloader the class loader that loads the service class
@return the subclass specified by expectedType | [
"load",
"the",
"class",
"and",
"then",
"casts",
"to",
"the",
"specified",
"sub",
"class"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java#L272-L295 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java | CDIUtils.prepareInstance | public static <S> S prepareInstance(Class<? extends S> serviceClass) {
try {
final Constructor<? extends S> constructor = serviceClass.getDeclaredConstructor();
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
constructor.setAccessible(true);
return null;
}
});
return constructor.newInstance();
} catch (LinkageError e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): Could not instantiate service class " + serviceClass.getName(), e);
}
return null;
} catch (InvocationTargetException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
} catch (IllegalArgumentException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
} catch (InstantiationException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
} catch (IllegalAccessException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
} catch (SecurityException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
} catch (NoSuchMethodException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
}
} | java | public static <S> S prepareInstance(Class<? extends S> serviceClass) {
try {
final Constructor<? extends S> constructor = serviceClass.getDeclaredConstructor();
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
constructor.setAccessible(true);
return null;
}
});
return constructor.newInstance();
} catch (LinkageError e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): Could not instantiate service class " + serviceClass.getName(), e);
}
return null;
} catch (InvocationTargetException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
} catch (IllegalArgumentException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
} catch (InstantiationException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
} catch (IllegalAccessException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
} catch (SecurityException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
} catch (NoSuchMethodException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e);
}
return null;
}
} | [
"public",
"static",
"<",
"S",
">",
"S",
"prepareInstance",
"(",
"Class",
"<",
"?",
"extends",
"S",
">",
"serviceClass",
")",
"{",
"try",
"{",
"final",
"Constructor",
"<",
"?",
"extends",
"S",
">",
"constructor",
"=",
"serviceClass",
".",
"getDeclaredConstructor",
"(",
")",
";",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"run",
"(",
")",
"{",
"constructor",
".",
"setAccessible",
"(",
"true",
")",
";",
"return",
"null",
";",
"}",
"}",
")",
";",
"return",
"constructor",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"LinkageError",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"prepareInstance(): Could not instantiate service class \"",
"+",
"serviceClass",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"prepareInstance(): The exception happened on loading \"",
"+",
"serviceClass",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"prepareInstance(): The exception happened on loading \"",
"+",
"serviceClass",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"InstantiationException",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"prepareInstance(): The exception happened on loading \"",
"+",
"serviceClass",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"prepareInstance(): The exception happened on loading \"",
"+",
"serviceClass",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"prepareInstance(): The exception happened on loading \"",
"+",
"serviceClass",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"prepareInstance(): The exception happened on loading \"",
"+",
"serviceClass",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}",
"}"
] | Creates an object of the service class
@param serviceClass the service class
@return the serviceClass object | [
"Creates",
"an",
"object",
"of",
"the",
"service",
"class"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java#L303-L352 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java | CDIUtils.isVisible | private static boolean isVisible(ClassLoader loaderA, ClassLoader loaderB) {
if (loaderB == loaderA || loaderB.getParent() == loaderA) {
return true;
}
return false;
} | java | private static boolean isVisible(ClassLoader loaderA, ClassLoader loaderB) {
if (loaderB == loaderA || loaderB.getParent() == loaderA) {
return true;
}
return false;
} | [
"private",
"static",
"boolean",
"isVisible",
"(",
"ClassLoader",
"loaderA",
",",
"ClassLoader",
"loaderB",
")",
"{",
"if",
"(",
"loaderB",
"==",
"loaderA",
"||",
"loaderB",
".",
"getParent",
"(",
")",
"==",
"loaderA",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | return true if loaderA is visible to loaderB | [
"return",
"true",
"if",
"loaderA",
"is",
"visible",
"to",
"loaderB"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java#L369-L374 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java | CDIUtils.getAndSetLoader | public static ClassLoader getAndSetLoader(ClassLoader newCL) {
ThreadContextAccessor tca = ThreadContextAccessor.getThreadContextAccessor();
//This could be a ClassLoader or the special type UNCHANGED.
Object maybeOldCL = tca.pushContextClassLoaderForUnprivileged(newCL);
if (maybeOldCL instanceof ClassLoader) {
return (ClassLoader) maybeOldCL;
} else {
return newCL;
}
} | java | public static ClassLoader getAndSetLoader(ClassLoader newCL) {
ThreadContextAccessor tca = ThreadContextAccessor.getThreadContextAccessor();
//This could be a ClassLoader or the special type UNCHANGED.
Object maybeOldCL = tca.pushContextClassLoaderForUnprivileged(newCL);
if (maybeOldCL instanceof ClassLoader) {
return (ClassLoader) maybeOldCL;
} else {
return newCL;
}
} | [
"public",
"static",
"ClassLoader",
"getAndSetLoader",
"(",
"ClassLoader",
"newCL",
")",
"{",
"ThreadContextAccessor",
"tca",
"=",
"ThreadContextAccessor",
".",
"getThreadContextAccessor",
"(",
")",
";",
"//This could be a ClassLoader or the special type UNCHANGED.",
"Object",
"maybeOldCL",
"=",
"tca",
".",
"pushContextClassLoaderForUnprivileged",
"(",
"newCL",
")",
";",
"if",
"(",
"maybeOldCL",
"instanceof",
"ClassLoader",
")",
"{",
"return",
"(",
"ClassLoader",
")",
"maybeOldCL",
";",
"}",
"else",
"{",
"return",
"newCL",
";",
"}",
"}"
] | This method sets the thread context classloader, and returns whatever was the TCCL before it was updated.
@param newCL the classloader to put on the thread context.
@return the classloader that was origonally on the thread context.
@throws SecurityException if <code>RuntimePermission("getClassLoader")</code> or <code>RuntimePermission("setContextClassLoader")</code> is not granted. | [
"This",
"method",
"sets",
"the",
"thread",
"context",
"classloader",
"and",
"returns",
"whatever",
"was",
"the",
"TCCL",
"before",
"it",
"was",
"updated",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java#L383-L392 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java | CDIUtils.isWeldProxy | public static boolean isWeldProxy(Object obj) {
Class<?> clazz = obj.getClass();
boolean result = isWeldProxy(clazz);
return result;
} | java | public static boolean isWeldProxy(Object obj) {
Class<?> clazz = obj.getClass();
boolean result = isWeldProxy(clazz);
return result;
} | [
"public",
"static",
"boolean",
"isWeldProxy",
"(",
"Object",
"obj",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"obj",
".",
"getClass",
"(",
")",
";",
"boolean",
"result",
"=",
"isWeldProxy",
"(",
"clazz",
")",
";",
"return",
"result",
";",
"}"
] | Return whether the object is a weld proxy
@param obj
@return true if it is a proxy | [
"Return",
"whether",
"the",
"object",
"is",
"a",
"weld",
"proxy"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.internal/src/com/ibm/ws/cdi/internal/interfaces/CDIUtils.java#L411-L415 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/injection/WebSphereInjectionServicesImpl.java | WebSphereInjectionServicesImpl.aroundInject | @Override
public <T> void aroundInject(final InjectionContext<T> injectionContext) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Annotations: " + injectionContext.getAnnotatedType());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Perform EE injection.");
}
injectJavaEEResources(injectionContext);
// perform Weld injection
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
injectionContext.proceed();
return null;
}
});
} | java | @Override
public <T> void aroundInject(final InjectionContext<T> injectionContext) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Annotations: " + injectionContext.getAnnotatedType());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Perform EE injection.");
}
injectJavaEEResources(injectionContext);
// perform Weld injection
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
injectionContext.proceed();
return null;
}
});
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"void",
"aroundInject",
"(",
"final",
"InjectionContext",
"<",
"T",
">",
"injectionContext",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Annotations: \"",
"+",
"injectionContext",
".",
"getAnnotatedType",
"(",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Perform EE injection.\"",
")",
";",
"}",
"injectJavaEEResources",
"(",
"injectionContext",
")",
";",
"// perform Weld injection",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"run",
"(",
")",
"{",
"injectionContext",
".",
"proceed",
"(",
")",
";",
"return",
"null",
";",
"}",
"}",
")",
";",
"}"
] | Perform Injection.
For EE | [
"Perform",
"Injection",
".",
"For",
"EE"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/injection/WebSphereInjectionServicesImpl.java#L306-L328 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATBifurcatedConsumer.java | CATBifurcatedConsumer.readSet | @Override
public void readSet(int requestNumber, SIMessageHandle[] msgHandles) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readSet",
new Object[] { requestNumber, msgHandles });
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Request to read " + msgHandles.length +
" message(s)");
final ConversationState convState = (ConversationState) getConversation().getAttachment();
try {
SIBusMessage[] messages = bifSession.readSet(msgHandles);
// Add the number of items first
CommsServerByteBuffer buff = poolManager.allocate();
buff.putInt(messages.length);
for (int x = 0; x < messages.length; x++) {
buff.putMessage((JsMessage) messages[x],
convState.getCommsConnection(),
getConversation());
}
try {
getConversation().send(buff,
JFapChannelConstants.SEG_READ_SET_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".readSet",
CommsConstants.CATBIFCONSUMER_READSET_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2033", e);
}
} catch (Exception e) {
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event OR if this Exception isn't a SIException.
if (!(e instanceof SIException) || !convState.hasMETerminated()) {
FFDCFilter.processException(e,
CLASS_NAME + ".readSet",
CommsConstants.CATBIFCONSUMER_READSET_02,
this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.CATBIFCONSUMER_READSET_02,
getConversation(), requestNumber);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readSet");
} | java | @Override
public void readSet(int requestNumber, SIMessageHandle[] msgHandles) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readSet",
new Object[] { requestNumber, msgHandles });
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Request to read " + msgHandles.length +
" message(s)");
final ConversationState convState = (ConversationState) getConversation().getAttachment();
try {
SIBusMessage[] messages = bifSession.readSet(msgHandles);
// Add the number of items first
CommsServerByteBuffer buff = poolManager.allocate();
buff.putInt(messages.length);
for (int x = 0; x < messages.length; x++) {
buff.putMessage((JsMessage) messages[x],
convState.getCommsConnection(),
getConversation());
}
try {
getConversation().send(buff,
JFapChannelConstants.SEG_READ_SET_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".readSet",
CommsConstants.CATBIFCONSUMER_READSET_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2033", e);
}
} catch (Exception e) {
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event OR if this Exception isn't a SIException.
if (!(e instanceof SIException) || !convState.hasMETerminated()) {
FFDCFilter.processException(e,
CLASS_NAME + ".readSet",
CommsConstants.CATBIFCONSUMER_READSET_02,
this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.CATBIFCONSUMER_READSET_02,
getConversation(), requestNumber);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readSet");
} | [
"@",
"Override",
"public",
"void",
"readSet",
"(",
"int",
"requestNumber",
",",
"SIMessageHandle",
"[",
"]",
"msgHandles",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"readSet\"",
",",
"new",
"Object",
"[",
"]",
"{",
"requestNumber",
",",
"msgHandles",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Request to read \"",
"+",
"msgHandles",
".",
"length",
"+",
"\" message(s)\"",
")",
";",
"final",
"ConversationState",
"convState",
"=",
"(",
"ConversationState",
")",
"getConversation",
"(",
")",
".",
"getAttachment",
"(",
")",
";",
"try",
"{",
"SIBusMessage",
"[",
"]",
"messages",
"=",
"bifSession",
".",
"readSet",
"(",
"msgHandles",
")",
";",
"// Add the number of items first",
"CommsServerByteBuffer",
"buff",
"=",
"poolManager",
".",
"allocate",
"(",
")",
";",
"buff",
".",
"putInt",
"(",
"messages",
".",
"length",
")",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"messages",
".",
"length",
";",
"x",
"++",
")",
"{",
"buff",
".",
"putMessage",
"(",
"(",
"JsMessage",
")",
"messages",
"[",
"x",
"]",
",",
"convState",
".",
"getCommsConnection",
"(",
")",
",",
"getConversation",
"(",
")",
")",
";",
"}",
"try",
"{",
"getConversation",
"(",
")",
".",
"send",
"(",
"buff",
",",
"JFapChannelConstants",
".",
"SEG_READ_SET_R",
",",
"requestNumber",
",",
"JFapChannelConstants",
".",
"PRIORITY_MEDIUM",
",",
"true",
",",
"ThrottlingPolicy",
".",
"BLOCK_THREAD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".readSet\"",
",",
"CommsConstants",
".",
"CATBIFCONSUMER_READSET_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2033\"",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"//No FFDC code needed",
"//Only FFDC if we haven't received a meTerminated event OR if this Exception isn't a SIException.",
"if",
"(",
"!",
"(",
"e",
"instanceof",
"SIException",
")",
"||",
"!",
"convState",
".",
"hasMETerminated",
"(",
")",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".readSet\"",
",",
"CommsConstants",
".",
"CATBIFCONSUMER_READSET_02",
",",
"this",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"StaticCATHelper",
".",
"sendExceptionToClient",
"(",
"e",
",",
"CommsConstants",
".",
"CATBIFCONSUMER_READSET_02",
",",
"getConversation",
"(",
")",
",",
"requestNumber",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"readSet\"",
")",
";",
"}"
] | This method will return a set of messages currently locked by the messaging engine.
@param requestNumber
@param msgIds | [
"This",
"method",
"will",
"return",
"a",
"set",
"of",
"messages",
"currently",
"locked",
"by",
"the",
"messaging",
"engine",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATBifurcatedConsumer.java#L195-L259 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATBifurcatedConsumer.java | CATBifurcatedConsumer.readAndDeleteSet | @Override
public void readAndDeleteSet(int requestNumber, SIMessageHandle[] msgHandles, int tran) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readAndDeleteSet",
new Object[] { requestNumber, msgHandles, tran });
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Request to read / delete " + msgHandles.length +
" message(s)");
final ConversationState convState = (ConversationState) getConversation().getAttachment();
try {
SITransaction siTran = null;
if (tran != CommsConstants.NO_TRANSACTION) {
siTran =
((ServerLinkLevelState) getConversation().getLinkLevelAttachment()).getTransactionTable().get(tran);
}
SIBusMessage[] messages;
if (siTran != IdToTransactionTable.INVALID_TRANSACTION) {
messages = bifSession.readAndDeleteSet(msgHandles, siTran);
} else {
messages = new SIBusMessage[0];
}
// Add the number of items first
CommsServerByteBuffer buff = poolManager.allocate();
buff.putInt(messages.length);
for (int x = 0; x < messages.length; x++) {
buff.putMessage((JsMessage) messages[x],
convState.getCommsConnection(),
getConversation());
}
try {
getConversation().send(buff,
JFapChannelConstants.SEG_READ_AND_DELETE_SET_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".readAndDeleteSet",
CommsConstants.CATBIFCONSUMER_READANDDELTESET_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2033", e);
}
} catch (Exception e) {
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event OR if this Exception isn't a SIException.
if (!(e instanceof SIException) || !convState.hasMETerminated()) {
FFDCFilter.processException(e,
CLASS_NAME + ".readAndDeleteSet",
CommsConstants.CATBIFCONSUMER_READANDDELTESET_02,
this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.CATBIFCONSUMER_READANDDELTESET_02,
getConversation(), requestNumber);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readAndDeleteSet");
} | java | @Override
public void readAndDeleteSet(int requestNumber, SIMessageHandle[] msgHandles, int tran) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "readAndDeleteSet",
new Object[] { requestNumber, msgHandles, tran });
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Request to read / delete " + msgHandles.length +
" message(s)");
final ConversationState convState = (ConversationState) getConversation().getAttachment();
try {
SITransaction siTran = null;
if (tran != CommsConstants.NO_TRANSACTION) {
siTran =
((ServerLinkLevelState) getConversation().getLinkLevelAttachment()).getTransactionTable().get(tran);
}
SIBusMessage[] messages;
if (siTran != IdToTransactionTable.INVALID_TRANSACTION) {
messages = bifSession.readAndDeleteSet(msgHandles, siTran);
} else {
messages = new SIBusMessage[0];
}
// Add the number of items first
CommsServerByteBuffer buff = poolManager.allocate();
buff.putInt(messages.length);
for (int x = 0; x < messages.length; x++) {
buff.putMessage((JsMessage) messages[x],
convState.getCommsConnection(),
getConversation());
}
try {
getConversation().send(buff,
JFapChannelConstants.SEG_READ_AND_DELETE_SET_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".readAndDeleteSet",
CommsConstants.CATBIFCONSUMER_READANDDELTESET_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2033", e);
}
} catch (Exception e) {
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event OR if this Exception isn't a SIException.
if (!(e instanceof SIException) || !convState.hasMETerminated()) {
FFDCFilter.processException(e,
CLASS_NAME + ".readAndDeleteSet",
CommsConstants.CATBIFCONSUMER_READANDDELTESET_02,
this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.CATBIFCONSUMER_READANDDELTESET_02,
getConversation(), requestNumber);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "readAndDeleteSet");
} | [
"@",
"Override",
"public",
"void",
"readAndDeleteSet",
"(",
"int",
"requestNumber",
",",
"SIMessageHandle",
"[",
"]",
"msgHandles",
",",
"int",
"tran",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"readAndDeleteSet\"",
",",
"new",
"Object",
"[",
"]",
"{",
"requestNumber",
",",
"msgHandles",
",",
"tran",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Request to read / delete \"",
"+",
"msgHandles",
".",
"length",
"+",
"\" message(s)\"",
")",
";",
"final",
"ConversationState",
"convState",
"=",
"(",
"ConversationState",
")",
"getConversation",
"(",
")",
".",
"getAttachment",
"(",
")",
";",
"try",
"{",
"SITransaction",
"siTran",
"=",
"null",
";",
"if",
"(",
"tran",
"!=",
"CommsConstants",
".",
"NO_TRANSACTION",
")",
"{",
"siTran",
"=",
"(",
"(",
"ServerLinkLevelState",
")",
"getConversation",
"(",
")",
".",
"getLinkLevelAttachment",
"(",
")",
")",
".",
"getTransactionTable",
"(",
")",
".",
"get",
"(",
"tran",
")",
";",
"}",
"SIBusMessage",
"[",
"]",
"messages",
";",
"if",
"(",
"siTran",
"!=",
"IdToTransactionTable",
".",
"INVALID_TRANSACTION",
")",
"{",
"messages",
"=",
"bifSession",
".",
"readAndDeleteSet",
"(",
"msgHandles",
",",
"siTran",
")",
";",
"}",
"else",
"{",
"messages",
"=",
"new",
"SIBusMessage",
"[",
"0",
"]",
";",
"}",
"// Add the number of items first",
"CommsServerByteBuffer",
"buff",
"=",
"poolManager",
".",
"allocate",
"(",
")",
";",
"buff",
".",
"putInt",
"(",
"messages",
".",
"length",
")",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"messages",
".",
"length",
";",
"x",
"++",
")",
"{",
"buff",
".",
"putMessage",
"(",
"(",
"JsMessage",
")",
"messages",
"[",
"x",
"]",
",",
"convState",
".",
"getCommsConnection",
"(",
")",
",",
"getConversation",
"(",
")",
")",
";",
"}",
"try",
"{",
"getConversation",
"(",
")",
".",
"send",
"(",
"buff",
",",
"JFapChannelConstants",
".",
"SEG_READ_AND_DELETE_SET_R",
",",
"requestNumber",
",",
"JFapChannelConstants",
".",
"PRIORITY_MEDIUM",
",",
"true",
",",
"ThrottlingPolicy",
".",
"BLOCK_THREAD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".readAndDeleteSet\"",
",",
"CommsConstants",
".",
"CATBIFCONSUMER_READANDDELTESET_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2033\"",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"//No FFDC code needed",
"//Only FFDC if we haven't received a meTerminated event OR if this Exception isn't a SIException.",
"if",
"(",
"!",
"(",
"e",
"instanceof",
"SIException",
")",
"||",
"!",
"convState",
".",
"hasMETerminated",
"(",
")",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".readAndDeleteSet\"",
",",
"CommsConstants",
".",
"CATBIFCONSUMER_READANDDELTESET_02",
",",
"this",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"StaticCATHelper",
".",
"sendExceptionToClient",
"(",
"e",
",",
"CommsConstants",
".",
"CATBIFCONSUMER_READANDDELTESET_02",
",",
"getConversation",
"(",
")",
",",
"requestNumber",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"readAndDeleteSet\"",
")",
";",
"}"
] | This method will return and delete a set of messages currently locked by the messaging
engine.
@param requestNumber
@param msgIds
@param tran | [
"This",
"method",
"will",
"return",
"and",
"delete",
"a",
"set",
"of",
"messages",
"currently",
"locked",
"by",
"the",
"messaging",
"engine",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATBifurcatedConsumer.java#L269-L344 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManager.java | NoRethrowSecurityManager.getCodeSource | public String getCodeSource(ProtectionDomain pd) {
CodeSource cs = pd.getCodeSource();
String csStr = null;
if (cs == null) {
csStr = "null code source";
} else {
URL url = cs.getLocation();
if (url == null) {
csStr = "null code URL";
} else {
csStr = url.toString();
}
}
return csStr;
} | java | public String getCodeSource(ProtectionDomain pd) {
CodeSource cs = pd.getCodeSource();
String csStr = null;
if (cs == null) {
csStr = "null code source";
} else {
URL url = cs.getLocation();
if (url == null) {
csStr = "null code URL";
} else {
csStr = url.toString();
}
}
return csStr;
} | [
"public",
"String",
"getCodeSource",
"(",
"ProtectionDomain",
"pd",
")",
"{",
"CodeSource",
"cs",
"=",
"pd",
".",
"getCodeSource",
"(",
")",
";",
"String",
"csStr",
"=",
"null",
";",
"if",
"(",
"cs",
"==",
"null",
")",
"{",
"csStr",
"=",
"\"null code source\"",
";",
"}",
"else",
"{",
"URL",
"url",
"=",
"cs",
".",
"getLocation",
"(",
")",
";",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"csStr",
"=",
"\"null code URL\"",
";",
"}",
"else",
"{",
"csStr",
"=",
"url",
".",
"toString",
"(",
")",
";",
"}",
"}",
"return",
"csStr",
";",
"}"
] | Find the code source based on the protection domain | [
"Find",
"the",
"code",
"source",
"based",
"on",
"the",
"protection",
"domain"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManager.java#L213-L237 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManager.java | NoRethrowSecurityManager.permissionToString | public String permissionToString(java.security.CodeSource cs, ClassLoader classloaderClass,
PermissionCollection col) {
StringBuffer buf = new StringBuffer("ClassLoader: ");
if (classloaderClass == null) {
buf.append("Primordial Classloader");
} else {
buf.append(classloaderClass.getClass().getName());
}
buf.append(lineSep);
buf.append(" Permissions granted to CodeSource ").append(cs).append(lineSep);
if (col != null) {
Enumeration<Permission> e = col.elements();
buf.append(" {").append(lineSep);
while (e.hasMoreElements()) {
Permission p = e.nextElement();
buf.append(" ").append(p.toString()).append(";").append(lineSep);
}
buf.append(" }");
} else {
buf.append(" {").append(lineSep).append(" }");
}
return buf.toString();
} | java | public String permissionToString(java.security.CodeSource cs, ClassLoader classloaderClass,
PermissionCollection col) {
StringBuffer buf = new StringBuffer("ClassLoader: ");
if (classloaderClass == null) {
buf.append("Primordial Classloader");
} else {
buf.append(classloaderClass.getClass().getName());
}
buf.append(lineSep);
buf.append(" Permissions granted to CodeSource ").append(cs).append(lineSep);
if (col != null) {
Enumeration<Permission> e = col.elements();
buf.append(" {").append(lineSep);
while (e.hasMoreElements()) {
Permission p = e.nextElement();
buf.append(" ").append(p.toString()).append(";").append(lineSep);
}
buf.append(" }");
} else {
buf.append(" {").append(lineSep).append(" }");
}
return buf.toString();
} | [
"public",
"String",
"permissionToString",
"(",
"java",
".",
"security",
".",
"CodeSource",
"cs",
",",
"ClassLoader",
"classloaderClass",
",",
"PermissionCollection",
"col",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"\"ClassLoader: \"",
")",
";",
"if",
"(",
"classloaderClass",
"==",
"null",
")",
"{",
"buf",
".",
"append",
"(",
"\"Primordial Classloader\"",
")",
";",
"}",
"else",
"{",
"buf",
".",
"append",
"(",
"classloaderClass",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"buf",
".",
"append",
"(",
"lineSep",
")",
";",
"buf",
".",
"append",
"(",
"\" Permissions granted to CodeSource \"",
")",
".",
"append",
"(",
"cs",
")",
".",
"append",
"(",
"lineSep",
")",
";",
"if",
"(",
"col",
"!=",
"null",
")",
"{",
"Enumeration",
"<",
"Permission",
">",
"e",
"=",
"col",
".",
"elements",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\" {\"",
")",
".",
"append",
"(",
"lineSep",
")",
";",
"while",
"(",
"e",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"Permission",
"p",
"=",
"e",
".",
"nextElement",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\" \"",
")",
".",
"append",
"(",
"p",
".",
"toString",
"(",
")",
")",
".",
"append",
"(",
"\";\"",
")",
".",
"append",
"(",
"lineSep",
")",
";",
"}",
"buf",
".",
"append",
"(",
"\" }\"",
")",
";",
"}",
"else",
"{",
"buf",
".",
"append",
"(",
"\" {\"",
")",
".",
"append",
"(",
"lineSep",
")",
".",
"append",
"(",
"\" }\"",
")",
";",
"}",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}"
] | Print out permissions granted to a CodeSource. | [
"Print",
"out",
"permissions",
"granted",
"to",
"a",
"CodeSource",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManager.java#L243-L273 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManager.java | NoRethrowSecurityManager.isOffendingClass | boolean isOffendingClass(Class<?>[] classes, int j, ProtectionDomain pd2, Permission inPerm) {
// Return true if ...
return (!classes[j].getName().startsWith("java")) && // as long as not
// starting with
// java
(classes[j].getName().indexOf("com.ibm.ws.kernel.launch.internal.NoRethrowSecurityManager") == -1) && // not
// our
// SecurityManager
(classes[j].getName().indexOf("ClassLoader") == -1) && // not a
// class
// loader
// not the end of stack and next is not a class loader
((j == classes.length - 1) ? true : (classes[j + 1].getName().indexOf("ClassLoader") == -1)) &&
// lacks the required permissions
!pd2.implies(inPerm);
} | java | boolean isOffendingClass(Class<?>[] classes, int j, ProtectionDomain pd2, Permission inPerm) {
// Return true if ...
return (!classes[j].getName().startsWith("java")) && // as long as not
// starting with
// java
(classes[j].getName().indexOf("com.ibm.ws.kernel.launch.internal.NoRethrowSecurityManager") == -1) && // not
// our
// SecurityManager
(classes[j].getName().indexOf("ClassLoader") == -1) && // not a
// class
// loader
// not the end of stack and next is not a class loader
((j == classes.length - 1) ? true : (classes[j + 1].getName().indexOf("ClassLoader") == -1)) &&
// lacks the required permissions
!pd2.implies(inPerm);
} | [
"boolean",
"isOffendingClass",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
",",
"int",
"j",
",",
"ProtectionDomain",
"pd2",
",",
"Permission",
"inPerm",
")",
"{",
"// Return true if ...",
"return",
"(",
"!",
"classes",
"[",
"j",
"]",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"java\"",
")",
")",
"&&",
"// as long as not",
"// starting with",
"// java",
"(",
"classes",
"[",
"j",
"]",
".",
"getName",
"(",
")",
".",
"indexOf",
"(",
"\"com.ibm.ws.kernel.launch.internal.NoRethrowSecurityManager\"",
")",
"==",
"-",
"1",
")",
"&&",
"// not",
"// our",
"// SecurityManager",
"(",
"classes",
"[",
"j",
"]",
".",
"getName",
"(",
")",
".",
"indexOf",
"(",
"\"ClassLoader\"",
")",
"==",
"-",
"1",
")",
"&&",
"// not a",
"// class",
"// loader",
"// not the end of stack and next is not a class loader",
"(",
"(",
"j",
"==",
"classes",
".",
"length",
"-",
"1",
")",
"?",
"true",
":",
"(",
"classes",
"[",
"j",
"+",
"1",
"]",
".",
"getName",
"(",
")",
".",
"indexOf",
"(",
"\"ClassLoader\"",
")",
"==",
"-",
"1",
")",
")",
"&&",
"// lacks the required permissions",
"!",
"pd2",
".",
"implies",
"(",
"inPerm",
")",
";",
"}"
] | isOffendingClass determines the offending class from the classes defined
in the stack. | [
"isOffendingClass",
"determines",
"the",
"offending",
"class",
"from",
"the",
"classes",
"defined",
"in",
"the",
"stack",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/NoRethrowSecurityManager.java#L280-L295 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaBatchMessageDeletionDispatcher.java | SibRaBatchMessageDeletionDispatcher.cleanup | protected void cleanup() {
final String methodName = "cleanup";
if (TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName);
}
super.cleanup();
if (_successfulMessages.size() > 0) {
try {
deleteMessages(getMessageHandles(_successfulMessages), null);
} catch (final ResourceException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, FFDC_PROBE_1, this);
if (TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception);
}
} finally {
_successfulMessages.clear();
}
}
if (TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | java | protected void cleanup() {
final String methodName = "cleanup";
if (TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName);
}
super.cleanup();
if (_successfulMessages.size() > 0) {
try {
deleteMessages(getMessageHandles(_successfulMessages), null);
} catch (final ResourceException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, FFDC_PROBE_1, this);
if (TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception);
}
} finally {
_successfulMessages.clear();
}
}
if (TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | [
"protected",
"void",
"cleanup",
"(",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"cleanup\"",
";",
"if",
"(",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"super",
".",
"cleanup",
"(",
")",
";",
"if",
"(",
"_successfulMessages",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"try",
"{",
"deleteMessages",
"(",
"getMessageHandles",
"(",
"_successfulMessages",
")",
",",
"null",
")",
";",
"}",
"catch",
"(",
"final",
"ResourceException",
"exception",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exception",
",",
"CLASS_NAME",
"+",
"\".\"",
"+",
"methodName",
",",
"FFDC_PROBE_1",
",",
"this",
")",
";",
"if",
"(",
"TRACE",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exception",
"(",
"this",
",",
"TRACE",
",",
"exception",
")",
";",
"}",
"}",
"finally",
"{",
"_successfulMessages",
".",
"clear",
"(",
")",
";",
"}",
"}",
"if",
"(",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"}"
] | Invoked after all messages in the batch have been delivered. Deletes any
successful messages. | [
"Invoked",
"after",
"all",
"messages",
"in",
"the",
"batch",
"have",
"been",
"delivered",
".",
"Deletes",
"any",
"successful",
"messages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaBatchMessageDeletionDispatcher.java#L134-L169 | train |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/context/ExternalContext.java | ExternalContext.getContextName | public String getContextName()
{
ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get();
if (ctx == null)
{
throw new UnsupportedOperationException();
}
return ctx.getContextName();
} | java | public String getContextName()
{
ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get();
if (ctx == null)
{
throw new UnsupportedOperationException();
}
return ctx.getContextName();
} | [
"public",
"String",
"getContextName",
"(",
")",
"{",
"ExternalContext",
"ctx",
"=",
"_MyFacesExternalContextHelper",
".",
"firstInstance",
".",
"get",
"(",
")",
";",
"if",
"(",
"ctx",
"==",
"null",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"}",
"return",
"ctx",
".",
"getContextName",
"(",
")",
";",
"}"
] | Returns the name of the underlying context
@return the name or null
@since 2.0 | [
"Returns",
"the",
"name",
"of",
"the",
"underlying",
"context"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/context/ExternalContext.java#L156-L166 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java | AppClassLoader.addTransformer | @Override
public boolean addTransformer(final ClassFileTransformer cft) {
transformers.add(cft);
// Also recursively register with parent(s), until a non-AppClassLoader or GlobalSharedLibrary loader is encountered.
if (parent instanceof AppClassLoader) {
if (Util.isGlobalSharedLibraryLoader(((AppClassLoader) parent))) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "addTransformer - skipping parent loader because it is a GlobalSharedLibrary");
}
} else {
return ((AppClassLoader) parent).addTransformer(cft);
}
}
return true;
} | java | @Override
public boolean addTransformer(final ClassFileTransformer cft) {
transformers.add(cft);
// Also recursively register with parent(s), until a non-AppClassLoader or GlobalSharedLibrary loader is encountered.
if (parent instanceof AppClassLoader) {
if (Util.isGlobalSharedLibraryLoader(((AppClassLoader) parent))) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "addTransformer - skipping parent loader because it is a GlobalSharedLibrary");
}
} else {
return ((AppClassLoader) parent).addTransformer(cft);
}
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"addTransformer",
"(",
"final",
"ClassFileTransformer",
"cft",
")",
"{",
"transformers",
".",
"add",
"(",
"cft",
")",
";",
"// Also recursively register with parent(s), until a non-AppClassLoader or GlobalSharedLibrary loader is encountered.",
"if",
"(",
"parent",
"instanceof",
"AppClassLoader",
")",
"{",
"if",
"(",
"Util",
".",
"isGlobalSharedLibraryLoader",
"(",
"(",
"(",
"AppClassLoader",
")",
"parent",
")",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"addTransformer - skipping parent loader because it is a GlobalSharedLibrary\"",
")",
";",
"}",
"}",
"else",
"{",
"return",
"(",
"(",
"AppClassLoader",
")",
"parent",
")",
".",
"addTransformer",
"(",
"cft",
")",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Spring method to register the given ClassFileTransformer on this ClassLoader | [
"Spring",
"method",
"to",
"register",
"the",
"given",
"ClassFileTransformer",
"on",
"this",
"ClassLoader"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L135-L150 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java | AppClassLoader.getBundle | @Override
public Bundle getBundle() {
return parent instanceof GatewayClassLoader ? ((GatewayClassLoader) parent).getBundle() : parent instanceof LibertyLoader ? ((LibertyLoader) parent).getBundle() : null;
} | java | @Override
public Bundle getBundle() {
return parent instanceof GatewayClassLoader ? ((GatewayClassLoader) parent).getBundle() : parent instanceof LibertyLoader ? ((LibertyLoader) parent).getBundle() : null;
} | [
"@",
"Override",
"public",
"Bundle",
"getBundle",
"(",
")",
"{",
"return",
"parent",
"instanceof",
"GatewayClassLoader",
"?",
"(",
"(",
"GatewayClassLoader",
")",
"parent",
")",
".",
"getBundle",
"(",
")",
":",
"parent",
"instanceof",
"LibertyLoader",
"?",
"(",
"(",
"LibertyLoader",
")",
"parent",
")",
".",
"getBundle",
"(",
")",
":",
"null",
";",
"}"
] | Returns the Bundle of the Top Level class loader | [
"Returns",
"the",
"Bundle",
"of",
"the",
"Top",
"Level",
"class",
"loader"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L242-L245 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java | AppClassLoader.definePackage | @FFDCIgnore(value = { IllegalArgumentException.class })
private void definePackage(ByteResourceInformation byteResourceInformation, String packageName) {
// If the package is in a JAR then we can load the JAR manifest to see what package definitions it's got
Manifest manifest = byteResourceInformation.getManifest();
try {
// The URLClassLoader.definePackage() will NPE with a null manifest so use the other definePackage if we don't have a manifest
if (manifest == null) {
definePackage(packageName, null, null, null, null, null, null, null);
} else {
definePackage(packageName, manifest, byteResourceInformation.getResourceUrl());
}
} catch (IllegalArgumentException e) {
// Ignore, this happens if the package is already defined but it is hard to guard against this in a thread safe way. See:
// http://bugs.sun.com/view_bug.do?bug_id=4841786
}
} | java | @FFDCIgnore(value = { IllegalArgumentException.class })
private void definePackage(ByteResourceInformation byteResourceInformation, String packageName) {
// If the package is in a JAR then we can load the JAR manifest to see what package definitions it's got
Manifest manifest = byteResourceInformation.getManifest();
try {
// The URLClassLoader.definePackage() will NPE with a null manifest so use the other definePackage if we don't have a manifest
if (manifest == null) {
definePackage(packageName, null, null, null, null, null, null, null);
} else {
definePackage(packageName, manifest, byteResourceInformation.getResourceUrl());
}
} catch (IllegalArgumentException e) {
// Ignore, this happens if the package is already defined but it is hard to guard against this in a thread safe way. See:
// http://bugs.sun.com/view_bug.do?bug_id=4841786
}
} | [
"@",
"FFDCIgnore",
"(",
"value",
"=",
"{",
"IllegalArgumentException",
".",
"class",
"}",
")",
"private",
"void",
"definePackage",
"(",
"ByteResourceInformation",
"byteResourceInformation",
",",
"String",
"packageName",
")",
"{",
"// If the package is in a JAR then we can load the JAR manifest to see what package definitions it's got",
"Manifest",
"manifest",
"=",
"byteResourceInformation",
".",
"getManifest",
"(",
")",
";",
"try",
"{",
"// The URLClassLoader.definePackage() will NPE with a null manifest so use the other definePackage if we don't have a manifest",
"if",
"(",
"manifest",
"==",
"null",
")",
"{",
"definePackage",
"(",
"packageName",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}",
"else",
"{",
"definePackage",
"(",
"packageName",
",",
"manifest",
",",
"byteResourceInformation",
".",
"getResourceUrl",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"// Ignore, this happens if the package is already defined but it is hard to guard against this in a thread safe way. See:",
"// http://bugs.sun.com/view_bug.do?bug_id=4841786",
"}",
"}"
] | This method will define the package using the byteResourceInformation for a class to get the URL for this package to try to load a manifest. If a manifest can't be loaded
from the URL it will create the package with no package versioning or sealing information.
@param byteResourceInformation The information about the class file
@param packageName The name of the package to create | [
"This",
"method",
"will",
"define",
"the",
"package",
"using",
"the",
"byteResourceInformation",
"for",
"a",
"class",
"to",
"get",
"the",
"URL",
"for",
"this",
"package",
"to",
"try",
"to",
"load",
"a",
"manifest",
".",
"If",
"a",
"manifest",
"can",
"t",
"be",
"loaded",
"from",
"the",
"URL",
"it",
"will",
"create",
"the",
"package",
"with",
"no",
"package",
"versioning",
"or",
"sealing",
"information",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L439-L455 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java | AppClassLoader.findClassCommonLibraryClassLoaders | @FFDCIgnore(ClassNotFoundException.class)
private Class<?> findClassCommonLibraryClassLoaders(String name) throws ClassNotFoundException {
for (LibertyLoader cl : delegateLoaders) {
try {
return cl.findClass(name);
} catch (ClassNotFoundException e) {
// Ignore. Will throw at the end if class is not found.
}
}
// If we reached here, then the class was not loaded.
throw new ClassNotFoundException(name);
} | java | @FFDCIgnore(ClassNotFoundException.class)
private Class<?> findClassCommonLibraryClassLoaders(String name) throws ClassNotFoundException {
for (LibertyLoader cl : delegateLoaders) {
try {
return cl.findClass(name);
} catch (ClassNotFoundException e) {
// Ignore. Will throw at the end if class is not found.
}
}
// If we reached here, then the class was not loaded.
throw new ClassNotFoundException(name);
} | [
"@",
"FFDCIgnore",
"(",
"ClassNotFoundException",
".",
"class",
")",
"private",
"Class",
"<",
"?",
">",
"findClassCommonLibraryClassLoaders",
"(",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"for",
"(",
"LibertyLoader",
"cl",
":",
"delegateLoaders",
")",
"{",
"try",
"{",
"return",
"cl",
".",
"findClass",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"// Ignore. Will throw at the end if class is not found.",
"}",
"}",
"// If we reached here, then the class was not loaded.",
"throw",
"new",
"ClassNotFoundException",
"(",
"name",
")",
";",
"}"
] | Search for the class using the common library classloaders.
@param name The class name.
@return The class, if found.
@throws ClassNotFoundException if the class isn't found. | [
"Search",
"for",
"the",
"class",
"using",
"the",
"common",
"library",
"classloaders",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L534-L545 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java | AppClassLoader.findResourceCommonLibraryClassLoaders | private URL findResourceCommonLibraryClassLoaders(String name) {
for (LibertyLoader cl : delegateLoaders) {
URL url = cl.findResource(name);
if (url != null) {
return url;
}
}
// If we reached here, then the resource was not found.
return null;
} | java | private URL findResourceCommonLibraryClassLoaders(String name) {
for (LibertyLoader cl : delegateLoaders) {
URL url = cl.findResource(name);
if (url != null) {
return url;
}
}
// If we reached here, then the resource was not found.
return null;
} | [
"private",
"URL",
"findResourceCommonLibraryClassLoaders",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"LibertyLoader",
"cl",
":",
"delegateLoaders",
")",
"{",
"URL",
"url",
"=",
"cl",
".",
"findResource",
"(",
"name",
")",
";",
"if",
"(",
"url",
"!=",
"null",
")",
"{",
"return",
"url",
";",
"}",
"}",
"// If we reached here, then the resource was not found.",
"return",
"null",
";",
"}"
] | Search for the resource using the common library classloaders.
@param name The resource name.
@return The resource, if found. Otherwise null. | [
"Search",
"for",
"the",
"resource",
"using",
"the",
"common",
"library",
"classloaders",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L554-L563 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java | AppClassLoader.findResourcesCommonLibraryClassLoaders | private CompositeEnumeration<URL> findResourcesCommonLibraryClassLoaders(String name, CompositeEnumeration<URL> enumerations) throws IOException {
for (LibertyLoader cl : delegateLoaders) {
enumerations.add(cl.findResources(name));
}
return enumerations;
} | java | private CompositeEnumeration<URL> findResourcesCommonLibraryClassLoaders(String name, CompositeEnumeration<URL> enumerations) throws IOException {
for (LibertyLoader cl : delegateLoaders) {
enumerations.add(cl.findResources(name));
}
return enumerations;
} | [
"private",
"CompositeEnumeration",
"<",
"URL",
">",
"findResourcesCommonLibraryClassLoaders",
"(",
"String",
"name",
",",
"CompositeEnumeration",
"<",
"URL",
">",
"enumerations",
")",
"throws",
"IOException",
"{",
"for",
"(",
"LibertyLoader",
"cl",
":",
"delegateLoaders",
")",
"{",
"enumerations",
".",
"add",
"(",
"cl",
".",
"findResources",
"(",
"name",
")",
")",
";",
"}",
"return",
"enumerations",
";",
"}"
] | Search for the resources using the common library classloaders.
@param name The resource name.
@param enumerations A CompositeEnumeration<URL>, which is populated by this method.
@return The enumerations parameter is populated by this method and returned. It contains
all the resources found under all the common library classloaders. | [
"Search",
"for",
"the",
"resources",
"using",
"the",
"common",
"library",
"classloaders",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L574-L579 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java | AppClassLoader.copyLibraryElementsToClasspath | private void copyLibraryElementsToClasspath(Library library) {
Collection<File> files = library.getFiles();
addToClassPath(library.getContainers());
if (files != null && !!!files.isEmpty()) {
for (File file : files) {
nativeLibraryFiles.add(file);
}
}
for (Fileset fileset : library.getFilesets()) {
for (File file : fileset.getFileset()) {
nativeLibraryFiles.add(file);
}
}
} | java | private void copyLibraryElementsToClasspath(Library library) {
Collection<File> files = library.getFiles();
addToClassPath(library.getContainers());
if (files != null && !!!files.isEmpty()) {
for (File file : files) {
nativeLibraryFiles.add(file);
}
}
for (Fileset fileset : library.getFilesets()) {
for (File file : fileset.getFileset()) {
nativeLibraryFiles.add(file);
}
}
} | [
"private",
"void",
"copyLibraryElementsToClasspath",
"(",
"Library",
"library",
")",
"{",
"Collection",
"<",
"File",
">",
"files",
"=",
"library",
".",
"getFiles",
"(",
")",
";",
"addToClassPath",
"(",
"library",
".",
"getContainers",
"(",
")",
")",
";",
"if",
"(",
"files",
"!=",
"null",
"&&",
"!",
"!",
"!",
"files",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"nativeLibraryFiles",
".",
"add",
"(",
"file",
")",
";",
"}",
"}",
"for",
"(",
"Fileset",
"fileset",
":",
"library",
".",
"getFilesets",
"(",
")",
")",
"{",
"for",
"(",
"File",
"file",
":",
"fileset",
".",
"getFileset",
"(",
")",
")",
"{",
"nativeLibraryFiles",
".",
"add",
"(",
"file",
")",
";",
"}",
"}",
"}"
] | Takes the Files and Folders from the Library
and adds them to the various classloader classpaths
@param library | [
"Takes",
"the",
"Files",
"and",
"Folders",
"from",
"the",
"Library",
"and",
"adds",
"them",
"to",
"the",
"various",
"classloader",
"classpaths"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L597-L613 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java | AppClassLoader.checkLib | private static boolean checkLib(final File f, String basename) {
boolean fExists = System.getSecurityManager() == null ? f.exists() : AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
@Override
public Boolean run() {
return f.exists();
}
});
return fExists &&
(f.getName().equals(basename) || (isWindows(basename) && f.getName().equalsIgnoreCase(basename)));
} | java | private static boolean checkLib(final File f, String basename) {
boolean fExists = System.getSecurityManager() == null ? f.exists() : AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
@Override
public Boolean run() {
return f.exists();
}
});
return fExists &&
(f.getName().equals(basename) || (isWindows(basename) && f.getName().equalsIgnoreCase(basename)));
} | [
"private",
"static",
"boolean",
"checkLib",
"(",
"final",
"File",
"f",
",",
"String",
"basename",
")",
"{",
"boolean",
"fExists",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
"==",
"null",
"?",
"f",
".",
"exists",
"(",
")",
":",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"run",
"(",
")",
"{",
"return",
"f",
".",
"exists",
"(",
")",
";",
"}",
"}",
")",
";",
"return",
"fExists",
"&&",
"(",
"f",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"basename",
")",
"||",
"(",
"isWindows",
"(",
"basename",
")",
"&&",
"f",
".",
"getName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"basename",
")",
")",
")",
";",
"}"
] | Check if the given file's name matches the given library basename.
@param f The file to check.
@param basename The basename to compare the file against.
@return true if the file exists and its name matches the given basename.
false otherwise. | [
"Check",
"if",
"the",
"given",
"file",
"s",
"name",
"matches",
"the",
"given",
"library",
"basename",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L635-L644 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java | CompositeComponentELUtils.removeCompositeComponentForResolver | public static void removeCompositeComponentForResolver(FacesContext facesContext)
{
List<UIComponent> list = (List<UIComponent>) facesContext.getAttributes().get(CURRENT_COMPOSITE_COMPONENT_KEY);
if (list != null)
{
list.remove(list.size()-1);
}
} | java | public static void removeCompositeComponentForResolver(FacesContext facesContext)
{
List<UIComponent> list = (List<UIComponent>) facesContext.getAttributes().get(CURRENT_COMPOSITE_COMPONENT_KEY);
if (list != null)
{
list.remove(list.size()-1);
}
} | [
"public",
"static",
"void",
"removeCompositeComponentForResolver",
"(",
"FacesContext",
"facesContext",
")",
"{",
"List",
"<",
"UIComponent",
">",
"list",
"=",
"(",
"List",
"<",
"UIComponent",
">",
")",
"facesContext",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"CURRENT_COMPOSITE_COMPONENT_KEY",
")",
";",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"list",
".",
"remove",
"(",
"list",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"}",
"}"
] | Removes the composite component from the attribute map of the FacesContext.
@param facesContext | [
"Removes",
"the",
"composite",
"component",
"from",
"the",
"attribute",
"map",
"of",
"the",
"FacesContext",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java#L453-L460 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpEndpointImpl.java | HttpEndpointImpl.processHttpChainWork | public void processHttpChainWork(boolean enableEndpoint, boolean isPause) {
if (enableEndpoint) {
// enable the endpoint if it is currently disabled
// it's ok if the endpoint is stopped, the config update will occur @ next start
endpointState.compareAndSet(DISABLED, ENABLED);
if (httpPort >= 0) {
httpChain.enable();
}
if (httpsPort >= 0 && sslFactoryProvider.getService() != null) {
httpSecureChain.enable();
}
if (!isPause) {
// Use an update action so they pick up the new settings
performAction(updateAction);
} else {
updateAction.run();
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "endpoint disabled: " + (String) endpointConfig.get("id"));
}
// The endpoint has been disabled-- stop it now
endpointState.set(DISABLED);
if (!isPause) {
performAction(stopAction);
} else {
stopAction.run();
}
}
} | java | public void processHttpChainWork(boolean enableEndpoint, boolean isPause) {
if (enableEndpoint) {
// enable the endpoint if it is currently disabled
// it's ok if the endpoint is stopped, the config update will occur @ next start
endpointState.compareAndSet(DISABLED, ENABLED);
if (httpPort >= 0) {
httpChain.enable();
}
if (httpsPort >= 0 && sslFactoryProvider.getService() != null) {
httpSecureChain.enable();
}
if (!isPause) {
// Use an update action so they pick up the new settings
performAction(updateAction);
} else {
updateAction.run();
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "endpoint disabled: " + (String) endpointConfig.get("id"));
}
// The endpoint has been disabled-- stop it now
endpointState.set(DISABLED);
if (!isPause) {
performAction(stopAction);
} else {
stopAction.run();
}
}
} | [
"public",
"void",
"processHttpChainWork",
"(",
"boolean",
"enableEndpoint",
",",
"boolean",
"isPause",
")",
"{",
"if",
"(",
"enableEndpoint",
")",
"{",
"// enable the endpoint if it is currently disabled",
"// it's ok if the endpoint is stopped, the config update will occur @ next start",
"endpointState",
".",
"compareAndSet",
"(",
"DISABLED",
",",
"ENABLED",
")",
";",
"if",
"(",
"httpPort",
">=",
"0",
")",
"{",
"httpChain",
".",
"enable",
"(",
")",
";",
"}",
"if",
"(",
"httpsPort",
">=",
"0",
"&&",
"sslFactoryProvider",
".",
"getService",
"(",
")",
"!=",
"null",
")",
"{",
"httpSecureChain",
".",
"enable",
"(",
")",
";",
"}",
"if",
"(",
"!",
"isPause",
")",
"{",
"// Use an update action so they pick up the new settings",
"performAction",
"(",
"updateAction",
")",
";",
"}",
"else",
"{",
"updateAction",
".",
"run",
"(",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"endpoint disabled: \"",
"+",
"(",
"String",
")",
"endpointConfig",
".",
"get",
"(",
"\"id\"",
")",
")",
";",
"}",
"// The endpoint has been disabled-- stop it now",
"endpointState",
".",
"set",
"(",
"DISABLED",
")",
";",
"if",
"(",
"!",
"isPause",
")",
"{",
"performAction",
"(",
"stopAction",
")",
";",
"}",
"else",
"{",
"stopAction",
".",
"run",
"(",
")",
";",
"}",
"}",
"}"
] | Process HTTP chain work.
@param enableEndpoint True to enable the associated HTTP chain. False, to disable it.
@param isPause True if this call is being made for pause endpoint processing. | [
"Process",
"HTTP",
"chain",
"work",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpEndpointImpl.java#L344-L376 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.